Ejemplo n.º 1
0
Archivo: ui.py Proyecto: oleg-krv/cozy
 def __start_sleep_timer(self):
     """
     Start the sleep timer but only when it is enabled by the user.
     """
     if self.timer_switch.get_active():
         # Enable Timer
         adjustment = self.timer_spinner.get_adjustment()
         countdown = int(adjustment.get_value())
         self.sleep_timer = RepeatedTimer(1, self.__sleep_timer_fired)
         self.sleep_timer.start()
         self.current_timer_time = countdown * 60
Ejemplo n.º 2
0
    def __set_play_status_updater(self, enable):
        """
        Starts/stops the play status ui update timer.
        Restarts if enable is True and the timer is already running.
        :params enable: Boolean
        """
        if self.play_status_updater is not None:
            self.play_status_updater.stop()
            self.play_status_updater = None

        if enable and self.ui.is_playing:
            self.play_status_updater = RepeatedTimer(1.0, self.__update_time)
            self.play_status_updater.start()