kivy wizard: don't use auto-dismiss. rename classes
This commit is contained in:
parent
b1f9f7faed
commit
4bfaa1fa02
|
@ -110,10 +110,6 @@ class ElectrumWindow(App):
|
||||||
return int(p * x)
|
return int(p * x)
|
||||||
|
|
||||||
|
|
||||||
hierarchy = ListProperty([])
|
|
||||||
'''used to navigate with the back button.
|
|
||||||
'''
|
|
||||||
|
|
||||||
_orientation = OptionProperty('landscape',
|
_orientation = OptionProperty('landscape',
|
||||||
options=('landscape', 'portrait'))
|
options=('landscape', 'portrait'))
|
||||||
|
|
||||||
|
@ -336,14 +332,6 @@ class ElectrumWindow(App):
|
||||||
if self.wallet:
|
if self.wallet:
|
||||||
self.wallet.stop_threads()
|
self.wallet.stop_threads()
|
||||||
|
|
||||||
def on_back(self):
|
|
||||||
try:
|
|
||||||
self.hierarchy.pop()()
|
|
||||||
except IndexError:
|
|
||||||
# capture back button and pause app.
|
|
||||||
self._pause()
|
|
||||||
|
|
||||||
|
|
||||||
def on_keyboard_height(self, window, height):
|
def on_keyboard_height(self, window, height):
|
||||||
win = window
|
win = window
|
||||||
active_widg = win.children[0]
|
active_widg = win.children[0]
|
||||||
|
|
|
@ -56,7 +56,7 @@ class AnimatedPopup(Factory.Popup):
|
||||||
anim.bind(on_complete=on_complete)
|
anim.bind(on_complete=on_complete)
|
||||||
anim.start(self)
|
anim.start(self)
|
||||||
|
|
||||||
class EventsDialog(AnimatedPopup):
|
class EventsDialog(Factory.Popup):
|
||||||
''' Abstract Popup that provides the following events
|
''' Abstract Popup that provides the following events
|
||||||
.. events::
|
.. events::
|
||||||
`on_release`
|
`on_release`
|
||||||
|
|
|
@ -22,7 +22,7 @@ Builder.load_string('''
|
||||||
#:import _ electrum.i18n._
|
#:import _ electrum.i18n._
|
||||||
|
|
||||||
|
|
||||||
<CreateAccountTextInput@TextInput>
|
<WizardTextInput@TextInput>
|
||||||
border: 4, 4, 4, 4
|
border: 4, 4, 4, 4
|
||||||
font_size: '15sp'
|
font_size: '15sp'
|
||||||
padding: '15dp', '15dp'
|
padding: '15dp', '15dp'
|
||||||
|
@ -34,7 +34,7 @@ Builder.load_string('''
|
||||||
size_hint_y: None
|
size_hint_y: None
|
||||||
height: '48sp'
|
height: '48sp'
|
||||||
|
|
||||||
<CreateAccountButton@Button>:
|
<WizardButton@Button>:
|
||||||
root: None
|
root: None
|
||||||
size_hint: 1, None
|
size_hint: 1, None
|
||||||
height: '48sp'
|
height: '48sp'
|
||||||
|
@ -42,9 +42,9 @@ Builder.load_string('''
|
||||||
on_release: if self.root: self.root.dispatch('on_release', self)
|
on_release: if self.root: self.root.dispatch('on_release', self)
|
||||||
|
|
||||||
|
|
||||||
<-CreateAccountDialog>
|
<-WizardDialog>
|
||||||
text_color: .854, .925, .984, 1
|
text_color: .854, .925, .984, 1
|
||||||
auto_dismiss: False
|
#auto_dismiss: False
|
||||||
size_hint: None, None
|
size_hint: None, None
|
||||||
canvas.before:
|
canvas.before:
|
||||||
Color:
|
Color:
|
||||||
|
@ -124,11 +124,11 @@ Builder.load_string('''
|
||||||
spacing: '14dp'
|
spacing: '14dp'
|
||||||
size_hint: 1, None
|
size_hint: 1, None
|
||||||
height: self.minimum_height
|
height: self.minimum_height
|
||||||
CreateAccountButton:
|
WizardButton:
|
||||||
id: create
|
id: create
|
||||||
text: _('Create a new seed')
|
text: _('Create a new seed')
|
||||||
root: root
|
root: root
|
||||||
CreateAccountButton:
|
WizardButton:
|
||||||
id: restore
|
id: restore
|
||||||
text: _('I already have a seed')
|
text: _('I already have a seed')
|
||||||
root: root
|
root: root
|
||||||
|
@ -148,7 +148,7 @@ Builder.load_string('''
|
||||||
spacing: '12dp'
|
spacing: '12dp'
|
||||||
size_hint: 1, None
|
size_hint: 1, None
|
||||||
height: self.minimum_height
|
height: self.minimum_height
|
||||||
CreateAccountTextInput:
|
WizardTextInput:
|
||||||
id: text_input_seed
|
id: text_input_seed
|
||||||
size_hint: 1, None
|
size_hint: 1, None
|
||||||
height: '110dp'
|
height: '110dp'
|
||||||
|
@ -171,7 +171,7 @@ Builder.load_string('''
|
||||||
spacing: '12dp'
|
spacing: '12dp'
|
||||||
size_hint: 1, None
|
size_hint: 1, None
|
||||||
height: self.minimum_height
|
height: self.minimum_height
|
||||||
CreateAccountButton:
|
WizardButton:
|
||||||
id: back
|
id: back
|
||||||
text: _('Back')
|
text: _('Back')
|
||||||
root: root
|
root: root
|
||||||
|
@ -179,7 +179,7 @@ Builder.load_string('''
|
||||||
id: scan
|
id: scan
|
||||||
text: _('QR')
|
text: _('QR')
|
||||||
on_release: root.scan_seed()
|
on_release: root.scan_seed()
|
||||||
CreateAccountButton:
|
WizardButton:
|
||||||
id: next
|
id: next
|
||||||
text: _('Next')
|
text: _('Next')
|
||||||
root: root
|
root: root
|
||||||
|
@ -213,19 +213,6 @@ Builder.load_string('''
|
||||||
background_normal: 'atlas://gui/kivy/theming/light/white_bg_round_top'
|
background_normal: 'atlas://gui/kivy/theming/light/white_bg_round_top'
|
||||||
background_down: self.background_normal
|
background_down: self.background_normal
|
||||||
text: root.seed_text
|
text: root.seed_text
|
||||||
#GridLayout:
|
|
||||||
# rows: 1
|
|
||||||
# Button:
|
|
||||||
# id: bt
|
|
||||||
# size_hint_x: .15
|
|
||||||
# background_normal: 'atlas://gui/kivy/theming/light/blue_bg_round_rb'
|
|
||||||
# background_down: self.background_normal
|
|
||||||
# Image:
|
|
||||||
# mipmap: True
|
|
||||||
# source: 'atlas://gui/kivy/theming/light/qrcode'
|
|
||||||
# size: bt.size
|
|
||||||
# center: bt.center
|
|
||||||
# #on_release:
|
|
||||||
Label:
|
Label:
|
||||||
rows: 1
|
rows: 1
|
||||||
size_hint: 1, .7
|
size_hint: 1, .7
|
||||||
|
@ -241,27 +228,24 @@ Builder.load_string('''
|
||||||
spacing: '12dp'
|
spacing: '12dp'
|
||||||
size_hint: 1, None
|
size_hint: 1, None
|
||||||
height: self.minimum_height
|
height: self.minimum_height
|
||||||
CreateAccountButton:
|
WizardButton:
|
||||||
id: back
|
id: back
|
||||||
text: _('Back')
|
text: _('Back')
|
||||||
root: root
|
root: root
|
||||||
CreateAccountButton:
|
WizardButton:
|
||||||
id: confirm
|
id: confirm
|
||||||
text: _('Confirm')
|
text: _('Confirm')
|
||||||
root: root
|
root: root
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
''')
|
''')
|
||||||
|
|
||||||
|
|
||||||
class CreateAccountDialog(EventsDialog):
|
class WizardDialog(EventsDialog):
|
||||||
''' Abstract dialog to be used as the base for all Create Account Dialogs
|
''' Abstract dialog to be used as the base for all Create Account Dialogs
|
||||||
'''
|
'''
|
||||||
crcontent = ObjectProperty(None)
|
crcontent = ObjectProperty(None)
|
||||||
|
|
||||||
def __init__(self, **kwargs):
|
def __init__(self, **kwargs):
|
||||||
super(CreateAccountDialog, self).__init__(**kwargs)
|
super(WizardDialog, self).__init__(**kwargs)
|
||||||
self.action = kwargs.get('action')
|
self.action = kwargs.get('action')
|
||||||
_trigger_size_dialog = Clock.create_trigger(self._size_dialog)
|
_trigger_size_dialog = Clock.create_trigger(self._size_dialog)
|
||||||
Window.bind(size=_trigger_size_dialog,
|
Window.bind(size=_trigger_size_dialog,
|
||||||
|
@ -282,12 +266,12 @@ class CreateAccountDialog(EventsDialog):
|
||||||
|
|
||||||
def add_widget(self, widget, index=0):
|
def add_widget(self, widget, index=0):
|
||||||
if not self.crcontent:
|
if not self.crcontent:
|
||||||
super(CreateAccountDialog, self).add_widget(widget)
|
super(WizardDialog, self).add_widget(widget)
|
||||||
else:
|
else:
|
||||||
self.crcontent.add_widget(widget, index=index)
|
self.crcontent.add_widget(widget, index=index)
|
||||||
|
|
||||||
|
|
||||||
class CreateRestoreDialog(CreateAccountDialog):
|
class CreateRestoreDialog(WizardDialog):
|
||||||
''' Initial Dialog for creating or restoring seed'''
|
''' Initial Dialog for creating or restoring seed'''
|
||||||
|
|
||||||
def on_parent(self, instance, value):
|
def on_parent(self, instance, value):
|
||||||
|
@ -296,7 +280,7 @@ class CreateRestoreDialog(CreateAccountDialog):
|
||||||
self._back = _back = partial(app.dispatch, 'on_back')
|
self._back = _back = partial(app.dispatch, 'on_back')
|
||||||
|
|
||||||
|
|
||||||
class ShowSeedDialog(CreateAccountDialog):
|
class ShowSeedDialog(WizardDialog):
|
||||||
|
|
||||||
seed_text = StringProperty('')
|
seed_text = StringProperty('')
|
||||||
message = StringProperty('')
|
message = StringProperty('')
|
||||||
|
@ -310,7 +294,7 @@ class ShowSeedDialog(CreateAccountDialog):
|
||||||
self._back = _back = partial(self.ids.back.dispatch, 'on_release')
|
self._back = _back = partial(self.ids.back.dispatch, 'on_release')
|
||||||
|
|
||||||
|
|
||||||
class RestoreSeedDialog(CreateAccountDialog):
|
class RestoreSeedDialog(WizardDialog):
|
||||||
|
|
||||||
message = StringProperty('')
|
message = StringProperty('')
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue