def __init__(self, message, default_width=300, default_height=140, is_succeed=True): DialogBox.__init__(self, "", default_width, default_height, self.DIALOG_MASK_SINGLE_PAGE) self.hbox = gtk.HBox() self.image_align = gtk.Alignment() self.image_align.set(0, 0, 0, 0) self.image_align.set_padding(0, 0, 20, 0) self.image_box = ImageBox(app_theme.get_pixbuf("bluetooth/succeed.png")) if not is_succeed: self.image_box = ImageBox(app_theme.get_pixbuf("bluetooth/failed.png")) self.image_align.add(self.image_box) self.message_align = gtk.Alignment() self.message_align.set(0, 0, 0, 0) self.message_align.set_padding(20, 0, 10, 0) if not is_succeed: self.message_align.set_padding(0, 0, 10, 0) self.message_label = Label(message, wrap_width = 200) self.message_align.add(self.message_label) self.hbox.pack_start(self.image_align) self.hbox.pack_start(self.message_align) self.confirm_align = gtk.Alignment() self.confirm_align.set(0, 0, 0, 0) self.confirm_align.set_padding(20, 0, 200, 0) self.confirm_button = Button(_("Ok")) self.confirm_button.set_size_request(70, WIDGET_HEIGHT) self.confirm_button.connect("clicked", lambda widget : self.destroy()) self.confirm_align.add(self.confirm_button) self.body_box.pack_start(self.hbox, False, False) self.body_box.pack_start(self.confirm_align, False, False)
def __init__(self, default_width=300, default_height=160, cancel_cb=None): DialogBox.__init__(self, "", default_width, default_height, self.DIALOG_MASK_SINGLE_PAGE) self.cancel_cb = cancel_cb self.message_align = gtk.Alignment() self.message_align.set(0, 0, 0, 0) self.message_align.set_padding(0, 0, 10, 0) self.message_label = Label("", label_width=300) self.message_align.add(self.message_label) self.progress_align = gtk.Alignment() self.progress_align.set(0, 0, 0, 0) self.progress_align.set_padding(20, 0, 10, 10) self.progress_bar = ProgressBar() self.progress_bar.set_size_request(default_width, -1) self.progress_align.add(self.progress_bar) self.percentage_align = gtk.Alignment() self.percentage_align.set(0, 0, 0, 0) self.percentage_align.set_padding(10, 0, 140, 0) self.percentage_label = Label("0%", label_width=300) self.percentage_label.set_size_request(default_width, -1) self.percentage_align.add(self.percentage_label) self.cancel_align = gtk.Alignment() self.cancel_align.set(0, 0, 0, 0) self.cancel_align.set_padding(20, 0, 200, 0) self.cancel_button = Button(_("Cancel")) self.cancel_button.set_size_request(70, WIDGET_HEIGHT) self.cancel_button.connect("clicked", self.__on_cancel_button_clicked) self.cancel_align.add(self.cancel_button) self.body_box.pack_start(self.message_align, False, False) self.body_box.pack_start(self.progress_align, False, False) self.body_box.pack_start(self.percentage_align, False, False) self.body_box.pack_start(self.cancel_align)
def switch_page(bread, content_page_info, index, label, slider, navigate_page, foot_box): global previous_module_id if index == 0: if label == _("System Settings"): slider.slide_to_page(navigate_page, "none") content_page_info.set_active_module_id("main") foot_box.hide() if previous_module_id: send_message(previous_module_id, "exit", "") else: send_message(content_page_info.get_active_module_id(), "click_crumb", (index, label))
def __init__(self, module_info, start_callback): ''' Initialize ItemIcon class. @param pixbuf: Icon pixbuf. ''' gobject.GObject.__init__(self) self.start_callback = start_callback self.module_info = module_info self.icon_padding_y = int(_("10")) self.name_padding_y = 8 self.hover_flag = False self.highlight_flag = False self.hover_offset = 1 self.hover_stroke_dcolor = app_theme.get_color("globalHoverStroke") self.hover_fill_dcolor = app_theme.get_color("globalHoverFill") self.hover_response_rect = gtk.gdk.Rectangle( self.hover_offset, self.hover_offset, ICON_SIZE - self.hover_offset * 2, ICON_SIZE - self.hover_offset * 2)
def __setup_reset_button(self): self.reset_button = Button(_("Reset")) #self.reset_button.set_size_request(self.button_width, WIDGET_HEIGHT) self.reset_button.connect("clicked", self.__reset_button_clicked)
IMG_WIDTH = 16 ''' ComboBox, Label widget height ''' WIDGET_HEIGHT = 22 WINDOW_HEIGHT = 535 WINDOW_WIDTH = 800 ''' Border color and backgroud color for treeview ''' TREEVIEW_BORDER_COLOR = "#d2d2d2" TREEVIEW_BG_COLOR = "#f6f6f6" MODULES_NAME_FOR_L18N = { "display": _("Displays"), "desktop": _("Desktop"), "individuation": _("Personalization"), "sound": _("Sound"), "date_time": _("Date & Time"), "power": _("Power"), "keyboard": _("Keyboard"), "mouse": _("Mouse"), "touchpad": _("Touchpad"), "printer": _("Printers"), "network": _("Network"), "bluetooth": _("Bluetooth"), "driver": _("Additional Drivers"), "account": _("User Accounts"), "application_associate": _("Default Applications"), "system_information": _("System Information"),
def __init__(self, module_infos, switch_page, click_module_item, backward_cb=None, forward_cb=None, search_cb=None): ''' init docs ''' # Init. gtk.Alignment.__init__(self) self.module_infos = module_infos self.set(0.5, 0.5, 1, 1) self.set_padding(0, 0, 0, 0) self.set_size_request(-1, 32) # Init action box. self.main_box = gtk.HBox() # Init action button. self.backward_align = gtk.Alignment() self.backward_align.set(0, 0, 0, 0) self.backward_align.set_padding(8, 5, 10, 0) self.backward_button = ImageButton( app_theme.get_pixbuf("action_button/backward_normal.png"), app_theme.get_pixbuf("action_button/backward_hover.png"), app_theme.get_pixbuf("action_button/backward_press.png"), insensitive_dpixbuf = app_theme.get_pixbuf("action_button/backward_normal.png") ) self.backward_cb = backward_cb self.backward_button.connect("clicked", self.__backward_clicked) self.backward_align.add(self.backward_button) self.forward_align = gtk.Alignment() self.forward_align.set(0, 0, 0, 0) self.forward_align.set_padding(8, 5, 10, 0) self.forward_button = ImageButton( app_theme.get_pixbuf("action_button/forward_normal.png"), app_theme.get_pixbuf("action_button/forward_hover.png"), app_theme.get_pixbuf("action_button/forward_press.png"), insensitive_dpixbuf = app_theme.get_pixbuf("action_button/forward_normal.png") ) self.forward_cb = forward_cb self.forward_button.connect("clicked", self.__forward_clicked) self.forward_align.add(self.forward_button) self.action_box = gtk.HBox() self.action_align = gtk.Alignment() self.action_align.set(0.5, 0, 0, 0) self.action_align.set_padding(0, 0, 5, 5) self.bread_align = gtk.Alignment() self.bread_align.set(0, 0.5, 1, 0) self.bread_align.set_padding(0, 0, 4, 4) # Init navigate bar. self.navigate_bar = gtk.HBox() self.bread = Bread(crumb = [(_("System Settings"), map(lambda module_info: ModuleMenuItem(module_info, click_module_item), list(itertools.chain(*module_infos)))), ], show_left_right_box = False) #self.bread.set_size(-1, 24) self.bread.connect("item_clicked", switch_page) # Init search entry. self.search_button = ImageButton( app_theme.get_pixbuf("entry/search_normal.png"), app_theme.get_pixbuf("entry/search_hover.png"), app_theme.get_pixbuf("entry/search_press.png"), ) self.search_cb = search_cb self.search_entry = InputEntry(action_button=self.search_button) self.search_entry.set_size(150, 24) self.search_entry.entry.connect("changed", self.__search_changed) self.search_entry.entry.connect("press-return", self.__search_press_enter) self.search_align = gtk.Alignment() self.search_align.set(0.5, 0.5, 0, 0) self.search_align.set_padding(5, 0, 5, 10) # Connect widgets. self.action_align.add(self.action_box) self.bread_align.add(self.bread) self.search_align.add(self.search_entry) self.action_box.pack_start(self.backward_align) self.action_box.pack_start(self.forward_align) self.navigate_bar.pack_start(self.bread_align, True, True) self.main_box.pack_start(self.action_align, False, False) self.main_box.pack_start(self.navigate_bar, True, True) self.main_box.pack_start(self.search_align, False, False) self.add(self.main_box)
WINDOW_WIDTH, WINDOW_HEIGHT, WINDOW_WIDTH, WINDOW_HEIGHT, ) image_dir = os.path.join(get_parent_dir(__file__, 2), "image") # Set application icon. application.set_icon(os.path.join(image_dir, "icon.png")) # Set application preview pixbuf. application.set_skin_preview(os.path.join(image_dir, "frame.png")) # Add titlebar. application.add_titlebar( ["min", "close"], os.path.join(image_dir, "logo.png"), _("System Settings"), enable_gaussian=False, name_size=10, ) frame_padding = 2 frame_padding_top = 0 main_align = gtk.Alignment() main_align.set(0.5, 0.5, 1, 1) main_align.set_padding(frame_padding_top, frame_padding, frame_padding, frame_padding) main_box = gtk.VBox() body_box = gtk.VBox() foot_box = FootBox() # Init module infos.
''' ComboBox, Label widget height ''' WIDGET_HEIGHT = 22 WINDOW_HEIGHT = 535 WINDOW_WIDTH = 800 ''' Border color and backgroud color for treeview ''' TREEVIEW_BORDER_COLOR = "#d2d2d2" TREEVIEW_BG_COLOR = "#f6f6f6" MODULES_NAME_FOR_L18N = { "display": _("Displays"), "desktop": _("Desktop"), "individuation": _("Personalization"), "sound": _("Sound"), "date_time": _("Date & Time"), "power": _("Power"), "keyboard": _("Keyboard"), "mouse": _("Mouse"), "touchpad": _("Touchpad"), "printer": _("Printers"), "network": _("Network"), "bluetooth": _("Bluetooth"), "driver": _("Additional Drivers"), "account": _("User Accounts"), "application_associate": _("Default Applications"), "system_information": _("System Information"),
def set_progress(self, progress): self.progress_bar.set_progress(progress) self.percentage_label.set_text(_("Sent %d") % progress + "%")
def __init__(self, module_infos, switch_page, click_module_item, backward_cb=None, forward_cb=None, search_cb=None): ''' init docs ''' # Init. gtk.Alignment.__init__(self) self.module_infos = module_infos self.set(0.5, 0.5, 1, 1) self.set_padding(0, 0, 0, 0) self.set_size_request(-1, 32) # Init action box. self.main_box = gtk.HBox() # Init action button. self.backward_align = gtk.Alignment() self.backward_align.set(0, 0, 0, 0) self.backward_align.set_padding(8, 5, 10, 0) self.backward_button = ImageButton( app_theme.get_pixbuf("action_button/backward_normal.png"), app_theme.get_pixbuf("action_button/backward_hover.png"), app_theme.get_pixbuf("action_button/backward_press.png"), insensitive_dpixbuf=app_theme.get_pixbuf( "action_button/backward_normal.png")) self.backward_cb = backward_cb self.backward_button.connect("clicked", self.__backward_clicked) self.backward_align.add(self.backward_button) self.forward_align = gtk.Alignment() self.forward_align.set(0, 0, 0, 0) self.forward_align.set_padding(8, 5, 10, 0) self.forward_button = ImageButton( app_theme.get_pixbuf("action_button/forward_normal.png"), app_theme.get_pixbuf("action_button/forward_hover.png"), app_theme.get_pixbuf("action_button/forward_press.png"), insensitive_dpixbuf=app_theme.get_pixbuf( "action_button/forward_normal.png")) self.forward_cb = forward_cb self.forward_button.connect("clicked", self.__forward_clicked) self.forward_align.add(self.forward_button) self.action_box = gtk.HBox() self.action_align = gtk.Alignment() self.action_align.set(0.5, 0, 0, 0) self.action_align.set_padding(0, 0, 5, 5) self.bread_align = gtk.Alignment() self.bread_align.set(0, 0.5, 1, 0) self.bread_align.set_padding(0, 0, 4, 4) # Init navigate bar. self.navigate_bar = gtk.HBox() self.bread = Bread(crumb=[ (_("System Settings"), map( lambda module_info: ModuleMenuItem(module_info, click_module_item), list(itertools.chain(*module_infos)))), ], show_left_right_box=False) #self.bread.set_size(-1, 24) self.bread.connect("item_clicked", switch_page) # Init search entry. self.search_button = ImageButton( app_theme.get_pixbuf("entry/search_normal.png"), app_theme.get_pixbuf("entry/search_hover.png"), app_theme.get_pixbuf("entry/search_press.png"), ) self.search_cb = search_cb self.search_entry = InputEntry(action_button=self.search_button) self.search_entry.set_size(150, 24) self.search_entry.entry.connect("changed", self.__search_changed) self.search_entry.entry.connect("press-return", self.__search_press_enter) self.search_align = gtk.Alignment() self.search_align.set(0.5, 0.5, 0, 0) self.search_align.set_padding(5, 0, 5, 10) # Connect widgets. self.action_align.add(self.action_box) self.bread_align.add(self.bread) self.search_align.add(self.search_entry) self.action_box.pack_start(self.backward_align) self.action_box.pack_start(self.forward_align) self.navigate_bar.pack_start(self.bread_align, True, True) self.main_box.pack_start(self.action_align, False, False) self.main_box.pack_start(self.navigate_bar, True, True) self.main_box.pack_start(self.search_align, False, False) self.add(self.main_box)
WINDOW_WIDTH, WINDOW_HEIGHT, ) image_dir = os.path.join(get_parent_dir(__file__, 2), "image") # Set application icon. application.set_icon(os.path.join(image_dir, "icon.png")) # Set application preview pixbuf. application.set_skin_preview(os.path.join(image_dir, "frame.png")) # Add titlebar. application.add_titlebar( ["min", "close"], os.path.join(image_dir, "logo.png"), _("System Settings"), enable_gaussian=False, name_size=10, ) frame_padding = 2 frame_padding_top = 0 main_align = gtk.Alignment() main_align.set(0.5, 0.5, 1, 1) main_align.set_padding(frame_padding_top, frame_padding, frame_padding, frame_padding) main_box = gtk.VBox() body_box = gtk.VBox() foot_box = FootBox()