URI: 
       tmain.kv - electrum - Electrum Bitcoin wallet
  HTML git clone https://git.parazyd.org/electrum
   DIR Log
   DIR Files
   DIR Refs
   DIR Submodules
       ---
       tmain.kv (12108B)
       ---
            1 #:import Clock kivy.clock.Clock
            2 #:import Window kivy.core.window.Window
            3 #:import Factory kivy.factory.Factory
            4 #:import _ electrum.gui.kivy.i18n._
            5 #:import KIVY_GUI_PATH electrum.gui.kivy.KIVY_GUI_PATH
            6 
            7 
            8 ###########################
            9 #     Global Defaults
           10 ###########################
           11 
           12 <Label>
           13     markup: True
           14     font_name: 'Roboto'
           15     font_size: '16sp'
           16     bound: False
           17     on_text: if isinstance(self.text, _) and not self.bound: self.bound=True; _.bind(self)
           18 
           19 <TextInput>
           20     on_focus: app._focused_widget = root
           21     font_size: '18sp'
           22 
           23 <Button>
           24     on_parent: self.MIN_STATE_TIME = 0.1
           25 
           26 <ListItemButton>
           27     font_size: '12sp'
           28 
           29 <Carousel>:
           30     canvas.before:
           31         Color:
           32             rgba: 0.1, 0.1, 0.1, 1
           33         Rectangle:
           34             size: self.size
           35             pos: self.pos
           36 
           37 <ActionView>:
           38     canvas.before:
           39         Color:
           40             rgba: 0.1, 0.1, 0.1, 1
           41         Rectangle:
           42             size: self.size
           43             pos: self.pos
           44 
           45 
           46 # Custom Global Widgets
           47 
           48 <TopLabel>
           49     size_hint_y: None
           50     text_size: self.width, None
           51     height: self.texture_size[1]
           52 
           53 <VGridLayout@GridLayout>:
           54     rows: 1
           55     size_hint: 1, None
           56     height: self.minimum_height
           57 
           58 
           59 
           60 <IconButton@Button>:
           61     icon: ''
           62     icon_size: '30dp'
           63     AnchorLayout:
           64         pos: self.parent.pos
           65         size: self.parent.size
           66         orientation: 'lr-tb'
           67         Image:
           68             source: self.parent.parent.icon
           69             size_hint_x: None
           70             size: root.icon_size, root.icon_size
           71 
           72             
           73 <BackgroundColor@Widget>
           74     background_color: 0, 0, 0, 1
           75     canvas.before:
           76         Color:
           77             rgba: root.background_color
           78         Rectangle:
           79             size: self.size
           80             pos: self.pos
           81 <BackgroundTopLabel@TopLabel+BackgroundColor>
           82     background_color: 0, 0, 0, 1
           83 
           84 
           85 #########################
           86 #       Dialogs
           87 #########################
           88 <BoxLabel@BoxLayout>
           89     text: ''
           90     value: ''
           91     size_hint_y: None
           92     height: max(lbl1.height, lbl2.height)
           93     TopLabel
           94         id: lbl1
           95         text: root.text
           96         pos_hint: {'top':1}
           97     TopLabel
           98         id: lbl2
           99         text: root.value
          100 
          101 <OutputItem>
          102     address: ''
          103     value: ''
          104     background_color: 0, 0, 0, 1
          105     color: 1, 1, 1, 1
          106     size_hint_y: None
          107     height: max(lbl1.height, lbl2.height)
          108     BackgroundTopLabel
          109         id: lbl1
          110         text: '[ref=%s]%s[/ref]'%(root.address, root.address)
          111         color: root.color
          112         background_color: root.background_color 
          113         font_size: '6pt'
          114         shorten: True
          115         size_hint_x: 0.65
          116         on_ref_press:
          117             app._clipboard.copy(root.address)
          118             app.show_info(_('Address copied to clipboard') + ' ' + root.address)
          119     TopLabel
          120         id: lbl2
          121         text: root.value
          122         font_size: '6pt'
          123         size_hint_x: 0.35
          124         halign: 'right'
          125 
          126 
          127 <OutputList>
          128     viewclass: 'OutputItem'
          129     size_hint: 1, None
          130     height: min(output_list_layout.minimum_height, dp(144))
          131     scroll_type: ['bars', 'content']
          132     bar_width: dp(15)
          133     RecycleBoxLayout:
          134         orientation: 'vertical'
          135         default_size: None, pt(6)
          136         default_size_hint: 1, None
          137         size_hint: 1, None
          138         height: self.minimum_height
          139         id: output_list_layout
          140         spacing: '10dp'
          141         padding: '10dp'
          142         canvas.before:
          143             Color:
          144                 rgb: .3, .3, .3
          145             Rectangle:
          146                 size: self.size
          147                 pos: self.pos
          148 
          149 <RefLabel>
          150     font_size: '6pt'
          151     name: ''
          152     data: ''
          153     visible: True
          154     opacity: 1 if self.visible else 0
          155     disabled: not self.visible
          156     text: self.data if self.data else _('Tap to show')
          157     touched: False
          158     padding: '10dp', '10dp'
          159     background_color: .3, .3, .3, 1
          160     show_text_with_qr: True
          161     touch_callback: lambda: app.on_ref_label(self, show_text_with_qr=self.show_text_with_qr)
          162     on_touch_down:
          163         touch = args[1]
          164         touched = bool(self.collide_point(*touch.pos))
          165         if touched: self.touch_callback()
          166         if touched: self.touched = True
          167     canvas.before:
          168         Color:
          169             rgba: root.background_color
          170         Rectangle:
          171             size: self.size
          172             pos: self.pos
          173 
          174 <TxHashLabel@RefLabel>
          175     data: ''
          176     text: ' '.join(map(''.join, zip(*[iter(self.data)]*4))) if self.data else ''
          177 
          178 <InfoBubble>
          179     size_hint: None, None
          180     width: '270dp' if root.fs else min(self.width, dp(270))
          181     height: self.width if self.fs else (lbl.texture_size[1] + dp(27))
          182     BoxLayout:
          183         padding: '5dp' if root.fs else 0
          184         Widget:
          185             size_hint: None, 1
          186             width: '4dp' if root.fs else '2dp'
          187         Image:
          188             id: img
          189             source: root.icon
          190             mipmap: True
          191             size_hint: None, 1
          192             width: (root.width - dp(20)) if root.fs  else (0 if not root.icon else '32dp')
          193         Widget:
          194             size_hint_x: None
          195             width: '5dp'
          196         Label:
          197             id: lbl
          198             markup: True
          199             font_size: '12sp'
          200             text: root.message
          201             text_size: self.width, None
          202             valign: 'middle'
          203             size_hint: 1, 1
          204             width: 0 if root.fs else (root.width - img.width)
          205 
          206 
          207 <SendReceiveBlueBottom@GridLayout>
          208     item_height: dp(42)
          209     foreground_color: .843, .914, .972, 1
          210     cols: 1
          211     padding: '12dp', 0
          212     canvas.before:
          213         Color:
          214             rgba: 0.192, .498, 0.745, 1
          215         BorderImage:
          216             source: f'atlas://{KIVY_GUI_PATH}/theming/light/card_bottom'
          217             size: self.size
          218             pos: self.pos
          219 
          220 
          221 <AddressFilter@GridLayout>
          222         item_height: dp(42)
          223         item_width: dp(60)
          224         foreground_color: .843, .914, .972, 1
          225         cols: 1
          226         canvas.before:
          227                 Color:
          228                         rgba: 0.192, .498, 0.745, 1
          229                 BorderImage:
          230                         source: f'atlas://{KIVY_GUI_PATH}/theming/light/card_bottom'
          231                         size: self.size
          232                         pos: self.pos
          233 
          234 <SearchBox@GridLayout>
          235         item_height: dp(42)
          236         foreground_color: .843, .914, .972, 1
          237         cols: 1
          238         padding: '12dp', 0
          239         canvas.before:
          240                 Color:
          241                         rgba: 0.192, .498, 0.745, 1
          242         BorderImage:
          243             source: f'atlas://{KIVY_GUI_PATH}/theming/light/card_bottom'
          244             size: self.size
          245             pos: self.pos
          246 
          247 <CardSeparator@Widget>
          248     size_hint: 1, None
          249     height: dp(1)
          250     color: .909, .909, .909, 1
          251     canvas:
          252         Color:
          253             rgba: root.color if root.color else (0, 0, 0, 0)
          254         Rectangle:
          255             size: self.size
          256             pos: self.pos
          257 
          258 <CardItem@ButtonBehavior+BoxLayout>
          259     size_hint: 1, None
          260     height: '65dp'
          261     group: 'requests'
          262     padding: dp(12)
          263     spacing: dp(5)
          264     screen: None
          265     on_release: self.screen.show_item(args[0])
          266     canvas.before:
          267         Color:
          268             rgba: (0.192, .498, 0.745, 1) if self.state == 'down' else (0.15, 0.15, 0.17, 1)
          269         Rectangle:
          270             size: self.size
          271             pos: self.pos
          272 
          273 <BlueButton@Button>:
          274     background_color: 1, .585, .878, 0
          275     halign: 'left'
          276     text_size: (self.width-10, None)
          277     size_hint: 0.5, None
          278     default_text: ''
          279     text: self.default_text
          280     padding: '5dp', '5dp'
          281     height: '40dp'
          282     text_color: self.foreground_color
          283     disabled_color: 1, 1, 1, 1
          284     foreground_color: 1, 1, 1, 1
          285     canvas.before:
          286         Color:
          287             rgba: (0.9, .498, 0.745, 1) if self.state == 'down' else self.background_color
          288         Rectangle:
          289             size: self.size
          290             pos: self.pos
          291 
          292 
          293 <KButton@Button>:
          294     size_hint: 1, None
          295     height: '60dp'
          296     font_size: '30dp'
          297     on_release:
          298         self.parent.update_amount(self.text)
          299 
          300 
          301 <StripLayout>
          302     padding: 0, 0, 0, 0
          303 
          304 <TabbedPanelStrip>:
          305     on_parent:
          306         if self.parent: self.parent.bar_width = 0
          307         if self.parent: self.parent.scroll_x = 0.5
          308 
          309 
          310 <TabbedCarousel>
          311     carousel: carousel
          312     do_default_tab: False
          313     Carousel:
          314         anim_type: 'out_quart'
          315         min_move: .05
          316         anim_move_duration: .1
          317         anim_cancel_duration: .54
          318         on_index: root.on_index(*args)
          319         id: carousel
          320 
          321 
          322 
          323 <CleanHeader@TabbedPanelHeader>
          324     border: 16, 0, 16, 0
          325     markup: False
          326     text_size: self.size
          327     halign: 'center'
          328     valign: 'middle'
          329     bold: True
          330     font_size: '12.5sp'
          331     background_normal: f'atlas://{KIVY_GUI_PATH}/theming/light/tab_btn'
          332     background_down: f'atlas://{KIVY_GUI_PATH}/theming/light/tab_btn_pressed'
          333 
          334 
          335 <ColoredLabel@Label>:
          336     font_size: '48sp'
          337     color: (.6, .6, .6, 1)
          338     canvas.before:
          339         Color:
          340             rgb: (.9, .9, .9)
          341         Rectangle:
          342             pos: self.x + sp(2), self.y + sp(2)
          343             size: self.width - sp(4), self.height - sp(4)
          344 
          345 
          346 <SettingsItem@ButtonBehavior+BoxLayout>
          347     orientation: 'vertical'
          348     title: ''
          349     description: ''
          350     size_hint: 1, None
          351     height: '60dp'
          352     action: lambda x: None
          353     canvas.before:
          354         Color:
          355             rgba: (0.192, .498, 0.745, 1) if self.state == 'down' else (0.3, 0.3, 0.3, 0)
          356         Rectangle:
          357             size: self.size
          358             pos: self.pos
          359     on_release:
          360         Clock.schedule_once(self.action)
          361     Widget
          362     TopLabel:
          363         id: title
          364         text: self.parent.title
          365         bold: True
          366         halign: 'left'
          367     TopLabel:
          368         text: self.parent.description
          369         color: 0.8, 0.8, 0.8, 1
          370         halign: 'left'
          371     Widget
          372 
          373 
          374 
          375 
          376 <ScreenTabs@Screen>
          377     TabbedCarousel:
          378         id: panel
          379         tab_height: '48dp'
          380         tab_width: panel.width/3
          381         strip_border: 0, 0, 0, 0
          382         SendScreen:
          383             id: send_screen
          384             tab: send_tab
          385         HistoryScreen:
          386             id: history_screen
          387             tab: history_tab
          388         ReceiveScreen:
          389             id: receive_screen
          390             tab: receive_tab
          391         CleanHeader:
          392             id: send_tab
          393             text: _('Send')
          394             slide: 0
          395         CleanHeader:
          396             id: history_tab
          397             text: _('History')
          398             slide: 1
          399         CleanHeader:
          400             id: receive_tab
          401             text: _('Receive')
          402             slide: 2
          403 
          404 
          405 <ActionOvrButton@ActionButton>
          406     #on_release:
          407         # fixme: the following line was commented out because it does not seem to do what it is intended
          408         # Clock.schedule_once(lambda dt: self.parent.parent.dismiss() if self.parent else None, 0.05)
          409     on_press:
          410         Clock.schedule_once(lambda dt: app.popup_dialog(self.name), 0.05)
          411         self.state = 'normal'
          412 
          413 
          414 BoxLayout:
          415     orientation: 'vertical'
          416 
          417     canvas.before:
          418         Color:
          419             rgb: .6, .6, .6
          420         Rectangle:
          421             size: self.size
          422             source: f'{KIVY_GUI_PATH}/data/background.png'
          423 
          424     ActionBar:
          425 
          426         ActionView:
          427             id: av
          428             ActionPrevious:
          429                 with_previous: False
          430                 size_hint: None, None
          431                 size: 0, 0
          432 
          433             ActionButton:
          434                 size_hint_x: None
          435                 text: app.wallet_name
          436                 bold: True
          437                 color: 0.7, 0.7, 0.7, 1
          438                 font_size: '22dp'
          439                 on_release:
          440                     Clock.schedule_once(lambda dt: app.popup_dialog('status'), 0.05)
          441                     self.state = 'normal'
          442 
          443             ActionButton:
          444                 size_hint_x: 0.8
          445                 text: ''
          446                 opacity:0
          447 
          448             ActionOverflow:
          449                 id: ao
          450                 size_hint_x: 0.2
          451                 ActionOvrButton:
          452                     name: 'about'
          453                     text: _('About')
          454                 ActionOvrButton:
          455                     name: 'wallets'
          456                     text: _('Wallets')
          457                 ActionOvrButton:
          458                     name: 'network'
          459                     text: _('Network')
          460                 ActionOvrButton:
          461                     name: 'addresses_dialog'
          462                     text: _('Addresses')
          463                 ActionOvrButton:
          464                     name: 'lightning_channels_dialog'
          465                     text: _('Channels')
          466                 ActionOvrButton:
          467                     name: 'settings'
          468                     text: _('Settings')
          469                     on_parent:
          470                         # when widget overflow drop down is shown, adjust the width
          471                         parent = args[1]
          472                         if parent: ao._dropdown.width = sp(200)
          473 
          474     ScreenManager:
          475         id: manager
          476         ScreenTabs:
          477             id: tabs