Skip to content
Snippets Groups Projects
Commit 2161632f authored by Vincent Texier's avatar Vincent Texier
Browse files

Set UD precision to 6 decimals

parent f6565e9b
Branches
Tags
No related merge requests found
......@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>399</width>
<height>402</height>
<height>409</height>
</rect>
</property>
<property name="windowTitle">
......@@ -143,6 +143,9 @@
<property name="suffix">
<string> UD</string>
</property>
<property name="decimals">
<number>6</number>
</property>
<property name="maximum">
<double>9999999.000000000000000</double>
</property>
......
......@@ -55,12 +55,12 @@ class InformationsTabWidget(QWidget, Ui_InformationsTabWidget):
localized_monetary_mass = QLocale().toString(round(self.get_referential_value(block['monetaryMass'])))
localized_mass_per_member = QLocale().toString(round(self.get_referential_value(block['monetaryMass'] / block['membersCount'])))
else:
localized_ud = QLocale().toString(ud, 'f', 2)
localized_ud = QLocale().toString(ud, 'f', 6)
localized_monetary_mass = QLocale().toString(
round(self.get_referential_value(block['monetaryMass'])), 'f', 2
round(self.get_referential_value(block['monetaryMass'])), 'f', 6
)
localized_mass_per_member = QLocale().toString(
round(self.get_referential_value(block['monetaryMass'] / block['membersCount']), 'f', 2)
round(self.get_referential_value(block['monetaryMass'] / block['membersCount']), 'f', 6)
)
# set infos in label
......
......@@ -79,11 +79,11 @@ class TransactionsTabWidget(QWidget, Ui_transactionsTabWidget):
else:
localized_deposits = QLocale().toString(
self.app.current_account.units_to_ref(proxy.deposits, self.community), 'f', 2)
self.app.current_account.units_to_ref(proxy.deposits, self.community), 'f', 6)
localized_payments = QLocale().toString(
self.app.current_account.units_to_ref(proxy.payments, self.community), 'f', 2)
self.app.current_account.units_to_ref(proxy.payments, self.community), 'f', 6)
localized_balance = QLocale().toString(
self.app.current_account.units_to_diff_ref(balance, self.community), 'f', 2)
self.app.current_account.units_to_diff_ref(balance, self.community), 'f', 6)
self.label_deposit.setText(self.tr("Deposits: {:} {:}").format(
localized_deposits,
......
......@@ -4,14 +4,12 @@ Created on 2 févr. 2014
@author: inso
'''
from PyQt5.QtWidgets import QDialog, QMessageBox, QApplication
from PyQt5.QtCore import QRegExp, Qt
from PyQt5.QtCore import QRegExp, Qt, QLocale
from PyQt5.QtGui import QRegExpValidator
from ..tools.exceptions import NotEnoughMoneyError, NoPeerAvailable
from ..gen_resources.transfer_uic import Ui_TransferMoneyDialog
import logging
class TransferMoneyDialog(QDialog, Ui_TransferMoneyDialog):
......@@ -125,6 +123,10 @@ Please try again later"""))
amount = self.wallet.value(self.community)
ref_amount = self.account.units_to_ref(amount, self.community)
ref_name = self.account.ref_name(self.community.currency)
if isinstance(ref_amount, int):
ref_amount = QLocale().toString(ref_amount)
else:
ref_amount = QLocale().toString(ref_amount, 'f', 6)
self.label_total.setText("{0} {1}".format(ref_amount, ref_name))
self.spinbox_amount.setSuffix(" " + self.community.currency)
self.spinbox_amount.setValue(0)
......@@ -138,6 +140,10 @@ Please try again later"""))
amount = self.wallet.value(self.community)
ref_amount = self.account.units_to_ref(amount, self.community)
ref_name = self.account.ref_name(self.community.currency)
if isinstance(ref_amount, int):
ref_amount = QLocale().toString(ref_amount)
else:
ref_amount = QLocale().toString(ref_amount, 'f', 6)
self.label_total.setText("{0} {1}".format(ref_amount, ref_name))
self.spinbox_amount.setValue(0)
amount = self.wallet.value(self.community)
......
......@@ -94,12 +94,12 @@ class WalletsTabWidget(QWidget, Ui_WalletsTab):
if isinstance(amount, int):
localized_amount = QLocale().toString(self.get_referential_value(amount))
else:
localized_amount = QLocale().toString(self.get_referential_value(amount), 'f', 2)
localized_amount = QLocale().toString(self.get_referential_value(amount), 'f', 6)
if isinstance(maximum, int):
localized_maximum = QLocale().toString(self.get_referential_value(maximum))
else:
localized_maximum = QLocale().toString(self.get_referential_value(maximum), 'f', 2)
localized_maximum = QLocale().toString(self.get_referential_value(maximum), 'f', 6)
logging.debug( self.tr("{:} {:} in [{:.2f} - {:}] {:}"))
# set infos in label
......
......@@ -104,7 +104,7 @@ class TxFilterProxyModel(QSortFilterProxyModel):
if isinstance(amount_ref, int):
return QLocale().toString(amount_ref)
else:
return QLocale().toString(amount_ref, 'f', 2)
return QLocale().toString(amount_ref, 'f', 6)
if role == Qt.FontRole:
font = QFont()
......
......@@ -42,7 +42,7 @@ class WalletsFilterProxyModel(QSortFilterProxyModel):
if isinstance(amount_ref, int):
return QLocale().toString(amount_ref)
else:
return QLocale().toString(amount_ref, 'f', 2)
return QLocale().toString(amount_ref, 'f', 6)
if role == Qt.TextAlignmentRole:
if source_index.column() == self.sourceModel().columns_types.index('amount'):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment