URI: 
       totp/email dialog handles pressing enter. do not offer to show seed for 2fa wallet. - electrum - Electrum Bitcoin wallet
  HTML git clone https://git.parazyd.org/electrum
   DIR Log
   DIR Files
   DIR Refs
   DIR Submodules
       ---
   DIR commit 248a3a57550e3886a4745453cde4f4e8073f0b6e
   DIR parent 9ceb73f014ed44ba16cb23e1d848d05bbfacd472
  HTML Author: SomberNight <somber.night@protonmail.com>
       Date:   Tue,  5 Jun 2018 15:14:22 +0200
       
       otp/email dialog handles pressing enter. do not offer to show seed for 2fa wallet.
       
       Diffstat:
         M gui/kivy/uix/dialogs/installwizard… |      55 +++++++++++++++++++------------
         M gui/kivy/uix/ui_screens/status.kv   |       5 +++--
         M plugins/trustedcoin/trustedcoin.py  |       2 +-
       
       3 files changed, 38 insertions(+), 24 deletions(-)
       ---
   DIR diff --git a/gui/kivy/uix/dialogs/installwizard.py b/gui/kivy/uix/dialogs/installwizard.py
       t@@ -207,6 +207,8 @@ Builder.load_string('''
            WizardTextInput:
                id: email
                on_text: Clock.schedule_once(root.on_text)
       +        multiline: False
       +        on_text_validate: Clock.schedule_once(root.on_enter)
        
        <WizardKnownOTPDialog>
            message : ''
       t@@ -224,6 +226,8 @@ Builder.load_string('''
            WizardTextInput:
                id: otp
                on_text: Clock.schedule_once(root.on_text)
       +        multiline: False
       +        on_text_validate: Clock.schedule_once(root.on_enter)
            Widget
                size_hint: 1, 1
            Label:
       t@@ -261,6 +265,8 @@ Builder.load_string('''
            WizardTextInput:
                id: otp
                on_text: Clock.schedule_once(root.on_text)
       +        multiline: False
       +        on_text_validate: Clock.schedule_once(root.on_enter)
        
        <MButton@Button>:
            size_hint: 1, None
       t@@ -576,12 +582,8 @@ class WizardMultisigDialog(WizardDialog):
                n = self.ids.n.value
                return m, n
        
       -class WizardKnownOTPDialog(WizardDialog):
        
       -    def __init__(self, wizard, **kwargs):
       -        WizardDialog.__init__(self, wizard, **kwargs)
       -        self.message = _("This wallet is already registered with TrustedCoin. To finalize wallet creation, please enter your Google Authenticator Code.")
       -        self.message2 =_("If you have lost your Google Authenticator account, check the box below to request a new secret. You will need to retype your seed.")
       +class WizardOTPDialogBase(WizardDialog):
        
            def get_otp(self):
                otp = self.ids.otp.text
       t@@ -592,6 +594,23 @@ class WizardKnownOTPDialog(WizardDialog):
                except:
                    return
        
       +    def on_text(self, dt):
       +        self.ids.next.disabled = self.get_otp() is None
       +
       +    def on_enter(self, dt):
       +        # press next
       +        next = self.ids.next
       +        if not next.disabled:
       +            next.dispatch('on_release')
       +
       +
       +class WizardKnownOTPDialog(WizardOTPDialogBase):
       +
       +    def __init__(self, wizard, **kwargs):
       +        WizardOTPDialogBase.__init__(self, wizard, **kwargs)
       +        self.message = _("This wallet is already registered with TrustedCoin. To finalize wallet creation, please enter your Google Authenticator Code.")
       +        self.message2 =_("If you have lost your Google Authenticator account, check the box below to request a new secret. You will need to retype your seed.")
       +
            def get_params(self, button):
                return (self.get_otp(), self.ids.cb.active)
        
       t@@ -599,31 +618,17 @@ class WizardKnownOTPDialog(WizardDialog):
                self.ids.otp.text = ''
                self.ids.next.disabled = not self.ids.cb.active
        
       -    def on_text(self, dt):
       -        self.ids.next.disabled = self.get_otp() is None
        
       -class WizardNewOTPDialog(WizardDialog):
       +class WizardNewOTPDialog(WizardOTPDialogBase):
        
            def __init__(self, wizard, **kwargs):
       -        WizardDialog.__init__(self, wizard, **kwargs)
       +        WizardOTPDialogBase.__init__(self, wizard, **kwargs)
                otp_secret = kwargs['otp_secret']
                uri = "otpauth://totp/%s?secret=%s"%('trustedcoin.com', otp_secret)
                self.message = "Please scan the following QR code in Google Authenticator. You may also use the secret key: %s"%otp_secret
                self.message2 = _('Then, enter your Google Authenticator code:')
                self.ids.qr.set_data(uri)
        
       -    def get_otp(self):
       -        otp = self.ids.otp.text
       -        if len(otp) != 6:
       -            return
       -        try:
       -            return int(otp)
       -        except:
       -            return
       -
       -    def on_text(self, dt):
       -        self.ids.next.disabled = self.get_otp() is None
       -
            def get_params(self, button):
                return (self.get_otp(), False)
        
       t@@ -637,11 +642,19 @@ class WizardTOSDialog(WizardDialog):
                self.message2 = _('Enter your email address:')
        
        class WizardEmailDialog(WizardDialog):
       +
            def get_params(self, button):
                return (self.ids.email.text,)
       +
            def on_text(self, dt):
                self.ids.next.disabled = not is_valid_email(self.ids.email.text)
        
       +    def on_enter(self, dt):
       +        # press next
       +        next = self.ids.next
       +        if not next.disabled:
       +            next.dispatch('on_release')
       +
        class WizardConfirmDialog(WizardDialog):
        
            def __init__(self, wizard, **kwargs):
   DIR diff --git a/gui/kivy/uix/ui_screens/status.kv b/gui/kivy/uix/ui_screens/status.kv
       t@@ -4,6 +4,7 @@ Popup:
            unconfirmed: 0
            unmatured: 0
            watching_only: app.wallet.is_watching_only()
       +    has_seed: app.wallet.has_seed()
            on_parent:
                self.confirmed, self.unconfirmed, self.unmatured = app.wallet.get_balance()
            BoxLayout:
       t@@ -70,8 +71,8 @@ Popup:
                    Button:
                        size_hint: 0.5, None
                        height: '48dp'
       -                text: '' if root.watching_only else (_('Hide seed') if seed_label.text else _('Show seed'))
       -                disabled: root.watching_only
       +                text: '' if not root.has_seed else (_('Hide seed') if seed_label.text else _('Show seed'))
       +                disabled: not root.has_seed
                        on_release:
                            setattr(seed_label, 'text', '') if seed_label.text else app.show_seed(seed_label)
                    Button:
   DIR diff --git a/plugins/trustedcoin/trustedcoin.py b/plugins/trustedcoin/trustedcoin.py
       t@@ -81,7 +81,7 @@ KIVY_DISCLAIMER = [
              "To use it, you must have a separate device with Google Authenticator."),
            _("This service uses a multi-signature wallet, where you own 2 of 3 keys.  "
              "The third key is stored on a remote server that signs transactions on "
       -      "your behalf.A small fee will be charged on each transaction that uses the "
       +      "your behalf. A small fee will be charged on each transaction that uses the "
              "remote server."),
            _("Note that your coins are not locked in this service.  You may withdraw "
              "your funds at any time and at no cost, without the remote server, by "