ui: fixed closing the GUI with a popup active

This commit is contained in:
Gustavo Iñiguez Goia 2025-01-06 20:22:49 +01:00
parent 2357186093
commit c0be3d15dc
Failed to generate hash of commit
2 changed files with 8 additions and 1 deletions

View file

@ -210,7 +210,8 @@ class PromptDialog(QtWidgets.QDialog, uic.loadUiType(DIALOG_UI_PATH)[0]):
else: else:
self.actionButton.setText(self._action_text[action_idx]) self.actionButton.setText(self._action_text[action_idx])
self.actionButton.setIcon(self._action_icon[action_idx]) self.actionButton.setIcon(self._action_icon[action_idx])
self._tick_thread.stop = True if self._tick_thread != None:
self._tick_thread.stop = True
def _check_advanced_toggled(self, state): def _check_advanced_toggled(self, state):
self.checkDstIP.setVisible(state) self.checkDstIP.setVisible(state)
@ -496,6 +497,11 @@ class PromptDialog(QtWidgets.QDialog, uic.loadUiType(DIALOG_UI_PATH)[0]):
self._send_rule() self._send_rule()
e.ignore() e.ignore()
def close(self):
self._stop_countdown()
self._done.set()
self.hide()
def _add_fixed_options_to_combo(self, combo, con, uid): def _add_fixed_options_to_combo(self, combo, con, uid):
# the order of these combobox entries must match those in the preferences dialog # the order of these combobox entries must match those in the preferences dialog
# prefs -> UI -> Default target # prefs -> UI -> Default target

View file

@ -292,6 +292,7 @@ class UIService(ui_pb2_grpc.UIServicer, QtWidgets.QGraphicsObject):
def _on_close(self): def _on_close(self):
self._exit = True self._exit = True
self._tray.setIcon(self.off_icon) self._tray.setIcon(self.off_icon)
self._prompt_dialog.close()
self._app.processEvents() self._app.processEvents()
self._nodes.stop_notifications() self._nodes.stop_notifications()
self._nodes.update_all(Nodes.OFFLINE) self._nodes.update_all(Nodes.OFFLINE)