From 7557f2455e60b1e0cf8112360e7eb165eea28392 Mon Sep 17 00:00:00 2001 From: jj-so Date: Wed, 22 Nov 2023 12:14:35 +0100 Subject: [PATCH 1/2] During the update process, the gui is busy --- nitrokeyapp/gui.py | 6 ++++++ nitrokeyapp/overview_tab.py | 12 +++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/nitrokeyapp/gui.py b/nitrokeyapp/gui.py index 3077a771..11b9f3d5 100644 --- a/nitrokeyapp/gui.py +++ b/nitrokeyapp/gui.py @@ -239,6 +239,7 @@ def remove_device(self, data: DeviceData) -> None: self.widget_show() def refresh(self) -> None: + self.overview_tab.busy_state_changed.connect(self.set_busy) """ Should be called if the selected device or the selected tab is changed """ @@ -292,8 +293,13 @@ def slot_lock_button_pressed(self) -> None: def set_busy(self, busy: bool) -> None: if busy: self.setCursor(QCursor(Qt.WaitCursor)) + self.home_button.setEnabled(False) + self.tabs.setEnabled(False) else: self.unsetCursor() + self.home_button.setEnabled(True) + self.tabs.setEnabled(True) + # TODO: setEnabled? # self.setEnabled(not busy) diff --git a/nitrokeyapp/overview_tab.py b/nitrokeyapp/overview_tab.py index aa853a71..f60c9a0d 100644 --- a/nitrokeyapp/overview_tab.py +++ b/nitrokeyapp/overview_tab.py @@ -1,7 +1,7 @@ from typing import Optional from pynitrokey.nk3.admin_app import InitStatus -from PyQt5.QtCore import pyqtSlot +from PyQt5.QtCore import pyqtSignal, pyqtSlot from PyQt5.QtWidgets import QFileDialog, QWidget from nitrokeyapp.device_data import DeviceData @@ -12,6 +12,8 @@ class OverviewTab(QtUtilsMixIn, QWidget): + busy_state_changed = pyqtSignal(bool) + def __init__(self, info_box: InfoBox, parent: Optional[QWidget] = None) -> None: QWidget.__init__(self, parent) QtUtilsMixIn.__init__(self) @@ -98,18 +100,26 @@ def set_update_enabled(self, enabled: bool) -> None: self.ui.pushButtonUpdate.setEnabled(enabled) self.ui.pushButtonUpdate.setToolTip(tooltip) + self.ui.more_options_btn.setEnabled(enabled) + self.ui.more_options_btn.setToolTip(tooltip) def update_btns_during_update(self, enabled: bool) -> None: tooltip = "" if enabled: + self.busy_state_changed.emit(False) self.ui.pushButtonUpdate.setEnabled(enabled) self.ui.pushButtonUpdate.setToolTip(tooltip) + self.ui.more_options_btn.setEnabled(enabled) + self.ui.more_options_btn.setToolTip(tooltip) self.ui.update_with_file_btn.setEnabled(enabled) self.ui.update_with_file_btn.setToolTip(tooltip) else: tooltip = "Update is already running. Please wait." + self.busy_state_changed.emit(True) self.ui.pushButtonUpdate.setEnabled(enabled) self.ui.pushButtonUpdate.setToolTip(tooltip) + self.ui.more_options_btn.setEnabled(enabled) + self.ui.more_options_btn.setToolTip(tooltip) self.ui.update_with_file_btn.setEnabled(enabled) self.ui.update_with_file_btn.setToolTip(tooltip) From 0a50290641a5ff56df63912af6f982e1050ccef0 Mon Sep 17 00:00:00 2001 From: jj-so Date: Wed, 22 Nov 2023 12:14:35 +0100 Subject: [PATCH 2/2] During the update process, the gui is busy modified: nitrokeyapp/gui.py modified: nitrokeyapp/overview_tab.py --- nitrokeyapp/gui.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/nitrokeyapp/gui.py b/nitrokeyapp/gui.py index 11b9f3d5..230767d8 100644 --- a/nitrokeyapp/gui.py +++ b/nitrokeyapp/gui.py @@ -243,6 +243,8 @@ def refresh(self) -> None: """ Should be called if the selected device or the selected tab is changed """ + self.overview_tab.busy_state_changed.connect(self.set_busy) + if self.selected_device: self.widgetTab.hide() self.views[self.tabs.currentIndex()].refresh(self.selected_device)