Skip to content
Snippets Groups Projects
Commit 8a207a32 authored by inso's avatar inso
Browse files

Refresh account quality status

parent 221ed42f
No related branches found
No related tags found
No related merge requests found
......@@ -5,7 +5,7 @@ Created on 2 févr. 2014
'''
import logging
from PyQt5.QtCore import Qt
from PyQt5.QtCore import Qt, pyqtSlot
from PyQt5.QtGui import QIcon, QCursor
from PyQt5.QtWidgets import QWidget, QMessageBox, QAction, QMenu, QDialog, \
QAbstractItemView
......@@ -51,25 +51,7 @@ class CommunityTabWidget(QWidget, Ui_CommunityTabWidget):
self.table_identities.setSelectionBehavior(QAbstractItemView.SelectRows)
self.table_identities.customContextMenuRequested.connect(self.identity_context_menu)
self.table_identities.sortByColumn(0, Qt.AscendingOrder)
try:
if self.account.published_uid(self.community):
if self.account.member_of(self.community):
self.button_membership.setText("Renew membership")
self.button_publish_uid.hide()
self.button_leaving.show()
else:
self.button_membership.setText("Send membership demand")
self.button_leaving.hide()
self.button_publish_uid.hide()
else:
self.button_membership.hide()
self.button_leaving.hide()
self.button_publish_uid.show()
except PersonNotFoundError:
self.button_membership.hide()
self.button_leaving.hide()
self.button_publish_uid.show()
app.monitor.persons_watcher(self.community).person_changed.connect(self.refresh_person)
self.wot_tab = WotTabWidget(app, account, community, password_asker, self)
self.tabs_information.addTab(self.wot_tab, QIcon(':/icons/wot_icon'), "WoT")
......@@ -80,6 +62,7 @@ class CommunityTabWidget(QWidget, Ui_CommunityTabWidget):
direct_connections.triggered.connect(self.search_direct_connections)
self.button_search.addAction(direct_connections)
self.refresh()
self.refresh_quality_buttons()
def identity_context_menu(self, point):
index = self.table_identities.indexAt(point)
......@@ -316,9 +299,39 @@ Publishing your UID cannot be canceled.""")
self.table_identities.model().sourceModel().refresh_identities(persons)
def refresh_quality_buttons(self):
try:
if self.account.published_uid(self.community):
logging.debug("UID Published")
if self.account.member_of(self.community):
self.button_membership.setText("Renew membership")
self.button_membership.show()
self.button_publish_uid.hide()
self.button_leaving.show()
else:
logging.debug("Not a member")
self.button_membership.setText("Send membership demand")
self.button_membership.show()
self.button_leaving.hide()
self.button_publish_uid.hide()
else:
logging.debug("UID not published")
self.button_membership.hide()
self.button_leaving.hide()
self.button_publish_uid.show()
except PersonNotFoundError:
self.button_membership.hide()
self.button_leaving.hide()
self.button_publish_uid.show()
@pyqtSlot(str)
def refresh_person(self, pubkey):
logging.debug("Refresh person {0}".format(pubkey))
if self is None:
logging.error("community_tab self is None in refresh_person. Watcher connected to a destroyed tab")
else:
if pubkey == self.account.pubkey:
self.refresh_quality_buttons()
index = self.table_identities.model().sourceModel().person_index(pubkey)
self.table_identities.model().sourceModel().dataChanged.emit(index[0], index[1])
......@@ -52,8 +52,6 @@ class CurrencyTabWidget(QWidget, Ui_CurrencyTabWidget):
self.community.network.new_block_mined.connect(self.refresh_block)
self.community.network.nodes_changed.connect(self.refresh_status)
persons_watcher = self.app.monitor.persons_watcher(self.community)
persons_watcher.person_changed.connect(self.tab_community.refresh_person)
bc_watcher = self.app.monitor.blockchain_watcher(self.community)
bc_watcher.error.connect(self.display_error)
bc_watcher.watching_stopped.connect(self.refresh_data)
......@@ -145,7 +143,7 @@ class CurrencyTabWidget(QWidget, Ui_CurrencyTabWidget):
'''
logging.debug("Refresh block")
self.tab_history.progressbar.show()
self.app.monitor.blockchain_watcher(self.community).thread().start()
#self.app.monitor.blockchain_watcher(self.community).thread().start()
self.app.monitor.persons_watcher(self.community).thread().start()
self.refresh_status()
......@@ -160,9 +158,9 @@ class CurrencyTabWidget(QWidget, Ui_CurrencyTabWidget):
if self.tab_history.table_history.model():
self.tab_history.table_history.model().sourceModel().refresh_transfers()
#self.tab_history.refresh_balance()
self.tab_history.progressbar.hide()
self.refresh_status()
self.tab_history.refresh_balance()
@pyqtSlot()
def refresh_status(self):
......
......@@ -106,7 +106,6 @@ class WalletsTabWidget(QWidget, Ui_WalletsTab):
else:
localized_maximum = QLocale().toString(self.get_referential_value(maximum), 'f', 6)
logging.debug(self.tr("{:} {:} in [{:.2f} - {:}] {:}"))
# set infos in label
self.label_balance.setText(
self.tr("""
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment