diff --git a/src/cutecoin/gui/certification.py b/src/cutecoin/gui/certification.py index a70d482057cbad580b1c63d6cee6577618d6f3bd..7ff30f863818a942f0826b150a840ad07165f399 100644 --- a/src/cutecoin/gui/certification.py +++ b/src/cutecoin/gui/certification.py @@ -37,7 +37,7 @@ class CertificationDialog(QDialog, Ui_CertificationDialog): else: pubkey = self.edit_pubkey.text() - password = self.password_asker.ask() + password = self.password_asker.exec_() if password == "": return diff --git a/src/cutecoin/gui/community_tab.py b/src/cutecoin/gui/community_tab.py index 752ef8f99529a1f8890988a21c848c63f681c81b..976e740210f23b1e0f92685e39ee8803eb131c3e 100644 --- a/src/cutecoin/gui/community_tab.py +++ b/src/cutecoin/gui/community_tab.py @@ -7,7 +7,7 @@ Created on 2 févr. 2014 import logging from PyQt5.QtCore import Qt from PyQt5.QtGui import QIcon -from PyQt5.QtWidgets import QWidget, QMessageBox, QAction, QMenu, QInputDialog, QLineEdit +from PyQt5.QtWidgets import QWidget, QMessageBox, QAction, QMenu, QDialog, QLineEdit from ..models.members import MembersListModel from ..gen_resources.community_tab_uic import Ui_CommunityTabWidget from .add_contact import AddContactDialog @@ -95,8 +95,8 @@ class CommunityTabWidget(QWidget, Ui_CommunityTabWidget): dialog.exec_() def send_membership_demand(self): - password = self.password_asker.ask() - if password == "": + password = self.password_asker.exec_() + if self.password_asker.result() == QDialog.Rejected: return try: @@ -126,8 +126,9 @@ Sending a membership demand cannot be canceled. The process to join back the community later will have to be done again.""" .format(self.account.pubkey), QMessageBox.Ok | QMessageBox.Cancel) if reply == QMessageBox.Ok: - password = PasswordAskerDialog(self.app.current_account).ask() - if password == "": + password_asker = PasswordAskerDialog(self.app.current_account) + password = password_asker.exec_() + if password_asker.result() == QDialog.Rejected: return try: diff --git a/src/cutecoin/gui/password_asker.py b/src/cutecoin/gui/password_asker.py index cae09d02b331c859019290560bb543b176b5932e..96d1dbcd75637e0f86a9153e0c7dfe6b4bfe11ac 100644 --- a/src/cutecoin/gui/password_asker.py +++ b/src/cutecoin/gui/password_asker.py @@ -27,14 +27,15 @@ class PasswordAskerDialog(QDialog, Ui_PasswordAskerDialog): self.password = "" self.remember = False - def ask(self): + def exec_(self): if not self.remember: - self.exec_() + super().exec_() pwd = self.password if not self.remember: self.password = "" return pwd else: + self.setResult(QDialog.Accepted) return self.password def accept(self): @@ -53,5 +54,6 @@ class PasswordAskerDialog(QDialog, Ui_PasswordAskerDialog): def reject(self): self.edit_password.setText("") logging.debug("Cancelled") + self.setResult(QDialog.Accepted) self.password = "" super().reject() diff --git a/src/cutecoin/gui/process_cfg_account.py b/src/cutecoin/gui/process_cfg_account.py index b620be5eaef24375b7a3cd2cac05fcd740c40b01..7ef72a8a435e56428af419cf03caf10d758e2b31 100644 --- a/src/cutecoin/gui/process_cfg_account.py +++ b/src/cutecoin/gui/process_cfg_account.py @@ -234,8 +234,8 @@ class ProcessConfigureAccount(QDialog, Ui_AccountConfigurationDialog): str(e), QMessageBox.Ok) password = self.edit_password.text() else: - password = self.password_asker.ask() - if password == "": + password = self.password_asker.exec_() + if self.password_asker.result() == QDialog.Rejected: return nb_wallets = self.spinbox_wallets.value() diff --git a/src/cutecoin/gui/process_cfg_community.py b/src/cutecoin/gui/process_cfg_community.py index fd36c3165852cbdb61d7b3f8d7346e96e869a1cf..e3f75e115c2ed4fe3d9cd5f5fe14fb4e99e9d3c6 100644 --- a/src/cutecoin/gui/process_cfg_community.py +++ b/src/cutecoin/gui/process_cfg_community.py @@ -179,8 +179,8 @@ class ProcessConfigureCommunity(QDialog, Ui_CommunityConfigurationDialog): {0}\n Would you like to publish the key ?""".format(self.account.pubkey)) if reply == QMessageBox.Yes: - password = self.password_asker.ask() - if password == "": + password = self.password_asker.exec_() + if self.password_asker.result() == QDialog.Rejected: return try: self.account.send_pubkey(password, self.community) diff --git a/src/cutecoin/gui/transfer.py b/src/cutecoin/gui/transfer.py index 3931789a9bd6a7774713199d5c609b597b00dd5d..344a7d13de1a4005da7a52e856a1c91be7b7b4a9 100644 --- a/src/cutecoin/gui/transfer.py +++ b/src/cutecoin/gui/transfer.py @@ -55,8 +55,8 @@ class TransferMoneyDialog(QDialog, Ui_TransferMoneyDialog): recipient = self.edit_pubkey.text() amount = self.spinbox_amount.value() - password = self.password_asker.ask() - if password == "": + password = self.password_asker.exec_() + if self.password_asker.result() == QDialog.Rejected: return try: