def __init__(self, plugin): super(ExternalPluginMenu, self).__init__() self.plugin = plugin self.shell = plugin.shell self.source = plugin.source self.app_id = None from coverart_browser_source import Views self._views = Views(self.shell) self._connect_properties() self._connect_signals() self._create_menu()
def __init__(self, shell, viewmgr): super(ViewController, self).__init__() self._viewmgr = viewmgr from coverart_browser_source import Views views = Views(shell) self.values = OrderedDict() for view_name in views.get_view_names(): self.values[views.get_menu_name(view_name)] = view_name print(view_name) self.options = list(self.values.keys()) viewmgr.connect('new-view', self.on_notify_view_name)
def __init__(self, plugin): super(ExternalPluginMenu, self).__init__() self.plugin = plugin self.shell = plugin.shell self.source = plugin.source self.app_id = None self.locations = [ 'library-toolbar', 'queue-toolbar', 'playsource-toolbar' ] from coverart_browser_source import Views self._views = Views(self.shell) self._use_standard_control = True self.plugin.using_alternative_toolbar = hasattr( self.shell, 'alternative_toolbar') if self.plugin.using_alternative_toolbar: from alttoolbar_type import AltToolbarHeaderBar self.plugin.using_headerbar = isinstance( self.shell.alternative_toolbar.toolbar_type, AltToolbarHeaderBar) if self.plugin.using_headerbar: self._use_standard_control = False # register with headerbar to complete the setup for coverart-browser print("registering") self.shell.alternative_toolbar.toolbar_type.setup_completed_async( self._headerbar_toolbar_completed) if self._use_standard_control: # ... otherwise just use the standard menubutton approach self.source.props.visibility = True # make the source visible gs = GSetting() setting = gs.get_setting(gs.Path.PLUGIN) setting.bind(gs.PluginKey.TOOLBAR_POS, self, 'toolbar_pos', Gio.SettingsBindFlags.GET) self.connect('notify::toolbar-pos', self._on_notify_toolbar_pos) self.shell.props.display_page_tree.connect("selected", self.on_page_change) self._create_menu()