Add option to interpret system idle as break

This commit is contained in:
Gobinath 2017-10-17 14:50:57 -04:00
parent 36b7006958
commit 70759a2115
32 changed files with 576 additions and 72 deletions

2
.gitignore vendored
View File

@ -51,7 +51,7 @@ coverage.xml
# Translations
*.mo
*.pot
# *.pot
# Django stuff:
*.log

View File

@ -143,7 +143,7 @@ def disable():
"""
pass
def update_next_break(date_time):
def update_next_break(break_obj, next_break_time):
"""
Update the next break time.
"""

View File

@ -154,12 +154,12 @@ class PluginManager(object):
if self.last_break.plugin_enabled(plugin['id'], plugin['enabled']):
plugin['module'].on_countdown(countdown, seconds)
def update_next_break(self, break_time):
def update_next_break(self, break_obj, break_time):
"""
Execute the update_next_break(break_time) function of plugins.
"""
for plugin in self.__plugins_update_next_break:
plugin['module'].update_next_break(break_time)
plugin['module'].update_next_break(break_obj, break_time)
return True
def get_break_screen_widgets(self, break_obj):
@ -266,7 +266,7 @@ class PluginManager(object):
self.__plugins_on_stop.append(plugin_obj)
if self.__has_method(module, 'on_exit'):
self.__plugins_on_exit.append(plugin_obj)
if self.__has_method(module, 'update_next_break', 1):
if self.__has_method(module, 'update_next_break', 2):
self.__plugins_update_next_break.append(plugin_obj)
else:
# This is the first time to load the plugin
@ -288,7 +288,7 @@ class PluginManager(object):
self.__plugins_on_stop.append(plugin_obj)
if self.__has_method(module, 'on_exit'):
self.__plugins_on_exit.append(plugin_obj)
if self.__has_method(module, 'update_next_break', 1):
if self.__has_method(module, 'update_next_break', 2):
self.__plugins_update_next_break.append(plugin_obj)
if self.__has_method(module, 'init', 3):
self.__plugins_on_init.append(plugin_obj)

View File

@ -237,11 +237,11 @@ class SafeEyes(object):
self.plugins_manager.countdown(countdown, seconds)
return True
def update_next_break(self, break_time):
def update_next_break(self, break_obj, break_time):
"""
Update the next break to plugins and save the session.
"""
self.plugins_manager.update_next_break(break_time)
self.plugins_manager.update_next_break(break_obj, break_time)
if self.config.get('persist_state'):
Utility.write_json(Utility.SESSION_FILE_PATH, self.context['session'])

View File

@ -199,7 +199,7 @@ class SafeEyesCore(object):
self.scheduled_next_break_time = -1
next_break_time = current_time + datetime.timedelta(seconds=time_to_wait)
self.on_update_next_break.fire(next_break_time)
Utility.execute_main_thread(self.__fire_on_update_next_break, next_break_time)
if self.__is_long_break():
self.context['break_type'] = 'long'
@ -218,6 +218,12 @@ class SafeEyesCore(object):
self.context['new_cycle'] = self.next_break_index == 0
Utility.execute_main_thread(self.__fire_pre_break)
def __fire_on_update_next_break(self, next_break_time):
"""
Pass the next break information to the registered listeners.
"""
self.on_update_next_break.fire(self.breaks[self.next_break_index], next_break_time)
def __fire_pre_break(self):
"""
Show the notification and start the break after the notification.

View File

@ -8,8 +8,8 @@ msgstr ""
"POT-Creation-Date: \n"
"PO-Revision-Date: 2017-10-08 12:42+0000\n"
"Last-Translator: Gobinath L <lgobi20@gmail.com>\n"
"Language-Team: Catalan <https://hosted.weblate.org/projects/safe-"
"eyes/translations/ca/>\n"
"Language-Team: Catalan <https://hosted.weblate.org/projects/safe-eyes/"
"translations/ca/>\n"
"Language: ca\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
@ -317,6 +317,10 @@ msgstr ""
msgid "Minimum idle time to pause Safe Eyes (in seconds)"
msgstr ""
# plugin/smartpause
msgid "Interpret idle time equivalent to upcoming break duration as a break"
msgstr ""
#: plugins/trayicon
msgid "Tray Icon"
msgstr ""

View File

@ -8,8 +8,8 @@ msgstr ""
"POT-Creation-Date: \n"
"PO-Revision-Date: 2017-10-08 12:42+0000\n"
"Last-Translator: Gobinath L <lgobi20@gmail.com>\n"
"Language-Team: Czech <https://hosted.weblate.org/projects/safe-"
"eyes/translations/cs/>\n"
"Language-Team: Czech <https://hosted.weblate.org/projects/safe-eyes/"
"translations/cs/>\n"
"Language: cs\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
@ -218,7 +218,8 @@ msgstr "Prosím nainstalujte si nástroj pro příkazový řádek'%s'"
# Settings dialog
msgid "Please add the resource %(resource)s to %(config_resource)s directory"
msgstr "Prosím přidejte prostředek %(resource)s do adresáře %(config_resource)s"
msgstr ""
"Prosím přidejte prostředek %(resource)s do adresáře %(config_resource)s"
# Settings dialog
msgid "New Break"
@ -316,6 +317,10 @@ msgstr "Pozastavit Safe Eyes když je systém v klidu"
msgid "Minimum idle time to pause Safe Eyes (in seconds)"
msgstr "Minimální čas v klidu na pozastavení Safe Eyes (v sekundách)"
# plugin/smartpause
msgid "Interpret idle time equivalent to upcoming break duration as a break"
msgstr ""
#: plugins/trayicon
msgid "Tray Icon"
msgstr "Systémová oblast"

View File

@ -8,8 +8,8 @@ msgstr ""
"POT-Creation-Date: \n"
"PO-Revision-Date: 2017-10-13 17:55+0000\n"
"Last-Translator: Gobinath L <lgobi20@gmail.com>\n"
"Language-Team: German <https://hosted.weblate.org/projects/safe-"
"eyes/translations/de/>\n"
"Language-Team: German <https://hosted.weblate.org/projects/safe-eyes/"
"translations/de/>\n"
"Language: de\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
@ -316,6 +316,10 @@ msgstr ""
msgid "Minimum idle time to pause Safe Eyes (in seconds)"
msgstr ""
# plugin/smartpause
msgid "Interpret idle time equivalent to upcoming break duration as a break"
msgstr ""
#: plugins/trayicon
msgid "Tray Icon"
msgstr ""

View File

@ -8,8 +8,8 @@ msgstr ""
"POT-Creation-Date: 2017-09-17 07:59-0400\n"
"PO-Revision-Date: 2017-10-08 12:42+0000\n"
"Last-Translator: Gobinath L <lgobi20@gmail.com>\n"
"Language-Team: English (United States) <https://hosted.weblate.org/projects"
"/safe-eyes/translations/en_US/>\n"
"Language-Team: English (United States) <https://hosted.weblate.org/projects/"
"safe-eyes/translations/en_US/>\n"
"Language: en_US\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
@ -317,6 +317,10 @@ msgstr "Pause Safe Eyes if the system is idle"
msgid "Minimum idle time to pause Safe Eyes (in seconds)"
msgstr "Minimum idle time to pause Safe Eyes (in seconds)"
# plugin/smartpause
msgid "Interpret idle time equivalent to upcoming break duration as a break"
msgstr ""
#: plugins/trayicon
msgid "Tray Icon"
msgstr "Tray Icon"

View File

@ -8,8 +8,8 @@ msgstr ""
"POT-Creation-Date: \n"
"PO-Revision-Date: 2017-10-14 02:28+0000\n"
"Last-Translator: Julio González <jgonzalez@rembox.cl>\n"
"Language-Team: Spanish <https://hosted.weblate.org/projects/safe-"
"eyes/translations/es/>\n"
"Language-Team: Spanish <https://hosted.weblate.org/projects/safe-eyes/"
"translations/es/>\n"
"Language: es\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
@ -316,6 +316,10 @@ msgstr ""
msgid "Minimum idle time to pause Safe Eyes (in seconds)"
msgstr ""
# plugin/smartpause
msgid "Interpret idle time equivalent to upcoming break duration as a break"
msgstr ""
#: plugins/trayicon
msgid "Tray Icon"
msgstr ""

View File

@ -8,8 +8,8 @@ msgstr ""
"POT-Creation-Date: \n"
"PO-Revision-Date: 2017-10-13 17:55+0000\n"
"Last-Translator: Gobinath L <lgobi20@gmail.com>\n"
"Language-Team: Estonian <https://hosted.weblate.org/projects/safe-"
"eyes/translations/et/>\n"
"Language-Team: Estonian <https://hosted.weblate.org/projects/safe-eyes/"
"translations/et/>\n"
"Language: et\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
@ -316,6 +316,10 @@ msgstr ""
msgid "Minimum idle time to pause Safe Eyes (in seconds)"
msgstr ""
# plugin/smartpause
msgid "Interpret idle time equivalent to upcoming break duration as a break"
msgstr ""
#: plugins/trayicon
msgid "Tray Icon"
msgstr ""

View File

@ -8,8 +8,8 @@ msgstr ""
"POT-Creation-Date: \n"
"PO-Revision-Date: 2017-10-13 17:55+0000\n"
"Last-Translator: Gobinath L <lgobi20@gmail.com>\n"
"Language-Team: Persian <https://hosted.weblate.org/projects/safe-"
"eyes/translations/fa/>\n"
"Language-Team: Persian <https://hosted.weblate.org/projects/safe-eyes/"
"translations/fa/>\n"
"Language: fa\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
@ -317,6 +317,10 @@ msgstr ""
msgid "Minimum idle time to pause Safe Eyes (in seconds)"
msgstr ""
# plugin/smartpause
msgid "Interpret idle time equivalent to upcoming break duration as a break"
msgstr ""
#: plugins/trayicon
msgid "Tray Icon"
msgstr ""

View File

@ -8,8 +8,8 @@ msgstr ""
"POT-Creation-Date: \n"
"PO-Revision-Date: 2017-10-13 17:55+0000\n"
"Last-Translator: Gobinath L <lgobi20@gmail.com>\n"
"Language-Team: French <https://hosted.weblate.org/projects/safe-"
"eyes/translations/fr/>\n"
"Language-Team: French <https://hosted.weblate.org/projects/safe-eyes/"
"translations/fr/>\n"
"Language: fr\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
@ -320,7 +320,12 @@ msgstr "Mettre Safe Eyes en pause si le système est inactif"
# plugin/smartpause
msgid "Minimum idle time to pause Safe Eyes (in seconds)"
msgstr "Durée d'inactivité minimale pour mettre Safe Eyes en pause (en secondes)"
msgstr ""
"Durée d'inactivité minimale pour mettre Safe Eyes en pause (en secondes)"
# plugin/smartpause
msgid "Interpret idle time equivalent to upcoming break duration as a break"
msgstr ""
#: plugins/trayicon
msgid "Tray Icon"

View File

@ -7,14 +7,14 @@ msgstr ""
"Project-Id-Version: \n"
"POT-Creation-Date: \n"
"PO-Revision-Date: \n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: hi\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 1.8.7.1\n"
"Last-Translator: \n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"Language: hi\n"
# Short break
msgid "Tightly close your eyes"
@ -313,6 +313,10 @@ msgstr ""
msgid "Minimum idle time to pause Safe Eyes (in seconds)"
msgstr ""
# plugin/smartpause
msgid "Interpret idle time equivalent to upcoming break duration as a break"
msgstr ""
#: plugins/trayicon
msgid "Tray Icon"
msgstr ""

View File

@ -8,8 +8,8 @@ msgstr ""
"POT-Creation-Date: \n"
"PO-Revision-Date: 2017-10-16 11:08+0000\n"
"Last-Translator: András Soltész <soltesz.andras@gmail.com>\n"
"Language-Team: Hungarian <https://hosted.weblate.org/projects/safe-"
"eyes/translations/hu/>\n"
"Language-Team: Hungarian <https://hosted.weblate.org/projects/safe-eyes/"
"translations/hu/>\n"
"Language: hu\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
@ -315,6 +315,10 @@ msgstr "Safe Eyes felfüggesztése ha a rendszer üresjáratban van"
msgid "Minimum idle time to pause Safe Eyes (in seconds)"
msgstr "Minimális üresjárati idő a Safe Eyes felfüggesztéséhez (mp)"
# plugin/smartpause
msgid "Interpret idle time equivalent to upcoming break duration as a break"
msgstr ""
#: plugins/trayicon
msgid "Tray Icon"
msgstr "Tálca Ikon"

View File

@ -7,14 +7,14 @@ msgstr ""
"Project-Id-Version: \n"
"POT-Creation-Date: \n"
"PO-Revision-Date: \n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: id\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 1.8.7.1\n"
"Last-Translator: \n"
"Plural-Forms: nplurals=1; plural=0;\n"
"Language: id\n"
# Short break
msgid "Tightly close your eyes"
@ -313,6 +313,10 @@ msgstr ""
msgid "Minimum idle time to pause Safe Eyes (in seconds)"
msgstr ""
# plugin/smartpause
msgid "Interpret idle time equivalent to upcoming break duration as a break"
msgstr ""
#: plugins/trayicon
msgid "Tray Icon"
msgstr ""

View File

@ -8,8 +8,8 @@ msgstr ""
"POT-Creation-Date: \n"
"PO-Revision-Date: 2017-10-10 17:46+0000\n"
"Last-Translator: Guglielmo Wilmup <wilmup67@gmail.com>\n"
"Language-Team: Italian <https://hosted.weblate.org/projects/safe-"
"eyes/translations/it/>\n"
"Language-Team: Italian <https://hosted.weblate.org/projects/safe-eyes/"
"translations/it/>\n"
"Language: it\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
@ -115,7 +115,8 @@ msgstr "Tempo prima di una pausa (in secondi)"
# Settings dialog
msgid "Keyboard shortcuts disabled period (in seconds)"
msgstr "Durata della disattivazione per le scorciatoie da tastiera (in secondi)"
msgstr ""
"Durata della disattivazione per le scorciatoie da tastiera (in secondi)"
# Settings dialog
msgid "Postpone duration (in minutes)"
@ -321,6 +322,10 @@ msgstr "Sospendi Safe Eyes quando il sistema è inattivo"
msgid "Minimum idle time to pause Safe Eyes (in seconds)"
msgstr "Tempo minimo di inattività per mettere in pausa Safe Eyes (in secondi)"
# plugin/smartpause
msgid "Interpret idle time equivalent to upcoming break duration as a break"
msgstr ""
#: plugins/trayicon
msgid "Tray Icon"
msgstr "Icona"

View File

@ -8,8 +8,8 @@ msgstr ""
"POT-Creation-Date: \n"
"PO-Revision-Date: 2017-10-13 17:55+0000\n"
"Last-Translator: Gobinath L <lgobi20@gmail.com>\n"
"Language-Team: Macedonian <https://hosted.weblate.org/projects/safe-"
"eyes/translations/mk/>\n"
"Language-Team: Macedonian <https://hosted.weblate.org/projects/safe-eyes/"
"translations/mk/>\n"
"Language: mk\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
@ -316,6 +316,10 @@ msgstr ""
msgid "Minimum idle time to pause Safe Eyes (in seconds)"
msgstr ""
# plugin/smartpause
msgid "Interpret idle time equivalent to upcoming break duration as a break"
msgstr ""
#: plugins/trayicon
msgid "Tray Icon"
msgstr ""

View File

@ -8,8 +8,8 @@ msgstr ""
"POT-Creation-Date: \n"
"PO-Revision-Date: 2017-10-13 17:55+0000\n"
"Last-Translator: Gobinath L <lgobi20@gmail.com>\n"
"Language-Team: Dutch <https://hosted.weblate.org/projects/safe-"
"eyes/translations/nl/>\n"
"Language-Team: Dutch <https://hosted.weblate.org/projects/safe-eyes/"
"translations/nl/>\n"
"Language: nl\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
@ -317,6 +317,10 @@ msgstr ""
msgid "Minimum idle time to pause Safe Eyes (in seconds)"
msgstr ""
# plugin/smartpause
msgid "Interpret idle time equivalent to upcoming break duration as a break"
msgstr ""
#: plugins/trayicon
msgid "Tray Icon"
msgstr ""

View File

@ -8,8 +8,8 @@ msgstr ""
"POT-Creation-Date: \n"
"PO-Revision-Date: 2017-10-16 11:08+0000\n"
"Last-Translator: Daria Szatan <bla_ke@tuta.io>\n"
"Language-Team: Polish <https://hosted.weblate.org/projects/safe-"
"eyes/translations/pl/>\n"
"Language-Team: Polish <https://hosted.weblate.org/projects/safe-eyes/"
"translations/pl/>\n"
"Language: pl\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
@ -317,6 +317,10 @@ msgstr "Zatrzymaj Safe Eyes podczas bezczynności"
msgid "Minimum idle time to pause Safe Eyes (in seconds)"
msgstr "Minimalny czas bezczynności (w sekundach)"
# plugin/smartpause
msgid "Interpret idle time equivalent to upcoming break duration as a break"
msgstr ""
#: plugins/trayicon
msgid "Tray Icon"
msgstr "Ikona w zasobniku"

View File

@ -8,8 +8,8 @@ msgstr ""
"POT-Creation-Date: \n"
"PO-Revision-Date: 2017-10-13 17:55+0000\n"
"Last-Translator: Gobinath L <lgobi20@gmail.com>\n"
"Language-Team: Portuguese <https://hosted.weblate.org/projects/safe-"
"eyes/translations/pt/>\n"
"Language-Team: Portuguese <https://hosted.weblate.org/projects/safe-eyes/"
"translations/pt/>\n"
"Language: pt\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
@ -316,6 +316,10 @@ msgstr ""
msgid "Minimum idle time to pause Safe Eyes (in seconds)"
msgstr ""
# plugin/smartpause
msgid "Interpret idle time equivalent to upcoming break duration as a break"
msgstr ""
#: plugins/trayicon
msgid "Tray Icon"
msgstr ""

View File

@ -8,14 +8,14 @@ msgstr ""
"POT-Creation-Date: \n"
"PO-Revision-Date: 2017-10-13 17:55+0000\n"
"Last-Translator: Duncan <duncan@fromru.com>\n"
"Language-Team: Russian <https://hosted.weblate.org/projects/safe-"
"eyes/translations/ru/>\n"
"Language-Team: Russian <https://hosted.weblate.org/projects/safe-eyes/"
"translations/ru/>\n"
"Language: ru\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<="
"4 && (n%100<10 || n%100>=20) ? 1 : 2;\n"
"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n"
"X-Generator: Weblate 2.17\n"
# Short break
@ -315,6 +315,10 @@ msgstr "Приостановить Safe Eyes, если система прост
msgid "Minimum idle time to pause Safe Eyes (in seconds)"
msgstr "Минимальное время простоя для приостановки Safe Eyes (в секундах)"
# plugin/smartpause
msgid "Interpret idle time equivalent to upcoming break duration as a break"
msgstr ""
#: plugins/trayicon
msgid "Tray Icon"
msgstr "Иконка в трее"

View File

@ -0,0 +1,381 @@
# SAFE EYES ENGLISH TRANSLATION.
# Copyright (C) 2017 Gobinath
# Gobinath slgobinath@gmail.com, 2017.
#
msgid ""
msgstr ""
# Short break
msgid "Tightly close your eyes"
msgstr ""
# Short break
msgid "Roll your eyes a few times to each side"
msgstr ""
# Short break
msgid "Rotate your eyes in clockwise direction"
msgstr ""
# Short break
msgid "Rotate your eyes in counterclockwise direction"
msgstr ""
# Short break
msgid "Blink your eyes"
msgstr ""
# Short break
msgid "Focus on a point in the far distance"
msgstr ""
# Short break
msgid "Have some water"
msgstr ""
# Long break
msgid "Walk for a while"
msgstr ""
# Long break
msgid "Lean back at your seat and relax"
msgstr ""
# Commandline arg description
msgid "show the about dialog"
msgstr ""
# Commandline arg description
msgid "disable the currently running safeeyes instance"
msgstr ""
# Commandline arg description
msgid "enable the currently running safeeyes instance"
msgstr ""
# Commandline arg description
msgid "quit the running safeeyes instance and exit"
msgstr ""
# Commandline arg description
msgid "show the settings dialog"
msgstr ""
# Commandline arg description
msgid "start safeeyes in debug mode"
msgstr ""
# About dialog
msgid "Close"
msgstr ""
# Description in about dialog
# Safe Eyes protects your eyes from eye strain (asthenopia) by reminding you to take breaks while you're working long hours at the computer
msgid "description"
msgstr ""
# About dialog
msgid "License"
msgstr ""
# Break screen
msgid "Skip"
msgstr ""
# Break screen
msgid "Postpone"
msgstr ""
# Settings dialog
msgid "Break duration (in seconds)"
msgstr ""
# Settings dialog
msgid "Interval between two breaks (in minutes)"
msgstr ""
# Settings dialog
msgid "Time to prepare for a break (in seconds)"
msgstr ""
# Settings dialog
msgid "Keyboard shortcuts disabled period (in seconds)"
msgstr ""
# Settings dialog
msgid "Postpone duration (in minutes)"
msgstr ""
# Settings dialog
msgid "Strict break (No way to skip breaks)"
msgstr ""
# Settings dialog
msgid "Allow postponing breaks"
msgstr ""
# Settings dialog
msgid "Persist the internal state"
msgstr ""
# Settings dialog
msgid "Long break interval must be a multiple of short break interval"
msgstr ""
# Settings dialog
msgid "Options"
msgstr ""
# Settings dialog
msgid "Short Breaks"
msgstr ""
# Settings dialog
msgid "Long Breaks"
msgstr ""
# Settings dialog
msgid "Break"
msgstr ""
# Settings dialog
msgid "Breaks"
msgstr ""
# Settings dialog
msgid "Plugins"
msgstr ""
# Settings dialog
msgid "Type"
msgstr ""
# Settings dialog
msgid "Short"
msgstr ""
# Settings dialog
msgid "Long"
msgstr ""
# Settings dialog
msgid "Image"
msgstr ""
# Settings dialog
msgid "Select"
msgstr ""
# Settings dialog
msgid "Please select an image"
msgstr ""
# Settings dialog
msgid "Duration"
msgstr ""
# Settings dialog
msgid "Override"
msgstr ""
# Settings dialog
msgid "Time (in seconds)"
msgstr ""
# Settings dialog
msgid "Break Settings"
msgstr ""
# Settings dialog
msgid "Plugin Settings"
msgstr ""
# Settings dialog
msgid "Plugin does not support %s desktop environment"
msgstr ""
# Settings dialog
msgid "Please install the Python module '%s'"
msgstr ""
# Settings dialog
msgid "Please install the command-line tool '%s'"
msgstr ""
# Settings dialog
msgid "Please add the resource %(resource)s to %(config_resource)s directory"
msgstr ""
# Settings dialog
msgid "New Break"
msgstr ""
# Settings dialog
msgid "Remove"
msgstr ""
# Settings dialog
msgid "Discard"
msgstr ""
# Settings dialog
msgid "Save"
msgstr ""
# plugin/audiblealert
msgid "Audible Alert"
msgstr ""
# plugin/audiblealert
msgid "Play an audible alert at the end of breaks"
msgstr ""
# plugin/donotdisturb
msgid "Do Not Disturb"
msgstr ""
# plugin/donotdisturb
msgid "Skip the break if the active window is in fullscreen mode"
msgstr ""
# plugin/donotdisturb
msgid "Do not interrupt these windows anytime"
msgstr ""
# plugin/donotdisturb
msgid "Interrupt these windows regardless of their state"
msgstr ""
# plugin/donotdisturb
msgid "Switch the interruptible windows to normal mode"
msgstr ""
# plugin/healthstats
msgid "Health Statistics"
msgstr ""
# plugin/healthstats
msgid "Show statistics based on how you use Safe Eyes"
msgstr ""
# plugin/notification
msgid "Notification"
msgstr ""
# plugin/notification
msgid "Show a system notification before breaks"
msgstr ""
# plugin/notification
msgid "Ready for a short break in %s seconds"
msgstr ""
# plugin/notification
msgid "Ready for a long break in %s seconds"
msgstr ""
# plugin/screensaver
msgid "Screensaver"
msgstr ""
# plugin/screensaver
msgid "Lock the screen after long breaks by starting screensaver"
msgstr ""
# plugin/screensaver
msgid "Custom screensaver command"
msgstr ""
# plugin/screensaver
msgid "Minimum seconds to skip without screensaver"
msgstr ""
# plugin/smartpause
msgid "Smart Pause"
msgstr ""
# plugin/smartpause
msgid "Pause Safe Eyes if the system is idle"
msgstr ""
# plugin/smartpause
msgid "Minimum idle time to pause Safe Eyes (in seconds)"
msgstr ""
# plugin/smartpause
msgid "Interpret idle time equivalent to upcoming break duration as a break"
msgstr ""
#: plugins/trayicon
msgid "Tray Icon"
msgstr ""
#: plugins/trayicon
msgid "Show a tray icon in the notification area"
msgstr ""
#: plugins/trayicon
msgid "Show next break time in tray icon"
msgstr ""
#: plugins/trayicon
msgid "About"
msgstr ""
#: plugins/trayicon
msgid "Disable Safe Eyes"
msgstr ""
#: plugins/trayicon
msgid "Disabled until %s"
msgstr ""
#: plugins/trayicon
msgid "Disabled until restart"
msgstr ""
#: plugins/trayicon
msgid "Enable Safe Eyes"
msgstr ""
#: plugins/trayicon
msgid "For %d Hour"
msgid_plural "For %d Hours"
msgstr[0] ""
msgstr[1] ""
#: plugins/trayicon
msgid "For %d Minute"
msgid_plural "For %d Minutes"
msgstr[0] ""
msgstr[1] ""
#: plugins/trayicon
msgid "For %d Second"
msgid_plural "For %d Seconds"
msgstr[0] ""
msgstr[1] ""
#: plugins/trayicon
msgid "Next break at %s"
msgstr ""
#: plugins/trayicon
msgid "No Breaks Available"
msgstr ""
#: plugins/trayicon
msgid "Settings"
msgstr ""
#: plugins/trayicon
msgid "Take a break now"
msgstr ""
#: plugins/trayicon
msgid "Until restart"
msgstr ""
#: plugins/trayicon
msgid "Quit"
msgstr ""

View File

@ -8,8 +8,8 @@ msgstr ""
"POT-Creation-Date: \n"
"PO-Revision-Date: 2017-10-13 17:55+0000\n"
"Last-Translator: Gobinath L <lgobi20@gmail.com>\n"
"Language-Team: Slovak <https://hosted.weblate.org/projects/safe-"
"eyes/translations/sk/>\n"
"Language-Team: Slovak <https://hosted.weblate.org/projects/safe-eyes/"
"translations/sk/>\n"
"Language: sk\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
@ -316,6 +316,10 @@ msgstr ""
msgid "Minimum idle time to pause Safe Eyes (in seconds)"
msgstr ""
# plugin/smartpause
msgid "Interpret idle time equivalent to upcoming break duration as a break"
msgstr ""
#: plugins/trayicon
msgid "Tray Icon"
msgstr ""

View File

@ -8,8 +8,8 @@ msgstr ""
"POT-Creation-Date: 2017-09-17 07:59-0400\n"
"PO-Revision-Date: 2017-10-08 12:42+0000\n"
"Last-Translator: Gobinath L <lgobi20@gmail.com>\n"
"Language-Team: Tamil <https://hosted.weblate.org/projects/safe-"
"eyes/translations/ta/>\n"
"Language-Team: Tamil <https://hosted.weblate.org/projects/safe-eyes/"
"translations/ta/>\n"
"Language: ta\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
@ -86,8 +86,8 @@ msgstr "மூடு"
# Safe Eyes protects your eyes from eye strain (asthenopia) by reminding you to take breaks while you're working long hours at the computer
msgid "description"
msgstr ""
"அடிக்கடி ஓய்வெடுக்க அறிவுறுத்துவதன் மூலம் Safe Eyes கணனியில் நீண்ட நேரம் "
"பணியாற்றுவதால் ஏற்படும் கண் சோர்வை தடுக்கிறது"
"அடிக்கடி ஓய்வெடுக்க அறிவுறுத்துவதன் மூலம் Safe Eyes கணனியில் நீண்ட நேரம் பணியாற்றுவதால் "
"ஏற்படும் கண் சோர்வை தடுக்கிறது"
# About dialog
msgid "License"
@ -135,7 +135,9 @@ msgstr "உள்ளக நிலையை தக்கவைத்து கொ
# Settings dialog
msgid "Long break interval must be a multiple of short break interval"
msgstr "நீண்ட இடைவேளைகளுக்கிடையிலான நேரம் குறுகிய இடைவேளைகளுக்கிடையிலான நேரத்தின் மடங்காக இருக்க வேண்டும்"
msgstr ""
"நீண்ட இடைவேளைகளுக்கிடையிலான நேரம் குறுகிய இடைவேளைகளுக்கிடையிலான நேரத்தின் மடங்காக "
"இருக்க வேண்டும்"
# Settings dialog
msgid "Options"
@ -317,6 +319,10 @@ msgstr "கணினி செயலற்று இருந்தால் Saf
msgid "Minimum idle time to pause Safe Eyes (in seconds)"
msgstr "Safe Eyesஐ இடைநிறுத்துவதற்கான குறைந்தபட்ச செயலற்ற நேரம் (விநாடிகளில்)"
# plugin/smartpause
msgid "Interpret idle time equivalent to upcoming break duration as a break"
msgstr ""
#: plugins/trayicon
msgid "Tray Icon"
msgstr "Safe Eyes சின்னம்"

View File

@ -8,8 +8,8 @@ msgstr ""
"POT-Creation-Date: \n"
"PO-Revision-Date: 2017-10-13 17:55+0000\n"
"Last-Translator: Gobinath L <lgobi20@gmail.com>\n"
"Language-Team: Turkish <https://hosted.weblate.org/projects/safe-"
"eyes/translations/tr/>\n"
"Language-Team: Turkish <https://hosted.weblate.org/projects/safe-eyes/"
"translations/tr/>\n"
"Language: tr\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
@ -317,6 +317,10 @@ msgstr ""
msgid "Minimum idle time to pause Safe Eyes (in seconds)"
msgstr ""
# plugin/smartpause
msgid "Interpret idle time equivalent to upcoming break duration as a break"
msgstr ""
#: plugins/trayicon
msgid "Tray Icon"
msgstr ""

View File

@ -8,14 +8,14 @@ msgstr ""
"POT-Creation-Date: \n"
"PO-Revision-Date: 2017-10-13 17:55+0000\n"
"Last-Translator: Gobinath L <lgobi20@gmail.com>\n"
"Language-Team: Ukrainian <https://hosted.weblate.org/projects/safe-"
"eyes/translations/uk/>\n"
"Language-Team: Ukrainian <https://hosted.weblate.org/projects/safe-eyes/"
"translations/uk/>\n"
"Language: uk\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<="
"4 && (n%100<10 || n%100>=20) ? 1 : 2;\n"
"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n"
"X-Generator: Weblate 2.17\n"
# Short break
@ -317,6 +317,10 @@ msgstr ""
msgid "Minimum idle time to pause Safe Eyes (in seconds)"
msgstr ""
# plugin/smartpause
msgid "Interpret idle time equivalent to upcoming break duration as a break"
msgstr ""
#: plugins/trayicon
msgid "Tray Icon"
msgstr ""

View File

@ -8,8 +8,8 @@ msgstr ""
"POT-Creation-Date: \n"
"PO-Revision-Date: 2017-10-13 17:55+0000\n"
"Last-Translator: Gobinath L <lgobi20@gmail.com>\n"
"Language-Team: Vietnamese <https://hosted.weblate.org/projects/safe-"
"eyes/translations/vi/>\n"
"Language-Team: Vietnamese <https://hosted.weblate.org/projects/safe-eyes/"
"translations/vi/>\n"
"Language: vi\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
@ -316,6 +316,10 @@ msgstr ""
msgid "Minimum idle time to pause Safe Eyes (in seconds)"
msgstr ""
# plugin/smartpause
msgid "Interpret idle time equivalent to upcoming break duration as a break"
msgstr ""
#: plugins/trayicon
msgid "Tray Icon"
msgstr ""

View File

@ -8,8 +8,8 @@ msgstr ""
"POT-Creation-Date: \n"
"PO-Revision-Date: 2017-10-08 12:42+0000\n"
"Last-Translator: Gobinath L <lgobi20@gmail.com>\n"
"Language-Team: Chinese (Simplified) <https://hosted.weblate.org/projects"
"/safe-eyes/translations/zh_Hans/>\n"
"Language-Team: Chinese (Simplified) <https://hosted.weblate.org/projects/"
"safe-eyes/translations/zh_Hans/>\n"
"Language: zh_CN\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
@ -84,7 +84,9 @@ msgstr "关闭"
# Description in about dialog
# Safe Eyes protects your eyes from eye strain (asthenopia) by reminding you to take breaks while you're working long hours at the computer
msgid "description"
msgstr "当您持续使用电脑办公太长时间时Safe Eyes 会提醒您休息一下,通过这种方式来保护您的眼睛,使您远离视疲劳"
msgstr ""
"当您持续使用电脑办公太长时间时Safe Eyes 会提醒您休息一下,通过这种方式来保"
"护您的眼睛,使您远离视疲劳"
# About dialog
msgid "License"
@ -314,6 +316,10 @@ msgstr ""
msgid "Minimum idle time to pause Safe Eyes (in seconds)"
msgstr ""
# plugin/smartpause
msgid "Interpret idle time equivalent to upcoming break duration as a break"
msgstr ""
#: plugins/trayicon
msgid "Tray Icon"
msgstr ""

View File

@ -2,7 +2,7 @@
"meta": {
"name": "Smart Pause",
"description": "Pause Safe Eyes if the system is idle",
"version": "0.0.1"
"version": "0.0.2"
},
"dependencies": {
"python_modules": [],
@ -16,9 +16,15 @@
"id": "idle_time",
"label": "Minimum idle time to pause Safe Eyes (in seconds)",
"type": "INT",
"default": 180,
"default": 60,
"max": 3600,
"min": 5
},
{
"id": "interpret_idle_as_break",
"label": "Interpret idle time equivalent to upcoming break duration as a break",
"type": "BOOL",
"default": false
}
]
}

View File

@ -38,8 +38,10 @@ disable_safe_eyes = None
smart_pause_activated = False
idle_start_time = None
next_break_time = None
next_break_duration = 0
break_interval = 0
waiting_time = 2
interpret_idle_as_break = False
def __system_idle_time():
"""
@ -81,11 +83,13 @@ def init(ctx, safeeyes_config, plugin_config):
global idle_time
global break_interval
global waiting_time
global interpret_idle_as_break
logging.debug('Initialize Smart Pause plugin')
context = ctx
enable_safe_eyes = context['api']['enable_safeeyes']
disable_safe_eyes = context['api']['disable_safeeyes']
idle_time = plugin_config['idle_time']
interpret_idle_as_break = plugin_config['interpret_idle_as_break']
break_interval = safeeyes_config.get('break_interval') * 60 # Convert to seconds
waiting_time = min(2, idle_time) # If idle time is 1 sec, wait only 1 sec
@ -114,10 +118,16 @@ def __start_idle_monitor():
logging.info('Resume Safe Eyes due to user activity')
smart_pause_activated = False
idle_period = (datetime.datetime.now() - idle_start_time)
if idle_period.total_seconds() < break_interval:
idle_seconds = idle_period.total_seconds()
if interpret_idle_as_break and idle_seconds >= next_break_duration:
# User is idle for break duration and wants to consider it as a break
enable_safe_eyes()
elif idle_seconds < break_interval:
# Credit back the idle time
next_break = next_break_time + idle_period
enable_safe_eyes(next_break.timestamp())
else:
# User is idle for more than the time between two breaks
enable_safe_eyes()
@ -149,9 +159,11 @@ def on_stop():
idle_condition.notify_all()
idle_condition.release()
def update_next_break(dateTime):
def update_next_break(break_obj, dateTime):
"""
Update the next break time.
"""
global next_break_time
global next_break_duration
next_break_time = dateTime
next_break_duration = break_obj.time

View File

@ -371,11 +371,11 @@ def init(ctx, safeeyes_cfg, plugin_config):
tray_icon.initialize(plugin_config)
def update_next_break(dateTime):
def update_next_break(break_obj, next_break_time):
"""
Update the next break time.
"""
tray_icon.next_break_time(dateTime)
tray_icon.next_break_time(next_break_time)
def on_pre_break(break_obj):