예제 #1
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)
예제 #2
0
    def __init__(self, node_set: NodeSet):
        super().__init__('Bitcoin Data Directory')
        self.error_message = QErrorMessage(self)

        self.node_set = node_set
        self.datadir = self.node_set.bitcoin.file['datadir']
        self.datadir_label = QLabel()
        self.datadir_label.setText(self.datadir)
        self.datadir_label.setAlignment(Qt.AlignCenter | Qt.AlignCenter)
        self.datadir_label.setFixedHeight(50)

        self.prune_warning_label = QLabel()
        new_font: QFont = self.prune_warning_label.font()
        new_font.setPointSize(8)
        self.prune_warning_label.setFont(new_font)
        self.prune_warning_label.setAlignment(Qt.AlignCenter | Qt.AlignCenter)
        self.display_pruning_warning()

        self.show_directory_button = QtWidgets.QPushButton('Show Directory')
        # noinspection PyUnresolvedReferences
        self.show_directory_button.clicked.connect(
            lambda: reveal(self.datadir))

        self.select_directory_button = QtWidgets.QPushButton(
            'Select Directory')
        # noinspection PyUnresolvedReferences
        self.select_directory_button.clicked.connect(self.file_dialog)

        layout = QtWidgets.QGridLayout()
        layout.addWidget(self.datadir_label, 1, 1, 1, 2)
        layout.addWidget(self.prune_warning_label, 2, 1, 1, 2)
        layout.addWidget(self.show_directory_button, 3, 1)
        layout.addWidget(self.select_directory_button, 3, 2)
        self.setLayout(layout)
        self.setFixedWidth(self.minimumSizeHint().width())
예제 #3
0
    def __init__(self, litecoin: Litecoin):
        super().__init__('Litecoin Data Directory')
        self.file_dialog = SelectDirectoryDialog(self)
        self.litecoin = litecoin

        self.datadir = None

        self.datadir_label = DatadirLabel()
        self.prune_warning_label = PruneWarningLabel()

        self.show_directory_button = QPushButton('Show Directory')
        # noinspection PyUnresolvedReferences
        self.show_directory_button.clicked.connect(
            lambda: reveal(self.datadir))

        self.select_directory_button = QPushButton('Select Directory')
        # noinspection PyUnresolvedReferences
        self.select_directory_button.clicked.connect(self.on_button)

        layout = QGridLayout(self)
        layout.addWidget(self.datadir_label, 1, 1, 1, 2)
        layout.addWidget(self.prune_warning_label, 2, 1, 1, 2)
        layout.addWidget(self.show_directory_button, 3, 1)
        layout.addWidget(self.select_directory_button, 3, 2)
        self.setLayout(layout)
        self.setFixedWidth(self.minimumSizeHint().width())
예제 #4
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)
예제 #5
0
    def __init__(self, node_set: NodeSet):
        super(ActionsLayout, self).__init__()
        self.node_set = node_set
        columns = 2

        self.show_bitcoin_conf = QtWidgets.QPushButton('Show bitcoin.conf')
        bitcoin_conf_dir = os.path.abspath(
            os.path.join(self.node_set.bitcoin.file.path, os.pardir)
        )
        # noinspection PyUnresolvedReferences
        self.show_bitcoin_conf.clicked.connect(
            lambda: reveal(bitcoin_conf_dir)
        )
        self.addWidget(self.show_bitcoin_conf, column=1)

        self.show_lnd_conf = QtWidgets.QPushButton('Show lnd.conf')
        lnd_conf_dir = os.path.abspath(
            os.path.join(self.node_set.lnd.file.path, os.pardir)
        )
        # noinspection PyUnresolvedReferences
        self.show_lnd_conf.clicked.connect(
            lambda: reveal(lnd_conf_dir)
        )
        self.addWidget(self.show_lnd_conf, same_row=True, column=2)
예제 #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)
예제 #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(JouleLayout, self).__init__()
        self.node_set = node_set
        columns = 2

        self.addWidget(SectionName(
            '<a href="https://github.com/wbobeirne/joule-extension/wiki/How-to:-Install-Extension-Manually">Joule Chrome Extension</a>'
        ),
                       column_span=columns)

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

        self.show_macaroons_button = QtWidgets.QPushButton('Show Macaroons')
        # noinspection PyUnresolvedReferences
        self.show_macaroons_button.clicked.connect(
            lambda: reveal(self.node_set.lnd.macaroon_path))
        self.addWidget(self.show_macaroons_button,
                       same_row=True,
                       column=columns)
        self.addWidget(HorizontalLine(), column_span=columns)
예제 #9
0
    def __init__(self, node_set: NodeSet, system_tray):
        super().__init__()
        self.node_set = node_set
        self.system_tray = system_tray

        self.bitcoind_status_action = self.addAction('bitcoind off')
        self.bitcoind_status_action.setEnabled(False)

        # bitcoin console
        self.bitcoin_cli_widget = ConsoleDialog(
            title='bitcoin-cli',
            program=self.node_set.bitcoin.software.bitcoin_cli,
            args=self.node_set.bitcoin.args,
            commands=BITCOIN_CLI_COMMANDS)
        self.bitcoin_console_action = self.addAction('Open Bitcoin Console')
        self.bitcoin_console_action.triggered.connect(
            self.bitcoin_cli_widget.show)

        # bitcoind output
        self.bitcoind_output_widget = BitcoindOutputWidget(
            node_set=self.node_set, system_tray=self.system_tray)
        self.bitcoind_output_action = self.addAction('See Bitcoin Output')
        self.bitcoind_output_action.triggered.connect(
            self.bitcoind_output_widget.show)

        self.addSeparator()

        self.lnd_status_action = self.addAction('lnd off')
        self.lnd_status_action.setEnabled(False)

        # lnd console

        self.lncli_widget = ConsoleDialog(
            title='lncli',
            program=self.node_set.lnd.software.lncli,
            args=self.node_set.lnd.lncli_arguments(),
            commands=LNCLI_COMMANDS)
        self.lnd_console_action = self.addAction('Open LND Console')
        self.lnd_console_action.triggered.connect(self.lncli_widget.show)

        # lnd output
        self.lnd_output_widget = LndOutputWidget(node_set=self.node_set,
                                                 system_tray=self.system_tray)
        self.lnd_output_action = self.addAction('See LND Output')
        self.lnd_output_action.triggered.connect(self.lnd_output_widget.show)

        self.addSeparator()

        # Joule

        self.joule_status_action = self.addAction('Joule Browser Extension')
        self.joule_status_action.setEnabled(False)
        self.joule_url_action = self.addAction('Copy Node URL (REST)')
        self.joule_macaroons_action = self.addAction('Show Macaroons')

        self.joule_url_action.triggered.connect(
            lambda: QClipboard().setText(self.node_set.lnd.rest_url))

        self.joule_macaroons_action.triggered.connect(
            lambda: reveal(self.node_set.lnd.macaroon_path))

        self.addSeparator()

        # settings

        self.settings_action = self.addAction('&Settings')
        self.settings_action.setShortcut(QKeySequence.Preferences)
        self.settings_tab = SettingsTabDialog(node_set=self.node_set)
        self.settings_action.triggered.connect(self.settings_tab.show)

        # advanced

        self.advanced_widget = AdvancedWidget(node_set=self.node_set)
        self.advanced_action = self.addAction('Advanced...')
        self.advanced_action.triggered.connect(self.advanced_widget.show)

        self.addSeparator()

        # quit
        self.quit_action = self.addAction('Quit')

        self.quit_action.triggered.connect(lambda _: QCoreApplication.exit(0))
예제 #10
0
    def __init__(self, node_set: NodeSet, system_tray):
        super().__init__()
        self.node_set = node_set
        self.system_tray = system_tray

        # Bitcoind
        self.bitcoind_status_action = self.addAction('bitcoind off')
        self.bitcoind_status_action.setEnabled(False)

        self.bitcoind_manager_tabs_dialog = BitcoindManagerTabsDialog(
            bitcoin=self.node_set.bitcoin, system_tray=self.system_tray)
        self.bitcoin_manage_action = self.addAction('Manage Bitcoind')
        self.bitcoin_manage_action.triggered.connect(
            self.bitcoind_manager_tabs_dialog.show)

        QTimer.singleShot(500, self.node_set.bitcoin.process.start)
        self.bitcoind_manager_tabs_dialog.output_tab.bitcoind_synced.connect(
            self.node_set.lnd.process.start)

        self.addSeparator()

        # LND
        self.lnd_status_action = self.addAction('lnd off')
        self.lnd_status_action.setEnabled(False)

        self.lnd_manager_tabs_dialog = LndManagerTabsDialog(
            lnd=self.node_set.lnd, system_tray=self.system_tray)
        self.lnd_manage_action = self.addAction('Manage LND')
        self.lnd_manage_action.triggered.connect(
            self.lnd_manager_tabs_dialog.show)

        self.addSeparator()

        # Joule
        self.joule_status_action = self.addAction('Joule Browser UI')
        self.joule_status_action.setEnabled(False)
        self.joule_url_action = self.addAction('Copy Node URL (REST)')
        self.joule_macaroons_action = self.addAction('Show Macaroons')
        self.joule_url_action.triggered.connect(
            lambda: QClipboard().setText(self.node_set.lnd.rest_url))
        self.joule_macaroons_action.triggered.connect(
            lambda: reveal(self.node_set.lnd.macaroon_path))

        self.addSeparator()

        # Zap
        self.zap_status_action = self.addAction('Zap Desktop UI')
        self.zap_status_action.setEnabled(False)
        self.zap_open_action = self.addAction('Open Zap Desktop')
        self.zap_open_action.triggered.connect(
            lambda: webbrowser.open(self.node_set.lnd.lndconnect_url))
        self.zap_qr_code_label = ZapQrcodeLabel(
            self.node_set.lnd.lndconnect_qrcode)
        self.show_zap_qrcode_action = self.addAction('Pair Zap Mobile')
        self.show_zap_qrcode_action.triggered.connect(
            self.zap_qr_code_label.show)

        self.addSeparator()

        # Quit
        self.quit_action = self.addAction('Quit')
        self.quit_action.triggered.connect(lambda _: QCoreApplication.exit(0))
예제 #11
0
 def reveal_macaroon_path(self):
     reveal(self.node_set.lnd_node.configuration.macaroon_path)