diff --git a/src/cutecoin/core/net/api/bma/access.py b/src/cutecoin/core/net/api/bma/access.py index df1c210847ed85e480701c596c381bf94d500ea1..5c64b38211a10a3f620a8c8b68a4a7b9648a0900 100644 --- a/src/cutecoin/core/net/api/bma/access.py +++ b/src/cutecoin/core/net/api/bma/access.py @@ -148,9 +148,6 @@ class BmaAccess(QObject): :return: The future data :rtype: dict """ - if request == blockchain.UD: - pass - def handle_future_reply(reply): if reply.error() == QNetworkReply.NoError: strdata = bytes(reply.readAll()).decode('utf-8') diff --git a/src/cutecoin/gui/community_tile.py b/src/cutecoin/gui/community_tile.py index cfe1ec27b438dd9a61cacceee20596b8934f1d76..205b3ec4c2584905ac8f2b9a01fee38c96acadbc 100644 --- a/src/cutecoin/gui/community_tile.py +++ b/src/cutecoin/gui/community_tile.py @@ -33,6 +33,11 @@ class CommunityTile(QFrame): def refresh(self): current_block = yield from self.community.get_block(self.community.network.latest_block_number) members_pubkeys = yield from self.community.members_pubkeys() + amount = yield from self.app.current_account.amount(self.community) + localized_amount = yield from self.app.current_account.current_ref(amount, + self.community, self.app).localized(units=True) + localized_monetary_mass = yield from self.app.current_account.current_ref(current_block['monetaryMass'], + self.community, self.app).localized(units=True) status = self.tr("Member") if self.app.current_account.pubkey in members_pubkeys \ else self.tr("Non-Member") description = """<html> @@ -49,11 +54,11 @@ class CommunityTile(QFrame): nb_members=len(members_pubkeys), members_label=self.tr("members"), monetary_mass_label=self.tr("Monetary mass"), - monetary_mass=current_block['monetaryMass'], + monetary_mass=localized_monetary_mass, status_label=self.tr("Status"), status=status, balance_label=self.tr("Balance"), - balance=self.app.current_account.amount(self.community)) + balance=localized_amount) self.text_label.setText(description) def mousePressEvent(self, event): diff --git a/src/cutecoin/gui/community_view.py b/src/cutecoin/gui/community_view.py index c0e515d532d1436164047a50b24cbd732295fa81..2d77b6a13582476b92817913b9bb347098aefbd2 100644 --- a/src/cutecoin/gui/community_view.py +++ b/src/cutecoin/gui/community_view.py @@ -324,6 +324,14 @@ Revoking your UID can only success if it is not already validated by the network else: QMessageBox.error(error, strdata) + def showEvent(self, QShowEvent): + """ + + :param QShowEvent: + :return: + """ + self.refresh_status() + def changeEvent(self, event): """ Intercepte LanguageChange event to translate UI diff --git a/src/cutecoin/gui/homescreen.py b/src/cutecoin/gui/homescreen.py index cc4db8af1d720f695d6933d851a4d3efac4dff34..d20dff1485b0534e828e762a54857fbc4050523f 100644 --- a/src/cutecoin/gui/homescreen.py +++ b/src/cutecoin/gui/homescreen.py @@ -48,7 +48,7 @@ class HomeScreenWidget(QWidget, Ui_HomescreenWidget): classdocs """ - def __init__(self, app): + def __init__(self, app, status_label): """ Constructor """ @@ -57,6 +57,7 @@ class HomeScreenWidget(QWidget, Ui_HomescreenWidget): self.app = app self.frame_communities = FrameCommunities(self) self.layout().addWidget(self.frame_communities) + self.status_label = status_label def refresh(self): self.frame_communities.refresh(self.app) @@ -68,6 +69,14 @@ class HomeScreenWidget(QWidget, Ui_HomescreenWidget): self.frame_disconnected.show() self.frame_connected.hide() + def showEvent(self, QShowEvent): + """ + + :param QShowEvent: + :return: + """ + self.status_label.setText("") + def changeEvent(self, event): """ Intercepte LanguageChange event to translate UI diff --git a/src/cutecoin/gui/mainwindow.py b/src/cutecoin/gui/mainwindow.py index 37289751f9be321c0b0b25a13575fa63c4375723..a361f6bcb9012d546eceba45ef738d0c5f99dc66 100644 --- a/src/cutecoin/gui/mainwindow.py +++ b/src/cutecoin/gui/mainwindow.py @@ -66,7 +66,7 @@ class MainWindow(QMainWindow, Ui_MainWindow): self.combo_referential.currentIndexChanged.connect(self.referential_changed) self.statusbar.addPermanentWidget(self.combo_referential) - self.homescreen = HomeScreenWidget(self.app) + self.homescreen = HomeScreenWidget(self.app, self.status_label) self.homescreen.frame_communities.community_tile_clicked.connect(self.change_community) self.homescreen.toolbutton_new_account.addAction(self.action_add_account) self.homescreen.toolbutton_new_account.addAction(self.action_import) @@ -254,8 +254,8 @@ class MainWindow(QMainWindow, Ui_MainWindow): self.homescreen.hide() self.community_view.show() else: - self.homescreen.show() self.community_view.hide() + self.homescreen.show() self.community_view.change_community(community) diff --git a/src/cutecoin/gui/transactions_tab.py b/src/cutecoin/gui/transactions_tab.py index e0b0f91219b1073a31193edf213656fca3b022a9..534bc085ecbde8123615cfae391f64051f55b9f1 100644 --- a/src/cutecoin/gui/transactions_tab.py +++ b/src/cutecoin/gui/transactions_tab.py @@ -111,51 +111,17 @@ class TransactionsTabWidget(QWidget, Ui_transactionsTabWidget): @asyncify @asyncio.coroutine def refresh_balance(self): - if self.app.preferences['expert_mode']: - # if referential is "units" - if self.app.current_account._current_ref == 0: - self.label_balance.show() - self.label_deposit.show() - self.label_payment.show() - else: - self.label_balance.hide() - self.label_deposit.hide() - self.label_payment.hide() - - proxy = self.table_history.model() - balance = proxy.deposits - proxy.payments - localized_deposits = yield from self.app.current_account.current_ref(proxy.deposits, self.community, - self.app).diff_localized() - localized_payments = yield from self.app.current_account.current_ref(proxy.payments, self.community, - self.app).diff_localized() - localized_balance = yield from self.app.current_account.current_ref(balance, self.community, - self.app).diff_localized() - - self.label_deposit.setText(QCoreApplication.translate("TransactionsTabWidget", "<b>Deposits</b> {:} {:}").format( - localized_deposits, - self.app.current_account.current_ref.units(self.community.short_currency) - )) - self.label_payment.setText(QCoreApplication.translate("TransactionsTabWidget", "<b>Payments</b> {:} {:}").format( - localized_payments, - self.app.current_account.current_ref.units(self.community.short_currency) - )) - self.label_balance.setText(QCoreApplication.translate("TransactionsTabWidget", "<b>Balance</b> {:} {:}").format( - localized_balance, - self.app.current_account.current_ref.units(self.community.short_currency) - )) - - else: - amount = yield from self.app.current_account.amount(self.community) - localized_amount = yield from self.app.current_account.current_ref(amount, self.community, - self.app).localized(units=True) - - # set infos in label - self.label_balance.setText( - self.tr("{:}") - .format( - localized_amount - ) + amount = yield from self.app.current_account.amount(self.community) + localized_amount = yield from self.app.current_account.current_ref(amount, self.community, + self.app).localized(units=True) + + # set infos in label + self.label_balance.setText( + self.tr("{:}") + .format( + localized_amount ) + ) def history_context_menu(self, point): index = self.table_history.indexAt(point)