How to use the safeeyes.Utility.start_thread function in safeeyes

To help you get started, we’ve selected a few safeeyes examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github slgobinath / SafeEyes / safeeyes / SafeEyesCore.py View on Github external
def __start_next_break(self):
        if not self.context['postponed']:
            self.break_queue.next()

        if self.running:
            # Schedule the break again
            Utility.start_thread(self.__scheduler_job)
github slgobinath / SafeEyes / safeeyes / plugins / smartpause / plugin.py View on Github external
def on_start():
    """
    Start a thread to continuously call xprintidle.
    """
    global active
    if not __is_active():
        # If SmartPause is already started, do not start it again
        logging.debug('Start Smart Pause plugin')
        __set_active(True)
        Utility.start_thread(__start_idle_monitor)
github slgobinath / SafeEyes / safeeyes / SafeEyesCore.py View on Github external
def __fire_start_break(self):
        # Show the break screen
        if not self.on_start_break.fire(self.break_queue.get_break()):
            # Plugins want to ignore this break
            self.__start_next_break()
            return
        if self.context['postponed']:
            # Plugins want to postpone this break
            self.context['postponed'] = False
            # Update the next break time
            self.scheduled_next_break_time = self.scheduled_next_break_time + datetime.timedelta(seconds=self.postpone_duration)
            self.__fire_on_update_next_break(self.scheduled_next_break_time)
            # Wait in user thread
            Utility.start_thread(self.__postpone_break)
        else:
            self.start_break.fire(self.break_queue.get_break())
            Utility.start_thread(self.__start_break)
github slgobinath / SafeEyes / safeeyes / plugins / trayicon / plugin.py View on Github external
def start_animation(self):
        if not self.active or not self.animate:
            return
        Utility.execute_main_thread(lambda: self.indicator.set_icon("safeeyes_disabled"))
        time.sleep(0.5)
        Utility.execute_main_thread(lambda: self.indicator.set_icon("safeeyes_enabled"))
        if self.animate and self.active:
            time.sleep(0.5)
            if self.animate and self.active:
                Utility.start_thread(self.start_animation)
github slgobinath / SafeEyes / safeeyes / plugins / trayicon / plugin.py View on Github external
# active = self.item_enable.get_active()
        if self.active and len(args) > 1:
            self.disable_ui()

            time_to_wait = args[1]
            if time_to_wait <= 0:
                info = _('Disabled until restart')
                self.on_disable(info)
                self.wakeup_time = None
                self.item_info.set_label(info)
            else:
                self.wakeup_time = datetime.datetime.now() + datetime.timedelta(minutes=time_to_wait)
                info = _('Disabled until %s') % Utility.format_time(self.wakeup_time)
                self.on_disable(info)
                self.item_info.set_label(info)
                Utility.start_thread(self.__schedule_resume, time_minutes=time_to_wait)
github slgobinath / SafeEyes / safeeyes / SafeEyesCore.py View on Github external
def __fire_pre_break(self):
        """
        Show the notification and start the break after the notification.
        """
        self.context['state'] = State.PRE_BREAK
        if not self.on_pre_break.fire(self.break_queue.get_break()):
            # Plugins wanted to ignore this break
            self.__start_next_break()
            return
        Utility.start_thread(self.__wait_until_prepare)