electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

checkbox_dialog.py (1447B)


      1 from kivy.app import App
      2 from kivy.factory import Factory
      3 from kivy.properties import ObjectProperty
      4 from kivy.lang import Builder
      5 
      6 Builder.load_string('''
      7 <CheckBoxDialog@Popup>
      8     id: popup
      9     title: ''
     10     size_hint: 0.8, 0.8
     11     pos_hint: {'top':0.9}
     12     BoxLayout:
     13         orientation: 'vertical'
     14         Label:
     15             id: description
     16             text: ''
     17             halign: 'left'
     18             text_size: self.width, None
     19             size: self.texture_size
     20         BoxLayout:
     21             orientation: 'horizontal'
     22             size_hint: 1, 0.2
     23             Label:
     24                 text: _('Enable')
     25             CheckBox:
     26                 id:cb
     27         Widget:
     28             size_hint: 1, 0.1
     29         BoxLayout:
     30             orientation: 'horizontal'
     31             size_hint: 1, 0.2
     32             Button:
     33                 text: 'Cancel'
     34                 size_hint: 0.5, None
     35                 height: '48dp'
     36                 on_release: popup.dismiss()
     37             Button:
     38                 text: 'OK'
     39                 size_hint: 0.5, None
     40                 height: '48dp'
     41                 on_release:
     42                     root.callback(cb.active)
     43                     popup.dismiss()
     44 ''')
     45 
     46 class CheckBoxDialog(Factory.Popup):
     47     def __init__(self, title, text, status, callback):
     48         Factory.Popup.__init__(self)
     49         self.ids.cb.active = status
     50         self.ids.description.text = text
     51         self.callback = callback
     52         self.title = title