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 __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 __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): 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') # Make sure this window is always above self.set_keep_above(True) 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', Gtk.main_quit) 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()