def __init__(self, data, parent=None, title="", show_text=False): WindowModalDialog.__init__(self, parent, title) vbox = QVBoxLayout() qrw = QRCodeWidget(data) vbox.addWidget(qrw, 1) if show_text: text = QTextEdit() text.setText(data) text.setReadOnly(True) vbox.addWidget(text) hbox = QHBoxLayout() hbox.addStretch(1) # Qt & Python GC hygiene: don't hold references to self in non-method slots as it appears Qt+Python GC don't like this too much and may leak memory in that case. weakSelf = util.Weak.ref(self) weakQ = util.Weak.ref(qrw) b = QPushButton(_("&Copy")) hbox.addWidget(b) weakBut = util.Weak.ref(b) b.clicked.connect(lambda: copy_to_clipboard(weakQ(), weakBut())) b = QPushButton(_("&Save")) hbox.addWidget(b) b.clicked.connect(lambda: save_to_file(weakQ(), weakSelf())) b = CloseButton(self) hbox.addWidget(b) vbox.addLayout(hbox) self.setLayout(vbox)
def __init__(self, parent, wallet): WindowModalDialog.__init__(self, parent) is_encrypted = wallet.has_storage_encryption() OK_button = OkButton(self) self.create_password_layout(wallet, is_encrypted, OK_button) self.setWindowTitle(self.playout.title()) vbox = QtWidgets.QVBoxLayout(self) vbox.addLayout(self.playout.layout()) vbox.addStretch(1) vbox.addLayout(Buttons(CancelButton(self), OK_button)) self.playout.encrypt_cb.setChecked(is_encrypted)
def __init__(self, parent=None, msg=None): msg = msg or _('Please enter your password') WindowModalDialog.__init__(self, parent, _("Enter Password")) self.pw = pw = PasswordLineEdit() vbox = QtWidgets.QVBoxLayout() vbox.addWidget(QtWidgets.QLabel(msg)) grid = QtWidgets.QGridLayout() grid.setSpacing(8) grid.addWidget(QtWidgets.QLabel(_('Password')), 1, 0) grid.addWidget(pw, 1, 1) vbox.addLayout(grid) vbox.addLayout(Buttons(CancelButton(self), OkButton(self))) self.setLayout(vbox) run_hook('password_dialog', pw, grid, 1)
def __init__(self, parent, wallet): WindowModalDialog.__init__(self, parent) is_encrypted = wallet.storage.is_encrypted() if not wallet.has_password(): msg = _('Your wallet is not protected.') msg += ' ' + _('Use this dialog to add a password to your wallet.') else: if not is_encrypted: msg = _( 'Your bitcoins are password protected. However, your wallet file is not encrypted.' ) else: msg = _('Your wallet is password protected and encrypted.') msg += ' ' + _('Use this dialog to change your password.') OK_button = OkButton(self) self.playout = PasswordLayout(wallet, msg, PW_CHANGE, OK_button) self.setWindowTitle(self.playout.title()) vbox = QVBoxLayout(self) vbox.addLayout(self.playout.layout()) vbox.addStretch(1) vbox.addLayout(Buttons(CancelButton(self), OK_button)) self.playout.encrypt_cb.setChecked(is_encrypted or not wallet.has_password())