def __init__(self, parent, app, connection, identities_service, transactions_service): """ History of all transactions :param PyQt5.QtWidgets.QWidget parent: parent widget :param sakia.app.Application app: the main application :param sakia.data.entities.Connection connection: the connection :param sakia.services.IdentitiesService identities_service: the identities service :param sakia.services.TransactionsService transactions_service: the transactions service """ super().__init__(parent) self.app = app self.connection = connection self.blockchain_processor = BlockchainProcessor.instanciate(app) self.identities_service = identities_service self.transactions_service = transactions_service self.transfers_data = [] self.columns_types = ('date', 'uid', 'amount', 'comment', 'state', 'txid', 'pubkey', 'block_number', 'txhash', 'raw_data') self.column_headers = (lambda: self.tr('Date'), lambda: self.tr('UID/Public key'), lambda: self.tr('Amount'), lambda: self.tr('Comment'))
def __attrs_post_init__(self): super().__init__() self._blockchain_processor = BlockchainProcessor.instanciate(self.app) self._sources_processor = SourcesProcessor.instanciate(self.app) self._connections_processor = ConnectionsProcessor.instanciate( self.app) self._contacts_processor = ContactsProcessor.instanciate(self.app)
def __attrs_post_init__(self): super().__init__() self._connections_processor = ConnectionsProcessor.instanciate( self.app) self._certifications_processor = CertificationsProcessor.instanciate( self.app) self._identities_processor = IdentitiesProcessor.instanciate(self.app) self._blockchain_processor = BlockchainProcessor.instanciate(self.app)
def __init__(self, app, connection): super().__init__() self.app = app self.connection = connection self._connections_processor = ConnectionsProcessor.instanciate( self.app) self._identities_processor = IdentitiesProcessor.instanciate(self.app) self._blockchain_processor = BlockchainProcessor.instanciate(self.app)
async def initialize_blockchain(self, log_stream): """ Download blockchain information locally :param function log_stream: a method to log data in the screen :return: """ blockchain_processor = BlockchainProcessor.instanciate(self.app) await blockchain_processor.initialize_blockchain(self.app.currency)
def instanciate(cls, app): """ Instanciate a blockchain processor :param sakia.app.Application app: the app """ return cls(BmaConnector(NodesProcessor(app.db.nodes_repo), app.parameters), BlockchainProcessor.instanciate(app), IdentitiesProcessor.instanciate(app), CertificationsProcessor.instanciate(app), TransactionsProcessor.instanciate(app), SourcesProcessor.instanciate(app))
def instanciate(cls, app): """ Instanciate a blockchain processor :param sakia.app.Application app: the app """ return cls(BmaConnector(NodesProcessor(app.db.nodes_repo), app.parameters), BlockchainProcessor.instanciate(app), IdentitiesProcessor.instanciate(app), CertificationsProcessor.instanciate(app), TransactionsProcessor.instanciate(app), SourcesProcessor.instanciate(app))
def create(cls, app, navigation): """ Instanciate a navigation component :param sakia.app.Application app: :param sakia.gui.navigation.controller.NavigationController navigation: :return: a new Navigation controller :rtype: NavigationController """ view = ToolbarView(None) model = ToolbarModel(app, navigation.model, app.blockchain_service, BlockchainProcessor.instanciate(app)) toolbar = cls(view, model) return toolbar
def __init__(self, parent, app, identity): """ :param sakia.gui.user_information.controller.UserInformationController parent: :param sakia.core.Application app: the app :param sakia.data.entities.Identity identity: the identity :param sakia.services.IdentitiesService identities_service: the identities service of current currency """ super().__init__(parent) self._certifications_processor = CertificationsProcessor.instanciate(app) self._blockchain_processor = BlockchainProcessor.instanciate(app) self.app = app self.identity = identity self.identities_service = self.app.identities_service
def __init__(self, parent, ts_from, ts_to, blockchain_service): """ History of all transactions :param PyQt5.QtWidgets.QWidget parent: parent widget :param int ts_from: the min timestamp of latest tx :param in ts_to: the max timestamp of most recent tx :param sakia.services.BlockchainService blockchain_service: the blockchain service """ super().__init__(parent) self.app = None self.ts_from = ts_from self.ts_to = ts_to self.blockchain_service = blockchain_service self.blockchain_processor = BlockchainProcessor.instanciate(blockchain_service.app)
def __init__(self, parent, app, identity): """ :param sakia.gui.user_information.controller.UserInformationController parent: :param sakia.core.Application app: the app :param sakia.data.entities.Identity identity: the identity :param sakia.services.IdentitiesService identities_service: the identities service of current currency """ super().__init__(parent) self._certifications_processor = CertificationsProcessor.instanciate( app) self._blockchain_processor = BlockchainProcessor.instanciate(app) self.app = app self.identity = identity self.identities_service = self.app.identities_service
def create(cls, app): """ Instanciate a navigation component :param sakia.app.Application app: :return: a new Navigation controller :rtype: NavigationController """ view = StatusBarView(None) model = StatusBarModel(None, app, BlockchainProcessor.instanciate(app)) status_bar = cls(view, model) app.new_blocks_handled.connect(status_bar.new_blocks_handled) if app.connection_exists(): status_bar.new_blocks_handled() return status_bar
def __init__(self, parent, app, connection, identities_service, transactions_service): """ History of all transactions :param PyQt5.QtWidgets.QWidget parent: parent widget :param sakia.app.Application app: the main application :param sakia.data.entities.Connection connection: the connection :param sakia.services.IdentitiesService identities_service: the identities service :param sakia.services.TransactionsService transactions_service: the transactions service """ super().__init__(parent) self.app = app self.connection = connection self.blockchain_processor = BlockchainProcessor.instanciate(app) self.identities_service = identities_service self.transactions_service = transactions_service self.transfers_data = []
def instanciate_services(self): nodes_processor = NodesProcessor(self.db.nodes_repo) bma_connector = BmaConnector(nodes_processor, self.parameters) connections_processor = ConnectionsProcessor(self.db.connections_repo) identities_processor = IdentitiesProcessor(self.db.identities_repo, self.db.certifications_repo, self.db.blockchains_repo, bma_connector) certs_processor = CertificationsProcessor(self.db.certifications_repo, self.db.identities_repo, bma_connector) blockchain_processor = BlockchainProcessor.instanciate(self) sources_processor = SourcesProcessor.instanciate(self) transactions_processor = TransactionsProcessor.instanciate(self) dividends_processor = DividendsProcessor.instanciate(self) nodes_processor.initialize_root_nodes(self.currency) self.db.commit() self.documents_service = DocumentsService.instanciate(self) self.identities_service = IdentitiesService( self.currency, connections_processor, identities_processor, certs_processor, blockchain_processor, bma_connector) self.transactions_service = TransactionsService( self.currency, transactions_processor, dividends_processor, identities_processor, connections_processor, bma_connector) self.sources_service = SourcesServices( self.currency, sources_processor, connections_processor, transactions_processor, blockchain_processor, bma_connector) self.blockchain_service = BlockchainService(self, self.currency, blockchain_processor, bma_connector, self.identities_service, self.transactions_service, self.sources_service) self.network_service = NetworkService.load(self, self.currency, nodes_processor, self.blockchain_service, self.identities_service)
def __init__(self, parent, app, connection, blockchain_service, identities_service, sources_service): """ Constructor of an component :param sakia.gui.informations.controller.InformationsController parent: the controller :param sakia.app.Application app: the app :param sakia.data.entities.Connection connection: the user connection of this node :param sakia.services.BlockchainService blockchain_service: the service watching the blockchain state :param sakia.services.IdentitiesService identities_service: the service watching the identities state :param sakia.services.SourcesService sources_service: the service watching the sources states """ super().__init__(parent) self.app = app self.connection = connection self.blockchain_processor = BlockchainProcessor.instanciate(app) self.blockchain_service = blockchain_service self.identities_service = identities_service self.sources_service = sources_service self._logger = logging.getLogger('sakia')
def __init__(self, parent, app, connection, blockchain_service, identities_service, sources_service): """ Constructor of an component :param sakia.gui.identity.controller.IdentityController parent: the controller :param sakia.app.Application app: the app :param sakia.data.entities.Connection connection: the user connection of this node :param sakia.services.BlockchainService blockchain_service: the service watching the blockchain state :param sakia.services.IdentitiesService identities_service: the service watching the identities state :param sakia.services.SourcesService sources_service: the service watching the sources states """ super().__init__(parent) self.app = app self.connection = connection self.blockchain_processor = BlockchainProcessor.instanciate(app) self.blockchain_service = blockchain_service self.identities_service = identities_service self.sources_service = sources_service self.table_model = None self.proxy_model = None self._logger = logging.getLogger('sakia')
def __init__(self, parent, app, connection, ts_from, ts_to, identities_service, transactions_service): """ History of all transactions :param PyQt5.QtWidgets.QWidget parent: parent widget :param sakia.app.Application app: the main application :param sakia.data.entities.Connection connection: the connection :param sakia.services.IdentitiesService identities_service: the identities service :param sakia.services.TransactionsService transactions_service: the transactions service """ super().__init__(parent) self.app = app self.connection = connection self.blockchain_processor = BlockchainProcessor.instanciate(app) self.identities_service = identities_service self.sql_adapter = TxHistorySqlAdapter(self.app.db.conn) self.transactions_repo = TransactionsRepo(self.app.db.conn) self.dividends_repo = DividendsRepo(self.app.db.conn) self.current_page = 0 self.ts_from = ts_from self.ts_to = ts_to self.main_column_id = HistoryTableModel.columns_types[0] self.order = Qt.AscendingOrder self.transfers_data = []
def instanciate_services(self): nodes_processor = NodesProcessor(self.db.nodes_repo) bma_connector = BmaConnector(nodes_processor, self.parameters) connections_processor = ConnectionsProcessor(self.db.connections_repo) identities_processor = IdentitiesProcessor(self.db.identities_repo, self.db.certifications_repo, self.db.blockchains_repo, bma_connector) certs_processor = CertificationsProcessor(self.db.certifications_repo, self.db.identities_repo, bma_connector) blockchain_processor = BlockchainProcessor.instanciate(self) sources_processor = SourcesProcessor.instanciate(self) transactions_processor = TransactionsProcessor.instanciate(self) dividends_processor = DividendsProcessor.instanciate(self) nodes_processor.initialize_root_nodes(self.currency) self.db.commit() self.documents_service = DocumentsService.instanciate(self) self.identities_service = IdentitiesService(self.currency, connections_processor, identities_processor, certs_processor, blockchain_processor, bma_connector) self.transactions_service = TransactionsService(self.currency, transactions_processor, dividends_processor, identities_processor, connections_processor, bma_connector) self.sources_service = SourcesServices(self.currency, sources_processor, connections_processor, transactions_processor, blockchain_processor, bma_connector) self.blockchain_service = BlockchainService(self, self.currency, blockchain_processor, connections_processor, bma_connector, self.identities_service, self.transactions_service, self.sources_service) self.network_service = NetworkService.load(self, self.currency, nodes_processor, self.blockchain_service, self.identities_service)
def __init__(self, parent, app, connection, ts_from, ts_to, identities_service, transactions_service): """ History of all transactions :param PyQt5.QtWidgets.QWidget parent: parent widget :param sakia.app.Application app: the main application :param sakia.data.entities.Connection connection: the connection :param sakia.services.IdentitiesService identities_service: the identities service :param sakia.services.TransactionsService transactions_service: the transactions service """ super().__init__(parent) self.app = app self.connection = connection self.blockchain_processor = BlockchainProcessor.instanciate(app) self.identities_service = identities_service self.sql_adapter = TxHistorySqlAdapter(self.app.db.conn) self.transactions_repo = TransactionsRepo(self.app.db.conn) self.dividends_repo = DividendsRepo(self.app.db.conn) self.current_page = 0 self.ts_from = ts_from self.ts_to = ts_to self.main_column_id = HistoryTableModel.columns_types[0] self.order = Qt.AscendingOrder self.transfers_data = []
async def copy_block_to_clipboard(self, number): clipboard = QApplication.clipboard() blockchain_processor = BlockchainProcessor.instanciate(self._app) block_doc = await blockchain_processor.get_block(self._connection.currency, number) clipboard.setText(block_doc.signed_raw())
def __attrs_post_init__(self): super().__init__() self._blockchain_processor = BlockchainProcessor.instanciate(self.app) self._sources_processor = SourcesProcessor.instanciate(self.app) self._connections_processor = ConnectionsProcessor.instanciate(self.app) self._contacts_processor = ContactsProcessor.instanciate(self.app)
def blockchain_parameters(self): blockchain_processor = BlockchainProcessor.instanciate(self.app) return blockchain_processor.parameters(self.app.currency)
def __attrs_post_init__(self): super().__init__() self._connections_processor = ConnectionsProcessor.instanciate(self.app) self._certifications_processor = CertificationsProcessor.instanciate(self.app) self._identities_processor = IdentitiesProcessor.instanciate(self.app) self._blockchain_processor = BlockchainProcessor.instanciate(self.app)
async def copy_block_to_clipboard(self, number): clipboard = QApplication.clipboard() blockchain_processor = BlockchainProcessor.instanciate(self._app) block_doc = await blockchain_processor.get_block( self._connection.currency, number) clipboard.setText(block_doc.signed_raw())
def __init__(self, app, parent=None): super().__init__(parent) self.app = app self.blockchain_processor = BlockchainProcessor.instanciate(app)
def __init__(self, app, parent=None): super().__init__(parent) self.app = app self.blockchain_processor = BlockchainProcessor.instanciate(app)