electrum

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

label_dialog.py (1671B)


      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 #:import KIVY_GUI_PATH electrum.gui.kivy.KIVY_GUI_PATH
      8 
      9 <LabelDialog@Popup>
     10     id: popup
     11     title: ''
     12     size_hint: 0.8, 0.3
     13     pos_hint: {'top':0.9}
     14     BoxLayout:
     15         orientation: 'vertical'
     16         Widget:
     17             size_hint: 1, 0.2
     18         TextInput:
     19             id:input
     20             padding: '5dp'
     21             size_hint: 1, None
     22             height: '27dp'
     23             pos_hint: {'center_y':.5}
     24             text:''
     25             multiline: False
     26             background_normal: f'atlas://{KIVY_GUI_PATH}/theming/light/tab_btn'
     27             background_active: f'atlas://{KIVY_GUI_PATH}/theming/light/textinput_active'
     28             hint_text_color: self.foreground_color
     29             foreground_color: 1, 1, 1, 1
     30             font_size: '16dp'
     31             focus: True
     32         Widget:
     33             size_hint: 1, 0.2
     34         BoxLayout:
     35             orientation: 'horizontal'
     36             size_hint: 1, 0.5
     37             Button:
     38                 text: 'Cancel'
     39                 size_hint: 0.5, None
     40                 height: '48dp'
     41                 on_release: popup.dismiss()
     42             Button:
     43                 text: 'OK'
     44                 size_hint: 0.5, None
     45                 height: '48dp'
     46                 on_release:
     47                     root.callback(input.text)
     48                     popup.dismiss()
     49 ''')
     50 
     51 class LabelDialog(Factory.Popup):
     52 
     53     def __init__(self, title, text, callback):
     54         Factory.Popup.__init__(self)
     55         self.ids.input.text = text
     56         self.callback = callback
     57         self.title = title