From 69922eef8c7fa9ae7b36858505bf2c67218c8a5f Mon Sep 17 00:00:00 2001
From: Inso <insomniak.fr@gmail.com>
Date: Wed, 23 Sep 2015 12:53:55 +0200
Subject: [PATCH] Return value of async dialogs

---
 src/cutecoin/gui/certification.py    | 3 +--
 src/cutecoin/gui/identities_tab.py   | 8 ++++++--
 src/cutecoin/gui/transactions_tab.py | 8 ++++++--
 src/cutecoin/gui/transfer.py         | 3 +--
 4 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/src/cutecoin/gui/certification.py b/src/cutecoin/gui/certification.py
index 40cf7f9b..90abaf2a 100644
--- a/src/cutecoin/gui/certification.py
+++ b/src/cutecoin/gui/certification.py
@@ -37,14 +37,13 @@ class CertificationDialog(QDialog, Ui_CertificationDialog):
             self.combo_contact.addItem(contact['name'])
 
     @classmethod
-    @asyncify
     @asyncio.coroutine
     def certify_identity(cls, app, account, password_asker, community, identity):
         dialog = cls(app, account, password_asker)
         dialog.combo_community.setCurrentText(community.name)
         dialog.edit_pubkey.setText(identity.pubkey)
         dialog.radio_pubkey.setChecked(True)
-        yield from dialog.async_exec()
+        return (yield from dialog.async_exec())
 
     @asyncify
     @asyncio.coroutine
diff --git a/src/cutecoin/gui/identities_tab.py b/src/cutecoin/gui/identities_tab.py
index 7c39dfeb..7ad87101 100644
--- a/src/cutecoin/gui/identities_tab.py
+++ b/src/cutecoin/gui/identities_tab.py
@@ -157,18 +157,22 @@ class IdentitiesTabWidget(QWidget, Ui_IdentitiesTab):
         if result == QDialog.Accepted:
             self.window().refresh_contacts()
 
+    @asyncify
+    @asyncio.coroutine
     def send_money_to_identity(self, identity):
         if isinstance(identity, str):
             pubkey = identity
         else:
             pubkey = identity.pubkey
-        result = TransferMoneyDialog.send_money_to_identity(self.app, self.account, self.password_asker,
+        result = yield from TransferMoneyDialog.send_money_to_identity(self.app, self.account, self.password_asker,
                                                             self.community, identity)
         if result == QDialog.Accepted:
             self.money_sent.emit()
 
+    @asyncify
+    @asyncio.coroutine
     def certify_identity(self, identity):
-        CertificationDialog.certify_identity(self.app, self.account, self.password_asker,
+        yield from CertificationDialog.certify_identity(self.app, self.account, self.password_asker,
                                              self.community, identity)
 
     def view_wot(self):
diff --git a/src/cutecoin/gui/transactions_tab.py b/src/cutecoin/gui/transactions_tab.py
index 3d1b514b..3fac8946 100644
--- a/src/cutecoin/gui/transactions_tab.py
+++ b/src/cutecoin/gui/transactions_tab.py
@@ -251,18 +251,22 @@ class TransactionsTabWidget(QWidget, Ui_transactionsTabWidget):
         if result == QDialog.Accepted:
             self.window().refresh_contacts()
 
+    @asyncify
+    @asyncio.coroutine
     def send_money_to_identity(self, identity):
         if isinstance(identity, str):
             pubkey = identity
         else:
             pubkey = identity.pubkey
-        result = TransferMoneyDialog.send_money_to_identity(self.app, self.account, self.password_asker,
+        result = yield from TransferMoneyDialog.send_money_to_identity(self.app, self.account, self.password_asker,
                                                             self.community, identity)
         if result == QDialog.Accepted:
             self.table_history.model().sourceModel().refresh_transfers()
 
+    @asyncify
+    @asyncio.coroutine
     def certify_identity(self, identity):
-        CertificationDialog.certify_identity(self.app, self.account, self.password_asker,
+        yield from CertificationDialog.certify_identity(self.app, self.account, self.password_asker,
                                              self.community, identity)
 
     def view_wot(self):
diff --git a/src/cutecoin/gui/transfer.py b/src/cutecoin/gui/transfer.py
index 2bdff3c3..b7eebf07 100644
--- a/src/cutecoin/gui/transfer.py
+++ b/src/cutecoin/gui/transfer.py
@@ -57,14 +57,13 @@ class TransferMoneyDialog(QDialog, Ui_TransferMoneyDialog):
             self.radio_pubkey.setChecked(True)
 
     @classmethod
-    @asyncify
     @asyncio.coroutine
     def send_money_to_identity(cls, app, account, password_asker, community, identity):
         dialog = cls(app, account, password_asker)
         dialog.edit_pubkey.setText(identity.pubkey)
         dialog.combo_community.setCurrentText(community.name)
         dialog.radio_pubkey.setChecked(True)
-        yield from dialog.async_exec()
+        return (yield from dialog.async_exec())
 
     @asyncify
     @asyncio.coroutine
-- 
GitLab