示例#1
0
    def __init__(self, node_set: NodeSet):
        super().__init__()
        self.setWindowTitle('Advanced')
        self.node_set = node_set

        self.columns = 2

        self.layout = QGridLayout()

        self.versions_layout = VersionsLayout(node_set=node_set)
        self.ports_layout = PortsLayout(node_set=node_set)
        self.actions_layout = ConfigurationFilesLayout(node_set=node_set)
        self.zap_layout = ZapLayout(node_set=self.node_set)
        self.tls_layout = TlsLayout(node_set=self.node_set)

        self.layout.addLayout(self.versions_layout, column_span=self.columns)
        self.layout.addWidget(HorizontalLine(), column_span=self.columns)
        self.layout.addLayout(self.ports_layout, column_span=self.columns)
        self.layout.addWidget(HorizontalLine(), column_span=self.columns)
        self.layout.addLayout(self.actions_layout, column_span=self.columns)
        self.layout.addWidget(HorizontalLine(), column_span=self.columns)
        self.layout.addLayout(self.zap_layout, column_span=self.columns)
        self.layout.addWidget(HorizontalLine(), column_span=self.columns)
        self.layout.addLayout(self.tls_layout, column_span=self.columns)

        self.setLayout(self.layout)
示例#2
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)
示例#3
0
    def __init__(self, lnd_node: LndNode):
        super().__init__()
        self.lnd_node = lnd_node
        self.layout = QGridLayout()

        self.lnd_version = SelectableText(
            f'LND '
            f'version {self.lnd_node.software.release_version}')
        self.layout.addWidget(self.lnd_version)

        self.alias_layout = AliasLayout()
        self.alias_layout.new_color.connect(
            lambda x: self.set_conf_value('color', x))
        self.alias_layout.alias_editor.textEdited.connect(
            lambda x: self.set_conf_value('alias', x))
        self.layout.addLayout(self.alias_layout)

        self.layout.addWidget(HorizontalLine())

        self.restart_layout = LndRestartLayout(lnd=self.lnd_node)
        self.layout.addLayout(self.restart_layout)

        self.tls_layout = TlsLayout(lnd=self.lnd_node)
        self.layout.addLayout(self.tls_layout)

        self.show_lnd_conf = QPushButton('Show lnd.conf')
        self.show_lnd_conf.clicked.connect(
            lambda: reveal(self.lnd_node.file.directory))
        self.layout.addWidget(self.show_lnd_conf)

        self.setLayout(self.layout)
示例#4
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)
示例#5
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)
示例#6
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)
        self.addWidget(HorizontalLine(), column_span=columns)
示例#7
0
    def __init__(self, bitcoin: Bitcoin):
        super().__init__()

        self.bitcoin = bitcoin

        self.layout = QGridLayout()

        self.bitcoin_version = SelectableText(
            f'Bitcoin Core '
            f'version {self.bitcoin.software.release_version}')
        self.layout.addWidget(self.bitcoin_version)

        self.data_directory_group_box = DataDirectoryBox(bitcoin=self.bitcoin)
        self.data_directory_group_box.file_dialog.new_data_directory.connect(
            self.change_datadir)
        self.layout.addWidget(self.data_directory_group_box)
        self.layout.setAlignment(self.data_directory_group_box,
                                 Qt.AlignHCenter)

        self.enable_wallet_label = QLabel('Enable wallet')
        self.enable_wallet_widget = QCheckBox('Enable Wallet')
        self.enable_wallet_widget.setChecked(
            not self.bitcoin.file['disablewallet'])
        self.enable_wallet_widget.stateChanged.connect(
            lambda x: self.set_conf_value('disablewallet', not bool(x)))
        self.layout.addWidget(self.enable_wallet_widget)

        self.layout.addWidget(HorizontalLine())

        self.ports_layout = BitcoindPortsLayout(bitcoin=self.bitcoin)
        self.layout.addLayout(self.ports_layout)

        self.restart_layout = BitcoindRestartLayout(bitcoin=self.bitcoin)
        self.layout.addLayout(self.restart_layout)

        self.show_bitcoin_conf = QPushButton('Show bitcoin.conf')
        self.show_bitcoin_conf.clicked.connect(
            lambda: reveal(self.bitcoin.file.directory))
        self.layout.addWidget(self.show_bitcoin_conf)

        self.setLayout(self.layout)
示例#8
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)
示例#9
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)