Skip to content

Commit

Permalink
Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
Raymo111 committed Aug 19, 2023
1 parent 9e04c1c commit 30d267d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
9 changes: 5 additions & 4 deletions src/nexus/Freqlog/Freqlog.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,11 @@ def _log_and_reset_word(min_length: int = 1) -> None:
def __init__(self, db_path: str = Defaults.DEFAULT_DB_PATH, loggable: bool = True):
self.backend: Backend = SQLiteBackend(db_path)
self.q: Queue = Queue()
self.listener: kbd.Listener | None = kbd.Listener(on_press=self._on_press, on_release=self._on_release,
name="Keyboard Listener") if loggable else None
self.mouse_listener: mouse.Listener | None = mouse.Listener(on_click=self._on_click,
name="Mouse Listener") if loggable else None
self.listener: kbd.Listener | None = None
self.mouse_listener: mouse.Listener | None = None
if loggable:
self.listener = kbd.Listener(on_press=self._on_press, on_release=self._on_release, name="Keyboard Listener")
self.mouse_listener = mouse.Listener(on_click=self._on_click, name="Mouse Listener")
self.new_word_threshold: float = Defaults.DEFAULT_NEW_WORD_THRESHOLD
self.chord_char_threshold: int = Defaults.DEFAULT_CHORD_CHAR_THRESHOLD
self.allowed_keys_in_chord: set = Defaults.DEFAULT_ALLOWED_KEYS_IN_CHORD
Expand Down
12 changes: 6 additions & 6 deletions src/nexus/GUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def __init__(self, args: argparse.Namespace):

# Translation
self.translator = Translator(self.app)
if self.translator.load(QLocale.system(), 'i18n', '_', str(Path(__file__).resolve().parent)+'/translations'):
if self.translator.load(QLocale.system(), 'i18n', '_', str(Path(__file__).resolve().parent) + '/translations'):
self.app.installTranslator(self.translator)
self.tr = self.translator.translate

Expand Down Expand Up @@ -104,7 +104,7 @@ def start_stop(self):
"""Controller for start/stop logging button"""
if not self.start_stop_button_started:
# Update button to starting
# TODO: fix signal blocking (not currently working)
# TODO: fix signal blocking (to prevent spam-clicking the button restarting logging, not currently working)
self.start_stop_button.blockSignals(True)
self.start_stop_button.setEnabled(False)
self.start_stop_button.setText(self.tr("GUI", "Starting..."))
Expand Down Expand Up @@ -238,10 +238,10 @@ def remove_banword():
else CaseSensitivity.INSENSITIVE)
conf_dialog = ConfirmDialog()
if len(selected_words) > 1:
confirmText = self.tr("GUI", "Unban {} words")
confirm_text = self.tr("GUI", "Unban {} words")
else:
confirmText = self.tr("GUI", "Unban one word")
conf_dialog.confirmText.setText(confirmText.format(len(selected_words)))
confirm_text = self.tr("GUI", "Unban one word")
conf_dialog.confirmText.setText(confirm_text.format(len(selected_words)))
conf_dialog.buttonBox.accepted.connect(lambda: self.temp_freqlog.unban_words(selected_words))
conf_dialog.exec()
refresh_banlist()
Expand All @@ -258,7 +258,7 @@ def export(self):
filename += ".csv"
num_exported = self.temp_freqlog.export_words_to_csv(filename)
self.statusbar.showMessage(
self.tr("GUI", "Exported {} words to {}".format(num_exported, filename)))
self.tr("GUI", "Exported {} words to {}".format(num_exported, filename)))

def exec(self):
"""Start the GUI"""
Expand Down
2 changes: 1 addition & 1 deletion src/nexus/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ def main():
match args.command:
case "startlog": # start freqlogging
freqlog = Freqlog.Freqlog(args.freq_log_path, loggable=True)
signal.signal(signal.SIGINT, lambda *_: freqlog.stop_logging())
signal.signal(signal.SIGINT, lambda: freqlog.stop_logging())
freqlog.start_logging(args.new_word_threshold, args.chord_char_threshold, args.allowed_keys_in_chord,
Defaults.DEFAULT_MODIFIER_KEYS - set(args.remove_modifier_key) | set(
args.add_modifier_key))
Expand Down

0 comments on commit 30d267d

Please sign in to comment.