Exemple #1
0
    def __init__(self, randomise=False, no_sync=False):
        Gtk.EventBox.__init__(self)

        # This is the avatar specific styling
        css_path = os.path.join(media_dir, "CSS/avatar_generator.css")
        apply_styling_to_screen(css_path)

        self.fixed = Gtk.Fixed()
        self.add(self.fixed)

        # Check profile information and load up either the created avatar or
        # the default
        self._create_menu(no_sync=no_sync)
        self._create_img_box(self.get_image_path())

        # This needs to be called after _create_menu()
        self._get_obj_data()

        self.width = self._imgbox.width
        self.height = self._imgbox.height
        self.set_size_request(self.width, self.height)

        self.fixed.put(self._imgbox, 0, 0)
        self.fixed.put(self._menu, 20, self.meny_y_pos)

        if randomise:
            # Create random button
            self.randomise_button = self._create_random_button()
            self.fixed.put(self.randomise_button, 645, self.meny_y_pos)

        self.connect('button-press-event', self._hide_pop_ups)
        self._update_img(None, None)
    def __init__(self):

        # Apply styling to window
        apply_styling_to_screen(self.CSS_FILE)

        Gtk.Window.__init__(self)
        self.fullscreen()
        self.set_keep_above(True)

        self.set_icon_name('kano-updater')
        self.set_title(_("Updater"))

        self._install_screen = Install()
        self.add(self._install_screen)

        kill_apps()

        self.show_all()
        self._install_screen.hide_game_play_label()
        self._set_wait_cursor()

        # For passing user input to the install thread
        self.user_input = None
        self.user_input_lock = Lock()

        # The lock is busy until the answer is ready
        self.user_input_lock.acquire()

        self._start_install()
        bring_flappy_judoka_to_front()
Exemple #3
0
    def __init__(self, cb, css_path):
        super(CharacterWindow, self).__init__()

        apply_styling_to_screen(css_path)
        self.get_style_context().add_class("character_window")
        self.set_decorated(False)
        self.close_cb = cb

        self.char_edit = CharacterCreator(randomise=True, no_sync=True)
        self.char_edit.connect("character_changed",
                               self._make_button_sensitive)
        vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
        self.add(vbox)

        vbox.pack_start(self.char_edit, False, False, 0)
        self._kano_button = KanoButton("OK")
        self._kano_button.connect("clicked", self.close_window)
        self._kano_button.pack_and_align()
        self._kano_button.set_sensitive(False)

        self.connect("delete-event", Gtk.main_quit)
        self.set_keep_above(True)

        vbox.pack_start(self._kano_button.align, False, False, 10)
        self.show_all()

        self.char_edit.show_pop_up_menu_for_category("judoka-faces")
        self.char_edit.select_category_button("judoka-faces")
Exemple #4
0
    def __init__(self, use_default=False):
        super(ProfileIcon, self).__init__()
        apply_styling_to_screen(common_css_path("profile_world_icon.css"))

        username = get_mixed_username()
        username_label = Gtk.Label(username)
        username_label.get_style_context().add_class("heading_desktop_label")

        # this is faster
        if use_default:
            level_label = Gtk.Label("Level 1")
            level_label.get_style_context().add_class("subheading_desktop_label")

            progress_img = Gtk.Image.new_from_file(self._get_progress_path(0))
            avatar_img = Gtk.Image.new_from_file(self._get_local_avatar_path())
        else:
            level, progress, _ = calculate_kano_level()
            level_label = Gtk.Label("Level {}".format(level))

            progress_img = Gtk.Image.new_from_file(self._get_progress_path(progress))
            avatar_img = Gtk.Image.new_from_file(self._get_avatar_path())

        level_label.get_style_context().add_class("subheading_desktop_label")
        self.put(progress_img, 0, 0)
        self.put(avatar_img, 13, 13)
        self.put(username_label, 90, 20)
        self.put(level_label, 90, 38)
        def __init__(self, wiface='wlan0', socket_id=0, no_confirm_ether=False):

            self.wiface = wiface
            self.network_list = []
            self.no_confirm_ether = no_confirm_ether

            # Default basic styling
            apply_common_to_screen()

            # Attach specific styling
            apply_styling_to_screen(self.CSS_PATH)

            # Set window
            base_class.__init__(
                self,
                _("Kano WiFi"),
                self.width,
                self.height,
                socket_id
            )

            self.top_bar = TopBar(_("Kano WiFi"))
            self.top_bar.set_prev_callback(self.refresh_networks)
            self.top_bar.set_close_callback(Gtk.main_quit)
            self.prev_handler = None
            self.connect('delete-event', Gtk.main_quit)
            self.set_keep_above(True)
            self.set_icon_name('kano-settings')
            self.set_decorated(True)

            if self._base_name == "Window":
                self.set_titlebar(self.top_bar)

            self._launch_application()
    def __init__(self, randomise=False, no_sync=False):
        Gtk.EventBox.__init__(self)

        # This is the avatar specific styling
        css_path = os.path.join(media_dir, "CSS/avatar_generator.css")
        apply_styling_to_screen(css_path)

        self.fixed = Gtk.Fixed()
        self.add(self.fixed)

        # Check profile information and load up either the created avatar or
        # the default
        self._create_menu(no_sync=no_sync)
        self._create_img_box(self.get_image_path())

        # This needs to be called after _create_menu()
        self._get_obj_data()

        self.width = self._imgbox.width
        self.height = self._imgbox.height
        self.set_size_request(self.width, self.height)

        self.fixed.put(self._imgbox, 0, 0)
        self.fixed.put(self._menu, 20, self.meny_y_pos)

        if randomise:
            # Create random button
            self.randomise_button = self._create_random_button()
            self.fixed.put(self.randomise_button, 645, self.meny_y_pos)

        self.connect('button-press-event', self._hide_pop_ups)
        self._update_img(None, None)
    def __init__(self, **keywords):
        Gtk.EventBox.__init__(self)
        apply_styling_to_screen(self.css_path)
        self.get_style_context().add_class("quest_screen_background")

        vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
        self.add(vbox)

        self.grid = Gtk.Grid()
        self.grid.set_column_spacing(10)
        self.grid.set_row_spacing(10)
        self.grid.set_margin_left(10)
        self.grid.set_margin_right(10)
        self.grid.set_margin_bottom(10)
        self.grid.set_margin_top(10)
        vbox.pack_start(self.grid, False, False, 0)

        # May be better elsewhere
        self.win = keywords["win"]
        self.quest = keywords["quest_info"]

        self.win.pack_in_main_content(self)

        # Pack in Progress
        progress_section = self.create_progress_section()
        self.grid.attach(progress_section, 0, 0, 1, 1)

        # Pack in Rewards
        rewards = self.create_reward_section()
        self.grid.attach(rewards, 1, 0, 1, 1)

        self.win.show_all()
        def __init__(self, wiface='wlan0', socket_id=0, no_confirm_ether=False):

            self.wiface = wiface
            self.network_list = []
            self.no_confirm_ether = no_confirm_ether

            # Default basic styling
            apply_common_to_screen()

            # Attach specific styling
            apply_styling_to_screen(self.CSS_PATH)

            # Set window
            base_class.__init__(
                self,
                _("Kano WiFi"),
                self.width,
                self.height,
                socket_id
            )

            self.top_bar = TopBar(_("Kano WiFi"))
            self.top_bar.set_prev_callback(self.refresh_networks)
            self.top_bar.set_close_callback(Gtk.main_quit)
            self.prev_handler = None
            self.connect('delete-event', Gtk.main_quit)
            self.set_keep_above(True)
            self.set_icon_name('kano-settings')
            self.set_decorated(True)

            if self._base_name == "Window":
                self.set_titlebar(self.top_bar)

            self._launch_application()
    def __init__(self):

        # Apply styling to window
        apply_styling_to_screen(self.CSS_FILE)

        Gtk.Window.__init__(self)
        self.fullscreen()
        self.set_keep_above(True)

        self.set_icon_name('kano-updater')
        self.set_title(_("Updater"))

        self._install_screen = Install()
        self.add(self._install_screen)

        kill_apps()

        self.show_all()
        self._install_screen.hide_game_play_label()
        self._set_wait_cursor()

        # For passing user input to the install thread
        self.user_input = None
        self.user_input_lock = Lock()

        # The lock is busy until the answer is ready
        self.user_input_lock.acquire()

        self._start_install()
        bring_flappy_judoka_to_front()
Exemple #10
0
 def __init__(self):
     super(MainWindow, self).__init__()
     self.set_decorated(False)
     self.set_size_request(500, 400)
     self.connect("delete-event", Gtk.main_quit)
     self.slide1()
     apply_styling_to_screen(self.css_path("style.css"))
Exemple #11
0
    def __init__(self, **keywords):
        Gtk.EventBox.__init__(self)
        apply_styling_to_screen(self.css_path)
        self.get_style_context().add_class('quest_screen_background')

        vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
        self.add(vbox)

        self.grid = Gtk.Grid()
        self.grid.set_column_spacing(10)
        self.grid.set_row_spacing(10)
        self.grid.set_margin_left(10)
        self.grid.set_margin_right(10)
        self.grid.set_margin_bottom(10)
        self.grid.set_margin_top(10)
        vbox.pack_start(self.grid, False, False, 0)

        # May be better elsewhere
        self.win = keywords['win']
        self.quest = keywords['quest_info']

        self.win.pack_in_main_content(self)

        # Pack in Progress
        progress_section = self.create_progress_section()
        self.grid.attach(progress_section, 0, 0, 1, 1)

        # Pack in Rewards
        rewards = self.create_reward_section()
        self.grid.attach(rewards, 1, 0, 1, 1)

        self.win.show_all()
    def __init__(self):

        # Apply styling to window
        apply_styling_to_screen(self.CSS_FILE)

        Gtk.Window.__init__(self)
        # self.fullscreen()
        # Gtk hack: set the width, height of the window to larger than screen
        # resolution in order fix set_keep_below(True) which doesn't work with fullscreen
        screen = Gdk.Screen.get_default()
        width = screen.get_width()
        height = screen.get_height()
        self.set_size_request(width, height + 80)
        self.set_keep_above(True)

        self.set_icon_name('kano-updater')
        self.set_title(_('Updater'))

        self._install_screen = Install()
        self.add(self._install_screen)

        kill_apps()

        self.show_all()
        self._install_screen.hide_game_play_label()
        self._set_wait_cursor()

        # For passing user input to the install thread
        self.user_input = None
        self.user_input_lock = Lock()

        # The lock is busy until the answer is ready
        self.user_input_lock.acquire()

        self._start_install()
Exemple #13
0
    def __init__(self, ctl):
        super(Desktop, self).__init__(ctl)
        apply_styling_to_screen(self.css_path("style.css"))

        # Flag to see whether to launch the character creator
        # and registration page.
        self._char_window_launched = False
        self._login_launched = False
    def __init__(self):
        apply_styling_to_screen(self.CSS_FILE)
        apply_styling_to_screen(self.COLOUR_CSS_FILE)

        Gtk.Window.__init__(self)
        self.connect('delete-event', self.close_window)
        self.get_style_context().add_class("main_window")
        self.maximize()
        self.set_title("Terminal Quest")
        self.set_icon_name("linux-story")
Exemple #15
0
    def __init__(self):
        apply_styling_to_screen(self.CSS_FILE)
        apply_styling_to_screen(self.COLOUR_CSS_FILE)

        Gtk.Window.__init__(self)
        self.connect('delete-event', self.close_window)
        self.get_style_context().add_class("main_window")
        self.maximize()
        self.set_title("Terminal Quest")
        self.set_icon_name("linux-story")
Exemple #16
0
    def __init__(self, win):
        Gtk.EventBox.__init__(self)
        self.get_style_context().add_class('quest_screen_background')

        self.checked_quests = False
        self.win = win
        self.win.pack_in_main_content(self)

        # Apply the styling from the Quests file
        apply_styling_to_screen(self.css_path)
        self.display_quests()
Exemple #17
0
    def __init__(self, win):
        Gtk.EventBox.__init__(self)
        self.get_style_context().add_class("quest_screen_background")

        self.checked_quests = False
        self.win = win
        self.win.pack_in_main_content(self)

        # Apply the styling from the Quests file
        apply_styling_to_screen(self.css_path)
        self.display_quests()
Exemple #18
0
    def __init__(self, list_of_names, signal_name):

        Gtk.EventBox.__init__(self)
        apply_styling_to_screen(CSS_PATH)

        # Initialise self._items
        self._set_items(list_of_names)

        self._signal_name = signal_name

        # This is the selected_identifier
        self._selected = None
        self.get_style_context().add_class('select_menu')
Exemple #19
0
    def __init__(self, title, description, is_plug=False, back_btn=False):
        self.back_button = None
        css_path = os.path.join(css_dir, "heading.css")
        apply_styling_to_screen(css_path)
        title_hbox = None

        if is_plug:
            title_hbox = Gtk.Box()
            close_button = Gtk.Button()
            close_button.set_image(set_from_name('cross'))
            close_button.get_style_context().add_class('back_button')
            close_button.connect('clicked', Gtk.main_quit)
            close_button.set_margin_top(15)
            attach_cursor_events(close_button)
            title_hbox.pack_end(close_button, True, True, 0)

            if back_btn:
                self.back_button = Gtk.Button()
                attach_cursor_events(self.back_button)
                self.back_button.get_style_context().add_class('back_button')
                # TODO: get better back icon
                self.back_button.set_image(set_from_name('dark_left_arrow'))
                self.back_button.set_margin_top(15)
                title_hbox.pack_start(self.back_button, True, False, 0)

            else:
                empty_button = Gtk.Button(" ")
                empty_button.get_style_context().add_class('transparent')
                title_hbox.pack_start(empty_button, True, True, 0)

        self.title = Gtk.Label(title)
        self.title.get_style_context().add_class('title')
        self.title.set_justify(Gtk.Justification.CENTER)
        self.container = Gtk.Box(orientation=Gtk.Orientation.VERTICAL,
                                 spacing=10)

        if is_plug:
            title_hbox.pack_start(self.title, True, True, 0)
            self.container.pack_start(title_hbox, False, False, 0)
        else:
            self.container.pack_start(self.title, False, False, 0)

        if description != "":
            self.description = Gtk.Label(description)
            self.description.set_justify(Gtk.Justification.CENTER)
            self.description.set_line_wrap(True)
            self.description_style = self.description.get_style_context()
            self.description_style.add_class('description')

            self.container.pack_start(self.description, False, False, 0)
Exemple #20
0
    def __init__(self, border_width=2):
        Gtk.EventBox.__init__(self)

        # Very hacky way to get a border (gg GTK): create a grey event box
        # which is a little bigger than the white event box containing the
        # widget
        apply_styling_to_screen(
            os.path.join(common_css_dir, 'multiline_entry.css')
        )
        self.get_style_context().add_class('gray-box')
        widget_box = Gtk.EventBox()
        widget_box.get_style_context().add_class('white-box')
        widget_box.set_margin_left(border_width)    # gray border width (px)
        widget_box.set_margin_right(border_width)
        widget_box.set_margin_top(border_width)
        widget_box.set_margin_bottom(border_width)
        self.add(widget_box)

        # putting the TextView into a ScrolledWindow so it doesn't resize
        # horiz & vert
        scrolled_window = ScrolledWindow()
        scrolled_window.set_vexpand(True)
        scrolled_window.set_hexpand(True)
        scrolled_window.set_policy(
            Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC
        )
        scrolled_window.apply_styling_to_widget()
        widget_box.add(scrolled_window)

        # creating the actual TextView
        self.text_view = Gtk.TextView()
        # break on words, then chars
        self.text_view.set_wrap_mode(Gtk.WrapMode.WORD_CHAR)
        # the white border inside the thin gray border
        self.text_view.set_margin_left(10)
        self.text_view.set_margin_right(10)
        self.text_view.set_margin_top(10)
        self.text_view.set_margin_bottom(10)
        scrolled_window.add(self.text_view)

        # placeholder text logic
        self.placeholder_text = None
        self.placeholder_text_set = False
        self.restore_buffer_handler_id = None
        self.clear_buffer_handler_id = None

        self.text_view.set_buffer(KanoTextBuffer())
        text_buffer = self.text_view.get_buffer()
        text_buffer.connect('changed', self._on_changed)
    def __init__(self, border_width=2):
        Gtk.EventBox.__init__(self)

        # Very hacky way to get a border (gg GTK): create a grey event box
        # which is a little bigger than the white event box containing the
        # widget
        apply_styling_to_screen(
            os.path.join(common_css_dir, 'multiline_entry.css')
        )
        self.get_style_context().add_class('gray-box')
        widget_box = Gtk.EventBox()
        widget_box.get_style_context().add_class('white-box')
        widget_box.set_margin_left(border_width)    # gray border width (px)
        widget_box.set_margin_right(border_width)
        widget_box.set_margin_top(border_width)
        widget_box.set_margin_bottom(border_width)
        self.add(widget_box)

        # putting the TextView into a ScrolledWindow so it doesn't resize
        # horiz & vert
        scrolled_window = ScrolledWindow()
        scrolled_window.set_vexpand(True)
        scrolled_window.set_hexpand(True)
        scrolled_window.set_policy(
            Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC
        )
        scrolled_window.apply_styling_to_widget()
        widget_box.add(scrolled_window)

        # creating the actual TextView
        self.text_view = Gtk.TextView()
        # break on words, then chars
        self.text_view.set_wrap_mode(Gtk.WrapMode.WORD_CHAR)
        # the white border inside the thin gray border
        self.text_view.set_margin_left(10)
        self.text_view.set_margin_right(10)
        self.text_view.set_margin_top(10)
        self.text_view.set_margin_bottom(10)
        scrolled_window.add(self.text_view)

        # placeholder text logic
        self.placeholder_text = None
        self.placeholder_text_set = False
        self.restore_buffer_handler_id = None
        self.clear_buffer_handler_id = None

        self.text_view.set_buffer(KanoTextBuffer())
        text_buffer = self.text_view.get_buffer()
        text_buffer.connect('changed', self._on_changed)
Exemple #22
0
    def __init__(self):
        apply_styling_to_screen(self.CSS_FILE)
        apply_styling_to_screen(self.COLOUR_CSS_FILE)

        Gtk.Window.__init__(self)
        self.connect('delete-event', self.close_window)
        self.get_style_context().add_class("main_window")
        self.maximize()
        self.set_title("Terminal Quest")
        self.set_icon_name("linux-story")

        # using the Gdk.Keymap to get events about the Caps Lock state
        keymap = Gdk.Keymap.get_for_display(self.get_display())
        keymap.connect('state-changed', self._on_keymap_state_changed)
        self.is_caps_lock_on = keymap.get_caps_lock_state()
Exemple #23
0
    def __init__(self, parent_pid):
        # Apply styling to window
        apply_styling_to_screen(self.CSS_FILE)

        Gtk.Window.__init__(self)
        self.fullscreen()
        self.set_keep_above(True)

        self.set_icon_name('kano-updater')
        self.set_title(_('Updater Splash'))

        self._relaunch_screen = Relaunch(parent_pid)
        self.add(self._relaunch_screen)

        self.show_all()
        self._set_wait_cursor()
    def __init__(self, win):
        Gtk.EventBox.__init__(self)

        self._win = win
        self._page = 0

        css_file = os.path.join(media_dir, "CSS/badge_screen.css")
        apply_styling_to_screen(css_file)

        self.badge_grid = BadgeGrid(win)
        bottom_bar = self._create_bottom_navigation_bar()

        self._win.pack_in_main_content(self.badge_grid)
        self._win.pack_in_bottom_bar(bottom_bar)
        self._load_page()

        self._win.show_all()
    def __init__(self, window_width):

        Gtk.Fixed.__init__(self)

        css_path = os.path.join(media_dir, "CSS/progress_bar.css")
        apply_styling_to_screen(css_path)

        # Height of the thin part of the progress bar
        self.height = 10

        # Height of the label
        self.label_height = 30
        self.label_width = 50

        # Allow for margin on either side of the progress bar
        self.total_width = window_width - 60

        self.progress = Gtk.EventBox()
        self.progress.get_style_context().add_class('progress_bar')

        self.rest_of_bar = Gtk.EventBox()
        self.rest_of_bar.get_style_context().add_class('rest_of_bar')

        self.progress_label = Gtk.Label()
        self.progress_label.set_alignment(xalign=0.5, yalign=0.5)

        self.endpoint_label = Gtk.Label()
        self.endpoint_label.set_alignment(xalign=0.5, yalign=0.5)

        self.label_background = Gtk.EventBox()
        self.label_background.get_style_context().add_class(
            'progress_background')
        self.label_background.set_size_request(self.label_width,
                                               self.label_height)
        self.label_background.add(self.progress_label)

        self.endpoint_background = Gtk.EventBox()
        self.endpoint_background.get_style_context().add_class(
            'endpoint_background')
        self.endpoint_background.set_size_request(self.label_width,
                                                  self.label_height)
        self.endpoint_background.add(self.endpoint_label)

        self.set_size_request(self.total_width, self.label_height)

        self.set_progress()
    def __init__(self, win):
        Gtk.EventBox.__init__(self)

        self._win = win
        self._page = 0

        css_file = os.path.join(media_dir, "CSS/badge_screen.css")
        apply_styling_to_screen(css_file)

        self.badge_grid = BadgeGrid(win)
        bottom_bar = self._create_bottom_navigation_bar()

        self._win.pack_in_main_content(self.badge_grid)
        self._win.pack_in_bottom_bar(bottom_bar)
        self._load_page()

        self._win.show_all()
    def __init__(self, challenge, step, debug):
        Gtk.Window.__init__(self)

        apply_styling_to_screen(self.CSS_FILE)
        apply_styling_to_screen(self.COLOUR_CSS_FILE)

        self.__debug = debug
        self.__setup_gtk_properties()
        self.__setup_keymap()
        self.is_busy = False
        self.connect("game_finished", self.finish_app)

        if challenge and step:
            self.__start_game_from_challenge(challenge, step)
        elif save_point_exists():
            self.__show_menu()
        else:
            self.__start_game_from_challenge("0", "1")
Exemple #28
0
    def __init__(self, challenge, step, debug):
        Gtk.Window.__init__(self)

        apply_styling_to_screen(self.CSS_FILE)
        apply_styling_to_screen(self.COLOUR_CSS_FILE)

        self.__debug = debug
        self.__setup_gtk_properties()
        self.__setup_keymap()
        self.is_busy = False
        self.connect("game_finished", self.finish_app)

        if challenge and step:
            self.__start_game_from_challenge(challenge, step)
        elif save_point_exists():
            self.__show_menu()
        else:
            self.__start_game_from_challenge("0", "1")
    def __init__(self, window_width):

        Gtk.Fixed.__init__(self)

        css_path = os.path.join(media_dir, "CSS/progress_bar.css")
        apply_styling_to_screen(css_path)

        # Height of the thin part of the progress bar
        self.height = 10

        # Height of the label
        self.label_height = 30
        self.label_width = 50

        # Allow for margin on either side of the progress bar
        self.total_width = window_width - 60

        self.progress = Gtk.EventBox()
        self.progress.get_style_context().add_class("progress_bar")

        self.rest_of_bar = Gtk.EventBox()
        self.rest_of_bar.get_style_context().add_class("rest_of_bar")

        self.progress_label = Gtk.Label()
        self.progress_label.set_alignment(xalign=0.5, yalign=0.5)

        self.endpoint_label = Gtk.Label()
        self.endpoint_label.set_alignment(xalign=0.5, yalign=0.5)

        self.label_background = Gtk.EventBox()
        self.label_background.get_style_context().add_class("progress_background")
        self.label_background.set_size_request(self.label_width, self.label_height)
        self.label_background.add(self.progress_label)

        self.endpoint_background = Gtk.EventBox()
        self.endpoint_background.get_style_context().add_class("endpoint_background")
        self.endpoint_background.set_size_request(self.label_width, self.label_height)
        self.endpoint_background.add(self.endpoint_label)

        self.set_size_request(self.total_width, self.label_height)

        self.set_progress()
Exemple #30
0
    def __init__(self):
        # Apply styling to window
        apply_styling_to_screen(self.CSS_FILE)

        Gtk.Window.__init__(self)
        self.fullscreen()
        self.set_keep_above(True)

        self.set_icon_name('kano-updater')
        self.set_title(_('Updater'))

        self._install_screen = Install()
        self.add(self._install_screen)

        kill_apps()

        self.show_all()
        self._set_wait_cursor()

        self._start_install()
Exemple #31
0
        def __init__(self,
                     screen_number=None,
                     screen_name=None,
                     socket_id=0,
                     onescreen=False):
            # Check for internet, if screen is 12 means no internet
            if screen_number == 12 or screen_name == 'no-internet':
                common.has_internet = False
            else:
                common.has_internet = is_internet()

            # Set combobox styling to the screen
            # Is done here so we don't attach the styling multiple times when
            # switching screens
            apply_styling_to_screen(self.CSS_PATH)
            apply_common_to_screen()
            KanoComboBox.apply_styling_to_screen()
            ScrolledWindow.apply_styling_to_screen(wide=True)

            # Set window
            base_class.__init__(self, _("Settings"), self.width, self.height,
                                socket_id)

            self.set_decorated(True)
            self.top_bar = TopBar(_("Settings"))
            self.top_bar.set_close_callback(self.close_window)
            self.prev_handler = None
            self.set_icon_name('kano-settings')

            if self._base_name == "Window":
                self.set_titlebar(self.top_bar)

            self._onescreen = onescreen

            self.connect('delete-event', Gtk.main_quit)
            # In case we are called from kano-world-launcher, terminate splash
            os.system('kano-stop-splash')
            # Init to Home Screen
            HomeScreen(self,
                       screen_number=screen_number,
                       screen_name=screen_name)
    def __init__(self, pulse=True, title="", rate=0.01):
        apply_colours_to_screen()
        apply_styling_to_screen(self.CSS_PATH)

        ProgressBar.__init__(self, pulse, rate)
        self.get_style_context().add_class("KanoProgressBar")

        self.win = Gtk.Window()
        self.win.get_style_context().add_class("KanoProgressBar")
        self.win.set_decorated(False)
        self.win.set_resizable(False)
        self.win.set_position(Gtk.WindowPosition.CENTER)
        self.win.connect("delete-event", Gtk.main_quit)

        box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
        self.win.add(box)

        label = Gtk.Label(title)
        label.set_padding(10, 10)
        label.get_style_context().add_class("KanoProgressBar")
        box.pack_start(label, False, False, 5)
        box.pack_start(self, False, False, 0)
Exemple #33
0
    def __init__(self, pulse=True, title="", rate=0.01):
        apply_colours_to_screen()
        apply_styling_to_screen(self.CSS_PATH)

        ProgressBar.__init__(self, pulse, rate)
        self.get_style_context().add_class("KanoProgressBar")

        self.win = Gtk.Window()
        self.win.get_style_context().add_class("KanoProgressBar")
        self.win.set_decorated(False)
        self.win.set_resizable(False)
        self.win.set_position(Gtk.WindowPosition.CENTER)
        self.win.connect("delete-event", Gtk.main_quit)

        box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
        self.win.add(box)

        label = Gtk.Label(title)
        label.set_padding(10, 10)
        label.get_style_context().add_class("KanoProgressBar")
        box.pack_start(label, False, False, 5)
        box.pack_start(self, False, False, 0)
    def __init__(self, offline=True):
        super(WorldIcon, self).__init__()
        apply_styling_to_screen(common_css_path("profile_world_icon.css"))

        kano_world_label = Gtk.Label("Kano World")
        kano_world_label.get_style_context().add_class("heading_desktop_label")

        # world icon path
        img_path = "/usr/share/kano-desktop/icons/kano-world-launcher.png"
        icon_img = Gtk.Image.new_from_file(img_path)

        self.put(icon_img, 0, 0)

        # Check here if there is a token (which there shouldn't be)
        if offline:
            status_label = Gtk.Label("SIGN UP")
            self.put(status_label, 60, 39)
        else:
            status_label = Gtk.Label("ONLINE")
            self.put(status_label, 68, 39)

        status_label.get_style_context().add_class("subheading_desktop_label")
        self.put(kano_world_label, 30, 21)
        def __init__(self, screen_number=None, screen_name=None,
                     socket_id=0, onescreen=False):
            # Check for internet, if screen is 12 means no internet
            if screen_number == 12 or screen_name == 'no-internet':
                common.has_internet = False
            else:
                common.has_internet = is_internet()

            # Set combobox styling to the screen
            # Is done here so we don't attach the styling multiple times when
            # switching screens
            apply_styling_to_screen(self.CSS_PATH)
            apply_common_to_screen()
            KanoComboBox.apply_styling_to_screen()
            ScrolledWindow.apply_styling_to_screen(wide=True)

            # Set window
            base_class.__init__(self, _("Settings"), self.width,
                                self.height, socket_id)

            self.set_decorated(True)
            self.top_bar = TopBar(_("Settings"))
            self.top_bar.set_close_callback(self.close_window)
            self.prev_handler = None
            self.set_icon_name('kano-settings')

            if self._base_name == "Window":
                self.set_titlebar(self.top_bar)

            self._onescreen = onescreen

            self.connect('delete-event', Gtk.main_quit)
            # In case we are called from kano-world-launcher, terminate splash
            os.system('kano-stop-splash')
            # Init to Home Screen
            HomeScreen(self, screen_number=screen_number, screen_name=screen_name)
    def _initialise_window(self):
        '''
        Inititlaises the gtk window
        '''
        self.last_click = 0

        self.app_name_opened = 'feedback-widget-opened'
        self.typeahead = None
        self.help_tip_message = 'Type your feedback here!'

        self.rotating_mode = True
        self.in_submit = False

        apply_styling_to_screen(media_dir() + 'css/widget.css')

        ScrolledWindow.apply_styling_to_screen(wide=False)

        self.visible = False
        self.set_hexpand(False)
        self.set_decorated(False)
        self.set_resizable(False)
        self.set_keep_above(False)
        self.set_property('skip-taskbar-hint', True)

        self._grid = grid = Gtk.Grid(hexpand=True, vexpand=True)

        qmark = Gtk.Label('?')
        qmark.get_style_context().add_class('qmark')

        qmark_centering = Gtk.Alignment(xalign=0.5, yalign=0.5)
        qmark_centering.add(qmark)

        qmark_box = Gtk.EventBox()
        qmark_box.get_style_context().add_class('qmark_box')
        qmark_box.add(qmark_centering)
        qmark_box.set_size_request(self.HEIGHT_COMPACT, self.HEIGHT_COMPACT)

        grid.attach(qmark_box, 0, 0, 1, 1)

        self._prompt = prompt = Gtk.Label(self.wprompts.get_current_prompt(),
                                          hexpand=False)
        prompt.get_style_context().add_class('prompt')
        prompt.set_justify(Gtk.Justification.LEFT)
        prompt.set_alignment(0.1, 0.5)
        prompt.set_size_request(410, -1)
        prompt.set_line_wrap(True)

        prompt_container = Gtk.Table(1, 1, False)
        prompt_container.attach(prompt, 0, 1, 0, 1, Gtk.AttachOptions.SHRINK | Gtk.AttachOptions.FILL)

        grid.attach(prompt_container, 1, 0, 2, 1)

        self._x_button = x_button = Gtk.Button('x')
        x_button.set_size_request(20, 20)
        x_button.connect('clicked', self._shrink)
        x_button.get_style_context().add_class('x_button')
        x_button.set_margin_right(20)

        x_button_ebox = Gtk.EventBox()
        x_button_ebox.add(x_button)
        x_button_ebox.connect("realize", self._set_cursor_to_hand_cb)

        x_button_align = Gtk.Alignment(xalign=1, yalign=0.5,
                                       xscale=0, yscale=0)
        x_button_align.add(x_button_ebox)

        grid.attach(x_button_align, 3, 0, 1, 1)

        self._gray_box = gray_box = Gtk.EventBox()
        gray_box.get_style_context().add_class('gray_box')
        gray_box.set_size_request(-1,
                                  self.HEIGHT_EXPANDED - self.HEIGHT_COMPACT)

        gray_box_centering = Gtk.Alignment(xalign=0, yalign=0, xscale=1.0,
                                           yscale=1.0)
        gray_box_centering.add(gray_box)

        grid.attach(gray_box_centering, 0, 1, 1, 2)

        self._ebox = Gtk.EventBox()
        self._ebox.get_style_context().add_class('scrolled_win')
        grid.attach(self._ebox, 1, 1, 2, 1)

        self._pack_input_widget()

        self._send = send = OrangeButton('SEND')
        apply_styling_to_widget(send.label, media_dir() + 'css/widget.css')
        send.set_sensitive(False)
        send.connect('clicked', self._send_clicked)
        send.set_margin_left(10)
        send.set_margin_right(20)
        send.set_margin_top(10)
        send.set_margin_bottom(15)
        send_align = Gtk.Alignment(xalign=1, yalign=0.5, xscale=0, yscale=0)
        send_align.add(send)

        grid.attach(send_align, 3, 2, 1, 1)

        self.set_main_widget(grid)
        self.show_all()

        self._dont_shrink = False
        self._shrink()

        self.connect("focus-out-event", self._shrink)
        self.connect("button-press-event", self._toggle)
 def apply_styling_to_screen():
     apply_styling_to_screen(KanoComboBox.CSS_PATH)
 def apply_styling_to_screen(wide=False):
     if wide:
         apply_styling_to_screen(ScrolledWindow.WIDE_CSS_PATH)
     else:
         apply_styling_to_screen(ScrolledWindow.NORMAL_CSS_PATH)
Exemple #39
0
 def apply_styling_to_screen():
     apply_styling_to_screen(KanoComboBox.CSS_PATH)
Exemple #40
0
    def _initialise_window(self):
        '''
        Inititlaises the gtk window
        '''
        self.last_click = 0

        self.app_name_opened = 'feedback-widget-opened'
        self.typeahead = None
        self.help_tip_message = _("Type your feedback here!")

        self.rotating_mode = True
        self.in_submit = False

        apply_styling_to_screen(media_dir() + 'css/widget.css')

        ScrolledWindow.apply_styling_to_screen(wide=False)

        self.visible = False
        self.set_hexpand(False)
        self.set_decorated(False)
        self.set_resizable(False)
        self.set_keep_above(False)
        self.set_property('skip-taskbar-hint', True)

        self._grid = grid = Gtk.Grid(hexpand=True, vexpand=True)

        qmark = Gtk.Label('?')
        qmark.get_style_context().add_class('qmark')

        qmark_centering = Gtk.Alignment(xalign=0.5, yalign=0.5)
        qmark_centering.add(qmark)

        qmark_box = Gtk.EventBox()
        qmark_box.get_style_context().add_class('qmark_box')
        qmark_box.add(qmark_centering)
        qmark_box.set_size_request(self.HEIGHT_COMPACT, self.HEIGHT_COMPACT)

        grid.attach(qmark_box, 0, 0, 1, 1)

        self._prompt = prompt = Gtk.Label(self.wprompts.get_current_prompt(),
                                          hexpand=False)
        prompt.get_style_context().add_class('prompt')
        prompt.set_justify(Gtk.Justification.LEFT)
        prompt.set_size_request(410, -1)
        prompt.set_line_wrap(True)

        prompt_align = Gtk.Alignment(xalign=0.5, yalign=0.5)
        prompt_align.add(prompt)

        prompt_ebox = Gtk.EventBox()
        prompt_ebox.add(prompt_align)

        grid.attach(prompt_ebox, 1, 0, 2, 1)

        self._x_button = x_button = Gtk.Button('x')
        x_button.set_size_request(20, 20)
        x_button.connect('clicked', self._shrink)
        x_button.get_style_context().add_class('x_button')
        x_button.set_margin_right(20)

        x_button_ebox = Gtk.EventBox()
        x_button_ebox.add(x_button)
        x_button_ebox.connect("realize", self._set_cursor_to_hand_cb)

        x_button_align = Gtk.Alignment(xalign=1, yalign=0.5,
                                       xscale=0, yscale=0)
        x_button_align.add(x_button_ebox)

        grid.attach(x_button_align, 3, 0, 1, 1)

        self._gray_box = gray_box = Gtk.EventBox()
        gray_box.get_style_context().add_class('gray_box')
        gray_box.set_size_request(-1,
                                  self.HEIGHT_EXPANDED - self.HEIGHT_COMPACT)

        gray_box_centering = Gtk.Alignment(xalign=0, yalign=0, xscale=1.0,
                                           yscale=1.0)
        gray_box_centering.add(gray_box)

        grid.attach(gray_box_centering, 0, 1, 1, 2)

        self._ebox = Gtk.EventBox()
        self._ebox.get_style_context().add_class('scrolled_win')
        grid.attach(self._ebox, 1, 1, 2, 1)

        self._pack_input_widget()

        self._send = send = OrangeButton('SEND')
        apply_styling_to_widget(send.label, media_dir() + 'css/widget.css')
        send.set_sensitive(False)
        send.connect('clicked', self._send_clicked)
        send.set_margin_left(10)
        send.set_margin_right(20)
        send.set_margin_top(10)
        send.set_margin_bottom(15)
        send_align = Gtk.Alignment(xalign=1, yalign=0.5, xscale=0, yscale=0)
        send_align.add(send)

        grid.attach(send_align, 3, 2, 1, 1)

        self.set_main_widget(grid)
        self.show_all()

        self._dont_shrink = False
        self._shrink()

        self.connect("focus-out-event", self._shrink)
        self.connect("button-press-event", self._toggle)