Ejemplo n.º 1
0
    def update_revealed(self):
        """
        Determines whether or not to show the panel, depending on:
            - Whether the power widget should show (are we on battery?)
            - Whether the notification widget should show (are there any?)
            - Are we running a plugin or not?  Only show over wallpaper.

        The panel will show if either of its child indicators has useful info.
        """
        if self.disabled:
            return

        do_reveal = False

        self.show_power = self.power_widget.should_show()
        self.show_notifications = self.notification_widget.should_show()

        # Determine if we want to show all the time or only when status.Awake

        if status.Awake:
            if self.show_power or self.show_notifications:
                do_reveal = True
        elif status.Active and not status.PluginRunning:
            if self.show_notifications:
                do_reveal = True

        if do_reveal:
            self.power_widget.set_visible(self.show_power)
            self.notification_widget.set_visible(self.show_notifications)
            self.reveal()
        else:
            self.unreveal()
            trackers.con_tracker_get().connect(self, "notify::child-revealed",
                                               self.after_unreveal)
Ejemplo n.º 2
0
    def destroy_stage(self):
        """
        Performs all tear-down necessary to destroy the Stage, destroying
        all children in the process, and finally destroying itself.
        """
        trackers.con_tracker_get().disconnect(singletons.Backgrounds,
                                              "changed", self.on_bg_changed)

        trackers.con_tracker_get().disconnect(self.power_client,
                                              "power-state-changed",
                                              self.on_power_state_changed)

        trackers.con_tracker_get().disconnect(self, "grab-broken-event",
                                              self.on_grab_broken_event)

        self.set_timeout_active(None, False)

        self.destroy_children()

        self.fader = None

        self.gdk_filter.stop()
        self.gdk_filter = None

        trackers.con_tracker_get().disconnect(status.screen, "size-changed",
                                              self.on_screen_size_changed)

        trackers.con_tracker_get().disconnect(status.screen,
                                              "monitors-changed",
                                              self.on_monitors_changed)

        status.screen = None

        self.destroy()
Ejemplo n.º 3
0
    def try_logind(self):
        print("Trying to connect to logind...")

        login_client = LogindClient()
        trackers.con_tracker_get().connect(login_client,
                                           "startup-status",
                                           self.on_logind_startup_result)
Ejemplo n.º 4
0
    def try_console_kit(self):
        print("Trying to connect to ConsoleKit...")

        login_client = ConsoleKitClient()
        trackers.con_tracker_get().connect(login_client,
                                           "startup-status",
                                           self.on_consolekit_startup_result)
    def on_realized(self, widget, data=None):
        if self.blinking and self.tick_id == 0:
            GObject.idle_add(self._blink_idle)

        trackers.con_tracker_get().disconnect(self,
                                              "realize",
                                              self.on_realized)
Ejemplo n.º 6
0
 def show_plugin(self):
     name = settings.get_screensaver_name()
     path = utils.lookup_plugin_path(name)
     if path is not None:
         self.spawn_plugin(path)
         trackers.con_tracker_get().connect(self.socket, "plug-added",
                                            self.on_plug_added)
Ejemplo n.º 7
0
    def try_logind(self):
        print("Trying to connect to logind...")

        login_client = LogindClient()
        trackers.con_tracker_get().connect(login_client,
                                           "startup-status",
                                           self.on_logind_startup_result)
Ejemplo n.º 8
0
    def try_console_kit(self):
        print("Trying to connect to ConsoleKit...")

        login_client = ConsoleKitClient()
        trackers.con_tracker_get().connect(login_client,
                                           "startup-status",
                                           self.on_consolekit_startup_result)
Ejemplo n.º 9
0
    def __init__(self, index):
        super(MonitorView, self).__init__()

        self.monitor_index = index

        self.proc = None

        self.update_geometry()

        self.stack = Gtk.Stack()
        self.stack.set_transition_type(Gtk.StackTransitionType.CROSSFADE)
        self.stack.set_transition_duration(250)
        self.add(self.stack)

        self.wallpaper_stack = WallpaperStack()
        self.wallpaper_stack.show()
        self.wallpaper_stack.set_halign(Gtk.Align.FILL)
        self.wallpaper_stack.set_valign(Gtk.Align.FILL)

        self.stack.add_named(self.wallpaper_stack, "wallpaper")

        self.socket = Gtk.Socket()
        self.socket.show()
        self.socket.set_halign(Gtk.Align.FILL)
        self.socket.set_valign(Gtk.Align.FILL)

        # This prevents the socket from self-destructing when the plug process is killed
        trackers.con_tracker_get().connect(self.socket,
                                           "plug-removed",
                                           lambda socket: True)

        self.stack.add_named(self.socket, "plugin")

        self.show_all()
Ejemplo n.º 10
0
    def destroy_stage(self):
        trackers.con_tracker_get().disconnect(singletons.Backgrounds,
                                              "changed",
                                              self.on_bg_changed)

        trackers.con_tracker_get().disconnect(self.power_client,
                                              "power-state-changed",
                                              self.on_power_state_changed)

        self.set_timeout_active(None, False)

        self.destroy_monitor_views()

        self.fader = None

        self.unlock_dialog.destroy()
        self.clock_widget.destroy()
        self.info_panel.destroy()
        self.audio_panel.destroy()

        self.unlock_dialog = None
        self.clock_widget = None
        self.info_panel = None
        self.audio_panel = None
        self.away_message = None
        self.monitors = []

        self.gdk_filter.stop()
        self.gdk_filter = None

        self.destroy()
Ejemplo n.º 11
0
    def spawn_plugin(self, path):
        """
        Spawns the plug-in script and watches its STDOUT for a window ID to use for
        our GtkSocket.  We hold a reference to it so that we can terminate it properly
        later.
        """
        if self.socket_is_anchored(self.socket):
            try:
                if status.Debug:
                    print("monitorView: spawning plugin process: %s" % path)

                trackers.con_tracker_get().connect(self.socket,
                                                   "plug-added",
                                                   self.on_plug_added)

                self.proc = Gio.Subprocess.new((path, None),
                                               Gio.SubprocessFlags.STDOUT_PIPE | Gio.SubprocessFlags.STDERR_SILENCE)

                pipe = self.proc.get_stdout_pipe()
                pipe.read_bytes_async(4096, GLib.PRIORITY_DEFAULT, None, self.on_bytes_read)

            except Exception as e:
                print(e)
                return
        else:
            if status.Debug:
                print("monitorView: socket not anchored, waiting on toplevel change")

            trackers.con_tracker_get().connect(self.socket,
                                               "hierarchy-changed",
                                               self.update_view)
    def __init__(self):
        """
        Connect to the bus and retrieve a list of interfaces.
        """
        super(MediaPlayerWatcher, self).__init__()

        self.player_clients = []

        try:
            self.dbus_proxy = Gio.DBusProxy.new_for_bus_sync(Gio.BusType.SESSION,
                                                             Gio.DBusProxyFlags.NONE,
                                                             None,
                                                             "org.freedesktop.DBus",
                                                             "/org/freedesktop/DBus",
                                                             "org.freedesktop.DBus",
                                                             None)

            trackers.con_tracker_get().connect(self.dbus_proxy,
                                               "g-signal",
                                               self.on_dbus_proxy_signal)

            self.find_initial_players()
        except GLib.Error:
            self.dbus_proxy = None
            print("Cannot acquire session org.freedesktop.DBus client to watch for media players")
Ejemplo n.º 13
0
    def set_lockscreen_keyboard_layout(self):
        if not self.keyboard_controller.get_enabled():
            return

        # If there are multiple keyboard layouts, we want to store
        # the one the user ends up using in the unlock widget, as they'll
        # want to use the same one each time, at least until they change
        # their password.

        saved_group = settings.get_kb_group()
        self.original_group = self.keyboard_controller.get_current_group()

        new_group = 0

        if saved_group == -1:
            new_group = self.original_group
        else:
            new_group = saved_group

        self.keyboard_controller.set_current_group(new_group)
        self.update_saved_group(new_group)
        self.update_layout_icon()

        trackers.con_tracker_get().connect(self,
                                           "icon-press",
                                           self.on_icon_pressed)

        trackers.con_tracker_get().connect(self,
                                           "draw",
                                           self.on_draw)
    def set_lockscreen_group(self):
        if not self.enabled:
            return

        # If there are multiple keyboard layouts, we want to store
        # the one the user ends up using in the unlock widget, as they'll
        # want to use the same one each time, at least until they change
        # their password.

        saved_group = settings.get_kb_group()
        self.original_group = self.config.get_current_group()

        new_group = 0

        if saved_group == -1:
            new_group = self.original_group
        else:
            new_group = saved_group

        self.config.lock_group(new_group)
        self.update_saved_group(new_group)

        trackers.con_tracker_get().connect(self.config,
                                           "group-changed",
                                           self.on_group_changed)

        self.config.start_listen()
Ejemplo n.º 15
0
    def after_unlock_unrevealed(self, obj, pspec):
        """
        Called after unlock unreveal is complete.  Tells the MonitorViews
        to update themselves.
        """
        self.unlock_dialog.hide()
        self.unlock_dialog.cancel()

        if self.audio_panel != None:
            self.audio_panel.hide()
        if self.clock_widget != None:
            self.clock_widget.hide()
        if self.albumart_widget != None:
            self.albumart_widget.hide()

        trackers.con_tracker_get().disconnect(self.unlock_dialog,
                                              "notify::child-revealed",
                                              self.after_unlock_unrevealed)

        status.Awake = False

        trackers.con_tracker_get().connect(
            self.monitors[0], "current-view-change-complete",
            self.after_transitioned_back_to_sleep)

        self.update_monitor_views()
Ejemplo n.º 16
0
    def cancel_unlock_widget(self):
        """
        Hide the unlock widget (and others) if the unlock has been canceled

        This process is in three steps for aesthetic reasons - 
            a) Unreveal all widgets (begin fading them out)
            b) Switch over MonitorViews from wallpaper to plug-ins if needed.
            c) Re-reveal the InfoPanel if applicable
        """
        if not status.Awake:
            return

        self.set_timeout_active(None, False)
        utils.clear_clipboards(self.unlock_dialog)

        trackers.con_tracker_get().connect(self.unlock_dialog,
                                           "notify::child-revealed",
                                           self.after_unlock_unrevealed)
        self.unlock_dialog.unreveal()

        if self.clock_widget != None:
            self.clock_widget.unreveal()
        if self.albumart_widget != None:
            self.albumart_widget.unreveal()
        if self.audio_panel != None:
            self.audio_panel.unreveal()
        if self.info_panel != None:
            self.info_panel.unreveal()
    def __init__(self):
        super(NotificationWidget, self).__init__()
        self.set_shadow_type(Gtk.ShadowType.NONE)
        self.get_style_context().add_class("notificationwidget")

        self.set_size_request(50, -1)

        self.notification_count = 0

        box = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)
        self.add(box)

        self.label = Gtk.Label.new("0")
        box.pack_start(self.label, False, False, 4)

        self.image = Gtk.Image.new_from_icon_name("screensaver-notification-symbolic", Gtk.IconSize.LARGE_TOOLBAR)
        box.pack_end(self.image, False, False, 4)

        box.show_all()

        self.notification_watcher = singletons.NotificationWatcher

        trackers.con_tracker_get().connect(self.notification_watcher,
                                           "notification-received",
                                           self.on_notification_received)
Ejemplo n.º 18
0
    def after_unlock_unrevealed(self, obj, pspec):
        """
        Called after unlock unreveal is complete.  Tells the MonitorViews
        to update themselves.
        """
        self.unlock_dialog.hide()
        self.unlock_dialog.cancel()

        if self.audio_panel != None:
            self.audio_panel.hide()
        if self.clock_widget != None:
            self.clock_widget.hide()
        if self.albumart_widget != None:
            self.albumart_widget.hide()

        trackers.con_tracker_get().disconnect(self.unlock_dialog,
                                              "notify::child-revealed",
                                              self.after_unlock_unrevealed)

        status.Awake = False

        trackers.con_tracker_get().connect(self.monitors[0],
                                           "current-view-change-complete",
                                           self.after_transitioned_back_to_sleep)

        self.update_monitor_views()
Ejemplo n.º 19
0
    def set_lockscreen_keyboard_layout(self):
        if not self.keyboard_controller.get_enabled():
            return

        # If there are multiple keyboard layouts, we want to store
        # the one the user ends up using in the unlock widget, as they'll
        # want to use the same one each time, at least until they change
        # their password.

        saved_group = settings.get_kb_group()
        self.original_group = self.keyboard_controller.get_current_group()

        new_group = 0

        if saved_group == -1:
            new_group = self.original_group
        else:
            new_group = saved_group

        self.keyboard_controller.set_current_group(new_group)
        self.update_saved_group(new_group)
        self.update_layout_icon()

        trackers.con_tracker_get().connect(self, "icon-press",
                                           self.on_icon_pressed)

        trackers.con_tracker_get().connect(self, "draw", self.on_draw)
    def __init__(self):
        super(NotificationWidget, self).__init__()
        self.set_shadow_type(Gtk.ShadowType.NONE)
        self.get_style_context().add_class("notificationwidget")

        self.set_size_request(50, -1)

        self.notification_count = 0

        box = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)
        self.add(box)

        self.label = Gtk.Label.new("0")
        box.pack_start(self.label, False, False, 4)

        self.image = Gtk.Image.new_from_icon_name(
            "screensaver-notification-symbolic", Gtk.IconSize.LARGE_TOOLBAR)
        box.pack_end(self.image, False, False, 4)

        box.show_all()

        self.notification_watcher = singletons.NotificationWatcher

        trackers.con_tracker_get().connect(self.notification_watcher,
                                           "notification-received",
                                           self.on_notification_received)
Ejemplo n.º 21
0
    def raise_unlock_widget(self):
        """
        Bring the unlock widget to the front and make sure it's visible.

        This is done in two steps - we don't want to show anything over a plugin
        (graphic glitches abound) - so we update the MonitorViews first, then do
        our other reveals after its transition is complete.
        """
        self.reset_timeout()

        if status.Awake:
            return

        utils.clear_clipboards(self.unlock_dialog)

        if self.clock_widget != None:
            self.clock_widget.stop_positioning()
        if self.albumart_widget != None:
            self.albumart_widget.stop_positioning()

        status.Awake = True

        # Connect to one of our monitorViews (we have at least one always), to wait for
        # its transition to finish before running after_wallpaper_shown_for_unlock()

        if len(self.monitors) > 0:
            trackers.con_tracker_get().connect(
                self.monitors[0], "current-view-change-complete",
                self.after_wallpaper_shown_for_unlock)

        self.update_monitor_views()
Ejemplo n.º 22
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)
    def on_realized(self, widget, data=None):
        if self.blinking and self.tick_id == 0:
            GObject.idle_add(self._blink_idle)

        trackers.con_tracker_get().disconnect(self,
                                              "realize",
                                              self.on_realized)
    def __init__(self, screen, away_message=None, initial_monitor=0):
        super(ClockWidget, self).__init__(initial_monitor)
        self.screen = screen
        self.get_style_context().add_class("clock")
        self.set_halign(Gtk.Align.START)

        if not settings.get_show_clock():
            return

        self.away_message = away_message

        self.label = Gtk.Label()
        self.label.show()
        self.add(self.label)

        self.clock_tracker = CinnamonDesktop.WallClock()

        trackers.con_tracker_get().connect(self.clock_tracker, "notify::clock",
                                           self.on_clock_changed)

        tz = Gio.File.new_for_path(path="/etc/localtime")
        self.tz_monitor = tz.monitor_file(0, None)

        trackers.con_tracker_get().connect(self.tz_monitor, "changed",
                                           self.on_tz_changed)

        self.update_clock()
Ejemplo n.º 25
0
    def update_revealed(self):
        do_reveal = False

        self.show_power = self.power_widget.should_show()
        self.show_notifications = self.notification_widget.should_show()
        show_separator = self.show_power and self.show_notifications

        # Determine if we want to show all the time or only when status.Awake

        if status.Awake:
            if self.show_power or self.show_notifications:
                do_reveal = True
        elif status.Active and not status.PluginRunning:
            if self.show_notifications:
                do_reveal = True

        if do_reveal:
            self.power_widget.set_visible(self.show_power)
            self.notification_widget.set_visible(self.show_notifications)
            self.separator.set_visible(show_separator)
            self.reveal()
        else:
            self.unreveal()
            trackers.con_tracker_get().connect(self, "notify::child-revealed",
                                               self.after_unreveal)
Ejemplo n.º 26
0
    def raise_unlock_widget(self):
        """
        Bring the unlock widget to the front and make sure it's visible.

        This is done in two steps - we don't want to show anything over a plugin
        (graphic glitches abound) - so we update the MonitorViews first, then do
        our other reveals after its transition is complete.
        """
        self.reset_timeout()

        if status.Awake:
            return

        self.clock_widget.stop_positioning()
        self.albumart_widget.stop_positioning()

        status.Awake = True

        # Connect to one of our monitorViews (we have at least one always), to wait for
        # its transition to finish before running after_wallpaper_shown_for_unlock()
        trackers.con_tracker_get().connect(self.monitors[0],
                                           "current-view-change-complete",
                                           self.after_wallpaper_shown_for_unlock)

        self.update_monitor_views()
Ejemplo n.º 27
0
    def __init__(self):
        super(PowerWidget, self).__init__()
        self.set_shadow_type(Gtk.ShadowType.NONE)
        self.get_style_context().add_class("powerwidget")

        self.path_widget_pairs = []

        self.box = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)
        self.add(self.box)

        self.box.show_all()

        self.power_client = singletons.UPowerClient

        self.battery_critical = False

        trackers.con_tracker_get().connect(self.power_client,
                                           "power-state-changed",
                                           self.on_power_state_changed)

        trackers.con_tracker_get().connect(self.power_client,
                                           "percentage-changed",
                                           self.on_percentage_changed)

        self.power_client.rescan_devices()

        self.on_power_state_changed(self.power_client)
Ejemplo n.º 28
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)
    def __init__(self):
        """
        Connect to the bus and retrieve a list of interfaces.
        """
        super(MediaPlayerWatcher, self).__init__()

        self.player_clients = []

        try:
            self.dbus_proxy = Gio.DBusProxy.new_for_bus_sync(Gio.BusType.SESSION,
                                                             Gio.DBusProxyFlags.NONE,
                                                             None,
                                                             "org.freedesktop.DBus",
                                                             "/org/freedesktop/DBus",
                                                             "org.freedesktop.DBus",
                                                             None)

            trackers.con_tracker_get().connect(self.dbus_proxy,
                                               "g-signal",
                                               self.on_dbus_proxy_signal)

            self.find_initial_players()
        except GLib.Error:
            self.dbus_proxy = None
            print("Cannot acquire session org.freedesktop.DBus client to watch for media players")
Ejemplo n.º 30
0
    def cancel_unlock_widget(self):
        """
        Hide the unlock widget (and others) if the unlock has been canceled

        This process is in three steps for aesthetic reasons -
            a) Unreveal all widgets (begin fading them out)
            b) Switch over MonitorViews from wallpaper to plug-ins if needed.
            c) Re-reveal the InfoPanel if applicable
        """
        if not status.Awake:
            return

        self.set_timeout_active(None, False)
        utils.clear_clipboards(self.unlock_dialog)

        trackers.con_tracker_get().connect(self.unlock_dialog,
                                           "notify::child-revealed",
                                           self.after_unlock_unrevealed)
        self.unlock_dialog.unreveal()

        if self.clock_widget != None:
            self.clock_widget.unreveal()
        if self.albumart_widget != None:
            self.albumart_widget.unreveal()
        if self.audio_panel != None:
            self.audio_panel.unreveal()
        if self.info_panel != None:
            self.info_panel.unreveal()
Ejemplo n.º 31
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)
Ejemplo n.º 32
0
    def __init__(self):
        super(ScreensaverManager, self).__init__()

        self.screen = Gdk.Screen.get_default()

        self.activated_timestamp = 0

        self.stage = None

        # Ensure our state
        status.Active = False
        status.Locked = False
        status.Awake = False

        self.grab_helper = GrabHelper(self)
        self.focus_nav = FocusNavigator()

        self.session_client = singletons.SessionClient
        trackers.con_tracker_get().connect(self.session_client,
                                           "idle-changed", 
                                           self.on_session_idle_changed)

        self.cinnamon_client = singletons.CinnamonClient

        singletons.LoginClientResolver(self)
Ejemplo n.º 33
0
    def __init__(self, screen, away_message=None, initial_monitor=0):
        super(ClockWidget, self).__init__()
        self.screen = screen
        # self.set_name("clock")
        self.get_style_context().add_class("clock")

        self.set_halign(Gtk.Align.CENTER)
        self.set_valign(Gtk.Align.CENTER)

        self.current_monitor = initial_monitor

        self.away_message = away_message

        self.label = Gtk.Label()
        self.label.show()
        self.add(self.label)

        self.clock_tracker = CinnamonDesktop.WallClock()

        trackers.con_tracker_get().connect(self.clock_tracker,
                                           "notify::clock",
                                           self.on_clock_changed)

        tz = Gio.File.new_for_path(path="/etc/localtime")
        self.tz_monitor = tz.monitor_file(0, None)

        trackers.con_tracker_get().connect(self.tz_monitor,
                                           "changed",
                                           self.on_tz_changed)

        self.update_clock()
Ejemplo n.º 34
0
    def __init__(self, index):
        super(MonitorView, self).__init__()

        self.monitor_index = index

        self.proc = None

        self.update_geometry()

        self.stack = Gtk.Stack()
        self.stack.set_transition_type(Gtk.StackTransitionType.CROSSFADE)
        self.stack.set_transition_duration(250)
        self.add(self.stack)

        self.wallpaper_stack = WallpaperStack()
        self.wallpaper_stack.show()
        self.wallpaper_stack.set_halign(Gtk.Align.FILL)
        self.wallpaper_stack.set_valign(Gtk.Align.FILL)

        self.stack.add_named(self.wallpaper_stack, "wallpaper")

        self.socket = Gtk.Socket()
        self.socket.show()
        self.socket.set_halign(Gtk.Align.FILL)
        self.socket.set_valign(Gtk.Align.FILL)

        # This prevents the socket from self-destructing when the plug process is killed
        trackers.con_tracker_get().connect(self.socket,
                                           "plug-removed",
                                           lambda socket: True)

        self.stack.add_named(self.socket, "plugin")

        self.show_all()
Ejemplo n.º 35
0
    def on_widget_destroy(self, widget, data=None):
        trackers.con_tracker_get().disconnect(self.player,
                                              "status-changed",
                                              self.on_playback_status_changed)

        trackers.con_tracker_get().disconnect(self,
                                              "destroy",
                                              self.on_widget_destroy)
Ejemplo n.º 36
0
 def show_plugin(self):
     name = settings.get_screensaver_name()
     path = utils.lookup_plugin_path(name)
     if path is not None:
         self.spawn_plugin(path)
         trackers.con_tracker_get().connect(self.socket,
                                            "plug-added",
                                            self.on_plug_added)
Ejemplo n.º 37
0
    def after_power_state_changed(self, monitor):
        """
        Update the visibility of the InfoPanel after updating the MonitorViews
        """
        trackers.con_tracker_get().disconnect(monitor,
                                              "current-view-change-complete",
                                              self.after_power_state_changed)

        self.info_panel.update_revealed()
Ejemplo n.º 38
0
    def after_power_state_changed(self, monitor):
        """
        Update the visibility of the InfoPanel after updating the MonitorViews
        """
        trackers.con_tracker_get().disconnect(monitor,
                                              "current-view-change-complete",
                                              self.after_power_state_changed)

        self.info_panel.update_revealed()
    def __init__(self):
        super(AccountsServiceClient, self).__init__()

        self.is_loaded = False

        self.service = AccountsService.UserManager.get_default().get_user(utils.get_user_name())
        trackers.con_tracker_get().connect(self.service,
                                           "notify::is-loaded",
                                           self.on_accounts_service_loaded)
    def __init__(self):
        super(AccountsServiceClient, self).__init__()

        self.is_loaded = False

        self.service = AccountsService.UserManager.get_default().get_user(
            utils.get_user_name())
        trackers.con_tracker_get().connect(self.service, "notify::is-loaded",
                                           self.on_accounts_service_loaded)
    def on_client_setup_complete(self):
        trackers.con_tracker_get().connect(self.proxy,
                                           "notify::playback-status",
                                           self.on_playback_status_changed)

        trackers.con_tracker_get().connect(self.proxy, "notify::metadata",
                                           self.on_metadata_changed)

        self.ensure_metadata()
Ejemplo n.º 42
0
    def on_destroy(self, widget, data=None):
        trackers.con_tracker_get().disconnect(self.keyboard_controller,
                                              "config-changed",
                                              self.on_config_changed)

        trackers.con_tracker_get().disconnect(self.keyboard_controller,
                                              "layout-changed",
                                              self.on_layout_changed)

        self.restore_original_layout()
Ejemplo n.º 43
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()
Ejemplo n.º 44
0
    def __init__(self):
        super(FramedImage, self).__init__()
        self.get_style_context().add_class("framedimage")

        self.cancellable = None

        self.file = None
        self.path = None

        trackers.con_tracker_get().connect(self, "realize", self.on_realized)
Ejemplo n.º 45
0
    def after_transitioned_back_to_sleep(self, monitor, data=None):
        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 and settings.get_show_clock():
            self.put_on_top(self.clock_widget)
            self.clock_widget.start_positioning()
    def on_client_setup_complete(self):
        trackers.con_tracker_get().connect(self.proxy,
                                           "notify::playback-status",
                                           self.on_playback_status_changed)

        trackers.con_tracker_get().connect(self.proxy,
                                           "notify::metadata",
                                           self.on_metadata_changed)

        self.ensure_metadata()
Ejemplo n.º 47
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()
Ejemplo n.º 48
0
    def show_wallpaper(self):
        status.PluginRunning = False

        if self.stack.get_visible_child_name() == "wallpaper":
            self.emit("current-view-change-complete")
            return

        self.stack.set_visible_child_name("wallpaper")
        trackers.con_tracker_get().connect(self.stack,
                                           "notify::transition-running",
                                           self.notify_transition_callback)
Ejemplo n.º 49
0
    def restore_original_layout(self):
        """
        Called when the unlock dialog is destroyed, restores
        the group that was active before the screensaver was activated.
        """
        if not self.keyboard_controller.get_enabled():
            return

        trackers.con_tracker_get().disconnect(self.keyboard_controller, "layout-changed", self.on_layout_changed)

        self.keyboard_controller.set_current_group(self.original_group)
Ejemplo n.º 50
0
    def on_logind_startup_result(self, client, success):
        trackers.con_tracker_get().disconnect(client, "startup-status",
                                              self.on_logind_startup_result)

        if success:
            print("Successfully using logind")
            self.login_client = client
            self.setup_manager_connections()
        else:
            print("Failed to connect to logind, or it doesn't exist.")
            self.try_console_kit()
Ejemplo n.º 51
0
 def show_plugin(self):
     """
     Attempt to retreive the current plug-in info and spawn
     a script to instantiate it.
     """
     name = settings.get_screensaver_name()
     path = utils.lookup_plugin_path(name)
     if path is not None:
         self.spawn_plugin(path)
         trackers.con_tracker_get().connect(self.socket, "plug-added",
                                            self.on_plug_added)
Ejemplo n.º 52
0
    def update_slider(self, volume, muted):

        trackers.con_tracker_get().handler_block(self.volume_slider,
                                                 "value-changed",
                                                 self.on_volume_slider_changed)

        self.volume_slider.set_muted(muted)
        self.volume_slider.set_value(volume)

        trackers.con_tracker_get().handler_unblock(
            self.volume_slider, "value-changed", self.on_volume_slider_changed)
Ejemplo n.º 53
0
    def initialize_sound_controller(self):
        self.controller = Cvc.MixerControl(name="cinnamon-screensaver")
        trackers.con_tracker_get().connect(self.controller, "state-changed",
                                           self.on_state_changed)

        trackers.con_tracker_get().connect(self.controller,
                                           "default-sink-changed",
                                           self.on_state_changed)

        self.controller.open()
        self.on_state_changed()
Ejemplo n.º 54
0
    def update_slider(self, volume, muted):

        trackers.con_tracker_get().handler_block(self.volume_slider,
                                                 "value-changed",
                                                 self.on_volume_slider_changed)

        self.volume_slider.set_muted(muted)
        self.volume_slider.set_value(volume)

        trackers.con_tracker_get().handler_unblock(self.volume_slider,
                                                   "value-changed",
                                                   self.on_volume_slider_changed)
Ejemplo n.º 55
0
    def initialize_sound_controller(self):
        self.controller = Cvc.MixerControl(name="cinnamon-screensaver")
        trackers.con_tracker_get().connect(self.controller,
                                           "state-changed",
                                           self.on_state_changed)

        trackers.con_tracker_get().connect(self.controller,
                                           "default-sink-changed",
                                           self.on_state_changed)

        self.controller.open()
        self.on_state_changed()
Ejemplo n.º 56
0
    def on_destroy(self, widget, data=None):
        self.stop_progress()

        trackers.con_tracker_get().disconnect(self.keyboard_controller,
                                              "config-changed",
                                              self.on_config_changed)

        trackers.con_tracker_get().disconnect(self.keyboard_controller,
                                              "layout-changed",
                                              self.on_layout_changed)

        self.restore_original_layout()
Ejemplo n.º 57
0
    def __init__(self):
        super(PositionBar, self).__init__(orientation=Gtk.Orientation.HORIZONTAL)
        self.get_style_context().add_class("positionbar")

        self.set_can_focus(False)

        self.set_halign(Gtk.Align.CENTER)
        self.set_valign(Gtk.Align.CENTER)

        trackers.con_tracker_get().connect(self,
                                           "draw",
                                           self.on_draw)
Ejemplo n.º 58
0
 def show_plugin(self):
     """
     Attempt to retreive the current plug-in info and spawn
     a script to instantiate it.
     """
     name = settings.get_screensaver_name()
     path = utils.lookup_plugin_path(name)
     if path is not None:
         self.spawn_plugin(path)
         trackers.con_tracker_get().connect(self.socket,
                                            "plug-added",
                                            self.on_plug_added)