예제 #1
0
 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
예제 #2
0
 def gen_qrcode(self):
     """
     Generates a qrcode containing the invoice for the specified amount in satoshis
     """
     try:
         amount = int(self.ids.amount.text)
     except:
         self.ids.amount.text = ''
         return
     self.ids.qrcode_container.clear_widgets()
     try:
         bolt11 = self.manager.app.account.gen_invoice(amount)['bolt11']
         self.ids.qrcode_container.add_widget(QRCodeWidget(data=bolt11))
     except Exception as e:
         self.ids.qrcode_container.add_widget(Label(text='There was a problem trying to speak to the node.'))
예제 #3
0
파일: main.py 프로젝트: Marcdnd/nowallet
    def show_dialog(self, title, message, qrdata=None, cb=None):
        if qrdata:
            dialog_height = 300
            content = QRCodeWidget(data=qrdata,
                                   size=(dp(150), dp(150)),
                                   size_hint=(None, None))
        else:
            dialog_height = 200
            content = MDLabel(font_style='Body1',
                              theme_text_color='Secondary',
                              text=message,
                              size_hint_y=None,
                              valign='top')
            content.bind(texture_size=content.setter('size'))
        self.dialog = MDDialog(title=title,
                               content=content,
                               size_hint=(.8, None),
                               height=dp(dialog_height),
                               auto_dismiss=False)

        self.dialog.add_action_button(
            "Dismiss", action=cb if cb else lambda *x: self.dialog.dismiss())
        self.dialog.open()