Set locked status on window title when locked. Don't exit on incorrect key, let it be tried again
This commit is contained in:
parent
648031786a
commit
26737fbfb2
7 changed files with 11 additions and 21 deletions
|
|
@ -1,6 +1,8 @@
|
||||||
# 0.4.6
|
# 0.4.6
|
||||||
|
|
||||||
* More Italian translations, thank you @mdaleo404
|
* 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
|
# 0.4.5
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -85,7 +85,7 @@
|
||||||
"history_dialog_delete": "&Delete revision",
|
"history_dialog_delete": "&Delete revision",
|
||||||
"history_dialog_delete_failed": "Could not delete revision",
|
"history_dialog_delete_failed": "Could not delete revision",
|
||||||
"key_prompt_enter_key": "Enter key",
|
"key_prompt_enter_key": "Enter key",
|
||||||
"lock_overlay_locked_due_to_inactivity": "Locked due to inactivity",
|
"lock_overlay_locked": "Locked",
|
||||||
"lock_overlay_unlock": "Unlock",
|
"lock_overlay_unlock": "Unlock",
|
||||||
"main_window_lock_screen_accessibility": "&Lock screen",
|
"main_window_lock_screen_accessibility": "&Lock screen",
|
||||||
"main_window_ready": "Ready",
|
"main_window_ready": "Ready",
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,7 @@
|
||||||
"history_dialog_revert_to_selected": "Revenir à la sélection",
|
"history_dialog_revert_to_selected": "Revenir à la sélection",
|
||||||
"history_dialog_revert_failed": "Échec de la restauration",
|
"history_dialog_revert_failed": "Échec de la restauration",
|
||||||
"key_prompt_enter_key": "Saisir la clé",
|
"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",
|
"lock_overlay_unlock": "Déverrouiller",
|
||||||
"main_window_ready": "Prêt",
|
"main_window_ready": "Prêt",
|
||||||
"main_window_save_a_version": "Enregistrer une version",
|
"main_window_save_a_version": "Enregistrer une version",
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,7 @@
|
||||||
"history_dialog_revert_to_selected": "Ripristina alla versione selezionata",
|
"history_dialog_revert_to_selected": "Ripristina alla versione selezionata",
|
||||||
"history_dialog_revert_failed": "Ripristino fallito",
|
"history_dialog_revert_failed": "Ripristino fallito",
|
||||||
"key_prompt_enter_key": "Inserisci la chiave",
|
"key_prompt_enter_key": "Inserisci la chiave",
|
||||||
"lock_overlay_locked_due_to_inactivity": "Bloccato per inattività",
|
"lock_overlay_locked": "Bloccato",
|
||||||
"lock_overlay_unlock": "Sblocca",
|
"lock_overlay_unlock": "Sblocca",
|
||||||
"main_window_ready": "Pronto",
|
"main_window_ready": "Pronto",
|
||||||
"main_window_save_a_version": "Salva versione",
|
"main_window_save_a_version": "Salva versione",
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ class LockOverlay(QWidget):
|
||||||
lay = QVBoxLayout(self)
|
lay = QVBoxLayout(self)
|
||||||
lay.addStretch(1)
|
lay.addStretch(1)
|
||||||
|
|
||||||
msg = QLabel(strings._("lock_overlay_locked_due_to_inactivity"), self)
|
msg = QLabel(strings._("lock_overlay_locked"), self)
|
||||||
msg.setObjectName("lockLabel")
|
msg.setObjectName("lockLabel")
|
||||||
msg.setAlignment(Qt.AlignCenter)
|
msg.setAlignment(Qt.AlignCenter)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -371,7 +371,7 @@ class MainWindow(QMainWindow):
|
||||||
else:
|
else:
|
||||||
error = str(e)
|
error = str(e)
|
||||||
QMessageBox.critical(self, strings._("db_database_error"), error)
|
QMessageBox.critical(self, strings._("db_database_error"), error)
|
||||||
sys.exit(1)
|
return False
|
||||||
|
|
||||||
def _prompt_for_key_until_valid(self, first_time: bool) -> bool:
|
def _prompt_for_key_until_valid(self, first_time: bool) -> bool:
|
||||||
"""
|
"""
|
||||||
|
|
@ -1691,6 +1691,8 @@ class MainWindow(QMainWindow):
|
||||||
tb.hide()
|
tb.hide()
|
||||||
self._lock_overlay.show()
|
self._lock_overlay.show()
|
||||||
self._lock_overlay.raise_()
|
self._lock_overlay.raise_()
|
||||||
|
lock_msg = strings._("lock_overlay_locked")
|
||||||
|
self.setWindowTitle(f"{APP_NAME} ({lock_msg})")
|
||||||
|
|
||||||
@Slot()
|
@Slot()
|
||||||
def _on_unlock_clicked(self):
|
def _on_unlock_clicked(self):
|
||||||
|
|
@ -1717,6 +1719,7 @@ class MainWindow(QMainWindow):
|
||||||
tb.show()
|
tb.show()
|
||||||
self._idle_timer.start()
|
self._idle_timer.start()
|
||||||
QTimer.singleShot(0, self._focus_editor_now)
|
QTimer.singleShot(0, self._focus_editor_now)
|
||||||
|
self.setWindowTitle(APP_NAME)
|
||||||
|
|
||||||
# ----------------- Close handlers ----------------- #
|
# ----------------- Close handlers ----------------- #
|
||||||
def closeEvent(self, event):
|
def closeEvent(self, event):
|
||||||
|
|
|
||||||
|
|
@ -470,23 +470,8 @@ def test_try_connect_maps_errors(
|
||||||
mwmod.QMessageBox, "critical", staticmethod(fake_critical), raising=True
|
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()
|
w._try_connect()
|
||||||
|
|
||||||
# We attempted to exit with code 1
|
|
||||||
assert exited["code"] == 1
|
|
||||||
|
|
||||||
# And we still showed the right error message
|
# And we still showed the right error message
|
||||||
assert "database" in shown["title"].lower()
|
assert "database" in shown["title"].lower()
|
||||||
if expect_key_msg:
|
if expect_key_msg:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue