From 866bea6b309fdfce9b963002acc0b0605554ff04 Mon Sep 17 00:00:00 2001 From: Gobinath Date: Sun, 28 Jan 2018 20:16:02 -0500 Subject: [PATCH] Add status command line arg --- .gitignore | 4 +++- safeeyes/SafeEyes.py | 16 ++++++++++++++-- safeeyes/__main__.py | 19 +++++++++++++------ .../config/locale/bg/LC_MESSAGES/safeeyes.po | 12 ++++++++++-- .../config/locale/ca/LC_MESSAGES/safeeyes.po | 8 ++++++++ .../config/locale/cs/LC_MESSAGES/safeeyes.po | 12 ++++++++++-- .../config/locale/de/LC_MESSAGES/safeeyes.po | 12 ++++++++++-- .../locale/en_US/LC_MESSAGES/safeeyes.po | 8 ++++++++ .../config/locale/es/LC_MESSAGES/safeeyes.po | 8 ++++++++ .../config/locale/et/LC_MESSAGES/safeeyes.po | 18 ++++++++++++------ .../config/locale/fa/LC_MESSAGES/safeeyes.po | 12 ++++++++++-- .../config/locale/fr/LC_MESSAGES/safeeyes.po | 12 ++++++++++-- .../config/locale/hi/LC_MESSAGES/safeeyes.po | 8 ++++++++ .../config/locale/hu/LC_MESSAGES/safeeyes.po | 8 ++++++++ .../config/locale/id/LC_MESSAGES/safeeyes.po | 8 ++++++++ .../config/locale/it/LC_MESSAGES/safeeyes.po | 12 ++++++++++-- .../config/locale/mk/LC_MESSAGES/safeeyes.po | 8 ++++++++ .../config/locale/nb/LC_MESSAGES/safeeyes.po | 13 ++++++++----- .../config/locale/nl/LC_MESSAGES/safeeyes.po | 12 ++++++++++-- .../config/locale/pl/LC_MESSAGES/safeeyes.po | 12 ++++++++++-- .../config/locale/pt/LC_MESSAGES/safeeyes.po | 13 ++++++++++--- .../config/locale/ru/LC_MESSAGES/safeeyes.po | 16 ++++++++++++---- safeeyes/config/locale/safeeyes.pot | 8 ++++++++ .../config/locale/sk/LC_MESSAGES/safeeyes.po | 12 ++++++++++-- .../config/locale/sv/LC_MESSAGES/safeeyes.po | 12 ++++++++++-- .../config/locale/ta/LC_MESSAGES/safeeyes.po | 8 ++++++++ .../config/locale/tr/LC_MESSAGES/safeeyes.po | 12 ++++++++++-- .../config/locale/uk/LC_MESSAGES/safeeyes.po | 16 ++++++++++++---- .../config/locale/vi/LC_MESSAGES/safeeyes.po | 15 ++++++++++++--- .../locale/zh_CN/LC_MESSAGES/safeeyes.po | 12 ++++++++++-- .../locale/zh_TW/LC_MESSAGES/safeeyes.po | 12 ++++++++++-- safeeyes/plugins/trayicon/plugin.py | 9 ++++++--- safeeyes/rpc.py | 9 ++++++++- 33 files changed, 312 insertions(+), 64 deletions(-) diff --git a/.gitignore b/.gitignore index 9641228..9791f1e 100644 --- a/.gitignore +++ b/.gitignore @@ -97,4 +97,6 @@ ENV/ .ropeproject # Visual Studio Code settings -.vscode/ \ No newline at end of file +.vscode/ + +*.safeeyes.po~ \ No newline at end of file diff --git a/safeeyes/SafeEyes.py b/safeeyes/SafeEyes.py index 042ae5c..c2c0263 100644 --- a/safeeyes/SafeEyes.py +++ b/safeeyes/SafeEyes.py @@ -56,6 +56,7 @@ class SafeEyes(object): self.plugins_manager = None self.settings_dialog_active = False self.rpc_server = None + self._status = '' # Initialize the Safe Eyes Context self.context['version'] = SAFE_EYES_VERSION @@ -65,7 +66,8 @@ class SafeEyes(object): self.context['api']['show_settings'] = lambda: Utility.execute_main_thread(self.show_settings) self.context['api']['show_about'] = lambda: Utility.execute_main_thread(self.show_about) self.context['api']['enable_safeeyes'] = lambda next_break_time=-1: Utility.execute_main_thread(self.enable_safeeyes, next_break_time) - self.context['api']['disable_safeeyes'] = lambda: Utility.execute_main_thread(self.disable_safeeyes) + self.context['api']['disable_safeeyes'] = lambda status: Utility.execute_main_thread(self.disable_safeeyes, status) + self.context['api']['status'] = self.status self.context['api']['quit'] = lambda: Utility.execute_main_thread(self.quit) if self.config.get('persist_state'): self.context['session'] = Utility.open_session() @@ -209,7 +211,7 @@ class SafeEyes(object): self.safe_eyes_core.start(scheduled_next_break_time) self.plugins_manager.start() - def disable_safeeyes(self): + def disable_safeeyes(self, status=None): """ Listen to tray icon disable action and send the signal to core. """ @@ -217,6 +219,9 @@ class SafeEyes(object): self.active = False self.plugins_manager.stop() self.safe_eyes_core.stop() + if status is None: + status = _('Disabled until restart') + self._status = status def start_break(self, break_obj): """ @@ -242,6 +247,7 @@ class SafeEyes(object): Update the next break to plugins and save the session. """ self.plugins_manager.update_next_break(break_obj, break_time) + self._status = _('Next break at %s') % (Utility.format_time(break_time)) if self.config.get('persist_state'): Utility.write_json(Utility.SESSION_FILE_PATH, self.context['session']) @@ -259,6 +265,12 @@ class SafeEyes(object): """ self.safe_eyes_core.take_break() + def status(self): + """ + Return the status of Safe Eyes. + """ + return self._status + def persist_session(self): """ Save the session object to the session file. diff --git a/safeeyes/__main__.py b/safeeyes/__main__.py index b340122..bf34427 100755 --- a/safeeyes/__main__.py +++ b/safeeyes/__main__.py @@ -103,6 +103,7 @@ def main(): group.add_argument('-s', '--settings', help=_('show the settings dialog'), action='store_true') group.add_argument('-t', '--take-break', help=_('Take a break now').lower(), action='store_true') parser.add_argument('--debug', help=_('start safeeyes in debug mode'), action='store_true') + parser.add_argument('--status', help=_('print the status of running safeeyes instance and exit'), action='store_true') parser.add_argument('--version', action='version', version='%(prog)s ' + SAFE_EYES_VERSION) args = parser.parse_args() @@ -123,18 +124,24 @@ def main(): rpc_client.show_settings() elif args.take_break: rpc_client.take_break() + elif args.status: + print(rpc_client.status()) elif args.quit: rpc_client.quit() else: # Default behavior is opening settings rpc_client.show_settings() sys.exit(0) - elif not args.quit: - logging.info("Starting Safe Eyes") - safeeyes = SafeEyes(system_locale, config) - safeeyes.start() - Timer(1.0, lambda: __evaluate_arguments(args, safeeyes)).start() - Gtk.main() + else: + if args.status: + print(_('Safe Eyes is not running')) + sys.exit(0) + elif not args.quit: + logging.info("Starting Safe Eyes") + safeeyes = SafeEyes(system_locale, config) + safeeyes.start() + Timer(1.0, lambda: __evaluate_arguments(args, safeeyes)).start() + Gtk.main() if __name__ == '__main__': diff --git a/safeeyes/config/locale/bg/LC_MESSAGES/safeeyes.po b/safeeyes/config/locale/bg/LC_MESSAGES/safeeyes.po index 88466cf..0ca683a 100644 --- a/safeeyes/config/locale/bg/LC_MESSAGES/safeeyes.po +++ b/safeeyes/config/locale/bg/LC_MESSAGES/safeeyes.po @@ -7,14 +7,14 @@ msgstr "" "Project-Id-Version: \n" "POT-Creation-Date: \n" "PO-Revision-Date: \n" +"Last-Translator: \n" "Language-Team: \n" +"Language: bg\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: bg\n" # Short break msgid "Tightly close your eyes" @@ -76,6 +76,14 @@ msgstr "" msgid "start safeeyes in debug mode" msgstr "" +# Commandline arg description +msgid "print the status of running safeeyes instance and exit" +msgstr "" + +# Status message +msgid "Safe Eyes is not running" +msgstr "" + # About dialog msgid "Close" msgstr "" diff --git a/safeeyes/config/locale/ca/LC_MESSAGES/safeeyes.po b/safeeyes/config/locale/ca/LC_MESSAGES/safeeyes.po index 15c2027..9a095ac 100644 --- a/safeeyes/config/locale/ca/LC_MESSAGES/safeeyes.po +++ b/safeeyes/config/locale/ca/LC_MESSAGES/safeeyes.po @@ -77,6 +77,14 @@ msgstr "" msgid "start safeeyes in debug mode" msgstr "" +# Commandline arg description +msgid "print the status of running safeeyes instance and exit" +msgstr "" + +# Status message +msgid "Safe Eyes is not running" +msgstr "" + # About dialog msgid "Close" msgstr "Tanca" diff --git a/safeeyes/config/locale/cs/LC_MESSAGES/safeeyes.po b/safeeyes/config/locale/cs/LC_MESSAGES/safeeyes.po index dfb4276..f2c1aac 100644 --- a/safeeyes/config/locale/cs/LC_MESSAGES/safeeyes.po +++ b/safeeyes/config/locale/cs/LC_MESSAGES/safeeyes.po @@ -8,8 +8,8 @@ msgstr "" "POT-Creation-Date: \n" "PO-Revision-Date: 2017-11-10 06:45+0000\n" "Last-Translator: Pavel Borecki \n" -"Language-Team: Czech \n" +"Language-Team: Czech \n" "Language: cs\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -77,6 +77,14 @@ msgstr "zobrazit nastavovací dialog" msgid "start safeeyes in debug mode" msgstr "spustit safeeyes v režimu pro ladění" +# Commandline arg description +msgid "print the status of running safeeyes instance and exit" +msgstr "" + +# Status message +msgid "Safe Eyes is not running" +msgstr "" + # About dialog msgid "Close" msgstr "Zavřít" diff --git a/safeeyes/config/locale/de/LC_MESSAGES/safeeyes.po b/safeeyes/config/locale/de/LC_MESSAGES/safeeyes.po index b9303e1..49811dd 100644 --- a/safeeyes/config/locale/de/LC_MESSAGES/safeeyes.po +++ b/safeeyes/config/locale/de/LC_MESSAGES/safeeyes.po @@ -8,8 +8,8 @@ msgstr "" "POT-Creation-Date: \n" "PO-Revision-Date: 2018-01-16 23:40+0000\n" "Last-Translator: Sebastian Pipping \n" -"Language-Team: German \n" +"Language-Team: German \n" "Language: de\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -77,6 +77,14 @@ msgstr "Einstellungen anzeigen" msgid "start safeeyes in debug mode" msgstr "Im Debug-Modus starten" +# Commandline arg description +msgid "print the status of running safeeyes instance and exit" +msgstr "" + +# Status message +msgid "Safe Eyes is not running" +msgstr "" + # About dialog msgid "Close" msgstr "Schließen" diff --git a/safeeyes/config/locale/en_US/LC_MESSAGES/safeeyes.po b/safeeyes/config/locale/en_US/LC_MESSAGES/safeeyes.po index d0e4dc5..0e42266 100644 --- a/safeeyes/config/locale/en_US/LC_MESSAGES/safeeyes.po +++ b/safeeyes/config/locale/en_US/LC_MESSAGES/safeeyes.po @@ -78,6 +78,14 @@ msgstr "show the settings dialog" msgid "start safeeyes in debug mode" msgstr "start safeeyes in debug mode" +# Commandline arg description +msgid "print the status of running safeeyes instance and exit" +msgstr "print the status of running safeeyes instance and exit" + +# Status message +msgid "Safe Eyes is not running" +msgstr "Safe Eyes is not running" + # About dialog msgid "Close" msgstr "Close" diff --git a/safeeyes/config/locale/es/LC_MESSAGES/safeeyes.po b/safeeyes/config/locale/es/LC_MESSAGES/safeeyes.po index f2797e6..e7928c3 100644 --- a/safeeyes/config/locale/es/LC_MESSAGES/safeeyes.po +++ b/safeeyes/config/locale/es/LC_MESSAGES/safeeyes.po @@ -77,6 +77,14 @@ msgstr "muestra dialogo de configuraciones" msgid "start safeeyes in debug mode" msgstr "iniciar safeeyes en modo de depuración" +# Commandline arg description +msgid "print the status of running safeeyes instance and exit" +msgstr "" + +# Status message +msgid "Safe Eyes is not running" +msgstr "" + # About dialog msgid "Close" msgstr "Cerrar" diff --git a/safeeyes/config/locale/et/LC_MESSAGES/safeeyes.po b/safeeyes/config/locale/et/LC_MESSAGES/safeeyes.po index 27e912d..5fb0488 100644 --- a/safeeyes/config/locale/et/LC_MESSAGES/safeeyes.po +++ b/safeeyes/config/locale/et/LC_MESSAGES/safeeyes.po @@ -8,8 +8,8 @@ msgstr "" "POT-Creation-Date: \n" "PO-Revision-Date: 2017-11-20 20:46+0000\n" "Last-Translator: Kristjan Räts \n" -"Language-Team: Estonian \n" +"Language-Team: Estonian \n" "Language: et\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -77,6 +77,14 @@ msgstr "kuva seadete aken" msgid "start safeeyes in debug mode" msgstr "käivita veatuvastuse režiimis" +# Commandline arg description +msgid "print the status of running safeeyes instance and exit" +msgstr "" + +# Status message +msgid "Safe Eyes is not running" +msgstr "" + # About dialog msgid "Close" msgstr "Sulge" @@ -302,8 +310,7 @@ msgstr "Kohandatud ekraanisäästja käsk" # plugin/screensaver msgid "Minimum seconds to skip without screensaver" -msgstr "" -"Kui mitme sekundi jooksul saab ekraanisäästja käivitamist vahele jätta" +msgstr "Kui mitme sekundi jooksul saab ekraanisäästja käivitamist vahele jätta" # plugin/smartpause msgid "Smart Pause" @@ -315,8 +322,7 @@ msgstr "Süsteemi jõudeoleku ajal programmi peatamine" # plugin/smartpause msgid "Minimum idle time to pause Safe Eyes (in seconds)" -msgstr "" -"Minimaalne süsteemi jõudeoleku aeg programmi peatamiseks (sekundites)" +msgstr "Minimaalne süsteemi jõudeoleku aeg programmi peatamiseks (sekundites)" # plugin/smartpause msgid "Interpret idle time equivalent to upcoming break duration as a break" diff --git a/safeeyes/config/locale/fa/LC_MESSAGES/safeeyes.po b/safeeyes/config/locale/fa/LC_MESSAGES/safeeyes.po index eee4350..eb1f03d 100644 --- a/safeeyes/config/locale/fa/LC_MESSAGES/safeeyes.po +++ b/safeeyes/config/locale/fa/LC_MESSAGES/safeeyes.po @@ -8,8 +8,8 @@ msgstr "" "POT-Creation-Date: \n" "PO-Revision-Date: 2017-11-03 06:48+0000\n" "Last-Translator: Misagh \n" -"Language-Team: Persian \n" +"Language-Team: Persian \n" "Language: fa\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -77,6 +77,14 @@ msgstr "نشان دادن پنجره تنظیمات" msgid "start safeeyes in debug mode" msgstr "اجرا کردن safeeyes در حالت دیباگ" +# Commandline arg description +msgid "print the status of running safeeyes instance and exit" +msgstr "" + +# Status message +msgid "Safe Eyes is not running" +msgstr "" + # About dialog msgid "Close" msgstr "بستن" diff --git a/safeeyes/config/locale/fr/LC_MESSAGES/safeeyes.po b/safeeyes/config/locale/fr/LC_MESSAGES/safeeyes.po index 52a63ef..04e27ae 100644 --- a/safeeyes/config/locale/fr/LC_MESSAGES/safeeyes.po +++ b/safeeyes/config/locale/fr/LC_MESSAGES/safeeyes.po @@ -8,8 +8,8 @@ msgstr "" "POT-Creation-Date: \n" "PO-Revision-Date: 2017-11-05 11:46+0000\n" "Last-Translator: French Coordinator \n" -"Language-Team: French \n" +"Language-Team: French \n" "Language: fr\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -77,6 +77,14 @@ msgstr "afficher la boîte de dialogue des paramètres" msgid "start safeeyes in debug mode" msgstr "démarrer safeeyes en mode de débogage" +# Commandline arg description +msgid "print the status of running safeeyes instance and exit" +msgstr "" + +# Status message +msgid "Safe Eyes is not running" +msgstr "" + # About dialog msgid "Close" msgstr "Fermer" diff --git a/safeeyes/config/locale/hi/LC_MESSAGES/safeeyes.po b/safeeyes/config/locale/hi/LC_MESSAGES/safeeyes.po index ca76b2d..3b2f46c 100644 --- a/safeeyes/config/locale/hi/LC_MESSAGES/safeeyes.po +++ b/safeeyes/config/locale/hi/LC_MESSAGES/safeeyes.po @@ -76,6 +76,14 @@ msgstr "" msgid "start safeeyes in debug mode" msgstr "" +# Commandline arg description +msgid "print the status of running safeeyes instance and exit" +msgstr "" + +# Status message +msgid "Safe Eyes is not running" +msgstr "" + # About dialog msgid "Close" msgstr "" diff --git a/safeeyes/config/locale/hu/LC_MESSAGES/safeeyes.po b/safeeyes/config/locale/hu/LC_MESSAGES/safeeyes.po index 925a6f1..d967668 100644 --- a/safeeyes/config/locale/hu/LC_MESSAGES/safeeyes.po +++ b/safeeyes/config/locale/hu/LC_MESSAGES/safeeyes.po @@ -77,6 +77,14 @@ msgstr "mutasd a beállítások dialógust" msgid "start safeeyes in debug mode" msgstr "Indítsd a SafeEyes-t debug módban" +# Commandline arg description +msgid "print the status of running safeeyes instance and exit" +msgstr "" + +# Status message +msgid "Safe Eyes is not running" +msgstr "" + # About dialog msgid "Close" msgstr "Bezárás" diff --git a/safeeyes/config/locale/id/LC_MESSAGES/safeeyes.po b/safeeyes/config/locale/id/LC_MESSAGES/safeeyes.po index 9083f1e..7808fb6 100644 --- a/safeeyes/config/locale/id/LC_MESSAGES/safeeyes.po +++ b/safeeyes/config/locale/id/LC_MESSAGES/safeeyes.po @@ -76,6 +76,14 @@ msgstr "" msgid "start safeeyes in debug mode" msgstr "" +# Commandline arg description +msgid "print the status of running safeeyes instance and exit" +msgstr "" + +# Status message +msgid "Safe Eyes is not running" +msgstr "" + # About dialog msgid "Close" msgstr "" diff --git a/safeeyes/config/locale/it/LC_MESSAGES/safeeyes.po b/safeeyes/config/locale/it/LC_MESSAGES/safeeyes.po index 949a3f4..f5dbaa8 100644 --- a/safeeyes/config/locale/it/LC_MESSAGES/safeeyes.po +++ b/safeeyes/config/locale/it/LC_MESSAGES/safeeyes.po @@ -8,8 +8,8 @@ msgstr "" "POT-Creation-Date: \n" "PO-Revision-Date: 2017-10-18 08:44+0000\n" "Last-Translator: Guglielmo Wilmup \n" -"Language-Team: Italian \n" +"Language-Team: Italian \n" "Language: it\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -77,6 +77,14 @@ msgstr "mostra la finestra delle preferenze" msgid "start safeeyes in debug mode" msgstr "avvia Safe Eyes in modalità debug" +# Commandline arg description +msgid "print the status of running safeeyes instance and exit" +msgstr "" + +# Status message +msgid "Safe Eyes is not running" +msgstr "" + # About dialog msgid "Close" msgstr "Esci" diff --git a/safeeyes/config/locale/mk/LC_MESSAGES/safeeyes.po b/safeeyes/config/locale/mk/LC_MESSAGES/safeeyes.po index a438041..cd0dc98 100644 --- a/safeeyes/config/locale/mk/LC_MESSAGES/safeeyes.po +++ b/safeeyes/config/locale/mk/LC_MESSAGES/safeeyes.po @@ -77,6 +77,14 @@ msgstr "" msgid "start safeeyes in debug mode" msgstr "" +# Commandline arg description +msgid "print the status of running safeeyes instance and exit" +msgstr "" + +# Status message +msgid "Safe Eyes is not running" +msgstr "" + # About dialog msgid "Close" msgstr "" diff --git a/safeeyes/config/locale/nb/LC_MESSAGES/safeeyes.po b/safeeyes/config/locale/nb/LC_MESSAGES/safeeyes.po index 724b6de..08b46fa 100644 --- a/safeeyes/config/locale/nb/LC_MESSAGES/safeeyes.po +++ b/safeeyes/config/locale/nb/LC_MESSAGES/safeeyes.po @@ -58,7 +58,6 @@ msgid "show the about dialog" msgstr "vis \"Om\"-dialogvinduet" # Commandline arg description -#, fuzzy msgid "disable the currently running safeeyes instance" msgstr "skru av det kjørende Øyetrygg-programmet" @@ -78,6 +77,14 @@ msgstr "vis innstillingsdialogvinduet" msgid "start safeeyes in debug mode" msgstr "start Øyetrygg i feilrettingsmodus" +# Commandline arg description +msgid "print the status of running safeeyes instance and exit" +msgstr "" + +# Status message +msgid "Safe Eyes is not running" +msgstr "" + # About dialog msgid "Close" msgstr "Luk" @@ -112,7 +119,6 @@ msgid "Time to prepare for a break (in seconds)" msgstr "Tid til forberedelse av pause (i sekunder)" # Settings dialog -#, fuzzy msgid "Keyboard shortcuts disabled period (in seconds)" msgstr "Tastatursnarveier avskrudd i periode (i sekunder)" @@ -129,7 +135,6 @@ msgid "Allow postponing breaks" msgstr "Tillat utsettelse av pauser" # Settings dialog -#, fuzzy msgid "Persist the internal state" msgstr "Fortsett i inngangstilstand" @@ -254,7 +259,6 @@ msgid "Skip the break if the active window is in fullscreen mode" msgstr "Hopp over pause hvis det aktive vinduet er i fullskjermsmodus" # plugin/donotdisturb -#, fuzzy msgid "Do not interrupt these windows anytime" msgstr "Ikke forstyrr disse vinduene noensinne" @@ -315,7 +319,6 @@ msgid "Pause Safe Eyes if the system is idle" msgstr "Sett Øyetrygg på pause hvis systemet er ledig" # plugin/smartpause -#, fuzzy msgid "Minimum idle time to pause Safe Eyes (in seconds)" msgstr "Minimal lediggang å pause Øyetrygg etter (i sekunder)" diff --git a/safeeyes/config/locale/nl/LC_MESSAGES/safeeyes.po b/safeeyes/config/locale/nl/LC_MESSAGES/safeeyes.po index 62da721..e98cd6f 100644 --- a/safeeyes/config/locale/nl/LC_MESSAGES/safeeyes.po +++ b/safeeyes/config/locale/nl/LC_MESSAGES/safeeyes.po @@ -8,8 +8,8 @@ msgstr "" "POT-Creation-Date: \n" "PO-Revision-Date: 2018-01-04 11:46+0000\n" "Last-Translator: Heimen Stoffels \n" -"Language-Team: Dutch \n" +"Language-Team: Dutch \n" "Language: nl\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -77,6 +77,14 @@ msgstr "het instellingen-dialoogvenster weergeven" msgid "start safeeyes in debug mode" msgstr "safeeyes opstart in foutopsporingsmodus" +# Commandline arg description +msgid "print the status of running safeeyes instance and exit" +msgstr "" + +# Status message +msgid "Safe Eyes is not running" +msgstr "" + # About dialog msgid "Close" msgstr "Sluiten" diff --git a/safeeyes/config/locale/pl/LC_MESSAGES/safeeyes.po b/safeeyes/config/locale/pl/LC_MESSAGES/safeeyes.po index b34e203..5cf439c 100644 --- a/safeeyes/config/locale/pl/LC_MESSAGES/safeeyes.po +++ b/safeeyes/config/locale/pl/LC_MESSAGES/safeeyes.po @@ -8,8 +8,8 @@ msgstr "" "POT-Creation-Date: \n" "PO-Revision-Date: 2017-12-06 19:48+0000\n" "Last-Translator: Wojciech \n" -"Language-Team: Polish \n" +"Language-Team: Polish \n" "Language: pl\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -78,6 +78,14 @@ msgstr "pokaż okno dialogowe ustawień" msgid "start safeeyes in debug mode" msgstr "uruchom safeeyes w trybie debugowania" +# Commandline arg description +msgid "print the status of running safeeyes instance and exit" +msgstr "" + +# Status message +msgid "Safe Eyes is not running" +msgstr "" + # About dialog msgid "Close" msgstr "Zamknij" diff --git a/safeeyes/config/locale/pt/LC_MESSAGES/safeeyes.po b/safeeyes/config/locale/pt/LC_MESSAGES/safeeyes.po index 2865bce..6f8e248 100644 --- a/safeeyes/config/locale/pt/LC_MESSAGES/safeeyes.po +++ b/safeeyes/config/locale/pt/LC_MESSAGES/safeeyes.po @@ -8,8 +8,8 @@ msgstr "" "POT-Creation-Date: \n" "PO-Revision-Date: 2017-10-28 07:15+0000\n" "Last-Translator: Romulo do Vale \n" -"Language-Team: Portuguese \n" +"Language-Team: Portuguese \n" "Language: pt\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -77,6 +77,14 @@ msgstr "mostrar a janela de configuração" msgid "start safeeyes in debug mode" msgstr "iniciar o safeeyes em modo de debug" +# Commandline arg description +msgid "print the status of running safeeyes instance and exit" +msgstr "" + +# Status message +msgid "Safe Eyes is not running" +msgstr "" + # About dialog msgid "Close" msgstr "Fechar" @@ -219,7 +227,6 @@ msgid "Please install the command-line tool '%s'" msgstr "Por favor instale a ferramenta de linha de comando '%s'" # Settings dialog -#, fuzzy msgid "Please add the resource %(resource)s to %(config_resource)s directory" msgstr "" "Por favor, adicione o recurso %(resource)s para %(config_resources)s pasta" diff --git a/safeeyes/config/locale/ru/LC_MESSAGES/safeeyes.po b/safeeyes/config/locale/ru/LC_MESSAGES/safeeyes.po index 36837f6..6b31e7d 100644 --- a/safeeyes/config/locale/ru/LC_MESSAGES/safeeyes.po +++ b/safeeyes/config/locale/ru/LC_MESSAGES/safeeyes.po @@ -8,14 +8,14 @@ msgstr "" "POT-Creation-Date: \n" "PO-Revision-Date: 2017-11-21 17:41+0000\n" "Last-Translator: Duncan \n" -"Language-Team: Russian \n" +"Language-Team: Russian \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.18-dev\n" # Short break @@ -78,6 +78,14 @@ msgstr "Настройки" msgid "start safeeyes in debug mode" msgstr "Запустить Safe Eyes в режиме отладки" +# Commandline arg description +msgid "print the status of running safeeyes instance and exit" +msgstr "" + +# Status message +msgid "Safe Eyes is not running" +msgstr "" + # About dialog msgid "Close" msgstr "Закрыть" diff --git a/safeeyes/config/locale/safeeyes.pot b/safeeyes/config/locale/safeeyes.pot index 95eabf7..df81ab0 100644 --- a/safeeyes/config/locale/safeeyes.pot +++ b/safeeyes/config/locale/safeeyes.pot @@ -65,6 +65,14 @@ msgstr "" msgid "start safeeyes in debug mode" msgstr "" +# Commandline arg description +msgid "print the status of running safeeyes instance and exit" +msgstr "" + +# Status message +msgid "Safe Eyes is not running" +msgstr "" + # About dialog msgid "Close" msgstr "" diff --git a/safeeyes/config/locale/sk/LC_MESSAGES/safeeyes.po b/safeeyes/config/locale/sk/LC_MESSAGES/safeeyes.po index a0345b3..dadc8a3 100644 --- a/safeeyes/config/locale/sk/LC_MESSAGES/safeeyes.po +++ b/safeeyes/config/locale/sk/LC_MESSAGES/safeeyes.po @@ -8,8 +8,8 @@ msgstr "" "POT-Creation-Date: \n" "PO-Revision-Date: 2017-10-13 17:55+0000\n" "Last-Translator: Radek Sprta \n" -"Language-Team: Slovak \n" +"Language-Team: Slovak \n" "Language: sk\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -77,6 +77,14 @@ msgstr "zobraziť dialog nastavenie" msgid "start safeeyes in debug mode" msgstr "spustiť safeeyes v móde pre ladenie" +# Commandline arg description +msgid "print the status of running safeeyes instance and exit" +msgstr "" + +# Status message +msgid "Safe Eyes is not running" +msgstr "" + # About dialog msgid "Close" msgstr "Zavrieť" diff --git a/safeeyes/config/locale/sv/LC_MESSAGES/safeeyes.po b/safeeyes/config/locale/sv/LC_MESSAGES/safeeyes.po index d34a30d..d9f566f 100644 --- a/safeeyes/config/locale/sv/LC_MESSAGES/safeeyes.po +++ b/safeeyes/config/locale/sv/LC_MESSAGES/safeeyes.po @@ -7,14 +7,14 @@ msgstr "" "Project-Id-Version: \n" "POT-Creation-Date: \n" "PO-Revision-Date: \n" +"Last-Translator: \n" "Language-Team: \n" +"Language: sv\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: sv\n" # Short break msgid "Tightly close your eyes" @@ -76,6 +76,14 @@ msgstr "" msgid "start safeeyes in debug mode" msgstr "" +# Commandline arg description +msgid "print the status of running safeeyes instance and exit" +msgstr "" + +# Status message +msgid "Safe Eyes is not running" +msgstr "" + # About dialog msgid "Close" msgstr "" diff --git a/safeeyes/config/locale/ta/LC_MESSAGES/safeeyes.po b/safeeyes/config/locale/ta/LC_MESSAGES/safeeyes.po index af909f5..c33782f 100644 --- a/safeeyes/config/locale/ta/LC_MESSAGES/safeeyes.po +++ b/safeeyes/config/locale/ta/LC_MESSAGES/safeeyes.po @@ -78,6 +78,14 @@ msgstr "அமைப்புகள் சாளரத்தை காண்ப msgid "start safeeyes in debug mode" msgstr "வழு நீக்கும் முறையில் Safe Eyes ஐ ஆரம்பிக்குக" +# Commandline arg description +msgid "print the status of running safeeyes instance and exit" +msgstr "இயங்கும் Safe Eyes நிலையை காண்பித்து வெளியேறுக" + +# Status message +msgid "Safe Eyes is not running" +msgstr "Safe Eyes தற்போது இயங்கவில்லை" + # About dialog msgid "Close" msgstr "மூடு" diff --git a/safeeyes/config/locale/tr/LC_MESSAGES/safeeyes.po b/safeeyes/config/locale/tr/LC_MESSAGES/safeeyes.po index 86473b3..8fa46c0 100644 --- a/safeeyes/config/locale/tr/LC_MESSAGES/safeeyes.po +++ b/safeeyes/config/locale/tr/LC_MESSAGES/safeeyes.po @@ -8,8 +8,8 @@ msgstr "" "POT-Creation-Date: \n" "PO-Revision-Date: 2017-10-17 21:48+0000\n" "Last-Translator: Musa Serdar ARSLAN \n" -"Language-Team: Turkish \n" +"Language-Team: Turkish \n" "Language: tr\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -77,6 +77,14 @@ msgstr "ayarlar penceresini göster" msgid "start safeeyes in debug mode" msgstr "safeeyes'ı hata ayıklama kipinde başlat" +# Commandline arg description +msgid "print the status of running safeeyes instance and exit" +msgstr "" + +# Status message +msgid "Safe Eyes is not running" +msgstr "" + # About dialog msgid "Close" msgstr "Kapat" diff --git a/safeeyes/config/locale/uk/LC_MESSAGES/safeeyes.po b/safeeyes/config/locale/uk/LC_MESSAGES/safeeyes.po index 9247fe7..e678e86 100644 --- a/safeeyes/config/locale/uk/LC_MESSAGES/safeeyes.po +++ b/safeeyes/config/locale/uk/LC_MESSAGES/safeeyes.po @@ -8,14 +8,14 @@ msgstr "" "POT-Creation-Date: \n" "PO-Revision-Date: 2018-01-24 12:34+0000\n" "Last-Translator: Марс Ямбар \n" -"Language-Team: Ukrainian \n" +"Language-Team: Ukrainian \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.19-dev\n" # Short break @@ -78,6 +78,14 @@ msgstr "" msgid "start safeeyes in debug mode" msgstr "" +# Commandline arg description +msgid "print the status of running safeeyes instance and exit" +msgstr "" + +# Status message +msgid "Safe Eyes is not running" +msgstr "" + # About dialog msgid "Close" msgstr "" diff --git a/safeeyes/config/locale/vi/LC_MESSAGES/safeeyes.po b/safeeyes/config/locale/vi/LC_MESSAGES/safeeyes.po index 031ae64..8c214b6 100644 --- a/safeeyes/config/locale/vi/LC_MESSAGES/safeeyes.po +++ b/safeeyes/config/locale/vi/LC_MESSAGES/safeeyes.po @@ -8,8 +8,8 @@ msgstr "" "POT-Creation-Date: \n" "PO-Revision-Date: 2017-10-28 07:14+0000\n" "Last-Translator: giappi \n" -"Language-Team: Vietnamese \n" +"Language-Team: Vietnamese \n" "Language: vi\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -77,6 +77,14 @@ msgstr "Hiện hộp thoại cài đặt" msgid "start safeeyes in debug mode" msgstr "Chạy Safe Eyes trong chế độ gỡ rối" +# Commandline arg description +msgid "print the status of running safeeyes instance and exit" +msgstr "" + +# Status message +msgid "Safe Eyes is not running" +msgstr "" + # About dialog msgid "Close" msgstr "Đóng" @@ -251,7 +259,8 @@ msgstr "Không Làm Phiền" # plugin/donotdisturb msgid "Skip the break if the active window is in fullscreen mode" -msgstr "Bỏ qua lần nghỉ nếu như cửa sổ hiện tại đang trong chế độ toàn màn hình" +msgstr "" +"Bỏ qua lần nghỉ nếu như cửa sổ hiện tại đang trong chế độ toàn màn hình" # plugin/donotdisturb msgid "Do not interrupt these windows anytime" diff --git a/safeeyes/config/locale/zh_CN/LC_MESSAGES/safeeyes.po b/safeeyes/config/locale/zh_CN/LC_MESSAGES/safeeyes.po index e36424e..faea9d5 100644 --- a/safeeyes/config/locale/zh_CN/LC_MESSAGES/safeeyes.po +++ b/safeeyes/config/locale/zh_CN/LC_MESSAGES/safeeyes.po @@ -8,8 +8,8 @@ msgstr "" "POT-Creation-Date: \n" "PO-Revision-Date: 2017-11-15 08:59+0000\n" "Last-Translator: 庞伟浩 \n" -"Language-Team: Chinese (Simplified) \n" +"Language-Team: Chinese (Simplified) \n" "Language: zh_CN\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -77,6 +77,14 @@ msgstr "显示“设置”对话框" msgid "start safeeyes in debug mode" msgstr "以调试模式运行Safeeyes" +# Commandline arg description +msgid "print the status of running safeeyes instance and exit" +msgstr "" + +# Status message +msgid "Safe Eyes is not running" +msgstr "" + # About dialog msgid "Close" msgstr "关闭" diff --git a/safeeyes/config/locale/zh_TW/LC_MESSAGES/safeeyes.po b/safeeyes/config/locale/zh_TW/LC_MESSAGES/safeeyes.po index 0a654cb..52d94e1 100644 --- a/safeeyes/config/locale/zh_TW/LC_MESSAGES/safeeyes.po +++ b/safeeyes/config/locale/zh_TW/LC_MESSAGES/safeeyes.po @@ -7,14 +7,14 @@ msgstr "" "Project-Id-Version: \n" "POT-Creation-Date: \n" "PO-Revision-Date: \n" +"Last-Translator: \n" "Language-Team: \n" +"Language: zh_TW\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: zh_TW\n" # Short break msgid "Tightly close your eyes" @@ -76,6 +76,14 @@ msgstr "" msgid "start safeeyes in debug mode" msgstr "" +# Commandline arg description +msgid "print the status of running safeeyes instance and exit" +msgstr "" + +# Status message +msgid "Safe Eyes is not running" +msgstr "" + # About dialog msgid "Close" msgstr "" diff --git a/safeeyes/plugins/trayicon/plugin.py b/safeeyes/plugins/trayicon/plugin.py index d0497b1..69fdb5b 100644 --- a/safeeyes/plugins/trayicon/plugin.py +++ b/safeeyes/plugins/trayicon/plugin.py @@ -289,16 +289,19 @@ class TrayIcon(object): # active = self.item_enable.get_active() if self.active and len(args) > 1: self.disable_ui() - self.on_disable() 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(_('Disabled until restart')) + 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) - self.item_info.set_label(_('Disabled until %s') % Utility.format_time(self.wakeup_time)) def lock_menu(self): """ diff --git a/safeeyes/rpc.py b/safeeyes/rpc.py index dc040b6..07c6ab8 100644 --- a/safeeyes/rpc.py +++ b/safeeyes/rpc.py @@ -39,6 +39,7 @@ class RPCServer(object): self.__server.register_function(context['api']['enable_safeeyes'], 'enable_safeeyes') self.__server.register_function(context['api']['disable_safeeyes'], 'disable_safeeyes') self.__server.register_function(context['api']['take_break'], 'take_break') + self.__server.register_function(context['api']['status'], 'status') self.__server.register_function(context['api']['quit'], 'quit') def start(self): @@ -91,7 +92,7 @@ class RPCClient(object): """ Disable Safe Eyes. """ - self.proxy.disable_safeeyes() + self.proxy.disable_safeeyes(None) def take_break(self): """ @@ -99,6 +100,12 @@ class RPCClient(object): """ self.proxy.take_break() + def status(self): + """ + Return the status of Safe Eyes + """ + return self.proxy.status() + def quit(self): """ Quit Safe Eyes.