コード例 #1
0
class BitcoindRestartLayout(QGridLayout):
    bitcoin: Bitcoin
    timer = QTimer

    def __init__(self, bitcoin: Bitcoin):
        super(BitcoindRestartLayout, self).__init__()

        self.timer = QTimer(self.parentWidget())

        self.bitcoin = bitcoin
        columns = 2

        self.section_name = SectionName('Restart Required')
        self.addWidget(self.section_name, column_span=columns)
        self.bitcoin_restart_required = WarningText('Bitcoin: ')
        self.addWidget(self.bitcoin_restart_required)
        self.bitcoin_restart_required.hide()
        self.bitcoin.file.file_watcher.fileChanged.connect(
            self.check_restart_required)
        self.timer.start(1000)
        self.timer.timeout.connect(self.check_restart_required)

    def check_restart_required(self):
        restart_required = self.bitcoin.restart_required
        self.bitcoin_restart_required.setText(
            f'Bitcoin: {self.bitcoin.restart_required}')
        if restart_required:
            self.section_name.show()
            self.bitcoin_restart_required.show()
        else:
            self.section_name.hide()
            self.bitcoin_restart_required.hide()
コード例 #2
0
class LndRestartLayout(QGridLayout):
    node_set: NodeSet
    timer = QTimer

    def __init__(self, lnd: LndNode):
        super(LndRestartLayout, self).__init__()

        self.timer = QTimer(self.parentWidget())

        self.lnd = lnd
        columns = 2

        self.section_name = SectionName('Restart Required')
        self.addWidget(self.section_name, column_span=columns)
        self.lnd_restart_required = WarningText('Lnd: ')
        self.addWidget(self.lnd_restart_required, same_row=True, column=columns)
        self.lnd_restart_required.hide()
        # self.lnd.file.file_watcher.fileChanged.connect(self.check_restart_required)
        self.timer.start(1000)
        # self.timer.timeout.connect(self.check_restart_required)

    def check_restart_required(self):
        restart_required = self.lnd.restart_required

        self.lnd_restart_required.setText(f'Lnd: {self.lnd.restart_required}')
        if restart_required:
            self.section_name.show()
            self.lnd_restart_required.show()
        else:
            self.section_name.hide()
            self.lnd_restart_required.hide()
コード例 #3
0
    def __init__(self, bitcoin: BitcoindNode):
        super(BitcoindRestartLayout, self).__init__()

        self.timer = QTimer(self.parentWidget())

        self.bitcoin = bitcoin
        columns = 2

        self.section_name = SectionName('Restart Required')
        self.addWidget(self.section_name, column_span=columns)
        self.bitcoin_restart_required = WarningText('Bitcoin: ')
        self.addWidget(self.bitcoin_restart_required)
        self.bitcoin_restart_required.hide()
        # self.bitcoin.file.file_watcher.fileChanged.connect(self.check_restart_required)
        self.timer.start(1000)
コード例 #4
0
    def __init__(self, lnd: LndNode):
        super(LndRestartLayout, self).__init__()

        self.timer = QTimer(self.parentWidget())

        self.lnd = lnd
        columns = 2

        self.section_name = SectionName('Restart Required')
        self.addWidget(self.section_name, column_span=columns)
        self.lnd_restart_required = WarningText('Lnd: ')
        self.addWidget(self.lnd_restart_required, same_row=True, column=columns)
        self.lnd_restart_required.hide()
        # self.lnd.file.file_watcher.fileChanged.connect(self.check_restart_required)
        self.timer.start(1000)
コード例 #5
0
    def __init__(self, node_set: NodeSet):
        super(LndWalletLayout, self).__init__()
        self.node_set = node_set
        self.password_dialog = QInputDialog()
        self.error_message = QErrorMessage()

        self.state = None

        self.threadpool = QThreadPool()

        columns = 2
        self.addWidget(SectionName('LND Wallet'), column_span=columns)
        wallet_buttons_layout = QtWidgets.QHBoxLayout()
        # Unlock wallet button
        self.unlock_wallet_button = QtWidgets.QPushButton('Unlock')
        # noinspection PyUnresolvedReferences
        self.unlock_wallet_button.clicked.connect(self.unlock_wallet)
        wallet_buttons_layout.addWidget(self.unlock_wallet_button)

        # Create wallet button
        self.create_wallet_button = QtWidgets.QPushButton('Create')
        # noinspection PyUnresolvedReferences
        self.create_wallet_button.clicked.connect(self.create_wallet)
        wallet_buttons_layout.addWidget(self.create_wallet_button,
                                        same_row=True,
                                        column=2)

        # Recover wallet button
        self.recover_wallet_button = QtWidgets.QPushButton('Recover')
        # noinspection PyUnresolvedReferences
        self.recover_wallet_button.clicked.connect(self.recover_wallet)
        wallet_buttons_layout.addWidget(self.recover_wallet_button)
        self.addLayout(wallet_buttons_layout, column_span=columns)

        self.addWidget(HorizontalLine(), column_span=columns)
コード例 #6
0
    def __init__(self, node_set: NodeSet):
        super(CliLayout, self).__init__()
        self.node_set = node_set

        self.lncli_widget = CliWidget(title='lncli',
                                      program=self.node_set.lnd.software.lncli,
                                      args=self.node_set.lnd.lncli_arguments(),
                                      commands=LNCLI_COMMANDS)

        self.bitcoin_cli_widget = CliWidget(
            title='bitcoin-cli',
            program=self.node_set.bitcoin.software.bitcoin_cli,
            args=self.node_set.bitcoin.bitcoin_cli_arguments(),
            commands=BITCOIN_CLI_COMMANDS)

        self.open_bitcoin_cli_button = QPushButton('bitcoin-cli')
        self.open_bitcoin_cli_button.clicked.connect(
            self.bitcoin_cli_widget.show)
        self.open_lncli_button = QPushButton('lncli')
        self.open_lncli_button.clicked.connect(self.lncli_widget.show)

        columns = 2
        self.section_name = SectionName('Command Line')
        self.addWidget(self.section_name, column_span=columns)
        self.addWidget(self.open_bitcoin_cli_button)
        self.addWidget(self.open_lncli_button, same_row=True, column=columns)
コード例 #7
0
    def __init__(self, node_set: NodeSet):
        super(NodesLayout, self).__init__()
        self.node_set = node_set
        self.advanced_widget = AdvancedWidget(node_set)

        self.columns = 2
        image_label = ImageLabel(f'bitcoin-{self.node_set.network}.png')
        self.addWidget(image_label, row_span=5)

        self.addWidget(SectionName('Nodes'), column=self.columns)
        # Bitcoin-Qt button
        self.bitcoin_qt_button = QPushButton('Launch Bitcoin')
        # noinspection PyUnresolvedReferences
        self.bitcoin_qt_button.clicked.connect(self.node_set.bitcoin.launch)
        self.addWidget(self.bitcoin_qt_button, column=self.columns)

        # LND button
        self.lnd_button = QPushButton('Launch LND')
        # noinspection PyUnresolvedReferences
        self.lnd_button.clicked.connect(self.node_set.lnd.launch)
        self.addWidget(self.lnd_button, column=self.columns)

        # Advanced button
        self.advanced_button = QPushButton('Advanced...')
        # noinspection PyUnresolvedReferences
        self.advanced_button.clicked.connect(self.advanced_widget.show)
        self.addWidget(self.advanced_button, column=self.columns)

        self.addWidget(HorizontalLine(), column=self.columns)
コード例 #8
0
    def __init__(self, node_set: NodeSet):
        super(PortsLayout, self).__init__()
        self.node_set = node_set

        self.network_ports = SectionName(
            f'Network Ports (for <a '
            f'href="https://www.wikihow.com/Set-Up-Port-Forwarding-on-a-Router"'
            f'>port forwarding</a>)')

        self.bitcoin_network_port = SelectableText(
            f'Bitcoin network peer port: {self.node_set.bitcoin.node_port}')

        self.lnd_network_port = SelectableText(
            f'LND network peer port: {self.node_set.lnd.node_port}')

        self.addWidget(self.network_ports)
        self.addWidget(self.bitcoin_network_port)
        self.addWidget(self.lnd_network_port)

        self.addWidget(HorizontalLine())

        self.client_ports = SelectableText(
            f'Client Ports (you can lose money port forwarding these!)')
        self.addWidget(self.client_ports)

        self.zmq_ports = SelectableText(
            f'Bitcoin ZMQ block/tx ports:'
            f' {self.node_set.bitcoin.zmq_block_port}'
            f'/{self.node_set.bitcoin.zmq_tx_port}')
        self.addWidget(self.zmq_ports)

        self.rpc_port = SelectableText(
            f'Bitcoin RPC port: {self.node_set.bitcoin.rpc_port}')
        self.addWidget(self.rpc_port)

        self.grpc_port = SelectableText(
            f'LND gRPC port: {self.node_set.lnd.grpc_port}')
        self.addWidget(self.grpc_port)

        self.rest_port = SelectableText(
            f'LND REST port: {self.node_set.lnd.rest_port}')
        self.addWidget(self.rest_port)
        self.bitcoin_restart_required = WarningText(
            'Config file changed: Restart Bitcoin')
        self.addWidget(self.bitcoin_restart_required)
        self.bitcoin_restart_required.hide()
        self.lnd_restart_required = WarningText(
            'Config file changed: Restart LND')
        self.addWidget(self.lnd_restart_required)
        self.lnd_restart_required.hide()

        self.node_set.bitcoin.file.file_watcher.fileChanged.connect(
            self.refresh_bitcoin_ports)
        self.node_set.lnd.file.file_watcher.fileChanged.connect(
            self.refresh_lnd_ports)
コード例 #9
0
    def __init__(self, node_set: NodeSet):
        super(RestartLayout, self).__init__()

        self.timer = QTimer(self.parentWidget())

        self.node_set = node_set
        columns = 2

        self.section_name = SectionName('Restart Required')
        self.addWidget(self.section_name, column_span=columns)
        self.bitcoin_restart_required = WarningText('Bitcoin: ')
        self.lnd_restart_required = WarningText('Lnd: ')
        self.addWidget(self.bitcoin_restart_required)
        self.addWidget(self.lnd_restart_required, same_row=True, column=columns)
        self.bitcoin_restart_required.hide()
        self.lnd_restart_required.hide()
        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.start(1000)
        self.timer.timeout.connect(self.check_restart_required)
コード例 #10
0
    def __init__(self, node_set: NodeSet):
        super(TlsLayout, self).__init__()
        self.node_set = node_set

        columns = 2
        self.section_name = SectionName('LND TLS Debugging')
        self.addWidget(self.section_name, column_span=columns)

        self.reset_tls = QPushButton('Reset TLS')
        # noinspection PyUnresolvedReferences
        self.reset_tls.clicked.connect(self.node_set.reset_tls)
        self.addWidget(self.reset_tls)
コード例 #11
0
 def __init__(self, node_set: NodeSet):
     super(CliLayout, self).__init__()
     self.node_set = node_set
     self.copy_bitcoin_cli = CopyButton(
         button_text='bitcoin-cli',
         copy_text=self.node_set.bitcoin.bitcoin_cli
     )
     self.copy_lncli = CopyButton(
         button_text='lncli',
         copy_text=self.node_set.lnd.lncli
     )
     columns = 2
     self.section_name = SectionName('Command Line')
     self.addWidget(self.section_name, column_span=columns)
     self.addLayout(self.copy_bitcoin_cli)
     self.addLayout(self.copy_lncli, same_row=True, column=columns)
コード例 #12
0
    def __init__(self, lnd: Lnd):
        super(TlsLayout, self).__init__()
        self.lnd = lnd

        columns = 2
        self.section_name = SectionName('LND TLS Debugging')
        self.addWidget(self.section_name, column_span=columns)

        self.test_tls = QPushButton('Test TLS')
        # noinspection PyUnresolvedReferences
        self.test_tls.clicked.connect(self.test_tls_cert)
        self.addWidget(self.test_tls)

        self.reset_tls = QPushButton('Reset TLS')
        # noinspection PyUnresolvedReferences
        self.reset_tls.clicked.connect(self.lnd.reset_tls)
        self.addWidget(self.reset_tls, same_row=True, column=2)
コード例 #13
0
    def __init__(self, node_set: NodeSet):
        super(JouleLayout, self).__init__()
        self.node_set = node_set
        columns = 2

        section_name = SectionName(
            '<a href="https://lightningjoule.com/">Joule Chrome Extension</a>')
        self.addWidget(section_name, column_span=columns)

        self.copy_rest = CopyButton('Node URL (REST)',
                                    self.node_set.lnd.rest_url)
        self.addLayout(self.copy_rest)

        self.show_macaroons = QtWidgets.QPushButton('Show Macaroons')
        # noinspection PyUnresolvedReferences
        self.show_macaroons.clicked.connect(
            lambda: reveal(self.node_set.lnd.macaroon_path))
        self.addWidget(self.show_macaroons, same_row=True, column=columns)
コード例 #14
0
    def __init__(self, node_set: NodeSet):
        super(ConfigurationFilesLayout, self).__init__()
        self.node_set = node_set

        self.columns = 2

        self.section_name = SectionName('Configuration Files')
        self.addWidget(self.section_name, column_span=self.columns)
        self.show_bitcoin_conf = QtWidgets.QPushButton('Show bitcoin.conf')
        # noinspection PyUnresolvedReferences
        self.show_bitcoin_conf.clicked.connect(
            lambda: reveal(self.node_set.bitcoin.file.directory))
        self.addWidget(self.show_bitcoin_conf)

        self.show_lnd_conf = QtWidgets.QPushButton('Show lnd.conf')
        # noinspection PyUnresolvedReferences
        self.show_lnd_conf.clicked.connect(
            lambda: reveal(self.node_set.lnd.file.directory))
        self.addWidget(self.show_lnd_conf, same_row=True, column=self.columns)
コード例 #15
0
    def __init__(self, node_set: NodeSet):
        super(ZapLayout, self).__init__()
        self.qrcode_label = None
        self.node_set = node_set
        columns = 2

        self.section_name = SectionName(
            '<a href="https://medium.com/lightning-power-users/easy-lightning-with-node-launcher-zap-488133edfbd">Zap Desktop Wallet</a>'
        )

        self.open_zap_desktop_button = QtWidgets.QPushButton(
            'Open Zap Desktop')
        self.open_zap_desktop_button.clicked.connect(self.open_zap_desktop)

        self.show_zap_qrcode_button = QtWidgets.QPushButton('Show QR Code')
        self.show_zap_qrcode_button.clicked.connect(self.show_zap_qrcode)

        self.addWidget(self.section_name, column_span=columns)
        self.addWidget(self.open_zap_desktop_button)
        self.addWidget(self.show_zap_qrcode_button, same_row=True, column=2)
        self.addWidget(HorizontalLine(), column_span=columns)
コード例 #16
0
    def __init__(self, lnd: Lnd):
        super(LndPortsLayout, self).__init__()
        self.lnd = lnd

        self.network_ports = SectionName(
            f'Network Ports (for <a '
            f'href="https://www.wikihow.com/Set-Up-Port-Forwarding-on-a-Router"'
            f'>port forwarding</a>)'
        )
        self.addWidget(self.network_ports)

        self.lnd_network_port = SelectableText(
            f'LND network peer port: {self.lnd.node_port}'
        )
        self.addWidget(self.lnd_network_port)

        self.addWidget(HorizontalLine())

        self.client_ports = SelectableText(
            f'Client Ports (you can lose money port forwarding these!)'
        )
        self.addWidget(self.client_ports)

        self.grpc_port = SelectableText(
            f'LND gRPC port: {self.lnd.grpc_port}'
        )
        self.addWidget(self.grpc_port)

        self.rest_port = SelectableText(
            f'LND REST port: {self.lnd.rest_port}'
        )
        self.addWidget(self.rest_port)

        self.lnd_restart_required = WarningText(
            'Config file changed: Restart LND'
        )
        self.addWidget(self.lnd_restart_required)
        self.lnd_restart_required.hide()

        self.lnd.file.file_watcher.fileChanged.connect(self.refresh_lnd_ports)