Example #1
0
    def __init__(self, parent: QWidget, plugins: Plugins):
        assert parent and plugins
        super().__init__(parent)

        # Make sure that all plugins are loaded so we have all hardware ids
        plugins.get_hardware_support()
        self.device_manager = plugins.device_manager

        self.setWindowTitle(_('Hardware Wallet Support'))

        layout = QVBoxLayout()
        self.setLayout(layout)
        layout.setContentsMargins(20, 20, 20, 20)

        info_label = QLabel()
        info_label.setText(
            _('This tool installs hardware wallet "udev rules" on your system.'
              ) + ' ' +
            _('Correct udev rules are required in order for a hardware wallet to be accessed by DeLight.'
              ) + '\n\n' +
            _('Note: Installing udev rules requires root access via "sudo", so make sure you are in the sudoers file and/or have Administrator rights on this system!'
              ))
        info_label.setWordWrap(True)

        layout.addWidget(info_label)

        hbox = QHBoxLayout()
        hbox.addStretch(2)
        status_title = QLabel()
        status_title.setText(_('udev Rules Status:'))
        status_title.setAlignment(Qt.AlignRight | Qt.AlignVCenter)
        hbox.addWidget(status_title)
        hbox.addStretch(1)
        self.status_label = QLabel()
        self.status_label.setAlignment(Qt.AlignLeft | Qt.AlignVCenter)
        font = self.status_label.font()
        font.setPointSize(15)
        self.status_label.setFont(font)
        hbox.addWidget(self.status_label)
        hbox.addStretch(2)
        layout.addLayout(hbox)

        button_layout = QHBoxLayout()
        layout.addLayout(button_layout)

        close_button = QPushButton(_('&Close'))
        close_button.clicked.connect(self.reject)
        button_layout.addWidget(close_button)
        button_layout.addStretch(1)
        self.uninstall_button = QPushButton()
        self.uninstall_button.setText(_('&Uninstall'))
        self.uninstall_button.clicked.connect(self.uninstallClicked)
        button_layout.addWidget(self.uninstall_button)

        self.install_button = QPushButton()
        self.install_button.setText(_('&Install'))
        self.install_button.clicked.connect(self.installClicked)
        button_layout.addWidget(self.install_button)

        self.install_button.setMinimumWidth(100)
        self.uninstall_button.setMinimumWidth(100)

        self.updateStatus()

        self.resize(400, 300)
Example #2
0
def init_plugins(config, gui_name):
    from electroncash.plugins import Plugins
    return Plugins(config, gui_name)