Пример #1
0
 def __init__(self, playlist_id):
     """
         Init PlaylistView
         @param playlist_id as int
     """
     View.__init__(self, False)
     self.__playlist_id = playlist_id
     self.__size_group = Gtk.SizeGroup()
     self.__size_group.set_mode(Gtk.SizeGroupMode.BOTH)
     builder = Gtk.Builder()
     builder.add_from_resource("/org/gnome/Lollypop/SmartPlaylistView.ui")
     builder.connect_signals(self)
     widget = builder.get_object("widget")
     self.connect("size-allocate", self.__on_size_allocate, widget)
     self._viewport.add(widget)
     self.__listbox = builder.get_object("listbox")
     self._scrolled.set_property("expand", True)
     self.__match_toggle = builder.get_object("match_toggle")
     self.__operand_combobox = builder.get_object("operand_combobox")
     self.__select_combobox = builder.get_object("select_combobox")
     self.__limit_spin = builder.get_object("limit_spin")
     self.__add_rule_button = builder.get_object("add_rule_button")
     self.__up_box = builder.get_object("up_box")
     self.__bottom_box = builder.get_object("bottom_box")
     if App().playlists.get_smart(playlist_id):
         self.__match_toggle.set_active(True)
     self.add(self._scrolled)
 def __init__(self, artist_ids, genre_ids):
     """
         Init ArtistView
         @param artist_id as int (Current if None)
         @param genre_id as int
     """
     View.__init__(self)
     self._genre_ids = genre_ids
     self._artist_ids = artist_ids
     ArtistViewCommon.__init__(self)
     self._jump_button.hide()
     self.__overlay = Gtk.Overlay()
     self.__overlay.show()
     self.__overlay.add_overlay(self._banner)
     album_ids = App().albums.get_ids(artist_ids, genre_ids)
     self.__album_box = AlbumsBoxView(
         genre_ids, artist_ids,
         ViewType.MEDIUM | ViewType.SCROLLED | ViewType.NOT_ADAPTIVE)
     height = self._banner.default_height // 3
     self._banner.set_height(height)
     self.__album_box.set_margin_top(height)
     self.__album_box.populate([Album(id) for id in album_ids])
     self.__album_box.show()
     self.__overlay.add_overlay(self.__album_box)
     self.add(self.__overlay)
Пример #3
0
 def _on_current_changed(self, player):
     """
         Current song changed, update playing button
         @param player as Player
     """
     View._on_current_changed(self, player)
     self.__update_jump_button()
Пример #4
0
    def __init__(self, playlist_id):
        """
            Init PlaylistView
            @parma playlist id as int
        """
        View.__init__(self)
        self._playlist_id = playlist_id
        self._signal_id = Lp().playlists.connect('playlist-changed',
                                                 self._update)

        builder = Gtk.Builder()
        builder.add_from_resource('/org/gnome/Lollypop/PlaylistView.ui')
        builder.get_object('title').set_label(
                                          Lp().playlists.get_name(playlist_id))
        builder.connect_signals(self)

        self._edit_btn = builder.get_object('edit_btn')

        if playlist_id < 0 and playlist_id != Type.LOVED:
            self._edit_btn.hide()
        self._back_btn = builder.get_object('back_btn')
        self._title = builder.get_object('title')

        self._playlist_widget = PlaylistWidget(playlist_id)
        self._playlist_widget.show()

        self.add(builder.get_object('widget'))
        self._viewport.add(self._playlist_widget)
        self._scrolledWindow.set_property('expand', True)
        self.add(self._scrolledWindow)
 def __init__(self, view_type):
     """
         Init view
         @param view_type as int
     """
     View.__init__(self)
     self.__view_type = view_type
     if view_type == Type.SETTINGS_APPEARANCE:
         from lollypop.widgets_settings_appearance\
             import AppearanceSettingsWidget
         widget = AppearanceSettingsWidget()
     elif view_type == Type.SETTINGS_BEHAVIOUR:
         from lollypop.widgets_settings_behaviour\
             import BehaviourSettingsWidget
         widget = BehaviourSettingsWidget()
     elif view_type == Type.SETTINGS_COLLECTIONS:
         from lollypop.widgets_settings_collections\
             import CollectionsSettingsWidget
         widget = CollectionsSettingsWidget()
     elif view_type == Type.SETTINGS_WEB:
         from lollypop.widgets_settings_web\
             import WebSettingsWidget
         widget = WebSettingsWidget()
     elif view_type == Type.SETTINGS_DEVICES:
         from lollypop.widgets_settings_devices\
             import DevicesSettingsWidget
         widget = DevicesSettingsWidget()
     child = widget.get_child()
     if isinstance(child, Gtk.Box):
         child.set_spacing(20)
     widget.show()
     self._viewport.add(widget)
     self._scrolled.set_property("expand", True)
     self.add(self._scrolled)
Пример #6
0
    def __init__(self, artist_id, genre_id):
        """
            Init ArtistView
            @param artist id as int
            @param genre id as int
        """
        View.__init__(self)
        self._artist_id = artist_id
        self._genre_id = genre_id
        self._signal_id = None

        self._artist_name = Lp.artists.get_name(artist_id)
        if Lp.lastfm is not None:
            self._popover = InfosPopover(self._artist_name)
        builder = Gtk.Builder()
        builder.add_from_resource('/org/gnome/Lollypop/ArtistView.ui')
        builder.connect_signals(self)
        self.attach(builder.get_object('ArtistView'), 0, 0, 1, 1)
        builder.get_object('artist').set_label(self._artist_name)

        self._pop_allowed = True

        self._albumbox = Gtk.Grid()
        self._albumbox.set_row_spacing(20)
        self._albumbox.set_property("orientation", Gtk.Orientation.VERTICAL)
        self._albumbox.show()

        self._scrolledWindow.set_property('expand', True)
        self._viewport.set_property("valign", Gtk.Align.START)
        self._viewport.add(self._albumbox)
        self.add(self._scrolledWindow)
Пример #7
0
 def __init__(self, device, progress, width):
     """
         Init view
         @param device as Device
         @param progress as Gtk.ProgressBar
         @param width as int
     """
     View.__init__(self)
     self._device = device
     self._progress = progress
     builder = Gtk.Builder()
     builder.add_from_resource("/org/gnome/Lollypop/DeviceManagerView.ui")
     self._memory_combo = builder.get_object("memory_combo")
     self._syncing_btn = builder.get_object("sync_btn")
     self._syncing_btn.set_label(_("Synchronize %s") % device.name)
     builder.connect_signals(self)
     grid = builder.get_object("widget")
     self.add(grid)
     self._device_widget = DeviceManagerWidget(progress, self)
     self._device_widget.connect("sync-finished", self._on_sync_finished)
     self._device_widget.show()
     self._scrolledWindow.set_property("halign", Gtk.Align.CENTER)
     self._scrolledWindow.set_property("width-request", width)
     self._viewport.add(self._device_widget)
     self.add(self._scrolledWindow)
Пример #8
0
    def __init__(self, view_type=ViewType.DEFAULT):
        """
            Init Popover
            @param view_type as ViewType
        """
        View.__init__(self)
        self.__view_type = view_type
        self.__last_drag_id = None
        self.__stop = False
        self.connect("map", self.__on_map)
        self.connect("unmap", self.__on_unmap)

        builder = Gtk.Builder()
        builder.add_from_resource("/org/gnome/Lollypop/QueuePopover.ui")
        builder.connect_signals(self)

        self.__clear_button = builder.get_object("clear-button")

        self.__view = Gtk.ListBox()
        self.__view.set_margin_start(MARGIN_SMALL)
        self.__view.set_margin_end(MARGIN)
        self.__view.get_style_context().add_class("trackswidget")
        self.__view.set_selection_mode(Gtk.SelectionMode.NONE)
        self.__view.set_activate_on_single_click(True)
        self.__view.connect("row-activated", self.__on_row_activated)
        self.__view.show()
        self.insert_row(0)
        self.attach(builder.get_object("widget"), 0, 0, 1, 1)
        self._viewport.add(self.__view)
        self._viewport.set_vexpand(True)
        self.add(self._scrolled)
Пример #9
0
 def _on_current_changed(self, player):
     """
         Current song changed, update playing button
         @param player as Player
     """
     View._on_current_changed(self, player)
     self._update_jump_button()
Пример #10
0
 def _on_unmap(self, widget):
     """
         Enable global shortcuts
         @param widget as Gtk.Widget
     """
     View._on_unmap(self, widget)
     App().enable_special_shortcuts(True)
Пример #11
0
    def __init__(self, artist_id, genre_id):
        """
            Init ArtistView
            @param artist id as int
            @param genre id as int
        """
        View.__init__(self)
        self._artist_id = artist_id
        self._genre_id = genre_id
        self._signal_id = None

        self._artist_name = Lp.artists.get_name(artist_id)
        if Lp.lastfm is not None or self.Wikipedia is not None:
            self._popover = InfosPopover(self._artist_name)
        builder = Gtk.Builder()
        builder.add_from_resource('/org/gnome/Lollypop/ArtistView.ui')
        builder.connect_signals(self)
        self.attach(builder.get_object('ArtistView'), 0, 0, 1, 1)
        builder.get_object('artist').set_label(self._artist_name)

        self._pop_allowed = True

        self._albumbox = Gtk.Grid()
        self._albumbox.set_row_spacing(20)
        self._albumbox.set_property("orientation", Gtk.Orientation.VERTICAL)
        self._albumbox.show()

        self._scrolledWindow.set_property('expand', True)
        self._viewport.set_property("valign", Gtk.Align.START)
        self._viewport.add(self._albumbox)
        self.add(self._scrolledWindow)
Пример #12
0
 def __init__(self, device, progress, width):
     """
         Init view
         @param device as Device
         @param progress as Gtk.ProgressBar
         @param width as int
     """
     View.__init__(self)
     self._device = device
     self._progress = progress
     builder = Gtk.Builder()
     builder.add_from_resource('/org/gnome/Lollypop/DeviceManagerView.ui')
     self._memory_combo = builder.get_object('memory_combo')
     self._syncing_btn = builder.get_object('sync_btn')
     self._syncing_btn.set_label(_("Synchronize %s") % device.name)
     builder.connect_signals(self)
     grid = builder.get_object('widget')
     self.add(grid)
     self._device_widget = DeviceManagerWidget(progress, self)
     self._device_widget.connect('sync-finished', self._on_sync_finished)
     self._device_widget.show()
     self._scrolledWindow.set_property('halign', Gtk.Align.CENTER)
     self._scrolledWindow.set_property('width-request', width)
     self._viewport.add(self._device_widget)
     self.add(self._scrolledWindow)
Пример #13
0
 def do_show(self):
     """
         Do show, connect signals
     """
     self._signal_id = Lp.playlists.connect('playlist-changed',
                                            self._update_view)
     View.do_show(self)
Пример #14
0
 def do_hide(self):
     """
         Disconnect player signal
     """
     View.do_hide(self)
     if self._signal is not None:
         Lp.art.disconnect(self._signal)
Пример #15
0
    def __init__(self, playlist_ids, editable=True):
        """
            Init PlaylistView
            @parma playlist ids as [int]
            @param editable as bool
        """
        View.__init__(self)
        self._tracks = []
        self._playlist_ids = playlist_ids
        self._signal_id1 = Lp().playlists.connect('playlist-add',
                                                  self._on_playlist_add)
        self._signal_id2 = Lp().playlists.connect('playlist-del',
                                                  self._on_playlist_del)

        builder = Gtk.Builder()
        builder.add_from_resource('/org/gnome/Lollypop/PlaylistView.ui')
        builder.connect_signals(self)

        builder.get_object('title').set_label(
                             ", ".join(Lp().playlists.get_names(playlist_ids)))

        self._edit_button = builder.get_object('edit-button')
        self._jump_button = builder.get_object('jump-button')

        if len(playlist_ids) > 1 or (
           playlist_ids[0] < 0 and playlist_ids[0] != Type.LOVED) or\
                not editable:
            self._edit_button.hide()

        self._playlists_widget = PlaylistsWidget(playlist_ids)
        self._playlists_widget.show()
        self.add(builder.get_object('widget'))
        self._viewport.add(self._playlists_widget)
        self._scrolled.set_property('expand', True)
        self.add(self._scrolled)
Пример #16
0
    def __init__(self, navigation_id):
        View.__init__(self)
        self._signal = None
        self._context_album_id = None
        self._genre_id = navigation_id
        self._albumsongs = None
        self._context_widget = None

        self._albumbox = Gtk.FlowBox()
        self._albumbox.set_selection_mode(Gtk.SelectionMode.NONE)
        self._albumbox.connect("child-activated", self._on_album_activated)
        self._albumbox.set_max_children_per_line(100)
        self._albumbox.show()

        self._viewport.set_property("valign", Gtk.Align.START)
        self._viewport.add(self._albumbox)
        self._scrolledWindow.set_property('expand', True)

        self._context = ViewContainer(500)

        separator = Gtk.Separator()
        separator.show()

        self._paned = Gtk.Paned.new(Gtk.Orientation.VERTICAL)
        self._paned.pack1(self._scrolledWindow)
        self._paned.pack2(self._context, True, False)
        height = Objects.settings.get_value('paned-context-height').get_int32()
        # We set a stupid max value, safe as self._context is shrinked
        if height == -1:
            height = Objects.window.get_allocated_height()
        self._paned.set_position(height)
        self._paned.connect('notify::position', self._on_position_notify)
        self._paned.show()
        self.add(self._paned)
Пример #17
0
    def __init__(self, playlist_id, playlist_name, parent):
        """
            Init PlaylistView
            @parma playlist id as int
            @param playlist name as str
        """
        View.__init__(self)
        self._playlist_name = playlist_name
        self._signal_id = None

        builder = Gtk.Builder()
        builder.add_from_resource('/org/gnome/Lollypop/PlaylistView.ui')
        builder.get_object('title').set_label(playlist_name)
        builder.connect_signals(self)

        self._edit_btn = builder.get_object('edit_btn')

        if playlist_id < 0 and playlist_id != Type.LOVED:
            self._edit_btn.hide()
        self._back_btn = builder.get_object('back_btn')
        self._title = builder.get_object('title')

        self._playlist_widget = PlaylistWidget(playlist_id, playlist_name)
        self._playlist_widget.show()

        self.add(builder.get_object('widget'))
        self._viewport.add(self._playlist_widget)
        self._scrolledWindow.set_property('expand', True)
        self.add(self._scrolledWindow)
Пример #18
0
    def __init__(self):
        View.__init__(self)

        self._signal = None

        self._radios_manager = RadiosManager()
        self._radios_manager.connect('playlists-changed',
                                     self._on_radios_changed)
        builder = Gtk.Builder()
        builder.add_from_resource('/org/gnome/Lollypop/RadiosView.ui')
        builder.connect_signals(self)
        widget = builder.get_object('widget')

        self._pop_tunein = TuneinPopover(self._radios_manager)
        self._pop_tunein.set_relative_to(builder.get_object('search_btn'))

        self._sizegroup = Gtk.SizeGroup(mode=Gtk.SizeGroupMode.BOTH)

        self._radiobox = Gtk.FlowBox()
        self._radiobox.set_sort_func(self._sort_radios)
        self._radiobox.set_selection_mode(Gtk.SelectionMode.NONE)
        self._radiobox.connect("child-activated", self._on_album_activated)
        self._radiobox.set_property('column-spacing', 5)
        self._radiobox.set_property('row-spacing', 5)
        self._radiobox.set_homogeneous(True)
        self._radiobox.set_max_children_per_line(1000)
        self._radiobox.show()

        self._viewport.set_property("valign", Gtk.Align.START)
        self._viewport.set_property('margin', 5)
        self._viewport.add(self._radiobox)
        self._scrolledWindow.set_property('expand', True)

        self.add(widget)
        self.add(self._scrolledWindow)
Пример #19
0
 def do_show(self):
     """
         Do show, connect signals
     """
     self._signal_id = Lp.playlists.connect('playlist-changed',
                                            self._update_view)
     View.do_show(self)
Пример #20
0
 def __init__(self):
     """
         Init view
     """
     View.__init__(self)
     InformationController.__init__(
         self, False,
         ArtBehaviour.BLUR_MAX | ArtBehaviour.CROP | ArtBehaviour.DARKER)
     self.__current_changed_id = None
     self.__size_allocate_timeout_id = None
     self.__lyrics_timeout_id = None
     self.__downloads_running = 0
     self.__lyrics_text = ""
     self.__size = 0
     self.__cancellable = Gio.Cancellable()
     builder = Gtk.Builder()
     builder.add_from_resource("/org/gnome/Lollypop/LyricsView.ui")
     builder.connect_signals(self)
     self._artwork = builder.get_object("cover")
     self.__lyrics_label = LyricsLabel()
     self.__lyrics_label.show()
     builder.get_object("viewport").add(self.__lyrics_label)
     self.__translate_button = builder.get_object("translate_button")
     # We do not use View scrolled window because it does not work with
     # an overlay
     self.add(builder.get_object("widget"))
     self.connect("size-allocate", self.__on_size_allocate)
     self.__sync_lyrics_helper = SyncLyricsHelper()
Пример #21
0
    def __init__(self, playlist_id, playlist_name, parent):
        """
            Init PlaylistView
            @parma playlist id as int
            @param playlist name as str
        """
        View.__init__(self)
        self._playlist_name = playlist_name
        self._signal_id = None

        builder = Gtk.Builder()
        builder.add_from_resource('/org/gnome/Lollypop/PlaylistView.ui')
        builder.get_object('title').set_label(playlist_name)
        builder.connect_signals(self)

        self._edit_btn = builder.get_object('edit_btn')

        if playlist_id < 0 and playlist_id != Type.LOVED:
            self._edit_btn.hide()
        self._back_btn = builder.get_object('back_btn')
        self._title = builder.get_object('title')

        self._playlist_widget = PlaylistWidget(playlist_id, playlist_name)
        self._playlist_widget.show()

        self.add(builder.get_object('widget'))
        self._viewport.add(self._playlist_widget)
        self._scrolledWindow.set_property('expand', True)
        self.add(self._scrolledWindow)
Пример #22
0
    def __init__(self, playlist_id):
        """
            Init PlaylistView
            @parma playlist id as int
        """
        View.__init__(self)
        self._playlist_id = playlist_id
        self._signal_id = Lp().playlists.connect('playlist-changed',
                                                 self._update)

        builder = Gtk.Builder()
        builder.add_from_resource('/org/gnome/Lollypop/PlaylistView.ui')
        builder.get_object('title').set_label(
            Lp().playlists.get_name(playlist_id))
        builder.connect_signals(self)

        self._edit_btn = builder.get_object('edit_btn')

        if playlist_id < 0 and playlist_id != Type.LOVED:
            self._edit_btn.hide()
        self._back_btn = builder.get_object('back_btn')
        self._title = builder.get_object('title')

        self._playlist_widget = PlaylistWidget(playlist_id)
        self._playlist_widget.show()

        self.add(builder.get_object('widget'))
        self._viewport.add(self._playlist_widget)
        self._scrolledWindow.set_property('expand', True)
        self.add(self._scrolledWindow)
Пример #23
0
    def __init__(self, navigation_id):
        View.__init__(self)
        self._signal = None
        self._context_album_id = None
        self._genre_id = navigation_id
        self._albumsongs = None
        self._context_widget = None

        self._albumbox = Gtk.FlowBox()
        self._albumbox.set_selection_mode(Gtk.SelectionMode.NONE)
        self._albumbox.connect("child-activated", self._on_album_activated)
        self._albumbox.set_max_children_per_line(100)
        self._albumbox.show()

        self._viewport.set_property("valign", Gtk.Align.START)
        self._viewport.add(self._albumbox)
        self._scrolledWindow.set_property('expand', True)

        self._context = ViewContainer(500)

        separator = Gtk.Separator()
        separator.show()

        self._paned = Gtk.Paned.new(Gtk.Orientation.VERTICAL)
        self._paned.pack1(self._scrolledWindow)
        self._paned.pack2(self._context, True, False)
        height = Objects.settings.get_value(
                                         'paned-context-height').get_int32()
        # We set a stupid max value, safe as self._context is shrinked
        if height == -1:
            height = Objects.window.get_allocated_height()
        self._paned.set_position(height)
        self._paned.connect('notify::position', self._on_position_notify)
        self._paned.show()
        self.add(self._paned)
Пример #24
0
    def __init__(self, playlist_ids, editable=True):
        """
            Init PlaylistView
            @parma playlist ids as [int]
            @param editable as bool
        """
        View.__init__(self)
        self.__tracks = []
        self.__playlist_ids = playlist_ids
        self.__signal_id1 = Lp().playlists.connect('playlist-add',
                                                   self.__on_playlist_add)
        self.__signal_id2 = Lp().playlists.connect('playlist-del',
                                                   self.__on_playlist_del)

        builder = Gtk.Builder()
        builder.add_from_resource('/org/gnome/Lollypop/PlaylistView.ui')
        builder.connect_signals(self)

        builder.get_object('title').set_label(
                             ", ".join(Lp().playlists.get_names(playlist_ids)))

        self.__edit_button = builder.get_object('edit-button')
        self.__jump_button = builder.get_object('jump-button')

        if len(playlist_ids) > 1 or (
           playlist_ids[0] < 0 and playlist_ids[0] != Type.LOVED) or\
                not editable:
            self.__edit_button.hide()

        self.__playlists_widget = PlaylistsWidget(playlist_ids)
        self.__playlists_widget.show()
        self.add(builder.get_object('widget'))
        self._viewport.add(self.__playlists_widget)
        self._scrolled.set_property('expand', True)
        self.add(self._scrolled)
Пример #25
0
 def __init__(self, view_type):
     """
         Init view
         @param view_type as ViewType
     """
     View.__init__(self, StorageType.COLLECTION,
                   view_type | ViewType.OVERLAY)
     self.__lyrics_timeout_id = None
     self.__downloads_running = 0
     self.__lyrics_text = ""
     self._empty_message = _("No track playing")
     self._empty_icon_name = "view-dual-symbolic"
     self.__lyrics_label = LyricsLabel()
     self.__lyrics_label.show()
     self.__lyrics_label.set_property("halign", Gtk.Align.CENTER)
     self.__banner = LyricsBannerWidget(self.view_type)
     self.__banner.show()
     self.__banner.connect("translate", self.__on_translate)
     self.add_widget(self.__lyrics_label, self.__banner)
     self.__lyrics_helper = LyricsHelper()
     self.__update_lyrics_style()
     self.__information_store = InformationStore()
     return [(App().window.container.widget, "notify::folded",
              "_on_container_folded"),
             (App().player, "current-changed", "_on_current_changed")]
Пример #26
0
 def _on_map(self, widget):
     """
         Disable shortcuts and update buttons
         @param widget as Gtk.Widget
     """
     View._on_map(self, widget)
     App().enable_special_shortcuts(False)
Пример #27
0
 def _on_map(self, widget):
     """
         Disable global shortcuts and update toolbar
         @param widget as Gtk.Widget
     """
     View._on_map(self, widget)
     App().enable_special_shortcuts(False)
Пример #28
0
 def __init__(self, initial_search, view_type):
     """
         Init Popover
         @param initial_search as str
     """
     View.__init__(
         self, StorageType.COLLECTION | StorageType.SAVED
         | StorageType.SEARCH | StorageType.EPHEMERAL
         | StorageType.SPOTIFY_NEW_RELEASES | StorageType.SPOTIFY_SIMILARS,
         ViewType.SEARCH | ViewType.SCROLLED | ViewType.OVERLAY)
     Gtk.Bin.__init__(self)
     self.__timeout_id = None
     self.__current_search = ""
     self.__search = Search()
     self.__search.set_web_search(
         App().settings.get_value("web-search").get_string())
     self.__cancellable = Gio.Cancellable()
     self._empty_message = _("Search for artists, albums and tracks")
     self._empty_icon_name = "edit-find-symbolic"
     self.__cancellable = Gio.Cancellable()
     self.__banner = SearchBannerWidget()
     self.__banner.show()
     self.__stack = SearchStack(self.storage_type)
     self.__stack.show()
     self.add_widget(self.__stack, self.__banner)
     self.__banner.entry.connect("changed", self._on_search_changed)
     self.show_placeholder(True, _("Search for artists, albums and tracks"))
     self.set_search(initial_search)
     return [(self.__search, "match-artist", "_on_match_artist"),
             (self.__search, "match-album", "_on_match_album"),
             (self.__search, "match-track", "_on_match_track"),
             (self.__search, "finished", "_on_search_finished"),
             (App().settings, "changed::web-search",
              "_on_web_search_changed")]
Пример #29
0
    def _get_view_albums_decades(self):
        """
            Get album view for decades
        """
        def load():
            (years, unknown) = App().albums.get_years()
            decades = []
            decade = []
            current_d = None
            for year in sorted(years):
                d = year // 10
                if current_d is not None and current_d != d:
                    current_d = d
                    decades.append(decade)
                    decade = []
                current_d = d
                decade.append(year)
            if decade:
                decades.append(decade)
            return decades

        if App().window.is_adaptive:
            view = View()
        else:
            from lollypop.view_albums_decade_box import AlbumsDecadeBoxView
            view = AlbumsDecadeBoxView()
            loader = Loader(target=load, view=view)
            loader.start()
        view.show()
        return view
Пример #30
0
 def do_hide(self):
     """
         Disconnect player signal
     """
     View.do_hide(self)
     if self._signal is not None:
         Lp.art.disconnect(self._signal)
Пример #31
0
 def do_show(self):
     """
         Connect player signal
     """
     View.do_show(self)
     self._signal = Lp.art.connect('logo-changed',
                                   self._on_logo_changed)
Пример #32
0
 def __init__(self, storage_type, view_type):
     """
         Init view
         @param storage_type as StorageType
         @param view_type as ViewType
     """
     View.__init__(self, storage_type, view_type | ViewType.OVERLAY)
     self.__grid = Gtk.Grid()
     self.__grid.get_style_context().add_class("padding")
     self.__grid.set_row_spacing(5)
     self.__grid.set_orientation(Gtk.Orientation.VERTICAL)
     self.__grid.show()
     if App().tracks.count() == 0:
         self.__welcome_screen()
         self.add_widget(self.__grid, None)
     else:
         album = TodayBannerWidget.get_today_album()
         if album is not None:
             self.__banner = TodayBannerWidget(album, self.view_type)
             self.__banner.show()
         else:
             self.__banner = None
         self.add_widget(self.__grid, self.__banner)
     return [
         (App().settings, "changed::suggestions-mask", "_on_mask_changed"),
     ]
Пример #33
0
 def _on_map(self, widget):
     """
         Set initial view state
         @param widget as GtK.Widget
     """
     View._on_map(self, widget)
     if self.view_type & ViewType.SCROLLED:
         self.scrolled.grab_focus()
Пример #34
0
 def _update_overlays(self, widgets):
     """
         Update children's overlay
         @param widgets as AlbumWidget
     """
     if self._context_widget in widgets:
         widgets.remove(self._context_widget)
     View._update_overlays(self, widgets)
Пример #35
0
 def _on_map(self, widget):
     """
         Restore backup and load
         @param widget as Gtk.Widget
     """
     View._on_map(self, widget)
     if self.__loading_state == LoadingState.ABORTED and self.__lazy_queue:
         self.lazy_loading()
Пример #36
0
 def _update_overlays(self, widgets):
     """
         Update children's overlay
         @param widgets as AlbumWidget
     """
     if self._context_widget in widgets:
         widgets.remove(self._context_widget)
     View._update_overlays(self, widgets)
Пример #37
0
 def do_hide(self):
     """
         Do hide, disconnect signals
     """
     if self._signal_id:
         Lp.playlists.disconnect(self._signal_id)
         self._signal_id = None
     View.do_hide(self)
Пример #38
0
 def __init__(self, widget):
     View.__init__(self)
     self._widget = widget
     self._viewport.add(widget)
     self._viewport.show()
     self._scrolledWindow.set_min_content_height(ArtSize.BIG+35)
     self._scrolledWindow.show()
     self.add(self._scrolledWindow)
Пример #39
0
 def __init__(self):
     """
         Init view
     """
     View.__init__(self)
     builder = Gtk.Builder()
     builder.add_from_resource('/org/gnome/Lollypop/DeviceManagerView.ui')
     self.add(builder.get_object('nodevice'))
Пример #40
0
 def __init__(self, widget):
     View.__init__(self)
     self._widget = widget
     self._viewport.add(widget)
     self._viewport.show()
     self._scrolledWindow.set_min_content_height(ArtSize.BIG + 35)
     self._scrolledWindow.show()
     self.add(self._scrolledWindow)
Пример #41
0
 def set_scrolled(self, scrolled):
     """
         Add an external scrolled window
         @param scrolled as Gtk.ScrolledWindow
     """
     View.set_scrolled(self, scrolled)
     scrolled.get_vadjustment().connect("value-changed",
                                        self._on_value_changed)
Пример #42
0
 def __init__(self):
     """
         Init view
     """
     View.__init__(self, StorageType.ALL, ViewType.SCROLLED)
     widget = EqualizerWidget()
     widget.show()
     self.add_widget(widget)
Пример #43
0
 def __init__(self):
     """
         Init view
     """
     View.__init__(self)
     builder = Gtk.Builder()
     builder.add_from_resource('/org/gnome/Lollypop/DeviceManagerView.ui')
     self.add(builder.get_object('nodevice'))
Пример #44
0
 def __init__(self):
     """
         Init view
     """
     View.__init__(self)
     widget = EqualizerWidget()
     widget.show()
     self.add(widget)
Пример #45
0
 def do_hide(self):
     """
         Do hide, disconnect signals
     """
     if self._signal_id:
         Lp.playlists.disconnect(self._signal_id)
         self._signal_id = None
     View.do_hide(self)
Пример #46
0
 def _on_destroy(self, widget):
     """
         Disconnect signals
         @param widget as Gtk.Widget
     """
     View._on_destroy(self, widget)
     if self._signal is not None:
         Lp.art.disconnect(self._signal)
Пример #47
0
 def __init__(self):
     """
         Init view
     """
     View.__init__(self)
     builder = Gtk.Builder()
     builder.add_from_resource('/org/gnome/Lollypop/DeviceManagerView.ui')
     self.add(builder.get_object('message'))
     builder.get_object('label').set_text(_("Please unlock your device"))
Пример #48
0
 def _on_destroy(self, widget):
     """
         Disconnect signals
         @param widget as Gtk.Widget
     """
     View._on_destroy(self, widget)
     if self._signal_id:
         Lp.playlists.disconnect(self._signal_id)
         self._signal_id = None
Пример #49
0
 def _on_destroy(self, widget):
     """
         Remove running timeout
         @param widget as Gtk.Widget
     """
     if self.__timeout_id is not None:
         GLib.source_remove(self.__timeout_id)
         self.__timeout_id = None
     View._on_destroy(self, widget)
Пример #50
0
 def __init__(self):
     """
         Init view
     """
     View.__init__(self)
     builder = Gtk.Builder()
     builder.add_from_resource('/org/gnome/Lollypop/DeviceManagerView.ui')
     self.add(builder.get_object('message'))
     builder.get_object('label').set_text(
         _("Lollypop sync changed due to limitations in some devices.\n"
           "Please remove Music/lollypop folder on your device..."))
Пример #51
0
 def _on_destroy(self, widget):
     """
         Disconnect signals
         @param widget as Gtk.Widget
     """
     View._on_destroy(self, widget)
     if self._signal_id1:
         Lp().playlists.disconnect(self._signal_id1)
         self._signal_id1 = None
     if self._signal_id2:
         Lp().playlists.disconnect(self._signal_id2)
         self._signal_id2 = None
Пример #52
0
 def __init__(self, widget):
     """
         Init context
         @param main view widget
     """
     View.__init__(self)
     self._widget = widget
     self._viewport.add(widget)
     self._viewport.show()
     self._scrolledWindow.set_min_content_height(ArtSize.BIG+35)
     self._scrolledWindow.show()
     self.add(self._scrolledWindow)
Пример #53
0
    def __init__(self, playlist_ids, editable=True):
        """
            Init PlaylistView
            @parma playlist ids as [int]
            @param editable as bool
        """
        View.__init__(self)
        self._tracks = []
        self._playlist_ids = playlist_ids
        self._signal_id1 = Lp().playlists.connect('playlist-add',
                                                  self._on_playlist_add)
        self._signal_id2 = Lp().playlists.connect('playlist-del',
                                                  self._on_playlist_del)

        builder = Gtk.Builder()
        builder.add_from_resource('/org/gnome/Lollypop/PlaylistView.ui')
        builder.connect_signals(self)

        name = ""
        for playlist_id in playlist_ids:
            if playlist_id == Type.POPULARS:
                name += _("Popular tracks")+", "
            elif playlist_id == Type.RECENTS:
                name += _("Recently played")+", "
            elif playlist_id == Type.NEVER:
                name += _("Never played")+", "
            elif playlist_id == Type.RANDOMS:
                name += _("Random tracks")+", "
            elif playlist_id == Type.SEARCH:
                name += _("Search")+", "
            else:
                name += Lp().playlists.get_name(playlist_id)+", "
        builder.get_object('title').set_label(name[:-2])

        self._edit_button = builder.get_object('edit-button')
        self._jump_button = builder.get_object('jump-button')

        if len(playlist_ids) > 1 or (
           playlist_ids[0] < 0 and playlist_ids[0] != Type.LOVED) or\
                not editable:
            self._edit_button.hide()
        self._title = builder.get_object('title')

        self._playlists_widget = PlaylistsWidget(playlist_ids)
        self._playlists_widget.connect('populated', self._on_populated)
        self._playlists_widget.show()
        self.add(builder.get_object('widget'))
        self._viewport.add(self._playlists_widget)
        self._scrolled.set_property('expand', True)
        self.add(self._scrolled)
Пример #54
0
 def __init__(self, playlist_name, width):
     View.__init__(self)
     builder = Gtk.Builder()
     builder.add_from_resource('/org/gnome/Lollypop/PlaylistEditView.ui')
     builder.get_object('title').set_label(playlist_name)
     builder.connect_signals(self)
     grid = builder.get_object('widget')
     self.add(grid)
     self._edit_widget = PlaylistEditWidget(playlist_name)
     self._edit_widget.show()
     self._scrolledWindow.set_property('halign', Gtk.Align.CENTER)
     self._scrolledWindow.set_property('width-request', width)
     self._viewport.add(self._edit_widget)
     self.add(self._scrolledWindow)
Пример #55
0
    def __init__(self, genre_id, is_compilation):
        """
            Init album view
            @param genre id as int
            @param is compilation as bool
        """
        View.__init__(self)
        self._signal = None
        self._context_album_id = None
        self._genre_id = genre_id
        self._is_compilation = is_compilation
        self._albumsongs = None
        self._context_widget = None
        self._press_rect = None
        self._lazy_queue = []  # Widgets not initialized
        self._scroll_value = 0
        self._timeout_id = None

        self._albumbox = Gtk.FlowBox()
        self._albumbox.set_selection_mode(Gtk.SelectionMode.NONE)
        self._albumbox.connect('child-activated', self._on_album_activated)
        self._albumbox.connect('button-press-event', self._on_button_press)
        self._albumbox.set_property('column-spacing', 5)
        self._albumbox.set_property('row-spacing', 5)
        self._albumbox.set_homogeneous(True)
        self._albumbox.set_max_children_per_line(1000)
        self._albumbox.show()

        self._viewport.set_property('valign', Gtk.Align.START)
        self._viewport.set_property('margin', 5)
        self._scrolled.set_property('expand', True)
        self._scrolled.get_vadjustment().connect('value-changed',
                                                 self._on_value_changed)
        self._context = ViewContainer(500)

        separator = Gtk.Separator()
        separator.show()

        self._paned = Gtk.Paned.new(Gtk.Orientation.VERTICAL)
        self._paned.pack1(self._scrolled, True, False)
        self._paned.pack2(self._context, False, False)
        height = Lp().settings.get_value('paned-context-height').get_int32()
        # We set a stupid max value, safe as self._context is shrinked
        if height == -1:
            height = Lp().window.get_allocated_height()
        self._paned.set_position(height)
        self._paned.connect('notify::position', self._on_position_notify)
        self._paned.show()
        self.add(self._paned)
Пример #56
0
 def __init__(self, playlist_name):
     """
         Init view
         @param playlist name as str
         @param width as int
     """
     View.__init__(self)
     builder = Gtk.Builder()
     builder.add_from_resource('/org/gnome/Lollypop/PlaylistEditView.ui')
     builder.get_object('title').set_label(playlist_name)
     builder.connect_signals(self)
     grid = builder.get_object('widget')
     self.add(grid)
     self._edit_widget = PlaylistEditWidget(playlist_name)
     self._edit_widget.show()
     self._viewport.add(self._edit_widget)
     self.add(self._scrolledWindow)
Пример #57
0
 def __init__(self, object_id, genre_id, is_album, width):
     View.__init__(self)
     builder = Gtk.Builder()
     builder.add_from_resource(
         '/org/gnome/Lollypop/PlaylistsManagerView.ui')
     if object_id != -1:
         builder.get_object('back_btn').show()
     builder.connect_signals(self)
     self._manage_widget = PlaylistsManagerWidget(object_id,
                                                  genre_id,
                                                  is_album)
     self._manage_widget.show()
     self._scrolledWindow.set_property('halign', Gtk.Align.CENTER)
     self._scrolledWindow.set_property('width-request', width)
     self._viewport.add(self._manage_widget)
     self.add(builder.get_object('widget'))
     self.add(self._scrolledWindow)
Пример #58
0
    def __init__(self, artist_id):
        View.__init__(self)
        self._artist_id = artist_id
        self._genre_id = Type.ALL
        self._signal_id = None

        self._pop_allowed = False

        self._albumbox = Gtk.Grid()
        self._albumbox.set_row_spacing(20)
        self._albumbox.set_property("orientation", Gtk.Orientation.VERTICAL)
        self._albumbox.show()

        self._scrolledWindow.set_property('expand', True)
        self._viewport.set_property("valign", Gtk.Align.START)
        self._viewport.add(self._albumbox)
        self.add(self._scrolledWindow)
Пример #59
0
    def __init__(self):
        """
            Init view
        """
        View.__init__(self)
        self._signal = Lp().art.connect('radio-artwork-changed',
                                        self._on_logo_changed)

        self._radios_manager = Radios()
        self._radios_manager.connect('radios-changed',
                                     self._on_radios_changed)
        builder = Gtk.Builder()
        builder.add_from_resource('/org/gnome/Lollypop/RadiosView.ui')
        builder.connect_signals(self)
        widget = builder.get_object('widget')
        self._empty = builder.get_object('empty')

        self._pop_tunein = TuneinPopover(self._radios_manager)
        self._pop_tunein.set_relative_to(builder.get_object('search_btn'))

        self._sizegroup = Gtk.SizeGroup(mode=Gtk.SizeGroupMode.BOTH)

        self._radiobox = Gtk.FlowBox()
        self._radiobox.set_selection_mode(Gtk.SelectionMode.NONE)
        self._radiobox.connect("child-activated", self._on_album_activated)
        self._radiobox.set_property('column-spacing', 5)
        self._radiobox.set_property('row-spacing', 5)
        self._radiobox.set_homogeneous(True)
        self._radiobox.set_max_children_per_line(1000)
        self._radiobox.show()

        self._stack = Gtk.Stack()
        self._stack.set_transition_duration(500)
        self._stack.set_transition_type(Gtk.StackTransitionType.CROSSFADE)
        self._stack.add(self._scrolled)
        self._stack.add(self._empty)
        self._stack.show()

        self._viewport.set_property("valign", Gtk.Align.START)
        self._viewport.set_property('margin', 5)
        self._viewport.add(self._radiobox)
        self._scrolled.set_property('expand', True)

        self.add(widget)
        self.add(self._stack)
Пример #60
0
 def __init__(self, playlist_id):
     """
         Init view
         @param playlist id as int
         @param playlist name as int
         @param width as int
     """
     View.__init__(self)
     builder = Gtk.Builder()
     builder.add_from_resource("/org/gnome/Lollypop/PlaylistEditView.ui")
     builder.get_object("title").set_label(Lp().playlists.get_name(playlist_id))
     builder.connect_signals(self)
     grid = builder.get_object("widget")
     self.add(grid)
     self._edit_widget = PlaylistEditWidget(playlist_id)
     self._edit_widget.show()
     self._viewport.add(self._edit_widget)
     self.add(self._scrolled)