コード例 #1
0
ファイル: fullscreen.py プロジェクト: gfidente/lollypop
    def __init__(self, app, parent):
        """
            Init window and set transient for parent
            @param app as Gio.Application
            @param parent as Gtk.window
        """
        Gtk.Window.__init__(self)
        self.set_title("Lollypop")
        PlaybackController.__init__(self)
        ProgressController.__init__(self)
        self.set_application(app)
        self.__timeout1 = None
        self.__timeout2 = None
        self.__signal1_id = None
        self.__signal2_id = None
        self.set_decorated(False)
        self.__parent = parent

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

        # Calculate cover size
        screen = Gdk.Screen.get_default()
        monitor = screen.get_primary_monitor()
        geometry = screen.get_monitor_geometry(monitor)
        # We want 500 and 200 in full hd
        if geometry.width > geometry.height:
            artsize = int(ArtSize.FULLSCREEN * geometry.width / 1920)
        else:
            artsize = int(ArtSize.FULLSCREEN * geometry.height / 1920)
        InfoController.__init__(self, artsize)

        self._play_btn = builder.get_object("play_btn")
        self._next_btn = builder.get_object("next_btn")
        self._prev_btn = builder.get_object("prev_btn")
        self._next_popover = NextPopover()
        self._next_popover.set_position(Gtk.PositionType.BOTTOM)
        self._play_image = builder.get_object("play_image")
        self._pause_image = builder.get_object("pause_image")
        close_btn = builder.get_object("close_btn")
        close_btn.connect("clicked", self.__destroy)
        self._cover = builder.get_object("cover")
        self._title_label = builder.get_object("title")
        self._artist_label = builder.get_object("artist")
        self._album_label = builder.get_object("album")

        self._datetime = builder.get_object("datetime")

        self._progress = builder.get_object("progress_scale")
        self._timelabel = builder.get_object("playback")
        self._total_time_label = builder.get_object("duration")
        self.connect("key-release-event", self.__on_key_release_event)
        self.add(builder.get_object("widget"))
コード例 #2
0
 def __init__(self):
     """
         Init toolbar
     """
     Gtk.Bin.__init__(self)
     InfoController.__init__(self, WindowSize.SMALL)
     builder = Gtk.Builder()
     builder.add_from_resource("/org/gnome/Lollypop/MiniPlayer.ui")
     builder.connect_signals(self)
     self.__grid = builder.get_object("grid")
     self._title_label = builder.get_object("title")
     self._artist_label = builder.get_object("artist")
     self._cover = builder.get_object("cover")
     self._signal_id = Lp().player.connect("current-changed",
                                           self.on_current_changed)
     self.on_current_changed(Lp().player)
     self.add(builder.get_object("widget"))
コード例 #3
0
ファイル: fullscreen.py プロジェクト: gfidente/lollypop
 def on_current_changed(self, player):
     """
         Update infos and show/hide popover
         @param player as Player
     """
     InfoController.on_current_changed(self, player)
     ProgressController.on_current_changed(self, player)
     if player.current_track.id is not None:
         album_name = player.current_track.album.name
         if player.current_track.year:
             album_name += " (%s)" % player.current_track.year
         self._album_label.set_text(album_name)
     # Do not show next popover non internal tracks as
     # tags will be readed on the fly
     if player.next_track.id is not None and player.next_track.id >= 0:
         self._next_popover.update()
         self._next_popover.show()
     else:
         self._next_popover.hide()
コード例 #4
0
ファイル: toolbar_info.py プロジェクト: lexruee/lollypop
    def __init__(self):
        """
            Init toolbar
        """
        Gtk.Bin.__init__(self)
        InfoController.__init__(self, ArtSize.SMALL)
        builder = Gtk.Builder()
        builder.add_from_resource("/org/gnome/Lollypop/ToolbarInfo.ui")
        builder.connect_signals(self)
        self.__pop_tunein = None
        self.__pop_info = None
        self.__timeout_id = None
        self.__width = 0

        self._infobox = builder.get_object("info")
        self.add(self._infobox)

        self.__helper = TouchHelper(self._infobox, None, None)
        self.__helper.set_long_func(self.__on_info_long)
        self.__helper.set_short_func(self.__on_info_short)

        self._spinner = builder.get_object("spinner")

        self.__labels = builder.get_object("nowplaying_labels")
        self.__labels.connect("query-tooltip", self.__on_query_tooltip)
        self.__labels.set_property("has-tooltip", True)

        self._title_label = builder.get_object("title")
        self._artist_label = builder.get_object("artist")
        self._cover = builder.get_object("cover")
        self._cover.set_property("has-tooltip", True)
        # Since GTK 3.20, we can set cover full height
        if Gtk.get_minor_version() > 18:
            self._cover.get_style_context().add_class("toolbar-cover-frame")
        else:
            self._cover.get_style_context().add_class("small-cover-frame")

        self.connect("realize", self.__on_realize)
        Lp().player.connect("loading-changed", self.__on_loading_changed)
        Lp().art.connect("album-artwork-changed", self.__update_cover)
        Lp().art.connect("radio-artwork-changed", self.__update_logo)
コード例 #5
0
    def __init__(self, app, parent):
        """
            Init window and set transient for parent
            @param app as Gio.Application
            @param parent as Gtk.window
        """
        Gtk.Window.__init__(self)
        self.set_title("Lollypop")
        PlaybackController.__init__(self)
        ProgressController.__init__(self)
        self.set_application(app)
        self.__timeout1 = None
        self.__timeout2 = None
        self.__signal1_id = None
        self.__signal2_id = None
        self.set_decorated(False)
        self.__parent = parent

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

        # Calculate cover size
        screen = Gdk.Screen.get_default()
        monitor = screen.get_primary_monitor()
        geometry = screen.get_monitor_geometry(monitor)
        # We want 500 and 200 in full hd
        if geometry.width > geometry.height:
            artsize = int(ArtSize.FULLSCREEN * geometry.width / 1920)
        else:
            artsize = int(ArtSize.FULLSCREEN * geometry.height / 1920)
        InfoController.__init__(self, artsize)
        widget = builder.get_object("widget")
        self._play_btn = builder.get_object("play_btn")
        self._next_btn = builder.get_object("next_btn")
        self._prev_btn = builder.get_object("prev_btn")
        self._next_popover = NextPopover()
        self._next_popover.set_position(Gtk.PositionType.BOTTOM)
        self._play_image = builder.get_object("play_image")
        self._pause_image = builder.get_object("pause_image")
        close_btn = builder.get_object("close_btn")
        preferences = Gio.Settings.new("org.gnome.desktop.wm.preferences")
        layout = preferences.get_value("button-layout").get_string()
        if layout.split(":")[0] == "close":
            widget.attach(close_btn, 0, 0, 1, 1)
            close_btn.set_property("halign", Gtk.Align.START)
        else:
            widget.attach(close_btn, 2, 0, 1, 1)
            close_btn.set_property("halign", Gtk.Align.END)
        self._cover = builder.get_object("cover")
        self._title_label = builder.get_object("title")
        self._artist_label = builder.get_object("artist")
        self._album_label = builder.get_object("album")

        self._datetime = builder.get_object("datetime")

        self._progress = builder.get_object("progress_scale")
        self._timelabel = builder.get_object("playback")
        self._total_time_label = builder.get_object("duration")
        self.connect("key-release-event", self.__on_key_release_event)
        self.add(widget)