diff --git a/safeeyes/Utility.py b/safeeyes/Utility.py index 6ea5868..c929772 100644 --- a/safeeyes/Utility.py +++ b/safeeyes/Utility.py @@ -317,8 +317,8 @@ def initialize_safeeyes(): style_dir_path = os.path.join(HOME_DIRECTORY, '.config/safeeyes/style') startup_dir_path = os.path.join(HOME_DIRECTORY, '.config/autostart') - # Remove the ~/.config/safeeyes directory - delete(os.path.join(CONFIG_DIRECTORY, 'safeeyes.json')) + # Remove the ~/.config/safeeyes/safeeyes.json file + delete(CONFIG_FILE_PATH) # Remove the startup file delete(os.path.join(HOME_DIRECTORY, os.path.join( @@ -343,6 +343,13 @@ def initialize_safeeyes(): shutil.copy2(SYSTEM_STYLE_SHEET_PATH, STYLE_SHEET_PATH) +def reset_config(): + # Remove the ~/.config/safeeyes/safeeyes.json file + delete(CONFIG_FILE_PATH) + + # Copy the safeeyes.json + shutil.copy2(SYSTEM_CONFIG_FILE_PATH, CONFIG_FILE_PATH) + def replace_style_sheet(): """ Replace the user style sheet by system style sheet. diff --git a/safeeyes/config/locale/ar/LC_MESSAGES/safeeyes.po b/safeeyes/config/locale/ar/LC_MESSAGES/safeeyes.po index 45441cd..78eec5d 100644 --- a/safeeyes/config/locale/ar/LC_MESSAGES/safeeyes.po +++ b/safeeyes/config/locale/ar/LC_MESSAGES/safeeyes.po @@ -143,6 +143,14 @@ msgstr "ثبّت الحالة الداخلية" msgid "Long break interval must be a multiple of short break interval" msgstr "الاستراحات الطويلة يجب أن تكون من مضاعفات مدة الاستراحات القصيرة" +# Settings dialog +msgid "Reset" +msgstr "" + +# Settings dialog +msgid "Are you sure you want to reset all settings to default?" +msgstr "" + # Settings dialog msgid "Options" msgstr "خيارات" diff --git a/safeeyes/config/locale/bg/LC_MESSAGES/safeeyes.po b/safeeyes/config/locale/bg/LC_MESSAGES/safeeyes.po index f4bd562..5d88435 100644 --- a/safeeyes/config/locale/bg/LC_MESSAGES/safeeyes.po +++ b/safeeyes/config/locale/bg/LC_MESSAGES/safeeyes.po @@ -141,6 +141,14 @@ msgstr "" msgid "Long break interval must be a multiple of short break interval" msgstr "" +# Settings dialog +msgid "Reset" +msgstr "" + +# Settings dialog +msgid "Are you sure you want to reset all settings to default?" +msgstr "" + # Settings dialog msgid "Options" msgstr "" diff --git a/safeeyes/config/locale/ca/LC_MESSAGES/safeeyes.po b/safeeyes/config/locale/ca/LC_MESSAGES/safeeyes.po index fdcf89b..a0c8f21 100644 --- a/safeeyes/config/locale/ca/LC_MESSAGES/safeeyes.po +++ b/safeeyes/config/locale/ca/LC_MESSAGES/safeeyes.po @@ -145,6 +145,14 @@ msgstr "" msgid "Long break interval must be a multiple of short break interval" msgstr "" +# Settings dialog +msgid "Reset" +msgstr "" + +# Settings dialog +msgid "Are you sure you want to reset all settings to default?" +msgstr "" + # Settings dialog msgid "Options" msgstr "" diff --git a/safeeyes/config/locale/cs/LC_MESSAGES/safeeyes.po b/safeeyes/config/locale/cs/LC_MESSAGES/safeeyes.po index e2ae2e0..c8e171f 100644 --- a/safeeyes/config/locale/cs/LC_MESSAGES/safeeyes.po +++ b/safeeyes/config/locale/cs/LC_MESSAGES/safeeyes.po @@ -144,6 +144,14 @@ msgstr "Zachovat vnitřní stav" msgid "Long break interval must be a multiple of short break interval" msgstr "Je třeba, aby dlouhé přestávky byly násobkem krátkých přestávek" +# Settings dialog +msgid "Reset" +msgstr "" + +# Settings dialog +msgid "Are you sure you want to reset all settings to default?" +msgstr "" + # Settings dialog msgid "Options" msgstr "Možnosti" diff --git a/safeeyes/config/locale/da/LC_MESSAGES/safeeyes.po b/safeeyes/config/locale/da/LC_MESSAGES/safeeyes.po index ff31768..773d28a 100644 --- a/safeeyes/config/locale/da/LC_MESSAGES/safeeyes.po +++ b/safeeyes/config/locale/da/LC_MESSAGES/safeeyes.po @@ -143,6 +143,14 @@ msgid "Long break interval must be a multiple of short break interval" msgstr "" "Tiden for en lang pause skal være et multiplum af tiden for en kort pause" +# Settings dialog +msgid "Reset" +msgstr "" + +# Settings dialog +msgid "Are you sure you want to reset all settings to default?" +msgstr "" + # Settings dialog msgid "Options" msgstr "Indstillinger" @@ -340,7 +348,6 @@ msgid "Minimum seconds to skip without screensaver" msgstr "Mindste antal sekunder for at springe over uden pauseskærm" # plugin/screensaver -#, fuzzy msgid "Lock screen" msgstr "Lås skærm" diff --git a/safeeyes/config/locale/de/LC_MESSAGES/safeeyes.po b/safeeyes/config/locale/de/LC_MESSAGES/safeeyes.po index 5e3d17d..a5331b1 100644 --- a/safeeyes/config/locale/de/LC_MESSAGES/safeeyes.po +++ b/safeeyes/config/locale/de/LC_MESSAGES/safeeyes.po @@ -144,6 +144,14 @@ msgstr "Internen Zustand persistieren" msgid "Long break interval must be a multiple of short break interval" msgstr "Lange Pausen müssen ein Vielfaches von kurzen Pausen lang dauern" +# Settings dialog +msgid "Reset" +msgstr "" + +# Settings dialog +msgid "Are you sure you want to reset all settings to default?" +msgstr "" + # Settings dialog msgid "Options" msgstr "Einstellungen" diff --git a/safeeyes/config/locale/en_US/LC_MESSAGES/safeeyes.po b/safeeyes/config/locale/en_US/LC_MESSAGES/safeeyes.po index e92ef0b..6ca45ea 100644 --- a/safeeyes/config/locale/en_US/LC_MESSAGES/safeeyes.po +++ b/safeeyes/config/locale/en_US/LC_MESSAGES/safeeyes.po @@ -145,6 +145,14 @@ msgstr "Persist the internal state" msgid "Long break interval must be a multiple of short break interval" msgstr "Long break interval must be a multiple of short break interval" +# Settings dialog +msgid "Reset" +msgstr "" + +# Settings dialog +msgid "Are you sure you want to reset all settings to default?" +msgstr "Are you sure you want to delete this break?" + # Settings dialog msgid "Options" msgstr "Options" diff --git a/safeeyes/config/locale/es/LC_MESSAGES/safeeyes.po b/safeeyes/config/locale/es/LC_MESSAGES/safeeyes.po index 25b23d3..e754ea8 100644 --- a/safeeyes/config/locale/es/LC_MESSAGES/safeeyes.po +++ b/safeeyes/config/locale/es/LC_MESSAGES/safeeyes.po @@ -144,6 +144,14 @@ msgstr "" msgid "Long break interval must be a multiple of short break interval" msgstr "" +# Settings dialog +msgid "Reset" +msgstr "" + +# Settings dialog +msgid "Are you sure you want to reset all settings to default?" +msgstr "" + # Settings dialog msgid "Options" msgstr "Opciones" diff --git a/safeeyes/config/locale/et/LC_MESSAGES/safeeyes.po b/safeeyes/config/locale/et/LC_MESSAGES/safeeyes.po index db282be..967f918 100644 --- a/safeeyes/config/locale/et/LC_MESSAGES/safeeyes.po +++ b/safeeyes/config/locale/et/LC_MESSAGES/safeeyes.po @@ -144,6 +144,14 @@ msgstr "Sisemise seisundi säilitamine" msgid "Long break interval must be a multiple of short break interval" msgstr "Pika pausi intervall peab olema lühikese pausi pikkuse kordne" +# Settings dialog +msgid "Reset" +msgstr "" + +# Settings dialog +msgid "Are you sure you want to reset all settings to default?" +msgstr "" + # Settings dialog msgid "Options" msgstr "Valikud" diff --git a/safeeyes/config/locale/fa/LC_MESSAGES/safeeyes.po b/safeeyes/config/locale/fa/LC_MESSAGES/safeeyes.po index b4583bc..c4b2c68 100644 --- a/safeeyes/config/locale/fa/LC_MESSAGES/safeeyes.po +++ b/safeeyes/config/locale/fa/LC_MESSAGES/safeeyes.po @@ -144,6 +144,14 @@ msgstr "" msgid "Long break interval must be a multiple of short break interval" msgstr "" +# Settings dialog +msgid "Reset" +msgstr "" + +# Settings dialog +msgid "Are you sure you want to reset all settings to default?" +msgstr "" + # Settings dialog msgid "Options" msgstr "" diff --git a/safeeyes/config/locale/fr/LC_MESSAGES/safeeyes.po b/safeeyes/config/locale/fr/LC_MESSAGES/safeeyes.po index e50ee11..0323a97 100644 --- a/safeeyes/config/locale/fr/LC_MESSAGES/safeeyes.po +++ b/safeeyes/config/locale/fr/LC_MESSAGES/safeeyes.po @@ -147,6 +147,14 @@ msgstr "" "L’intervalle entre les pauses longues doit être un multiple de l’intervalle " "entre les pauses courtes" +# Settings dialog +msgid "Reset" +msgstr "" + +# Settings dialog +msgid "Are you sure you want to reset all settings to default?" +msgstr "" + # Settings dialog msgid "Options" msgstr "Options" diff --git a/safeeyes/config/locale/hi/LC_MESSAGES/safeeyes.po b/safeeyes/config/locale/hi/LC_MESSAGES/safeeyes.po index 7e6a453..7d6a108 100644 --- a/safeeyes/config/locale/hi/LC_MESSAGES/safeeyes.po +++ b/safeeyes/config/locale/hi/LC_MESSAGES/safeeyes.po @@ -142,6 +142,14 @@ msgstr "आंतरिक अवस्था को जारी रखें" msgid "Long break interval must be a multiple of short break interval" msgstr "लम्बी ब्रेक अंतराल लघु ब्रेक अंतराल के एक बहुमान होना चाहिए" +# Settings dialog +msgid "Reset" +msgstr "" + +# Settings dialog +msgid "Are you sure you want to reset all settings to default?" +msgstr "" + # Settings dialog msgid "Options" msgstr "विकल्प" diff --git a/safeeyes/config/locale/hu/LC_MESSAGES/safeeyes.po b/safeeyes/config/locale/hu/LC_MESSAGES/safeeyes.po index e681312..78f1ee9 100644 --- a/safeeyes/config/locale/hu/LC_MESSAGES/safeeyes.po +++ b/safeeyes/config/locale/hu/LC_MESSAGES/safeeyes.po @@ -142,6 +142,14 @@ msgstr "Belső állapot elmentése" msgid "Long break interval must be a multiple of short break interval" msgstr "Hosszú pihenő fel kell legyen bontva több kicsire" +# Settings dialog +msgid "Reset" +msgstr "" + +# Settings dialog +msgid "Are you sure you want to reset all settings to default?" +msgstr "" + # Settings dialog msgid "Options" msgstr "Opciók" diff --git a/safeeyes/config/locale/id/LC_MESSAGES/safeeyes.po b/safeeyes/config/locale/id/LC_MESSAGES/safeeyes.po index 2c5931c..5a10ced 100644 --- a/safeeyes/config/locale/id/LC_MESSAGES/safeeyes.po +++ b/safeeyes/config/locale/id/LC_MESSAGES/safeeyes.po @@ -141,6 +141,14 @@ msgstr "" msgid "Long break interval must be a multiple of short break interval" msgstr "" +# Settings dialog +msgid "Reset" +msgstr "" + +# Settings dialog +msgid "Are you sure you want to reset all settings to default?" +msgstr "" + # Settings dialog msgid "Options" msgstr "" diff --git a/safeeyes/config/locale/it/LC_MESSAGES/safeeyes.po b/safeeyes/config/locale/it/LC_MESSAGES/safeeyes.po index 3006971..9ecbb0f 100644 --- a/safeeyes/config/locale/it/LC_MESSAGES/safeeyes.po +++ b/safeeyes/config/locale/it/LC_MESSAGES/safeeyes.po @@ -147,6 +147,14 @@ msgstr "" "L'intervallo per la pausa lunga deve essere un multiplo dell'intervallo per " "la pausa breve" +# Settings dialog +msgid "Reset" +msgstr "" + +# Settings dialog +msgid "Are you sure you want to reset all settings to default?" +msgstr "" + # Settings dialog msgid "Options" msgstr "Preferenze" diff --git a/safeeyes/config/locale/lt/LC_MESSAGES/safeeyes.po b/safeeyes/config/locale/lt/LC_MESSAGES/safeeyes.po index 44dc095..9b39d2e 100644 --- a/safeeyes/config/locale/lt/LC_MESSAGES/safeeyes.po +++ b/safeeyes/config/locale/lt/LC_MESSAGES/safeeyes.po @@ -147,6 +147,14 @@ msgid "Long break interval must be a multiple of short break interval" msgstr "" "Ilgos pertraukos laikotarpis turi būti sudarytas iš kelių trumpų pertraukų" +# Settings dialog +msgid "Reset" +msgstr "" + +# Settings dialog +msgid "Are you sure you want to reset all settings to default?" +msgstr "" + # Settings dialog msgid "Options" msgstr "Parametrai" diff --git a/safeeyes/config/locale/mk/LC_MESSAGES/safeeyes.po b/safeeyes/config/locale/mk/LC_MESSAGES/safeeyes.po index 8e44d71..7d344ce 100644 --- a/safeeyes/config/locale/mk/LC_MESSAGES/safeeyes.po +++ b/safeeyes/config/locale/mk/LC_MESSAGES/safeeyes.po @@ -144,6 +144,14 @@ msgstr "" msgid "Long break interval must be a multiple of short break interval" msgstr "" +# Settings dialog +msgid "Reset" +msgstr "" + +# Settings dialog +msgid "Are you sure you want to reset all settings to default?" +msgstr "" + # Settings dialog msgid "Options" msgstr "" diff --git a/safeeyes/config/locale/nb/LC_MESSAGES/safeeyes.po b/safeeyes/config/locale/nb/LC_MESSAGES/safeeyes.po index 68d3b8f..0868fba 100644 --- a/safeeyes/config/locale/nb/LC_MESSAGES/safeeyes.po +++ b/safeeyes/config/locale/nb/LC_MESSAGES/safeeyes.po @@ -8,8 +8,8 @@ msgstr "" "POT-Creation-Date: \n" "PO-Revision-Date: 2019-01-19 13:21+0000\n" "Last-Translator: Allan Nordhøy \n" -"Language-Team: Norwegian Bokmål \n" +"Language-Team: Norwegian Bokmål \n" "Language: nb\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -142,6 +142,14 @@ msgstr "Fortsett i inngangstilstand" msgid "Long break interval must be a multiple of short break interval" msgstr "Tiden mellom lange pauser må være være en inndeling av de små pausene" +# Settings dialog +msgid "Reset" +msgstr "" + +# Settings dialog +msgid "Are you sure you want to reset all settings to default?" +msgstr "" + # Settings dialog msgid "Options" msgstr "Innstillinger" @@ -207,7 +215,6 @@ msgid "Duration" msgstr "Varighet" # Settings dialog -#, fuzzy msgid "Time to wait" msgstr "Tid å vente" @@ -340,7 +347,6 @@ msgid "Minimum seconds to skip without screensaver" msgstr "Minimalt antall sekunder å hoppe over uten skjermsparer" # plugin/screensaver -#, fuzzy msgid "Lock screen" msgstr "Lås skjerm" diff --git a/safeeyes/config/locale/nl/LC_MESSAGES/safeeyes.po b/safeeyes/config/locale/nl/LC_MESSAGES/safeeyes.po index 8a3e644..0797e7e 100644 --- a/safeeyes/config/locale/nl/LC_MESSAGES/safeeyes.po +++ b/safeeyes/config/locale/nl/LC_MESSAGES/safeeyes.po @@ -147,6 +147,14 @@ msgstr "" "De tussenpoos van een lange pauze moet een vermenigvuldiging zijn van de " "korte" +# Settings dialog +msgid "Reset" +msgstr "" + +# Settings dialog +msgid "Are you sure you want to reset all settings to default?" +msgstr "" + # Settings dialog msgid "Options" msgstr "Opties" diff --git a/safeeyes/config/locale/pl/LC_MESSAGES/safeeyes.po b/safeeyes/config/locale/pl/LC_MESSAGES/safeeyes.po index 0032199..781d532 100644 --- a/safeeyes/config/locale/pl/LC_MESSAGES/safeeyes.po +++ b/safeeyes/config/locale/pl/LC_MESSAGES/safeeyes.po @@ -145,6 +145,14 @@ msgstr "Utrzymaj stan wewnętrzny" msgid "Long break interval must be a multiple of short break interval" msgstr "Długa przerwa musi być poprzedzona kilkoma krótkimi" +# Settings dialog +msgid "Reset" +msgstr "" + +# Settings dialog +msgid "Are you sure you want to reset all settings to default?" +msgstr "" + # Settings dialog msgid "Options" msgstr "Opcje" diff --git a/safeeyes/config/locale/pt/LC_MESSAGES/safeeyes.po b/safeeyes/config/locale/pt/LC_MESSAGES/safeeyes.po index 34e157f..086aacb 100644 --- a/safeeyes/config/locale/pt/LC_MESSAGES/safeeyes.po +++ b/safeeyes/config/locale/pt/LC_MESSAGES/safeeyes.po @@ -146,6 +146,14 @@ msgstr "" "O intervalo de uma parada longa deve ser um múltiplo do intervalo de uma " "parada curta" +# Settings dialog +msgid "Reset" +msgstr "" + +# Settings dialog +msgid "Are you sure you want to reset all settings to default?" +msgstr "" + # Settings dialog msgid "Options" msgstr "Opções" diff --git a/safeeyes/config/locale/ru/LC_MESSAGES/safeeyes.po b/safeeyes/config/locale/ru/LC_MESSAGES/safeeyes.po index 84bd901..0071444 100644 --- a/safeeyes/config/locale/ru/LC_MESSAGES/safeeyes.po +++ b/safeeyes/config/locale/ru/LC_MESSAGES/safeeyes.po @@ -143,6 +143,14 @@ msgstr "Сохранять внутреннее состояние" msgid "Long break interval must be a multiple of short break interval" msgstr "Время длинного перерыва должно быть кратно времени короткого перерыва" +# Settings dialog +msgid "Reset" +msgstr "" + +# Settings dialog +msgid "Are you sure you want to reset all settings to default?" +msgstr "" + # Settings dialog msgid "Options" msgstr "Параметры" diff --git a/safeeyes/config/locale/safeeyes.pot b/safeeyes/config/locale/safeeyes.pot index 091e829..e99c92e 100644 --- a/safeeyes/config/locale/safeeyes.pot +++ b/safeeyes/config/locale/safeeyes.pot @@ -130,6 +130,14 @@ msgstr "" msgid "Long break interval must be a multiple of short break interval" msgstr "" +# Settings dialog +msgid "Reset" +msgstr "" + +# Settings dialog +msgid "Are you sure you want to reset all settings to default?" +msgstr "" + # Settings dialog msgid "Options" msgstr "" diff --git a/safeeyes/config/locale/sk/LC_MESSAGES/safeeyes.po b/safeeyes/config/locale/sk/LC_MESSAGES/safeeyes.po index 1cc5908..441d720 100644 --- a/safeeyes/config/locale/sk/LC_MESSAGES/safeeyes.po +++ b/safeeyes/config/locale/sk/LC_MESSAGES/safeeyes.po @@ -144,6 +144,14 @@ msgstr "Zachovať vnútorný stav" msgid "Long break interval must be a multiple of short break interval" msgstr "Dlhá prestávka musí byť násobkom krátkej prestávky" +# Settings dialog +msgid "Reset" +msgstr "" + +# Settings dialog +msgid "Are you sure you want to reset all settings to default?" +msgstr "" + # Settings dialog msgid "Options" msgstr "Možnosti" diff --git a/safeeyes/config/locale/sv/LC_MESSAGES/safeeyes.po b/safeeyes/config/locale/sv/LC_MESSAGES/safeeyes.po index a228310..bade3c7 100644 --- a/safeeyes/config/locale/sv/LC_MESSAGES/safeeyes.po +++ b/safeeyes/config/locale/sv/LC_MESSAGES/safeeyes.po @@ -141,6 +141,14 @@ msgstr "" msgid "Long break interval must be a multiple of short break interval" msgstr "" +# Settings dialog +msgid "Reset" +msgstr "" + +# Settings dialog +msgid "Are you sure you want to reset all settings to default?" +msgstr "" + # Settings dialog msgid "Options" msgstr "" diff --git a/safeeyes/config/locale/ta/LC_MESSAGES/safeeyes.po b/safeeyes/config/locale/ta/LC_MESSAGES/safeeyes.po index f99bbf5..8415f07 100644 --- a/safeeyes/config/locale/ta/LC_MESSAGES/safeeyes.po +++ b/safeeyes/config/locale/ta/LC_MESSAGES/safeeyes.po @@ -147,6 +147,14 @@ msgstr "" "நீண்ட இடைவேளைகளுக்கிடையிலான நேரம் குறுகிய இடைவேளைகளுக்கிடையிலான நேரத்தின் மடங்காக " "இருக்க வேண்டும்" +# Settings dialog +msgid "Reset" +msgstr "மீளமை" + +# Settings dialog +msgid "Are you sure you want to reset all settings to default?" +msgstr "எல்லா அமைப்புகளையும் இயல்புநிலைக்கு நிச்சயமாக மாற்ற வேண்டுமா?" + # Settings dialog msgid "Options" msgstr "தேர்வுகள்" diff --git a/safeeyes/config/locale/tr/LC_MESSAGES/safeeyes.po b/safeeyes/config/locale/tr/LC_MESSAGES/safeeyes.po index cc7019f..92d8feb 100644 --- a/safeeyes/config/locale/tr/LC_MESSAGES/safeeyes.po +++ b/safeeyes/config/locale/tr/LC_MESSAGES/safeeyes.po @@ -145,6 +145,14 @@ msgstr "İç durum kalıcı olsun" msgid "Long break interval must be a multiple of short break interval" msgstr "Uzun mola aralığı, kısa mola aralığının katı olmalıdır" +# Settings dialog +msgid "Reset" +msgstr "" + +# Settings dialog +msgid "Are you sure you want to reset all settings to default?" +msgstr "" + # Settings dialog msgid "Options" msgstr "Seçenekler" diff --git a/safeeyes/config/locale/ug/LC_MESSAGES/safeeyes.po b/safeeyes/config/locale/ug/LC_MESSAGES/safeeyes.po index 599bdf0..30831ba 100644 --- a/safeeyes/config/locale/ug/LC_MESSAGES/safeeyes.po +++ b/safeeyes/config/locale/ug/LC_MESSAGES/safeeyes.po @@ -141,6 +141,14 @@ msgstr "" msgid "Long break interval must be a multiple of short break interval" msgstr "" +# Settings dialog +msgid "Reset" +msgstr "" + +# Settings dialog +msgid "Are you sure you want to reset all settings to default?" +msgstr "" + # Settings dialog msgid "Options" msgstr "" diff --git a/safeeyes/config/locale/uk/LC_MESSAGES/safeeyes.po b/safeeyes/config/locale/uk/LC_MESSAGES/safeeyes.po index 54ab20c..563f44c 100644 --- a/safeeyes/config/locale/uk/LC_MESSAGES/safeeyes.po +++ b/safeeyes/config/locale/uk/LC_MESSAGES/safeeyes.po @@ -146,6 +146,14 @@ msgid "Long break interval must be a multiple of short break interval" msgstr "" "Довгий інтервал перерви повинен бути кратним короткому інтервалу перерви" +# Settings dialog +msgid "Reset" +msgstr "" + +# Settings dialog +msgid "Are you sure you want to reset all settings to default?" +msgstr "" + # Settings dialog msgid "Options" msgstr "Параметри" diff --git a/safeeyes/config/locale/vi/LC_MESSAGES/safeeyes.po b/safeeyes/config/locale/vi/LC_MESSAGES/safeeyes.po index b5f202f..2ce104c 100644 --- a/safeeyes/config/locale/vi/LC_MESSAGES/safeeyes.po +++ b/safeeyes/config/locale/vi/LC_MESSAGES/safeeyes.po @@ -145,6 +145,14 @@ msgstr "Persist the internal state" msgid "Long break interval must be a multiple of short break interval" msgstr "Thời gian nghỉ dài phải là bội số của thời gian nghỉ ngắn" +# Settings dialog +msgid "Reset" +msgstr "" + +# Settings dialog +msgid "Are you sure you want to reset all settings to default?" +msgstr "" + # Settings dialog msgid "Options" msgstr "Tùy chọn" diff --git a/safeeyes/config/locale/zh_CN/LC_MESSAGES/safeeyes.po b/safeeyes/config/locale/zh_CN/LC_MESSAGES/safeeyes.po index ea6cd3e..289a316 100644 --- a/safeeyes/config/locale/zh_CN/LC_MESSAGES/safeeyes.po +++ b/safeeyes/config/locale/zh_CN/LC_MESSAGES/safeeyes.po @@ -144,6 +144,14 @@ msgstr "维持内部状态" msgid "Long break interval must be a multiple of short break interval" msgstr "长休息时间间隔必须是短休息间隔的倍数" +# Settings dialog +msgid "Reset" +msgstr "" + +# Settings dialog +msgid "Are you sure you want to reset all settings to default?" +msgstr "" + # Settings dialog msgid "Options" msgstr "选项" diff --git a/safeeyes/config/locale/zh_TW/LC_MESSAGES/safeeyes.po b/safeeyes/config/locale/zh_TW/LC_MESSAGES/safeeyes.po index d64f359..a843dc5 100644 --- a/safeeyes/config/locale/zh_TW/LC_MESSAGES/safeeyes.po +++ b/safeeyes/config/locale/zh_TW/LC_MESSAGES/safeeyes.po @@ -142,6 +142,14 @@ msgstr "" msgid "Long break interval must be a multiple of short break interval" msgstr "" +# Settings dialog +msgid "Reset" +msgstr "" + +# Settings dialog +msgid "Are you sure you want to reset all settings to default?" +msgstr "" + # Settings dialog msgid "Options" msgstr "" diff --git a/safeeyes/config/style/safeeyes_style.css b/safeeyes/config/style/safeeyes_style.css index 4135e53..ae7eb52 100644 --- a/safeeyes/config/style/safeeyes_style.css +++ b/safeeyes/config/style/safeeyes_style.css @@ -99,4 +99,11 @@ background: black; opacity: 0.9; border-color: transparent; +} + +.btn_menu { + border-width: 0px; + border-radius: 0px; + border-image: None; + border-color: transparent; } \ No newline at end of file diff --git a/safeeyes/glade/settings_break.glade b/safeeyes/glade/settings_break.glade index aeec396..9bf182d 100644 --- a/safeeyes/glade/settings_break.glade +++ b/safeeyes/glade/settings_break.glade @@ -20,7 +20,7 @@ ~ along with this program. If not, see . --> - + 1 3600 @@ -232,6 +232,7 @@ True False + 10 5 10 vertical diff --git a/safeeyes/glade/settings_dialog.glade b/safeeyes/glade/settings_dialog.glade index 6bfd6c0..63b1985 100644 --- a/safeeyes/glade/settings_dialog.glade +++ b/safeeyes/glade/settings_dialog.glade @@ -20,7 +20,7 @@ ~ along with this program. If not, see . --> - + 15 1 @@ -66,28 +66,114 @@ False gtk-add - + + False + + + 128 + True + False + vertical + 5 + True + + + Reset + True + True + True + + + + + True + True + 0 + + + + + + False - Safe Eyes center 450 600 safeeyes center - - + + True - True - False + False + 91 + True + menu:close + + + True + True + True + center + center + popover + + + True + False + safeeyes + 1 + + + + + + + True + False + vertical + + + True + False + 5 + Safe Eyes + + + False + True + 0 + + + + + True + False + stack + + + False + True + 1 + + + + + + + + + True + False + True True False - 10 - 10 - 10 - 10 + 5 + 5 vertical 15 @@ -250,7 +336,7 @@ - + False 6 start @@ -265,7 +351,7 @@ - + False 16 @@ -300,6 +386,9 @@ 0 + + + @@ -711,25 +800,16 @@ - True - - - - - True - False - Settings - - - lbl_settings - True - False + Settings + Settings True False + 5 + 5 vertical @@ -745,8 +825,6 @@ True False - 10 - 10 10 10 vertical @@ -860,8 +938,6 @@ True False - 5 - 5 10 10 end @@ -902,20 +978,9 @@ + page1 + Breaks 1 - True - - - - - True - False - Breaks - - - 1 - True - False @@ -932,8 +997,6 @@ True False - 10 - 10 10 10 vertical @@ -959,20 +1022,9 @@ + page2 + Plugins 2 - True - - - - - True - False - Plugins - - - 2 - True - False diff --git a/safeeyes/settings.py b/safeeyes/settings.py index 98001e3..45a5dc1 100644 --- a/safeeyes/settings.py +++ b/safeeyes/settings.py @@ -21,6 +21,7 @@ import os import gi from safeeyes import Utility +from safeeyes.model import Config gi.require_version('Gtk', '3.0') from gi.repository import Gtk @@ -58,14 +59,8 @@ class SettingsDialog(object): self.window = builder.get_object('window_settings') self.box_short_breaks = builder.get_object('box_short_breaks') self.box_long_breaks = builder.get_object('box_long_breaks') - box_plugins = builder.get_object('box_plugins') - for short_break in config.get('short_breaks'): - self.__create_break_item(short_break, True) - for long_break in config.get('long_breaks'): - self.__create_break_item(long_break, False) - - for plugin_config in Utility.load_plugins_config(config): - box_plugins.pack_start(self.__create_plugin_item(plugin_config), False, False, 0) + self.box_plugins = builder.get_object('box_plugins') + self.popover = builder.get_object('popover') self.spin_short_break_duration = builder.get_object('spin_short_break_duration') self.spin_long_break_duration = builder.get_object('spin_long_break_duration') @@ -81,6 +76,28 @@ class SettingsDialog(object): self.info_bar_long_break.hide() # Set the current values of input fields + self.__initialize(config) + + # Update relative states + # GtkSwitch state-set signal is available only from 3.14 + if Gtk.get_minor_version() >= 14: + self.switch_strict_break.connect('state-set', self.on_switch_strict_break_activate) + self.switch_postpone.connect('state-set', self.on_switch_postpone_activate) + self.on_switch_strict_break_activate(self.switch_strict_break, self.switch_strict_break.get_active()) + self.on_switch_postpone_activate(self.switch_postpone, self.switch_postpone.get_active()) + self.initializing = False + + def __initialize(self, config): + # Don't show infobar for changes made internally + self.infobar_long_break_shown = True + for short_break in config.get('short_breaks'): + self.__create_break_item(short_break, True) + for long_break in config.get('long_breaks'): + self.__create_break_item(long_break, False) + + for plugin_config in Utility.load_plugins_config(config): + self.box_plugins.pack_start(self.__create_plugin_item(plugin_config), False, False, 0) + self.spin_short_break_duration.set_value(config.get('short_break_duration')) self.spin_long_break_duration.set_value(config.get('long_break_duration')) self.spin_short_break_interval.set_value(config.get('short_break_interval')) @@ -91,15 +108,7 @@ class SettingsDialog(object): self.switch_strict_break.set_active(config.get('strict_break')) self.switch_postpone.set_active(config.get('allow_postpone') and not config.get('strict_break')) self.switch_persist.set_active(config.get('persist_state')) - - # Update relative states - # GtkSwitch state-set signal is available only from 3.14 - if Gtk.get_minor_version() >= 14: - self.switch_strict_break.connect('state-set', self.on_switch_strict_break_activate) - self.switch_postpone.connect('state-set', self.on_switch_postpone_activate) - self.on_switch_strict_break_activate(self.switch_strict_break, self.switch_strict_break.get_active()) - self.on_switch_postpone_activate(self.switch_postpone, self.switch_postpone.get_active()) - self.initializing = False + self.infobar_long_break_shown = False def __create_break_item(self, break_config, is_short): """ @@ -137,6 +146,25 @@ class SettingsDialog(object): parent_box.pack_start(box, False, False, 0) return box + def on_reset_menu_clicked(self, button): + self.popover.hide() + def __confirmation_dialog_response(widget, response_id): + if response_id == Gtk.ResponseType.OK: + Utility.reset_config() + self.config = Config() + self.__initialize(self.config) + widget.destroy() + + messagedialog = Gtk.MessageDialog(parent=self.window, + flags=Gtk.DialogFlags.MODAL, + type=Gtk.MessageType.WARNING, + buttons=(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL, + _("Reset"), Gtk.ResponseType.OK), + message_format=_("Are you sure you want to reset all settings to default?")) + messagedialog.connect("response", __confirmation_dialog_response) + messagedialog.format_secondary_text(_("You can't undo this action.")) + messagedialog.show() + def __delete_break(self, break_config, is_short, on_remove): """ Remove the break after a confirmation.