# Path: linux_story/common.py
# def get_max_challenge_number():
#     '''
#     Returns:
#         str: string of the maximum challenge number as saved in
#             kano-profile.
#     '''
# 
#     # Hardcoded path, perhaps change it later
#     path = "/usr/share/kano-profile/rules/app_profiles.json"
#     f = open(path)
#     str_data = f.read()
#     f.close()
# 
#     dict_data = json.loads(str_data)
#     max_level = dict_data['linux-story']['max-level']
# 
#     return max_level
# 
# Path: linux_story/titles.py



from gi.repository import Gtk, GObject
from kano_profile.apps import load_app_state_variable
from linux_story.common import get_max_challenge_number
from linux_story.titles import challenges, chapters
        'challenge_highlighted': (GObject.SIGNAL_RUN_FIRST, None, (int,)),
    }

    width = 500
    height = 200

    def __init__(self):
        Gtk.Alignment.__init__(self, xalign=0.5, yalign=0.5, xscale=0, yscale=0)

        self.background = Gtk.EventBox()
        self.background.get_style_context().add_class("menu_background")
        self.background.set_size_request(self.width, self.height)

        self.add(self.background)

        # Find the greatest challenge that has been created according to
        # kano profile
        self.max_challenge = get_max_challenge_number()

        # Get the last unlocked challenge.
        self.last_unlocked_challenge = load_app_state_variable('linux-story', 'level')

        if self.last_unlocked_challenge:

            # If the last unlocked challenge is less than the max_challenge,
            # add one so the user can access the first locked-challenge.
            if self.last_unlocked_challenge < self.max_challenge:
                self.last_unlocked_challenge += 1

            # With this data, we need to decide which chapters are locked.

# Path: linux_story/common.py
# def get_max_challenge_number():
#     '''
#     Returns:
#         str: string of the maximum challenge number as saved in
#             kano-profile.
#     '''
# 
#     # Hardcoded path, perhaps change it later
#     path = "/usr/share/kano-profile/rules/app_profiles.json"
#     f = open(path)
#     str_data = f.read()
#     f.close()
# 
#     dict_data = json.loads(str_data)
#     max_level = dict_data['linux-story']['max-level']
# 
#     return max_level
# 
# Path: linux_story/titles.py



# Path: linux_story/gtk3/MenuScreen.py
from gi.repository import Gtk, GObject
from kano_profile.apps import load_app_state_variable
from linux_story.common import get_max_challenge_number
from linux_story.titles import challenges, chapters

        'challenge_highlighted': (GObject.SIGNAL_RUN_FIRST, None, (int,)),
    }

    width = 500
    height = 200

    def __init__(self):
        Gtk.Alignment.__init__(self, xalign=0.5, yalign=0.5, xscale=0, yscale=0)

        self.background = Gtk.EventBox()
        self.background.get_style_context().add_class("menu_background")
        self.background.set_size_request(self.width, self.height)

        self.add(self.background)

        # Find the greatest challenge that has been created according to
        # kano profile
        self.max_challenge = get_max_challenge_number()

        # Get the last unlocked challenge.
        self.last_unlocked_challenge = load_app_state_variable('linux-story', 'level')

        if self.last_unlocked_challenge:

            # If the last unlocked challenge is less than the max_challenge,
            # add one so the user can access the first locked-challenge.
            if self.last_unlocked_challenge < self.max_challenge:
                self.last_unlocked_challenge += 1

            # With this data, we need to decide which chapters are locked.

            self.last_unlocked_chapter = challenges[self.last_unlocked_challenge]['chapter']