def __init__(self): super().__init__() self.parent = QWidget() self.parent.hide() self.parent.setWindowFlags(self.parent.windowFlags() & ~QtCore.Qt.Tool) self.setQuitOnLastWindowClosed(False) self.aboutToQuit.connect(self.quit_app) self.node_set = NodeSet() self.system_tray = SystemTray(self.parent, self.node_set)
def __init__(self, network: Network = MAINNET): super().__init__() self.timer = QTimer(self.parentWidget()) self.node_set = NodeSet(network) columns = 2 layout = QGridLayout() self.nodes_layout = NodesLayout(node_set=self.node_set) layout.addLayout(self.nodes_layout, column_span=columns) self.lnd_wallet_layout = LndWalletLayout(node_set=self.node_set) layout.addLayout(self.lnd_wallet_layout, column_span=columns) self.zap_layout = ZapLayout(node_set=self.node_set) layout.addLayout(self.zap_layout, column_span=columns) self.joule_layout = JouleLayout(node_set=self.node_set) layout.addLayout(self.joule_layout, column_span=columns) self.setLayout(layout) self.timer.start(1000) # noinspection PyUnresolvedReferences self.timer.timeout.connect(self.refresh) self.refresh()
def __init__(self): super().__init__() self.node_set = NodeSet() self.parent = QWidget() self.parent.hide() self.parent.setWindowFlags(self.parent.windowFlags() & ~QtCore.Qt.Tool) self.system_tray = SystemTray(self.parent, self.node_set) self.setQuitOnLastWindowClosed(False) self.aboutToQuit.connect(self.quit_app) self.system_tray.show() self.system_tray.showMessage('Nodes starting...', 'Bitcoin and Lightning are syncing') self.node_set.bitcoin.file.file_watcher.fileChanged.connect( self.check_restart_required) self.node_set.lnd.file.file_watcher.fileChanged.connect( self.check_restart_required) self.timer = QTimer(self) self.timer.start(1000) self.timer.timeout.connect(self.check_restart_required) self.timer.singleShot(1000, self.check_version)
def __init__(self): super().__init__() self.timer = QTimer(self.parentWidget()) self.node_set = NodeSet() columns = 2 layout = QGridLayout() self.nodes_layout = NodesLayout(node_set=self.node_set) layout.addLayout(self.nodes_layout, column_span=columns) self.lnd_wallet_layout = LndWalletLayout(node_set=self.node_set) layout.addLayout(self.lnd_wallet_layout, column_span=columns) self.joule_layout = JouleLayout(node_set=self.node_set) layout.addLayout(self.joule_layout, column_span=columns) self.cli_layout = CliLayout(node_set=self.node_set) layout.addLayout(self.cli_layout, column_span=columns) self.setLayout(layout) self.timer.start(1000) # noinspection PyUnresolvedReferences self.timer.timeout.connect(self.refresh) single_timer = QTimer() single_timer.singleShot(300, self.refresh)
def __init__(self, parent: QWidget, network: str = 'mainnet'): super().__init__() self.timer = QTimer(self.parentWidget()) self.node_set = NodeSet(network) columns = 2 layout = QGridLayout() self.nodes_layout = NodesLayout(node_set=self.node_set) layout.addLayout(self.nodes_layout, column_span=columns) self.lnd_wallet_layout = LndWalletLayout(node_set=self.node_set, parent=parent) layout.addLayout(self.lnd_wallet_layout, column_span=columns) self.zap_layout = ZapLayout(node_set=self.node_set) layout.addLayout(self.zap_layout, column_span=columns) self.joule_layout = JouleLayout(node_set=self.node_set) layout.addLayout(self.joule_layout, column_span=columns) self.cli_layout = CliLayout(node_set=self.node_set) layout.addLayout(self.cli_layout, column_span=columns) self.setLayout(layout) self.threadpool = QThreadPool() self.timer.start(1000) self.timer.timeout.connect(self.refresh) self.refresh()
def __init__(self, parent: QWidget, network: str = 'mainnet'): super().__init__() self.node_set = NodeSet(network) columns = 2 layout = QGridLayout() self.nodes_layout = NodesLayout(node_set=self.node_set) layout.addLayout(self.nodes_layout, column_span=columns) self.lnd_wallet_layout = LndWalletLayout(node_set=self.node_set, parent=parent) layout.addLayout(self.lnd_wallet_layout, column_span=columns) self.zap_layout = ZapLayout(node_set=self.node_set) layout.addLayout(self.zap_layout, column_span=columns) self.joule_layout = JouleLayout(node_set=self.node_set) layout.addLayout(self.joule_layout, column_span=columns) self.cli_layout = CliLayout(node_set=self.node_set) layout.addLayout(self.cli_layout, column_span=columns) self.setLayout(layout)
def get_list(self, page, sort_field, sort_desc, search, filters, page_size=None): node_set = NodeSet(network) try: pending_channels = node_set.lnd_client.list_pending_channels() return len(pending_channels), pending_channels except Exception as e: # todo add error handling # todo add error logging print(e)
def tip(self): if request.method == 'POST': value = int(request.form['value']) memo = request.form['memo'] else: value = 50000 memo = 'Tip' node_set = NodeSet(network) payment_request = node_set.lnd_client.create_invoice( value=value, memo=memo).payment_request uri = ':'.join(['lightning', payment_request]) return render_template('payment_request.html', payment_request=payment_request, uri=uri)
def index(self): # noinspection PyBroadException info_cache_file = os.path.join(cache_path, 'info.json') try: node_set = NodeSet(network) info = MessageToDict(node_set.lnd_client.get_info()) with open(info_cache_file, 'w') as f: json.dump(info, f) except Exception as e: # Todo add logging print(pformat(e)) try: with open(info_cache_file, 'r') as f: info = json.load(f) except FileNotFoundError: info = {} return render_template('index.html', info=info)
def data_directory_box() -> DataDirectoryBox: data_directory_box = DataDirectoryBox(bitcoin_node=NodeSet().bitcoind_node) data_directory_box.file_dialog = MagicMock() return data_directory_box
def node_set(network: str, litecoin: Litecoin, lnd: Lnd) -> NodeSet: configuration = NodeSet() return configuration
def node_set(network: str, bitcoin: Bitcoin, lnd: Lnd) -> NodeSet: configuration = NodeSet(network) return configuration
class Application(QApplication): def __init__(self): super().__init__() self.parent = QWidget() self.parent.hide() self.parent.setWindowFlags(self.parent.windowFlags() & ~QtCore.Qt.Tool) self.setQuitOnLastWindowClosed(False) self.aboutToQuit.connect(self.quit_app) self.node_set = NodeSet() self.system_tray = SystemTray(self.parent, self.node_set) def start(self): threadpool = QThreadPool() worker = Worker(fn=self.check_version) threadpool.start(worker) self.system_tray.show() self.node_set.start() status = self.exec_() return status @staticmethod def check_version(progress_callback): latest_version = LauncherSoftware().get_latest_release_version() if latest_version is None: return latest_major, latest_minor, latest_bugfix = latest_version.split('.') major, minor, bugfix = NODE_LAUNCHER_RELEASE.split('.') major_upgrade = latest_major > major minor_upgrade = (latest_major == major and latest_minor > minor) bugfix_upgrade = (latest_major == major and latest_minor == minor and latest_bugfix > bugfix) if major_upgrade or minor_upgrade or bugfix_upgrade: message_box = QMessageBox() message_box.setTextFormat(Qt.RichText) message_box.setText(UPGRADE) message_box.setInformativeText( f'Your version: {NODE_LAUNCHER_RELEASE}\n' f'New version: {latest_version}') message_box.exec_() @Slot() def quit_app(self): log.debug('quit_app') self.system_tray.show_message(title='Stopping LND...') self.node_set.lnd_node.stop() self.node_set.lnd_node.process.waitForFinished(-1) self.node_set.bitcoind_node.stop() self.system_tray.show_message(title='Stopping bitcoind...') self.node_set.bitcoind_node.process.waitForFinished(-1) self.node_set.tor_node.process.kill() self.node_set.tor_node.process.waitForFinished(-1) self.system_tray.show_message(title='Exiting Node Launcher', timeout=1) QCoreApplication.exit(0)
def index(self): form = PaymentRequestForm() node_set = NodeSet(network) address = node_set.lnd_client.get_new_address() return render_template('tip.html', form=form, address=address)
def data_directory_box() -> DataDirectoryBox: data_directory_box = DataDirectoryBox(litecoin=NodeSet().litecoin) data_directory_box.file_dialog = MagicMock() return data_directory_box