class PasswordDialog(AbstractPasswordDialog): enter_pw_message = _('Enter your password') enter_new_pw_message = _('Enter new password') confirm_new_pw_message = _('Confirm new password') wrong_password_message = _('Wrong password') allow_disable = False def __init__(self, app, **kwargs): AbstractPasswordDialog.__init__(self, app, **kwargs) self.hide_wallet_label = app._use_single_password def clear_password(self): self.ids.textinput_generic_password.text = '' def on_password(self, pw: str): # if not self.require_password: self.success = True self.message = _('Please wait...') self.dismiss() return # if setting new generic password, enforce min length if self.level > 0: if len(pw) < 6: self.app.show_error( _('Password is too short (min {} characters)').format(6)) return # don't enforce minimum length on existing self.do_check(pw)
def get_card(self, addr, balance, is_used, label): ci = {} ci['screen'] = self ci['address'] = addr ci['memo'] = label ci['amount'] = self.app.format_amount_and_units(balance) ci['status'] = _('Used') if is_used else _( 'Funded') if balance > 0 else _('Unused') ci['is_frozen'] = self.app.wallet.is_frozen_address(addr) return ci
def update_status(self): req = self.app.wallet.get_request(self.key) self.status = self.app.wallet.get_request_status(self.key) self.status_str = req.get_status_str(self.status) self.status_color = pr_color[self.status] if self.status == PR_UNPAID: address = req.get_address() if self.app.wallet.is_used(address): self.warning = _('Warning') + ': ' + _( 'This address is being reused')
def on_text(self, new_val): if not new_val: self.err.text = _('Missing value') self.err.subs_val = self.min_val return new_val = int(new_val) if new_val < self.min_val: self.err.text = _('Value too small') self.err.subs_val = self.min_val elif new_val > self.max_val: self.err.text = _('Value too large') self.err.subs_val = self.max_val else: self.err.text = '' self.value = new_val
def on_password(self, pw: str): # if not self.require_password: self.success = True self.message = _('Please wait...') self.dismiss() return # if setting new generic password, enforce min length if self.level > 0: if len(pw) < 6: self.app.show_error( _('Password is too short (min {} characters)').format(6)) return # don't enforce minimum length on existing self.do_check(pw)
class PincodeDialog(AbstractPasswordDialog): enter_pw_message = _('Enter your PIN') enter_new_pw_message = _('Enter new PIN') confirm_new_pw_message = _('Confirm new PIN') wrong_password_message = _('Wrong PIN') allow_disable = True def __init__(self, app, **kwargs): AbstractPasswordDialog.__init__(self, app, **kwargs) def clear_password(self): self.ids.kb.password = '' def on_password(self, pw: str): # PIN codes are exactly 6 chars if len(pw) >= 6: self.do_check(pw)
def on_currency(self, ccy): b = (ccy != _('None')) self.fx.set_enabled(b) if b: if ccy != self.fx.get_currency(): self.fx.set_currency(ccy) self.app.fiat_unit = ccy else: self.app.is_fiat = False Clock.schedule_once(lambda dt: self.add_exchanges())
def delete_dialog(self): from .question import Question def cb(result): if result: self.app.wallet.delete_request(self.key) self.dismiss() self.app.receive_screen.update() d = Question(_('Delete request?'), cb) d.open()
def __init__(self, parent, address, balance, status, **kwargs): super(AddressPopup, self).__init__(**kwargs) self.title = _('Address Details') self.parent_dialog = parent self.app = parent.app # type: ElectrumWindow self.address = address self.status = status self.script_type = self.app.wallet.get_txin_type(self.address) self.balance = self.app.format_amount_and_units(balance) self.address_color, self.address_background_color = address_colors( self.app.wallet, address) self.is_frozen = self.app.wallet.is_frozen_address(address)