mirror of
https://github.com/slgobinath/SafeEyes.git
synced 2024-12-23 23:41:20 +01:00
Local function names should match #550
This commit is contained in:
parent
edb5b70b53
commit
cbfc0cc133
@ -35,8 +35,8 @@ idle_condition = threading.Condition()
|
||||
lock = threading.Lock()
|
||||
active = False
|
||||
idle_time = 0
|
||||
enable_safe_eyes = None
|
||||
disable_safe_eyes = None
|
||||
enable_safeeyes = None
|
||||
disable_safeeyes = None
|
||||
smart_pause_activated = False
|
||||
idle_start_time = None
|
||||
next_break_time = None
|
||||
@ -150,8 +150,8 @@ def init(ctx, safeeyes_config, plugin_config):
|
||||
Initialize the plugin.
|
||||
"""
|
||||
global context
|
||||
global enable_safe_eyes
|
||||
global disable_safe_eyes
|
||||
global enable_safeeyes
|
||||
global disable_safeeyes
|
||||
global postpone
|
||||
global idle_time
|
||||
global short_break_interval
|
||||
@ -163,8 +163,8 @@ def init(ctx, safeeyes_config, plugin_config):
|
||||
global use_swayidle
|
||||
logging.debug('Initialize Smart Pause plugin')
|
||||
context = ctx
|
||||
enable_safe_eyes = context['api']['enable_safeeyes']
|
||||
disable_safe_eyes = context['api']['disable_safeeyes']
|
||||
enable_safeeyes = context['api']['enable_safeeyes']
|
||||
disable_safeeyes = context['api']['disable_safeeyes']
|
||||
postpone = context['api']['postpone']
|
||||
idle_time = plugin_config['idle_time']
|
||||
interpret_idle_as_break = plugin_config['interpret_idle_as_break']
|
||||
@ -197,7 +197,7 @@ def __start_idle_monitor():
|
||||
smart_pause_activated = True
|
||||
idle_start_time = datetime.datetime.now() - datetime.timedelta(seconds=system_idle_time)
|
||||
logging.info('Pause Safe Eyes due to system idle')
|
||||
disable_safe_eyes(None)
|
||||
disable_safeeyes(None)
|
||||
elif system_idle_time < idle_time and context['state'] == State.STOPPED and idle_start_time is not None:
|
||||
logging.info('Resume Safe Eyes due to user activity')
|
||||
smart_pause_activated = False
|
||||
@ -214,12 +214,12 @@ def __start_idle_monitor():
|
||||
# This method runs in a thread since the start.
|
||||
# It may run before next_break is initialized in the update_next_break method
|
||||
next_break = next_break_time + idle_period
|
||||
enable_safe_eyes(next_break.timestamp())
|
||||
enable_safeeyes(next_break.timestamp())
|
||||
else:
|
||||
enable_safe_eyes()
|
||||
enable_safeeyes()
|
||||
else:
|
||||
# User is idle for more than the time between two breaks
|
||||
enable_safe_eyes()
|
||||
enable_safeeyes()
|
||||
|
||||
|
||||
def on_start():
|
||||
|
@ -53,8 +53,8 @@ class TrayIcon:
|
||||
self.on_show_settings = context['api']['show_settings']
|
||||
self.on_show_about = context['api']['show_about']
|
||||
self.quit = context['api']['quit']
|
||||
self.on_enable = context['api']['enable_safeeyes']
|
||||
self.on_disable = context['api']['disable_safeeyes']
|
||||
self.enable_safeeyes = context['api']['enable_safeeyes']
|
||||
self.disable_safeeyes = context['api']['disable_safeeyes']
|
||||
self.take_break = context['api']['take_break']
|
||||
self.has_breaks = context['api']['has_breaks']
|
||||
self.get_break_time = context['api']['get_break_time']
|
||||
@ -324,7 +324,7 @@ class TrayIcon:
|
||||
if not self.active:
|
||||
with self.lock:
|
||||
self.enable_ui()
|
||||
self.on_enable()
|
||||
self.enable_safeeyes()
|
||||
# Notify all schedulers
|
||||
self.idle_condition.acquire()
|
||||
self.idle_condition.notify_all()
|
||||
@ -342,13 +342,13 @@ class TrayIcon:
|
||||
time_to_wait = args[1]
|
||||
if time_to_wait <= 0:
|
||||
info = _('Disabled until restart')
|
||||
self.on_disable(info)
|
||||
self.disable_safeeyes(info)
|
||||
self.wakeup_time = None
|
||||
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.disable_safeeyes(info)
|
||||
self.item_info.set_label(info)
|
||||
utility.start_thread(self.__schedule_resume, time_minutes=time_to_wait)
|
||||
|
||||
|
@ -41,7 +41,7 @@ class BreakScreen:
|
||||
This class reads the break_screen.glade and build the user interface.
|
||||
"""
|
||||
|
||||
def __init__(self, context, on_skip, on_postpone, style_sheet_path):
|
||||
def __init__(self, context, on_skipped, on_postponed, style_sheet_path):
|
||||
self.context = context
|
||||
self.count_labels = []
|
||||
self.display = Display()
|
||||
@ -50,8 +50,8 @@ class BreakScreen:
|
||||
self.is_pretified = False
|
||||
self.keycode_shortcut_postpone = 65
|
||||
self.keycode_shortcut_skip = 9
|
||||
self.on_postpone = on_postpone
|
||||
self.on_skip = on_skip
|
||||
self.on_postponed = on_postponed
|
||||
self.on_skipped = on_skipped
|
||||
self.shortcut_disable_time = 2
|
||||
self.strict_break = False
|
||||
self.windows = []
|
||||
@ -77,8 +77,8 @@ class BreakScreen:
|
||||
Skip the break from the break screen
|
||||
"""
|
||||
logging.info("User skipped the break")
|
||||
# Must call on_skip before close to lock screen before closing the break screen
|
||||
self.on_skip()
|
||||
# Must call on_skipped before close to lock screen before closing the break screen
|
||||
self.on_skipped()
|
||||
self.close()
|
||||
|
||||
def postpone_break(self):
|
||||
@ -86,7 +86,7 @@ class BreakScreen:
|
||||
Postpone the break from the break screen
|
||||
"""
|
||||
logging.info("User postponed the break")
|
||||
self.on_postpone()
|
||||
self.on_postponed()
|
||||
self.close()
|
||||
|
||||
def on_window_delete(self, *args):
|
||||
|
Loading…
Reference in New Issue
Block a user