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