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

Add community and multitiles

parent 35d0a1fb
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
......@@ -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,
......
......@@ -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
......
......@@ -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(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment