Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions nexus/Freqlog/Freqlog.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,7 @@ def _log_and_reset_word(min_length: int = 2) -> None:

def _update_timing():
"""Must be called after adding a key to word and before self.q.task_done()"""
nonlocal word_start_time, word_end_time, last_key_was_disallowed, chars_since_last_bs, \
avg_char_time_after_last_bs
nonlocal word_start_time, word_end_time, avg_char_time_after_last_bs
if not word_start_time:
word_start_time = time_pressed
elif chars_since_last_bs > 1 and avg_char_time_after_last_bs:
Expand Down Expand Up @@ -393,6 +392,12 @@ def stop_logging(self) -> None: # FIXME: find out why this runs twice on one Ct
self.killed = True
logging.warning("Stopping freqlog")
if self.listener:
# stop() unblocks the listener's blocking start() call so its thread can
# return; without it the listener thread would hang and prevent a clean
# shutdown. Wait for the thread to exit before freeing the listener.
self.listener.stop()
if self.listener_thread.is_alive():
self.listener_thread.join()
del self.listener
self.listener = None
self.is_logging = False
Comment on lines 392 to 403
Expand Down
4 changes: 2 additions & 2 deletions nexus/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,6 @@ def main():

def _prompt_for_upgrade(db_version: Version) -> None:
"""Prompt user to upgrade"""
nonlocal args
logging.warning(
f"You are running version {__version__} of nexus, but your database is on version {db_version}.")
if not args.upgrade:
Expand Down Expand Up @@ -352,7 +351,8 @@ def _prompt_for_password(new: bool, desc: str = "") -> str:
for mod in args.modifier_keys:
logging.debug(' - ' + str(mod))
setattr(mods, mod, True)
signal.signal(signal.SIGINT, lambda _: freqlog.stop_logging())
# Signal handlers are called with (signum, frame); accept and ignore both.
signal.signal(signal.SIGINT, lambda *_: freqlog.stop_logging())
freqlog.start_logging(args.new_word_threshold, args.chord_char_threshold, args.allowed_chars,
args.allowed_first_chars, mods)
case "checkword": # Check if word is banned
Expand Down
8 changes: 4 additions & 4 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
charachorder.py~=0.5.2
cryptography~=45.0
pyinstaller~=5.13
PySide6~=6.5
requests~=2.32.1
pyinstaller~=6.14.1
PySide6~=6.9.1
requests~=2.32.4
setuptools~=80.7
vinput~=0.2.0
vinput~=1.3.0
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ packages = find:
python_requires = >=3.11
install_requires =
setuptools
vinput
vinput>=1.3.0
Comment on lines 61 to +63

[options.entry_points]
console_scripts =
Expand Down
8 changes: 4 additions & 4 deletions test-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
flake8~=6.1
pytest~=7.4
pytest-cov~=4.1
pre-commit~=3.3
flake8~=7.2.0
pytest~=8.4.1
pytest-cov~=6.2.1
pre-commit~=4.2.0
Loading