def slide2(self): self.clear_window() fixed = Gtk.Fixed() pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_size( self.media_path("world-slide.png"), 1000, 678 ) image = Gtk.Image.new_from_pixbuf(pixbuf) title = Gtk.Label("Kano World") title.get_style_context().add_class("title") desc = Gtk.Label( "Show off and share your creations to friends\n" + "family and other Kano users on Kano World.\n\n" + "Why not check it out now by clicking on the\n" + "icon to see what people have made today." ) desc.get_style_context().add_class("description") next_button = KanoButton("LET'S GO") next_button.connect("clicked", Gtk.main_quit) fixed.put(image, 0, 0) fixed.put(title, 415, 370) fixed.put(desc, 310, 420) fixed.put(next_button, 440, 580) self.add(fixed) self.show_all()
def __init__(self, win, title, description, original_overscan=None): Gtk.Box.__init__(self, orientation=Gtk.Orientation.VERTICAL) self.kano_button = KanoButton(_("APPLY CHANGES")) self.kano_button.connect('button-release-event', self.apply_changes) self.kano_button.pack_and_align() self.heading = Heading(title, description) self.pack_start(self.heading.container, False, False, 0) self.win = win self.win.set_main_widget(self) self.win.top_bar.enable_prev() # Launch pipe for the overscan c code launch_pipe() self.overscan_values = get_overscan_status() self.original_overscan = original_overscan # Pass original overscan values between the classes # If original_overscan hasn't been generated yet, get it from current # overscan status. Alternatively, maybe read this from a file in future if original_overscan is None: self.original_overscan = get_overscan_status() # Reset button self.reset_button = OrangeButton() reset_icon_path = os.path.join(common.media, '/Icons/reset.png') reset_image = Gtk.Image().new_from_file(reset_icon_path) self.reset_button.set_image(reset_image) self.reset_button.connect('button_press_event', self.reset)
def __init__(self, img_path, title, description): Gtk.Box.__init__(self, orientation=Gtk.Orientation.VERTICAL) if img_path: self.image = Gtk.Image.new_from_file(img_path) self.pack_start(self.image, False, False, 0) self.heading = Heading(title, description) icon_path = os.path.join(MEDIA_DIR, "play-sound.png") self.kano_button = KanoButton(text="PLAY SOUND", color="blue", icon_filename=icon_path) self.kano_button.pack_and_align() self.kano_button.set_margin_top(10) self.pack_start(self.heading.container, False, False, 0) self.pack_start(self.kano_button.align, False, False, 0) button_box = Gtk.ButtonBox(spacing=15) button_box.set_layout(Gtk.ButtonBoxStyle.CENTER) self.yes_button = KanoButton("YES") self.yes_button.set_sensitive(False) self.no_button = KanoButton("NO", color="red") self.no_button.set_sensitive(False) button_box.pack_start(self.yes_button, False, False, 0) button_box.pack_start(self.no_button, False, False, 0) button_box.set_margin_bottom(5) self.pack_start(button_box, False, False, 15)
def __init__(self, win): Gtk.Box.__init__(self, orientation=Gtk.Orientation.VERTICAL) self.win = win self.win.set_main_widget(self) # Main image image = Gtk.Image.new_from_file(media + "/Graphics/no-internet-screen.png") # Orange button later_button = OrangeButton(_("Later")) later_button.connect('button-release-event', self.win.close_window) # Green button self.kano_button = KanoButton(_("CONNECT NOW")) self.kano_button.pack_and_align() self.kano_button.connect('button-release-event', self.go_to_wifi) self.kano_button.connect('key-release-event', self.go_to_wifi) # Text label text_align = self.create_text_align() # Place elements image.set_margin_top(50) image.set_margin_bottom(30) self.pack_start(image, False, False, 0) self.pack_start(text_align, False, False, 2) self.pack_start(self.kano_button.align, False, False, 10) self.pack_start(later_button, False, False, 3) # Refresh window self.win.show_all()
def __init__(self, size_x=400, size_y=150): Gtk.Grid.__init__(self) self.set_row_spacing(10) self.set_column_spacing(10) scroll = ScrolledWindow() scroll.set_size_request(size_x, size_y) scroll.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC) self.edit_list_store = Gtk.ListStore(str) self.edit_list = Gtk.TreeView(self.edit_list_store) self.edit_list.set_headers_visible(False) renderer = Gtk.CellRendererText() renderer.set_property('editable', True) renderer.connect('edited', self._item_edited_handler) renderer.connect('editing-started', self._item_edit_started) renderer.connect('editing-canceled', self._item_edit_canceled) column = Gtk.TreeViewColumn(cell_renderer=renderer, text=0) self.edit_list.append_column(column) self._add_btn = KanoButton(_("ADD")) self._add_btn.connect('button-release-event', self.add) self._rm_btn = KanoButton(_("REMOVE")) self._set_rm_btn_state() self._rm_btn.connect('button-release-event', self.rm) scroll.add_with_viewport(self.edit_list) self.attach(scroll, 0, 0, 2, 1) self.attach(self._add_btn, 0, 1, 1, 1) self.attach(self._rm_btn, 1, 1, 1, 1)
def __init__(self, win): Gtk.Box.__init__(self, orientation=Gtk.Orientation.VERTICAL) self.win = win self.win.set_main_widget(self) self.win.set_decorated(True) title = Heading(_("Kano World"), _("Choose a cool name and secure password")) self.pack_start(title.container, False, False, 0) self.data_screen = GetData() # TODO: refactor this self.data_screen.connect('widgets-filled', self._enable_register_button) self.data_screen.connect('widgets-empty', self._disable_register_button) self.add(self.data_screen) self.register_button = KanoButton(_("JOIN KANO WORLD")) self.register_button.set_sensitive(False) self.register_button.set_margin_top(10) self.register_button.set_margin_left(30) self.register_button.set_margin_right(30) self.register_button.set_margin_bottom(30) self.register_button.connect('clicked', self._on_register_button) self.pack_end(self.register_button, False, False, 0) self.win.show_all()
def __init__(self, kano_button_text, orange_text="", orange_text_2="", orange_text_3=""): Gtk.Box.__init__(self) self.kano_button = KanoButton(kano_button_text) if orange_text != "": self.orange_button = OrangeButton(orange_text) self.pack_start(self.orange_button, False, False, 0) self.pack_start(self.kano_button, False, False, 0) if orange_text_2 == "": # The empty label is to centre the kano_button label = Gtk.Label(" ") self.pack_start(label, False, False, 0) else: self.orange_button2 = OrangeButton(orange_text_2) if orange_text_3 == "": self.pack_start(self.orange_button2, False, False, 0) else: # If two orange button texts, we align them vertically self.vertbox = Gtk.Box( orientation=Gtk.Orientation.VERTICAL, spacing=6) self.add(self.vertbox) self.orange_button3 = OrangeButton(orange_text_3) self.vertbox.pack_start(self.orange_button2, False, False, 0) self.vertbox.pack_start(self.orange_button3, False, False, 0) else: self.pack_start(self.kano_button, False, False, 0)
class Template(Gtk.Box): def __init__(self, title, description, button_text, is_plug=False, back_btn=False): Gtk.Box.__init__(self, orientation=Gtk.Orientation.VERTICAL) self.title = Heading(title, description, is_plug, back_btn) self.title.container.set_margin_bottom(0) self.box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL) self.align = Gtk.Alignment(xscale=0, yscale=0, xalign=0.5, yalign=0.3) self.align.add(self.box) self.kano_button = KanoButton(button_text) self.kano_button.pack_and_align() self.kano_button.align.set_padding(0, 30, 0, 0) self.pack_start(self.title.container, False, False, 0) self.pack_start(self.align, True, True, 0) self.pack_end(self.kano_button.align, False, False, 0) def set_prev_callback(self, cb): self.title.set_prev_callback(cb)
def __init__(self, win, char_creator): Gtk.EventBox.__init__(self) self._win = win # Should this be inherited, passed as a variable, or global? # Could be a member variable in window. # self.char_creator = self._win.get_char_creator() self.char_creator = char_creator self._win.pack_in_main_content(self.char_creator) self.char_creator.reset_selected_menu_items() save_changes_button = KanoButton(_("Save changes").upper()) save_changes_button.connect("clicked", self.save_changes) discard_changes_button = OrangeButton(_("Discard").upper()) discard_changes_button.connect("clicked", self.discard) discard_changes_button.set_margin_left(100) empty_label = Gtk.Label("") button_box = Gtk.ButtonBox() button_box.pack_start(discard_changes_button, False, False, 0) button_box.pack_start(save_changes_button, False, False, 0) button_box.pack_start(empty_label, False, False, 0) self._win.pack_in_bottom_bar(button_box) self._win.show_all() # Hide all the pop ups self.char_creator._hide_pop_ups()
def third_scroll(self): self._clear() heading = Gtk.Label('New quest') add_class(heading, 'scroll-heading') world = Gtk.Image.new_from_file(self._stage.media_path('world.png')) copy = [ "Journey to Kano World", ] text_widgets = self._get_text_widgets(copy) button = KanoButton('OK', color='orange') button.connect('clicked', cb_wrapper, self._stage._ctl.next_stage) heading.set_margin_top(35) self._vbox.pack_start(heading, False, False, 0) world.set_margin_top(35) self._vbox.pack_start(world, False, False, 0) text_widgets[0].set_margin_top(40) for w in text_widgets: self._vbox.pack_start(w, False, False, 0) button.set_margin_top(40) button.set_margin_left(80) button.set_margin_right(80) self._vbox.pack_start(button, False, False, 0) self.show_all()
def slide1(self): fixed = Gtk.Fixed() pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_size( self.media_path("apps-slide.png"), 1000, 678 ) image = Gtk.Image.new_from_pixbuf(pixbuf) title1 = Gtk.Label("Get Started") title1.get_style_context().add_class("title") title2 = Gtk.Label("Apps") title2.get_style_context().add_class("title") desc = Gtk.Label( "Create and play with\n" + "Kano's Apps to make and save your\n" + "own code masterpieces, from games\n" + "and minecraft world, to art and music pieces..." ) desc.get_style_context().add_class("description") next_button = KanoButton("NEXT") next_button.connect("clicked", self.slide2_wrapper) fixed.put(image, 0, 0) fixed.put(title1, 460, 40) fixed.put(title2, 60, 400) fixed.put(desc, 60, 450) fixed.put(next_button, 460, 580) self.add(fixed) self.show_all()
def __init__(self, user, greeter): Gtk.Grid.__init__(self) self.get_style_context().add_class('password') self.set_row_spacing(10) self.greeter = greeter self.user = user self.title = self._set_title() self.attach(self.title.container, 0, 0, 1, 1) self.label = Gtk.Label(user) self.label.get_style_context().add_class('login') self.attach(self.label, 0, 1, 1, 1) self.password = Gtk.Entry() self.password.set_visibility(False) self.password.set_alignment(0.5) self.password.connect('activate', self._login_cb) self.attach(self.password, 0, 2, 1, 1) self.login_btn = KanoButton(_('Login').upper()) self.login_btn.connect('clicked', self._login_cb) self.attach(self.login_btn, 0, 3, 1, 1) # Protect against removing the last Kano user # so you do not get locked out from logging into the Kit system_users = KanoUserList().get_users() if len(system_users) > 1: delete_account_btn = OrangeButton(_('Remove Account')) delete_account_btn.connect('clicked', self.delete_user) self.attach(delete_account_btn, 0, 4, 1, 1)
def _create_refresh_connect_buttons(self): '''Create the buttons used for the refresh button and the to connect to a network, and pack them into a button box. Returns the button box. ''' self._connect_btn = KanoButton(_("CONNECT")) self._connect_btn.pack_and_align() self.connect_handler = self._connect_btn.connect( 'clicked', self._first_time_connect ) self._connect_btn.set_sensitive(False) self._refresh_btn = self._create_refresh_button() # For now, show both connect and refresh buttons buttonbox = Gtk.ButtonBox() buttonbox.set_layout(Gtk.ButtonBoxStyle.CENTER) buttonbox.set_spacing(10) buttonbox.pack_start(self._refresh_btn, False, False, 0) buttonbox.pack_start(self._connect_btn.align, False, False, 0) if self._win.is_plug(): self._skip_btn = WhiteButton(_("Skip")) buttonbox.pack_start(self._skip_btn, False, False, 0) self._skip_btn.connect('clicked', self.skip) else: blank_label = Gtk.Label("") buttonbox.pack_start(blank_label, False, False, 0) return buttonbox
class Template(Gtk.Box): def __init__( self, title, description, button_text, is_plug=False, back_btn=False ): Gtk.Box.__init__(self, orientation=Gtk.Orientation.VERTICAL) self.title = Heading(title, description, is_plug, back_btn) self.title.container.set_margin_bottom(0) self.box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL) self.align = Gtk.Alignment(xscale=0, yscale=0, xalign=0.5, yalign=0.3) self.align.add(self.box) self.kano_button = KanoButton(button_text) self.kano_button.pack_and_align() self.kano_button.align.set_padding(0, 30, 0, 0) self.pack_start(self.title.container, False, False, 0) self.pack_start(self.align, True, True, 0) self.pack_end(self.kano_button.align, False, False, 0) def set_prev_callback(self, cb): self.title.set_prev_callback(cb)
def __init__(self, title, description, button_text, orange_button_text=None): Gtk.Box.__init__(self, orientation=Gtk.Orientation.VERTICAL) self.sw = ScrolledWindow() self.sw.apply_styling_to_widget(wide=False) self.title = Heading(title, description) self.kano_button = KanoButton(button_text) self.kano_button.pack_and_align() self.pack_start(self.title.container, False, False, 0) self.pack_start(self.sw, True, True, 0) if orange_button_text: box_align = Gtk.Alignment(xscale=0, xalign=0.5) button_box = Gtk.ButtonBox(orientation=Gtk.Orientation.HORIZONTAL, spacing=40) label = Gtk.Label("") self.orange_button = OrangeButton(orange_button_text) button_box.pack_start(label, False, False, 0) button_box.pack_start(self.kano_button.align, False, False, 0) button_box.pack_start(self.orange_button, False, False, 0) box_align.add(button_box) self.pack_start(box_align, False, False, 0) else: self.pack_start(self.kano_button.align, False, False, 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")
def __init__(self, title, description, left_btn_text, right_btn_text, buttons_shown): Gtk.Box.__init__(self, orientation=Gtk.Orientation.VERTICAL) self.title = Heading(title, description) self.title.container.set_margin_bottom(0) self.sw = ScrolledWindow() self.sw.apply_styling_to_widget(wide=False) self.left_button = KanoButton(left_btn_text, color='orange') self.right_button = KanoButton(right_btn_text, color='green') kano_button_box = Gtk.ButtonBox() kano_button_box.set_layout(Gtk.ButtonBoxStyle.CENTER) kano_button_box.set_spacing(20) if buttons_shown == 2: kano_button_box.pack_start(self.left_button, False, False, 0) kano_button_box.pack_start(self.right_button, False, False, 0) self.pack_start(self.title.container, False, False, 0) self.pack_start(self.sw, True, True, 0) self.pack_end(kano_button_box, False, False, 0)
def __init__(self, win, char_creator): Gtk.EventBox.__init__(self) self._win = win # Should this be inherited, passed as a variable, or global? # Could be a member variable in window. # self.char_creator = self._win.get_char_creator() self.char_creator = char_creator self._win.pack_in_main_content(self.char_creator) self.char_creator.reset_selected_menu_items() self._save_changes_button = KanoButton(_("Save changes").upper()) self._save_changes_button.connect('clicked', self.save_changes) self._save_changes_button.set_sensitive(False) self.char_creator.connect('character_changed', self._make_button_sensitive) discard_changes_button = OrangeButton(_("Discard").upper()) discard_changes_button.connect('clicked', self.discard) discard_changes_button.set_margin_left(100) empty_label = Gtk.Label("") button_box = Gtk.ButtonBox() button_box.pack_start(discard_changes_button, False, False, 0) button_box.pack_start(self._save_changes_button, False, False, 0) button_box.pack_start(empty_label, False, False, 0) self._win.pack_in_bottom_bar(button_box) self._win.show_all() # Hide all the pop ups self.char_creator._hide_pop_ups()
def first_scroll(self): self._clear() copy = [ "Quests are a series of tasks that you", "can complete on your Kano to get", "great rewards." ] text_widgets = self._get_text_widgets(copy) img_path = self._stage.media_path('chest-closed.png') chest = Gtk.Image.new_from_file(img_path) button = KanoButton('NEXT', color='orange') button.connect('clicked', cb_wrapper, self.second_scroll) text_widgets[0].set_margin_top(30) for w in text_widgets: self._vbox.pack_start(w, False, False, 0) chest.set_margin_top(60) self._vbox.pack_start(chest, False, False, 0) button.set_margin_top(70) button.set_margin_left(80) button.set_margin_right(80) self._vbox.pack_start(button, False, False, 0) self.show_all()
class KanoButtonBox(Gtk.Box): def __init__(self, kano_button_text, orange_text="", orange_text_2=""): Gtk.Box.__init__(self) self.kano_button = KanoButton(kano_button_text) if not orange_text == "": self.orange_button = OrangeButton(orange_text) self.pack_start(self.orange_button, False, False, 0) self.pack_start(self.kano_button, False, False, 0) if orange_text_2 == "": # The empty label is to centre the kano_button label = Gtk.Label(" ") self.pack_start(label, False, False, 0) else: self.orange_button2 = OrangeButton(orange_text_2) self.pack_start(self.orange_button2, False, False, 0) else: self.pack_start(self.kano_button, False, False, 0) def get_kano_button(self): return self.kano_button def set_kano_button_cb(self, cb, args=[]): self.kano_button.connect('button-release-event', cb, args) def set_orange_button_cb(self, cb, args=[]): self.orange_button.connect('button-release-event', cb, args) def set_orange_button2_cb(self, cb, args=None): self.orange_button2.connect('button-release-event', cb, args)
def second_scroll(self): self._clear() ticks = Gtk.Image.new_from_file(self._stage.media_path('ticks.png')) copy = ["Complete all of the ticks in a", "quest to unlock rewards."] text_widgets = self._get_text_widgets(copy) chest = Gtk.Image.new_from_file( self._stage.media_path('chest-open.png')) button = KanoButton('NEXT', color='orange') button.connect('clicked', cb_wrapper, self.third_scroll) ticks.set_margin_top(20) self._vbox.pack_start(ticks, False, False, 0) text_widgets[0].set_margin_top(40) for w in text_widgets: self._vbox.pack_start(w, False, False, 0) chest.set_margin_top(35) self._vbox.pack_start(chest, False, False, 0) button.set_margin_top(40) button.set_margin_left(80) button.set_margin_right(80) self._vbox.pack_start(button, False, False, 0) self.show_all()
def __init__(self, stage, overscan_ctl, next_cb): super(Window2, self).__init__() add_class(self, 'overscan-window') head_img = Gtk.Image.new_from_file(stage.media_path('hint2.png')) box = Gtk.VBox() self.add(box) box.pack_start(head_img, False, False, 0) heading = Gtk.Label('Use UP and DOWN keys') heading.set_margin_top(25) heading.set_margin_bottom(25) add_class(heading, 'notebook-heading') box.pack_start(heading, False, False, 0) label_copy = 'Stretch or shrink your screen, until the white lines' text1 = Gtk.Label(label_copy) text1.set_margin_bottom(5) add_class(text1, 'notebook-text') box.pack_start(text1, False, False, 0) text2 = Gtk.Label('are lined up with the edges') text2.set_margin_bottom(25) add_class(text2, 'notebook-text') box.pack_start(text2, False, False, 0) buttons = Gtk.HBox(halign=Gtk.Align.CENTER) buttons.set_margin_bottom(25) done = KanoButton('DONE', color='green') buttons.pack_start(done, False, False, 0) done.connect('clicked', cb_wrapper, next_cb) box.pack_start(buttons, False, False, 0)
def __init__(self, win): Gtk.Box.__init__(self, orientation=Gtk.Orientation.VERTICAL) self.win = win self.win.set_main_widget(self) self.win.top_bar.enable_prev() self.win.change_prev_callback(self.win.go_to_home) self.added_or_removed_account = False main_heading = Heading( _("System account settings"), _("Set your account") ) self.pass_button = KanoButton(_("CHANGE PASSWORD")) self.pass_button.pack_and_align() self.pass_button.connect('button-release-event', self.go_to_password_screen) self.pass_button.connect('key-release-event', self.go_to_password_screen) self.add_button = KanoButton(_("ADD ACCOUNT")) self.add_button.set_size_request(200, 44) self.add_button.connect('button-release-event', self.add_account) self.add_button.connect('key-release-event', self.add_account) self.remove_button = KanoButton(_("REMOVE ACCOUNT"), color='red') self.remove_button.set_size_request(200, 44) self.remove_button.connect('button-release-event', self.remove_account_dialog) self.remove_button.connect('key-release-event', self.remove_account_dialog) button_container = Gtk.Box() button_container.pack_start(self.add_button, False, False, 10) button_container.pack_start(self.remove_button, False, False, 10) button_align = Gtk.Alignment(xscale=0, xalign=0.5) button_align.add(button_container) accounts_heading = Heading( _("Accounts"), _("Add or remove accounts") ) # Check if we already scheduled an account add or remove # We import kano-init locally to avoid circular dependency # the packages. try: from kano_init.utils import is_any_task_scheduled if is_any_task_scheduled(): self.disable_buttons() except ImportError: self.disable_buttons() self.pack_start(main_heading.container, False, False, 0) self.pack_start(self.pass_button.align, False, False, 0) self.pack_start(accounts_heading.container, False, False, 0) self.pack_start(button_align, False, False, 0) self.win.show_all()
def __init__(self, stage, image_path, image_scale, image_align, title, copy, buttons): super(Notebook, self).__init__() self.add( Gtk.Image.new_from_file(stage.media_path('lonely-notebook.png'))) fixed = Gtk.Fixed() self.add_overlay(fixed) self._eb = Gtk.EventBox() add_class(self._eb, 'notebook-content-area') self._eb.set_size_request(415, 460) fixed.put(self._eb, 20, 70) vbox = Gtk.VBox(False, 0) vbox.set_vexpand(True) vbox.set_hexpand(True) vbox.set_margin_left(10) vbox.set_margin_right(10) img = scale_image(Gtk.Image.new_from_file(image_path), image_scale) img_align = Gtk.Alignment.new(image_align, 0.5, 0, 0) img_align.add(img) img_align.set_vexpand(True) img_align.set_hexpand(True) vbox.pack_start(img_align, False, False, 0) heading = Gtk.Label(title) add_class(heading, 'notebook-heading') copy_widgets = [] for line in copy: l = Gtk.Label(line) l.set_line_wrap(False) l.set_justify(Gtk.Justification.CENTER) add_class(l, 'notebook-text') l.set_halign(Gtk.Align.CENTER) copy_widgets.append(l) # Pack heading vbox.pack_start(heading, False, False, 0) heading.set_margin_top(15) heading.set_margin_bottom(15) for w in copy_widgets: vbox.pack_start(w, False, False, 3) hbox = Gtk.HBox(False, 10) hbox.set_margin_top(15) hbox.set_halign(Gtk.Align.CENTER) for b in buttons: button = KanoButton(b['label'], color=b['color']) button.connect('clicked', cb_wrapper, b['callback']) hbox.pack_start(button, False, False, 0) vbox.pack_start(hbox, False, False, 0) self._eb.add(vbox)
def __init__(self, stage, image_path, image_scale, image_align, title, copy, buttons): super(Notebook, self).__init__() self.add(Gtk.Image.new_from_file(stage.media_path('lonely-notebook.png'))) fixed = Gtk.Fixed() self.add_overlay(fixed) self._eb = Gtk.EventBox() add_class(self._eb, 'notebook-content-area') self._eb.set_size_request(415, 460) fixed.put(self._eb, 20, 70) vbox = Gtk.VBox(False, 0) vbox.set_vexpand(True) vbox.set_hexpand(True) vbox.set_margin_left(10) vbox.set_margin_right(10) img = scale_image(Gtk.Image.new_from_file(image_path), image_scale) img_align = Gtk.Alignment.new(image_align, 0.5, 0, 0) img_align.add(img) img_align.set_vexpand(True) img_align.set_hexpand(True) vbox.pack_start(img_align, False, False, 0) heading = Gtk.Label(title) add_class(heading, 'notebook-heading') copy_widgets = [] for line in copy: l = Gtk.Label(line) l.set_line_wrap(False) l.set_justify(Gtk.Justification.CENTER) add_class(l, 'notebook-text') l.set_halign(Gtk.Align.CENTER) copy_widgets.append(l) # Pack heading vbox.pack_start(heading, False, False, 0) heading.set_margin_top(15) heading.set_margin_bottom(15) for w in copy_widgets: vbox.pack_start(w, False, False, 3) hbox = Gtk.HBox(False, 10) hbox.set_margin_top(15) hbox.set_halign(Gtk.Align.CENTER) for b in buttons: button = KanoButton(b['label'], color=b['color']) button.connect('clicked', cb_wrapper, b['callback']) hbox.pack_start(button, False, False, 0) vbox.pack_start(hbox, False, False, 0) self._eb.add(vbox)
def second_scroll(self): self._clear() ticks = Gtk.Image.new_from_file(self._stage.media_path('ticks.png')) copy = [ "Complete all of the ticks in a", "quest to unlock rewards." ] text_widgets = self._get_text_widgets(copy) chest = Gtk.Image.new_from_file(self._stage.media_path('chest-open.png')) button = KanoButton('NEXT', color='orange') button.connect('clicked', cb_wrapper, self.third_scroll) ticks.set_margin_top(20) self._vbox.pack_start(ticks, False, False, 0) text_widgets[0].set_margin_top(40) for w in text_widgets: self._vbox.pack_start(w, False, False, 0) chest.set_margin_top(35) self._vbox.pack_start(chest, False, False, 0) button.set_margin_top(40) button.set_margin_left(80) button.set_margin_right(80) self._vbox.pack_start(button, False, False, 0) self.show_all()
class NewUserView(Gtk.Grid): def __init__(self, greeter): Gtk.Grid.__init__(self) self.get_style_context().add_class('password') self.set_row_spacing(12) self.greeter = greeter title = Heading(_('Add new account'), _('Login with Kano World\n' 'or create a new account.')) self.attach(title.container, 0, 0, 1, 1) # the 2 push buttons self.login_btn = KanoButton(_('Kano World')) self.login_btn.connect('clicked', self._login_button_pressed) self.attach(self.login_btn, 0, 1, 1, 1) self.newuser_btn = KanoButton(_('New Account')) self.newuser_btn.connect('clicked', self._new_user_reboot) self.attach(self.newuser_btn, 0, 2, 1, 1) def _login_button_pressed(self, event=None, button=None): win = self.get_toplevel() win.go_to_login_with_kw() def _new_user_reboot(self, event=None, button=None): ''' Schedules kano-init to create a new user from scratch on next reboot, then performs the actual reboot ''' confirm = KanoDialog( title_text=_('Are you sure you want to create a new account?'), description_text=_('A reboot will be required'), button_dict=[ { 'label': _('Cancel').upper(), 'color': 'red', 'return_value': False }, { 'label': _('Create').upper(), 'color': 'green', 'return_value': True } ]) confirm.dialog.set_position(Gtk.WindowPosition.CENTER_ALWAYS) if confirm.run(): os.system("sudo kano-init schedule add-user") LightDM.restart()
def __init__(self, title, description, buttons, is_plug=False, img_path=None): super(Template, self).__init__(orientation=Gtk.Orientation.VERTICAL) self._focus_widget = None heading = Heading(title, description, is_plug, back_btn=False) bbox = Gtk.ButtonBox() bbox.set_spacing(20) bbox.set_layout(Gtk.ButtonBoxStyle.CENTER) bbox.set_margin_right(10) bbox.set_margin_left(10) for b in buttons: label = b["label"] if not label: gtk_button = Gtk.Label() else: button_type = b["type"] callback = b["callback"] if button_type == "KanoButton": color = b["color"] gtk_button = KanoButton(label, color=color) elif button_type == "OrangeButton": gtk_button = OrangeButton(label) gtk_button.connect("clicked", callback) bbox.pack_start(gtk_button, False, False, 0) if "focus" in b: self._focus_widget = gtk_button self.pack_start(heading.container, False, False, 0) heading.container.set_margin_right(15) heading.container.set_margin_left(15) if img_path: image = Gtk.Image.new_from_file(img_path) if is_plug: self.pack_start(image, False, False, 10) self.pack_start(bbox, False, False, 30) else: self.pack_start(image, False, False, 20) self.pack_end(bbox, False, False, 30) self.show_all()
def __init__(self, title, description, buttons, is_plug=False, img_path=None): super(Template, self).__init__(orientation=Gtk.Orientation.VERTICAL) self._focus_widget = None heading = Heading( title, description, is_plug, back_btn=False ) bbox = Gtk.ButtonBox() bbox.set_spacing(20) bbox.set_layout(Gtk.ButtonBoxStyle.CENTER) bbox.set_margin_right(10) bbox.set_margin_left(10) for b in buttons: label = b["label"] if not label: gtk_button = Gtk.Label() else: button_type = b["type"] callback = b["callback"] if button_type == "KanoButton": color = b["color"] gtk_button = KanoButton(label, color=color) elif button_type == "OrangeButton": gtk_button = OrangeButton(label) gtk_button.connect("clicked", callback) bbox.pack_start(gtk_button, False, False, 0) if "focus" in b: self._focus_widget = gtk_button self.pack_start(heading.container, False, False, 0) heading.container.set_margin_right(15) heading.container.set_margin_left(15) if img_path: image = Gtk.Image.new_from_file(img_path) if is_plug: self.pack_start(image, False, False, 10) self.pack_start(bbox, False, False, 30) else: self.pack_start(image, False, False, 20) self.pack_end(bbox, False, False, 30) self.show_all()
def __init__(self, stage, troubleshoot_cb, skip_cb): super(TroubleshootOrDisconnect, self).__init__(orientation=Gtk.Orientation.VERTICAL) self._stage = stage self.set_hexpand(False) self.set_vexpand(False) self.set_margin_left(40) self.set_margin_right(40) desc = Gtk.Label('Oops there was a problem connecting to internet.') desc.set_line_wrap(True) add_class(desc, 'console-screen-desc') img_path = self._stage.media_path("troubleshooting.png") image = Gtk.Image.new_from_file(img_path) troubleshoot = KanoButton('FIX IT') troubleshoot.connect('clicked', self._cb_wrapper, troubleshoot_cb) skip = KanoButton('SKIP', color="orange") skip.connect('clicked', self._cb_wrapper, skip_cb) buttons = Gtk.HBox(False, 0) buttons.pack_start(troubleshoot, True, True, 20) buttons.pack_start(skip, True, True, 0) self.pack_start(desc, False, False, 40) self.pack_start(image, False, False, 20) self.pack_start(buttons, False, False, 30)
def __generate_buttons(self): self.buttons = [] kano_button_box = Gtk.Box() for button in self.button_info: for argument, value in button_defaults.iteritems(): # Use default info if not provided if argument not in button: button[argument] = value # Create default return values for OK and CANCEL buttons if argument == 'return_value': if hasattr(button, 'label'): if button['label'] == _("OK"): button['return_value'] = 0 elif button['label'] == _("CANCEL"): button['return_value'] = 1 if argument == 'color': if button['label'] == _("CANCEL"): button['color'] = 'red' color = button['color'] return_value = button['return_value'] button_name = button['label'] button = KanoButton(button_name) button.set_color(color) button.connect('button-release-event', self.exit_dialog, return_value) button.connect('key-release-event', self.exit_dialog, return_value) self.buttons.append(button) kano_button_box.pack_start(button, False, False, 6) return kano_button_box
def __init__(self, stage, try_again_cb, skip_cb): super(AreYouSure, self).__init__(orientation=Gtk.Orientation.VERTICAL) self._stage = stage self.set_hexpand(False) self.set_vexpand(False) self.set_margin_left(40) self.set_margin_right(40) heading = Gtk.Label('Are You Sure?') heading.set_margin_top(20) add_class(heading, 'console-screen-heading') desc = Gtk.Label("Kano uses WiFi to stay up to date" + "\nwith all new software updates, apps" + "\nand features.") desc.set_justify(Gtk.Justification.CENTER) desc.set_line_wrap(True) add_class(desc, 'console-screen-desc') try_again = KanoButton('TRY AGAIN') try_again.connect('clicked', self._cb_wrapper, try_again_cb) skip = KanoButton('YES I WANT TO SKIP', color="grey") skip.connect('clicked', self._cb_wrapper, skip_cb, 'init-flow-wifi-skipped') buttons = Gtk.HBox(False, 0) buttons.pack_start(try_again, True, True, 20) buttons.pack_start(skip, True, True, 0) self.pack_start(heading, False, False, 30) self.pack_start(desc, False, False, 40) self.pack_start(buttons, False, False, 40)
def __init__(self): Gtk.Window.__init__(self, title=self._TITLE) apply_common_to_screen() window_height = self._IMAGE_HEIGHT + 220 self.set_size_request(self._IMAGE_WIDTH, window_height) self.set_decorated(False) self.set_resizable(False) self.set_position(Gtk.WindowPosition.CENTER) self.set_icon_name('kano-updater') # Put the window above all the existing ones when it starts # FIXME: this needs to happen within a 'realized' signal handler # disabled for now #self.get_window().raise_() image = Gtk.Image() image.set_from_file(self._HEADER_IMAGE) background = Gtk.EventBox() background.set_size_request(self._IMAGE_WIDTH, self._IMAGE_HEIGHT) background.add(image) # Header heading = Heading(self._HEADING, self._BYLINE) heading.description.set_line_wrap(True) action = KanoButton(self._ACTION.upper()) action.connect('clicked', self._do_action) action.set_halign(Gtk.Align.CENTER) later = OrangeButton(_("Later")) later.connect('clicked', self._do_later) later.set_halign(Gtk.Align.START) later.set_margin_left(40) buttons = Gtk.Overlay() buttons.add(action) buttons.add_overlay(later) box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=0) box.pack_start(background, False, False, 0) box.pack_start(heading.container, False, False, 10) box.pack_start(buttons, False, False, 0) self.add(box) self.show_all()
def __init__(self, stage, yes_cb, no_cb): super(Window1, self).__init__() add_class(self, 'overscan-window') head_img = Gtk.Image.new_from_file(stage.media_path('hint1.png')) box = Gtk.VBox() self.add(box) box.pack_start(head_img, False, False, 0) heading = Gtk.Label('Let\'s set up your screen') heading.set_margin_top(25) heading.set_margin_bottom(25) add_class(heading, 'notebook-heading') box.pack_start(heading, False, False, 0) heading = Gtk.Label('Are the white lines touching the edges?') heading.set_margin_bottom(35) add_class(heading, 'notebook-text') box.pack_start(heading, False, False, 0) buttons = Gtk.HBox(halign=Gtk.Align.CENTER) buttons.set_margin_bottom(25) yes = KanoButton('YES', color='green') yes.connect('clicked', cb_wrapper, yes_cb) buttons.pack_start(yes, False, False, 0) no = KanoButton('NO', color='red') no.connect('clicked', cb_wrapper, no_cb) buttons.pack_start(no, False, False, 10) box.pack_start(buttons, False, False, 0)
class KanoButtonBox(Gtk.Box): def __init__(self, kano_button_text, orange_text="", orange_text_2="", orange_text_3=""): Gtk.Box.__init__(self) self.kano_button = KanoButton(kano_button_text) if orange_text != "": self.orange_button = OrangeButton(orange_text) self.pack_start(self.orange_button, False, False, 0) self.pack_start(self.kano_button, False, False, 0) if orange_text_2 == "": # The empty label is to centre the kano_button label = Gtk.Label(" ") self.pack_start(label, False, False, 0) else: self.orange_button2 = OrangeButton(orange_text_2) if orange_text_3 == "": self.pack_start(self.orange_button2, False, False, 0) else: # If two orange button texts, we align them vertically self.vertbox = Gtk.Box( orientation=Gtk.Orientation.VERTICAL, spacing=6) self.add(self.vertbox) self.orange_button3 = OrangeButton(orange_text_3) self.vertbox.pack_start(self.orange_button2, False, False, 0) self.vertbox.pack_start(self.orange_button3, False, False, 0) else: self.pack_start(self.kano_button, False, False, 0) def get_kano_button(self): return self.kano_button def set_kano_button_cb(self, cb, args=[]): self.kano_button.connect('button-release-event', cb, args) def set_orange_button_cb(self, cb, args=[]): self.orange_button.connect('button-release-event', cb, args) def set_orange_button2_cb(self, cb, args=None): self.orange_button2.connect('button-release-event', cb, args) def set_orange_button3_cb(self, cb, args=None): self.orange_button3.connect('button-release-event', cb, args)
def __init__(self, img_filename, title, description, kano_button_text, orange_button_text): Gtk.Box.__init__(self, orientation=Gtk.Orientation.VERTICAL) if img_filename: self.image = Gtk.Image.new_from_file(img_filename) self.pack_start(self.image, False, False, 0) self.heading = Heading(title, description) self.kano_button = KanoButton(kano_button_text) self.pack_start(self.heading.container, False, False, 0) self.button_box = Gtk.ButtonBox(spacing=10) self.button_box.set_layout(Gtk.ButtonBoxStyle.SPREAD) self.button_box.set_margin_bottom(30) self.pack_start(self.button_box, False, False, 0) if not orange_button_text == "": self.orange_button = OrangeButton(orange_button_text) self.button_box.pack_start(self.orange_button, False, False, 0) self.button_box.pack_start(self.kano_button, False, False, 0) # The empty label is to centre the kano_button label = Gtk.Label(" ") self.button_box.pack_start(label, False, False, 0) else: self.button_box.pack_start(self.kano_button, False, False, 0)
def __init__(self, win, title, description, original_overscan=None): Gtk.Box.__init__(self, orientation=Gtk.Orientation.VERTICAL) self.kano_button = KanoButton("APPLY CHANGES") self.kano_button.connect("button-release-event", self.apply_changes) self.kano_button.pack_and_align() self.heading = Heading(title, description) self.pack_start(self.heading.container, False, False, 0) self.win = win self.win.set_main_widget(self) self.win.top_bar.enable_prev() # Launch pipe for the overscan c code launch_pipe() self.overscan_values = get_overscan_status() self.original_overscan = original_overscan # Pass original overscan values between the classes # If original_overscan hasn't been generated yet, get it from current overscan status # Alternatively, maybe read this from a file in future if original_overscan is None: self.original_overscan = get_overscan_status() # Reset button self.reset_button = OrangeButton() reset_image = Gtk.Image().new_from_file(common.media + "/Icons/reset.png") self.reset_button.set_image(reset_image) self.reset_button.connect("button_press_event", self.reset)
def __init__(self, kano_button_text, orange_text="", orange_text_2="", orange_text_3=""): Gtk.Box.__init__(self) self.kano_button = KanoButton(kano_button_text) if orange_text != "": self.orange_button = OrangeButton(orange_text) self.pack_start(self.orange_button, False, False, 0) self.pack_start(self.kano_button, False, False, 0) if orange_text_2 == "": # The empty label is to centre the kano_button label = Gtk.Label(" ") self.pack_start(label, False, False, 0) else: self.orange_button2 = OrangeButton(orange_text_2) if orange_text_3 == "": self.pack_start(self.orange_button2, False, False, 0) else: # If two orange button texts, we align them vertically self.vertbox=Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=6) self.add(self.vertbox) self.orange_button3 = OrangeButton(orange_text_3) self.vertbox.pack_start(self.orange_button2, False, False, 0) self.vertbox.pack_start(self.orange_button3, False, False, 0) else: self.pack_start(self.kano_button, False, False, 0)
def __init__(self, win): Gtk.Box.__init__(self, orientation=Gtk.Orientation.VERTICAL) self.win = win self.win.set_main_widget(self) self.win.set_decorated(True) title = Heading( _("Kano World"), _("Choose a cool name and secure password") ) self.pack_start(title.container, False, False, 0) self.data_screen = GetData() # TODO: refactor this self.data_screen.connect('widgets-filled', self._enable_register_button) self.data_screen.connect('widgets-empty', self._disable_register_button) self.add(self.data_screen) self.register_button = KanoButton(_("JOIN KANO WORLD")) self.register_button.set_sensitive(False) self.register_button.set_margin_top(10) self.register_button.set_margin_left(30) self.register_button.set_margin_right(30) self.register_button.set_margin_bottom(30) self.register_button.connect('clicked', self._on_register_button) self.pack_end(self.register_button, False, False, 0) self.win.show_all()
def __init__(self): Gtk.Box.__init__(self, orientation=Gtk.Orientation.VERTICAL) kano_button_text = _("CREATE") skip_button_text = _("Skip") login_button_text = _("I have a profile") header = _('Keep your creations safe') subheader = _( 'Create a Kano World account so you never lose your progress...\n' 'and to get inspired by creations from the community') img_width = 590 img_height = 270 self.skip_button = OrangeButton(skip_button_text) self.login_button = OrangeButton(login_button_text) image_filename = get_image('login', "", 'first-screen', str(img_width) + 'x' + str(img_height)) self.image = Gtk.Image.new_from_file(image_filename) self.pack_start(self.image, False, False, 0) self.heading = Heading(header, subheader) self.kano_button = KanoButton(kano_button_text) self.pack_start(self.heading.container, False, False, 0) self.button_box = Gtk.ButtonBox(spacing=10) self.button_box.set_layout(Gtk.ButtonBoxStyle.SPREAD) self.pack_start(self.button_box, False, False, 0) self.button_box.pack_start(self.login_button, False, False, 0) self.button_box.pack_start(self.kano_button, False, False, 0) self.button_box.pack_start(self.skip_button, False, False, 0)
def __generate_buttons(self): self.buttons = [] kano_button_box = Gtk.Box() for button in self.button_info: for argument, value in button_defaults.iteritems(): # Use default info if not provided if argument not in button: button[argument] = value # Create default return values for OK and CANCEL buttons if argument == "return_value": if hasattr(button, "label"): if button["label"] == _("OK"): button["return_value"] = 0 elif button["label"] == _("CANCEL"): button["return_value"] = 1 if argument == "color": if button["label"] == _("CANCEL"): button["color"] = "red" color = button["color"] return_value = button["return_value"] button_name = button["label"] button = KanoButton(button_name) button.set_color(color) button.connect("button-release-event", self.exit_dialog, return_value) button.connect("key-release-event", self.exit_dialog, return_value) self.buttons.append(button) kano_button_box.pack_start(button, False, False, 6) return kano_button_box
def __init__(self, device): Gtk.Box.__init__(self, hexpand=True) self.device = device device_name = device.name dev_label = Gtk.Label(device_name, hexpand=True) dev_label.get_style_context().add_class('normal_label') self.pack_start(dev_label, False, False, 0) self._pair_button = KanoButton() self._set_paired_button_state() self._pair_button.set_margin_top(10) self._pair_button.set_margin_bottom(10) self._pair_button.set_margin_left(10) self._pair_button.set_margin_right(10) self._pair_button.connect('clicked', self.pair) self.pack_start(self._pair_button, False, False, 0)
class KanoButtonBox(Gtk.Box): def __init__(self, kano_button_text, orange_text="", orange_text_2="", orange_text_3=""): Gtk.Box.__init__(self) self.kano_button = KanoButton(kano_button_text) if orange_text != "": self.orange_button = OrangeButton(orange_text) self.pack_start(self.orange_button, False, False, 0) self.pack_start(self.kano_button, False, False, 0) if orange_text_2 == "": # The empty label is to centre the kano_button label = Gtk.Label(" ") self.pack_start(label, False, False, 0) else: self.orange_button2 = OrangeButton(orange_text_2) if orange_text_3 == "": self.pack_start(self.orange_button2, False, False, 0) else: # If two orange button texts, we align them vertically self.vertbox=Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=6) self.add(self.vertbox) self.orange_button3 = OrangeButton(orange_text_3) self.vertbox.pack_start(self.orange_button2, False, False, 0) self.vertbox.pack_start(self.orange_button3, False, False, 0) else: self.pack_start(self.kano_button, False, False, 0) def get_kano_button(self): return self.kano_button def set_kano_button_cb(self, cb, args=[]): self.kano_button.connect('button-release-event', cb, args) def set_orange_button_cb(self, cb, args=[]): self.orange_button.connect('button-release-event', cb, args) def set_orange_button2_cb(self, cb, args=None): self.orange_button2.connect('button-release-event', cb, args) def set_orange_button3_cb(self, cb, args=None): self.orange_button3.connect('button-release-event', cb, args)
def __init__(self, win): Gtk.Box.__init__(self, orientation=Gtk.Orientation.VERTICAL) self.win = win self.get_style_context().add_class('notebook_page') reset_button = KanoButton(text=_("RESET YOUR DESKTOP"), color='orange') reset_button.connect('button-release-event', self.reset_button_cb) reset_button.connect('key-release-event', self.reset_button_cb) reset_button.pack_and_align() reset_button.align.set(0.5, 0.5, 0, 0) self.pack_start(reset_button.align, True, True, 0)
class ScrolledWindowTemplate(Gtk.Box): def __init__( self, title, description, button_text, orange_button_text=None ): Gtk.Box.__init__(self, orientation=Gtk.Orientation.VERTICAL) self.sw = ScrolledWindow() self.sw.apply_styling_to_widget(wide=False) self.title = Heading(title, description) self.kano_button = KanoButton(button_text) self.kano_button.pack_and_align() self.pack_start(self.title.container, False, False, 0) self.pack_start(self.sw, True, True, 0) if orange_button_text: box_align = Gtk.Alignment(xscale=0, xalign=0.5) button_box = Gtk.ButtonBox( orientation=Gtk.Orientation.HORIZONTAL, spacing=40 ) label = Gtk.Label("") self.orange_button = OrangeButton(orange_button_text) button_box.pack_start(label, False, False, 0) button_box.pack_start(self.kano_button.align, False, False, 0) button_box.pack_start(self.orange_button, False, False, 0) box_align.add(button_box) self.pack_start(box_align, False, False, 0) else: self.pack_start(self.kano_button.align, False, False, 0) def get_scrolled_window(self): return self.sw
def __init__(self, greeter): Gtk.Grid.__init__(self) self.get_style_context().add_class('password') self.set_row_spacing(12) self.greeter = greeter title = Heading(_('Add new account'), _('Login with Kano World\n' 'or create a new account.')) self.attach(title.container, 0, 0, 1, 1) # the 2 push buttons self.login_btn = KanoButton(_('Kano World')) self.login_btn.connect('clicked', self._login_button_pressed) self.attach(self.login_btn, 0, 1, 1, 1) self.newuser_btn = KanoButton(_('New Account')) self.newuser_btn.connect('clicked', self._new_user_reboot) self.attach(self.newuser_btn, 0, 2, 1, 1)
class CharacterEdit(Gtk.EventBox): '''Offer the user the option to modify their avatar ''' def __init__(self, win, char_creator): Gtk.EventBox.__init__(self) self._win = win # Should this be inherited, passed as a variable, or global? # Could be a member variable in window. # self.char_creator = self._win.get_char_creator() self.char_creator = char_creator self._win.pack_in_main_content(self.char_creator) self.char_creator.reset_selected_menu_items() self._save_changes_button = KanoButton(_("Save changes").upper()) self._save_changes_button.connect('clicked', self.save_changes) self._save_changes_button.set_sensitive(False) self.char_creator.connect( 'character_changed', self._make_button_sensitive ) discard_changes_button = OrangeButton(_("Discard").upper()) discard_changes_button.connect('clicked', self.discard) discard_changes_button.set_margin_left(100) empty_label = Gtk.Label("") button_box = Gtk.ButtonBox() button_box.pack_start(discard_changes_button, False, False, 0) button_box.pack_start(self._save_changes_button, False, False, 0) button_box.pack_start(empty_label, False, False, 0) self._win.pack_in_bottom_bar(button_box) self._win.show_all() # Hide all the pop ups self.char_creator._hide_pop_ups() def save_changes(self, widget): self.char_creator.save() self._go_back_to_display_screen() def discard(self, widget): self.char_creator.update_from_saved_image() self._go_back_to_display_screen() def _go_back_to_display_screen(self): '''Don't save, just go back to the edit character screen ''' self._win.empty_main_content() self._win.empty_bottom_bar() self._win.menu_bar.enable_buttons() CharacterDisplay(self._win) def _make_button_sensitive(self, widget=None): self._save_changes_button.set_sensitive(True)
def __init__(self, win): Gtk.Box.__init__(self, orientation=Gtk.Orientation.VERTICAL) self.win = win reset_button = KanoButton(text='RESET YOUR DESKTOP', color='orange') reset_button.connect('button-release-event', self.reset_button_cb) reset_button.connect('key-release-event', self.reset_button_cb) reset_button.pack_and_align() reset_button.align.set(0.5, 0.5, 0, 0) self.pack_start(reset_button.align, True, True, 0)
def __init__(self, cb): super(CharacterWindow, self).__init__() self.get_style_context().add_class("character_window") self.set_decorated(False) self.close_cb = cb self.char_edit = CharacterCreator(randomise=True) vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL) self.add(vbox) vbox.pack_start(self.char_edit, False, False, 0) button = KanoButton("OK") button.connect("clicked", self.close_window) button.pack_and_align() self.connect("delete-event", Gtk.main_quit) self.set_keep_above(True) vbox.pack_start(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")