diff options
Diffstat (limited to 'src/leap')
-rw-r--r-- | src/leap/bitmask/gui/mainwindow.py | 9 | ||||
-rw-r--r-- | src/leap/bitmask/gui/preferenceswindow.py | 24 |
2 files changed, 16 insertions, 17 deletions
diff --git a/src/leap/bitmask/gui/mainwindow.py b/src/leap/bitmask/gui/mainwindow.py index b106364d..cc4ede09 100644 --- a/src/leap/bitmask/gui/mainwindow.py +++ b/src/leap/bitmask/gui/mainwindow.py @@ -98,9 +98,6 @@ class MainWindow(QtGui.QMainWindow): # We give the services some time to a halt before forcing quit. SERVICES_STOP_TIMEOUT = 3000 # in milliseconds - # Preferences window - preferences = None - def __init__(self, start_hidden=False, backend_pid=None): """ Constructor for the client main window @@ -574,10 +571,8 @@ class MainWindow(QtGui.QMainWindow): """ account = Account(self._logged_user, self._providers.get_selected_provider()) - if self.preferences is not None: - self.preferences.close() - self.preferences = PreferencesWindow(self, account, self.app) - self.preferences.show() + pref_win = PreferencesWindow(self, account, self.app) + pref_win.show() @QtCore.Slot(object, list) def _update_eip_enabled_status(self, account=None, services=None): diff --git a/src/leap/bitmask/gui/preferenceswindow.py b/src/leap/bitmask/gui/preferenceswindow.py index ccddb764..32651d5c 100644 --- a/src/leap/bitmask/gui/preferenceswindow.py +++ b/src/leap/bitmask/gui/preferenceswindow.py @@ -38,22 +38,21 @@ class PreferencesWindow(QtGui.QDialog): Window that displays the preferences. """ + _current_window = None # currently visible preferences window + def __init__(self, parent, account, app): """ :param parent: parent object of the PreferencesWindow. :parent type: QWidget - :param username: the user set in the login widget - :type username: unicode - :param domain: the selected domain in the login widget - :type domain: unicode - :param backend: Backend being used - :type backend: Backend - :param leap_signaler: signal server - :type leap_signaler: LeapSignaler + + :param account: the user or provider + :type account: Account + + :param app: the current App object + :type app: App """ QtGui.QDialog.__init__(self, parent) - self._parent = parent self.account = account self.app = app @@ -69,6 +68,11 @@ class PreferencesWindow(QtGui.QDialog): self._add_pages() self._update_icons(self.account, self.account.services()) + # only allow a single preferrences window at a time. + if PreferencesWindow._current_window is not None: + PreferencesWindow._current_window.close() + PreferencesWindow._current_window = self + def _add_icons(self): """ Adds all the icons for the different configuration categories. @@ -136,7 +140,7 @@ class PreferencesWindow(QtGui.QDialog): Close this dialog """ - self._parent.preferences = None + PreferencesWindow._current_window = None self.hide() @QtCore.Slot() |