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): ...@@ -94,7 +94,7 @@ class Node(QObject):
node = cls(network_manager, peer.currency, node = cls(network_manager, peer.currency,
[Endpoint.from_inline(e.inline()) for e in peer.endpoints], [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) {'root': "", 'leaves': []}, "", "", 0)
logging.debug("Node from address : {:}".format(str(node))) logging.debug("Node from address : {:}".format(str(node)))
return node return node
......
...@@ -8,7 +8,7 @@ from ..gen_resources.about_uic import Ui_AboutPopup ...@@ -8,7 +8,7 @@ from ..gen_resources.about_uic import Ui_AboutPopup
from PyQt5.QtWidgets import QMainWindow, QAction, QFileDialog, QProgressBar, \ from PyQt5.QtWidgets import QMainWindow, QAction, QFileDialog, QProgressBar, \
QMessageBox, QLabel, QComboBox, QDialog, QApplication 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 pyqtSlot, pyqtSignal, QDate, QDateTime, QTimer, QUrl, Qt, QCoreApplication
from PyQt5.QtGui import QIcon, QDesktopServices from PyQt5.QtGui import QIcon, QDesktopServices
...@@ -20,6 +20,7 @@ from .import_account import ImportAccountDialog ...@@ -20,6 +20,7 @@ from .import_account import ImportAccountDialog
from .certification import CertificationDialog from .certification import CertificationDialog
from .password_asker import PasswordAskerDialog from .password_asker import PasswordAskerDialog
from .preferences import PreferencesDialog from .preferences import PreferencesDialog
from .process_cfg_community import ProcessConfigureCommunity
from .homescreen import HomeScreenWidget from .homescreen import HomeScreenWidget
from ..core import money from ..core import money
from ..core.community import Community from ..core.community import Community
...@@ -69,6 +70,7 @@ class MainWindow(QMainWindow, Ui_MainWindow): ...@@ -69,6 +70,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
self.homescreen.frame_communities.community_tile_clicked.connect(self.change_community) 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_add_account)
self.homescreen.toolbutton_new_account.addAction(self.action_import) 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.homescreen.button_disconnect.clicked.connect(lambda :self.action_change_account(""))
self.centralWidget().layout().addWidget(self.homescreen) self.centralWidget().layout().addWidget(self.homescreen)
self.homescreen.toolbutton_connect.setMenu(self.menu_change_account) self.homescreen.toolbutton_connect.setMenu(self.menu_change_account)
...@@ -140,6 +142,14 @@ class MainWindow(QMainWindow, Ui_MainWindow): ...@@ -140,6 +142,14 @@ class MainWindow(QMainWindow, Ui_MainWindow):
self.community_view.change_account(self.app.current_account) self.community_view.change_account(self.app.current_account)
self.refresh() 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): def open_transfer_money_dialog(self):
dialog = TransferMoneyDialog(self.app, dialog = TransferMoneyDialog(self.app,
self.app.current_account, self.app.current_account,
......
...@@ -14,7 +14,7 @@ from PyQt5.QtCore import pyqtSlot ...@@ -14,7 +14,7 @@ from PyQt5.QtCore import pyqtSlot
from ..gen_resources.community_cfg_uic import Ui_CommunityConfigurationDialog from ..gen_resources.community_cfg_uic import Ui_CommunityConfigurationDialog
from ..models.peering import PeeringTreeModel from ..models.peering import PeeringTreeModel
from ..core import Community from ..core import Community
from ..core.registry import Identity from ..core.registry.identity import BlockchainState
from ..core.net import Node from ..core.net import Node
from . import toast from . import toast
...@@ -45,10 +45,10 @@ class StepPageInit(Step): ...@@ -45,10 +45,10 @@ class StepPageInit(Step):
self.node = yield from Node.from_address(self.config_dialog.app.network_manager, None, server, port) self.node = yield from Node.from_address(self.config_dialog.app.network_manager, None, server, port)
if self.node: if self.node:
self.config_dialog.button_next.setEnabled(True) self.config_dialog.button_next.setEnabled(True)
self.config_dialog.button_check_node.setText("Ok !") self.config_dialog.button_checknode.setText("Ok !")
else: else:
self.config_dialog.button_next.setEnabled(False) 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() @pyqtSlot()
def check_node(self): def check_node(self):
...@@ -226,7 +226,7 @@ class ProcessConfigureCommunity(QDialog, Ui_CommunityConfigurationDialog): ...@@ -226,7 +226,7 @@ class ProcessConfigureCommunity(QDialog, Ui_CommunityConfigurationDialog):
@asyncio.coroutine @asyncio.coroutine
def final(self): def final(self):
identity = yield from self.app.identities_registry.future_find(self.account.pubkey, self.community) 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"), reply = QMessageBox.question(self, self.tr("Pubkey not found"),
self.tr("""The public key of your account wasn't found in the community. :\n self.tr("""The public key of your account wasn't found in the community. :\n
{0}\n {0}\n
......
...@@ -135,13 +135,13 @@ class TransactionsTabWidget(QWidget, Ui_transactionsTabWidget): ...@@ -135,13 +135,13 @@ class TransactionsTabWidget(QWidget, Ui_transactionsTabWidget):
)) ))
else: else:
amount = self.account.amount(self.community) amount = self.app.current_account.amount(self.community)
maximum = self.community.monetary_mass maximum = self.community.monetary_mass
# if referential type is quantitative... # if referential type is quantitative...
# display int values # display int values
localized_amount = self.account.current_ref(amount, 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.account.current_ref(0, 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.account.current_ref(maximum, 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 # set infos in label
self.label_balance.setText( 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