Skip to content

Commit 8416f34

Browse files
committed
docstrings
1 parent 670b405 commit 8416f34

2 files changed

Lines changed: 14 additions & 0 deletions

File tree

config/settings.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@
3131

3232

3333
def get_setting(setting_type, setting_name=None):
34+
"""
35+
gets a user setting or group of user settings
36+
from the user_settings.json or, if that doesn't exist,
37+
the default_user_settings dictionary
38+
"""
3439
json_path = os.path.join(dirs["config"], "user_settings.json")
3540
if os.path.exists(json_path):
3641
with open(json_path, "r", encoding='utf-8') as f:

gui/dialogs.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,7 @@ def reset(self):
325325

326326

327327
class Spin_setter:
328+
"""Spinbox input for changing user settings"""
328329
def __init__(self, parent, label, key, suffix=None):
329330
center = QtCore.Qt.AlignmentFlag.AlignCenter
330331
Vcenter = QtCore.Qt.AlignmentFlag.AlignVCenter
@@ -345,6 +346,11 @@ def __init__(self, parent, label, key, suffix=None):
345346
self.spn.valueChanged.connect(self.show_edit)
346347

347348
def show_edit(self):
349+
"""
350+
checks whether the settings has been edited, and changes label color accordingly
351+
also keeps a running tally of how many settings have been edited
352+
and enables/disables the "Save settings" button accordingly
353+
"""
348354
if self.spn.value() != self.start_value:
349355
if self.edited is False:
350356
self.edited = True
@@ -372,6 +378,7 @@ def reset(self):
372378

373379

374380
class Settings_dialog(QtWidgets.QDialog):
381+
"""Dialog for editing user settings"""
375382
def __init__(self, parent):
376383
super(QtWidgets.QDialog, self).__init__(parent)
377384
self.setWindowTitle("Settings")
@@ -454,6 +461,7 @@ def __init__(self, parent):
454461
self.close_shortcut.activated.connect(self.close)
455462

456463
def reset(self):
464+
"""Resets values to whatever is saved in user_settings.json, or to default_user_settings if no user_settings.json exists"""
457465
for variable in [
458466
self.tasks_setter,
459467
self.data_setter,
@@ -470,6 +478,7 @@ def reset(self):
470478
self.save_settings_btn.setFocus()
471479

472480
def fill_with_defaults(self):
481+
"Populates inputs with default_user_settings dictionary values from settings.py"
473482
self.update_interval.spn.setValue(default_user_settings["plotting"]["update_interval"])
474483
self.event_history_len.spn.setValue(default_user_settings["plotting"]["event_history_len"])
475484
self.state_history_len.spn.setValue(default_user_settings["plotting"]["state_history_len"])

0 commit comments

Comments
 (0)