From f322a2c4a6692c4648fc3bc59cf43dda24da2f58 Mon Sep 17 00:00:00 2001 From: Inso <insomniak.fr@gmail.com> Date: Fri, 4 Sep 2015 07:23:49 +0200 Subject: [PATCH] Fix bugs when adding a community --- src/cutecoin/gui/community_tile.py | 1 + src/cutecoin/gui/identities_tab.py | 9 +++++++-- src/cutecoin/gui/process_cfg_community.py | 9 ++++++--- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/cutecoin/gui/community_tile.py b/src/cutecoin/gui/community_tile.py index 053c731c..04fbedc8 100644 --- a/src/cutecoin/gui/community_tile.py +++ b/src/cutecoin/gui/community_tile.py @@ -14,6 +14,7 @@ class CommunityTile(QFrame): super().__init__(parent) self.app = app self.community = community + self.community.inner_data_changed.connect(self.refresh) self.text_label = QLabel() self.setLayout(QVBoxLayout()) self.layout().setSizeConstraint(QLayout.SetFixedSize) diff --git a/src/cutecoin/gui/identities_tab.py b/src/cutecoin/gui/identities_tab.py index 9ae72577..646e59bb 100644 --- a/src/cutecoin/gui/identities_tab.py +++ b/src/cutecoin/gui/identities_tab.py @@ -66,9 +66,14 @@ class IdentitiesTabWidget(QWidget, Ui_IdentitiesTab): def change_community(self, community): if self.community: - self.account.identity(self.community).inner_data_changed.disconnect(self.handle_account_identity_change) + try: + self.account.identity(self.community).inner_data_changed.disconnect(self.handle_account_identity_change) + except TypeError as e: + if "disconnect" in str(e): + logging.debug("Disconnect failed between inner_data_changed ans handle_account_identity_changed") + pass if community: - self.account.identity(self.community).inner_data_changed.connect(self.handle_account_identity_change) + self.account.identity(community).inner_data_changed.connect(self.handle_account_identity_change) self.community = community self.table_identities.model().change_community(community) diff --git a/src/cutecoin/gui/process_cfg_community.py b/src/cutecoin/gui/process_cfg_community.py index 9294cf25..6ec9c491 100644 --- a/src/cutecoin/gui/process_cfg_community.py +++ b/src/cutecoin/gui/process_cfg_community.py @@ -9,7 +9,7 @@ import asyncio from PyQt5.QtWidgets import QDialog, QMenu, QMessageBox, QApplication from PyQt5.QtGui import QCursor -from PyQt5.QtCore import pyqtSlot +from PyQt5.QtCore import pyqtSlot, pyqtSignal from ..gen_resources.community_cfg_uic import Ui_CommunityConfigurationDialog from ..models.peering import PeeringTreeModel @@ -96,6 +96,7 @@ class ProcessConfigureCommunity(QDialog, Ui_CommunityConfigurationDialog): """ Dialog to configure or add a community """ + community_added = pyqtSignal() def __init__(self, app, account, community, password_asker): """ @@ -115,6 +116,7 @@ class ProcessConfigureCommunity(QDialog, Ui_CommunityConfigurationDialog): self.step = None self.nodes = [] + self.community_added.connect(self.add_community_and_close) step_init = StepPageInit(self) step_add_peers = StepPageAddpeers(self) @@ -218,6 +220,7 @@ class ProcessConfigureCommunity(QDialog, Ui_CommunityConfigurationDialog): self.account.broadcast_error.disconnect(self.handle_error) QApplication.restoreOverrideCursor() + @pyqtSlot() def add_community_and_close(self): if self.community not in self.account.communities: self.account.add_community(self.community) @@ -239,6 +242,6 @@ Would you like to publish the key ?""").format(self.account.pubkey)) self.account.broadcast_error.connect(self.handle_error) asyncio.async(self.account.send_selfcert(password, self.community)) else: - self.add_community_and_close() + self.community_added.emit() else: - self.add_community_and_close() + self.community_added.emit() -- GitLab