diff --git a/CHANGELOG.md b/CHANGELOG.md index 1fd4577..ed7a59c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,8 @@ # 0.4.6 * More Italian translations, thank you @mdaleo404 + * Set locked status on window title when locked + * Don't exit on incorrect key, let it be tried again # 0.4.5 diff --git a/bouquin/locales/en.json b/bouquin/locales/en.json index e4fb1c7..f6be3e1 100644 --- a/bouquin/locales/en.json +++ b/bouquin/locales/en.json @@ -85,7 +85,7 @@ "history_dialog_delete": "&Delete revision", "history_dialog_delete_failed": "Could not delete revision", "key_prompt_enter_key": "Enter key", - "lock_overlay_locked_due_to_inactivity": "Locked due to inactivity", + "lock_overlay_locked": "Locked", "lock_overlay_unlock": "Unlock", "main_window_lock_screen_accessibility": "&Lock screen", "main_window_ready": "Ready", diff --git a/bouquin/locales/fr.json b/bouquin/locales/fr.json index c518fb6..99c5f66 100644 --- a/bouquin/locales/fr.json +++ b/bouquin/locales/fr.json @@ -69,7 +69,7 @@ "history_dialog_revert_to_selected": "Revenir à la sélection", "history_dialog_revert_failed": "Échec de la restauration", "key_prompt_enter_key": "Saisir la clé", - "lock_overlay_locked_due_to_inactivity": "Verrouillé pour cause d’inactivité", + "lock_overlay_locked": "Verrouillé", "lock_overlay_unlock": "Déverrouiller", "main_window_ready": "Prêt", "main_window_save_a_version": "Enregistrer une version", diff --git a/bouquin/locales/it.json b/bouquin/locales/it.json index 2d4e76c..6a178bb 100644 --- a/bouquin/locales/it.json +++ b/bouquin/locales/it.json @@ -69,7 +69,7 @@ "history_dialog_revert_to_selected": "Ripristina alla versione selezionata", "history_dialog_revert_failed": "Ripristino fallito", "key_prompt_enter_key": "Inserisci la chiave", - "lock_overlay_locked_due_to_inactivity": "Bloccato per inattività", + "lock_overlay_locked": "Bloccato", "lock_overlay_unlock": "Sblocca", "main_window_ready": "Pronto", "main_window_save_a_version": "Salva versione", diff --git a/bouquin/lock_overlay.py b/bouquin/lock_overlay.py index 42e92e1..4a1a98e 100644 --- a/bouquin/lock_overlay.py +++ b/bouquin/lock_overlay.py @@ -21,7 +21,7 @@ class LockOverlay(QWidget): lay = QVBoxLayout(self) lay.addStretch(1) - msg = QLabel(strings._("lock_overlay_locked_due_to_inactivity"), self) + msg = QLabel(strings._("lock_overlay_locked"), self) msg.setObjectName("lockLabel") msg.setAlignment(Qt.AlignCenter) diff --git a/bouquin/main_window.py b/bouquin/main_window.py index 45e213f..b26ba2c 100644 --- a/bouquin/main_window.py +++ b/bouquin/main_window.py @@ -371,7 +371,7 @@ class MainWindow(QMainWindow): else: error = str(e) QMessageBox.critical(self, strings._("db_database_error"), error) - sys.exit(1) + return False def _prompt_for_key_until_valid(self, first_time: bool) -> bool: """ @@ -1691,6 +1691,8 @@ class MainWindow(QMainWindow): tb.hide() self._lock_overlay.show() self._lock_overlay.raise_() + lock_msg = strings._("lock_overlay_locked") + self.setWindowTitle(f"{APP_NAME} ({lock_msg})") @Slot() def _on_unlock_clicked(self): @@ -1717,6 +1719,7 @@ class MainWindow(QMainWindow): tb.show() self._idle_timer.start() QTimer.singleShot(0, self._focus_editor_now) + self.setWindowTitle(APP_NAME) # ----------------- Close handlers ----------------- # def closeEvent(self, event): diff --git a/tests/test_main_window.py b/tests/test_main_window.py index 3e58443..bbf7f0a 100644 --- a/tests/test_main_window.py +++ b/tests/test_main_window.py @@ -470,22 +470,7 @@ def test_try_connect_maps_errors( mwmod.QMessageBox, "critical", staticmethod(fake_critical), raising=True ) - # Intercept sys.exit so the test process doesn't actually die - exited = {} - - def fake_exit(code=0): - exited["code"] = code - # mimic real behaviour: raise SystemExit so callers see a fatal exit - raise SystemExit(code) - - monkeypatch.setattr(mwmod.sys, "exit", fake_exit, raising=True) - - # _try_connect should now raise SystemExit instead of returning - with pytest.raises(SystemExit): - w._try_connect() - - # We attempted to exit with code 1 - assert exited["code"] == 1 + w._try_connect() # And we still showed the right error message assert "database" in shown["title"].lower()