From c1362522dbbcce9b74d4a839708905322ffad0f0 Mon Sep 17 00:00:00 2001
From: inso <insomniak.fr@gmaiL.com>
Date: Tue, 19 Jul 2016 07:32:09 +0200
Subject: [PATCH] Add log in transfer to help for issue #482

---
 src/sakia/gui/transfer.py | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/src/sakia/gui/transfer.py b/src/sakia/gui/transfer.py
index c90bbb45..4ae91441 100644
--- a/src/sakia/gui/transfer.py
+++ b/src/sakia/gui/transfer.py
@@ -4,6 +4,7 @@ Created on 2 févr. 2014
 @author: inso
 """
 import asyncio
+import logging
 
 from PyQt5.QtWidgets import QDialog, QApplication, QDialogButtonBox
 from PyQt5.QtCore import QRegExp, Qt, QObject
@@ -110,9 +111,11 @@ class TransferMoneyDialog(QObject):
 
     @asyncify
     async def accept(self):
+        logging.debug("Accept transfer action...")
         self.ui.button_box.setEnabled(False)
         comment = self.ui.edit_message.text()
 
+        logging.debug("checking recipient mode...")
         if self.ui.radio_contact.isChecked():
             for contact in self.account.contacts:
                 if contact['name'] == self.ui.combo_contact.currentText():
@@ -127,29 +130,34 @@ class TransferMoneyDialog(QObject):
             recipient = self.ui.edit_pubkey.text()
         amount = self.ui.spinbox_amount.value()
 
+        logging.debug("checking amount...")
         if not amount:
             await QAsyncMessageBox.critical(self.widget, self.tr("Money transfer"),
                                  self.tr("No amount. Please give the transfert amount"),
                                  QMessageBox.Ok)
             self.ui.button_box.setEnabled(True)
             return
-
+        logging.debug("Showing password dialog...")
         password = await self.password_asker.async_exec()
         if self.password_asker.result() == QDialog.Rejected:
             self.ui.button_box.setEnabled(True)
             return
 
+        logging.debug("Setting cursor...")
         QApplication.setOverrideCursor(Qt.WaitCursor)
 
+        logging.debug("Send money...")
         result = await self.wallet.send_money(self.account.salt, password, self.community,
                                    recipient, amount, comment)
         if result[0]:
+            logging.debug("Checking result to display...")
             if self.app.preferences['notifications']:
                 toast.display(self.tr("Transfer"),
                           self.tr("Success sending money to {0}").format(recipient))
             else:
                 await QAsyncMessageBox.information(self.widget, self.tr("Transfer"),
                           self.tr("Success sending money to {0}").format(recipient))
+            logging.debug("Restore cursor...")
             QApplication.restoreOverrideCursor()
 
             # If we sent back a transaction we cancel the first one
@@ -158,6 +166,7 @@ class TransferMoneyDialog(QObject):
             self.app.refresh_transfers.emit()
             self.widget.accept()
         else:
+            logging.debug("Error occured...")
             if self.app.preferences['notifications']:
                 toast.display(self.tr("Transfer"), "Error : {0}".format(result[1]))
             else:
-- 
GitLab