diff --git a/res/ui/currency_tab.ui b/res/ui/currency_tab.ui index d56ceb510acec4ea49fce7866c330b6d3a3a2885..96fb8c5971e30da25a72bb274cce7d4ad3b27974 100644 --- a/res/ui/currency_tab.ui +++ b/res/ui/currency_tab.ui @@ -29,9 +29,6 @@ <layout class="QVBoxLayout" name="verticalLayout"> <item> <widget class="QTabWidget" name="tabs_account"> - <property name="enabled"> - <bool>false</bool> - </property> <property name="currentIndex"> <number>-1</number> </property> diff --git a/src/cutecoin/core/net/network.py b/src/cutecoin/core/net/network.py index f483db38b2bb6a992ec36f7b32196f7ae89e5694..f82e083cb32e49de454ee72296c4500d60189902 100644 --- a/src/cutecoin/core/net/network.py +++ b/src/cutecoin/core/net/network.py @@ -197,7 +197,7 @@ class Network(QObject): for node in self.nodes: if self.continue_crawling(): yield from asyncio.sleep(2) - node.refresh() + node.refresh_identities() logging.debug("End of network discovery") @pyqtSlot(Peer) diff --git a/src/cutecoin/core/wallet.py b/src/cutecoin/core/wallet.py index 3d996beef8d0d8378ccd1699cca50180fbac6e15..cc8aadcc5d8253a22490f833a6dc21cb1bfb0914 100644 --- a/src/cutecoin/core/wallet.py +++ b/src/cutecoin/core/wallet.py @@ -114,7 +114,7 @@ class Wallet(QObject): :param community: The community to refresh its cache """ logging.debug("Refresh transactions for {0}".format(self.pubkey)) - asyncio.async(self.caches[community.currency].refresh(community, received_list)) + asyncio.async(self.caches[community.currency].refresh_identities(community, received_list)) def check_password(self, salt, password): """ diff --git a/src/cutecoin/gui/community_tab.py b/src/cutecoin/gui/community_tab.py index 8869848572194e5aecf19d9bd0ee0b93d9cbd898..89717f7dc504e5f83a132d280ee2589f244c2583 100644 --- a/src/cutecoin/gui/community_tab.py +++ b/src/cutecoin/gui/community_tab.py @@ -43,10 +43,9 @@ class CommunityTabWidget(QWidget, Ui_CommunityTabWidget): self.community = community self.account = account self.password_asker = password_asker - self.setup_ui() - def setup_ui(self): self.setupUi(self) + identities_model = IdentitiesTableModel(self.community) proxy = IdentitiesFilterProxyModel() proxy.setSourceModel(identities_model) @@ -251,7 +250,7 @@ Revoking your UID can only success if it is not already validated by the network raise self.edit_textsearch.clear() - self.refresh(identities) + self.refresh_identities(identities) def search_text(self): """ @@ -297,7 +296,7 @@ Revoking your UID can only success if it is not already validated by the network raise self.edit_textsearch.clear() - self.refresh(identities) + self.refresh_identities(identities) def search_direct_connections(self): """ @@ -322,9 +321,9 @@ Revoking your UID can only success if it is not already validated by the network certified_by = [p for p in account_connections if p.pubkey not in [i.pubkey for i in certifiers_of]] identities = certifiers_of + certified_by - self.refresh(identities) + self.refresh_identities(identities) - def refresh(self, identities): + def refresh_identities(self, identities): """ Refresh the table with specified identities. If no identities is passed, use the account connections. diff --git a/src/cutecoin/gui/currency_tab.py b/src/cutecoin/gui/currency_tab.py index 2809a02e3d085b5a354a94555b5b3e210ee03f7f..71af87f5e99980a475b73d8f99e019ede9bb9f43 100644 --- a/src/cutecoin/gui/currency_tab.py +++ b/src/cutecoin/gui/currency_tab.py @@ -33,7 +33,6 @@ class CurrencyTabWidget(QWidget, Ui_CurrencyTabWidget): Constructor """ super().__init__() - self.setupUi(self) self.app = app self.community = community self.password_asker = password_asker @@ -46,13 +45,8 @@ class CurrencyTabWidget(QWidget, Ui_CurrencyTabWidget): self.tr("Warning : Your could miss certifications soon.") } - self.tab_community = None - self.tab_wallets = None - self.tab_network = None - self.tab_history = None - - def setupUi(self): super().setupUi(self) + self.tab_community = CommunityTabWidget(self.app, self.app.current_account, self.community, @@ -86,6 +80,10 @@ class CurrencyTabWidget(QWidget, Ui_CurrencyTabWidget): QIcon(':/icons/informations_icon'), self.tr("Informations")) + self.tabs_account.addTab(self.tab_community, + QIcon(':/icons/community_icon'), + self.tr("Community")) + self.tabs_account.addTab(self.tab_network, QIcon(":/icons/network_icon"), self.tr("Network")) @@ -93,24 +91,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) - def refresh(self): - if self.app.current_account is None: - self.tabs_account.setEnabled(False) - else: - self.tabs_account.setEnabled(True) - - self.tab_wallets.refresh() - - self.tab_history.refresh() - - self.tab_community.refresh() - - self.tab_informations.refresh() - - self.tab_network.refresh() - - self.refresh_status() - @pyqtSlot(str) def display_error(self, error): QMessageBox.critical(self, ":(", @@ -153,6 +133,10 @@ class CurrencyTabWidget(QWidget, Ui_CurrencyTabWidget): self.tab_history.start_progress() self.refresh_data() + def refresh_wallets(self): + if self.tab_wallets: + self.tab_wallets.refresh() + def refresh_data(self): """ Refresh data when the blockchain watcher finished handling datas diff --git a/src/cutecoin/gui/mainwindow.py b/src/cutecoin/gui/mainwindow.py index 5d1faac5833d9cb881d9460fd87eaf18ba2f3221..d6e991b13d544d3252357b7ea0cf1928908ec585 100644 --- a/src/cutecoin/gui/mainwindow.py +++ b/src/cutecoin/gui/mainwindow.py @@ -44,25 +44,24 @@ class MainWindow(QMainWindow, Ui_MainWindow): self.app = app self.initialized = False self.password_asker = None - self.combo_referential = QComboBox(self) - self.status_label = QLabel("", self) - self.label_time = QLabel("", self) self.import_dialog = None - self.setupUi() - def setupUi(self): super().setupUi(self) + QApplication.setWindowIcon(QIcon(":/icons/cutecoin_logo")) self.app.version_requested.connect(self.latest_version_requested) - self.combo_referential.setEnabled(False) - self.combo_referential.currentIndexChanged.connect(self.referential_changed) - + self.status_label = QLabel("", self) self.status_label.setTextFormat(Qt.RichText) - self.statusbar.addPermanentWidget(self.status_label, 1) + + self.label_time = QLabel("", self) self.statusbar.addPermanentWidget(self.label_time) + + self.combo_referential = QComboBox(self) + self.combo_referential.setEnabled(False) + self.combo_referential.currentIndexChanged.connect(self.referential_changed) self.statusbar.addPermanentWidget(self.combo_referential) self.homescreen = HomeScreenWidget(self.app) @@ -242,7 +241,6 @@ class MainWindow(QMainWindow, Ui_MainWindow): tab_currency = CurrencyTabWidget(self.app, community, self.password_asker, self.status_label) - tab_currency.refresh() self.currencies_tabwidget.addTab(tab_currency, QIcon(":/icons/currency_icon"), community.name)