Override break intervals (#294)
* Add break queue * Add remember last break option * Add option to override interval * Increase duration limit for promodo mode
This commit is contained in:
parent
b096c46d37
commit
107670f9c0
|
@ -141,8 +141,7 @@ class BreakScreen(object):
|
|||
Show an empty break screen on all screens.
|
||||
"""
|
||||
# Lock the keyboard
|
||||
thread = threading.Thread(target=self.__lock_keyboard)
|
||||
thread.start()
|
||||
Utility.start_thread(self.__lock_keyboard)
|
||||
|
||||
screen = Gtk.Window().get_screen()
|
||||
no_of_monitors = screen.get_n_monitors()
|
||||
|
|
|
@ -28,6 +28,7 @@ import time
|
|||
from safeeyes import Utility
|
||||
from safeeyes.model import Break
|
||||
from safeeyes.model import BreakType
|
||||
from safeeyes.model import BreakQueue
|
||||
from safeeyes.model import EventHook
|
||||
from safeeyes.model import State
|
||||
|
||||
|
@ -41,16 +42,11 @@ class SafeEyesCore(object):
|
|||
"""
|
||||
Create an instance of SafeEyesCore and initialize the variables.
|
||||
"""
|
||||
self.break_count = 0
|
||||
self.break_interval = 0
|
||||
self.breaks = None
|
||||
self.long_break_duration = 0
|
||||
self.next_break_index = context['session'].get('next_break_index', 0)
|
||||
self.break_queue = None
|
||||
self.postpone_duration = 0
|
||||
self.default_postpone_duration = 0
|
||||
self.pre_break_warning_time = 0
|
||||
self.running = False
|
||||
self.short_break_duration = 0
|
||||
self.scheduled_next_break_timestamp = -1
|
||||
self.scheduled_next_break_time = None
|
||||
self.paused_time = -1
|
||||
|
@ -72,35 +68,22 @@ class SafeEyesCore(object):
|
|||
self.context['skipped'] = False
|
||||
self.context['postponed'] = False
|
||||
self.context['state'] = State.WAITING
|
||||
self.context['new_cycle'] = False
|
||||
|
||||
def initialize(self, config):
|
||||
"""
|
||||
Initialize the internal properties from configuration
|
||||
"""
|
||||
logging.info("Initialize the core")
|
||||
self.breaks = []
|
||||
self.pre_break_warning_time = config.get('pre_break_warning_time')
|
||||
self.long_break_duration = config.get('long_break_duration')
|
||||
self.short_break_duration = config.get('short_break_duration')
|
||||
self.break_interval = config.get('break_interval') * 60 # Convert to seconds
|
||||
self.break_queue = BreakQueue(config, self.context)
|
||||
self.default_postpone_duration = config.get('postpone_duration') * 60 # Convert to seconds
|
||||
self.postpone_duration = self.default_postpone_duration
|
||||
|
||||
self.__init_breaks(BreakType.SHORT_BREAK, config.get('short_breaks'), config.get('no_of_short_breaks_per_long_break'))
|
||||
self.__init_breaks(BreakType.LONG_BREAK, config.get('long_breaks'), config.get('no_of_short_breaks_per_long_break'))
|
||||
self.break_count = len(self.breaks)
|
||||
if self.break_count == 0:
|
||||
# No breaks found
|
||||
return
|
||||
self.next_break_index = (self.next_break_index) % self.break_count
|
||||
self.context['session']['next_break_index'] = self.next_break_index
|
||||
|
||||
def start(self, next_break_time=-1):
|
||||
"""
|
||||
Start Safe Eyes is it is not running already.
|
||||
"""
|
||||
if not self.has_breaks():
|
||||
if self.break_queue.is_empty():
|
||||
return
|
||||
with self.lock:
|
||||
if not self.running:
|
||||
|
@ -148,7 +131,7 @@ class SafeEyesCore(object):
|
|||
"""
|
||||
Calling this method stops the scheduler and show the next break screen
|
||||
"""
|
||||
if not self.has_breaks():
|
||||
if self.break_queue.is_empty():
|
||||
return
|
||||
if not self.context['state'] == State.WAITING:
|
||||
return
|
||||
|
@ -158,7 +141,7 @@ class SafeEyesCore(object):
|
|||
"""
|
||||
Check whether Safe Eyes has breaks or not.
|
||||
"""
|
||||
return bool(self.breaks)
|
||||
return not self.break_queue.is_empty()
|
||||
|
||||
def __take_break(self):
|
||||
"""
|
||||
|
@ -180,7 +163,6 @@ class SafeEyesCore(object):
|
|||
time.sleep(1) # Wait for 1 sec to ensure the sceduler is dead
|
||||
self.running = True
|
||||
|
||||
self.context['new_cycle'] = self.next_break_index == 0
|
||||
Utility.execute_main_thread(self.__fire_start_break)
|
||||
|
||||
def __scheduler_job(self):
|
||||
|
@ -191,7 +173,8 @@ class SafeEyesCore(object):
|
|||
return
|
||||
|
||||
self.context['state'] = State.WAITING
|
||||
time_to_wait = self.break_interval
|
||||
# Convert to seconds
|
||||
time_to_wait = self.break_queue.get_break().time * 60
|
||||
current_time = datetime.datetime.now()
|
||||
current_timestamp = current_time.timestamp()
|
||||
|
||||
|
@ -201,14 +184,14 @@ class SafeEyesCore(object):
|
|||
time_to_wait = self.postpone_duration
|
||||
self.context['postponed'] = False
|
||||
|
||||
elif self.paused_time > -1 and self.__is_long_break():
|
||||
elif self.paused_time > -1 and self.break_queue.is_long_break():
|
||||
# Safe Eyes was paused earlier and next break is long
|
||||
paused_duration = int(current_timestamp - self.paused_time)
|
||||
self.paused_time = -1
|
||||
if paused_duration > self.breaks[self.next_break_index].time:
|
||||
if paused_duration > self.break_queue.get_break().duration:
|
||||
logging.info('Skip next long break due to the pause longer than break duration')
|
||||
# Skip the next long break
|
||||
self.__select_next_break()
|
||||
self.break_queue.next()
|
||||
|
||||
if current_timestamp < self.scheduled_next_break_timestamp:
|
||||
time_to_wait = round(self.scheduled_next_break_timestamp - current_timestamp)
|
||||
|
@ -217,11 +200,6 @@ class SafeEyesCore(object):
|
|||
self.scheduled_next_break_time = current_time + datetime.timedelta(seconds=time_to_wait)
|
||||
Utility.execute_main_thread(self.__fire_on_update_next_break, self.scheduled_next_break_time)
|
||||
|
||||
if self.__is_long_break():
|
||||
self.context['break_type'] = 'long'
|
||||
else:
|
||||
self.context['break_type'] = 'short'
|
||||
|
||||
# Wait for the pre break warning period
|
||||
logging.info("Waiting for %d minutes until next break", (time_to_wait / 60))
|
||||
self.__wait_for(time_to_wait)
|
||||
|
@ -230,22 +208,20 @@ class SafeEyesCore(object):
|
|||
|
||||
if not self.running:
|
||||
return
|
||||
|
||||
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)
|
||||
self.on_update_next_break.fire(self.break_queue.get_break(), next_break_time)
|
||||
|
||||
def __fire_pre_break(self):
|
||||
"""
|
||||
Show the notification and start the break after the notification.
|
||||
"""
|
||||
self.context['state'] = State.PRE_BREAK
|
||||
if not self.on_pre_break.fire(self.breaks[self.next_break_index]):
|
||||
if not self.on_pre_break.fire(self.break_queue.get_break()):
|
||||
# Plugins wanted to ignore this break
|
||||
self.__start_next_break()
|
||||
return
|
||||
|
@ -265,7 +241,7 @@ class SafeEyesCore(object):
|
|||
|
||||
def __fire_start_break(self):
|
||||
# Show the break screen
|
||||
if not self.on_start_break.fire(self.breaks[self.next_break_index]):
|
||||
if not self.on_start_break.fire(self.break_queue.get_break()):
|
||||
# Plugins want to ignore this break
|
||||
self.__start_next_break()
|
||||
return
|
||||
|
@ -278,7 +254,7 @@ class SafeEyesCore(object):
|
|||
# Wait in user thread
|
||||
Utility.start_thread(self.__postpone_break)
|
||||
else:
|
||||
self.start_break.fire(self.breaks[self.next_break_index])
|
||||
self.start_break.fire(self.break_queue.get_break())
|
||||
Utility.start_thread(self.__start_break)
|
||||
|
||||
def __start_break(self):
|
||||
|
@ -286,8 +262,8 @@ class SafeEyesCore(object):
|
|||
Start the break screen.
|
||||
"""
|
||||
self.context['state'] = State.BREAK
|
||||
break_obj = self.breaks[self.next_break_index]
|
||||
countdown = break_obj.time
|
||||
break_obj = self.break_queue.get_break()
|
||||
countdown = break_obj.duration
|
||||
total_break_time = countdown
|
||||
|
||||
while countdown and self.running and not self.context['skipped'] and not self.context['postponed']:
|
||||
|
@ -315,66 +291,10 @@ class SafeEyesCore(object):
|
|||
self.waiting_condition.wait(duration)
|
||||
self.waiting_condition.release()
|
||||
|
||||
def __select_next_break(self):
|
||||
"""
|
||||
Select the next break.
|
||||
"""
|
||||
self.next_break_index = (self.next_break_index + 1) % self.break_count
|
||||
self.context['session']['next_break_index'] = self.next_break_index
|
||||
|
||||
def __is_long_break(self):
|
||||
"""
|
||||
Check if the next break is long break.
|
||||
"""
|
||||
return self.breaks[self.next_break_index].type is BreakType.LONG_BREAK
|
||||
|
||||
def __start_next_break(self):
|
||||
if not self.context['postponed']:
|
||||
self.__select_next_break()
|
||||
self.break_queue.next()
|
||||
|
||||
if self.running:
|
||||
# Schedule the break again
|
||||
Utility.start_thread(self.__scheduler_job)
|
||||
|
||||
def __init_breaks(self, break_type, break_configs, short_breaks_per_long_break=0):
|
||||
"""
|
||||
Fill the self.breaks using short and local breaks.
|
||||
"""
|
||||
# Defin the default break time
|
||||
default_break_time = self.short_break_duration
|
||||
|
||||
# Duplicate short breaks to equally distribute the long breaks
|
||||
if break_type is BreakType.LONG_BREAK:
|
||||
if self.breaks:
|
||||
default_break_time = self.long_break_duration
|
||||
required_short_breaks = short_breaks_per_long_break * len(break_configs)
|
||||
no_of_short_breaks = len(self.breaks)
|
||||
short_break_index = 0
|
||||
while no_of_short_breaks < required_short_breaks:
|
||||
self.breaks.append(self.breaks[short_break_index])
|
||||
short_break_index += 1
|
||||
no_of_short_breaks += 1
|
||||
else:
|
||||
# If there are no short breaks, extend the break interval according to long break interval
|
||||
self.break_interval = int(self.break_interval * short_breaks_per_long_break)
|
||||
|
||||
iteration = 1
|
||||
for break_config in break_configs:
|
||||
name = _(break_config['name'])
|
||||
break_time = break_config.get('duration', default_break_time)
|
||||
image = break_config.get('image')
|
||||
plugins = break_config.get('plugins', None)
|
||||
|
||||
# Validate time value
|
||||
if not isinstance(break_time, int) or break_time <= 0:
|
||||
logging.error('Invalid time in break: ' + str(break_config))
|
||||
continue
|
||||
|
||||
break_obj = Break(break_type, name, break_time, image, plugins)
|
||||
if break_type is BreakType.SHORT_BREAK:
|
||||
self.breaks.append(break_obj)
|
||||
else:
|
||||
# Long break
|
||||
index = iteration * (short_breaks_per_long_break + 1) - 1
|
||||
self.breaks.insert(index, break_obj)
|
||||
iteration += 1
|
||||
|
|
|
@ -57,7 +57,6 @@ USER_PLUGINS_DIR = os.path.join(CONFIG_DIRECTORY, 'plugins')
|
|||
LOCALE_PATH = os.path.join(BIN_DIRECTORY, 'config/locale')
|
||||
DESKTOP_ENVIRONMENT = None
|
||||
|
||||
|
||||
def get_resource_path(resource_name):
|
||||
"""
|
||||
Return the user-defined resource if a system resource is overridden by the user.
|
||||
|
@ -80,7 +79,7 @@ def start_thread(target_function, **args):
|
|||
"""
|
||||
Execute the function in a separate thread.
|
||||
"""
|
||||
thread = threading.Thread(target=target_function, kwargs=args)
|
||||
thread = threading.Thread(target=target_function, name="WorkThread", kwargs=args)
|
||||
thread.start()
|
||||
|
||||
|
||||
|
|
|
@ -207,6 +207,10 @@ msgstr "يرجى تحديد صورة"
|
|||
msgid "Duration"
|
||||
msgstr "المدة"
|
||||
|
||||
# Settings dialog
|
||||
msgid "Time to wait"
|
||||
msgstr ""
|
||||
|
||||
# Settings dialog
|
||||
msgid "Override"
|
||||
msgstr "تجاوز"
|
||||
|
@ -215,6 +219,10 @@ msgstr "تجاوز"
|
|||
msgid "Time (in seconds)"
|
||||
msgstr "الزمن (ثوان)"
|
||||
|
||||
# Settings dialog
|
||||
msgid "Time (in minutes)"
|
||||
msgstr ""
|
||||
|
||||
# Settings dialog
|
||||
msgid "Break Settings"
|
||||
msgstr "إعدادات الاستراحة"
|
||||
|
|
|
@ -205,6 +205,10 @@ msgstr ""
|
|||
msgid "Duration"
|
||||
msgstr ""
|
||||
|
||||
# Settings dialog
|
||||
msgid "Time to wait"
|
||||
msgstr ""
|
||||
|
||||
# Settings dialog
|
||||
msgid "Override"
|
||||
msgstr ""
|
||||
|
@ -213,6 +217,10 @@ msgstr ""
|
|||
msgid "Time (in seconds)"
|
||||
msgstr ""
|
||||
|
||||
# Settings dialog
|
||||
msgid "Time (in minutes)"
|
||||
msgstr ""
|
||||
|
||||
# Settings dialog
|
||||
msgid "Break Settings"
|
||||
msgstr ""
|
||||
|
|
|
@ -209,6 +209,10 @@ msgstr ""
|
|||
msgid "Duration"
|
||||
msgstr ""
|
||||
|
||||
# Settings dialog
|
||||
msgid "Time to wait"
|
||||
msgstr ""
|
||||
|
||||
# Settings dialog
|
||||
msgid "Override"
|
||||
msgstr ""
|
||||
|
@ -217,6 +221,10 @@ msgstr ""
|
|||
msgid "Time (in seconds)"
|
||||
msgstr ""
|
||||
|
||||
# Settings dialog
|
||||
msgid "Time (in minutes)"
|
||||
msgstr ""
|
||||
|
||||
# Settings dialog
|
||||
msgid "Break Settings"
|
||||
msgstr ""
|
||||
|
|
|
@ -208,6 +208,10 @@ msgstr "Vyberte obrázek"
|
|||
msgid "Duration"
|
||||
msgstr "Trvání"
|
||||
|
||||
# Settings dialog
|
||||
msgid "Time to wait"
|
||||
msgstr ""
|
||||
|
||||
# Settings dialog
|
||||
msgid "Override"
|
||||
msgstr "Přepsat"
|
||||
|
@ -216,6 +220,10 @@ msgstr "Přepsat"
|
|||
msgid "Time (in seconds)"
|
||||
msgstr "Čas (v sekundách)"
|
||||
|
||||
# Settings dialog
|
||||
msgid "Time (in minutes)"
|
||||
msgstr "Čas (v minutách)"
|
||||
|
||||
# Settings dialog
|
||||
msgid "Break Settings"
|
||||
msgstr "Nastavení přestávek"
|
||||
|
|
|
@ -54,7 +54,6 @@ msgid "Lean back at your seat and relax"
|
|||
msgstr "Læn tilbage i sædet og slap af"
|
||||
|
||||
# Commandline arg description
|
||||
#, fuzzy
|
||||
msgid "show the about dialog"
|
||||
msgstr "Om programmet"
|
||||
|
||||
|
@ -92,7 +91,6 @@ msgstr "Luk"
|
|||
|
||||
# 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
|
||||
#, fuzzy
|
||||
msgid "description"
|
||||
msgstr "beskrivelse"
|
||||
|
||||
|
@ -129,7 +127,6 @@ msgid "Postpone duration (in minutes)"
|
|||
msgstr "Udskyd varighed (i minutter)"
|
||||
|
||||
# Settings dialog
|
||||
#, fuzzy
|
||||
msgid "Strict break (No way to skip breaks)"
|
||||
msgstr "Fast pause (ingen måde at springe over)"
|
||||
|
||||
|
@ -138,12 +135,10 @@ msgid "Allow postponing breaks"
|
|||
msgstr "Tillad at udskyde pauser"
|
||||
|
||||
# Settings dialog
|
||||
#, fuzzy
|
||||
msgid "Persist the internal state"
|
||||
msgstr "Fortsætter i interntilstand"
|
||||
|
||||
# Settings dialog
|
||||
#, fuzzy
|
||||
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"
|
||||
|
@ -212,6 +207,10 @@ msgstr "Vælg et billede"
|
|||
msgid "Duration"
|
||||
msgstr "Varighed"
|
||||
|
||||
# Settings dialog
|
||||
msgid "Time to wait"
|
||||
msgstr ""
|
||||
|
||||
# Settings dialog
|
||||
msgid "Override"
|
||||
msgstr "Tilsidesæt"
|
||||
|
@ -220,6 +219,10 @@ msgstr "Tilsidesæt"
|
|||
msgid "Time (in seconds)"
|
||||
msgstr "Tid (i sekunder)"
|
||||
|
||||
# Settings dialog
|
||||
msgid "Time (in minutes)"
|
||||
msgstr "Tid (i minutter)"
|
||||
|
||||
# Settings dialog
|
||||
msgid "Break Settings"
|
||||
msgstr "Pauseindstillinger"
|
||||
|
@ -229,7 +232,6 @@ msgid "Plugin Settings"
|
|||
msgstr "Udvidelsesindstillinger"
|
||||
|
||||
# Settings dialog
|
||||
#, fuzzy
|
||||
msgid "Plugin does not support %s desktop environment"
|
||||
msgstr "Udvidelse understøtter ikke %s skrivebordsmiljø"
|
||||
|
||||
|
@ -242,7 +244,6 @@ msgid "Please install the command-line tool '%s'"
|
|||
msgstr "Installer kommandolinjeværktøjet '%s'"
|
||||
|
||||
# Settings dialog
|
||||
#, fuzzy
|
||||
msgid "Please add the resource %(resource)s to %(config_resource)s directory"
|
||||
msgstr "Tilføj ressource %(ressource)s til %(config_resource)s bibliotek"
|
||||
|
||||
|
@ -283,22 +284,18 @@ msgid "Skip break if the active window is in fullscreen mode"
|
|||
msgstr "Spring pausen over, hvis det aktive vindue er i fuldskærmstilstand"
|
||||
|
||||
# plugin/donotdisturb
|
||||
#, fuzzy
|
||||
msgid "Do not interrupt these windows anytime"
|
||||
msgstr "Afbryd ikke disse vinduer nogensinde"
|
||||
|
||||
# plugin/donotdisturb
|
||||
#, fuzzy
|
||||
msgid "Interrupt these windows regardless of their state"
|
||||
msgstr "Afbryde disse vinduer uanset deres tilstand"
|
||||
|
||||
# plugin/donotdisturb
|
||||
#, fuzzy
|
||||
msgid "Switch the interruptible windows to normal mode"
|
||||
msgstr "Skift de afbrydelige vinduer til normal funktionstilstand"
|
||||
|
||||
# plugin/donotdisturb
|
||||
#, fuzzy
|
||||
msgid "Do not disturb while on battery"
|
||||
msgstr "Forstyr ikke ved batteridrift"
|
||||
|
||||
|
@ -331,7 +328,6 @@ msgid "Screensaver"
|
|||
msgstr "Pauseskærm"
|
||||
|
||||
# plugin/screensaver
|
||||
#, fuzzy
|
||||
msgid "Lock the screen after long breaks by starting screensaver"
|
||||
msgstr "Lås skærmen efter lange pauser ved at starte pauseskærmen"
|
||||
|
||||
|
@ -344,7 +340,6 @@ msgid "Minimum seconds to skip without screensaver"
|
|||
msgstr "Mindste antal sekunder for at springe over uden pauseskærm"
|
||||
|
||||
# plugin/smartpause
|
||||
#, fuzzy
|
||||
msgid "Smart Pause"
|
||||
msgstr "Smart Pause"
|
||||
|
||||
|
@ -353,32 +348,26 @@ msgid "Pause Safe Eyes if the system is idle"
|
|||
msgstr "Pause Safe Eyes, hvis systemet er inaktivt"
|
||||
|
||||
# plugin/smartpause
|
||||
#, fuzzy
|
||||
msgid "Minimum idle time to pause Safe Eyes (in seconds)"
|
||||
msgstr "Mindste tomgangstid for at pause Safe Eyes (i sekunder)"
|
||||
|
||||
# plugin/smartpause
|
||||
#, fuzzy
|
||||
msgid "Interpret idle time equivalent to upcoming break duration as a break"
|
||||
msgstr "Fortolk inaktiv tid svarende til kommende pause varighed som en pause"
|
||||
|
||||
# plugin/smartpause
|
||||
#, fuzzy
|
||||
msgid "Postpone the next break until the system becomes idle"
|
||||
msgstr "Udskyd den næste pause, indtil systemet bliver ledig"
|
||||
|
||||
#: plugins/trayicon
|
||||
#, fuzzy
|
||||
msgid "Tray Icon"
|
||||
msgstr "Bakkeikon"
|
||||
|
||||
#: plugins/trayicon
|
||||
#, fuzzy
|
||||
msgid "Show a tray icon in the notification area"
|
||||
msgstr "Vise en ikon i meddelelsesområdet"
|
||||
|
||||
#: plugins/trayicon
|
||||
#, fuzzy
|
||||
msgid "Show next break time in tray icon"
|
||||
msgstr "Vis næste pausetid i bakkeikon"
|
||||
|
||||
|
|
|
@ -208,6 +208,10 @@ msgstr "Bitte Bild auswählen"
|
|||
msgid "Duration"
|
||||
msgstr "Dauer"
|
||||
|
||||
# Settings dialog
|
||||
msgid "Time to wait"
|
||||
msgstr ""
|
||||
|
||||
# Settings dialog
|
||||
msgid "Override"
|
||||
msgstr "Überschreiben"
|
||||
|
@ -216,6 +220,10 @@ msgstr "Überschreiben"
|
|||
msgid "Time (in seconds)"
|
||||
msgstr "Zeit (in Sekunden)"
|
||||
|
||||
# Settings dialog
|
||||
msgid "Time (in minutes)"
|
||||
msgstr "Zeit (in Minuten)"
|
||||
|
||||
# Settings dialog
|
||||
msgid "Break Settings"
|
||||
msgstr "Einstelllungen Pause"
|
||||
|
|
|
@ -209,6 +209,10 @@ msgstr "Please select an image"
|
|||
msgid "Duration"
|
||||
msgstr "Duration"
|
||||
|
||||
# Settings dialog
|
||||
msgid "Time to wait"
|
||||
msgstr "Time to wait"
|
||||
|
||||
# Settings dialog
|
||||
msgid "Override"
|
||||
msgstr "Override"
|
||||
|
@ -217,6 +221,10 @@ msgstr "Override"
|
|||
msgid "Time (in seconds)"
|
||||
msgstr "Time (in seconds)"
|
||||
|
||||
# Settings dialog
|
||||
msgid "Time (in minutes)"
|
||||
msgstr "Time (in minutes)"
|
||||
|
||||
# Settings dialog
|
||||
msgid "Break Settings"
|
||||
msgstr "Break Settings"
|
||||
|
|
|
@ -208,6 +208,10 @@ msgstr "Por favor seleccione una imagen"
|
|||
msgid "Duration"
|
||||
msgstr "Duracion"
|
||||
|
||||
# Settings dialog
|
||||
msgid "Time to wait"
|
||||
msgstr ""
|
||||
|
||||
# Settings dialog
|
||||
msgid "Override"
|
||||
msgstr ""
|
||||
|
@ -216,6 +220,10 @@ msgstr ""
|
|||
msgid "Time (in seconds)"
|
||||
msgstr "Tiempo (en segundos)"
|
||||
|
||||
# Settings dialog
|
||||
msgid "Time (in minutes)"
|
||||
msgstr "Tiempo (en minutos)"
|
||||
|
||||
# Settings dialog
|
||||
msgid "Break Settings"
|
||||
msgstr ""
|
||||
|
|
|
@ -208,6 +208,10 @@ msgstr "Palun vali pilt"
|
|||
msgid "Duration"
|
||||
msgstr "Kestvus"
|
||||
|
||||
# Settings dialog
|
||||
msgid "Time to wait"
|
||||
msgstr ""
|
||||
|
||||
# Settings dialog
|
||||
msgid "Override"
|
||||
msgstr "Muuda vaikimisi seadeid"
|
||||
|
@ -216,6 +220,10 @@ msgstr "Muuda vaikimisi seadeid"
|
|||
msgid "Time (in seconds)"
|
||||
msgstr "Kestvus (sekundites)"
|
||||
|
||||
# Settings dialog
|
||||
msgid "Time (in minutes)"
|
||||
msgstr "Kestvus (minutites)"
|
||||
|
||||
# Settings dialog
|
||||
msgid "Break Settings"
|
||||
msgstr "Pausi seaded"
|
||||
|
|
|
@ -208,6 +208,10 @@ msgstr ""
|
|||
msgid "Duration"
|
||||
msgstr ""
|
||||
|
||||
# Settings dialog
|
||||
msgid "Time to wait"
|
||||
msgstr ""
|
||||
|
||||
# Settings dialog
|
||||
msgid "Override"
|
||||
msgstr ""
|
||||
|
@ -216,6 +220,10 @@ msgstr ""
|
|||
msgid "Time (in seconds)"
|
||||
msgstr ""
|
||||
|
||||
# Settings dialog
|
||||
msgid "Time (in minutes)"
|
||||
msgstr ""
|
||||
|
||||
# Settings dialog
|
||||
msgid "Break Settings"
|
||||
msgstr ""
|
||||
|
|
|
@ -211,6 +211,10 @@ msgstr "Veuillez choisir une image"
|
|||
msgid "Duration"
|
||||
msgstr "Durée"
|
||||
|
||||
# Settings dialog
|
||||
msgid "Time to wait"
|
||||
msgstr ""
|
||||
|
||||
# Settings dialog
|
||||
msgid "Override"
|
||||
msgstr "Remplacer"
|
||||
|
@ -219,6 +223,10 @@ msgstr "Remplacer"
|
|||
msgid "Time (in seconds)"
|
||||
msgstr "Durée (en secondes)"
|
||||
|
||||
# Settings dialog
|
||||
msgid "Time (in minutes)"
|
||||
msgstr "Durée (en minutes)"
|
||||
|
||||
# Settings dialog
|
||||
msgid "Break Settings"
|
||||
msgstr "Paramètres de la pause"
|
||||
|
|
|
@ -206,6 +206,10 @@ msgstr ""
|
|||
msgid "Duration"
|
||||
msgstr ""
|
||||
|
||||
# Settings dialog
|
||||
msgid "Time to wait"
|
||||
msgstr ""
|
||||
|
||||
# Settings dialog
|
||||
msgid "Override"
|
||||
msgstr ""
|
||||
|
@ -214,6 +218,10 @@ msgstr ""
|
|||
msgid "Time (in seconds)"
|
||||
msgstr ""
|
||||
|
||||
# Settings dialog
|
||||
msgid "Time (in minutes)"
|
||||
msgstr ""
|
||||
|
||||
# Settings dialog
|
||||
msgid "Break Settings"
|
||||
msgstr ""
|
||||
|
|
|
@ -206,6 +206,10 @@ msgstr "Válasszon ki egy képet"
|
|||
msgid "Duration"
|
||||
msgstr "Időtartam"
|
||||
|
||||
# Settings dialog
|
||||
msgid "Time to wait"
|
||||
msgstr ""
|
||||
|
||||
# Settings dialog
|
||||
msgid "Override"
|
||||
msgstr "Felülbírál"
|
||||
|
@ -214,6 +218,10 @@ msgstr "Felülbírál"
|
|||
msgid "Time (in seconds)"
|
||||
msgstr "Idő (másodpercben)"
|
||||
|
||||
# Settings dialog
|
||||
msgid "Time (in minutes)"
|
||||
msgstr "Idő (percben)"
|
||||
|
||||
# Settings dialog
|
||||
msgid "Break Settings"
|
||||
msgstr "Pihenő Beállítások"
|
||||
|
|
|
@ -205,6 +205,10 @@ msgstr ""
|
|||
msgid "Duration"
|
||||
msgstr ""
|
||||
|
||||
# Settings dialog
|
||||
msgid "Time to wait"
|
||||
msgstr ""
|
||||
|
||||
# Settings dialog
|
||||
msgid "Override"
|
||||
msgstr ""
|
||||
|
@ -213,6 +217,10 @@ msgstr ""
|
|||
msgid "Time (in seconds)"
|
||||
msgstr ""
|
||||
|
||||
# Settings dialog
|
||||
msgid "Time (in minutes)"
|
||||
msgstr ""
|
||||
|
||||
# Settings dialog
|
||||
msgid "Break Settings"
|
||||
msgstr ""
|
||||
|
|
|
@ -211,6 +211,10 @@ msgstr "Seleziona una immagine"
|
|||
msgid "Duration"
|
||||
msgstr "Durata"
|
||||
|
||||
# Settings dialog
|
||||
msgid "Time to wait"
|
||||
msgstr ""
|
||||
|
||||
# Settings dialog
|
||||
msgid "Override"
|
||||
msgstr "Sovrascrive"
|
||||
|
@ -219,6 +223,10 @@ msgstr "Sovrascrive"
|
|||
msgid "Time (in seconds)"
|
||||
msgstr "Tempo (in secondi)"
|
||||
|
||||
# Settings dialog
|
||||
msgid "Time (in minutes)"
|
||||
msgstr "Tempo (in minuti)"
|
||||
|
||||
# Settings dialog
|
||||
msgid "Break Settings"
|
||||
msgstr "Preferenze per la pausa"
|
||||
|
|
|
@ -211,6 +211,10 @@ msgstr "Pasirinkite paveikslą"
|
|||
msgid "Duration"
|
||||
msgstr "Trukmė"
|
||||
|
||||
# Settings dialog
|
||||
msgid "Time to wait"
|
||||
msgstr ""
|
||||
|
||||
# Settings dialog
|
||||
msgid "Override"
|
||||
msgstr "Nustelbti"
|
||||
|
@ -219,6 +223,10 @@ msgstr "Nustelbti"
|
|||
msgid "Time (in seconds)"
|
||||
msgstr "Laikas (sekundėmis)"
|
||||
|
||||
# Settings dialog
|
||||
msgid "Time (in minutes)"
|
||||
msgstr "Laikas (minutėmis)"
|
||||
|
||||
# Settings dialog
|
||||
msgid "Break Settings"
|
||||
msgstr "Pertraukos nustatymai"
|
||||
|
|
|
@ -208,6 +208,10 @@ msgstr ""
|
|||
msgid "Duration"
|
||||
msgstr ""
|
||||
|
||||
# Settings dialog
|
||||
msgid "Time to wait"
|
||||
msgstr ""
|
||||
|
||||
# Settings dialog
|
||||
msgid "Override"
|
||||
msgstr ""
|
||||
|
@ -216,6 +220,10 @@ msgstr ""
|
|||
msgid "Time (in seconds)"
|
||||
msgstr ""
|
||||
|
||||
# Settings dialog
|
||||
msgid "Time (in minutes)"
|
||||
msgstr ""
|
||||
|
||||
# Settings dialog
|
||||
msgid "Break Settings"
|
||||
msgstr ""
|
||||
|
|
|
@ -8,8 +8,8 @@ msgstr ""
|
|||
"POT-Creation-Date: \n"
|
||||
"PO-Revision-Date: 2019-01-03 17:07+0000\n"
|
||||
"Last-Translator: Allan Nordhøy <epost@anotheragency.no>\n"
|
||||
"Language-Team: Norwegian Bokmål <https://hosted.weblate.org/projects/"
|
||||
"safe-eyes/translations/nb_NO/>\n"
|
||||
"Language-Team: Norwegian Bokmål <https://hosted.weblate.org/projects/safe-"
|
||||
"eyes/translations/nb_NO/>\n"
|
||||
"Language: nb\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
|
@ -159,12 +159,10 @@ msgid "Delete"
|
|||
msgstr "Slett"
|
||||
|
||||
# Settings dialog
|
||||
#, fuzzy
|
||||
msgid "Are you sure you want to delete this break?"
|
||||
msgstr "Er du sikker på at du ønsker å slette denne pausen?"
|
||||
|
||||
# Settings dialog
|
||||
#, fuzzy
|
||||
msgid "You can't undo this action."
|
||||
msgstr "Dette kan ikke angres."
|
||||
|
||||
|
@ -208,6 +206,10 @@ msgstr "Velg et bilde"
|
|||
msgid "Duration"
|
||||
msgstr "Varighet"
|
||||
|
||||
# Settings dialog
|
||||
msgid "Time to wait"
|
||||
msgstr ""
|
||||
|
||||
# Settings dialog
|
||||
msgid "Override"
|
||||
msgstr "Overstyr"
|
||||
|
@ -216,6 +218,10 @@ msgstr "Overstyr"
|
|||
msgid "Time (in seconds)"
|
||||
msgstr "Tid (i sekunder)"
|
||||
|
||||
# Settings dialog
|
||||
msgid "Time (in minutes)"
|
||||
msgstr "Tid (i minutter)"
|
||||
|
||||
# Settings dialog
|
||||
msgid "Break Settings"
|
||||
msgstr "Pauseinnstillinger"
|
||||
|
|
|
@ -211,6 +211,10 @@ msgstr "Kies een afbeelding"
|
|||
msgid "Duration"
|
||||
msgstr "Duur"
|
||||
|
||||
# Settings dialog
|
||||
msgid "Time to wait"
|
||||
msgstr ""
|
||||
|
||||
# Settings dialog
|
||||
msgid "Override"
|
||||
msgstr "Overschrijven"
|
||||
|
@ -219,6 +223,10 @@ msgstr "Overschrijven"
|
|||
msgid "Time (in seconds)"
|
||||
msgstr "Tijd (in seconden)"
|
||||
|
||||
# Settings dialog
|
||||
msgid "Time (in minutes)"
|
||||
msgstr "Tijd (in minuten)"
|
||||
|
||||
# Settings dialog
|
||||
msgid "Break Settings"
|
||||
msgstr "Pauze-instellingen"
|
||||
|
@ -277,7 +285,8 @@ msgstr "Niet storen"
|
|||
|
||||
# plugin/donotdisturb
|
||||
msgid "Skip break if the active window is in fullscreen mode"
|
||||
msgstr "Pauze overslaan als het actieve venster draait in volledig scherm-modus"
|
||||
msgstr ""
|
||||
"Pauze overslaan als het actieve venster draait in volledig scherm-modus"
|
||||
|
||||
# plugin/donotdisturb
|
||||
msgid "Do not interrupt these windows anytime"
|
||||
|
|
|
@ -209,6 +209,10 @@ msgstr "Proszę wybrać obraz"
|
|||
msgid "Duration"
|
||||
msgstr "Czas trwania"
|
||||
|
||||
# Settings dialog
|
||||
msgid "Time to wait"
|
||||
msgstr ""
|
||||
|
||||
# Settings dialog
|
||||
msgid "Override"
|
||||
msgstr "Nadpisz"
|
||||
|
@ -217,6 +221,10 @@ msgstr "Nadpisz"
|
|||
msgid "Time (in seconds)"
|
||||
msgstr "Czas (w sekundach)"
|
||||
|
||||
# Settings dialog
|
||||
msgid "Time (in minutes)"
|
||||
msgstr "Czas (w minutach)"
|
||||
|
||||
# Settings dialog
|
||||
msgid "Break Settings"
|
||||
msgstr "Ustawienia Przerwy"
|
||||
|
|
|
@ -210,6 +210,10 @@ msgstr "Por favor, selecione uma imagem"
|
|||
msgid "Duration"
|
||||
msgstr "Duração"
|
||||
|
||||
# Settings dialog
|
||||
msgid "Time to wait"
|
||||
msgstr ""
|
||||
|
||||
# Settings dialog
|
||||
msgid "Override"
|
||||
msgstr "Sobrepor"
|
||||
|
@ -218,6 +222,10 @@ msgstr "Sobrepor"
|
|||
msgid "Time (in seconds)"
|
||||
msgstr "Tempo (em segundos)"
|
||||
|
||||
# Settings dialog
|
||||
msgid "Time (in minutes)"
|
||||
msgstr "Tempo (em minutos)"
|
||||
|
||||
# Settings dialog
|
||||
msgid "Break Settings"
|
||||
msgstr "Configurações da Parada"
|
||||
|
|
|
@ -207,6 +207,10 @@ msgstr "Пожалуйста выберите изображение"
|
|||
msgid "Duration"
|
||||
msgstr "Длительность"
|
||||
|
||||
# Settings dialog
|
||||
msgid "Time to wait"
|
||||
msgstr ""
|
||||
|
||||
# Settings dialog
|
||||
msgid "Override"
|
||||
msgstr "Переписать"
|
||||
|
@ -215,6 +219,10 @@ msgstr "Переписать"
|
|||
msgid "Time (in seconds)"
|
||||
msgstr "Время (в секундах)"
|
||||
|
||||
# Settings dialog
|
||||
msgid "Time (in minutes)"
|
||||
msgstr "Время (в минутах)"
|
||||
|
||||
# Settings dialog
|
||||
msgid "Break Settings"
|
||||
msgstr "Настройки перерыва"
|
||||
|
|
|
@ -194,6 +194,10 @@ msgstr ""
|
|||
msgid "Duration"
|
||||
msgstr ""
|
||||
|
||||
# Settings dialog
|
||||
msgid "Time to wait"
|
||||
msgstr ""
|
||||
|
||||
# Settings dialog
|
||||
msgid "Override"
|
||||
msgstr ""
|
||||
|
@ -202,6 +206,10 @@ msgstr ""
|
|||
msgid "Time (in seconds)"
|
||||
msgstr ""
|
||||
|
||||
# Settings dialog
|
||||
msgid "Time (in minutes)"
|
||||
msgstr ""
|
||||
|
||||
# Settings dialog
|
||||
msgid "Break Settings"
|
||||
msgstr ""
|
||||
|
|
|
@ -208,6 +208,10 @@ msgstr "Vybrať obrázok"
|
|||
msgid "Duration"
|
||||
msgstr "Trvanie"
|
||||
|
||||
# Settings dialog
|
||||
msgid "Time to wait"
|
||||
msgstr ""
|
||||
|
||||
# Settings dialog
|
||||
msgid "Override"
|
||||
msgstr "Prepsať"
|
||||
|
@ -216,6 +220,10 @@ msgstr "Prepsať"
|
|||
msgid "Time (in seconds)"
|
||||
msgstr "Čas (v sekundách)"
|
||||
|
||||
# Settings dialog
|
||||
msgid "Time (in minutes)"
|
||||
msgstr "Čas (v minútach)"
|
||||
|
||||
# Settings dialog
|
||||
msgid "Break Settings"
|
||||
msgstr "Nastavenie prestávok"
|
||||
|
|
|
@ -205,6 +205,10 @@ msgstr ""
|
|||
msgid "Duration"
|
||||
msgstr ""
|
||||
|
||||
# Settings dialog
|
||||
msgid "Time to wait"
|
||||
msgstr ""
|
||||
|
||||
# Settings dialog
|
||||
msgid "Override"
|
||||
msgstr ""
|
||||
|
@ -213,6 +217,10 @@ msgstr ""
|
|||
msgid "Time (in seconds)"
|
||||
msgstr ""
|
||||
|
||||
# Settings dialog
|
||||
msgid "Time (in minutes)"
|
||||
msgstr ""
|
||||
|
||||
# Settings dialog
|
||||
msgid "Break Settings"
|
||||
msgstr ""
|
||||
|
|
|
@ -211,6 +211,10 @@ msgstr "ஒரு படத்தைத் தேர்ந்தெடுக்
|
|||
msgid "Duration"
|
||||
msgstr "கால அளவு"
|
||||
|
||||
# Settings dialog
|
||||
msgid "Time to wait"
|
||||
msgstr ""
|
||||
|
||||
# Settings dialog
|
||||
msgid "Override"
|
||||
msgstr "இயல்புநிலை அமைப்புகளை மீறவும்"
|
||||
|
@ -219,6 +223,10 @@ msgstr "இயல்புநிலை அமைப்புகளை மீற
|
|||
msgid "Time (in seconds)"
|
||||
msgstr "நேரம் (விநாடிகளில்)"
|
||||
|
||||
# Settings dialog
|
||||
msgid "Time (in minutes)"
|
||||
msgstr "நேரம் (நிமிடங்களில்)"
|
||||
|
||||
# Settings dialog
|
||||
msgid "Break Settings"
|
||||
msgstr "இடைவேளை அமைப்புகள்"
|
||||
|
@ -268,7 +276,6 @@ msgid "Play audible alert before and after breaks"
|
|||
msgstr "இடைவேளைகளின் ஆரம்பத்திலும் முடிவிலும் ஒலிச் சமிக்ஞய்"
|
||||
|
||||
# plugin/audiblealert
|
||||
#, fuzzy
|
||||
msgid "Play audible alert before breaks"
|
||||
msgstr "இடைவேளைகளின் தொடக்கத்தில் ஒலிச் சமிக்ஞய்"
|
||||
|
||||
|
|
|
@ -209,6 +209,10 @@ msgstr "Lütfen bir resim seçiniz"
|
|||
msgid "Duration"
|
||||
msgstr "Süre"
|
||||
|
||||
# Settings dialog
|
||||
msgid "Time to wait"
|
||||
msgstr ""
|
||||
|
||||
# Settings dialog
|
||||
msgid "Override"
|
||||
msgstr "Geçersizleştir"
|
||||
|
@ -217,6 +221,10 @@ msgstr "Geçersizleştir"
|
|||
msgid "Time (in seconds)"
|
||||
msgstr "Zaman (saniye)"
|
||||
|
||||
# Settings dialog
|
||||
msgid "Time (in minutes)"
|
||||
msgstr "Zaman (dakika)"
|
||||
|
||||
# Settings dialog
|
||||
msgid "Break Settings"
|
||||
msgstr "Mola Ayarları"
|
||||
|
|
|
@ -205,6 +205,10 @@ msgstr ""
|
|||
msgid "Duration"
|
||||
msgstr ""
|
||||
|
||||
# Settings dialog
|
||||
msgid "Time to wait"
|
||||
msgstr ""
|
||||
|
||||
# Settings dialog
|
||||
msgid "Override"
|
||||
msgstr ""
|
||||
|
@ -213,6 +217,10 @@ msgstr ""
|
|||
msgid "Time (in seconds)"
|
||||
msgstr ""
|
||||
|
||||
# Settings dialog
|
||||
msgid "Time (in minutes)"
|
||||
msgstr ""
|
||||
|
||||
# Settings dialog
|
||||
msgid "Break Settings"
|
||||
msgstr ""
|
||||
|
|
|
@ -210,6 +210,10 @@ msgstr "Будь ласка, виберіть зображення"
|
|||
msgid "Duration"
|
||||
msgstr "Тривалість"
|
||||
|
||||
# Settings dialog
|
||||
msgid "Time to wait"
|
||||
msgstr ""
|
||||
|
||||
# Settings dialog
|
||||
msgid "Override"
|
||||
msgstr "Перевизначити"
|
||||
|
@ -218,6 +222,10 @@ msgstr "Перевизначити"
|
|||
msgid "Time (in seconds)"
|
||||
msgstr "Час (сек)"
|
||||
|
||||
# Settings dialog
|
||||
msgid "Time (in minutes)"
|
||||
msgstr "Час (хв)"
|
||||
|
||||
# Settings dialog
|
||||
msgid "Break Settings"
|
||||
msgstr "Налаштування перерви"
|
||||
|
|
|
@ -209,6 +209,10 @@ msgstr "Vui lòng chọn một hình ảnh"
|
|||
msgid "Duration"
|
||||
msgstr "Thời gian"
|
||||
|
||||
# Settings dialog
|
||||
msgid "Time to wait"
|
||||
msgstr ""
|
||||
|
||||
# Settings dialog
|
||||
msgid "Override"
|
||||
msgstr "Ghi đè"
|
||||
|
@ -217,6 +221,10 @@ msgstr "Ghi đè"
|
|||
msgid "Time (in seconds)"
|
||||
msgstr "Thời gian (bằng giây)"
|
||||
|
||||
# Settings dialog
|
||||
msgid "Time (in minutes)"
|
||||
msgstr "Thời gian (bằng phút)"
|
||||
|
||||
# Settings dialog
|
||||
msgid "Break Settings"
|
||||
msgstr "Cài đặt nghỉ ngơi"
|
||||
|
|
|
@ -208,6 +208,10 @@ msgstr "请选择一张图片"
|
|||
msgid "Duration"
|
||||
msgstr "时长"
|
||||
|
||||
# Settings dialog
|
||||
msgid "Time to wait"
|
||||
msgstr ""
|
||||
|
||||
# Settings dialog
|
||||
msgid "Override"
|
||||
msgstr "覆盖"
|
||||
|
@ -216,6 +220,10 @@ msgstr "覆盖"
|
|||
msgid "Time (in seconds)"
|
||||
msgstr "时间(秒)"
|
||||
|
||||
# Settings dialog
|
||||
msgid "Time (in minutes)"
|
||||
msgstr "时间(分钟)"
|
||||
|
||||
# Settings dialog
|
||||
msgid "Break Settings"
|
||||
msgstr "休息设置"
|
||||
|
|
|
@ -206,6 +206,10 @@ msgstr ""
|
|||
msgid "Duration"
|
||||
msgstr ""
|
||||
|
||||
# Settings dialog
|
||||
msgid "Time to wait"
|
||||
msgstr ""
|
||||
|
||||
# Settings dialog
|
||||
msgid "Override"
|
||||
msgstr ""
|
||||
|
@ -214,6 +218,10 @@ msgstr ""
|
|||
msgid "Time (in seconds)"
|
||||
msgstr ""
|
||||
|
||||
# Settings dialog
|
||||
msgid "Time (in minutes)"
|
||||
msgstr ""
|
||||
|
||||
# Settings dialog
|
||||
msgid "Break Settings"
|
||||
msgstr ""
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
{
|
||||
"meta": {
|
||||
"config_version": "6.0.0"
|
||||
"config_version": "6.0.1"
|
||||
},
|
||||
"allow_postpone": false,
|
||||
"break_interval": 15,
|
||||
"short_break_interval": 15,
|
||||
"long_break_interval": 75,
|
||||
"long_break_duration": 60,
|
||||
"no_of_short_breaks_per_long_break": 5,
|
||||
"pre_break_warning_time": 10,
|
||||
"short_break_duration": 15,
|
||||
"persist_state": false,
|
||||
|
|
|
@ -22,7 +22,14 @@
|
|||
<interface>
|
||||
<requires lib="gtk+" version="3.10"/>
|
||||
<object class="GtkAdjustment" id="adjustment_duration">
|
||||
<property name="upper">100</property>
|
||||
<property name="lower">1</property>
|
||||
<property name="upper">3600</property>
|
||||
<property name="step_increment">1</property>
|
||||
<property name="page_increment">10</property>
|
||||
</object>
|
||||
<object class="GtkAdjustment" id="adjustment_interval">
|
||||
<property name="lower">1</property>
|
||||
<property name="upper">120</property>
|
||||
<property name="step_increment">1</property>
|
||||
<property name="page_increment">10</property>
|
||||
</object>
|
||||
|
@ -59,6 +66,9 @@
|
|||
<property name="skip_taskbar_hint">True</property>
|
||||
<property name="gravity">center</property>
|
||||
<signal name="delete-event" handler="on_window_delete" swapped="no"/>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox" id="box_settings">
|
||||
<property name="visible">True</property>
|
||||
|
@ -208,6 +218,125 @@
|
|||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkFrame" id="frame4">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label_xalign">0</property>
|
||||
<child>
|
||||
<object class="GtkAlignment" id="alignment4">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="left_padding">12</property>
|
||||
<child>
|
||||
<object class="GtkBox" id="box9">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="margin_top">5</property>
|
||||
<property name="margin_bottom">10</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">3</property>
|
||||
<child>
|
||||
<object class="GtkBox" id="box10">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="spacing">10</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="lbl_duration5">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="label" translatable="yes">Override</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSwitch" id="switch_override_interval">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="halign">end</property>
|
||||
<property name="valign">center</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="pack_type">end</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox" id="box11">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="spacing">100</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="lbl_duration6">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="label" translatable="yes">Time (in minutes)</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSpinButton" id="spin_interval">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="halign">end</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="text" translatable="yes">0</property>
|
||||
<property name="adjustment">adjustment_interval</property>
|
||||
<property name="numeric">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="pack_type">end</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child type="label">
|
||||
<object class="GtkLabel" id="label4">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Time to wait</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkFrame" id="frame1">
|
||||
<property name="visible">True</property>
|
||||
|
@ -293,6 +422,7 @@
|
|||
<property name="halign">end</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="adjustment">adjustment_duration</property>
|
||||
<property name="numeric">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
|
@ -323,7 +453,7 @@
|
|||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">1</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
|
@ -444,7 +574,7 @@
|
|||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">2</property>
|
||||
<property name="position">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Generated with glade 3.18.3 -->
|
||||
<!-- Generated with glade 3.22.1 -->
|
||||
<!--
|
||||
~ Safe Eyes is a utility to remind you to take break frequently
|
||||
~ to protect your eyes from eye strain.
|
||||
|
@ -28,7 +28,7 @@
|
|||
</object>
|
||||
<object class="GtkAdjustment" id="adjust_long_break_duration">
|
||||
<property name="lower">1</property>
|
||||
<property name="upper">600</property>
|
||||
<property name="upper">3600</property>
|
||||
<property name="step_increment">5</property>
|
||||
<property name="page_increment">10</property>
|
||||
</object>
|
||||
|
@ -45,7 +45,7 @@
|
|||
</object>
|
||||
<object class="GtkAdjustment" id="adjust_short_break_duration">
|
||||
<property name="lower">1</property>
|
||||
<property name="upper">60</property>
|
||||
<property name="upper">1800</property>
|
||||
<property name="step_increment">1</property>
|
||||
<property name="page_increment">5</property>
|
||||
</object>
|
||||
|
|
|
@ -22,7 +22,7 @@ This module contains the entity classes used by Safe Eyes and its plugins.
|
|||
|
||||
from distutils.version import LooseVersion
|
||||
from enum import Enum
|
||||
|
||||
import logging
|
||||
from safeeyes import Utility
|
||||
|
||||
|
||||
|
@ -30,15 +30,18 @@ class Break(object):
|
|||
"""
|
||||
An entity class which represents a break.
|
||||
"""
|
||||
def __init__(self, break_type, name, time, image, plugins):
|
||||
|
||||
def __init__(self, break_type, name, time, duration, image, plugins):
|
||||
self.type = break_type
|
||||
self.name = name
|
||||
self.time = time
|
||||
self.duration = duration
|
||||
self.image = image
|
||||
self.plugins = plugins
|
||||
self.time = time
|
||||
self.next = None
|
||||
|
||||
def __str__(self):
|
||||
return 'Break: {{name: "{}", type: {}, time: {}}}\n'.format(self.name, self.type, self.time)
|
||||
return 'Break: {{name: "{}", type: {}, duration: {}}}\n'.format(self.name, self.type, self.duration)
|
||||
|
||||
def __repr__(self):
|
||||
return str(self)
|
||||
|
@ -73,6 +76,119 @@ class BreakType(Enum):
|
|||
LONG_BREAK = 2
|
||||
|
||||
|
||||
class BreakQueue(object):
|
||||
|
||||
def __init__(self, config, context):
|
||||
self.context = context
|
||||
self.__current_break = None
|
||||
self.__first_break = None
|
||||
self.__short_break_time = config.get('short_break_interval')
|
||||
self.__long_break_time = config.get('long_break_interval')
|
||||
self.__short_pointer = self.__build_queue(BreakType.SHORT_BREAK,
|
||||
config.get('short_breaks'),
|
||||
self.__short_break_time,
|
||||
config.get('short_break_duration'))
|
||||
self.__long_pointer = self.__build_queue(BreakType.LONG_BREAK,
|
||||
config.get('long_breaks'),
|
||||
self.__long_break_time,
|
||||
config.get('long_break_duration'))
|
||||
# Restore the last break from session
|
||||
if not self.is_empty():
|
||||
last_break = context['session'].get('break')
|
||||
if last_break is not None:
|
||||
current_break = self.get_break()
|
||||
if last_break != current_break.name:
|
||||
pointer = self.next()
|
||||
while(pointer != current_break and pointer.name != last_break):
|
||||
pointer = self.next()
|
||||
|
||||
def get_break(self):
|
||||
if self.__current_break is None:
|
||||
self.__current_break = self.next()
|
||||
return self.__current_break
|
||||
|
||||
def is_long_break(self):
|
||||
return self.__current_break is not None and self.__current_break.type == BreakType.LONG_BREAK
|
||||
|
||||
def next(self):
|
||||
if self.is_empty():
|
||||
return None
|
||||
break_obj = None
|
||||
if self.__short_pointer is None:
|
||||
# No short breaks
|
||||
break_obj = self.__long_pointer
|
||||
self.context['break_type'] = 'long'
|
||||
# Update the pointer to next
|
||||
self.__long_pointer = self.__long_pointer.next
|
||||
elif self.__long_pointer is None:
|
||||
# No long breaks
|
||||
break_obj = self.__short_pointer
|
||||
self.context['break_type'] = 'short'
|
||||
# Update the pointer to next
|
||||
self.__short_pointer = self.__short_pointer.next
|
||||
elif self.__long_pointer.time <= self.__short_pointer.time:
|
||||
# Time for a long break
|
||||
break_obj = self.__long_pointer
|
||||
self.context['break_type'] = 'long'
|
||||
# Update the pointer to next
|
||||
self.__long_pointer = self.__long_pointer.next
|
||||
else:
|
||||
# Time for a short break
|
||||
break_obj = self.__short_pointer
|
||||
self.context['break_type'] = 'short'
|
||||
# Reduce the break time from the next long break
|
||||
self.__long_pointer.time -= self.__short_pointer.time
|
||||
# Update the pointer to next
|
||||
self.__short_pointer = self.__short_pointer.next
|
||||
|
||||
if self.__first_break is None:
|
||||
self.__first_break = break_obj
|
||||
self.context['new_cycle'] = self.__first_break == break_obj
|
||||
if self.__current_break is not None:
|
||||
# Reset the time of long breaks
|
||||
if self.__current_break.type == BreakType.LONG_BREAK:
|
||||
self.__current_break.time = self.__long_break_time
|
||||
|
||||
self.__current_break = break_obj
|
||||
self.context['session']['break'] = self.__current_break.name
|
||||
|
||||
return break_obj
|
||||
|
||||
def is_empty(self):
|
||||
return self.__short_pointer is None and self.__long_pointer is None
|
||||
|
||||
def __build_queue(self, break_type, break_configs, break_time, break_duration):
|
||||
"""
|
||||
Build a circular queue of breaks.
|
||||
"""
|
||||
head = None
|
||||
tail = None
|
||||
for break_config in break_configs:
|
||||
name = _(break_config['name'])
|
||||
duration = break_config.get('duration', break_duration)
|
||||
image = break_config.get('image')
|
||||
plugins = break_config.get('plugins', None)
|
||||
interval = break_config.get('interval', break_time)
|
||||
|
||||
# Validate time value
|
||||
if not isinstance(duration, int) or duration <= 0:
|
||||
logging.error('Invalid break duration in: ' + str(break_config))
|
||||
continue
|
||||
|
||||
break_obj = Break(break_type, name, interval, duration, image, plugins)
|
||||
if head is None:
|
||||
head = break_obj
|
||||
tail = break_obj
|
||||
else:
|
||||
tail.next = break_obj
|
||||
tail = break_obj
|
||||
|
||||
# Connect the tail to the head
|
||||
if tail is not None:
|
||||
tail.next = head
|
||||
return head
|
||||
|
||||
|
||||
class State(Enum):
|
||||
"""
|
||||
Possible states of Safe Eyes.
|
||||
|
@ -89,6 +205,7 @@ class EventHook(object):
|
|||
"""
|
||||
Hook to attach and detach listeners to system events.
|
||||
"""
|
||||
|
||||
def __init__(self):
|
||||
self.__handlers = []
|
||||
|
||||
|
@ -114,6 +231,7 @@ class Config(object):
|
|||
"""
|
||||
The configuration of Safe Eyes.
|
||||
"""
|
||||
|
||||
def __init__(self):
|
||||
# Read the config files
|
||||
self.__user_config = Utility.load_json(Utility.CONFIG_FILE_PATH)
|
||||
|
|
|
@ -95,7 +95,7 @@ def init(ctx, safeeyes_config, plugin_config):
|
|||
idle_time = plugin_config['idle_time']
|
||||
interpret_idle_as_break = plugin_config['interpret_idle_as_break']
|
||||
postpone_if_active = plugin_config['postpone_if_active']
|
||||
break_interval = safeeyes_config.get('break_interval') * 60 # Convert to seconds
|
||||
break_interval = safeeyes_config.get('short_break_interval') * 60 # Convert to seconds
|
||||
waiting_time = min(2, idle_time) # If idle time is 1 sec, wait only 1 sec
|
||||
|
||||
|
||||
|
@ -172,7 +172,7 @@ def update_next_break(break_obj, dateTime):
|
|||
global next_break_time
|
||||
global next_break_duration
|
||||
next_break_time = dateTime
|
||||
next_break_duration = break_obj.time
|
||||
next_break_duration = break_obj.duration
|
||||
|
||||
|
||||
def on_start_break(break_obj):
|
||||
|
|
|
@ -48,7 +48,7 @@ class SettingsDialog(object):
|
|||
self.on_save_settings = on_save_settings
|
||||
self.plugin_switches = {}
|
||||
self.plugin_map = {}
|
||||
self.last_short_break_interval = config.get('break_interval')
|
||||
self.last_short_break_interval = config.get('short_break_interval')
|
||||
self.initializing = True
|
||||
self.infobar_long_break_shown = False
|
||||
|
||||
|
@ -83,8 +83,8 @@ class SettingsDialog(object):
|
|||
# Set the current values of input fields
|
||||
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('break_interval'))
|
||||
self.spin_long_break_interval.set_value(config.get('no_of_short_breaks_per_long_break') * config.get('break_interval'))
|
||||
self.spin_short_break_interval.set_value(config.get('short_break_interval'))
|
||||
self.spin_long_break_interval.set_value(config.get('long_break_interval'))
|
||||
self.spin_time_to_prepare.set_value(config.get('pre_break_warning_time'))
|
||||
self.spin_postpone_duration.set_value(config.get('postpone_duration'))
|
||||
self.spin_disable_keyboard_shortcut.set_value(config.get('shortcut_disable_time'))
|
||||
|
@ -270,8 +270,8 @@ class SettingsDialog(object):
|
|||
"""
|
||||
self.config.set('short_break_duration', self.spin_short_break_duration.get_value_as_int())
|
||||
self.config.set('long_break_duration', self.spin_long_break_duration.get_value_as_int())
|
||||
self.config.set('break_interval', self.spin_short_break_interval.get_value_as_int())
|
||||
self.config.set('no_of_short_breaks_per_long_break', math.floor(self.spin_long_break_interval.get_value_as_int() / self.spin_short_break_interval.get_value_as_int()))
|
||||
self.config.set('short_break_interval', self.spin_short_break_interval.get_value_as_int())
|
||||
self.config.set('long_break_interval', self.spin_long_break_interval.get_value_as_int())
|
||||
self.config.set('pre_break_warning_time', self.spin_time_to_prepare.get_value_as_int())
|
||||
self.config.set('postpone_duration', self.spin_postpone_duration.get_value_as_int())
|
||||
self.config.set('shortcut_disable_time', self.spin_disable_keyboard_shortcut.get_value_as_int())
|
||||
|
@ -380,8 +380,10 @@ class BreakSettingsDialog(object):
|
|||
builder.connect_signals(self)
|
||||
self.window = builder.get_object('dialog_settings_break')
|
||||
self.txt_break = builder.get_object('txt_break')
|
||||
self.switch_override_interval = builder.get_object('switch_override_interval')
|
||||
self.switch_override_duration = builder.get_object('switch_override_duration')
|
||||
self.switch_override_plugins = builder.get_object('switch_override_plugins')
|
||||
self.spin_interval = builder.get_object('spin_interval')
|
||||
self.spin_duration = builder.get_object('spin_duration')
|
||||
self.img_break = builder.get_object('img_break')
|
||||
self.cmb_type = builder.get_object('cmb_type')
|
||||
|
@ -389,18 +391,28 @@ class BreakSettingsDialog(object):
|
|||
grid_plugins = builder.get_object('grid_plugins')
|
||||
list_types = builder.get_object('lst_break_types')
|
||||
|
||||
interval_overriden = break_config.get('interval', None) is not None
|
||||
duration_overriden = break_config.get('duration', None) is not None
|
||||
plugins_overriden = break_config.get('plugins', None) is not None
|
||||
|
||||
# Set the values
|
||||
self.window.set_title(_('Break Settings'))
|
||||
self.txt_break.set_text(_(break_config['name']))
|
||||
self.switch_override_interval.set_active(interval_overriden)
|
||||
self.switch_override_duration.set_active(duration_overriden)
|
||||
self.switch_override_plugins.set_active(plugins_overriden)
|
||||
self.cmb_type.set_active(0 if is_short else 1)
|
||||
list_types[0][0] = _(list_types[0][0])
|
||||
list_types[1][0] = _(list_types[1][0])
|
||||
|
||||
if interval_overriden:
|
||||
self.spin_interval.set_value(break_config['interval'])
|
||||
else:
|
||||
if is_short:
|
||||
self.spin_interval.set_value(parent_config.get('short_break_interval'))
|
||||
else:
|
||||
self.spin_interval.set_value(parent_config.get('long_break_interval'))
|
||||
|
||||
if duration_overriden:
|
||||
self.spin_duration.set_value(break_config['duration'])
|
||||
else:
|
||||
|
@ -424,11 +436,19 @@ class BreakSettingsDialog(object):
|
|||
row = 0
|
||||
# GtkSwitch state-set signal is available only from 3.14
|
||||
if Gtk.get_minor_version() >= 14:
|
||||
self.switch_override_interval.connect('state-set', self.on_switch_override_interval_activate)
|
||||
self.switch_override_duration.connect('state-set', self.on_switch_override_duration_activate)
|
||||
self.switch_override_plugins.connect('state-set', self.on_switch_override_plugins_activate)
|
||||
self.on_switch_override_interval_activate(self.switch_override_interval, self.switch_override_interval.get_active())
|
||||
self.on_switch_override_duration_activate(self.switch_override_duration, self.switch_override_duration.get_active())
|
||||
self.on_switch_override_plugins_activate(self.switch_override_plugins, self.switch_override_plugins.get_active())
|
||||
|
||||
def on_switch_override_interval_activate(self, switch_button, state):
|
||||
"""
|
||||
switch_override_interval state change event handler.
|
||||
"""
|
||||
self.spin_interval.set_sensitive(state)
|
||||
|
||||
def on_switch_override_duration_activate(self, switch_button, state):
|
||||
"""
|
||||
switch_override_duration state change event handler.
|
||||
|
@ -472,6 +492,10 @@ class BreakSettingsDialog(object):
|
|||
break_name = self.txt_break.get_text().strip()
|
||||
if break_name:
|
||||
self.break_config['name'] = break_name
|
||||
if self.switch_override_interval.get_active():
|
||||
self.break_config['interval'] = int(self.spin_interval.get_value())
|
||||
else:
|
||||
self.break_config.pop('interval', None)
|
||||
if self.switch_override_duration.get_active():
|
||||
self.break_config['duration'] = int(self.spin_duration.get_value())
|
||||
else:
|
||||
|
|
Loading…
Reference in New Issue