Skip to content
Snippets Groups Projects
Commit a0b4d28b authored by inso's avatar inso
Browse files

Fixed misuses of qt methods in dialogs

self.close() replaced with super().accept()
QErrorMessage replaced with QMessageBox.critical()
parent 240eb294
No related branches found
No related tags found
No related merge requests found
...@@ -35,7 +35,7 @@ class AddContactDialog(QDialog, Ui_AddContactDialog): ...@@ -35,7 +35,7 @@ class AddContactDialog(QDialog, Ui_AddContactDialog):
if result: if result:
self.main_window.menu_contacts_list.addAction(name) self.main_window.menu_contacts_list.addAction(name)
self.main_window.app.save(self.account) self.main_window.app.save(self.account)
self.close() super().accept()
def name_edited(self, new_name): def name_edited(self, new_name):
name_ok = len(new_name) > 0 name_ok = len(new_name) > 0
......
...@@ -50,17 +50,19 @@ class CertificationDialog(QDialog, Ui_CertificationDialog): ...@@ -50,17 +50,19 @@ class CertificationDialog(QDialog, Ui_CertificationDialog):
QMessageBox.critical(self, "Certification", QMessageBox.critical(self, "Certification",
"Something wrong happened : {0}".format(e), "Something wrong happened : {0}".format(e),
QMessageBox.Ok) QMessageBox.Ok)
return
except NoPeerAvailable as e: except NoPeerAvailable as e:
QMessageBox.critical(self, "Certification", QMessageBox.critical(self, "Certification",
"Couldn't connect to network : {0}".format(e), "Couldn't connect to network : {0}".format(e),
QMessageBox.Ok) QMessageBox.Ok)
return
except Exception as e: except Exception as e:
QMessageBox.critical(self, "Error", QMessageBox.critical(self, "Error",
"{0}".format(e), "{0}".format(e),
QMessageBox.Ok) QMessageBox.Ok)
return
self.accepted.emit() super().accept()
self.close()
def change_current_community(self, index): def change_current_community(self, index):
self.community = self.certifier.communities[index] self.community = self.certifier.communities[index]
......
...@@ -4,7 +4,7 @@ Created on 22 mai 2014 ...@@ -4,7 +4,7 @@ Created on 22 mai 2014
@author: inso @author: inso
''' '''
import re import re
from PyQt5.QtWidgets import QDialog, QDialogButtonBox, QMessageBox, QErrorMessage, QFileDialog from PyQt5.QtWidgets import QDialog, QDialogButtonBox, QMessageBox, QFileDialog
from cutecoin.tools.exceptions import Error from cutecoin.tools.exceptions import Error
from cutecoin.gen_resources.import_account_uic import Ui_ImportAccountDialog from cutecoin.gen_resources.import_account_uic import Ui_ImportAccountDialog
...@@ -30,13 +30,14 @@ class ImportAccountDialog(QDialog, Ui_ImportAccountDialog): ...@@ -30,13 +30,14 @@ class ImportAccountDialog(QDialog, Ui_ImportAccountDialog):
account_name = self.edit_name.text() account_name = self.edit_name.text()
try: try:
self.app.import_account(self.selected_file, account_name) self.app.import_account(self.selected_file, account_name)
except Error as e: except Exception as e:
QErrorMessage(self).showMessage(e.message) QMessageBox.critical(self, "Error",
"{0}".format(e),
QMessageBox.Ok)
return return
QMessageBox.information(self, "Account import", QMessageBox.information(self, "Account import",
"Account imported succefully !") "Account imported succefully !")
self.accepted.emit() super().accept()
self.close()
def import_account(self): def import_account(self):
self.selected_file = QFileDialog.getOpenFileName(self, self.selected_file = QFileDialog.getOpenFileName(self,
......
...@@ -241,5 +241,4 @@ class ProcessConfigureAccount(QDialog, Ui_AccountConfigurationDialog): ...@@ -241,5 +241,4 @@ class ProcessConfigureAccount(QDialog, Ui_AccountConfigurationDialog):
nb_wallets = self.spinbox_wallets.value() nb_wallets = self.spinbox_wallets.value()
self.account.set_walletpool_size(nb_wallets, password) self.account.set_walletpool_size(nb_wallets, password)
self.app.save(self.account) self.app.save(self.account)
self.accepted.emit() super().accept()
self.close()
...@@ -192,5 +192,4 @@ class ProcessConfigureCommunity(QDialog, Ui_CommunityConfigurationDialog): ...@@ -192,5 +192,4 @@ class ProcessConfigureCommunity(QDialog, Ui_CommunityConfigurationDialog):
if self.community not in self.account.communities: if self.community not in self.account.communities:
self.account.add_community(self.community) self.account.add_community(self.community)
self.accepted.emit() super().accept()
self.close()
...@@ -86,8 +86,7 @@ class TransferMoneyDialog(QDialog, Ui_TransferMoneyDialog): ...@@ -86,8 +86,7 @@ class TransferMoneyDialog(QDialog, Ui_TransferMoneyDialog):
"{0}".format(e), "{0}".format(e),
QMessageBox.Ok) QMessageBox.Ok)
return return
self.accepted.emit() super().accept()
self.close()
def amount_changed(self): def amount_changed(self):
amount = self.spinbox_amount.value() amount = self.spinbox_amount.value()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment