Skip to content
Snippets Groups Projects
Commit 08e817bc authored by inso's avatar inso
Browse files

Corrections diverses dans les vues

parent 2552cd22
Branches
Tags
No related merge requests found
......@@ -63,11 +63,11 @@ class CommunityWidget(QWidget, Ui_CommunityWidget):
QIcon(':/icons/tx_icon'),
self.tr("Transactions"))
self.tabs.addTab(self.tab_identities,
self.tabs.addTab(self.tab_wot,
QIcon(':/icons/wot_icon'),
self.tr("Web of Trust"))
self.tabs.addTab(self.tab_wot,
self.tabs.addTab(self.tab_identities,
QIcon(':/icons/members_icon'),
self.tr("Search Identities"))
......@@ -81,15 +81,21 @@ class CommunityWidget(QWidget, Ui_CommunityWidget):
self.tab_identities.change_account(account)
def change_community(self, community):
self.community = community
self.tab_network.change_community(community)
self.tab_wot.change_community(community)
self.tab_history.change_community(community)
self.tab_identities.change_community(community)
self.community.network.new_block_mined.connect(self.refresh_block)
self.community.network.nodes_changed.connect(self.refresh_status)
self.community.inner_data_changed.connect(self.refresh_status)
if self.community:
self.community.network.new_block_mined.disconnect(self.refresh_block)
self.community.network.nodes_changed.disconnect(self.refresh_status)
self.community.inner_data_changed.disconnect(self.refresh_status)
if community:
community.network.new_block_mined.connect(self.refresh_block)
community.network.nodes_changed.connect(self.refresh_status)
community.inner_data_changed.connect(self.refresh_status)
self.label_currency.setText(community.currency)
self.community = community
@pyqtSlot(str)
def display_error(self, error):
......@@ -188,7 +194,7 @@ class CommunityWidget(QWidget, Ui_CommunityWidget):
self.refresh_status()
def referential_changed(self):
if self.tab_history.table_history.model():
if self.community and self.tab_history.table_history.model():
self.tab_history.table_history.model().dataChanged.emit(
QModelIndex(),
QModelIndex(),
......
......@@ -71,8 +71,10 @@ class MainWindow(QMainWindow, Ui_MainWindow):
self.homescreen.toolbutton_new_account.addAction(self.action_import)
self.homescreen.button_disconnect.clicked.connect(lambda :self.action_change_account(""))
self.centralWidget().layout().addWidget(self.homescreen)
self.homescreen.toolbutton_connect.setMenu(self.menu_change_account)
self.community_view = CommunityWidget(self.app, self.status_label)
self.community_view.button_home.clicked.connect(lambda: self.change_community(None))
self.community_view.button_certification.clicked.connect(self.open_certification_dialog)
self.community_view.button_send_money.clicked.connect(self.open_transfer_money_dialog)
self.centralWidget().layout().addWidget(self.community_view)
......@@ -236,9 +238,16 @@ class MainWindow(QMainWindow, Ui_MainWindow):
@pyqtSlot(Community)
def change_community(self, community):
logging.debug("Change on tile")
if self.community_view.community:
self.community_view.community.stop_coroutines()
if community:
self.homescreen.hide()
self.community_view.show()
else:
self.homescreen.show()
self.community_view.hide()
self.community_view.change_community(community)
def refresh_accounts(self):
......@@ -247,7 +256,6 @@ class MainWindow(QMainWindow, Ui_MainWindow):
action = QAction(account_name, self)
action.triggered.connect(lambda checked, account_name=account_name: self.action_change_account(account_name))
self.menu_change_account.addAction(action)
self.homescreen.toolbutton_connect.addAction(action)
def refresh_contacts(self):
self.menu_contacts_list.clear()
......@@ -275,9 +283,12 @@ class MainWindow(QMainWindow, Ui_MainWindow):
if self.app.current_account is None:
self.setWindowTitle(self.tr("CuteCoin {0}").format(__version__))
self.menu_account.setEnabled(False)
self.action_add_a_contact.setEnabled(False)
self.actionCertification.setEnabled(False)
self.actionTransfer_money.setEnabled(False)
self.action_configure_parameters.setEnabled(False)
self.action_set_as_default.setEnabled(False)
self.menu_contacts_list.setEnabled(False)
self.combo_referential.setEnabled(False)
self.status_label.setText(self.tr(""))
self.password_asker = None
......@@ -293,7 +304,10 @@ class MainWindow(QMainWindow, Ui_MainWindow):
self.combo_referential.blockSignals(False)
logging.debug(self.app.preferences)
self.combo_referential.setCurrentIndex(self.app.preferences['ref'])
self.menu_account.setEnabled(True)
self.action_add_a_contact.setEnabled(True)
self.actionCertification.setEnabled(True)
self.actionTransfer_money.setEnabled(True)
self.menu_contacts_list.setEnabled(True)
self.action_configure_parameters.setEnabled(True)
self.setWindowTitle(self.tr("CuteCoin {0} - Account : {1}").format(__version__,
self.app.current_account.name))
......
......@@ -41,9 +41,13 @@ class NetworkTabWidget(QWidget, Ui_NetworkTabWidget):
self.table_network.resizeColumnsToContents()
def change_community(self, community):
if community:
community.network.nodes_changed.connect(self.refresh_nodes)
if self.community:
self.community.network.nodes_changed.disconnect(self.refresh_nodes)
self.community = community
self.table_network.model().change_community(community)
community.network.nodes_changed.connect(self.refresh_nodes)
@pyqtSlot()
def refresh_nodes(self):
......
......@@ -35,9 +35,12 @@ class TransactionsTabWidget(QWidget, Ui_transactionsTabWidget):
self.refresh()
def change_community(self, community):
if self.community:
self.community.inner_data_changed.disconnect(self.refresh_minimum_maximum)
if community:
community.inner_data_changed.connect(self.refresh_minimum_maximum)
self.community = community
self.refresh()
self.community.inner_data_changed.connect(self.refresh_minimum_maximum)
def refresh_minimum_maximum(self):
block = self.community.get_block(1)
......
......@@ -52,9 +52,12 @@ class WotTabWidget(QWidget, Ui_WotTabWidget):
self.account = account
def change_community(self, community):
if self.community:
self.community.network.new_block_mined.disconnect(self.refresh)
if community:
community.network.new_block_mined.connect(self.refresh)
self.community = community
self.reset()
self.community.network.new_block_mined.connect(self.refresh)
def refresh_informations_frame(self):
parameters = self.community.parameters
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment