def create_screen(self): center = Gtk.VBox() weatherbox = Gtk.HBox() eventbox = Gtk.HBox() eventdesc = Gtk.VBox() timebox = Gtk.VBox() namebox = Gtk.VBox() statusbar = Gtk.HBox() self.weather_img.set_from_pixbuf(self.weather_data.image) self.cal_img.set_from_pixbuf(IMG.home_calendarpix) self.welcome.set_text("Welcome,") desc = Pango.FontDescription("AnjaliOldLipi Bold 15") self.weather_temp.override_font(desc) self.weather_temp.override_color(Gtk.StateFlags.NORMAL, Gdk.RGBA(255, 255, 255, 1.0)) self.cal_time.override_font(desc) self.cal_time.override_color(Gtk.StateFlags.NORMAL, Gdk.RGBA(255, 255, 255, 1.0)) self.cal_title.override_font(desc) self.cal_title.override_color(Gtk.StateFlags.NORMAL, Gdk.RGBA(255, 255, 255, 1.0)) self.timedate_date.override_font(desc) self.timedate_date.override_color(Gtk.StateFlags.NORMAL, Gdk.RGBA(255, 255, 255, 1.0)) self.timedate_time.override_font(desc) self.timedate_time.override_color(Gtk.StateFlags.NORMAL, Gdk.RGBA(255, 255, 255, 1.0)) self.welcome.override_font(desc) self.welcome.override_color(Gtk.StateFlags.NORMAL, Gdk.RGBA(255, 255, 255, 1.0)) self.username.override_font(desc) self.username.override_color(Gtk.StateFlags.NORMAL, Gdk.RGBA(255, 255, 255, 1.0)) self.update_home() weatherbox.pack_start(self.weather_img, False, False, 0) weatherbox.pack_start(self.weather_temp, False, False, 0) timebox.pack_start(self.timedate_time, False, False, 0) timebox.pack_start(self.timedate_date, False, False, 0) eventdesc.pack_start(self.cal_title, False, False, 0) eventdesc.pack_start(self.cal_time, False, False, 0) eventbox.pack_start(self.cal_img, False, False, 0) eventbox.pack_start(eventdesc, False, False, 0) namebox.pack_start(self.welcome, False, False, 0) namebox.pack_start(self.username, False, False, 0) statusbar.pack_start(eventbox, True, True, 0) statusbar.pack_start(timebox, True, True, 0) statusbar.pack_start(weatherbox, True, True, 0) statusbar.pack_start(namebox, True, True, 0) center.pack_start(statusbar, False, False, 0) self.add(center)
from pyanaconda.ui.gui.utils import escape_markup, override_cell_property from pyanaconda.ui.categories.localization import LocalizationCategory from pyanaconda.ui.gui.spokes.lib.lang_locale_handler import LangLocaleHandler from pyanaconda import localization import re from pyanaconda.anaconda_loggers import get_module_logger log = get_module_logger(__name__) __all__ = ["LangsupportSpoke"] # #fdfbc0 # Sure would be nice if gdk_rgba_parse returned a new object instead of # modifying an existing one. _HIGHLIGHT_COLOR = Gdk.RGBA(red=0.992157, green=0.984314, blue=0.752941, alpha=1.0) class LangsupportSpoke(LangLocaleHandler, NormalSpoke): """ .. inheritance-diagram:: LangsupportSpoke :parts: 3 """ builderObjects = ["languageStore", "languageStoreFilter", "localeStore", "langsupportWindow"] mainWidgetName = "langsupportWindow" focusWidgetName = "languageEntry" uiFile = "spokes/language_support.glade" helpFile = "LangSupportSpoke.xml" category = LocalizationCategory icon = "accessories-character-map-symbolic"
def __init__(self) -> None: GObject.Object.__init__(self) self._column = 0 self._line_width = 1.0 self._stroke_color_rgba: Gdk.RGBA = Gdk.RGBA(0.5, 0.5, 0.5, 1) self._stacked_color_rgba: Gdk.RGBA = Gdk.RGBA(0.5, 0.5, 0.5, 0.5)
def argb_to_gdk_rgba(color_int): return Gdk.RGBA(color_int / 256**2 % 256 / 255., color_int / 256**1 % 256 / 255., color_int / 256**0 % 256 / 255., color_int / 256**3 % 256 / 255.)
def __init__(self): super(MainApp, self).__init__() # ################################################################# # # Load and apply gtkrc # ################################################################# # # No exception control because rc_parse doesn't throw exception on fail... sad but true ;) # ORIGDIR = os.getcwd() # os.chdir('lib/ui/data/Brave/gtk-2.0/') # Gtk.rc_parse('gtkrc') # os.chdir(ORIGDIR) from inguma import inguma_init self.ing = self # Load Output Manager self.gom = om.OutputManager('gui', self.ing) glob.gom = self.gom core.check_args() core.create_profile_dir() inguma_init() # Create config self.config = config ################################################################# # Create a new window ################################################################# splash.push(("Creating main window...")) self.set_icon_from_file(os.path.join('logo', 'inguma_16.png')) self.set_focus = True self.connect("delete_event", self.event_quit) splash.push(("Loading...")) Gtk.Settings.get_default().set_long_property("gtk-button-images", True, "main") # Title self.set_title(MAINTITLE) # Positions self.resize(800, 600) self.move(25, 25) # Maximize window self.maximize() ################################################################# # Load UIcore... ################################################################# # Initialize KB splash.push(("Loading KB...")) self.kb = glob.kb self.uicore = uicore.UIcore(self.gom) self.uicore.add_local_asn() self.gom.set_core(self.uicore) # Check module window prefs setattr(self.uicore, 'SHOW_MODULE_WIN', self.config.SHOW_MODULE_WIN) self.uicore.set_om(self.gom) ################################################################# # Main VBox ################################################################# mainvbox = Gtk.VBox(False, 1) mainvbox.set_border_width(1) self.add(mainvbox) mainvbox.show() ################################################################# # ToolBar ################################################################# splash.push(("Creating menu and toolbar...")) self.toolbar = toolbar.Toolbar(self.ing) mainvbox.pack_start(self.toolbar, False, False, 1) # Disable if not GtkSourceView2 if not self.config.HAS_SOURCEVIEW: self.toolbar.edit_tb.set_sensitive(False) # Disable if not Vte if not self.config.HAS_VTE: self.toolbar.sniffer_tb.set_sensitive(False) self.toolbar.scapy_tb.set_sensitive(False) ################################################################# # Map tab ################################################################# # Will contain on top the notebook and on bottom log window self.vpaned = Gtk.VPaned() # Will contain xdot widget and kb window self.network_paned = Gtk.HPaned() ################################################################# # xdot map ################################################################# from . import inxdot # node_menu initialization stuff self.uiman = node_menu.NodeMenu(self.gom, self.uicore, self.config) self.uiman.set_data(None) accel = self.uiman.get_accel_group() self.add_accel_group(accel) # graphMenu initialization stuff self.graph_uiman = graphMenu.UIManager(self.ing) graph_accel = self.graph_uiman.get_accel_group() self.add_accel_group(graph_accel) # altNodeMenu initialization stuff self.altnode_uiman = altNodeMenu.UIManager(self.gom, self.uicore) altnode_accel = self.altnode_uiman.get_accel_group() self.add_accel_group(altnode_accel) self.xdotw = inxdot.MyDotWidget(self.uiman, self.graph_uiman, self.altnode_uiman, self.uicore) setattr(self.graph_uiman, 'xdot', self.xdotw) setattr(self.altnode_uiman, 'xdot', self.xdotw) setattr(self.uicore, 'xdot', self.xdotw) self.uicore.getDot(doASN=False) self.xdotw.set_dotcode(self.uicore.get_last_dot()) self.xdotw.zoom_image(1.0) ################################################################# # Graph Menu ################################################################# gmenu = graphTBar.GraphMenu(self.xdotw, self.uicore) ################################################################# # HBox for Map and GraphMenu ################################################################# self.graph_box = Gtk.HBox() self.graph_box.pack_start(self.xdotw, True, True, 0) self.graph_box.pack_start(gmenu, False, False, 0) # Show elements gmenu.show() self.graph_box.show() ################################################################# # Right panel ################################################################# # Holds right tree and buttons self.right_hbox = Gtk.HBox(False) # KB TreeView self.treeview = right_tree.KBtree(self, self.uicore) self.gom.set_kbwin(self.treeview) self.gom.set_map(self.xdotw) self.right_vbox = self.treeview.right_vbox self.scrolled_window = self.treeview.scrolled_window # Right buttons self.btn_vbox = right_buttons.RightButtons(self.right_vbox, self.treeview) self.btn_vbox.create_buttons() ################################################################# # Map Iface ################################################################# label = Gtk.Label(label='Map') # Pack map and right tree self.network_paned.pack1(self.graph_box, True, True) self.network_paned.pack2(self.right_vbox, False, False) self.right_hbox.pack_start(self.network_paned, True, True, 1) self.right_hbox.pack_start(self.btn_vbox, False, False, 1) # Check visibility on config preferences if self.config.SHOW_KBTREE: self.scrolled_window.show_all() self.right_hbox.show_all() self.scrolled_window.is_visible = True else: self.scrolled_window.is_visible = False self.network_paned.show() self.xdotw.show() label = Gtk.Label(label=' Networking') label.set_angle(90) b_factory = Gtk.VBox b = b_factory(spacing=1) i = Gtk.Image() i.set_from_file(os.path.join('lib', 'ui', 'data', 'icons', 'map.png')) b.pack_start(label, True, True, 0) b.pack_start(i, True, True, 0) b.show_all() ################################################################# # Notebook ################################################################# self.notebook = Gtk.Notebook() self.notebook.set_tab_pos(Gtk.PositionType.LEFT) self.notebook.append_page(self.right_hbox, b) self.notebook.connect("switch_page", self.on_switch) # Log button self.log_btn = Gtk.Button() self.log_icn = Gtk.Image() self.log_icn.set_from_stock(Gtk.STOCK_GOTO_BOTTOM, Gtk.IconSize.MENU) self.log_btn.set_image(self.log_icn) self.log_btn.set_relief(Gtk.ReliefStyle.NONE) self.log_btn.set_tooltip_text('Show/Hide Log panel') self.log_btn.connect("clicked", self.show_log) self.notebook.set_action_widget(self.log_btn, Gtk.PackType.END) self.log_btn.show() ################################################################# # Consoles Tab ################################################################# label = Gtk.Label(label=' Terminals') label.set_angle(90) b_factory = Gtk.VBox b = b_factory(spacing=1) i = Gtk.Image() i.set_from_file( os.path.join('lib', 'ui', 'data', 'icons', 'terminal.png')) b.pack_start(label, True, True, 0) b.pack_start(i, True, True, 0) b.show_all() # Paned to contain left file manager tree and terminals notebook self.terms_paned = Gtk.HPaned() self.term_notebook = terminal_manager.TerminalNotebook(self) setattr(self.uiman, 'termnb', self.term_notebook) setattr(self.uiman, 'mainnb', self.notebook) self.file_notebook = filemanager_notebook.FileManagerNotebook(self) # Pack all terminals stuff self.terms_paned.pack1(self.file_notebook, resize=False, shrink=False) self.terms_paned.pack2(self.term_notebook, resize=True, shrink=False) self.terms_paned.show_all() self.notebook.append_page(self.terms_paned, b) ################################################################# # RCE Iface ################################################################# label = Gtk.Label(label=' Reversing') label.set_angle(90) b_factory = Gtk.VBox b = b_factory(spacing=1) i = Gtk.Image() i.set_from_stock(Gtk.STOCK_REFRESH, Gtk.IconSize.MENU) b.pack_start(label, True, True, 0) b.pack_start(i, True, True, 0) b.show_all() if self.config.HAS_SOURCEVIEW: # Create bokken UI and add to the Notebook self.bokken = bokken.MainApp('', 'pyew', self) self.bokken_tb = bokken_toolbar.TopButtons(self.bokken.uicore, self.bokken) mainvbox.pack_start(self.bokken_tb, False, False, 1) self.rcevb = self.bokken.get_supervb() self.rcevb.show_all() self.notebook.append_page(self.rcevb, b) # self.bokken_tb.init_core() self.bokken_tb.hide() ################################################################# # Xploit Iface ################################################################# # Exploits Notebook for Exploit DB, Fuzzing and Exploit Dev self.exploits_nb = Gtk.Notebook() self.exploits_nb.set_tab_pos(Gtk.PositionType.LEFT) # # Exploits DB # label = Gtk.Label(label=' Exploits DB') label.set_angle(90) b_factory = Gtk.VBox b = b_factory(spacing=1) i = Gtk.Image() i.set_from_stock(Gtk.STOCK_PREFERENCES, Gtk.IconSize.MENU) b.pack_start(label, True, True, 0) b.pack_start(i, True, True, 0) b.show_all() self.exploitsInst = exploits.Exploits(self.config, self.term_notebook) exploitsGui = self.exploitsInst.get_widget() setattr(self.exploitsInst, 'gom', self.gom) exploitsGui.show_all() self.exploits_nb.append_page(exploitsGui, b) # # Fuzzers # label = Gtk.Label(label=' Fuzzing') label.set_angle(90) b_factory = Gtk.VBox b = b_factory(spacing=1) i = Gtk.Image() i.set_from_stock(Gtk.STOCK_PREFERENCES, Gtk.IconSize.MENU) b.pack_start(label, True, True, 0) b.pack_start(i, True, True, 0) b.show_all() # Fuzzers Box to contain krash and scapy fuzzers self.fuzz_frame = fuzz_frame.FuzzFrame() setattr(self.fuzz_frame.scapyui, 'gom', self.gom) setattr(self.fuzz_frame.krashui, 'gom', self.gom) self.exploits_nb.append_page(self.fuzz_frame, b) setattr(self.uiman, 'fuzz_frame', self.fuzz_frame) # Add exploits notebook and text/label to main notebook label = Gtk.Label(label=' Exploiting') label.set_angle(90) b_factory = Gtk.VBox b = b_factory(spacing=1) i = Gtk.Image() i.set_from_stock(Gtk.STOCK_PREFERENCES, Gtk.IconSize.MENU) b.pack_start(label, True, True, 0) b.pack_start(i, True, True, 0) b.show_all() self.notebook.append_page(self.exploits_nb, b) setattr(self.uiman, 'notebook', self.notebook) self.vpaned.add1(self.notebook) self.exploits_nb.show_all() self.notebook.show() ################################################################# # Log Window ################################################################# self.logtext = Gtk.TextView(buffer=None) # Some eye candy self.logtext.override_background_color(Gtk.StateType.NORMAL, Gdk.RGBA(16400, 16400, 16440)) self.logtext.override_color(Gtk.StateType.NORMAL, Gdk.RGBA(60535, 60535, 60535, 0)) self.logtext.set_left_margin(10) self.logtext.set_wrap_mode(Gtk.WrapMode.NONE) self.logtext.set_editable(False) self.logbuffer = self.logtext.get_buffer() self.logbuffer.set_text('Loading Inguma...\n') self.logtext.show() ################################################################# # Log Scrolled Window ################################################################# self.log_scrolled_window = Gtk.ScrolledWindow() self.log_scrolled_window.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.ALWAYS) self.log_scrolled_window.is_visible = True # Always on bottom on change self.vadj = self.log_scrolled_window.get_vadjustment() self.vadj.connect( 'changed', lambda a, s=self.log_scrolled_window: self.rescroll(a, s)) # Add Textview to Scrolled Window self.log_scrolled_window.add_with_viewport(self.logtext) # Set logtext as output for gui self.gom.set_gui(self.logbuffer) # Add Scrolled Log Window to Bottom Notebook ############################################ # Notebook for bottom panel self.bottom_nb = Gtk.Notebook() self.bottom_nb.set_size_request(-1, 110) self.bottom_nb.set_tab_pos(Gtk.PositionType.LEFT) self.bottom_nb.connect("switch_page", self.on_bottom_switch) # Icon and label for Logs tab label = Gtk.Label(label=' Logs') label.set_angle(90) b_factory = Gtk.VBox b = b_factory(spacing=1) self.log_icon = Gtk.Image() self.log_icon.set_from_stock(Gtk.STOCK_JUSTIFY_FILL, Gtk.IconSize.MENU) b.pack_start(label, True, True, 0) b.pack_start(self.log_icon, True, True, 0) b.show_all() self.bottom_nb.append_page(self.log_scrolled_window, b) # Icon and label for Actions tab label = Gtk.Label(label=' Actions') label.set_angle(90) b_factory = Gtk.VBox b = b_factory(spacing=1) i = Gtk.Image() i.set_from_stock(Gtk.STOCK_EXECUTE, Gtk.IconSize.MENU) b.pack_start(label, True, True, 0) b.pack_start(i, True, True, 0) b.show_all() # Add Threads TreeView self.threadsInst = threadstv.ThreadsTv(self) threadsGui = self.threadsInst.get_widget() setattr(self.threadsInst, 'uicore', self.uicore) threadsGui.show_all() self.bottom_nb.append_page(threadsGui, b) setattr(self.fuzz_frame.scapyui, 'bottom_nb', self.bottom_nb) setattr(self.fuzz_frame.krashui, 'bottom_nb', self.bottom_nb) # Check visibility on config preferences if self.config.SHOW_LOG: self.bottom_nb.is_visible = True self.bottom_nb.show() else: self.bottom_nb.is_visible = False self.vpaned.pack2(self.bottom_nb, False, False) mainvbox.pack_start(self.vpaned, True, True, 1) self.log_scrolled_window.show() self.bottom_nb.set_current_page(0) # Add threadtv to core self.uicore.set_threadtv(self.threadsInst) setattr(self.graph_uiman, 'threadtv', self.threadsInst) setattr(self.altnode_uiman, 'threadtv', self.threadsInst) # And to exploit management module setattr(self.exploitsInst, 'threadsInst', self.threadsInst) # Must be connected here to avoid errors due to bottom_nb not yet existing self.exploits_nb.connect("switch_page", self.on_exploits_switch) ################################################################# # StatusBar ################################################################# self.statusbar = statusbar.Statusbar() self.statusbar.create_statusbar() self.statusbar.add_text(None, glob.version) mainvbox.pack_end(self.statusbar, False, False, 1) if self.config.HAS_SOURCEVIEW: self.bokken_statusbar = bokken_statusbar.Statusbar( self.bokken.uicore, self.bokken.tviews) self.bokken_statusbar.create_statusbar() mainvbox.pack_end(self.bokken_statusbar, False, False, 1) self.bokken_statusbar.hide_all() self.statusbar.show_all() # Systray self.systray = systray.Systray(self) ################################################################# # finish it ################################################################# self.vpaned.show() self.show() splash.destroy() # Check for autosaved KB and ask for loading if not libAutosave.check_kb(): self.gom.echo('Autosaved KB not found, skipping...') else: toload = libAutosave.ask_dialog() if toload: kbpath = libAutosave.get_kb_path() glob.kb.load(kbpath) libAutosave.remove_kb() # Update KB Tree self.treeview.update_tree() # Adding text to Log window self.gom.echo('Loaded', False) else: libAutosave.remove_kb() # To keep record of kb file name self.kbfile = '' # Update Map self.uicore.getDot(False) self.xdotw.set_dotcode(self.uicore.get_last_dot()) self.treeview.update_tree() self.treeview.expand_all() self.xdotw.zoom_image(1.0) Gtk.main()
def _update_gui_with_active_layer_data(self): if _filling_layer_list: return # This a bit hackish, but works. Finding a method that blocks all # gui events from being added to queue would be nice. self.block_updates = True # TEXT layer = _titler_data.active_layer self.text_view.get_buffer().set_text(layer.text) r, g, b, a = layer.color_rgba button_color = Gdk.RGBA(r, g, b, 1.0) self.color_button.set_rgba(button_color) if FACE_REGULAR == layer.font_face: self.bold_font.set_active(False) self.italic_font.set_active(False) elif FACE_BOLD == layer.font_face: self.bold_font.set_active(True) self.italic_font.set_active(False) elif FACE_ITALIC == layer.font_face: self.bold_font.set_active(False) self.italic_font.set_active(True) else:#FACE_BOLD_ITALIC self.bold_font.set_active(True) self.italic_font.set_active(True) if layer.alignment == ALIGN_LEFT: self.left_align.set_active(True) elif layer.alignment == ALIGN_CENTER: self.center_align.set_active(True) else:#ALIGN_RIGHT self.right_align.set_active(True) self.size_spin.set_value(layer.font_size) try: combo_index = self.font_family_indexes_for_name[layer.font_family] self.font_select.set_active(combo_index) except:# if font family not found we'll use first. This happens e.g at start-up if "Times New Roman" not in system. family = self.font_families[0] layer.font_family = family.get_name() self.font_select.set_active(0) self.x_pos_spin.set_value(layer.x) self.y_pos_spin.set_value(layer.y) self.rotation_spin.set_value(layer.angle) self.fill_on.set_active(layer.fill_on) # OUTLINE r, g, b, a = layer.outline_color_rgba button_color = Gdk.RGBA(r, g, b, 1.0) self.out_line_color_button.set_rgba(button_color) self.out_line_size_spin.set_value(layer.outline_width) self.outline_on.set_active(layer.outline_on) # SHADOW r, g, b = layer.shadow_color_rgb button_color = Gdk.RGBA(r, g, b, 1.0) self.shadow_color_button.set_rgba(button_color) self.shadow_opa_spin.set_value(layer.shadow_opacity) self.shadow_xoff_spin.set_value(layer.shadow_xoff) self.shadow_yoff_spin.set_value(layer.shadow_yoff) self.shadow_on.set_active(layer.shadow_on) self.block_updates = False
def do_device_found(self, device): iter = self.find_device(device) if iter: anim = TreeRowColorFade(self, self.props.model.get_path(iter), Gdk.RGBA(0, 0, 1, 1)) anim.animate(start=0.8, end=1.0)
def do_render(self, cr, widget, background_area, cell_area, flags): vw_tags = self.__count_viewable_tags() count = 0 # Select source if self.tag_list is not None: tags = self.tag_list elif self.tag is not None: tags = [self.tag] else: return # Drawing context gdkcontext = cr gdkcontext.set_antialias(cairo.ANTIALIAS_NONE) # Coordinates of the origin point x_align = self.get_property("xalign") y_align = self.get_property("yalign") padding = self.PADDING orig_x = cell_area.x + int((cell_area.width - 16 * vw_tags - padding * 2 * (vw_tags - 1)) * x_align) orig_y = cell_area.y + int((cell_area.height - 16) * y_align) # We draw the icons & squares for my_tag in tags: my_tag_icon = my_tag.get_attribute("icon") my_tag_color = my_tag.get_attribute("color") rect_x = orig_x + self.PADDING * 2 * count + 16 * count rect_y = orig_y if my_tag_icon: try: pixbuf = Gtk.IconTheme.get_default().load_icon( my_tag_icon, 16, 0) Gdk.cairo_set_source_pixbuf(gdkcontext, pixbuf, rect_x, rect_y) gdkcontext.paint() count = count + 1 except GLib.GError: # In some rare cases an icon could not be found # (e.g. wrong set icon path, missing icon) # Raising an exception breaks UI and signal catcher badly log.error(f"Can't load icon '{my_tag_icon}'") elif my_tag_color: # Draw rounded rectangle my_color = Gdk.color_parse(my_tag_color) Gdk.cairo_set_source_color(gdkcontext, my_color) self.__roundedrec(gdkcontext, rect_x, rect_y, 16, 16, 8) gdkcontext.fill() count = count + 1 # Outer line Gdk.cairo_set_source_rgba(gdkcontext, Gdk.RGBA(0, 0, 0, 0.20)) gdkcontext.set_line_width(1.0) self.__roundedrec(gdkcontext, rect_x, rect_y, 16, 16, 8) gdkcontext.stroke() if self.tag and my_tag: my_tag_icon = my_tag.get_attribute("icon") my_tag_color = my_tag.get_attribute("color") if not my_tag_icon and not my_tag_color: # Draw rounded rectangle Gdk.cairo_set_source_rgba(gdkcontext, Gdk.RGBA(0.95, 0.95, 0.95, 1)) self.__roundedrec(gdkcontext, rect_x, rect_y, 16, 16, 8) gdkcontext.fill() # Outer line Gdk.cairo_set_source_rgba(gdkcontext, Gdk.RGBA(0, 0, 0, 0.20)) gdkcontext.set_line_width(1.0) self.__roundedrec(gdkcontext, rect_x, rect_y, 16, 16, 8) gdkcontext.stroke()
def do_render(self, cr, widget, background_area, cell_area, flags): vw_tags = self.__count_viewable_tags() count = 0 # Select source if self.tag_list is not None: tags = self.tag_list elif self.tag is not None: tags = [self.tag] else: return if self.config.get('dark_mode'): symbolic_color = Gdk.RGBA(0.9, 0.9, 0.9, 1) else: symbolic_color = Gdk.RGBA(0, 0, 0, 1) # Drawing context gdkcontext = cr gdkcontext.set_antialias(cairo.ANTIALIAS_NONE) # Coordinates of the origin point x_align = self.get_property("xalign") y_align = self.get_property("yalign") padding = self.PADDING orig_x = cell_area.x + int((cell_area.width - 16 * vw_tags - padding * 2 * (vw_tags - 1)) * x_align) orig_y = cell_area.y + int((cell_area.height - 16) * y_align) # We draw the icons & squares for my_tag in tags: my_tag_icon = my_tag.get_attribute("icon") my_tag_color = my_tag.get_attribute("color") rect_x = orig_x + self.PADDING * 2 * count + 16 * count rect_y = orig_y if my_tag_icon: if my_tag_icon in self.SYMBOLIC_ICONS: icon_theme = Gtk.IconTheme.get_default() info = icon_theme.lookup_icon(my_tag_icon, 16, 0) load = info.load_symbolic(symbolic_color) pixbuf = load[0] Gdk.cairo_set_source_pixbuf(gdkcontext, pixbuf, rect_x, rect_y) gdkcontext.paint() count += 1 else: layout = PangoCairo.create_layout(cr) layout.set_markup(my_tag_icon, -1) cr.move_to(rect_x - 2, rect_y - 1) PangoCairo.show_layout(cr, layout) count += 1 elif my_tag_color: # Draw rounded rectangle my_color = Gdk.RGBA() my_color.parse(my_tag_color) Gdk.cairo_set_source_rgba(gdkcontext, my_color) self.__roundedrec(gdkcontext, rect_x, rect_y, 16, 16, 8) gdkcontext.fill() count += 1 # Outer line Gdk.cairo_set_source_rgba(gdkcontext, Gdk.RGBA(0, 0, 0, 0.20)) gdkcontext.set_line_width(1.0) self.__roundedrec(gdkcontext, rect_x, rect_y, 16, 16, 8) gdkcontext.stroke() if self.tag and my_tag: my_tag_icon = my_tag.get_attribute("icon") my_tag_color = my_tag.get_attribute("color") if not my_tag_icon and not my_tag_color: # Draw rounded rectangle Gdk.cairo_set_source_rgba(gdkcontext, Gdk.RGBA(0.95, 0.95, 0.95, 1)) self.__roundedrec(gdkcontext, rect_x, rect_y, 16, 16, 8) gdkcontext.fill() # Outer line Gdk.cairo_set_source_rgba(gdkcontext, Gdk.RGBA(0, 0, 0, 0.20)) gdkcontext.set_line_width(1.0) self.__roundedrec(gdkcontext, rect_x, rect_y, 16, 16, 8) gdkcontext.stroke()
def PluginPreferences(self, parent): red = Gdk.RGBA() red.parse("#ff0000") def validate_color(entry): text = entry.get_text() if not Gdk.RGBA().parse(text): # Invalid color, make text red entry.override_color(Gtk.StateFlags.NORMAL, red) else: # Reset text color entry.override_color(Gtk.StateFlags.NORMAL, None) def elapsed_color_changed(entry): validate_color(entry) CONFIG.elapsed_color = entry.get_text() def hover_color_changed(entry): validate_color(entry) CONFIG.hover_color = entry.get_text() def remaining_color_changed(entry): validate_color(entry) CONFIG.remaining_color = entry.get_text() def on_show_pos_toggled(button, *args): CONFIG.show_current_pos = button.get_active() def seek_amount_changed(spinbox): CONFIG.seek_amount = spinbox.get_value_as_int() vbox = Gtk.VBox(spacing=6) def on_show_time_labels_toggled(button, *args): CONFIG.show_time_labels = button.get_active() if self._bar is not None: self._bar.set_time_label_visibility(CONFIG.show_time_labels) def create_color(label_text, color, callback): hbox = Gtk.HBox(spacing=6) hbox.set_border_width(6) label = Gtk.Label(label=label_text) hbox.pack_start(label, False, True, 0) entry = Gtk.Entry() if color: entry.set_text(color) entry.connect('changed', callback) hbox.pack_start(entry, True, True, 0) return hbox box = create_color(_("Override foreground color:"), CONFIG.elapsed_color, elapsed_color_changed) vbox.pack_start(box, True, True, 0) box = create_color(_("Override hover color:"), CONFIG.hover_color, hover_color_changed) vbox.pack_start(box, True, True, 0) box = create_color(_("Override remaining color:"), CONFIG.remaining_color, remaining_color_changed) vbox.pack_start(box, True, True, 0) show_current_pos = Gtk.CheckButton(label=_("Show current position")) show_current_pos.set_active(CONFIG.show_current_pos) show_current_pos.connect("toggled", on_show_pos_toggled) vbox.pack_start(show_current_pos, True, True, 0) show_time_labels = Gtk.CheckButton(label=_("Show time labels")) show_time_labels.set_active(CONFIG.show_time_labels) show_time_labels.connect("toggled", on_show_time_labels_toggled) vbox.pack_start(show_time_labels, True, True, 0) hbox = Gtk.HBox(spacing=6) hbox.set_border_width(6) label = Gtk.Label( label=_("Seek amount when scrolling (milliseconds):")) hbox.pack_start(label, False, True, 0) seek_amount = Gtk.SpinButton(adjustment=Gtk.Adjustment( CONFIG.seek_amount, 0, 60000, 1000, 1000, 0)) seek_amount.set_numeric(True) seek_amount.connect("changed", seek_amount_changed) hbox.pack_start(seek_amount, True, True, 0) vbox.pack_start(hbox, True, True, 0) return vbox
def create_gui(self): """ Prepare the gui """ outer_box = Gtk.Grid() outer_box.set_row_spacing(64) outer_box.set_column_spacing(64) monitor_box = Gtk.Grid() alignment_box = Gtk.Grid(row_homogeneous=True) colour_box = Gtk.Grid(row_homogeneous=True) avatar_box = Gtk.Grid(row_homogeneous=True) colour_box.set_row_spacing(8) colour_box.set_column_spacing(8) avatar_box.set_column_spacing(8) alignment_box.set_column_spacing(8) outer_box.attach(monitor_box, 0, 0, 1, 1) outer_box.attach(alignment_box, 0, 1, 1, 1) outer_box.attach(colour_box, 1, 0, 1, 1) outer_box.attach(avatar_box, 1, 1, 1, 1) # Autohide #autohide_label = Gtk.Label.new("Hide on mouseover") #autohide = Gtk.CheckButton.new() # autohide.set_active(self.autohide) #autohide.connect("toggled", self.change_hide_on_mouseover) # Font chooser font_label = Gtk.Label.new("Font") font = Gtk.FontButton() if self.font: font.set_font(self.font) font.connect("font-set", self.change_font) alignment_box.attach(font_label, 0, 0, 1, 1) alignment_box.attach(font, 1, 0, 1, 1) # Colours bg_col = Gtk.ColorButton.new_with_rgba( Gdk.RGBA(self.bg_col[0], self.bg_col[1], self.bg_col[2], self.bg_col[3])) fg_col = Gtk.ColorButton.new_with_rgba( Gdk.RGBA(self.fg_col[0], self.fg_col[1], self.fg_col[2], self.fg_col[3])) tk_col = Gtk.ColorButton.new_with_rgba( Gdk.RGBA(self.tk_col[0], self.tk_col[1], self.tk_col[2], self.tk_col[3])) mt_col = Gtk.ColorButton.new_with_rgba( Gdk.RGBA(self.mt_col[0], self.mt_col[1], self.mt_col[2], self.mt_col[3])) hi_col = Gtk.ColorButton.new_with_rgba( Gdk.RGBA( self.hi_col[0], self.hi_col[1], self.hi_col[2], self.hi_col[3])) t_hi_col = Gtk.ColorButton.new_with_rgba( Gdk.RGBA( self.t_hi_col[0], self.t_hi_col[1], self.t_hi_col[2], self.t_hi_col[3])) bo_col = Gtk.ColorButton.new_with_rgba( Gdk.RGBA( self.bo_col[0], self.bo_col[1], self.bo_col[2], self.bo_col[3] ) ) bg_col.set_use_alpha(True) fg_col.set_use_alpha(True) tk_col.set_use_alpha(True) mt_col.set_use_alpha(True) hi_col.set_use_alpha(True) t_hi_col.set_use_alpha(True) bo_col.set_use_alpha(True) bg_col.connect("color-set", self.change_bg) fg_col.connect("color-set", self.change_fg) tk_col.connect("color-set", self.change_tk) mt_col.connect("color-set", self.change_mt) hi_col.connect("color-set", self.change_hi) t_hi_col.connect("color-set", self.change_t_hi) bo_col.connect("color-set", self.change_bo) text_label = Gtk.Label.new("Text") background_label = Gtk.Label.new("Label") talking_label = Gtk.Label.new("Talking") idle_label = Gtk.Label.new("Idle") border_label = Gtk.Label.new("Border") mute_label = Gtk.Label.new("Mute") colour_box.attach(text_label, 1, 0, 1, 1) colour_box.attach(background_label, 2, 0, 1, 1) colour_box.attach(border_label, 3, 0, 1, 1) colour_box.attach(talking_label, 0, 1, 1, 1) colour_box.attach(idle_label, 0, 2, 1, 1) colour_box.attach(mute_label, 0, 4, 1, 1) colour_box.attach(bg_col, 2, 2, 1, 1) colour_box.attach(hi_col, 2, 1, 1, 1) colour_box.attach(fg_col, 1, 2, 1, 1) colour_box.attach(t_hi_col, 1, 1, 1, 1) colour_box.attach(tk_col, 3, 1, 1, 1) colour_box.attach(bo_col, 3, 2, 1, 1) colour_box.attach(mt_col, 1, 4, 1, 1) # Monitor & Alignment align_label = Gtk.Label.new("Overlay Location") align_type_box = Gtk.HBox() align_type_edge = Gtk.RadioButton.new_with_label( None, "Anchor to edge") align_type_floating = Gtk.RadioButton.new_with_label_from_widget( align_type_edge, "Floating") if self.floating: align_type_floating.set_active(True) align_type_box.add(align_type_edge) align_type_box.add(align_type_floating) monitor_store = Gtk.ListStore(str) display = Gdk.Display.get_default() if "get_n_monitors" in dir(display): for i in range(0, display.get_n_monitors()): monitor_store.append([display.get_monitor(i).get_model()]) monitor = Gtk.ComboBox.new_with_model(monitor_store) monitor.set_active(self.get_monitor_index(self.monitor)) monitor.connect("changed", self.change_monitor) renderer_text = Gtk.CellRendererText() monitor.pack_start(renderer_text, True) monitor.add_attribute(renderer_text, "text", 0) self.align_x_store = Gtk.ListStore(str) self.align_x_store.append(["Left"]) self.align_x_store.append(["Right"]) align_x = Gtk.ComboBox.new_with_model(self.align_x_store) align_x.set_active(True if self.align_x else False) align_x.connect("changed", self.change_align_x) renderer_text = Gtk.CellRendererText() align_x.pack_start(renderer_text, True) align_x.add_attribute(renderer_text, "text", 0) self.align_y_store = Gtk.ListStore(str) self.align_y_store.append(["Top"]) self.align_y_store.append(["Middle"]) self.align_y_store.append(["Bottom"]) align_y = Gtk.ComboBox.new_with_model(self.align_y_store) align_y.set_active(self.align_y) align_y.connect("changed", self.change_align_y) renderer_text = Gtk.CellRendererText() align_y.pack_start(renderer_text, True) align_y.add_attribute(renderer_text, "text", 0) align_placement_button = Gtk.Button.new_with_label("Place Window") align_type_edge.connect("toggled", self.change_align_type_edge) align_type_floating.connect("toggled", self.change_align_type_floating) align_placement_button.connect("pressed", self.change_placement) self.align_x_widget = align_x self.align_y_widget = align_y self.align_monitor_widget = monitor self.align_placement_widget = align_placement_button monitor_box.attach(align_label, 0, 0, 2, 1) monitor_box.attach(align_type_box, 1, 1, 1, 1) monitor_box.attach(monitor, 1, 2, 1, 1) monitor_box.attach(align_x, 1, 3, 1, 1) monitor_box.attach(align_y, 1, 4, 1, 1) monitor_box.attach(align_placement_button, 1, 5, 1, 1) # Avatar size avatar_size_label = Gtk.Label.new("Avatar size") avatar_size_label.set_xalign(0) avatar_adjustment = Gtk.Adjustment.new( self.avatar_size, 8, 128, 1, 1, 8) avatar_size = Gtk.SpinButton.new(avatar_adjustment, 0, 0) avatar_size.connect("value-changed", self.change_avatar_size) avatar_box.attach(avatar_size_label, 0, 0, 1, 1) avatar_box.attach(avatar_size, 1, 0, 1, 1) # Avatar shape square_avatar_label = Gtk.Label.new("Square Avatar") square_avatar_label.set_xalign(0) square_avatar = Gtk.CheckButton.new() square_avatar.set_active(self.square_avatar) square_avatar.connect("toggled", self.change_square_avatar) avatar_box.attach(square_avatar_label, 0, 2, 1, 1) avatar_box.attach(square_avatar, 1, 2, 1, 1) # Display icon only icon_only_label = Gtk.Label.new("Display Icon Only") icon_only_label.set_xalign(0) icon_only = Gtk.CheckButton.new() icon_only.set_active(self.icon_only) icon_only.connect("toggled", self.change_icon_only) avatar_box.attach(icon_only_label, 0, 1, 1, 1) avatar_box.attach(icon_only, 1, 1, 1, 1) # Display Speaker only only_speaking_label = Gtk.Label.new("Display Speakers Only") only_speaking_label.set_xalign(0) only_speaking = Gtk.CheckButton.new() only_speaking.set_active(self.only_speaking) only_speaking.connect("toggled", self.change_only_speaking) avatar_box.attach(only_speaking_label, 0, 3, 1, 1) avatar_box.attach(only_speaking, 1, 3, 1, 1) # Highlight self highlight_self_label = Gtk.Label.new("Highlight Self") highlight_self_label.set_xalign(0) highlight_self = Gtk.CheckButton.new() highlight_self.set_active(self.highlight_self) highlight_self.connect("toggled", self.change_highlight_self) avatar_box.attach(highlight_self_label, 0, 4, 1, 1) avatar_box.attach(highlight_self, 1, 4, 1, 1) # Order avatars order_label = Gtk.Label.new("Order Avatars By") order_label.set_xalign(0) order_store = Gtk.ListStore(str) order_store.append(["Alphabetically"]) order_store.append(["ID"]) order_store.append(["Last Spoken"]) order = Gtk.ComboBox.new_with_model(order_store) order.set_active(self.order) order.connect("changed", self.change_order) renderer_text = Gtk.CellRendererText() order.pack_start(renderer_text, True) order.add_attribute(renderer_text, "text", 0) avatar_box.attach(order_label, 0, 5, 1, 1) avatar_box.attach(order, 1, 5, 1, 1) # Icon spacing icon_spacing_label = Gtk.Label.new("Icon Spacing") icon_spacing_label.set_xalign(0) icon_spacing_adjustment = Gtk.Adjustment.new( self.icon_spacing, 0, 64, 1, 1, 0) icon_spacing = Gtk.SpinButton.new(icon_spacing_adjustment, 0, 0) icon_spacing.connect("value-changed", self.change_icon_spacing) alignment_box.attach(icon_spacing_label, 0, 1, 1, 1) alignment_box.attach(icon_spacing, 1, 1, 1, 1) # Text padding text_padding_label = Gtk.Label.new("Text Padding") text_padding_label.set_xalign(0) text_padding_adjustment = Gtk.Adjustment.new( self.text_padding, 0, 64, 1, 1, 0) text_padding = Gtk.SpinButton.new(text_padding_adjustment, 0, 0) text_padding.connect("value-changed", self.change_text_padding) alignment_box.attach(text_padding_label, 0, 2, 1, 1) alignment_box.attach(text_padding, 1, 2, 1, 1) # Text Baseline Adjustment text_baseline_label = Gtk.Label.new("Text Vertical Offset") text_baseline_label.set_xalign(0) text_baseline_adjustment = Gtk.Adjustment.new( self.text_baseline_adj, -32, 32, 1, 1, 0) text_baseline = Gtk.SpinButton.new(text_baseline_adjustment, 0, 0) text_baseline.connect("value-changed", self.change_text_baseline) alignment_box.attach(text_baseline_label, 0, 3, 1, 1) alignment_box.attach(text_baseline, 1, 3, 1, 1) # Edge padding vert_edge_padding_label = Gtk.Label.new("Vertical Edge Padding") vert_edge_padding_label.set_xalign(0) vert_edge_padding_adjustment = Gtk.Adjustment.new( self.vert_edge_padding, 0, 1000, 1, 1, 0) vert_edge_padding = Gtk.SpinButton.new( vert_edge_padding_adjustment, 0, 0) vert_edge_padding.connect( "value-changed", self.change_vert_edge_padding) alignment_box.attach(vert_edge_padding_label, 0, 4, 1, 1) alignment_box.attach(vert_edge_padding, 1, 4, 1, 1) horz_edge_padding_label = Gtk.Label.new("Horizontal Edge Padding") horz_edge_padding_adjustment = Gtk.Adjustment.new( self.horz_edge_padding, 0, 1000, 1, 1, 0) horz_edge_padding = Gtk.SpinButton.new( horz_edge_padding_adjustment, 0, 0) horz_edge_padding.connect( "value-changed", self.change_horz_edge_padding) alignment_box.attach(horz_edge_padding_label, 0, 5, 1, 1) alignment_box.attach(horz_edge_padding, 1, 5, 1, 1) # Display icon horizontally horizontal_label = Gtk.Label.new("Display Horizontally") horizontal_label.set_xalign(0) horizontal = Gtk.CheckButton.new() horizontal.set_active(self.horizontal) horizontal.connect("toggled", self.change_horizontal) alignment_box.attach(horizontal_label, 0, 6, 1, 1) alignment_box.attach(horizontal, 1, 6, 1, 1) # Guild ids to load: guild_ids_label = Gtk.Label.new("Search Servers for User") guild_ids_box = Gtk.VBox(homogeneous=False) self.guild_ids_list = Gtk.ListStore(bool, str, str, str) self.guild_ids_filter = self.guild_ids_list.filter_new() self.guild_ids_filter.set_visible_func(self.guild_filter_func) # TODO Append guilds guild_ids_scroll_window = Gtk.ScrolledWindow() guild_ids_scroll_window.set_size_request(300, 150) guild_ids_tree = Gtk.TreeView(model=self.guild_ids_filter) guild_column = Gtk.TreeViewColumn("Guilds") toggle = Gtk.CellRendererToggle() title = Gtk.CellRendererText() icon = Gtk.CellRendererPixbuf() guild_column.pack_start(toggle, True) guild_column.pack_start(icon, True) guild_column.pack_start(title, True) guild_column.add_attribute(toggle, "active", 0) guild_column.add_attribute(icon, "icon_name", 1) guild_column.add_attribute(title, "text", 2) guild_ids_tree.append_column(guild_column) guild_ids_tree.set_activate_on_single_click(True) guild_ids_tree.connect( "row-activated", self.on_guild_selection_changed) guild_filter = Gtk.Entry() guild_filter.set_placeholder_text("Filter...") guild_filter.connect("changed", self.guild_filter_changed) guild_ids_box.pack_start(guild_ids_label, False, False, 0) guild_ids_box.pack_start(guild_filter, False, False, 0) guild_ids_box.pack_end(guild_ids_scroll_window, True, True, 0) guild_ids_scroll_window.add(guild_ids_tree) outer_box.attach(guild_ids_box, 0, 3, 2, 1) self.add(outer_box) self.set_orientated_names()
def color_parser(color): rgba = Gdk.RGBA() rgba.parse(color) return rgba
def __init__(self): window = Gtk.Window() window.set_title(_("Welcome Screen")) window.set_icon_from_file("/usr/share/linuxmint/logo.png") window.set_position(Gtk.WindowPosition.CENTER) window.connect("destroy", Gtk.main_quit) with open("/etc/linuxmint/info") as f: config = dict([line.strip().split("=") for line in f]) codename = config['CODENAME'].capitalize() edition = config['EDITION'] release = config['RELEASE'] desktop = config['DESKTOP'] self.release_notes = config['RELEASE_NOTES_URL'] self.user_guide = "http://www.linuxmint.com/documentation.php" # Switch to config['USER_GUIDE_URL'] when mintdoc is ready and localized self.new_features = config['NEW_FEATURES_URL'] # distro-specific self.is_lmde = False self.dist_name = "Linux Mint" self.codec_pkg_name = "mint-meta-codecs" if os.path.exists("/usr/share/doc/debian-system-adjustments/copyright"): self.is_lmde = True self.dist_name = "LMDE" self.codec_pkg_name = "mint-meta-debian-codecs" bgcolor = Gdk.RGBA() bgcolor.parse("rgba(0,0,0,0)") fgcolor = Gdk.RGBA() fgcolor.parse("#3e3e3e") main_box = Gtk.VBox() event_box = Gtk.EventBox() event_box.set_name("event_box") event_box.override_background_color(Gtk.StateType.NORMAL, bgcolor) event_box.override_color(Gtk.StateType.NORMAL, fgcolor) main_box.pack_start(event_box, True, True, 0) vbox = Gtk.VBox() vbox.set_border_width(12) vbox.set_spacing(0) event_box.add(vbox) headerbox = Gtk.VBox() logo = Gtk.Image() if "KDE" in desktop: logo.set_from_file("/usr/share/linuxmint/mintwelcome/icons/logo_header_kde.png") else: logo.set_from_file("/usr/share/linuxmint/mintwelcome/icons/logo_header.png") headerbox.pack_start(logo, False, False, 0) label = Gtk.Label() if "KDE" in desktop: label.set_markup("<span font='12.5' fgcolor='#3e3e3e'>%s %s '<span fgcolor='#3267b8'>%s</span>'</span>" % (self.dist_name, release, codename)) else: label.set_markup("<span font='12.5' fgcolor='#3e3e3e'>%s %s '<span fgcolor='#709937'>%s</span>'</span>" % (self.dist_name, release, codename)) headerbox.pack_start(label, False, False, 0) label = Gtk.Label() label.set_markup("<span font='8' fgcolor='#3e3e3e'><i>%s</i></span>" % edition) headerbox.pack_start(label, False, False, 2) vbox.pack_start(headerbox, False, False, 10) welcome_label = Gtk.Label() welcome_message = _("Welcome and thank you for choosing Linux Mint. We hope you'll enjoy using it as much as we did designing it. The links below will help you get started with your new operating system. Have a great time and don't hesitate to send us your feedback.") welcome_label.set_markup("<span font='9' fgcolor='#3e3e3e'>%s</span>" % welcome_message) welcome_label.set_line_wrap(True) vbox.pack_start(welcome_label, False, False, 10) separator = Gtk.Image() separator.set_from_file('/usr/share/linuxmint/mintwelcome/icons/separator.png') vbox.pack_start(separator, False, False, 10) liststore = Gtk.ListStore(Pixbuf, str, str, str, Pixbuf, Pixbuf) self.iconview = Gtk.IconView.new() self.iconview.add_events(Gdk.EventMask.POINTER_MOTION_MASK) self.iconview.connect("item-activated", self.item_activated) self.iconview.connect("motion-notify-event", self.on_pointer_motion) self.iconview.connect("button-press-event", self.on_mouse_click) self.iconview.set_model(liststore) self.iconview.set_pixbuf_column(0) self.iconview.set_text_column(2) self.iconview.set_tooltip_column(3) self.iconview.set_columns(4) self.iconview.set_margin(0) self.iconview.set_spacing(6) self.iconview.set_item_padding(3) self.iconview.set_row_spacing(20) self.iconview.set_column_spacing(20) self.iconview.override_background_color(Gtk.StateType.NORMAL, bgcolor) self.iconview.override_color(Gtk.StateType.NORMAL, fgcolor) #self.iconview.connect("selection-changed", self.item_activated) hbox = Gtk.HBox() hbox.pack_start(self.iconview, True, True, 30) vbox.pack_start(hbox, False, False, 10) actions = [] add_codecs = False if ("Gnome" in desktop or "MATE" in desktop): # Some GNOME editions (Cinnamon, MATE) can come without codecs import apt cache = apt.Cache() if self.codec_pkg_name in cache: pkg = cache[self.codec_pkg_name] if not pkg.is_installed: add_codecs = True self.last_selected_path = None if add_codecs: if self.is_lmde: actions.append(['new_features', _("New features"), _("See what is new in this release")]) actions.append(['user_guide', _("Documentation"), _("Learn all the basics to get started with Linux Mint")]) actions.append(['software', _("Apps"), _("Install additional software")]) if not self.is_lmde: actions.append(['driver', _("Drivers"), _("Install hardware drivers")]) actions.append(['codecs', _("Multimedia codecs"), _("Add all the missing multimedia codecs")]) actions.append(['forums', _("Forums"), _("Seek help from other users in the Linux Mint forums")]) actions.append(['chatroom', _("Chat room"), _("Chat live with other users in the chat room")]) actions.append(['get_involved', _("Getting involved"), _("Find out how to get involved in the Linux Mint project")]) actions.append(['donors', _("Donations"), _("Make a donation to the Linux Mint project")]) else: actions.append(['new_features', _("New features"), _("See what is new in this release")]) if self.is_lmde: actions.append(['release_notes', _("Release notes"), _("Read the release notes")]) actions.append(['user_guide', _("Documentation"), _("Learn all the basics to get started with Linux Mint")]) actions.append(['software', _("Apps"), _("Install additional software")]) if not self.is_lmde: actions.append(['driver', _("Drivers"), _("Install hardware drivers")]) actions.append(['forums', _("Forums"), _("Seek help from other users in the Linux Mint forums")]) actions.append(['chatroom', _("Chat room"), _("Chat live with other users in the chat room")]) actions.append(['get_involved', _("Getting involved"), _("Find out how to get involved in the Linux Mint project")]) actions.append(['donors', _("Donations"), _("Make a donation to the Linux Mint project")]) for action in actions: desat_pixbuf = Pixbuf.new_from_file('/usr/share/linuxmint/mintwelcome/icons/desat/%s.png' % action[0]) color_pixbuf = Pixbuf.new_from_file('/usr/share/linuxmint/mintwelcome/icons/color/%s.png' % action[0]) pixbuf = desat_pixbuf liststore.append([pixbuf, action[0], action[1], action[2], desat_pixbuf, color_pixbuf]) hbox = Gtk.HBox() hbox.set_border_width(6) main_box.pack_end(hbox, False, False, 0) checkbox = Gtk.CheckButton() checkbox.set_label(_("Show this dialog at startup")) if not os.path.exists(NORUN_FLAG): checkbox.set_active(True) checkbox.connect("toggled", self.on_button_toggled) hbox.pack_end(checkbox, False, False, 2) window.add(main_box) window.set_default_size(540, 420) css_provider = Gtk.CssProvider() css = """ #event_box { background-image: -gtk-gradient (linear, left top, left bottom, from (#d6d6d6), color-stop (0.5, #efefef), to (#d6d6d6)); } """ css_provider.load_from_data(css.encode('UTF-8')) screen = Gdk.Screen.get_default() style_context = window.get_style_context() style_context.add_provider_for_screen(screen, css_provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION) window.show_all()
def get_transition_panel(trans_data): type_combo_box = Gtk.ComboBoxText() name, t_service_id = mlttransitions.rendered_transitions[0] type_combo_box.append_text(name) name, t_service_id = mlttransitions.rendered_transitions[1] type_combo_box.append_text(name) name, t_service_id = mlttransitions.rendered_transitions[2] type_combo_box.append_text(name) type_combo_box.set_active(0) type_row = get_two_column_box(Gtk.Label(label=_("Type:")), type_combo_box) wipe_luma_combo_box = Gtk.ComboBoxText() keys = mlttransitions.wipe_lumas.keys() keys.sort() for k in keys: wipe_luma_combo_box.append_text(k) wipe_luma_combo_box.set_active(0) wipe_label = Gtk.Label(label=_("Wipe Pattern:")) wipe_row = get_two_column_box(wipe_label, wipe_luma_combo_box) color_button = Gtk.ColorButton.new_with_rgba(Gdk.RGBA(0, 0, 0, 1)) color_button_box = guiutils.get_left_justified_box([color_button]) color_label = Gtk.Label(label=_("Dip Color:")) color_row = get_two_column_box(color_label, color_button_box) wipe_luma_combo_box.set_sensitive(False) color_button.set_sensitive(False) wipe_label.set_sensitive(False) color_label.set_sensitive(False) transition_type_widgets = (type_combo_box, wipe_luma_combo_box, color_button, wipe_label, color_label) type_combo_box.connect( "changed", lambda w, e: _transition_type_changed(transition_type_widgets), None) length_entry = Gtk.Entry() trans_length = 30 if editorstate.transition_length > 0: # use last invocation length if available trans_length = editorstate.transition_length length_entry.set_text(str(trans_length)) length_row = get_two_column_box(Gtk.Label(label=_("Length:")), length_entry) filler = Gtk.Label() filler.set_size_request(10, 10) out_clip_label = Gtk.Label(label=_("First Clip Out Handle:")) out_clip_value = Gtk.Label(label=str(trans_data["from_handle"]) + _(" frame(s)")) in_clip_label = Gtk.Label(label=_("Second Clip In Handle:")) in_clip_value = Gtk.Label(label=str(trans_data["to_handle"]) + _(" frame(s)")) out_handle_row = get_two_column_box(out_clip_label, out_clip_value) in_handle_row = get_two_column_box(in_clip_label, in_clip_value) # Encoding widgets encodings_cb = Gtk.ComboBoxText() for encoding in renderconsumer.encoding_options: encodings_cb.append_text(encoding.name) encodings_cb.set_active(0) quality_cb = Gtk.ComboBoxText() transition_widgets = (encodings_cb, quality_cb) encodings_cb.connect( "changed", lambda w, e: _transition_encoding_changed(transition_widgets), None) _fill_transition_quality_combo_box(transition_widgets, 10) _set_saved_encoding(transition_widgets) # Build panel edit_vbox = Gtk.VBox(False, 2) edit_vbox.pack_start(type_row, False, False, 0) edit_vbox.pack_start(length_row, False, False, 0) edit_vbox.pack_start(wipe_row, False, False, 0) edit_vbox.pack_start(color_row, False, False, 0) data_vbox = Gtk.VBox(False, 2) data_vbox.pack_start(out_handle_row, False, False, 0) data_vbox.pack_start(in_handle_row, False, False, 0) enconding_vbox = Gtk.VBox(False, 2) enconding_vbox.pack_start(encodings_cb, False, False, 0) enconding_vbox.pack_start(quality_cb, False, False, 0) vbox = Gtk.VBox(False, 2) vbox.pack_start(get_named_frame(_("Transition Options"), edit_vbox), True, True, 0) vbox.pack_start(get_named_frame(_("Encoding"), enconding_vbox), True, True, 0) vbox.pack_start(get_named_frame(_("Media Overlap info"), data_vbox), True, True, 0) alignment = guiutils.set_margins(vbox, 12, 24, 12, 12) return (alignment, type_combo_box, length_entry, encodings_cb, quality_cb, wipe_luma_combo_box, color_button)
def select_chadmin(self, *args): self.navbar.override_background_color(Gtk.StateFlags.NORMAL, Gdk.RGBA(0.7, 1, 0.7, 1)) self.update(self.cur_server, self.cur_domain, "admin")
def _initialize_widgets(self, task, window): from .TasksWindow import UNCHECKED_IMAGE, CHECKED_IMAGE #Display the task details vbox = Gtk.VBox() self.add(vbox) style_context = window.get_style_context() colour = style_context.lookup_color("selected_bg_color")[1] vbox.override_background_color(Gtk.StateType.NORMAL, colour) vbox.set_margin_left(0) self._header_eb = Gtk.EventBox() self._header_eb.override_background_color(Gtk.StateType.NORMAL, Gdk.RGBA(1.0, 1.0, 1.0, 1.0)) self._header_eb.add_events(Gdk.EventMask.BUTTON_PRESS_MASK | Gdk.EventMask.POINTER_MOTION_MASK) header_hbox = Gtk.HBox() self._checkmark = ImageToggle(UNCHECKED_IMAGE, CHECKED_IMAGE) self._checkmark.set_active(task.complete) header_hbox.pack_start(self._checkmark, 0, False, False) header_hbox.set_margin_top(10) header_hbox.set_margin_bottom(10) self._summary_label_eb = Gtk.EventBox() self._summary_label_eb.add_events(Gdk.EventMask.BUTTON_PRESS_MASK | Gdk.EventMask.POINTER_MOTION_MASK) self._summary_label_eb.connect("button-press-event", self.summary_clicked_cb) self._summary_label_eb.set_visible_window(False) self._summary_label = Gtk.Label() self._summary_label.set_markup("<b>" + task.summary + "</b>") self._summary_label.set_padding(0, 5) self._summary_label.set_line_wrap(True) self._summary_label_eb.add(self._summary_label) self._summary_edit = Gtk.Entry() self._summary_edit.set_size_request(400, -1) self._summary_edit.set_text(task.summary) self._summary_edit.connect("key-press-event", self.summary_edit_changed_cb) self._summary_edit.connect("focus-out-event", self.summary_edit_focus_out_cb) label_and_tags_box = Gtk.VBox() label_and_tags_box.pack_start(self._summary_edit, 0, True, False) label_and_tags_box.pack_start(self._summary_label_eb, 0, True, False) if task.tags.exists(): #TODO: List tags pass else: tag_label = Gtk.Label() tag_label.set_markup('<span foreground="grey">Add tags</span>') tag_label.set_halign(Gtk.Align.START) tag_label.set_justify(Gtk.Justification.LEFT) label_and_tags_box.pack_start(tag_label, 0, True, False) header_hbox.pack_start(label_and_tags_box, 0, True, False) # archive_button = Gtk.Button("X") # archive_button.set_margin_right(5) # header_hbox.pack_end(archive_button, 0, True, False) self._header_eb.add(header_hbox) vbox.pack_start(self._header_eb, 0, True, False) details_label = Gtk.Label() details_label.set_markup("<b>" + "Notes" + "</b>") details_label.set_justify(Gtk.Justification.LEFT) details_label.set_halign(Gtk.Align.START) details_label.set_margin_bottom(10) self._notes_box = Gtk.TextView() self._notes_box.get_buffer().set_text(task.details) self._notes_box.set_left_margin(2) self._notes_box.set_right_margin(2) self._notes_box.set_pixels_above_lines(2) self._notes_box.set_pixels_below_lines(2) self._notes_box.get_buffer().connect("changed", self.notes_changed_callback) self._notes_box.set_wrap_mode(Gtk.WrapMode.WORD) notes_scrolled_window = Gtk.ScrolledWindow() notes_scrolled_window.add_with_viewport(self._notes_box) notes_scrolled_window.set_size_request(-1, 50) details_vbox = Gtk.VBox() details_vbox.pack_start(details_label, 0, True, False) details_vbox.pack_start(notes_scrolled_window, 0, True, False) details_vbox.set_margin_left(50) details_vbox.set_margin_top(10) details_vbox.set_margin_bottom(20) details_vbox.set_margin_right(50) vbox.pack_start(details_vbox, 0, True, False) vbox.pack_start(Gtk.Separator(), 0, True, True) schedule_label = Gtk.Label() schedule_label.set_markup("<b>" + "Deadline" + "</b>") schedule_label.set_justify(Gtk.Justification.LEFT) schedule_label.set_halign(Gtk.Align.START) schedule_label.set_margin_bottom(10) schedule_vbox = Gtk.VBox() schedule_vbox.pack_start(schedule_label, 0, True, False) schedule_enabled = Gtk.CheckButton() schedule_enabled.set_label("Set a deadline?") schedule_enabled.set_margin_bottom(20) schedule_enabled.connect("toggled", self.schedule_enabled_toggled_cb) self._schedule_calendar = Gtk.Calendar() if self._task.due_date: self._schedule_calendar.select_month(self._task.due_date.month, self._task.due_date.year) self._schedule_calendar.select_day(self._task.due_date.day) self._schedule_calendar.connect("day-selected", self.due_date_changed_cb) schedule_enabled.set_active(self._task.due_date is not None) schedule_enabled.emit("toggled") schedule_vbox.pack_start(schedule_enabled, 0, True, False) schedule_hbox = Gtk.HBox() schedule_hbox.pack_start(self._schedule_calendar, 0, False, False) time_selector = Gtk.HBox() time_selector.set_margin_left(50) time_selector.set_margin_top(10) def show_leading_zeros(spin_button): adjustment = spin_button.get_adjustment() spin_button.set_text('{:02d}'.format(int(adjustment.get_value()))) return True self._hour_spinbutton = Gtk.SpinButton() self._hour_spinbutton.set_range(0, 23) self._hour_spinbutton.connect("output", show_leading_zeros) self._hour_spinbutton.set_margin_left(2) self._hour_spinbutton.set_margin_right(10) self._hour_spinbutton.set_increments(1, 0) self._hour_spinbutton.set_wrap(True) self._hour_spinbutton.connect("value-changed", self.due_time_changed_cb) if self._task.due_time: self._hour_spinbutton.set_value( int(self._task.due_time.strftime("%H"))) time_selector.pack_start(Gtk.Label("Hours:"), 5, True, False) time_selector.pack_start(self._hour_spinbutton, 5, True, False) self._minute_spinbutton = Gtk.SpinButton() self._minute_spinbutton.set_range(0, 59) self._minute_spinbutton.connect("output", show_leading_zeros) self._minute_spinbutton.set_margin_left(2) self._minute_spinbutton.set_margin_right(10) self._minute_spinbutton.set_increments(1, 0) self._minute_spinbutton.set_wrap(True) self._minute_spinbutton.connect("value-changed", self.due_time_changed_cb) if self._task.due_time: self._minute_spinbutton.set_value( int(self._task.due_time.strftime("%M"))) time_selector.pack_start(Gtk.Label("Minutes:"), 5, True, False) time_selector.pack_start(self._minute_spinbutton, 5, True, False) time_vbox = Gtk.VBox() self._time_checkbox = Gtk.CheckButton() self._time_checkbox.set_label("Set a time?") self._time_checkbox.set_margin_left(20) self._time_checkbox.set_active(self._task.due_time is not None) self._time_checkbox.set_sensitive(schedule_enabled.get_active()) self._time_checkbox.connect("toggled", self.time_enabled_toggled_cb) #Make the hours and minutes sensitive to the time checkbox self._hour_spinbutton.set_sensitive(self._time_checkbox.get_active()) self._minute_spinbutton.set_sensitive(self._time_checkbox.get_active()) time_vbox.pack_start(self._time_checkbox, 0, True, False) time_vbox.pack_start(time_selector, 0, True, False) schedule_hbox.pack_start(time_vbox, 0, True, False) schedule_vbox.pack_start(schedule_hbox, 0, True, False) schedule_vbox.set_margin_left(50) schedule_vbox.set_margin_top(10) schedule_vbox.set_margin_bottom(20) schedule_vbox.set_margin_right(5) vbox.pack_start(schedule_vbox, 0, True, False) vbox.pack_start(Gtk.Separator(), 0, True, True)
def __init__(self): GObject.GObject.__init__(self) self.set_title(_("Titler")) self.connect("delete-event", lambda w, e:close_titler()) if editorstate.screen_size_small_height() == True: global TEXT_LAYER_LIST_HEIGHT, TEXT_VIEW_HEIGHT, VIEW_EDITOR_HEIGHT TEXT_LAYER_LIST_HEIGHT = 150 TEXT_VIEW_HEIGHT = 180 VIEW_EDITOR_HEIGHT = 450 if editorstate.screen_size_small_height() == True: global VIEW_EDITOR_WIDTH VIEW_EDITOR_WIDTH = 680 self.block_updates = False self.view_editor = vieweditor.ViewEditor(PLAYER().profile, VIEW_EDITOR_WIDTH, VIEW_EDITOR_HEIGHT) self.view_editor.active_layer_changed_listener = self.active_layer_changed self.guides_toggle = vieweditor.GuidesViewToggle(self.view_editor) add_b = Gtk.Button(_("Add")) del_b = Gtk.Button(_("Delete")) add_b.connect("clicked", lambda w:self._add_layer_pressed()) del_b.connect("clicked", lambda w:self._del_layer_pressed()) add_del_box = Gtk.HBox() add_del_box = Gtk.HBox(True,1) add_del_box.pack_start(add_b, True, True, 0) add_del_box.pack_start(del_b, True, True, 0) center_h_icon = Gtk.Image.new_from_file(respaths.IMAGE_PATH + "center_horizontal.png") center_v_icon = Gtk.Image.new_from_file(respaths.IMAGE_PATH + "center_vertical.png") center_h = Gtk.Button() center_h.set_image(center_h_icon) center_h.connect("clicked", lambda w:self._center_h_pressed()) center_v = Gtk.Button() center_v.set_image(center_v_icon) center_v.connect("clicked", lambda w:self._center_v_pressed()) self.layer_list = TextLayerListView(self._layer_selection_changed, self._layer_visibility_toggled) self.layer_list.set_size_request(TEXT_LAYER_LIST_WIDTH, TEXT_LAYER_LIST_HEIGHT) self.text_view = Gtk.TextView() self.text_view.set_pixels_above_lines(2) self.text_view.set_left_margin(2) self.text_view.get_buffer().connect("changed", self._text_changed) self.sw = Gtk.ScrolledWindow() self.sw.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.ALWAYS) self.sw.add(self.text_view) self.sw.set_size_request(TEXT_VIEW_WIDTH, TEXT_VIEW_HEIGHT) scroll_frame = Gtk.Frame() scroll_frame.add(self.sw) self.tc_display = guicomponents.MonitorTCDisplay() self.tc_display.use_internal_frame = True self.tc_display.widget.set_valign(Gtk.Align.CENTER) self.pos_bar = positionbar.PositionBar() self.pos_bar.set_listener(self.position_listener) self.pos_bar.update_display_from_producer(PLAYER().producer) self.pos_bar.mouse_release_listener = self.pos_bar_mouse_released pos_bar_frame = Gtk.Frame() pos_bar_frame.add(self.pos_bar.widget) pos_bar_frame.set_shadow_type(Gtk.ShadowType.ETCHED_IN) pos_bar_frame.set_valign(Gtk.Align.CENTER) font_map = PangoCairo.font_map_get_default() unsorted_families = font_map.list_families() if len(unsorted_families) == 0: print "No font families found in system! Titler will not work." self.font_families = sorted(unsorted_families, key=lambda family: family.get_name()) self.font_family_indexes_for_name = {} combo = Gtk.ComboBoxText() indx = 0 for family in self.font_families: combo.append_text(family.get_name()) self.font_family_indexes_for_name[family.get_name()] = indx indx += 1 combo.set_active(0) self.font_select = combo self.font_select.connect("changed", self._edit_value_changed) adj = Gtk.Adjustment(float(DEFAULT_FONT_SIZE), float(1), float(300), float(1)) self.size_spin = Gtk.SpinButton() self.size_spin.set_adjustment(adj) self.size_spin.connect("changed", self._edit_value_changed) self.size_spin.connect("key-press-event", self._key_pressed_on_widget) font_main_row = Gtk.HBox() font_main_row.pack_start(self.font_select, True, True, 0) font_main_row.pack_start(guiutils.pad_label(5, 5), False, False, 0) font_main_row.pack_start(self.size_spin, False, False, 0) self.bold_font = Gtk.ToggleButton() self.italic_font = Gtk.ToggleButton() bold_icon = Gtk.Image.new_from_stock(Gtk.STOCK_BOLD, Gtk.IconSize.BUTTON) italic_icon = Gtk.Image.new_from_stock(Gtk.STOCK_ITALIC, Gtk.IconSize.BUTTON) self.bold_font.set_image(bold_icon) self.italic_font.set_image(italic_icon) self.bold_font.connect("clicked", self._edit_value_changed) self.italic_font.connect("clicked", self._edit_value_changed) self.left_align = Gtk.RadioButton(None) self.center_align = Gtk.RadioButton.new_from_widget(self.left_align) self.right_align = Gtk.RadioButton.new_from_widget(self.left_align) left_icon = Gtk.Image.new_from_stock(Gtk.STOCK_JUSTIFY_LEFT, Gtk.IconSize.BUTTON) center_icon = Gtk.Image.new_from_stock(Gtk.STOCK_JUSTIFY_CENTER, Gtk.IconSize.BUTTON) right_icon = Gtk.Image.new_from_stock(Gtk.STOCK_JUSTIFY_RIGHT, Gtk.IconSize.BUTTON) self.left_align.set_image(left_icon) self.center_align.set_image(center_icon) self.right_align.set_image(right_icon) self.left_align.set_mode(False) self.center_align.set_mode(False) self.right_align.set_mode(False) self.left_align.connect("clicked", self._edit_value_changed) self.center_align.connect("clicked", self._edit_value_changed) self.right_align.connect("clicked", self._edit_value_changed) self.color_button = Gtk.ColorButton.new_with_rgba(Gdk.RGBA(red=1.0, green=1.0, blue=1.0, alpha=1.0)) self.color_button.connect("color-set", self._edit_value_changed) self.fill_on = Gtk.CheckButton() self.fill_on.set_active(True) self.fill_on.connect("toggled", self._edit_value_changed) buttons_box = Gtk.HBox() buttons_box.pack_start(Gtk.Label(), True, True, 0) buttons_box.pack_start(self.bold_font, False, False, 0) buttons_box.pack_start(self.italic_font, False, False, 0) buttons_box.pack_start(guiutils.pad_label(5, 5), False, False, 0) buttons_box.pack_start(self.left_align, False, False, 0) buttons_box.pack_start(self.center_align, False, False, 0) buttons_box.pack_start(self.right_align, False, False, 0) buttons_box.pack_start(guiutils.pad_label(15, 5), False, False, 0) buttons_box.pack_start(self.color_button, False, False, 0) buttons_box.pack_start(guiutils.pad_label(2, 1), False, False, 0) buttons_box.pack_start(self.fill_on, False, False, 0) buttons_box.pack_start(Gtk.Label(), True, True, 0) outline_label = Gtk.Label(_("<b>Outline</b>")) outline_label.set_use_markup(True) outline_size = Gtk.Label(_("Size:")) self.out_line_color_button = Gtk.ColorButton.new_with_rgba(Gdk.RGBA(red=0.3, green=0.3, blue=0.3, alpha=1.0)) self.out_line_color_button.connect("color-set", self._edit_value_changed) adj2 = Gtk.Adjustment(float(3), float(1), float(50), float(1)) self.out_line_size_spin = Gtk.SpinButton() self.out_line_size_spin.set_adjustment(adj2) self.out_line_size_spin.connect("changed", self._edit_value_changed) self.out_line_size_spin.connect("key-press-event", self._key_pressed_on_widget) self.outline_on = Gtk.CheckButton() self.outline_on.set_active(False) self.outline_on.connect("toggled", self._edit_value_changed) outline_box = Gtk.HBox() outline_box.pack_start(outline_label, False, False, 0) outline_box.pack_start(guiutils.pad_label(15, 1), False, False, 0) outline_box.pack_start(outline_size, False, False, 0) outline_box.pack_start(guiutils.pad_label(2, 1), False, False, 0) outline_box.pack_start(self.out_line_size_spin, False, False, 0) outline_box.pack_start(guiutils.pad_label(15, 1), False, False, 0) outline_box.pack_start(self.out_line_color_button, False, False, 0) outline_box.pack_start(guiutils.pad_label(2, 1), False, False, 0) outline_box.pack_start(self.outline_on, False, False, 0) outline_box.pack_start(Gtk.Label(), True, True, 0) shadow_label = Gtk.Label(_("<b>Shadow</b>")) shadow_label.set_use_markup(True) shadow_opacity_label = Gtk.Label(_("Opacity:")) shadow_xoff = Gtk.Label(_("X Off:")) shadow_yoff = Gtk.Label(_("Y Off:")) self.shadow_opa_spin = Gtk.SpinButton() adj3 = Gtk.Adjustment(float(100), float(1), float(100), float(1)) self.shadow_opa_spin.set_adjustment(adj3) self.shadow_opa_spin.connect("changed", self._edit_value_changed) self.shadow_opa_spin.connect("key-press-event", self._key_pressed_on_widget) self.shadow_xoff_spin = Gtk.SpinButton() adj4 = Gtk.Adjustment(float(3), float(1), float(100), float(1)) self.shadow_xoff_spin.set_adjustment(adj4) self.shadow_xoff_spin.connect("changed", self._edit_value_changed) self.shadow_xoff_spin.connect("key-press-event", self._key_pressed_on_widget) self.shadow_yoff_spin = Gtk.SpinButton() adj5 = Gtk.Adjustment(float(3), float(1), float(100), float(1)) self.shadow_yoff_spin.set_adjustment(adj5) self.shadow_yoff_spin.connect("changed", self._edit_value_changed) self.shadow_yoff_spin.connect("key-press-event", self._key_pressed_on_widget) self.shadow_on = Gtk.CheckButton() self.shadow_on.set_active(False) self.shadow_on.connect("toggled", self._edit_value_changed) self.shadow_color_button = Gtk.ColorButton.new_with_rgba(Gdk.RGBA(red=0.3, green=0.3, blue=0.3, alpha=1.0)) self.shadow_color_button.connect("color-set", self._edit_value_changed) shadow_box_1 = Gtk.HBox() shadow_box_1.pack_start(shadow_label, False, False, 0) shadow_box_1.pack_start(guiutils.pad_label(15, 1), False, False, 0) shadow_box_1.pack_start(shadow_opacity_label, False, False, 0) shadow_box_1.pack_start(self.shadow_opa_spin, False, False, 0) shadow_box_1.pack_start(guiutils.pad_label(15, 1), False, False, 0) shadow_box_1.pack_start(self.shadow_color_button, False, False, 0) shadow_box_1.pack_start(guiutils.pad_label(2, 1), False, False, 0) shadow_box_1.pack_start(self.shadow_on, False, False, 0) shadow_box_1.pack_start(Gtk.Label(), True, True, 0) shadow_box_2 = Gtk.HBox() shadow_box_2.pack_start(shadow_xoff, False, False, 0) shadow_box_2.pack_start(self.shadow_xoff_spin, False, False, 0) shadow_box_2.pack_start(guiutils.pad_label(15, 1), False, False, 0) shadow_box_2.pack_start(shadow_yoff, False, False, 0) shadow_box_2.pack_start(self.shadow_yoff_spin, False, False, 0) shadow_box_2.pack_start(Gtk.Label(), True, True, 0) load_layers = Gtk.Button(_("Load Layers")) load_layers.connect("clicked", lambda w:self._load_layers_pressed()) save_layers = Gtk.Button(_("Save Layers")) save_layers.connect("clicked", lambda w:self._save_layers_pressed()) clear_layers = Gtk.Button(_("Clear All")) clear_layers.connect("clicked", lambda w:self._clear_layers_pressed()) layers_save_buttons_row = Gtk.HBox() layers_save_buttons_row.pack_start(save_layers, False, False, 0) layers_save_buttons_row.pack_start(load_layers, False, False, 0) layers_save_buttons_row.pack_start(Gtk.Label(), True, True, 0) adj = Gtk.Adjustment(float(0), float(0), float(3000), float(1)) self.x_pos_spin = Gtk.SpinButton() self.x_pos_spin.set_adjustment(adj) self.x_pos_spin.connect("changed", self._position_value_changed) self.x_pos_spin.connect("key-press-event", self._key_pressed_on_widget) adj = Gtk.Adjustment(float(0), float(0), float(3000), float(1)) self.y_pos_spin = Gtk.SpinButton() self.y_pos_spin.set_adjustment(adj) self.y_pos_spin.connect("changed", self._position_value_changed) self.y_pos_spin.connect("key-press-event", self._key_pressed_on_widget) adj = Gtk.Adjustment(float(0), float(0), float(3000), float(1)) self.rotation_spin = Gtk.SpinButton() self.rotation_spin.set_adjustment(adj) self.rotation_spin.connect("changed", self._position_value_changed) self.rotation_spin.connect("key-press-event", self._key_pressed_on_widget) undo_pos = Gtk.Button() undo_icon = Gtk.Image.new_from_stock(Gtk.STOCK_UNDO, Gtk.IconSize.BUTTON) undo_pos.set_image(undo_icon) next_icon = Gtk.Image.new_from_file(respaths.IMAGE_PATH + "next_frame_s.png") prev_icon = Gtk.Image.new_from_file(respaths.IMAGE_PATH + "prev_frame_s.png") prev_frame = Gtk.Button() prev_frame.set_image(prev_icon) prev_frame.connect("clicked", lambda w:self._prev_frame_pressed()) next_frame = Gtk.Button() next_frame.set_image(next_icon) next_frame.connect("clicked", lambda w:self._next_frame_pressed()) self.scale_selector = vieweditor.ScaleSelector(self) timeline_box = Gtk.HBox() timeline_box.pack_start(self.tc_display.widget, False, False, 0) timeline_box.pack_start(guiutils.pad_label(12, 12), False, False, 0) timeline_box.pack_start(pos_bar_frame, True, True, 0) timeline_box.pack_start(guiutils.pad_label(12, 12), False, False, 0) timeline_box.pack_start(prev_frame, False, False, 0) timeline_box.pack_start(next_frame, False, False, 0) timeline_box.pack_start(self.guides_toggle, False, False, 0) timeline_box.pack_start(self.scale_selector, False, False, 0) timeline_box.set_margin_top(6) timeline_box.set_margin_bottom(6) positions_box = Gtk.HBox() positions_box.pack_start(Gtk.Label(), True, True, 0) positions_box.pack_start(Gtk.Label(label="X:"), False, False, 0) positions_box.pack_start(self.x_pos_spin, False, False, 0) positions_box.pack_start(guiutils.pad_label(40, 5), False, False, 0) positions_box.pack_start(Gtk.Label(label="Y:"), False, False, 0) positions_box.pack_start(self.y_pos_spin, False, False, 0) #positions_box.pack_start(Gtk.Label(label=_("Angle")), False, False, 0) #positions_box.pack_start(self.rotation_spin, False, False, 0) positions_box.pack_start(guiutils.pad_label(40, 5), False, False, 0) positions_box.pack_start(center_h, False, False, 0) positions_box.pack_start(center_v, False, False, 0) positions_box.pack_start(Gtk.Label(), True, True, 0) controls_panel_1 = Gtk.VBox() controls_panel_1.pack_start(add_del_box, False, False, 0) controls_panel_1.pack_start(self.layer_list, False, False, 0) controls_panel_1.pack_start(layers_save_buttons_row, False, False, 0) controls_panel_2 = Gtk.VBox() controls_panel_2.pack_start(scroll_frame, True, True, 0) controls_panel_2.pack_start(font_main_row, False, False, 0) controls_panel_2.pack_start(buttons_box, False, False, 0) controls_panel_2.pack_start(guiutils.pad_label(40, 1), False, False, 0) controls_panel_2.pack_start(outline_box, False, False, 0) controls_panel_2.pack_start(guiutils.pad_label(40, 1), False, False, 0) controls_panel_2.pack_start(shadow_box_1, False, False, 0) controls_panel_2.pack_start(shadow_box_2, False, False, 0) controls_panel = Gtk.VBox() controls_panel.pack_start(guiutils.get_named_frame(_("Active Layer"),controls_panel_2), True, True, 0) controls_panel.pack_start(guiutils.get_named_frame(_("Layers"),controls_panel_1), False, False, 0) view_editor_editor_buttons_row = Gtk.HBox() view_editor_editor_buttons_row.pack_start(positions_box, False, False, 0) view_editor_editor_buttons_row.pack_start(Gtk.Label(), True, True, 0) keep_label = Gtk.Label(label=_("Keep Layers When Closed")) self.keep_layers_check = Gtk.CheckButton() self.keep_layers_check.set_active(_keep_titler_data) self.keep_layers_check.connect("toggled", self._keep_layers_toggled) open_label = Gtk.Label(label=_("Open Saved Title In Bin")) self.open_in_current_check = Gtk.CheckButton() self.open_in_current_check.set_active(_open_saved_in_bin) self.open_in_current_check.connect("toggled", self._open_saved_in_bin) exit_b = guiutils.get_sized_button(_("Close"), 150, 32) exit_b.connect("clicked", lambda w:close_titler()) save_titles_b = guiutils.get_sized_button(_("Save Title Graphic"), 150, 32) save_titles_b.connect("clicked", lambda w:self._save_title_pressed()) editor_buttons_row = Gtk.HBox() editor_buttons_row.pack_start(Gtk.Label(), True, True, 0) editor_buttons_row.pack_start(keep_label, False, False, 0) editor_buttons_row.pack_start(self.keep_layers_check, False, False, 0) editor_buttons_row.pack_start(guiutils.pad_label(24, 2), False, False, 0) editor_buttons_row.pack_start(open_label, False, False, 0) editor_buttons_row.pack_start(self.open_in_current_check, False, False, 0) editor_buttons_row.pack_start(guiutils.pad_label(24, 2), False, False, 0) editor_buttons_row.pack_start(exit_b, False, False, 0) editor_buttons_row.pack_start(save_titles_b, False, False, 0) editor_panel = Gtk.VBox() editor_panel.pack_start(self.view_editor, True, True, 0) editor_panel.pack_start(timeline_box, False, False, 0) editor_panel.pack_start(guiutils.get_in_centering_alignment(view_editor_editor_buttons_row), False, False, 0) editor_panel.pack_start(guiutils.pad_label(2, 24), True, True, 0) editor_panel.pack_start(editor_buttons_row, False, False, 0) editor_row = Gtk.HBox() editor_row.pack_start(controls_panel, False, False, 0) editor_row.pack_start(editor_panel, True, True, 0) alignment = guiutils.set_margins(editor_row, 8,8,8,8) self.add(alignment) self.layer_list.fill_data_model() self._update_gui_with_active_layer_data() self.show_all() self.connect("size-allocate", lambda w, e:self.window_resized()) self.connect("window-state-event", lambda w, e:self.window_resized())
def test_hex_to_rgba(self): color = nfoview.util.hex_to_rgba("#ff0000") assert color.equal(Gdk.RGBA(red=1, green=0, blue=0, alpha=1))
def __init__(self, title): Gtk.Box.__init__(self) self.set_orientation(Gtk.Orientation.VERTICAL) frame = Gtk.Frame() frame.set_shadow_type(Gtk.ShadowType.IN) frame_style = frame.get_style_context() frame_style.add_class("view") self.pack_start(frame, True, True, 0) schema = "org.cinnamon.desktop.screensaver" self.settings = Gio.Settings.new(schema) self.webkit_executable = None self.xscreensaver_executable = None self.proc = None self.current_name = self.settings.get_string("screensaver-name") if self.current_name == "*****@*****.**": self.current_name = self.settings.get_string( "screensaver-webkit-theme") elif self.current_name == "*****@*****.**": self.current_name = "xscreensaver-" + self.settings.get_string( "xscreensaver-hack") self.main_box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL) frame.add(self.main_box) toolbar = Gtk.Toolbar.new() Gtk.StyleContext.add_class(Gtk.Widget.get_style_context(toolbar), "cs-header") label = Gtk.Label() label.set_markup("<b>%s</b>" % title) title_holder = Gtk.ToolItem() title_holder.add(label) toolbar.add(title_holder) self.main_box.add(toolbar) self.preview_stack = Gtk.Stack() self.preview_stack.set_border_width(30) self.preview_stack.set_size_request(-1, 300) self.preview_stack.override_background_color(Gtk.StateFlags.NORMAL, Gdk.RGBA(0, 0, 0, 1)) self.main_box.pack_start(self.preview_stack, False, False, 0) self.main_box.add( Gtk.Separator(orientation=Gtk.Orientation.HORIZONTAL)) scw = Gtk.ScrolledWindow() scw.expand = True scw.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC) scw.set_shadow_type(Gtk.ShadowType.NONE) self.main_box.pack_start(scw, True, True, 0) self.list_box = Gtk.ListBox() self.list_box.set_selection_mode(Gtk.SelectionMode.SINGLE) self.list_box.set_header_func(list_header_func, None) self.list_box.connect("row-activated", self.on_row_activated) scw.add(self.list_box) self.socket = Gtk.Socket() # Prevent the socket from self-destructing when its plug dies self.socket.connect("plug-removed", lambda socket: True) self.socket.show() self.preview_stack.add_named(self.socket, "socket") pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_size( "/usr/share/cinnamon/thumbnails/wallclock.png", -1, 240) image = Gtk.Image.new_from_pixbuf(pixbuf) image.show() self.preview_stack.add_named(image, "default") self.gather_screensavers() self.socket_map_id = self.preview_stack.connect( "map", self.on_stack_mapped) self.socket_unmap_id = self.preview_stack.connect( "unmap", self.on_stack_unmapped)
def test_lookup_color(self): color = nfoview.util.lookup_color("theme_fg_color", "#ff0000") assert not color.equal(Gdk.RGBA(red=1, green=0, blue=0, alpha=1))
def test_hex_from_rgba(hex_, hex_exp): rgba = Gdk.RGBA() rgba.parse(hex_) hex_acyl = acylgui.hex_from_rgba(rgba) assert hex_exp == hex_acyl
def test_lookup_color_fallback(self): color = nfoview.util.lookup_color("xxx", "#ff0000") assert color.equal(Gdk.RGBA(red=1, green=0, blue=0, alpha=1))
def _get_led_color_as_rgba(self): # Helper function to convert ratbagd's 0-255 color range to a Gdk.RGBA # with a 0.0-1.0 color range. r, g, b = self._led.color return Gdk.RGBA(r / 255.0, g / 255.0, b / 255.0, 1.0)
def test_rgba_to_hex(self): rgba = Gdk.RGBA(red=1, green=0, blue=1) color = nfoview.util.rgba_to_hex(rgba) assert color == "#ff00ff"
def load_symbolic_icon(icon_name, size, fg=None, success=None, warning=None, error=None, outline=None): """More Pythonic wrapper for gtk_icon_info_load_symbolic() etc. :param str icon_name: Name of the symbolic icon to render :param int size: Pixel size to render at :param tuple fg: foreground color (rgba tuple, values in [0..1]) :param tuple success: success color (rgba tuple, values in [0..1]) :param tuple warning: warning color (rgba tuple, values in [0..1]) :param tuple error: error color (rgba tuple, values in [0..1]) :param tuple outline: outline color (rgba tuple, values in [0..1]) :returns: The rendered symbolic icon :rtype: GdkPixbuf.Pixbuf If the outline color is specified, a single-pixel outline is faked for the icon. Outlined renderings require a size 2 pixels larger than non-outlined if the central icon is to be of the same size. The returned value should be cached somewhere. """ theme = Gtk.IconTheme.get_default() if outline is not None: size -= 2 info = theme.lookup_icon(icon_name, size, Gtk.IconLookupFlags(0)) rgba_or_none = lambda tup: (tup is not None) and Gdk.RGBA(*tup) or None icon_pixbuf, was_symbolic = info.load_symbolic( fg=rgba_or_none(fg), success_color=rgba_or_none(success), warning_color=rgba_or_none(warning), error_color=rgba_or_none(error), ) assert was_symbolic if outline is None: return icon_pixbuf result = GdkPixbuf.Pixbuf.new( GdkPixbuf.Colorspace.RGB, True, 8, size + 2, size + 2, ) result.fill(0x00000000) outline_rgba = list(outline) outline_rgba[3] /= 3.0 outline_rgba = Gdk.RGBA(*outline_rgba) outline_stamp, was_symbolic = info.load_symbolic( fg=outline_rgba, success_color=outline_rgba, warning_color=outline_rgba, error_color=outline_rgba, ) w = outline_stamp.get_width() h = outline_stamp.get_height() assert was_symbolic offsets = [ (-1, -1), (0, -1), (1, -1), (-1, 0), (1, 0), (-1, 1), (0, 1), (1, 1), ] for dx, dy in offsets: outline_stamp.composite( result, dx + 1, dy + 1, w, h, dx + 1, dy + 1, 1, 1, GdkPixbuf.InterpType.NEAREST, 255, ) icon_pixbuf.composite( result, 1, 1, w, h, 1, 1, 1, 1, GdkPixbuf.InterpType.NEAREST, 255, ) return result
def builddomaingui(self): if self.updatechannellist() == False: self.navbar.override_background_color(Gtk.StateFlags.NORMAL, Gdk.RGBA(1, 0, 0, 1)) self.buildservergui() return if self.cur_domain == "admin": self.builder.get_object("levelshowl").set_text( "Server Service Level") else: self.builder.get_object("levelshowl").set_text("Domain Level") #reconnect signals if self.box_select_handler_id != None: self.navbox.disconnect(self.box_select_handler_id) self.box_select_handler_id = None self.box_select_handler_id = self.navbox.connect( "cursor-changed", self.select_context_channel) if self.box_activate_handler_id != None: self.navbox.disconnect(self.box_activate_handler_id) self.box_activate_handler_id = None self.box_activate_handler_id = self.navbox.connect( "row-activated", self.select_channel) newob = self.builder.get_object("domaincontext") cdin = self.builder.get_object("contextdropin") if len(cdin.get_children()) == 1: cdin.remove(cdin.get_children()[0]) cdin.add(newob) channelfold = self.builder.get_object("dropinchannelcontext2") if len(channelfold.get_children()) >= 1: channelfold.remove(channelfold.get_children()[0]) channelf = self.builder.get_object("dropinchannelcontext1") if len(channelf.get_children()) >= 1: channelf.remove(channelf.get_children()[0]) channelf.add(self.genchannelcontext()) domainmessagel = self.builder.get_object("domainmessagel") if self.cur_domain == "admin": domainmessagel.set_text("Servermessage") else: domainmessagel.set_text("Domainmessage") domainmessagebuffer = self.builder.get_object("domainmessage") domainmessage = self.builder.get_object("domainmessagev2") domainmessage.set_editable(False) tempmes = self.linkback.main.c_get_domain_message( self.cur_server, self.cur_domain) if tempmes is None: domainmessagebuffer.set_text("") else: domainmessagebuffer.set_text(tempmes) is_admin = True tnode = self.scn_servers.get_channel(self.cur_server, self.cur_domain, "admin") if tnode is None: is_admin = False if is_admin == True and bool(tnode[4]) == True: is_admin = self.linkback.main.c_update_pending( self.cur_server, self.cur_domain, "admin") #hide controls if client has no admin rights if is_admin == True: domainmessage.set_editable(True) self.builder.get_object("domainmessagecontrols").show() self.builder.get_object("addchannelb").show() self.builder.get_object("delchannelb").show() else: self.builder.get_object("domainmessagecontrols").hide() self.builder.get_object("addchannelb").hide() self.builder.get_object("delchannelb").hide()
def __init__(self, *args, **kwds): super(WaveformScale, self).__init__(*args, **kwds) self.set_size_request(40, 40) self.position = 0 self.override_background_color(Gtk.StateFlags.NORMAL, Gdk.RGBA(alpha=0))
def buildchannelgui(self): if self.cur_server is None or self.cur_domain is None or self.cur_channel is None: self.builddomaingui() return self.builder.get_object("levelshowl").set_text("Channel Level") self.updatenodelist() self.navbar.override_background_color(Gtk.StateFlags.NORMAL, Gdk.RGBA(1, 0, 0, 1)) #disconnect signals and set handler_id to 0 if self.box_select_handler_id != None: self.navbox.disconnect(self.box_select_handler_id) self.box_select_handler_id = None self.box_select_handler_id = self.navbox.connect( "cursor-changed", self.fill_node_data) if self.box_activate_handler_id != None: self.navbox.disconnect(self.box_activate_handler_id) self.box_activate_handler_id = None if self.cur_channel != "admin": self.builder.get_object("showaddrtype").show() self.builder.get_object("addrtypelabel").show() self.builder.get_object("showaddr").show() self.builder.get_object("addrlabel").show() else: self.builder.get_object("showaddrtype").hide() self.builder.get_object("addrtypelabel").hide() self.builder.get_object("showaddr").hide() self.builder.get_object("addrlabel").hide() newob = self.builder.get_object("channelcontext") cdin = self.builder.get_object("contextdropin") if len(cdin.get_children()) == 1: cdin.remove(cdin.get_children()[0]) cdin.add(newob) #hide renew secret if no secret is available or it isn't confirmed tnode = self.scn_servers.get_channel(self.cur_server, self.cur_domain, self.cur_channel) if tnode is not None: # and tnode[4]==False: self.builder.get_object("renewsecret").show() self.builder.get_object("deleteself").show() else: self.builder.get_object("renewsecret").hide() self.builder.get_object("deleteself").hide() #hide admin options for non-admins tadmin = self.scn_servers.get_channel(self.cur_server, self.cur_domain, "admin") if tadmin is None or tadmin[4] == True: self.builder.get_object("pinchannelorderb").hide() self.builder.get_object("addnodeb").hide() self.builder.get_object("delnodeb1").hide() else: self.builder.get_object("pinchannelorderb").show() self.builder.get_object("addnodeb").show() self.builder.get_object("delnodeb1").show() channelfold = self.builder.get_object("dropinchannelcontext1") if len(channelfold.get_children()) >= 1: channelfold.remove(channelfold.get_children()[0]) channelf = self.builder.get_object("dropinchannelcontext2") if len(channelf.get_children()) >= 1: channelf.remove(channelf.get_children()[0]) channelf.add(self.genchannelcontext()) self.fill_node_data()
def reconfigure(self): """Update configuration for the whole application""" if self.style_providers != []: for style_provider in self.style_providers: Gtk.StyleContext.remove_provider_for_screen( Gdk.Screen.get_default(), style_provider) self.style_providers = [] # Force the window background to be transparent for newer versions of # GTK3. We then have to fix all the widget backgrounds because the # widgets theming may not render it's own background. css = """ .terminator-terminal-window { background-color: alpha(@theme_bg_color,0); } .terminator-terminal-window .notebook.header, .terminator-terminal-window notebook header { background-color: @theme_bg_color; } .terminator-terminal-window .pane-separator { background-color: @theme_bg_color; } .terminator-terminal-window .terminator-terminal-searchbar { background-color: @theme_bg_color; } """ # Fix several themes that put a borders, corners, or backgrounds around # viewports, making the titlebar look bad. css += """ .terminator-terminal-window GtkViewport, .terminator-terminal-window viewport { border-width: 0px; border-radius: 0px; background-color: transparent; } """ # Add per profile snippets for setting the background of the HBox template = """ .terminator-profile-%s { background-color: alpha(%s, %s); } """ profiles = self.config.base.profiles for profile in list(profiles.keys()): if profiles[profile]['use_theme_colors']: # Create a dummy window/vte and realise it so it has correct # values to read from tmp_win = Gtk.Window() tmp_vte = Vte.Terminal() tmp_win.add(tmp_vte) tmp_win.realize() bgcolor = tmp_vte.get_style_context().get_background_color( Gtk.StateType.NORMAL) bgcolor = "#{0:02x}{1:02x}{2:02x}".format( int(bgcolor.red * 255), int(bgcolor.green * 255), int(bgcolor.blue * 255)) tmp_win.remove(tmp_vte) del (tmp_vte) del (tmp_win) else: bgcolor = Gdk.RGBA() bgcolor = profiles[profile]['background_color'] if profiles[profile]['background_type'] == 'image': backgound_image = profiles[profile]['background_image'] if profiles[profile][ 'background_type'] == 'transparent' or profiles[profile][ 'background_type'] == 'image': bgalpha = profiles[profile]['background_darkness'] else: bgalpha = "1" munged_profile = "".join( [c if c.isalnum() else "-" for c in profile]) css += template % (munged_profile, bgcolor, bgalpha) style_provider = Gtk.CssProvider() style_provider.load_from_data(css.encode('utf-8')) self.style_providers.append(style_provider) # Attempt to load some theme specific stylistic tweaks for appearances usr_theme_dir = os.path.expanduser('~/.local/share/themes') (head, _tail) = os.path.split(borg.__file__) app_theme_dir = os.path.join(head, 'themes') theme_name = self.gtk_settings.get_property('gtk-theme-name') theme_part_list = ['terminator.css'] if self.config[ 'extra_styling']: # checkbox_style - needs adding to prefs theme_part_list.append('terminator_styling.css') for theme_part_file in theme_part_list: for theme_dir in [usr_theme_dir, app_theme_dir]: path_to_theme_specific_css = os.path.join( theme_dir, theme_name, 'gtk-3.0/apps', theme_part_file) if os.path.isfile(path_to_theme_specific_css): style_provider = Gtk.CssProvider() style_provider.connect('parsing-error', self.on_css_parsing_error) try: style_provider.load_from_path( path_to_theme_specific_css) except GError: # Hmmm. Should we try to provide GTK version specific files here on failure? gtk_version_string = '.'.join([ str(Gtk.get_major_version()), str(Gtk.get_minor_version()), str(Gtk.get_micro_version()) ]) err('Error(s) loading css from %s into Gtk %s' % (path_to_theme_specific_css, gtk_version_string)) self.style_providers.append(style_provider) break # Size the GtkPaned splitter handle size. css = "" if self.config['handle_size'] in range(0, 21): css += """ .terminator-terminal-window separator { min-height: %spx; min-width: %spx; } """ % (self.config['handle_size'], self.config['handle_size']) style_provider = Gtk.CssProvider() style_provider.load_from_data(css.encode('utf-8')) self.style_providers.append(style_provider) # Apply the providers, incrementing priority so they don't cancel out # each other for idx in range(0, len(self.style_providers)): Gtk.StyleContext.add_provider_for_screen( Gdk.Screen.get_default(), self.style_providers[idx], Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION + idx) # Cause all the terminals to reconfigure for terminal in self.terminals: terminal.reconfigure() # Reparse our keybindings self.keybindings.configure(self.config['keybindings']) # Update tab position if appropriate maker = Factory() for window in self.windows: child = window.get_child() if maker.isinstance(child, 'Notebook'): child.configure()
def _set_value(self): value = settings.get_option(self.name, self.default) rgba = Gdk.RGBA() rgba.parse(value) self.widget.set_rgba(rgba)