diff --git a/setup.py b/setup.py index e4e3db248753841e740fa5abd43ebb137acaccfe..4cdfe1a466d7d481e36be932054b2f88af6d086c 100644 --- a/setup.py +++ b/setup.py @@ -124,7 +124,7 @@ else: setup( name = "sakia", - version = "0.11.4", + version = "0.12.0", description = "UCoin client", author = "Inso", options = {"build_exe": options}, diff --git a/src/sakia/__init__.py b/src/sakia/__init__.py index e92e1772fccf93ff2627cba943fed2e5091cbfbf..993750a514d8123b5e23027dc8e44da36df81c60 100644 --- a/src/sakia/__init__.py +++ b/src/sakia/__init__.py @@ -1,2 +1,2 @@ -__version_info__ = ('0', '11', '3') +__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 1ca052fd65cf2dd5afad51669658d6bb1374e970..a757b762a1166bd1081c8773e6bd7d2dfecc1285 100644 --- a/src/sakia/core/money/relative.py +++ b/src/sakia/core/money/relative.py @@ -40,7 +40,7 @@ class Relative(BaseReferential): @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 @@ -51,10 +51,7 @@ class Relative(BaseReferential): 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 3539d85abd3134f0f269b7e095119ec2faa96a31..348aa4063206d704dee483f3ffa2cf5b76d2e044 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 @@ -258,8 +260,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() @@ -318,8 +318,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)) @@ -338,8 +338,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)) @@ -371,8 +371,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)) @@ -398,8 +398,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)) @@ -433,8 +433,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)) @@ -469,8 +469,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)) @@ -481,8 +481,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 da2bbfba295e91475f53d1a45dcc6270f6b5abe8..9f5ad92ea3da52c4f0c6d10088b9714d518403ea 100644 --- a/src/sakia/gui/certification.py +++ b/src/sakia/gui/certification.py @@ -52,6 +52,7 @@ class CertificationDialog(QDialog, Ui_CertificationDialog): @asyncify async 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(): @@ -62,6 +63,7 @@ class CertificationDialog(QDialog, Ui_CertificationDialog): password = await self.password_asker.async_exec() if password == "": + self.button_box.setEnabled(True) return QApplication.setOverrideCursor(Qt.WaitCursor) result = await self.account.certify(password, self.community, pubkey) @@ -83,6 +85,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 e97939ee51759746d6628e34d4fc24195c274b2f..e0dae0faab07a4df7efeb45827bc59c7ad39f6f1 100644 --- a/src/sakia/gui/transfer.py +++ b/src/sakia/gui/transfer.py @@ -90,6 +90,7 @@ class TransferMoneyDialog(QDialog, Ui_TransferMoneyDialog): @asyncify async def accept(self): + self.button_box.setEnabled(False) comment = self.edit_message.text() if self.radio_contact.isChecked(): @@ -105,6 +106,7 @@ class TransferMoneyDialog(QDialog, Ui_TransferMoneyDialog): await 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 = await self.password_asker.async_exec() @@ -136,6 +138,7 @@ class TransferMoneyDialog(QDialog, Ui_TransferMoneyDialog): await QAsyncMessageBox.critical(self, self.tr("Transfer"), result[1]) QApplication.restoreOverrideCursor() + self.button_box.setEnabled(True) @asyncify async def amount_changed(self, value):