def __init__(self, view_type): """ Init view @param view_type as ViewType """ AlbumsListView.__init__(self, [], [], view_type | ViewType.SCROLLED | ViewType.OVERLAY | ViewType.PLAYBACK) self.box.set_width(Size.MEDIUM) if view_type & ViewType.DND: self.dnd_helper.connect("dnd-finished", self.__on_dnd_finished) self.__banner = CurrentAlbumsBannerWidget(self) self.__banner.show() self.add_widget(self.box, self.__banner) self.allow_duplicate("_on_queue_changed") self.allow_duplicate("_on_playback_added") self.allow_duplicate("_on_playback_updated") self.allow_duplicate("_on_playback_removed") return [ (App().player, "queue-changed", "_on_queue_changed"), (App().player, "playback-added", "_on_playback_added"), (App().player, "playback-setted", "_on_playback_setted"), (App().player, "playback-updated", "_on_playback_updated"), (App().player, "playback-removed", "_on_playback_removed") ]
def __init__(self, playlist_id, view_type): """ Init PlaylistView @parma playlist_id as int @param view_type as ViewType """ AlbumsListView.__init__(self, [], [], view_type | ViewType.SCROLLED | ViewType.OVERLAY) SizeAllocationHelper.__init__(self) self.__playlist_id = playlist_id self.box.set_width(Size.MEDIUM) if view_type & ViewType.DND: self.dnd_helper.connect("dnd-finished", self.__on_dnd_finished) self.__banner = PlaylistBannerWidget(playlist_id, self) self.__banner.show() self.add_widget(self.box, self.__banner) return [ (App().playlists, "playlist-track-added", "_on_playlist_track_added"), (App().playlists, "playlist-track-removed", "_on_playlist_track_removed"), (App().playlists, "playlists-removed", "_on_playlist_removed"), (App().playlists, "playlists-renamed", "_on_playlist_renamed"), (App().playlists, "playlists-updated", "_on_playlist_updated") ]
def __init__(self, view_type): """ Init view @param view_type as ViewType """ AlbumsListView.__init__(self, [], [], view_type) self.__clear_button = Gtk.Button.new_from_icon_name( "edit-clear-all-symbolic", Gtk.IconSize.MENU) self.__clear_button.set_relief(Gtk.ReliefStyle.NONE) self.__clear_button.set_tooltip_text(_("Clear albums")) self.__clear_button.get_style_context().add_class("light-button") self.__clear_button.get_style_context().add_class( "light-button-no-right-border") self.__clear_button.set_sensitive(App().player.albums) self.__clear_button.connect("clicked", self.__on_clear_clicked) self.__clear_button.set_margin_end(MARGIN_SMALL) self.__save_button = Gtk.Button.new_from_icon_name( "document-new-symbolic", Gtk.IconSize.MENU) self.__save_button.set_relief(Gtk.ReliefStyle.NONE) self.__save_button.set_tooltip_text(_("Create a new playlist")) self.__save_button.get_style_context().add_class("light-button") self.__save_button.set_sensitive(App().player.albums) self.__save_button.connect("clicked", self.__on_save_clicked) self.__jump_button = Gtk.Button.new_from_icon_name( "go-jump-symbolic", Gtk.IconSize.MENU) self.__jump_button.set_relief(Gtk.ReliefStyle.NONE) self.__jump_button.connect("clicked", self.__on_jump_clicked) self.__jump_button.get_style_context().add_class("light-button") self.__jump_button.set_tooltip_text(_("Go to current track")) self.__jump_button.set_sensitive(App().player.albums) label = Gtk.Label.new("<b>" + _("Playing albums") + "</b>") label.set_use_markup(True) label.set_hexpand(True) label.set_margin_start(2) label.get_style_context().add_class("dim-label") label.set_property("halign", Gtk.Align.START) grid = Gtk.Grid() grid.set_column_spacing(5) grid.add(label) grid.set_property("valign", Gtk.Align.CENTER) if view_type & ViewType.POPOVER: grid.add(self.__jump_button) grid.add(self.__save_button) grid.add(self.__clear_button) grid.show_all() grid.set_margin_bottom(MARGIN_SMALL) self.set_row_spacing(2) self.insert_row(0) self.attach(grid, 0, 0, 1, 1)