Skip to content

Commit c3ff3a0

Browse files
committed
Comment safeeyes functions
1 parent 03f612d commit c3ff3a0

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

safeeyes/safeeyes/safeeyes

+40
Original file line numberDiff line numberDiff line change
@@ -51,32 +51,54 @@ system_language_directory = os.path.join(bin_directory, "config/lang")
5151
is_active = True
5252
CONFIGURATION_VERSION = 1
5353

54+
"""
55+
Listen to tray icon Settings action and send the signal to Settings dialog.
56+
"""
5457
def show_settings():
5558
logging.info("Show Settings dialog")
5659
settings_dialog = SettingsDialog(config, language, save_settings, settings_dialog_glade)
5760
settings_dialog.show()
5861

62+
"""
63+
Receive the signal from core and pass it to the Notification.
64+
"""
5965
def show_notification():
6066
notification.show(config['pre_break_warning_time'])
6167

68+
"""
69+
Receive the break signal from core and pass it to the break screen.
70+
"""
6271
def show_alert(message):
6372
logging.info("Show the break screen")
6473
notification.close()
6574
break_screen.show_message(message)
6675

76+
"""
77+
Receive the stop break signal from core and pass it to the break screen.
78+
"""
6779
def close_alert():
6880
logging.info("Close the break screen")
6981
break_screen.close()
7082

83+
"""
84+
Receive the count from core and pass it to the break screen.
85+
"""
7186
def on_countdown(count):
7287
break_screen.show_count_down(count)
7388

89+
"""
90+
Listen to the tray menu quit action and stop the core, notification and the app itself.
91+
"""
7492
def on_quit():
7593
logging.info("Quit Safe Eyes")
7694
core.stop()
7795
notification.quite();
7896
Gtk.main_quit()
7997

98+
"""
99+
If the system goes to sleep, Safe Eyes stop the core if it is already active.
100+
If it was active, Safe Eyes will become active after wake up.
101+
"""
80102
def handle_suspend_callback(sleeping):
81103
if sleeping:
82104
# Sleeping / suspending
@@ -89,15 +111,24 @@ def handle_suspend_callback(sleeping):
89111
core.start()
90112
logging.info("Resumed Safe Eyes after system wakeup")
91113

114+
"""
115+
Setup system suspend listener.
116+
"""
92117
def handle_system_suspend():
93118
DBusGMainLoop(set_as_default=True)
94119
bus = dbus.SystemBus()
95120
bus.add_signal_receiver(handle_suspend_callback, 'PrepareForSleep', 'org.freedesktop.login1.Manager', 'org.freedesktop.login1')
96121

122+
"""
123+
Listen to break screen Skip action and send the signal to core.
124+
"""
97125
def on_skipped():
98126
logging.info("User skipped the break")
99127
core.skip_break()
100128

129+
"""
130+
Listen to Settings dialog Save action and write to the config file.
131+
"""
101132
def save_settings(config):
102133
logging.info("Saving settings to safeeyes.json")
103134
if is_active:
@@ -114,14 +145,23 @@ def save_settings(config):
114145
# 1 sec delay is required to give enough time for core to be stopped
115146
Timer(1.0, core.start).start()
116147

148+
"""
149+
Listen to tray icon enable action and send the signal to core.
150+
"""
117151
def enable_safeeyes():
118152
is_active = True
119153
core.toggle_active_state()
120154

155+
"""
156+
Listen to tray icon disable action and send the signal to core.
157+
"""
121158
def disable_safeeyes():
122159
is_active = False
123160
core.toggle_active_state()
124161

162+
"""
163+
Initialize the configuration directory and copy the files to ~/.config directory.
164+
"""
125165
def initialize_config():
126166
global config
127167
config_dir_path = os.path.join(os.path.expanduser('~'), '.config/safeeyes/style')

0 commit comments

Comments
 (0)