From 68b9e59d695ae896e405fd5f98eb2953dd5c9a2e Mon Sep 17 00:00:00 2001 From: Ivan Alejandro Date: Fri, 18 Sep 2015 16:29:48 -0300 Subject: [bug] track soledad ready state on a shared place Connecting to the `soledad_bootstrap_finished` signal is not enough since the password change window is created after the signal is emitted, that way we were not able to tell when soledad is ready to be used. - Resolves: #7474 --- src/leap/bitmask/gui/app.py | 2 ++ src/leap/bitmask/gui/mainwindow.py | 8 +++----- src/leap/bitmask/gui/passwordwindow.py | 5 ++--- src/leap/bitmask/gui/preferenceswindow.py | 2 +- 4 files changed, 8 insertions(+), 9 deletions(-) (limited to 'src/leap') diff --git a/src/leap/bitmask/gui/app.py b/src/leap/bitmask/gui/app.py index 02357b2b..97fd0549 100644 --- a/src/leap/bitmask/gui/app.py +++ b/src/leap/bitmask/gui/app.py @@ -43,6 +43,8 @@ class App(QtGui.QWidget): self.signaler = LeapSignaler() self.signaler.start() + self.soledad_started = False + # periodically check if the backend is alive self._backend_checker = QtCore.QTimer(self) self._backend_checker.timeout.connect(self._check_backend_status) diff --git a/src/leap/bitmask/gui/mainwindow.py b/src/leap/bitmask/gui/mainwindow.py index c5939a6d..387c6283 100644 --- a/src/leap/bitmask/gui/mainwindow.py +++ b/src/leap/bitmask/gui/mainwindow.py @@ -201,8 +201,6 @@ class MainWindow(QtGui.QMainWindow, SignalTracker): self._login_widget.login_offline_finished.connect( self._maybe_run_soledad_setup_checks) - self._soledad_started = False - # This is created once we have a valid provider config self._logged_in_offline = False @@ -544,7 +542,7 @@ class MainWindow(QtGui.QMainWindow, SignalTracker): # XXX: handle differently not logged in user? akm = AdvancedKeyManagement(self, mx_provided, logged_user, - self._backend, self._soledad_started) + self._backend, self.app.soledad_started) akm.show() def _show_preferences(self): @@ -1238,7 +1236,7 @@ class MainWindow(QtGui.QMainWindow, SignalTracker): self._backend.soledad_cancel_bootstrap() self._backend.soledad_close() - self._soledad_started = False + self.app.soledad_started = True def _on_user_logged_in(self): """ @@ -1414,7 +1412,7 @@ class MainWindow(QtGui.QMainWindow, SignalTracker): """ logger.debug("Done bootstrapping Soledad") - self._soledad_started = True + self.app.soledad_started = True self.soledad_ready.emit() ################################################################### diff --git a/src/leap/bitmask/gui/passwordwindow.py b/src/leap/bitmask/gui/passwordwindow.py index 219a5634..d9309b2f 100644 --- a/src/leap/bitmask/gui/passwordwindow.py +++ b/src/leap/bitmask/gui/passwordwindow.py @@ -71,9 +71,10 @@ class PasswordWindow(QtGui.QDialog, Flashable): self.ui.cancel_button.setEnabled(True) self.flash_error(self.tr("Please log in to change your password.")) - if self.is_soledad_needed() and not self._soledad_ready: + if self.is_soledad_needed() and not self.app.soledad_started: self._enable_password_widgets(False) self.ui.cancel_button.setEnabled(True) + self.flash_message( self.tr("Please wait for data storage to be ready.")) @@ -146,7 +147,6 @@ class PasswordWindow(QtGui.QDialog, Flashable): sig.soledad_password_change_error.connect( self._soledad_change_password_problem) - self._soledad_ready = False sig.soledad_bootstrap_finished.connect(self._on_soledad_ready) def _change_password(self): @@ -269,4 +269,3 @@ class PasswordWindow(QtGui.QDialog, Flashable): Signaler.soledad_bootstrap_finished """ self._enable_password_widgets(True) - self._soledad_ready = True diff --git a/src/leap/bitmask/gui/preferenceswindow.py b/src/leap/bitmask/gui/preferenceswindow.py index baa71252..44c4641c 100644 --- a/src/leap/bitmask/gui/preferenceswindow.py +++ b/src/leap/bitmask/gui/preferenceswindow.py @@ -70,7 +70,7 @@ class PreferencesWindow(QtGui.QDialog): # only allow a single preferences window at a time. if PreferencesWindow._current_window is not None: - PreferencesWindow._current_window.close_window() + PreferencesWindow._current_window.close() PreferencesWindow._current_window = self def _add_icons(self): -- cgit v1.2.3