Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2017-10-14 15:30:34 +02:00
commit 65b2129eda
25 changed files with 301 additions and 36 deletions

View File

@ -314,7 +314,7 @@ msgid "Pause Safe Eyes if the system is idle"
msgstr "" msgstr ""
# plugin/smartpause # plugin/smartpause
msgid "Minimum idle time to pause Safe Eyes" msgid "Minimum idle time to pause Safe Eyes (in seconds)"
msgstr "" msgstr ""
#: plugins/trayicon #: plugins/trayicon

View File

@ -313,8 +313,8 @@ msgid "Pause Safe Eyes if the system is idle"
msgstr "Pozastavit Safe Eyes když je systém v klidu" msgstr "Pozastavit Safe Eyes když je systém v klidu"
# plugin/smartpause # plugin/smartpause
msgid "Minimum idle time to pause Safe Eyes" msgid "Minimum idle time to pause Safe Eyes (in seconds)"
msgstr "Minimální čas v klidu na pozastavení Safe Eyes" msgstr "Minimální čas v klidu na pozastavení Safe Eyes (v sekundách)"
#: plugins/trayicon #: plugins/trayicon
msgid "Tray Icon" msgid "Tray Icon"

View File

@ -313,7 +313,7 @@ msgid "Pause Safe Eyes if the system is idle"
msgstr "" msgstr ""
# plugin/smartpause # plugin/smartpause
msgid "Minimum idle time to pause Safe Eyes" msgid "Minimum idle time to pause Safe Eyes (in seconds)"
msgstr "" msgstr ""
#: plugins/trayicon #: plugins/trayicon

View File

@ -314,8 +314,8 @@ msgid "Pause Safe Eyes if the system is idle"
msgstr "Pause Safe Eyes if the system is idle" msgstr "Pause Safe Eyes if the system is idle"
# plugin/smartpause # plugin/smartpause
msgid "Minimum idle time to pause Safe Eyes" msgid "Minimum idle time to pause Safe Eyes (in seconds)"
msgstr "Minimum idle time to pause Safe Eyes" msgstr "Minimum idle time to pause Safe Eyes (in seconds)"
#: plugins/trayicon #: plugins/trayicon
msgid "Tray Icon" msgid "Tray Icon"

View File

@ -127,3 +127,265 @@ msgstr "Descanso estricto (no hay forma de saltarlo)"
# Settings dialog # Settings dialog
msgid "Allow postponing breaks" msgid "Allow postponing breaks"
msgstr "Permitir posponer los descansos" msgstr "Permitir posponer los descansos"
# 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 ""
#: 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

@ -313,7 +313,7 @@ msgid "Pause Safe Eyes if the system is idle"
msgstr "" msgstr ""
# plugin/smartpause # plugin/smartpause
msgid "Minimum idle time to pause Safe Eyes" msgid "Minimum idle time to pause Safe Eyes (in seconds)"
msgstr "" msgstr ""
#: plugins/trayicon #: plugins/trayicon

View File

@ -314,7 +314,7 @@ msgid "Pause Safe Eyes if the system is idle"
msgstr "" msgstr ""
# plugin/smartpause # plugin/smartpause
msgid "Minimum idle time to pause Safe Eyes" msgid "Minimum idle time to pause Safe Eyes (in seconds)"
msgstr "" msgstr ""
#: plugins/trayicon #: plugins/trayicon

View File

@ -319,8 +319,8 @@ msgid "Pause Safe Eyes if the system is idle"
msgstr "Mettre Safe Eyes en pause si le système est inactif" msgstr "Mettre Safe Eyes en pause si le système est inactif"
# plugin/smartpause # plugin/smartpause
msgid "Minimum idle time to pause Safe Eyes" msgid "Minimum idle time to pause Safe Eyes (in seconds)"
msgstr "Durée d'inactivité minimale pour mettre Safe Eyes en pause" msgstr "Durée d'inactivité minimale pour mettre Safe Eyes en pause (en secondes)"
#: plugins/trayicon #: plugins/trayicon
msgid "Tray Icon" msgid "Tray Icon"

View File

@ -310,7 +310,7 @@ msgid "Pause Safe Eyes if the system is idle"
msgstr "" msgstr ""
# plugin/smartpause # plugin/smartpause
msgid "Minimum idle time to pause Safe Eyes" msgid "Minimum idle time to pause Safe Eyes (in seconds)"
msgstr "" msgstr ""
#: plugins/trayicon #: plugins/trayicon

View File

@ -310,7 +310,7 @@ msgid "Pause Safe Eyes if the system is idle"
msgstr "" msgstr ""
# plugin/smartpause # plugin/smartpause
msgid "Minimum idle time to pause Safe Eyes" msgid "Minimum idle time to pause Safe Eyes (in seconds)"
msgstr "" msgstr ""
#: plugins/trayicon #: plugins/trayicon

View File

@ -310,7 +310,7 @@ msgid "Pause Safe Eyes if the system is idle"
msgstr "" msgstr ""
# plugin/smartpause # plugin/smartpause
msgid "Minimum idle time to pause Safe Eyes" msgid "Minimum idle time to pause Safe Eyes (in seconds)"
msgstr "" msgstr ""
#: plugins/trayicon #: plugins/trayicon

View File

@ -318,8 +318,8 @@ msgid "Pause Safe Eyes if the system is idle"
msgstr "Sospendi Safe Eyes quando il sistema è inattivo" msgstr "Sospendi Safe Eyes quando il sistema è inattivo"
# plugin/smartpause # plugin/smartpause
msgid "Minimum idle time to pause Safe Eyes" msgid "Minimum idle time to pause Safe Eyes (in seconds)"
msgstr "Tempo minimo di inattività per mettere in pausa Safe Eyes" msgstr "Tempo minimo di inattività per mettere in pausa Safe Eyes (in secondi)"
#: plugins/trayicon #: plugins/trayicon
msgid "Tray Icon" msgid "Tray Icon"

View File

@ -313,7 +313,7 @@ msgid "Pause Safe Eyes if the system is idle"
msgstr "" msgstr ""
# plugin/smartpause # plugin/smartpause
msgid "Minimum idle time to pause Safe Eyes" msgid "Minimum idle time to pause Safe Eyes (in seconds)"
msgstr "" msgstr ""
#: plugins/trayicon #: plugins/trayicon

View File

@ -314,7 +314,7 @@ msgid "Pause Safe Eyes if the system is idle"
msgstr "" msgstr ""
# plugin/smartpause # plugin/smartpause
msgid "Minimum idle time to pause Safe Eyes" msgid "Minimum idle time to pause Safe Eyes (in seconds)"
msgstr "" msgstr ""
#: plugins/trayicon #: plugins/trayicon

View File

@ -314,7 +314,7 @@ msgid "Pause Safe Eyes if the system is idle"
msgstr "" msgstr ""
# plugin/smartpause # plugin/smartpause
msgid "Minimum idle time to pause Safe Eyes" msgid "Minimum idle time to pause Safe Eyes (in seconds)"
msgstr "" msgstr ""
#: plugins/trayicon #: plugins/trayicon

View File

@ -313,7 +313,7 @@ msgid "Pause Safe Eyes if the system is idle"
msgstr "" msgstr ""
# plugin/smartpause # plugin/smartpause
msgid "Minimum idle time to pause Safe Eyes" msgid "Minimum idle time to pause Safe Eyes (in seconds)"
msgstr "" msgstr ""
#: plugins/trayicon #: plugins/trayicon

View File

@ -312,8 +312,8 @@ msgid "Pause Safe Eyes if the system is idle"
msgstr "Приостановить Safe Eyes, если система простаивает" msgstr "Приостановить Safe Eyes, если система простаивает"
# plugin/smartpause # plugin/smartpause
msgid "Minimum idle time to pause Safe Eyes" msgid "Minimum idle time to pause Safe Eyes (in seconds)"
msgstr "Минимальное время простоя для приостановки Safe Eyes" msgstr "Минимальное время простоя для приостановки Safe Eyes (в секундах)"
#: plugins/trayicon #: plugins/trayicon
msgid "Tray Icon" msgid "Tray Icon"

View File

@ -313,7 +313,7 @@ msgid "Pause Safe Eyes if the system is idle"
msgstr "" msgstr ""
# plugin/smartpause # plugin/smartpause
msgid "Minimum idle time to pause Safe Eyes" msgid "Minimum idle time to pause Safe Eyes (in seconds)"
msgstr "" msgstr ""
#: plugins/trayicon #: plugins/trayicon

View File

@ -314,8 +314,8 @@ msgid "Pause Safe Eyes if the system is idle"
msgstr "கணினி செயலற்று இருந்தால் Safe Eyesஐ இடைநிறுத்துக" msgstr "கணினி செயலற்று இருந்தால் Safe Eyesஐ இடைநிறுத்துக"
# plugin/smartpause # plugin/smartpause
msgid "Minimum idle time to pause Safe Eyes" msgid "Minimum idle time to pause Safe Eyes (in seconds)"
msgstr "Safe Eyesஐ இடைநிறுத்துவதற்கான குறைந்தபட்ச செயலற்ற வினாடிகள்" msgstr "Safe Eyesஐ இடைநிறுத்துவதற்கான குறைந்தபட்ச செயலற்ற நேரம் (விநாடிகளில்)"
#: plugins/trayicon #: plugins/trayicon
msgid "Tray Icon" msgid "Tray Icon"

View File

@ -314,7 +314,7 @@ msgid "Pause Safe Eyes if the system is idle"
msgstr "" msgstr ""
# plugin/smartpause # plugin/smartpause
msgid "Minimum idle time to pause Safe Eyes" msgid "Minimum idle time to pause Safe Eyes (in seconds)"
msgstr "" msgstr ""
#: plugins/trayicon #: plugins/trayicon

View File

@ -314,7 +314,7 @@ msgid "Pause Safe Eyes if the system is idle"
msgstr "" msgstr ""
# plugin/smartpause # plugin/smartpause
msgid "Minimum idle time to pause Safe Eyes" msgid "Minimum idle time to pause Safe Eyes (in seconds)"
msgstr "" msgstr ""
#: plugins/trayicon #: plugins/trayicon

View File

@ -313,7 +313,7 @@ msgid "Pause Safe Eyes if the system is idle"
msgstr "" msgstr ""
# plugin/smartpause # plugin/smartpause
msgid "Minimum idle time to pause Safe Eyes" msgid "Minimum idle time to pause Safe Eyes (in seconds)"
msgstr "" msgstr ""
#: plugins/trayicon #: plugins/trayicon

View File

@ -311,7 +311,7 @@ msgid "Pause Safe Eyes if the system is idle"
msgstr "" msgstr ""
# plugin/smartpause # plugin/smartpause
msgid "Minimum idle time to pause Safe Eyes" msgid "Minimum idle time to pause Safe Eyes (in seconds)"
msgstr "" msgstr ""
#: plugins/trayicon #: plugins/trayicon

View File

@ -14,11 +14,11 @@
"settings": [ "settings": [
{ {
"id": "idle_time", "id": "idle_time",
"label": "Minimum idle time to pause Safe Eyes", "label": "Minimum idle time to pause Safe Eyes (in seconds)",
"type": "INT", "type": "INT",
"default": 3, "default": 180,
"max": 60, "max": 3600,
"min": 1 "min": 5
} }
] ]
} }

View File

@ -39,6 +39,7 @@ smart_pause_activated = False
idle_start_time = None idle_start_time = None
next_break_time = None next_break_time = None
break_interval = 0 break_interval = 0
waiting_time = 2
def __system_idle_time(): def __system_idle_time():
""" """
@ -46,7 +47,7 @@ def __system_idle_time():
Return the idle time if xprintidle is available, otherwise return 0. Return the idle time if xprintidle is available, otherwise return 0.
""" """
try: try:
return int(subprocess.check_output(['xprintidle']).decode('utf-8')) / 60000 # Convert to minutes return int(subprocess.check_output(['xprintidle']).decode('utf-8')) / 1000 # Convert to seconds
except BaseException: except BaseException:
return 0 return 0
@ -79,12 +80,14 @@ def init(ctx, safeeyes_config, plugin_config):
global disable_safe_eyes global disable_safe_eyes
global idle_time global idle_time
global break_interval global break_interval
global waiting_time
logging.debug('Initialize Smart Pause plugin') logging.debug('Initialize Smart Pause plugin')
context = ctx context = ctx
enable_safe_eyes = context['api']['enable_safeeyes'] enable_safe_eyes = context['api']['enable_safeeyes']
disable_safe_eyes = context['api']['disable_safeeyes'] disable_safe_eyes = context['api']['disable_safeeyes']
idle_time = plugin_config['idle_time'] idle_time = plugin_config['idle_time']
break_interval = safeeyes_config.get('break_interval') * 60 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
def __start_idle_monitor(): def __start_idle_monitor():
@ -94,9 +97,9 @@ def __start_idle_monitor():
global smart_pause_activated global smart_pause_activated
global idle_start_time global idle_start_time
while __is_active(): while __is_active():
# Wait for 2 seconds # Wait for waiting_time seconds
idle_condition.acquire() idle_condition.acquire()
idle_condition.wait(2) idle_condition.wait(waiting_time)
idle_condition.release() idle_condition.release()
if __is_active(): if __is_active():