def __init__(self, unit): super().__init__(unit) self.treeview = data.RecordTreeView(self.fields, self.data_func, self.sortable) self.store = self.treeview.get_model() self.actions.add_action(resource.Action('reset', self.action_reset_cb)) self.actions.add_action(resource.Action('copy', self.action_copy_delete_cb)) if self.record_new_cb != NotImplemented: self.actions.add_action(resource.Action('paste', self.action_paste_cb)) self.actions.add_action(resource.Action('paste-before', self.action_paste_cb)) self.signal_handler_connect(self.store, 'record-new', self.record_new_cb) if self.record_delete_cb != NotImplemented: self.actions.add_action(resource.Action('delete', self.action_copy_delete_cb)) self.actions.add_action(resource.Action('cut', self.action_copy_delete_cb)) self.signal_handler_connect(self.store, 'record-delete', self.record_delete_cb) self.set_editable(True) self.treeview_filter = data.TreeViewFilter(self.unit.unit_misc, self.treeview) self.add(self.treeview_filter) self.actions.add_action(Gio.PropertyAction(name='filter', object=self.treeview_filter, property_name='active')) self.setup_context_menu('.'.join([self.name, 'context']), self.treeview) self.treeview.connect('row-activated', self.treeview_row_activated_cb) self.connect('map', self.set_color) self.signal_handler_connect(self.unit.unit_persistent, 'notify::dark', self.set_color)
def __init__(self, unit): self.box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, visible=True) super().__init__(unit) self.current_tanda = None self.current_tanda_path = None self.actions.add_action( resource.Action('tanda-delete', self.action_tanda_delete_cb)) self.actions.add_action( resource.Action('tanda-reset', self.action_tanda_reset_cb)) self.actions.add_action( resource.Action('tanda-reset-field', self.action_tanda_field_cb)) self.actions.add_action( resource.Action('tanda-fill-field', self.action_tanda_field_cb)) self.tanda_treeview = data.RecordTreeView(self.unit.db.fields, self.tanda_data_func, True) self.tanda_treeview.set_name('tanda-treeview') self.tanda_treeview.connect('button-press-event', self.tanda_treeview_button_press_event_cb) self.setup_context_menu('tanda-edit.left-context', self.tanda_treeview) self.init_tandaid_treeview(self.tanda_treeview) for name in self.unit.db.fields.basic_names: col = self.tanda_treeview.cols[name] col.renderer.set_property('editable', True) col.renderer.connect('editing-started', self.renderer_editing_started_cb, name) self.tanda_store = self.tanda_treeview.get_model() self.tanda_treeview.connect('cursor-changed', self.tanda_treeview_cursor_changed_cb) self.tanda_filter = data.TreeViewFilter(self.unit.unit_misc, self.tanda_treeview) self.actions.remove('filter') self.actions.add_action( Gio.PropertyAction(name='filter', object=self.tanda_filter, property_name='active')) self.treeview.set_vexpand(False) self.treeview_filter.scroller.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.NEVER) self.box.pack_start(self.tanda_filter, True, True, 0) super().add(self.box) self.queue = []
def _init_headerbar(self): # pylint: disable=too-many-locals,too-many-statements self.headerbar = Gtk.HeaderBar() self.headerbar.set_show_close_button(True) self.headerbar.props.title = translate("Oo-mox GUI") # @TODO: # new_button = ImageButton("text-x-generic-symbolic", translate("Create New Theme")) # noqa # self.headerbar.pack_start(new_button) import_menu = Gio.Menu() import_menu.append_item(Gio.MenuItem.new( translate("Oomox Colors File"), WindowActions.import_themix_colors.get_id() # pylint:disable=no-member )) for plugin_name, plugin in PluginLoader.get_import_plugins().items(): if plugin.import_text: import_menu.append_item(Gio.MenuItem.new( plugin.import_text or plugin.display_name, f"win.import_plugin_{plugin_name}" )) import_button = ImageMenuButton( label=translate("Import"), icon_name="pan-down-symbolic", tooltip_text=translate("Import Themes") ) import_button.set_use_popover(True) import_button.set_menu_model(import_menu) self.add_action(Gio.PropertyAction( name=WindowActions.import_menu, object=import_button, property_name="active" )) self.headerbar.pack_start(import_button) # save_button = ImageButton( "document-save-symbolic", translate("Save Theme") ) self.attach_action(save_button, WindowActions.save) # self.headerbar.pack_start(save_button) clone_button = ImageButton( "document-save-as-symbolic", translate("Save as…") ) self.attach_action(clone_button, WindowActions.clone) # self.headerbar.pack_start(clone_button) rename_button = ImageButton( # "preferences-desktop-font-symbolic", "Rename theme" "pda-symbolic", translate("Rename Theme…") ) self.attach_action(rename_button, WindowActions.rename) # self.headerbar.pack_start(rename_button) remove_button = ImageButton( "edit-delete-symbolic", translate("Remove Theme…") ) self.attach_action(remove_button, WindowActions.remove) linked_preset_box = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL) Gtk.StyleContext.add_class( linked_preset_box.get_style_context(), "linked" ) linked_preset_box.add(save_button) linked_preset_box.add(clone_button) linked_preset_box.add(rename_button) # linked_preset_box.add(remove_button) self.headerbar.pack_start(linked_preset_box) self.headerbar.pack_start(remove_button) # menu = Gio.Menu() menu_button = ImageMenuButton("open-menu-symbolic") menu_button.set_use_popover(True) menu_button.set_menu_model(menu) self.add_action(Gio.PropertyAction( name=WindowActions.menu, object=menu_button, property_name="active" )) self.headerbar.pack_end(menu_button) menu.append_item(Gio.MenuItem.new( translate("Keyboard Shortcuts"), WindowActions.show_help.get_id() # pylint:disable=no-member )) menu.append_item(Gio.MenuItem.new( translate("About"), WindowActions.show_about.get_id() # pylint:disable=no-member )) # export_theme_button = Gtk.Button( label=translate("_Export Theme…"), use_underline=True, tooltip_text=translate("Export GTK Theme") ) self.attach_action(export_theme_button, WindowActions.export_theme) export_icons_button = Gtk.Button( label=translate("Export _Icons…"), use_underline=True, tooltip_text=translate("Export Icon Theme") ) self.attach_action(export_icons_button, WindowActions.export_icons) export_menu = Gio.Menu() if PluginLoader.get_export_plugins(): for plugin_name, plugin in PluginLoader.get_export_plugins().items(): export_menu.append_item(Gio.MenuItem.new( plugin.export_text or plugin.display_name, f"win.export_plugin_{plugin_name}" )) export_button = ImageMenuButton( icon_name="pan-down-symbolic", tooltip_text=translate("Export Themes") ) export_button.set_use_popover(True) export_button.set_menu_model(export_menu) self.add_action(Gio.PropertyAction( name=WindowActions.export_menu, object=export_button, property_name="active" )) linked_export_box = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL) Gtk.StyleContext.add_class( linked_export_box.get_style_context(), "linked" ) linked_export_box.add(export_theme_button) linked_export_box.add(export_icons_button) linked_export_box.add(export_button) self.headerbar.pack_end(linked_export_box) # self.set_titlebar(self.headerbar)
def _init_headerbar(self): self.headerbar = Gtk.HeaderBar() self.headerbar.set_show_close_button(True) self.headerbar.props.title = _("Oo-mox GUI") # @TODO: # new_button = ImageButton("text-x-generic-symbolic", _("Create new theme")) # noqa # self.headerbar.pack_start(new_button) clone_button = ImageButton("edit-copy-symbolic", _("Clone current theme")) self.attach_action(clone_button, WindowActions.clone) self.headerbar.pack_start(clone_button) save_button = ImageButton("document-save-symbolic", _("Save theme")) self.attach_action(save_button, WindowActions.save) self.headerbar.pack_start(save_button) rename_button = ImageButton( # "preferences-desktop-font-symbolic", "Rename theme" "pda-symbolic", _("Rename theme")) self.attach_action(rename_button, WindowActions.rename) self.headerbar.pack_start(rename_button) remove_button = ImageButton("edit-delete-symbolic", _("Remove theme")) self.attach_action(remove_button, WindowActions.remove) self.headerbar.pack_start(remove_button) # menu = Gio.Menu() # menu.append_item(Gio.MenuItem.new( # _("_Export icon theme"), # WindowActions.get_id(WindowActions.export_icons) # )) menu.append_item( Gio.MenuItem.new( _("Apply Spotif_y theme"), WindowActions.get_id(WindowActions.export_spotify))) menu_button = ImageMenuButton("open-menu-symbolic") menu_button.set_use_popover(True) menu_button.set_menu_model(menu) self.add_action( Gio.PropertyAction(name=WindowActions.get_name(WindowActions.menu), object=menu_button, property_name="active")) self.headerbar.pack_end(menu_button) export_terminal_button = Gtk.Button( label=_("Export _terminal"), use_underline=True, tooltip_text=_("Export terminal theme")) self.attach_action(export_terminal_button, WindowActions.export_terminal) self.headerbar.pack_end(export_terminal_button) export_icons_button = Gtk.Button(label=_("Export _icons"), use_underline=True, tooltip_text=_("Export icon theme")) self.attach_action(export_icons_button, WindowActions.export_icons) self.headerbar.pack_end(export_icons_button) export_button = Gtk.Button(label=_("_Export theme"), use_underline=True, tooltip_text=_("Export GTK theme")) self.attach_action(export_button, WindowActions.export_theme) self.headerbar.pack_end(export_button) self.set_titlebar(self.headerbar)
def _init_headerbar(self): # pylint: disable=too-many-locals self.headerbar = Gtk.HeaderBar() self.headerbar.set_show_close_button(True) self.headerbar.props.title = _("Oo-mox GUI") # @TODO: # new_button = ImageButton("text-x-generic-symbolic", _("Create New Theme")) # noqa # self.headerbar.pack_start(new_button) import_menu = Gio.Menu() import_menu.append_item( Gio.MenuItem.new(_("Oomox Colors File"), "win.import_themix_colors")) for plugin_name, plugin in IMPORT_PLUGINS.items(): if plugin.import_text: import_menu.append_item( Gio.MenuItem.new( plugin.import_text or plugin.display_name, "win.import_plugin_{}".format(plugin_name))) import_button = ImageMenuButton(label=_("Import"), icon_name="pan-down-symbolic", tooltip_text=_("Import Themes")) import_button.set_use_popover(True) import_button.set_menu_model(import_menu) self.add_action( Gio.PropertyAction(name=WindowActions.import_menu, object=import_button, property_name="active")) self.headerbar.pack_start(import_button) clone_button = ImageButton("edit-copy-symbolic", _("Clone Current Theme…")) self.attach_action(clone_button, WindowActions.clone) self.headerbar.pack_start(clone_button) save_button = ImageButton("document-save-symbolic", _("Save Theme")) self.attach_action(save_button, WindowActions.save) self.headerbar.pack_start(save_button) rename_button = ImageButton( # "preferences-desktop-font-symbolic", "Rename theme" "pda-symbolic", _("Rename Theme…")) self.attach_action(rename_button, WindowActions.rename) self.headerbar.pack_start(rename_button) remove_button = ImageButton("edit-delete-symbolic", _("Remove Theme…")) self.attach_action(remove_button, WindowActions.remove) self.headerbar.pack_start(remove_button) # menu = Gio.Menu() if EXPORT_PLUGINS: for plugin_name, plugin in EXPORT_PLUGINS.items(): menu.append_item( Gio.MenuItem.new( plugin.export_text or plugin.display_name, "win.export_plugin_{}".format(plugin_name))) menu_button = ImageMenuButton("open-menu-symbolic") menu_button.set_use_popover(True) menu_button.set_menu_model(menu) self.add_action( Gio.PropertyAction(name=WindowActions.menu, object=menu_button, property_name="active")) self.headerbar.pack_end(menu_button) show_help_menuitem = Gio.MenuItem.new(_("Keyboard Shortcuts"), "win.show_help") menu.append_item(show_help_menuitem) # export_terminal_button = Gtk.Button( label=_("Export _Terminal"), # label=_("Export _Terminal…"), use_underline=True, tooltip_text=_("Export Terminal Theme")) self.attach_action(export_terminal_button, WindowActions.export_terminal) self.headerbar.pack_end(export_terminal_button) export_icons_button = Gtk.Button(label=_("Export _Icons"), use_underline=True, tooltip_text=_("Export Icon Theme")) self.attach_action(export_icons_button, WindowActions.export_icons) self.headerbar.pack_end(export_icons_button) # export_button = Gtk.Button(label=_("_Export Theme…"), export_button = Gtk.Button(label=_("_Export Theme"), use_underline=True, tooltip_text=_("Export GTK Theme")) self.attach_action(export_button, WindowActions.export_theme) self.headerbar.pack_end(export_button) self.spinner = Gtk.Spinner() self.headerbar.pack_end(self.spinner) self.set_titlebar(self.headerbar)
def _init_headerbar(self): self.headerbar = Gtk.HeaderBar() self.headerbar.set_show_close_button(True) self.headerbar.props.title = _("Oo-mox GUI") # @TODO: # new_button = ImageButton("text-x-generic-symbolic", _("Create new theme")) # noqa # self.headerbar.pack_start(new_button) import_menu = Gio.Menu() import_menu.append_item( Gio.MenuItem.new(_("Oomox colors file"), "win.import_themix_colors")) for plugin_name, plugin in IMPORT_PLUGINS.items(): import_menu.append_item( Gio.MenuItem.new(plugin.import_text or plugin.display_name, "win.import_plugin_{}".format(plugin_name))) import_button = Gtk.MenuButton(label=_("Import")) import_button.set_use_popover(True) import_button.set_menu_model(import_menu) self.add_action( Gio.PropertyAction(name=WindowActions.get_name( WindowActions.import_menu), object=import_button, property_name="active")) self.headerbar.pack_start(import_button) clone_button = ImageButton("edit-copy-symbolic", _("Clone current theme")) self.attach_action(clone_button, WindowActions.clone) self.headerbar.pack_start(clone_button) save_button = ImageButton("document-save-symbolic", _("Save theme")) self.attach_action(save_button, WindowActions.save) self.headerbar.pack_start(save_button) rename_button = ImageButton( # "preferences-desktop-font-symbolic", "Rename theme" "pda-symbolic", _("Rename theme")) self.attach_action(rename_button, WindowActions.rename) self.headerbar.pack_start(rename_button) remove_button = ImageButton("edit-delete-symbolic", _("Remove theme")) self.attach_action(remove_button, WindowActions.remove) self.headerbar.pack_start(remove_button) # if EXPORT_PLUGINS: menu = Gio.Menu() for plugin_name, plugin in EXPORT_PLUGINS.items(): menu.append_item( Gio.MenuItem.new( plugin.display_name, "win.export_plugin_{}".format(plugin_name))) menu_button = ImageMenuButton("open-menu-symbolic") menu_button.set_use_popover(True) menu_button.set_menu_model(menu) self.add_action( Gio.PropertyAction(name=WindowActions.get_name( WindowActions.menu), object=menu_button, property_name="active")) self.headerbar.pack_end(menu_button) export_terminal_button = Gtk.Button( label=_("Export _terminal"), use_underline=True, tooltip_text=_("Export terminal theme")) self.attach_action(export_terminal_button, WindowActions.export_terminal) self.headerbar.pack_end(export_terminal_button) export_icons_button = Gtk.Button(label=_("Export _icons"), use_underline=True, tooltip_text=_("Export icon theme")) self.attach_action(export_icons_button, WindowActions.export_icons) self.headerbar.pack_end(export_icons_button) export_button = Gtk.Button(label=_("_Export theme"), use_underline=True, tooltip_text=_("Export GTK theme")) self.attach_action(export_button, WindowActions.export_theme) self.headerbar.pack_end(export_button) self.set_titlebar(self.headerbar)
def __init__(self, unit): super().__init__(unit) self.all_tandas = self.filtered_tandas = [] self.selected_artists = ['*'] self.left_store = Gtk.ListStore(str) self.left_treeview.set_model(self.left_store) self.left_treeview.insert_column_with_attributes( 0, _("Artist"), Gtk.CellRendererText(), text=0) self.left_treeview.get_selection().set_mode(Gtk.SelectionMode.MULTIPLE) self.button_box = Gtk.ButtonBox(orientation=Gtk.Orientation.HORIZONTAL, layout_style=Gtk.ButtonBoxStyle.START, visible=True) self.actions.add_action( Gio.PropertyAction(name='genre-filter', object=self, property_name='genre-filter')) for i, genre in enumerate(self.GENRES): button = Gtk.ModelButton(iconic=True, text=genre, centered=True, visible=True, can_focus=False, action_name='supermod.genre-filter', action_target=GLib.Variant.new_int32(i)) self.button_box.pack_start(button, False, False, 0) self.connect('notify::genre-filter', lambda *args: self.filter_tandas(False)) self.problem_button = Gtk.ToggleButton( image=Gtk.Image(icon_name='object-select-symbolic'), visible=True, can_focus=False, active=unit.unit_persistent.protected, tooltip_text=_("Filter zero note")) self.problem_button.connect('toggled', lambda *args: self.filter_tandas(False)) self.stack = Gtk.Stack( visible=True, transition_type=Gtk.StackTransitionType.CROSSFADE) self.switcher = Gtk.StackSwitcher(visible=True, stack=self.stack) self.button_box.pack_end(self.problem_button, False, False, 0) self.button_box.set_child_secondary(self.problem_button, True) self.button_box.pack_end(self.switcher, False, False, 0) self.button_box.set_child_secondary(self.switcher, True) self.right_box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, visible=True) self.right_box.pack_start(self.button_box, False, False, 0) self.right_box.add(self.stack) self.add(self.right_box) self.edit = TandaEdit(unit) self.view = TandaView(unit) self.stack.add_titled(self.edit, 'edit', _("Edit tandas")) self.stack.add_titled(self.view, 'view', _("View tandas")) self.sub_components = [self.edit, self.view] for c in self.sub_components: self.bind_property( 'current-tandaid', c, 'current-tandaid', GObject.BindingFlags.BIDIRECTIONAL | GObject.BindingFlags.SYNC_CREATE) self.signal_handler_connect(self.unit.db, 'changed', self.db_changed_cb) self.signal_handler_connect(self.unit.db, 'verify-progress', self.db_verify_progress_cb) self.signal_handler_connect(self.unit.db, 'missing-song', self.db_missing_song_cb) self.actions.add_action( resource.Action('tanda-switch-subcomponent', self.action_sub_component_next_cb)) self.actions.add_action( resource.Action('tanda-verify', self.unit.db.action_tanda_verify_cb)) self.actions.add_action( resource.Action('tanda-cleanup-db', self.unit.db.action_cleanup_db_cb)) self.signal_handler_connect( self.unit.unit_persistent, 'notify::protected', lambda unit_persistent, param_spec: unit_persistent.protected and self.problem_button.set_active(True)) self.read_db()