How to use the safeeyes.Utility.execute_main_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 / plugins / trayicon / plugin.py View on Github external
def __schedule_resume(self, time_minutes):
        """
        Schedule a local timer to enable Safe Eyes after the given timeout.
        """
        self.idle_condition.acquire()
        self.idle_condition.wait(time_minutes * 60)    # Convert to seconds
        self.idle_condition.release()

        with self.lock:
            if not self.active:
                Utility.execute_main_thread(self.item_enable.activate)
github slgobinath / SafeEyes / safeeyes / plugins / trayicon / plugin.py View on Github external
def __unlock_menu():
    """
    Unlock the menu
    """
    Utility.execute_main_thread(tray_icon.unlock_menu)
github slgobinath / SafeEyes / safeeyes / SafeEyesCore.py View on Github external
with self.lock:
            if not self.running:
                return

            logging.info("Stop the scheduler")

            # Stop the break thread
            self.waiting_condition.acquire()
            self.running = False
            self.waiting_condition.notify_all()
            self.waiting_condition.release()
            time.sleep(1)  # Wait for 1 sec to ensure the sceduler is dead
            self.running = True

        Utility.execute_main_thread(self.__fire_start_break)
github slgobinath / SafeEyes / safeeyes / __main__.py View on Github external
def __evaluate_arguments(args, safe_eyes):
    """
    Evaluate the arguments and execute the operations.
    """
    if args.about:
        Utility.execute_main_thread(safe_eyes.show_about)
    elif args.disable:
        Utility.execute_main_thread(safe_eyes.disable_safeeyes)
    elif args.enable:
        Utility.execute_main_thread(safe_eyes.enable_safeeyes)
    elif args.settings:
        Utility.execute_main_thread(safe_eyes.show_settings)
    elif args.take_break:
        Utility.execute_main_thread(safe_eyes.take_break)
github slgobinath / SafeEyes / safeeyes / plugins / trayicon / plugin.py View on Github external
def __set_next_break_info(self):
        """
        A private method to be called within this class to update the next break information using self.dateTime.
        """
        formatted_time = Utility.format_time(self.date_time)
        message = _('Next break at %s') % (formatted_time)
        # Update the menu item label
        Utility.execute_main_thread(self.item_info.set_label, message)
        # Update the tray icon label
        if self.plugin_config.get('show_time_in_tray', False):
            self.indicator.set_label(formatted_time, '')
        else:
            self.indicator.set_label('', '')
github slgobinath / SafeEyes / safeeyes / __main__.py View on Github external
def __evaluate_arguments(args, safe_eyes):
    """
    Evaluate the arguments and execute the operations.
    """
    if args.about:
        Utility.execute_main_thread(safe_eyes.show_about)
    elif args.disable:
        Utility.execute_main_thread(safe_eyes.disable_safeeyes)
    elif args.enable:
        Utility.execute_main_thread(safe_eyes.enable_safeeyes)
    elif args.settings:
        Utility.execute_main_thread(safe_eyes.show_settings)
    elif args.take_break:
        Utility.execute_main_thread(safe_eyes.take_break)
github slgobinath / SafeEyes / safeeyes / SafeEyes.py View on Github external
        self.context['api']['show_settings'] = lambda: Utility.execute_main_thread(
            self.show_settings)
        self.context['api']['show_about'] = lambda: Utility.execute_main_thread(
github slgobinath / SafeEyes / safeeyes / __main__.py View on Github external
def __evaluate_arguments(args, safe_eyes):
    """
    Evaluate the arguments and execute the operations.
    """
    if args.about:
        Utility.execute_main_thread(safe_eyes.show_about)
    elif args.disable:
        Utility.execute_main_thread(safe_eyes.disable_safeeyes)
    elif args.enable:
        Utility.execute_main_thread(safe_eyes.enable_safeeyes)
    elif args.settings:
        Utility.execute_main_thread(safe_eyes.show_settings)
    elif args.take_break:
        Utility.execute_main_thread(safe_eyes.take_break)