def do_impl_activate(self): ''' Called by do_selected the first time the source is activated. It creates all the source ui and connects the necessary signals for it correct behavior. ''' print('do_impl_activate') self.hasActivated = True self.entryview = CoverArtPlayEntryView(self.shell, self.source) self.entryview.props.hexpand = True self.entryview.props.vexpand = True grid = Gtk.Grid() grid.attach(self.entryview, 0, 1, 1, 1) self.entryview.set_model(self.source.source_query_model) # enable sorting on the entryview # entryview.set_columns_clickable(True) self.shell.props.library_source.get_entry_view().set_columns_clickable( True) cl = CoverLocale() cl.switch_locale(cl.Locale.LOCALE_DOMAIN) location = rb.find_plugin_file(self.plugin, 'ui/playsource-toolbar.ui') ui = Gtk.Builder() ui.set_translation_domain(cl.Locale.RB) ui.add_from_file(location) toolbar_menu = ui.get_object('playsource-toolbar') app = self.shell.props.application app.link_shared_menus(toolbar_menu) bar = RB.ButtonBar.new(toolbar_menu, toolbar_menu) grid.attach(bar, 0, 0, 1, 1) grid.show_all() self.pack_start(grid, True, True, 0) appshell = ApplicationShell(self.shell) action_group = ActionGroup(self.shell, 'PlaySourceActions') action_group.add_action(func=self.clear_playsource, action_name='playsource-clear', action_state=ActionGroup.STANDARD, action_type='app') action_group.add_action(func=self.shuffle_playsource, action_name='playsource-shuffle', action_state=ActionGroup.STANDARD, action_type='app') appshell.insert_action_group(action_group)
def do_impl_activate(self): ''' Called by do_selected the first time the source is activated. It creates all the source ui and connects the necessary signals for it correct behavior. ''' print('do_impl_activate') self.plugin = self.props.plugin self.shell = self.props.shell player = self.shell.props.shell_player player.set_playing_source(self) player.set_selected_source(self) # define a query model that we'll use for playing self.source_query_model = self.plugin.source_query_model grid = Gtk.Grid() self.entryview = self.get_entry_view() child = self.get_children() print(child) grid = child[0] self.rbsourcetoolbar = grid.get_children( )[1] # need to remember the reference to stop crashes when python cleans up unlinked objects grid.remove(grid.get_children()[1]) self.get_entry_view().set_model(self.source_query_model) ''' # enable sorting on the entryview entryview.set_columns_clickable(True) self.shell.props.library_source.get_entry_view().set_columns_clickable( True) ''' cl = CoverLocale() cl.switch_locale(cl.Locale.LOCALE_DOMAIN) location = rb.find_plugin_file(self.plugin, 'ui/playsource-toolbar.ui') ui = Gtk.Builder() ui.set_translation_domain(cl.Locale.RB) ui.add_from_file(location) toolbar_menu = ui.get_object('playsource-toolbar') app = self.shell.props.application app.link_shared_menus(toolbar_menu) self.toolbar = RB.ButtonBar.new(toolbar_menu, toolbar_menu) self.toolbar.props.hexpand_set = False grid.attach(self.toolbar, 0, 0, 1, 1) grid.show_all() appshell = ApplicationShell(self.shell) action_group = ActionGroup(self.shell, 'PlaySourceActions') action_group.add_action(func=self.clear_playsource, action_name='playsource-clear', action_state=ActionGroup.STANDARD, action_type='app') action_group.add_action(func=self.shuffle_playsource, action_name='playsource-shuffle', action_state=ActionGroup.STANDARD, action_type='app') appshell.insert_action_group(action_group) # if the alternative-toolbar is loaded then lets connect to the toolbar-visibility signal # to control our sources toolbar visibility #if hasattr(self.shell, 'alternative_toolbar'): # self.shell.alternative_toolbar.connect('toolbar-visibility', self._visibility) self._load_model() self.source_query_model.connect('row-inserted', self.save_changed_model) self.source_query_model.connect('row-changed', self.save_changed_model) self.source_query_model.connect('row-deleted', self.save_changed_model)
def do_impl_activate(self): ''' Called by do_selected the first time the source is activated. It creates all the source ui and connects the necessary signals for it correct behavior. ''' print('do_impl_activate') self.plugin = self.props.plugin self.shell = self.props.shell player = self.shell.props.shell_player player.set_playing_source(self) player.set_selected_source(self) # define a query model that we'll use for playing self.source_query_model = self.plugin.source_query_model grid = Gtk.Grid() self.entryview = self.get_entry_view() child = self.get_children() print (child) grid = child[0] self.rbsourcetoolbar = grid.get_children()[1] # need to remember the reference to stop crashes when python cleans up unlinked objects grid.remove(grid.get_children()[1]) self.get_entry_view().set_model(self.source_query_model) ''' # enable sorting on the entryview entryview.set_columns_clickable(True) self.shell.props.library_source.get_entry_view().set_columns_clickable( True) ''' cl = CoverLocale() cl.switch_locale(cl.Locale.LOCALE_DOMAIN) location = rb.find_plugin_file(self.plugin, 'ui/playsource-toolbar.ui') ui = Gtk.Builder() ui.set_translation_domain(cl.Locale.RB) ui.add_from_file(location) toolbar_menu = ui.get_object('playsource-toolbar') app = self.shell.props.application app.link_shared_menus(toolbar_menu) self.toolbar = RB.ButtonBar.new(toolbar_menu, toolbar_menu) self.toolbar.props.hexpand_set = False grid.attach(self.toolbar, 0, 0, 1, 1) grid.show_all() appshell = ApplicationShell(self.shell) action_group = ActionGroup(self.shell, 'PlaySourceActions') action_group.add_action(func=self.clear_playsource, action_name='playsource-clear', action_state=ActionGroup.STANDARD, action_type='app') action_group.add_action(func=self.shuffle_playsource, action_name='playsource-shuffle', action_state=ActionGroup.STANDARD, action_type='app') appshell.insert_action_group(action_group) # if the alternative-toolbar is loaded then lets connect to the toolbar-visibility signal # to control our sources toolbar visibility #if hasattr(self.shell, 'alternative_toolbar'): # self.shell.alternative_toolbar.connect('toolbar-visibility', self._visibility) self._load_model() self.source_query_model.connect('row-inserted', self.save_changed_model) self.source_query_model.connect('row-changed', self.save_changed_model) self.source_query_model.connect('row-deleted', self.save_changed_model)