コード例 #1
0
ファイル: stage.py プロジェクト: Fantu/cinnamon-screensaver
    def update_monitor_views(self):
        """
        Updates all of our MonitorViews based on the power
        or Awake states.
        """
        low_power = not self.power_client.plugged_in
        if not status.Awake:
            if (not settings.should_show_plugin()) or (settings.should_show_plugin() and low_power):
                if self.clock_widget != None and settings.get_show_clock():
                    self.clock_widget.start_positioning()
                if self.albumart_widget != None and settings.get_show_albumart():
                    self.albumart_widget.start_positioning()
            else:
                if self.clock_widget != None:
                    self.clock_widget.stop_positioning()
                    self.clock_widget.hide()
                if self.albumart_widget != None:
                    self.albumart_widget.stop_positioning()
                    self.albumart_widget.hide()

        for monitor in self.monitors:
            monitor.update_view(status.Awake, low_power)

            if not monitor.get_reveal_child():
                monitor.reveal()
コード例 #2
0
    def __init__(self, screen, away_message=None, initial_monitor=0):
        super(AlbumArt, self).__init__(initial_monitor)
        self.screen = screen
        self.get_style_context().add_class("albumart")

        if not settings.get_show_albumart():
            return

        self.watcher = singletons.MediaPlayerWatcher
        self.player = self.watcher.get_best_player()

        self.current_url = None

        self.image = FramedImage()
        self.image.show()
        self.image.set_opacity(0.0)
        self.add(self.image)

        trackers.con_tracker_get().connect(self.image, "pixbuf-changed",
                                           self.on_pixbuf_changed)

        if self.player != None:
            trackers.con_tracker_get().connect(self.player, "metadata-changed",
                                               self.on_metadata_changed)
            self.on_metadata_changed(self.player)
コード例 #3
0
    def __init__(self, away_message=None, initial_monitor=0):
        super(AlbumArt, self).__init__(initial_monitor)
        self.get_style_context().add_class("albumart")
        self.set_halign(Gtk.Align.END)

        if not settings.get_show_albumart():
            return

        self.watcher = singletons.MediaPlayerWatcher
        self.player = self.watcher.get_best_player()

        self.current_url = None

        self.image = FramedImage()
        self.image.show()
        self.image.set_opacity(0.0)
        self.add(self.image)

        trackers.con_tracker_get().connect(self.image,
                                           "pixbuf-changed",
                                           self.on_pixbuf_changed)

        if self.player != None:
            trackers.con_tracker_get().connect(self.player,
                                               "metadata-changed",
                                               self.on_metadata_changed)
            self.on_metadata_changed(self.player)
コード例 #4
0
    def __init__(self, away_message=None, initial_monitor=0):
        super(AlbumArt, self).__init__(initial_monitor)
        self.get_style_context().add_class("albumart")
        self.set_halign(Gtk.Align.END)
        self.set_valign(Gtk.Align.CENTER)

        if not settings.get_show_albumart():
            return

        self.watcher = singletons.MediaPlayerWatcher
        self.player = self.watcher.get_best_player()

        self.current_url = None

        self.image = FramedImage(status.screen.get_low_res_mode(),
                                 scale_up=True)
        self.image.show()
        self.image.set_opacity(0.0)
        self.add(self.image)

        trackers.con_tracker_get().connect(self.image, "surface-changed",
                                           self.on_surface_changed)

        if self.player != None:
            trackers.con_tracker_get().connect(self.player, "metadata-changed",
                                               self.on_metadata_changed)
            self.on_metadata_changed(self.player)
コード例 #5
0
    def update_monitor_views(self):
        """
        Updates all of our MonitorViews based on the power
        or Awake states.
        """
        low_power = not self.power_client.plugged_in

        if (not settings.should_show_plugin()) or (
                settings.should_show_plugin() and low_power):
            if self.clock_widget != None and settings.get_show_clock():
                self.clock_widget.start_positioning()
            if self.albumart_widget != None and settings.get_show_albumart():
                self.albumart_widget.start_positioning()
        else:
            if self.clock_widget != None:
                self.clock_widget.stop_positioning()
                self.clock_widget.hide()
            if self.albumart_widget != None:
                self.albumart_widget.stop_positioning()
                self.albumart_widget.hide()

        for monitor in self.monitors:
            monitor.update_view(status.Awake, low_power)

            if not monitor.get_reveal_child():
                monitor.reveal()
コード例 #6
0
    def update_monitor_views(self):
        """
        Updates all of our MonitorViews based on the power
        or Awake states.
        """

        if not status.Awake:
            if self.clock_widget != None and settings.get_show_clock():
                self.clock_widget.start_positioning()
            if self.albumart_widget != None and settings.get_show_albumart():
                self.albumart_widget.start_positioning()

        for monitor in self.monitors:
                monitor.show()
コード例 #7
0
    def update_monitor_views(self):
        """
        Updates all of our MonitorViews based on the power
        or Awake states.
        """

        if not status.Awake:
            if self.clock_widget != None and settings.get_show_clock():
                self.clock_widget.start_positioning()
            if self.albumart_widget != None and settings.get_show_albumart():
                self.albumart_widget.start_positioning()

        for monitor in self.monitors:
            monitor.show()
コード例 #8
0
    def after_transitioned_back_to_sleep(self, monitor, data=None):
        """
        Called after the MonitorViews have updated - re-show the clock (if desired)
        and the InfoPanel (if required.)
        """
        trackers.con_tracker_get().disconnect(monitor,
                                              "current-view-change-complete",
                                              self.after_transitioned_back_to_sleep)

        self.info_panel.update_revealed()

        if not status.PluginRunning:
            if settings.get_show_clock():
                self.clock_widget.start_positioning()
            if settings.get_show_albumart():
                self.albumart_widget.start_positioning()
コード例 #9
0
    def setup_albumart(self):
        """
        Construct the AlbumArt widget and add it to the overlay, but only actually
        show it if we're a) Not running a plug-in, and b) The user wants it via
        preferences.

        Initially invisible, regardless - its visibility is controlled via its
        own positioning timer.
        """
        self.albumart_widget = AlbumArt(self.screen, self.away_message, utils.get_mouse_monitor())
        self.add_child_widget(self.albumart_widget)

        self.floaters.append(self.clock_widget)

        if not settings.should_show_plugin() and settings.get_show_albumart():
            self.albumart_widget.start_positioning()
コード例 #10
0
    def after_transitioned_back_to_sleep(self, monitor, data=None):
        """
        Called after the MonitorViews have updated - re-show the clock (if desired)
        and the InfoPanel (if required.)
        """
        trackers.con_tracker_get().disconnect(
            monitor, "current-view-change-complete",
            self.after_transitioned_back_to_sleep)

        self.info_panel.update_revealed()

        if not status.PluginRunning:
            if settings.get_show_clock():
                self.clock_widget.start_positioning()
            if settings.get_show_albumart():
                self.albumart_widget.start_positioning()
コード例 #11
0
    def setup_albumart(self):
        """
        Construct the AlbumArt widget and add it to the overlay, but only actually
        show it if we're a) Not running a plug-in, and b) The user wants it via
        preferences.

        Initially invisible, regardless - its visibility is controlled via its
        own positioning timer.
        """
        self.albumart_widget = AlbumArt(None,
                                        status.screen.get_mouse_monitor())
        self.add_child_widget(self.albumart_widget)

        self.floaters.append(self.clock_widget)

        if settings.get_show_albumart():
            self.albumart_widget.start_positioning()
コード例 #12
0
    def setup_albumart(self):
        """
        Construct the AlbumArt widget and add it to the overlay, but only actually
        show it if we're a) Not running a plug-in, and b) The user wants it via
        preferences.

        Initially invisible, regardless - its visibility is controlled via its
        own positioning timer.
        """
        self.albumart_widget = AlbumArt(self.screen, self.away_message, self.screen.get_mouse_monitor())
        self.add_child_widget(self.albumart_widget)

        self.floaters.append(self.clock_widget)

        if self.mplayer.fs:
            return
        if (not settings.should_show_plugin()) or (settings.should_show_plugin() and not self.power_client.plugged_in):
            if settings.get_show_albumart():
                self.albumart_widget.start_positioning()