-WIP-electrum-btcp/gui/kivy/uix/dialogs/checkbox_dialog.py

53 lines
1.4 KiB
Python
Raw Normal View History

2016-01-19 03:37:40 -08:00
from kivy.app import App
from kivy.factory import Factory
from kivy.properties import ObjectProperty
from kivy.lang import Builder
Builder.load_string('''
<CheckBoxDialog@Popup>
id: popup
title: ''
2016-01-21 03:12:55 -08:00
size_hint: 0.8, 0.8
2016-01-19 03:37:40 -08:00
pos_hint: {'top':0.9}
BoxLayout:
orientation: 'vertical'
2016-02-11 01:08:59 -08:00
Widget:
size_hint: 1, 0.1
Label:
id: description
text: ''
halign: 'left'
text_size: self.width, None
size: self.texture_size
2016-01-19 03:37:40 -08:00
BoxLayout:
orientation: 'horizontal'
2016-02-11 01:08:59 -08:00
size_hint: 1, 0.2
2016-01-19 03:37:40 -08:00
Label:
text: _('Enable')
CheckBox:
id:cb
BoxLayout:
orientation: 'horizontal'
2016-02-11 01:08:59 -08:00
size_hint: 1, 0.2
2016-01-19 03:37:40 -08:00
Button:
text: 'Cancel'
size_hint: 0.5, None
height: '48dp'
on_release: popup.dismiss()
Button:
text: 'OK'
size_hint: 0.5, None
height: '48dp'
on_release:
root.callback(cb.active)
popup.dismiss()
''')
class CheckBoxDialog(Factory.Popup):
def __init__(self, title, text, status, callback):
Factory.Popup.__init__(self)
self.ids.cb.active = status
self.ids.description.text = text
self.callback = callback
self.title = title