Skip to content
Snippets Groups Projects
Commit 01b45028 authored by inso's avatar inso
Browse files

Merge branch 'dev0114'

parents 0f32dd85 d9e177b3
Branches
Tags
No related merge requests found
......@@ -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},
......
__version_info__ = ('0', '11', '4')
__version_info__ = ('0', '11', '5')
__version__ = '.'.join(__version_info__)
......@@ -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
prefix_index += 1
if prefix_index < len(prefixes):
......
......@@ -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))
......
......@@ -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]
......
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment