def _setup_source(self): ''' Setups the differents parts of the source so they are ready to be used by the user. It also creates and configure some custom widgets. ''' print("CoverArtBrowser DEBUG - _setup_source") cl = CoverLocale() cl.switch_locale(cl.Locale.LOCALE_DOMAIN) # setup iconview popup self.viewmgr.current_view.set_popup_menu(self.popup_menu) # setup entry-view objects and widgets setting = self.gs.get_setting(self.gs.Path.PLUGIN) setting.bind(self.gs.PluginKey.PANED_POSITION, self.paned, 'collapsible-y', Gio.SettingsBindFlags.DEFAULT) setting.bind(self.gs.PluginKey.DISPLAY_BOTTOM, self.paned.get_child2(), 'visible', Gio.SettingsBindFlags.DEFAULT) # create entry view. Don't allow to reorder until the load is finished self.entry_view = EV(self.shell, self) self.entry_view.set_columns_clickable(False) self.shell.props.library_source.get_entry_view().set_columns_clickable( False) self.stars = ReactiveStar() self.stars.set_rating(0) a = Gtk.Alignment.new(0.5, 0.5, 0, 0) a.add(self.stars) self.stars.connect('changed', self.rating_changed_callback) vbox = Gtk.Box() vbox.set_orientation(Gtk.Orientation.VERTICAL) vbox.pack_start(self.entry_view, True, True, 0) vbox.pack_start(a, False, False, 1) vbox.show_all() self.notebook.append_page(vbox, Gtk.Label.new_with_mnemonic(_("Tracks"))) # create an album manager self.album_manager = AlbumManager(self.plugin, self.viewmgr.current_view) self.viewmgr.current_view.initialise(self) # setup cover search pane colour = self.viewmgr.get_selection_colour() self.cover_search_pane = CoverSearchPane(self.plugin, colour) self.notebook.append_page(self.cover_search_pane, Gtk.Label.new_with_mnemonic(_("Covers"))) # connect a signal to when the info of albums is ready self.load_fin_id = self.album_manager.loader.connect( 'model-load-finished', self.load_finished_callback) # prompt the loader to load the albums self.album_manager.loader.load_albums(self.props.base_query_model) # initialise the variables of the quick search self.quick_search_controller = AlbumQuickSearchController( self.album_manager) self.quick_search_controller.connect_quick_search(self.quick_search) # set sensitivity of export menu item for iconview self.popup_menu.set_sensitive( 'export_embed_menu_item', CoverArtExport(self.plugin, self.shell, self.album_manager).is_search_plugin_enabled()) # setup the statusbar component self.statusbar = Statusbar(self) # initialise the toolbar manager self.toolbar_manager = ToolbarManager(self.plugin, self.page, self.viewmgr) self.viewmgr.current_view.emit('update-toolbar') cl.switch_locale(cl.Locale.RB) # setup the artist paned artist_pview = None for view in self.shell.props.library_source.get_property_views(): print(view.props.title) print(_("Artist")) if view.props.title == _("Artist"): artist_pview = view break assert artist_pview, "cannot find artist property view" self.artist_treeview.set_model(artist_pview.get_model()) setting.bind(self.gs.PluginKey.ARTIST_PANED_POSITION, self, 'artist-paned-pos', Gio.SettingsBindFlags.DEFAULT) self.artist_paned.connect('button-release-event', self.artist_paned_button_release_callback) # intercept JumpToPlaying Song action so that we can scroll to the playing album appshell = rb3compat.ApplicationShell(self.shell) action = appshell.lookup_action("", "jump-to-playing", "win") action.action.connect("activate", self.jump_to_playing, None) self.echonest_similar_playlist = None print("CoverArtBrowser DEBUG - end _setup_source")