diff --git a/setup.py b/setup.py index dd00517be61ccbb8b2817b5944f5b1a253c4ea64..40f40456a5be1d52ba3f24e3d6050b0ba6c82fbd 100644 --- a/setup.py +++ b/setup.py @@ -116,7 +116,7 @@ target = Executable( # creation du setup setup( name = "sakia", - version = "0.11.4", + version = "0.11.5", description = "UCoin client", author = "Inso", options = {"build_exe": options}, diff --git a/src/sakia/__init__.py b/src/sakia/__init__.py index 0abaae08ee103547ec6b1d7d24d04985b1682761..993750a514d8123b5e23027dc8e44da36df81c60 100644 --- a/src/sakia/__init__.py +++ b/src/sakia/__init__.py @@ -1,2 +1,2 @@ -__version_info__ = ('0', '11', '4') +__version_info__ = ('0', '11', '5') __version__ = '.'.join(__version_info__) diff --git a/src/sakia/core/money/relative.py b/src/sakia/core/money/relative.py index a524e468468f9e61265ea52fd0e1155c57473e30..d015d4d9f5209bb1489b098804486979efc71b9e 100644 --- a/src/sakia/core/money/relative.py +++ b/src/sakia/core/money/relative.py @@ -45,7 +45,7 @@ class Relative: @staticmethod def to_si(value, digits): - prefixes = ['', 'd', 'c', 'm', 'µ', 'n', 'p', 'f', 'a', 'z', 'y'] + prefixes = ['', 'm', 'µ', 'n', 'p', 'f', 'a', 'z', 'y'] if value < 0: value = -value multiplier = -1 @@ -56,10 +56,7 @@ class Relative: prefix = "" while int(scientific_value) == 0 and scientific_value > 0.0: - if prefix_index > 3: - scientific_value *= 1000 - else: - scientific_value *= 10 + scientific_value *= 1000 prefix_index += 1 if prefix_index < len(prefixes): diff --git a/src/sakia/core/net/node.py b/src/sakia/core/net/node.py index 9970c8612f9d51978f86f03d964f2ec449a2a04e..a23d849ebaef58136a4a27983e6632f465091d81 100644 --- a/src/sakia/core/net/node.py +++ b/src/sakia/core/net/node.py @@ -12,9 +12,11 @@ from ucoinpy.api.bma import ConnectionHandler import asyncio from aiohttp.errors import ClientError, DisconnectedError +from asyncio import TimeoutError import logging import time import jsonschema +import aiohttp from socket import gaierror from PyQt5.QtCore import QObject, pyqtSignal @@ -259,8 +261,6 @@ class Node(QObject): # self.state, new_state)) if self._state != new_state: - if self.pubkey[:5] in ("6YfbK", "J78bP"): - pass self.last_change = time.time() self._state = new_state self.changed.emit() @@ -320,8 +320,8 @@ class Node(QObject): logging.debug("Error in previous block reply : {0}".format(self.pubkey)) logging.debug(str(e)) self.changed.emit() - except (ClientError, gaierror, asyncio.TimeoutError, DisconnectedError) as e: - logging.debug("{0} : {1}".format(str(e), self.pubkey)) + except (ClientError, gaierror, TimeoutError, DisconnectedError) as e: + logging.debug("{0} : {1}".format(type(e).__name__, self.pubkey)) self.state = Node.OFFLINE except jsonschema.ValidationError: logging.debug("Validation error : {0}".format(self.pubkey)) @@ -340,8 +340,8 @@ class Node(QObject): logging.debug("Error in block reply : {0}".format(self.pubkey)) logging.debug(str(e)) self.changed.emit() - except (ClientError, gaierror, asyncio.TimeoutError, DisconnectedError) as e: - logging.debug("{0} : {1}".format(str(e), self.pubkey)) + except (ClientError, gaierror, TimeoutError, DisconnectedError) as e: + logging.debug("{0} : {1}".format(type(e).__name__, self.pubkey)) self.state = Node.OFFLINE except jsonschema.ValidationError: logging.debug("Validation error : {0}".format(self.pubkey)) @@ -374,8 +374,8 @@ class Node(QObject): logging.debug("Error in peering reply : {0}".format(str(e))) self.state = Node.OFFLINE self.changed.emit() - except (ClientError, gaierror, asyncio.TimeoutError, DisconnectedError) as e: - logging.debug("{0} : {1}".format(str(e), self.pubkey)) + except (ClientError, gaierror, TimeoutError, DisconnectedError) as e: + logging.debug("{0} : {1}".format(type(e).__name__, self.pubkey)) self.state = Node.OFFLINE except jsonschema.ValidationError: logging.debug("Validation error : {0}".format(self.pubkey)) @@ -402,8 +402,8 @@ class Node(QObject): logging.debug("Error in summary : {0}".format(e)) self.state = Node.OFFLINE self.changed.emit() - except (ClientError, gaierror, asyncio.TimeoutError, DisconnectedError) as e: - logging.debug("{0} : {1}".format(str(e), self.pubkey)) + except (ClientError, gaierror, TimeoutError, DisconnectedError) as e: + logging.debug("{0} : {1}".format(type(e).__name__, self.pubkey)) self.state = Node.OFFLINE except jsonschema.ValidationError: logging.debug("Validation error : {0}".format(self.pubkey)) @@ -438,8 +438,8 @@ class Node(QObject): logging.debug("error in uid reply : {0}".format(self.pubkey)) self.state = Node.OFFLINE self.identity_changed.emit() - except (ClientError, gaierror, asyncio.TimeoutError, DisconnectedError) as e: - logging.debug("{0} : {1}".format(str(e), self.pubkey)) + except (ClientError, gaierror, TimeoutError, DisconnectedError) as e: + logging.debug("{0} : {1}".format(type(e).__name__, self.pubkey)) self.state = Node.OFFLINE except jsonschema.ValidationError: logging.debug("Validation error : {0}".format(self.pubkey)) @@ -475,8 +475,8 @@ class Node(QObject): leaf=leaf_hash)) self.state = Node.OFFLINE self.changed.emit() - except (ClientError, gaierror, asyncio.TimeoutError, DisconnectedError) as e: - logging.debug("{0} : {1}".format(str(e), self.pubkey)) + except (ClientError, gaierror, TimeoutError, DisconnectedError) as e: + logging.debug("{0} : {1}".format(type(e).__name__, self.pubkey)) self.state = Node.OFFLINE except jsonschema.ValidationError: logging.debug("Validation error : {0}".format(self.pubkey)) @@ -487,8 +487,8 @@ class Node(QObject): logging.debug("Error in peers reply") self.state = Node.OFFLINE self.changed.emit() - except (ClientError, gaierror, asyncio.TimeoutError, DisconnectedError) as e: - logging.debug("{0} : {1}".format(str(e), self.pubkey)) + except (ClientError, gaierror, TimeoutError, DisconnectedError) as e: + logging.debug("{0} : {1}".format(type(e).__name__, self.pubkey)) self.state = Node.OFFLINE except jsonschema.ValidationError: logging.debug("Validation error : {0}".format(self.pubkey)) diff --git a/src/sakia/gui/certification.py b/src/sakia/gui/certification.py index c79a964651cd2bda625abb2633856764e0a2a70a..87a9874fb85850e37fb88639cca2e1f6404ec2ae 100644 --- a/src/sakia/gui/certification.py +++ b/src/sakia/gui/certification.py @@ -54,6 +54,7 @@ class CertificationDialog(QDialog, Ui_CertificationDialog): @asyncify @asyncio.coroutine def accept(self): + self.button_box.setEnabled(False) if self.radio_contact.isChecked(): for contact in self.account.contacts: if contact['name'] == self.combo_contact.currentText(): @@ -64,6 +65,7 @@ class CertificationDialog(QDialog, Ui_CertificationDialog): password = yield from self.password_asker.async_exec() if password == "": + self.button_box.setEnabled(True) return QApplication.setOverrideCursor(Qt.WaitCursor) result = yield from self.account.certify(password, self.community, pubkey) @@ -85,6 +87,7 @@ class CertificationDialog(QDialog, Ui_CertificationDialog): self.tr("Could not broadcast certification : {0}" .format(result[1]))) QApplication.restoreOverrideCursor() + self.button_box.setEnabled(True) def change_current_community(self, index): self.community = self.account.communities[index] diff --git a/src/sakia/gui/transfer.py b/src/sakia/gui/transfer.py index 25efea077fd3ce3f55fbcfb437956dad30936f9c..10d7e83eb3ab4a8c067d9f3755e941c854a1d527 100644 --- a/src/sakia/gui/transfer.py +++ b/src/sakia/gui/transfer.py @@ -93,6 +93,7 @@ class TransferMoneyDialog(QDialog, Ui_TransferMoneyDialog): @asyncify @asyncio.coroutine def accept(self): + self.button_box.setEnabled(False) comment = self.edit_message.text() if self.radio_contact.isChecked(): @@ -108,6 +109,7 @@ class TransferMoneyDialog(QDialog, Ui_TransferMoneyDialog): yield from QAsyncMessageBox.critical(self, self.tr("Money transfer"), self.tr("No amount. Please give the transfert amount"), QMessageBox.Ok) + self.button_box.setEnabled(True) return password = yield from self.password_asker.async_exec() @@ -139,6 +141,7 @@ class TransferMoneyDialog(QDialog, Ui_TransferMoneyDialog): yield from QAsyncMessageBox.critical(self, self.tr("Transfer"), result[1]) QApplication.restoreOverrideCursor() + self.button_box.setEnabled(True) @asyncify @asyncio.coroutine