diff --git a/nexus/Freqlog/Freqlog.py b/nexus/Freqlog/Freqlog.py index e671a16..ae73be2 100644 --- a/nexus/Freqlog/Freqlog.py +++ b/nexus/Freqlog/Freqlog.py @@ -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: @@ -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 diff --git a/nexus/__main__.py b/nexus/__main__.py index cf7a2b7..c05f19b 100644 --- a/nexus/__main__.py +++ b/nexus/__main__.py @@ -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: @@ -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 diff --git a/requirements.txt b/requirements.txt index 1f973c6..bbb669d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -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 diff --git a/setup.cfg b/setup.cfg index 7f6fff1..888bc34 100644 --- a/setup.cfg +++ b/setup.cfg @@ -60,7 +60,7 @@ packages = find: python_requires = >=3.11 install_requires = setuptools - vinput + vinput>=1.3.0 [options.entry_points] console_scripts = diff --git a/test-requirements.txt b/test-requirements.txt index 1eb2737..73c70f4 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -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