diff --git a/src/cutecoin/core/net/node.py b/src/cutecoin/core/net/node.py index ed141ac451690770248a3adf9a0f44e65097bd17..648990dee4e325fea61403437bc276924a97cc4a 100644 --- a/src/cutecoin/core/net/node.py +++ b/src/cutecoin/core/net/node.py @@ -94,7 +94,7 @@ class Node(QObject): node = cls(network_manager, peer.currency, [Endpoint.from_inline(e.inline()) for e in peer.endpoints], - "", peer.pubkey, 0, Block.Empty_Hash, Node.ONLINE, time.time(), + "", peer.pubkey, qtbma.blockchain.Block.null_value, Node.ONLINE, time.time(), {'root': "", 'leaves': []}, "", "", 0) logging.debug("Node from address : {:}".format(str(node))) return node diff --git a/src/cutecoin/gui/mainwindow.py b/src/cutecoin/gui/mainwindow.py index 1e23292675857dcb8bca66c45b411bea3fc8e262..a978deae290c9d0d3853b3b37cd6a6373b28c10a 100644 --- a/src/cutecoin/gui/mainwindow.py +++ b/src/cutecoin/gui/mainwindow.py @@ -8,7 +8,7 @@ from ..gen_resources.about_uic import Ui_AboutPopup from PyQt5.QtWidgets import QMainWindow, QAction, QFileDialog, QProgressBar, \ QMessageBox, QLabel, QComboBox, QDialog, QApplication -from PyQt5.QtCore import QSignalMapper, QObject, QLocale, QEvent, \ +from PyQt5.QtCore import QSignalMapper, pyqtSlot, QLocale, QEvent, \ pyqtSlot, pyqtSignal, QDate, QDateTime, QTimer, QUrl, Qt, QCoreApplication from PyQt5.QtGui import QIcon, QDesktopServices @@ -20,6 +20,7 @@ from .import_account import ImportAccountDialog from .certification import CertificationDialog from .password_asker import PasswordAskerDialog from .preferences import PreferencesDialog +from .process_cfg_community import ProcessConfigureCommunity from .homescreen import HomeScreenWidget from ..core import money from ..core.community import Community @@ -69,6 +70,7 @@ class MainWindow(QMainWindow, Ui_MainWindow): 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) + self.homescreen.button_add_community.clicked.connect(self.action_open_add_community) 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) @@ -140,6 +142,14 @@ class MainWindow(QMainWindow, Ui_MainWindow): self.community_view.change_account(self.app.current_account) self.refresh() + @pyqtSlot() + def action_open_add_community(self): + dialog = ProcessConfigureCommunity(self.app, + self.app.current_account, None, + self.password_asker) + if dialog.exec_() == QDialog.Accepted: + self.homescreen.refresh() + def open_transfer_money_dialog(self): dialog = TransferMoneyDialog(self.app, self.app.current_account, diff --git a/src/cutecoin/gui/process_cfg_community.py b/src/cutecoin/gui/process_cfg_community.py index 9f37d5eda232bfe842704ceb75f6f24938f4678d..9294cf251007631db793fb7090601f9cc1d03a92 100644 --- a/src/cutecoin/gui/process_cfg_community.py +++ b/src/cutecoin/gui/process_cfg_community.py @@ -14,7 +14,7 @@ from PyQt5.QtCore import pyqtSlot from ..gen_resources.community_cfg_uic import Ui_CommunityConfigurationDialog from ..models.peering import PeeringTreeModel from ..core import Community -from ..core.registry import Identity +from ..core.registry.identity import BlockchainState from ..core.net import Node from . import toast @@ -45,10 +45,10 @@ class StepPageInit(Step): self.node = yield from Node.from_address(self.config_dialog.app.network_manager, None, server, port) if self.node: self.config_dialog.button_next.setEnabled(True) - self.config_dialog.button_check_node.setText("Ok !") + self.config_dialog.button_checknode.setText("Ok !") else: self.config_dialog.button_next.setEnabled(False) - self.config_dialog.button_check_node.setText("Could not connect.") + self.config_dialog.button_checknode.setText("Could not connect.") @pyqtSlot() def check_node(self): @@ -226,7 +226,7 @@ class ProcessConfigureCommunity(QDialog, Ui_CommunityConfigurationDialog): @asyncio.coroutine def final(self): identity = yield from self.app.identities_registry.future_find(self.account.pubkey, self.community) - if identity.status == Identity.NOT_FOUND: + if identity.blockchain_state == BlockchainState.NOT_FOUND: reply = QMessageBox.question(self, self.tr("Pubkey not found"), self.tr("""The public key of your account wasn't found in the community. :\n {0}\n diff --git a/src/cutecoin/gui/transactions_tab.py b/src/cutecoin/gui/transactions_tab.py index 5ef5cf9acadeb754d3d33623bfd9f9f6241eaaef..0009941d9ad4306abce52982021c33cc893c053d 100644 --- a/src/cutecoin/gui/transactions_tab.py +++ b/src/cutecoin/gui/transactions_tab.py @@ -135,13 +135,13 @@ class TransactionsTabWidget(QWidget, Ui_transactionsTabWidget): )) else: - amount = self.account.amount(self.community) + amount = self.app.current_account.amount(self.community) maximum = self.community.monetary_mass # if referential type is quantitative... # display int values - localized_amount = self.account.current_ref(amount, self.community, self.app).localized(units=True) - localized_minimum = self.account.current_ref(0, self.community, self.app).localized(units=True) - localized_maximum = self.account.current_ref(maximum, self.community, self.app).localized(units=True) + localized_amount = self.app.current_account.current_ref(amount, self.community, self.app).localized(units=True) + localized_minimum = self.app.current_account.current_ref(0, self.community, self.app).localized(units=True) + localized_maximum = self.app.current_account.current_ref(maximum, self.community, self.app).localized(units=True) # set infos in label self.label_balance.setText(