diff --git a/coverart_artistview.py b/coverart_artistview.py index 6abd3d87..e0521853 100644 --- a/coverart_artistview.py +++ b/coverart_artistview.py @@ -530,6 +530,8 @@ def sort(self): 'rating_artist': ('rating', 'album_sort') } + print (key, order) + props = sort_keys[key] def key_function(album): @@ -538,9 +540,9 @@ def key_function(album): # remember the current sort then remove the sort order # because sorting will only work in unsorted lists - sortSettings = self.store.get_sort_column_id() + #sortSettings = self.store.get_sort_column_id() - self.store.set_sort_column_id(-1, Gtk.SortType.ASCENDING) + #self.store.set_sort_column_id(-1, Gtk.SortType.ASCENDING) for artist in self._iters: albums.clear() @@ -569,8 +571,9 @@ def key_function(album): next_iter = self._tree_store.iter_next(next_iter) # now we have finished sorting, reapply the sort - if sortSettings[0]: - self.store.set_sort_column_id(*sortSettings) + #if sortSettings[0]: + # self.store.set_sort_column_id(*sortSettings) + @idle_iterator def _recreate_text(self): @@ -852,8 +855,8 @@ class ArtistView(Gtk.Stack, AbstractView): } - def __init__(self, *args, **kwargs): - super(ArtistView, self).__init__(*args, **kwargs) + def __init__(self): + super(ArtistView, self).__init__() self._external_plugins = None self.gs = GSetting() @@ -863,6 +866,7 @@ def __init__(self, *args, **kwargs): def initialise(self, source): if self._has_initialised: + print ("already initialised") return self._has_initialised = True @@ -934,7 +938,9 @@ def switch_to_view(self, source, album): self.initialise(source) self.show_policy.initialise(source.album_manager) - self.iconview.scroll_to_album(album) + print(self.get_visible_child_name())#'iconview') + print (self.get_children()) + #self.iconview.scroll_to_album(album) def do_update_toolbar(self, *args): @@ -1015,6 +1021,9 @@ def initialise(self, source): self._connect_properties() self._connect_signals() + self.emit('initialise') + + def _connect_properties(self): setting = self.gs.get_setting(self.gs.Path.PLUGIN) setting.bind(self.gs.PluginKey.ICON_AUTOMATIC, self, diff --git a/coverart_browser_source.py b/coverart_browser_source.py index 9602c331..94713438 100644 --- a/coverart_browser_source.py +++ b/coverart_browser_source.py @@ -1316,9 +1316,7 @@ def __init__(self, source, window): self._views[ListView.name] = ListView() self._views[QueueView.name] = QueueView() self._views[PlaySourceView.name] = PlaySourceView() - ui.add_from_file(rb.find_plugin_file(source.plugin, - 'ui/coverart_artistview.ui')) - self._views[ArtistView.name] = ui.get_object('artist_view') + self._views[ArtistView.name] = ArtistView() self._lastview = None self.controller = ViewController(source.shell, self) @@ -1356,9 +1354,11 @@ def on_notify_view_name(self, *args): if self._views[self.view_name].use_plugin_window: child = self.window.get_child() - if child: + if isinstance(child, Gtk.Viewport): + child.remove(child.get_child()) # Gtk adds a viewport automatically for a Gtk.Stack self.window.remove(child) + self.window.add(self._views[self.view_name].view) self.window.show_all() self.click_count = 0 diff --git a/coverart_covericonview.py b/coverart_covericonview.py index ba8bd29f..56c7af23 100644 --- a/coverart_covericonview.py +++ b/coverart_covericonview.py @@ -309,12 +309,9 @@ def _album_updated(self, model, album_path, album_iter): class CoverIconView(EnhancedIconView, AbstractView): __gtype_name__ = "CoverIconView" - icon_spacing = GObject.property(type=int, default=0) - icon_padding = GObject.property(type=int, default=0) - icon_automatic = GObject.property(type=bool, default=True) - display_text_enabled = GObject.property(type=bool, default=False) display_text_pos = GObject.property(type=bool, default=False) + icon_automatic = GObject.property(type=bool, default=True) name = 'coverview' panedposition = PanedCollapsible.Paned.COLLAPSE @@ -401,21 +398,11 @@ def initialise(self, source): self._connect_signals() self._activate_markup() - self.on_notify_icon_padding() - self.on_notify_icon_spacing() + + self.emit('initialise') def _connect_properties(self): setting = self.gs.get_setting(self.gs.Path.PLUGIN) - setting.bind( - self.gs.PluginKey.ICON_SPACING, - self, - 'icon_spacing', - Gio.SettingsBindFlags.GET) - setting.bind( - self.gs.PluginKey.ICON_PADDING, - self, - 'icon_padding', - Gio.SettingsBindFlags.GET) setting.bind(self.gs.PluginKey.DISPLAY_TEXT, self, 'display_text_enabled', Gio.SettingsBindFlags.GET) @@ -433,10 +420,7 @@ def _connect_signals(self): self.connect("item-clicked", self.item_clicked_callback) self.connect("selection-changed", self.selectionchanged_callback) self.connect("item-activated", self.item_activated_callback) - self.connect('notify::icon-spacing', - self.on_notify_icon_spacing) - self.connect('notify::icon-padding', - self.on_notify_icon_padding) + self.connect("motion-notify-event", self.on_pointer_motion) self.connect('notify::display-text-enabled', self._activate_markup) @@ -734,18 +718,6 @@ def item_activated_callback(self, iconview, path): return True - def on_notify_icon_padding(self, *args): - ''' - Callback called when the icon-padding gsetting value is changed - ''' - self.set_item_padding(self.icon_padding) - - def on_notify_icon_spacing(self, *args): - ''' - Callback called when the icon-spacing gsetting value is changed - ''' - self.set_row_spacing(self.icon_spacing) - self.set_column_spacing(self.icon_spacing) def _activate_markup(self, *args): ''' diff --git a/coverart_widgets.py b/coverart_widgets.py index 7410f718..41b1b201 100644 --- a/coverart_widgets.py +++ b/coverart_widgets.py @@ -1015,10 +1015,14 @@ class EnhancedIconView(Gtk.IconView): # signals __gsignals__ = { - 'item-clicked': (GObject.SIGNAL_RUN_LAST, None, (object, object)) + 'item-clicked': (GObject.SIGNAL_RUN_LAST, None, (object, object)), + 'initialise': (GObject.SIGNAL_RUN_FIRST, None, ()) } object_column = GObject.property(type=int, default=-1) + icon_spacing = GObject.property(type=int, default=0) + icon_padding = GObject.property(type=int, default=0) + def __init__(self, *args, **kwargs): super(EnhancedIconView, self).__init__(*args, **kwargs) @@ -1028,6 +1032,40 @@ def __init__(self, *args, **kwargs): self.source = None self.ext_menu_pos = 0 + def do_initialise(self): + setting = self.gs.get_setting(self.gs.Path.PLUGIN) + setting.bind( + self.gs.PluginKey.ICON_SPACING, + self, + 'icon_spacing', + Gio.SettingsBindFlags.GET) + setting.bind( + self.gs.PluginKey.ICON_PADDING, + self, + 'icon_padding', + Gio.SettingsBindFlags.GET) + + self.connect('notify::icon-spacing', + self.on_notify_icon_spacing) + self.connect('notify::icon-padding', + self.on_notify_icon_padding) + + self.on_notify_icon_padding() + self.on_notify_icon_spacing() + + def on_notify_icon_padding(self, *args): + ''' + Callback called when the icon-padding gsetting value is changed + ''' + self.set_item_padding(self.icon_padding) + + def on_notify_icon_spacing(self, *args): + ''' + Callback called when the icon-spacing gsetting value is changed + ''' + self.set_row_spacing(self.icon_spacing) + self.set_column_spacing(self.icon_spacing) + def do_size_allocate(self, allocation): ''' Forces the reallocation of the IconView columns when the width of the diff --git a/ui/coverart_artistview.ui b/ui/coverart_artistview.ui deleted file mode 100644 index 443275ec..00000000 --- a/ui/coverart_artistview.ui +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - True - True - True - -