def dialog(cls, account): """ Prompt the password dialog. """ title = "Enter your password" password_form = cls() password_form.ids.account_id.text = "0x" + account.address.hex() dialog = Dialog.create_dialog_content_helper(title=title, content=password_form) # workaround for MDDialog container size (too small by default) dialog.ids.container.size_hint_y = 1 dialog.add_action_button( "Unlock", action=lambda *x: password_form.dispatch( 'on_unlock', dialog, account, password_form.password)) # hitting enter on the text should also submit password_form.ids.password_id.bind( on_text_validate=lambda *x: password_form.dispatch( 'on_unlock', dialog, account, password_form.password)) return dialog
def show_qr_code(self): """ Shows address QR Code in a dialog. """ # lazy loading from kivy.garden.qrcode import QRCodeWidget from kivy.metrics import dp account = self.current_account if not account: return address = "0x" + account.address.hex() title = address qr_code = QRCodeWidget() qr_code.data = address dialog = Dialog.create_dialog_content_helper(title=title, content=qr_code) # workaround for MDDialog container size (too small by default) dialog.ids.container.size_hint_y = 1 dialog.height = dp(500) dialog.add_action_button("OK", action=lambda *x: dialog.dismiss()) dialog.open() return dialog