Skip to content
Snippets Groups Projects
Commit 488dd046 authored by inso's avatar inso
Browse files

New display of units and network name

parent aebb5116
Branches
Tags
No related merge requests found
......@@ -16,10 +16,10 @@ class NodesProcessor:
def initialize_root_nodes(self, currency):
if not self.nodes(currency):
for pubkey in ROOT_SERVERS[currency]:
for pubkey in ROOT_SERVERS[currency]["nodes"]:
node = Node(currency=currency,
pubkey=pubkey,
endpoints=ROOT_SERVERS[currency][pubkey],
endpoints=ROOT_SERVERS[currency]["nodes"][pubkey],
peer_blockstamp=BlockUID.empty(),
state=Node.ONLINE)
self._repo.insert(node)
......
......@@ -6,6 +6,7 @@ from math import ceil, log
from sakia.gui.widgets import toast
from sakia.helpers import timestamp_to_dhms
from sakia.gui.widgets.dialogs import QAsyncMessageBox
from sakia.constants import ROOT_SERVERS
class ConnectionConfigView(QDialog, Ui_ConnectionConfigurationDialog):
......@@ -109,7 +110,7 @@ class ConnectionConfigView(QDialog, Ui_ConnectionConfigurationDialog):
"""
Hide unecessary buttons and display correct title
"""
self.setWindowTitle(self.tr("New connection to {0} network").format(currency))
self.setWindowTitle(self.tr("New connection to {0} network").format(ROOT_SERVERS[currency]["display"]))
def action_show_pubkey(self):
salt = self.edit_salt.text()
......
......@@ -71,7 +71,7 @@ class TransferModel(QObject):
"""
Get the value of the current referential
"""
localized = self.app.current_ref.instance(amount, self.connection.currency, self.app).diff_localized(True, True)
localized = self.app.current_ref.instance(amount, self.connection.currency, self.app).diff_localized(False, True)
return localized
def cancel_previous(self):
......
......@@ -4,7 +4,7 @@ from PyQt5.QtCore import QEvent, pyqtSlot, QObject
from PyQt5.QtGui import QIcon
from PyQt5.QtWidgets import QMessageBox, QApplication
from sakia.gui.sub.password_input import PasswordInputController
from sakia.constants import ROOT_SERVERS
from .model import MainWindowModel
from .status_bar.controller import StatusBarController
from .toolbar.controller import ToolbarController
......@@ -76,12 +76,6 @@ class MainWindowController(QObject):
navigation=navigation,
toolbar=toolbar
)
currencies = app.db.connections_repo.get_currencies()
if currencies:
currency = currencies[0]
else:
currency = ""
#app.version_requested.connect(main_window.latest_version_requested)
#app.account_imported.connect(main_window.import_account_accepted)
#app.account_changed.connect(main_window.change_account)
......@@ -89,7 +83,7 @@ class MainWindowController(QObject):
main_window.view.showMaximized()
else:
main_window.view.show()
main_window.refresh(currency)
main_window.refresh(app.currency)
return main_window
@pyqtSlot(str)
......@@ -124,7 +118,8 @@ class MainWindowController(QObject):
"""
self.status_bar.refresh()
self.toolbar.enable_actions(len(self.navigation.model.navigation[0]['children']) > 0)
self.view.setWindowTitle(self.tr("sakia {0} - {currency}").format(__version__, currency=currency))
display_name = ROOT_SERVERS[currency]["display"]
self.view.setWindowTitle(self.tr("sakia {0} - {1}").format(__version__, display_name))
def eventFilter(self, target, event):
"""
......
......@@ -2,9 +2,8 @@ import logging
from PyQt5.QtCore import QObject
from sakia.errors import NoPeerAvailable
from sakia.constants import ROOT_SERVERS
from duniterpy.api import errors
from sakia.decorators import asyncify
from .model import InformationsModel
from .view import InformationsView
......@@ -75,7 +74,7 @@ class InformationsController(QObject):
self.view.set_text_referentials(referentials)
params = self.model.parameters()
if params:
self.view.set_money_text(params, self.model.short_currency())
self.view.set_money_text(params, ROOT_SERVERS[self.model.connection.currency]["display"])
self.view.set_wot_text(params)
self.refresh_localized_data()
......
......@@ -3,8 +3,7 @@ import math
from PyQt5.QtCore import QLocale, QDateTime, pyqtSignal, QObject
from sakia.errors import NoPeerAvailable
from sakia.helpers import timestamp_to_dhms
from sakia.money.currency import shortened
from sakia.constants import ROOT_SERVERS
from sakia.money import Referentials
from duniterpy.api import errors
......@@ -43,6 +42,7 @@ class InformationsModel(QObject):
logging.debug('community parameters error : ' + str(e))
return None
localized_data['currency'] = ROOT_SERVERS[self.connection.currency]["display"]
localized_data['growth'] = params.c
localized_data['days_per_dividend'] = QLocale().toString(params.dt / 86400, 'f', 2)
......@@ -165,13 +165,6 @@ class InformationsModel(QObject):
refs_instances.append(ref_class(0, self.connection.currency, self.app, None))
return refs_instances
def short_currency(self):
"""
Get community currency
:return: the community in short currency format
"""
return shortened(self.connection.currency)
def notifications(self):
return self.app.parameters.notifications
......
......@@ -81,7 +81,7 @@ class InformationsView(QWidget, Ui_InformationsWidget):
<p><span style="font-weight:600;">{monetary_mass_label}</span> : {monetary_mass}</p>
<p><span style="font-weight:600;">{balance_label}</span> : {balance}</p>
</body>
</html>""".format(currency=data['units'],
</html>""".format(currency=data['currency'],
nb_members=data['members_count'],
members_label=self.tr("members"),
monetary_mass_label=self.tr("Monetary mass"),
......
......@@ -38,7 +38,7 @@ class QuantitativeZSum(BaseReferential):
@property
def units(self):
return QCoreApplication.translate("QuantitativeZSum", QuantitativeZSum._UNITS_STR_).format(shortened(self.currency))
return QCoreApplication.translate("QuantitativeZSum", QuantitativeZSum._UNITS_STR_).format("units")
@property
def formula(self):
......@@ -50,7 +50,7 @@ class QuantitativeZSum(BaseReferential):
@property
def diff_units(self):
return QCoreApplication.translate("Quantitative", Quantitative._UNITS_STR_).format(shortened(self.currency))
return QCoreApplication.translate("Quantitative", Quantitative._UNITS_STR_).format("units")
def value(self):
"""
......
......@@ -28,7 +28,7 @@ class Quantitative(BaseReferential):
@property
def units(self):
return QCoreApplication.translate("Quantitative", Quantitative._UNITS_STR_).format(shortened(self.currency))
return QCoreApplication.translate("Quantitative", Quantitative._UNITS_STR_).format("units")
@property
def formula(self):
......
......@@ -50,7 +50,7 @@ class Relative(BaseReferential):
@property
def units(self):
return QCoreApplication.translate("Relative", Relative._UNITS_STR_).format(shortened(self.currency))
return QCoreApplication.translate("Relative", Relative._UNITS_STR_).format("")
@property
def formula(self):
......
......@@ -37,7 +37,7 @@ class RelativeZSum(BaseReferential):
@property
def units(self):
return QCoreApplication.translate("RelativeZSum", RelativeZSum._UNITS_STR_).format(shortened(self.currency))
return QCoreApplication.translate("RelativeZSum", RelativeZSum._UNITS_STR_).format("")
@property
def formula(self):
......@@ -49,7 +49,7 @@ class RelativeZSum(BaseReferential):
@property
def diff_units(self):
return QCoreApplication.translate("Relative", Relative._UNITS_STR_).format(shortened(self.currency))
return QCoreApplication.translate("Relative", Relative._UNITS_STR_).format(shortened(""))
@staticmethod
def base_str(base):
......
fakenet:
display: fakenet
nodes:
HnFcSms8jzwngtVomTTnzudZx7SHUQY8sVE1y8yBmULk:
- "BASIC_MERKLED_API fakenet.cgeek.fr 10900"
gtest:
display: ğtest
nodes:
C4orqutdb3Nveur3xN5L2TduT1j8d2EZkJsWLmWuD2Sv:
- "BASIC_MERKLED_API gtest.duniter.org 10900"
- "BASIC_MERKLED_API cgeek.fr 10900"
- "BASIC_MERKLED_API gtest.duniter.fr 10900"
g1:
display: ğ1
nodes:
858SvdsS7Aog3U8QRg2TaygEFN8M8Hru48P17KosDFbg:
- "BASIC_MERKLED_API g1.duniter.org 80"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment