예제 #1
0
 def start_positioning(self):
     self.show()
     if settings.get_allow_floating():
         trackers.timer_tracker_get().cancel(str(self) + "positioning")
         trackers.timer_tracker_get().start_seconds(str(self) + "positioning",
                                                    POSITIONING_TIMEOUT,
                                                    self.positioning_callback)
예제 #2
0
    def simulate_user_activity(self):
        """
        Called upon any key, motion or button event, does different things
        depending on our current state.

        If we're idle:
            - do nothing

        If we're locked:
            - show the unlock widget (if it's already visible, this also has
              the effect of resetting the unlock timeout - see Stage.py)
            - show the mouse pointer, so the user can navigate the unlock screen.

        If we're Active but not Locked, simply deactivate (destroying the Stage
        and returning the screensaver back to idle mode.)
        """
        if not status.Active:
            return

        if status.Debug and not status.Awake:
            print("manager: user activity, waking")

        if status.Locked and self.stage.initialize_pam():
            if status.Debug and not status.Awake:
                print("manager: locked, raising unlock widget")

            self.stage.raise_unlock_widget()
            self.grab_helper.release_mouse()
            self.stage.maybe_update_layout()
        else:
            if status.Debug:
                print("manager: not locked, queueing idle deactivation")

            trackers.timer_tracker_get().add_idle("idle-deactivate",
                                                  self.idle_deactivate)
예제 #3
0
    def align_clock(self):
        current_halign = int(self.get_halign())
        horizontal = current_halign

        current_valign = int(self.get_valign())
        vertical = current_valign

        while horizontal == current_halign:
            horizontal = ALIGNMENTS[random.randint(0, 2)]
        while vertical == current_valign:
            vertical = ALIGNMENTS[random.randint(0, 2)]

        self.set_halign(Gtk.Align(horizontal))
        self.set_valign(Gtk.Align(vertical))

        if self.screen.get_n_monitors() > 1:
            new_monitor = self.current_monitor
            n = self.screen.get_n_monitors()

            while new_monitor == self.current_monitor:
                new_monitor = random.randint(0, n - 1)

            self.current_monitor = new_monitor

        self.queue_resize()

        self.reveal()

        trackers.timer_tracker_get().cancel("align-clock-timeout")

        return False
예제 #4
0
    def positioning_callback(self):
        self.unreveal()
        self.queue_resize()

        trackers.timer_tracker_get().start(str(self) + "align-timeout", self.REVEALER_DURATION + 10, self.align_clock)

        return True
예제 #5
0
 def set_timeout_active(self, dialog, active):
     if active:
         trackers.timer_tracker_get().start("wake-timeout",
                                            c.UNLOCK_TIMEOUT * 1000,
                                            self.on_wake_timeout)
     else:
         trackers.timer_tracker_get().cancel("wake-timeout")
예제 #6
0
 def update_position_timer(self, status):
     """
     Starts or stops the position update timer - this is based upon the provided rate
     property of the player, which is defined as the recommended update frequency for position
     data.
     """
     if status == PlaybackStatus.Playing:
         trackers.timer_tracker_get().start("position-timer", self.player.get_rate() * 1000, self.update_position_display)
     else:
         trackers.timer_tracker_get().cancel("position-timer")
예제 #7
0
 def set_timeout_active(self, dialog, active):
     """
     Start or stop the dialog timer
     """
     if active and not status.InteractiveDebug:
         trackers.timer_tracker_get().start("wake-timeout",
                                            c.UNLOCK_TIMEOUT * 1000,
                                            self.on_wake_timeout)
     else:
         trackers.timer_tracker_get().cancel("wake-timeout")
예제 #8
0
    def on_session_idle_changed(self, proxy, idle):
        if idle and not status.Active:
            if self.grab_helper.grab_offscreen(False):
                self.spawn_stage("", c.STAGE_IDLE_SPAWN_TRANSITION, self.on_spawn_stage_complete)
            else:
                print("Can't fade in screensaver, unable to grab the keyboard")
        else:
            if not status.Active:
                if self.stage:
                    self.despawn_stage(c.STAGE_IDLE_CANCEL_SPAWN_TRANSITION, self.on_despawn_stage_complete)

                trackers.timer_tracker_get().start("release-grab-timeout",
                                                   c.GRAB_RELEASE_TIMEOUT,
                                                   self.on_release_grab_timeout)
    def on_widget_destroy(self, widget, data=None):
        trackers.con_tracker_get().disconnect(self.player,
                                              "position-changed",
                                              self.on_position_changed)

        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)

        trackers.timer_tracker_get().cancel("position-timer")
예제 #10
0
    def start_lock_delay(self):
        if not settings.get_idle_lock_enabled():
            return

        if not utils.user_can_lock():
            return

        lock_delay = settings.get_idle_lock_delay()

        if lock_delay == 0:
            self.on_lock_delay_timeout()
        else:
            trackers.timer_tracker_get().start_seconds("idle-lock-delay",
                                                       lock_delay,
                                                       self.on_lock_delay_timeout)
예제 #11
0
    def on_session_idle_changed(self, proxy, idle):
        """
        Call back for the session client - initiates a slow fade-in
        for the stage when the session goes idle.  Cancels the stage fade-in
        if idle becomes False before it has completed its animation.
        """
        if idle and not status.Active:
            if self.grab_helper.grab_offscreen(False):
                self.spawn_stage("", c.STAGE_IDLE_SPAWN_TRANSITION, self.on_spawn_stage_complete)
            else:
                print("Can't fade in screensaver, unable to grab the keyboard")
        else:
            if not status.Active:
                if self.stage:
                    self.despawn_stage(c.STAGE_IDLE_CANCEL_SPAWN_TRANSITION, self.on_despawn_stage_complete)

                trackers.timer_tracker_get().start("release-grab-timeout",
                                                   c.GRAB_RELEASE_TIMEOUT,
                                                   self.on_release_grab_timeout)
예제 #12
0
    def start_lock_delay(self):
        """
        Setup the lock delay timer based on user prefs - if there is
        no delay, or if idle locking isn't enabled, we run the callback
        immediately, or simply return, respectively.
        """
        if not settings.get_idle_lock_enabled():
            return

        if not utils.user_can_lock():
            return

        lock_delay = settings.get_idle_lock_delay()

        if lock_delay == 0:
            self.on_lock_delay_timeout()
        else:
            trackers.timer_tracker_get().start_seconds("idle-lock-delay",
                                                       lock_delay,
                                                       self.on_lock_delay_timeout)
예제 #13
0
    def on_despawn_stage_complete(self):
        """
        Called after the stage has faded out - the stage is destroyed, our status
        is updated, timer is canceled and active-changed is fired.
        """
        was_active = status.Active == True
        status.Active = False

        if was_active:
            self.emit("active-changed", False)

        self.cancel_timers()

        self.stage.destroy_stage()
        self.stage = None

        # Ideal time to check for leaking connections that might prevent GC by python and gobject
        if trackers.DEBUG_SIGNALS:
            trackers.con_tracker_get().dump_connections_list()

        if trackers.DEBUG_TIMERS:
            trackers.timer_tracker_get().dump_timer_list()
예제 #14
0
    def on_despawn_stage_complete(self):
        """
        Called after the stage has faded out - the stage is destroyed, our status
        is updated, timer is canceled and active-changed is fired.
        """
        was_active = status.Active == True
        status.Active = False

        if was_active:
            self.emit("active-changed", False)

        self.cancel_timers()

        self.stage.destroy_stage()
        self.stage = None

        # Ideal time to check for leaking connections that might prevent GC by python and gobject
        if trackers.DEBUG_SIGNALS:
            trackers.con_tracker_get().dump_connections_list()

        if trackers.DEBUG_TIMERS:
            trackers.timer_tracker_get().dump_timer_list()
예제 #15
0
 def stop_positioning(self):
     trackers.timer_tracker_get().cancel(str(self) + "positioning")
 def update_position_timer(self, status):
     if status == PlaybackStatus.Playing:
         trackers.timer_tracker_get().start("position-timer", self.player.get_rate() * 1000, self.update_position_display)
     else:
         trackers.timer_tracker_get().cancel("position-timer")
예제 #17
0
 def stop_positioning(self):
     if settings.get_allow_floating():
         trackers.timer_tracker_get().cancel(str(self) + "positioning")
예제 #18
0
    def idle_deactivate(self):
        self.set_active(False)

        trackers.timer_tracker_get().cancel("idle-deactivate")

        return False
예제 #19
0
 def start_positioning(self):
     trackers.timer_tracker_get().cancel(str(self) + "positioning")
     trackers.timer_tracker_get().start_seconds(
         str(self) + "positioning", POSITIONING_TIMEOUT,
         self.positioning_callback)
예제 #20
0
    def idle_deactivate(self):
        self.set_active(False)

        trackers.timer_tracker_get().cancel("idle-deactivate")

        return False
예제 #21
0
 def stop_positioning(self):
     trackers.timer_tracker_get().cancel("clock-positioning")
예제 #22
0
 def stop_progress(self):
     trackers.timer_tracker_get().cancel("auth-progress")
     self.set_progress_fraction(0.0)
예제 #23
0
 def start_positioning(self):
     trackers.timer_tracker_get().cancel("clock-positioning")
     trackers.timer_tracker_get().start_seconds("clock-positioning",
                                                CLOCK_POSITIONING_TIMEOUT,
                                                self.positioning_callback)
예제 #24
0
 def stop_lock_delay(self):
     trackers.timer_tracker_get().cancel("idle-lock-delay")
예제 #25
0
 def stop_positioning(self):
     trackers.timer_tracker_get().cancel(str(self) + "positioning")
예제 #26
0
 def stop_positioning(self):
     trackers.timer_tracker_get().cancel("clock-positioning")
예제 #27
0
 def stop_progress(self):
     trackers.timer_tracker_get().cancel("auth-progress")
     self.set_progress_fraction(0.0)
예제 #28
0
 def start_positioning(self):
     trackers.timer_tracker_get().cancel("clock-positioning")
     trackers.timer_tracker_get().start_seconds("clock-positioning",
                                                CLOCK_POSITIONING_TIMEOUT,
                                                self.positioning_callback)
예제 #29
0
 def start_positioning(self):
     trackers.timer_tracker_get().cancel(str(self) + "positioning")
     trackers.timer_tracker_get().start_seconds(
         str(self) + "positioning", POSITIONING_TIMEOUT, self.positioning_callback
     )
예제 #30
0
 def start_progress(self):
     self.set_progress_pulse_step(0.2)
     trackers.timer_tracker_get().start("auth-progress",
                                        100,
                                        self.pulse)
예제 #31
0
 def stop_positioning(self):
     if settings.get_allow_floating():
         trackers.timer_tracker_get().cancel(str(self) + "positioning")
예제 #32
0
 def start_progress(self):
     self.set_progress_pulse_step(0.2)
     trackers.timer_tracker_get().start("auth-progress", 100, self.pulse)
예제 #33
0
 def stop_lock_delay(self):
     """
     Cancels the lock delay timer.
     """
     trackers.timer_tracker_get().cancel("idle-lock-delay")
예제 #34
0
 def stop_lock_delay(self):
     """
     Cancels the lock delay timer.
     """
     trackers.timer_tracker_get().cancel("idle-lock-delay")
예제 #35
0
 def stop_lock_delay(self):
     trackers.timer_tracker_get().cancel("idle-lock-delay")