From def537bb5a78e046a75a9e13ea75449eec2b34c8 Mon Sep 17 00:00:00 2001 From: Ivan Alejandro Date: Wed, 16 Apr 2014 14:48:53 -0300 Subject: Use Slot decorator instead of SLOT docstring. --- src/leap/bitmask/gui/wizard.py | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) (limited to 'src/leap/bitmask/gui/wizard.py') diff --git a/src/leap/bitmask/gui/wizard.py b/src/leap/bitmask/gui/wizard.py index ebcee400..52cbab48 100644 --- a/src/leap/bitmask/gui/wizard.py +++ b/src/leap/bitmask/gui/wizard.py @@ -145,7 +145,6 @@ class Wizard(QtGui.QWizard): @QtCore.Slot() def _wizard_finished(self): """ - SLOT TRIGGER: self.finished @@ -210,10 +209,9 @@ class Wizard(QtGui.QWizard): def get_services(self): return self._selected_services - @QtCore.Slot() + @QtCore.Slot(unicode) def _enable_check(self, reset=True): """ - SLOT TRIGGER: self.ui.lnProvider.textChanged @@ -282,9 +280,9 @@ class Wizard(QtGui.QWizard): # register button self.ui.btnRegister.setVisible(visible) + @QtCore.Slot() def _registration_finished(self): """ - SLOT TRIGGERS: self._backend.signaler.srp_registration_finished @@ -308,9 +306,9 @@ class Wizard(QtGui.QWizard): self.page(self.REGISTER_USER_PAGE).set_completed() self.button(QtGui.QWizard.BackButton).setEnabled(False) + @QtCore.Slot() def _registration_failed(self): """ - SLOT TRIGGERS: self._backend.signaler.srp_registration_failed @@ -322,9 +320,9 @@ class Wizard(QtGui.QWizard): self._set_register_status(error_msg, error=True) self.ui.btnRegister.setEnabled(True) + @QtCore.Slot() def _registration_taken(self): """ - SLOT TRIGGERS: self._backend.signaler.srp_registration_taken @@ -368,9 +366,9 @@ class Wizard(QtGui.QWizard): self.ui.lblCheckCaFpr.setPixmap(None) self.ui.lblCheckApiCert.setPixmap(None) + @QtCore.Slot() def _check_provider(self): """ - SLOT TRIGGERS: self.ui.btnCheck.clicked self.ui.lnProvider.returnPressed @@ -403,9 +401,9 @@ class Wizard(QtGui.QWizard): self._provider_select_defer = self._backend.\ setup_provider(self._domain) + @QtCore.Slot(bool) def _skip_provider_checks(self, skip): """ - SLOT Triggered: self.ui.rbExistingProvider.toggled @@ -447,9 +445,9 @@ class Wizard(QtGui.QWizard): label.setPixmap(self.ERROR_ICON) logger.error(error) + @QtCore.Slot(dict) def _name_resolution(self, data): """ - SLOT TRIGGER: self._backend.signaler.prov_name_resolution Sets the status for the name resolution check @@ -466,9 +464,9 @@ class Wizard(QtGui.QWizard): self.ui.btnCheck.setEnabled(not passed) self.ui.lnProvider.setEnabled(not passed) + @QtCore.Slot(dict) def _https_connection(self, data): """ - SLOT TRIGGER: self._backend.signaler.prov_https_connection Sets the status for the https connection check @@ -485,9 +483,9 @@ class Wizard(QtGui.QWizard): self.ui.btnCheck.setEnabled(not passed) self.ui.lnProvider.setEnabled(not passed) + @QtCore.Slot(dict) def _download_provider_info(self, data): """ - SLOT TRIGGER: self._backend.signaler.prov_download_provider_info Sets the status for the provider information download @@ -519,9 +517,9 @@ class Wizard(QtGui.QWizard): else: self.ui.cbProviders.setEnabled(True) + @QtCore.Slot(dict) def _download_ca_cert(self, data): """ - SLOT TRIGGER: self._backend.signaler.prov_download_ca_cert Sets the status for the download of the CA certificate check @@ -531,9 +529,9 @@ class Wizard(QtGui.QWizard): if passed: self.ui.lblCheckCaFpr.setPixmap(self.QUESTION_ICON) + @QtCore.Slot(dict) def _check_ca_fingerprint(self, data): """ - SLOT TRIGGER: self._backend.signaler.prov_check_ca_fingerprint Sets the status for the CA fingerprint check @@ -543,9 +541,9 @@ class Wizard(QtGui.QWizard): if passed: self.ui.lblCheckApiCert.setPixmap(self.QUESTION_ICON) + @QtCore.Slot(dict) def _check_api_certificate(self, data): """ - SLOT TRIGGER: self._backend.signaler.prov_check_api_certificate Sets the status for the API certificate check. Also finishes @@ -556,9 +554,9 @@ class Wizard(QtGui.QWizard): True, self.SETUP_PROVIDER_PAGE) self._provider_setup_ok = True + @QtCore.Slot(str, int) def _service_selection_changed(self, service, state): """ - SLOT TRIGGER: service_checkbox.stateChanged Adds the service to the state if the state is checked, removes it otherwise @@ -604,9 +602,9 @@ class Wizard(QtGui.QWizard): self.tr("Something went wrong while trying to " "load service %s" % (service,))) + @QtCore.Slot(int) def _current_id_changed(self, pageId): """ - SLOT TRIGGER: self.currentIdChanged Prepares the pages when they appear -- cgit v1.2.3 From 5218fda6b524cb8e694113e123e7b0d05b205ddc Mon Sep 17 00:00:00 2001 From: Ivan Alejandro Date: Wed, 16 Apr 2014 15:25:41 -0300 Subject: Use consistent wording for triggers documentation. --- src/leap/bitmask/gui/wizard.py | 41 +++++++++++++++++++++++++---------------- 1 file changed, 25 insertions(+), 16 deletions(-) (limited to 'src/leap/bitmask/gui/wizard.py') diff --git a/src/leap/bitmask/gui/wizard.py b/src/leap/bitmask/gui/wizard.py index 52cbab48..957a67e0 100644 --- a/src/leap/bitmask/gui/wizard.py +++ b/src/leap/bitmask/gui/wizard.py @@ -145,7 +145,7 @@ class Wizard(QtGui.QWizard): @QtCore.Slot() def _wizard_finished(self): """ - TRIGGER: + TRIGGERS: self.finished This method is called when the wizard is accepted or rejected. @@ -212,7 +212,7 @@ class Wizard(QtGui.QWizard): @QtCore.Slot(unicode) def _enable_check(self, reset=True): """ - TRIGGER: + TRIGGERS: self.ui.lnProvider.textChanged Enables/disables the 'check' button in the SELECT_PROVIDER_PAGE @@ -284,7 +284,7 @@ class Wizard(QtGui.QWizard): def _registration_finished(self): """ TRIGGERS: - self._backend.signaler.srp_registration_finished + self._backend.signaler.srp_registration_finished The registration has finished successfully, so we do some final steps. """ @@ -310,7 +310,7 @@ class Wizard(QtGui.QWizard): def _registration_failed(self): """ TRIGGERS: - self._backend.signaler.srp_registration_failed + self._backend.signaler.srp_registration_failed The registration has failed, so we report the problem. """ @@ -324,7 +324,7 @@ class Wizard(QtGui.QWizard): def _registration_taken(self): """ TRIGGERS: - self._backend.signaler.srp_registration_taken + self._backend.signaler.srp_registration_taken The requested username is taken, warn the user about that. """ @@ -370,8 +370,8 @@ class Wizard(QtGui.QWizard): def _check_provider(self): """ TRIGGERS: - self.ui.btnCheck.clicked - self.ui.lnProvider.returnPressed + self.ui.btnCheck.clicked + self.ui.lnProvider.returnPressed Starts the checks for a given provider """ @@ -404,7 +404,7 @@ class Wizard(QtGui.QWizard): @QtCore.Slot(bool) def _skip_provider_checks(self, skip): """ - Triggered: + TRIGGERS: self.ui.rbExistingProvider.toggled Allows the user to move to the next page without make any checks, @@ -448,7 +448,8 @@ class Wizard(QtGui.QWizard): @QtCore.Slot(dict) def _name_resolution(self, data): """ - TRIGGER: self._backend.signaler.prov_name_resolution + TRIGGERS: + self._backend.signaler.prov_name_resolution Sets the status for the name resolution check """ @@ -467,7 +468,8 @@ class Wizard(QtGui.QWizard): @QtCore.Slot(dict) def _https_connection(self, data): """ - TRIGGER: self._backend.signaler.prov_https_connection + TRIGGERS: + self._backend.signaler.prov_https_connection Sets the status for the https connection check """ @@ -486,7 +488,8 @@ class Wizard(QtGui.QWizard): @QtCore.Slot(dict) def _download_provider_info(self, data): """ - TRIGGER: self._backend.signaler.prov_download_provider_info + TRIGGERS: + self._backend.signaler.prov_download_provider_info Sets the status for the provider information download check. Since this check is the last of this set, it also @@ -520,7 +523,8 @@ class Wizard(QtGui.QWizard): @QtCore.Slot(dict) def _download_ca_cert(self, data): """ - TRIGGER: self._backend.signaler.prov_download_ca_cert + TRIGGERS: + self._backend.signaler.prov_download_ca_cert Sets the status for the download of the CA certificate check """ @@ -532,7 +536,8 @@ class Wizard(QtGui.QWizard): @QtCore.Slot(dict) def _check_ca_fingerprint(self, data): """ - TRIGGER: self._backend.signaler.prov_check_ca_fingerprint + TRIGGERS: + self._backend.signaler.prov_check_ca_fingerprint Sets the status for the CA fingerprint check """ @@ -544,7 +549,8 @@ class Wizard(QtGui.QWizard): @QtCore.Slot(dict) def _check_api_certificate(self, data): """ - TRIGGER: self._backend.signaler.prov_check_api_certificate + TRIGGERS: + self._backend.signaler.prov_check_api_certificate Sets the status for the API certificate check. Also finishes the provider bootstrapper thread since it's not needed anymore @@ -557,7 +563,9 @@ class Wizard(QtGui.QWizard): @QtCore.Slot(str, int) def _service_selection_changed(self, service, state): """ - TRIGGER: service_checkbox.stateChanged + TRIGGERS: + service_checkbox.stateChanged + Adds the service to the state if the state is checked, removes it otherwise @@ -605,7 +613,8 @@ class Wizard(QtGui.QWizard): @QtCore.Slot(int) def _current_id_changed(self, pageId): """ - TRIGGER: self.currentIdChanged + TRIGGERS: + self.currentIdChanged Prepares the pages when they appear """ -- cgit v1.2.3 From fa81e2f08335334f8def3a9275c00ba133e5f714 Mon Sep 17 00:00:00 2001 From: Ivan Alejandro Date: Thu, 17 Apr 2014 11:45:03 -0300 Subject: Improve parameters docstrings. Also rename a parameter named 'param' to a more meaningful 'idx'. --- src/leap/bitmask/gui/wizard.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/leap/bitmask/gui/wizard.py') diff --git a/src/leap/bitmask/gui/wizard.py b/src/leap/bitmask/gui/wizard.py index 957a67e0..cc8c2624 100644 --- a/src/leap/bitmask/gui/wizard.py +++ b/src/leap/bitmask/gui/wizard.py @@ -217,6 +217,11 @@ class Wizard(QtGui.QWizard): Enables/disables the 'check' button in the SELECT_PROVIDER_PAGE depending on the lnProvider content. + + :param reset: this contains the text of the line edit, and when is + called directly defines whether we want to reset the + checks. + :type reset: unicode or bool """ enabled = len(self.ui.lnProvider.text()) != 0 enabled = enabled or self.ui.rbExistingProvider.isChecked() @@ -617,6 +622,9 @@ class Wizard(QtGui.QWizard): self.currentIdChanged Prepares the pages when they appear + + :param pageId: the new current page id. + :type pageId: int """ if pageId == self.SELECT_PROVIDER_PAGE: self._clear_register_widgets() -- cgit v1.2.3