-WIP-electrum-btcp/gui/kivy/main.kv

465 lines
14 KiB
Plaintext
Raw Normal View History

#:import Window kivy.core.window.Window
#:import _ electrum.i18n._
#:import partial functools.partial
# Custom Global Widgets
<VGridLayout@GridLayout>:
rows: 1
size_hint: 1, None
height: self.minimum_height
<IconButton@ButtonBehavior+Image>
allow_stretch: True
size_hint_x: None
width: self.height
canvas:
BorderImage:
border: (10, 10, 10, 10)
source:
'atlas://gui/kivy/theming/light/' + ('tab_btn'\
if root.state == 'normal' else 'icon_border')
size: root.size
pos: root.pos
###########################
## Gloabal Defaults
###########################
<Label>
markup: True
font_name: 'data/fonts/Roboto.ttf'
font_size: '16sp'
<ListItemButton>
font_size: '12sp'
#########################
# Dialogs
#########################
################################################
## Create Dialogs
################################################
<CreateAccountTextInput@TextInput>
border: 4, 4, 4, 4
font_size: '15sp'
padding: '15dp', '15dp'
background_color: (1, 1, 1, 1) if self.focus else (0.454, 0.698, 0.909, 1)
foreground_color: (0.31, 0.31, 0.31, 1) if self.focus else (0.835, 0.909, 0.972, 1)
hint_text_color: self.foreground_color
background_active: 'atlas://gui/kivy/theming/light/create_act_text_active'
background_normal: 'atlas://gui/kivy/theming/light/create_act_text_active'
size_hint_y: None
height: '48sp'
<CreateAccountButtonBlue@Button>
canvas.after:
Color
rgba: 1, 1, 1, 1 if self.disabled else 0
Rectangle:
texture: self.texture
size: self.size
pos: self.pos
Color
rgba: .5, .5, .5, .5 if self.disabled else 0
Rectangle:
texture: self.texture
size: self.size
pos: self.x - dp(1), self.y + dp(1)
border: 15, 5, 5, 5
background_color: (1, 1, 1, 1) if self.disabled else (.203, .490, .741, 1 if self.state == 'normal' else .75)
size_hint: 1, None
height: '48sp'
text_size: self.size
halign: 'center'
valign: 'middle'
background_normal: 'atlas://gui/kivy/theming/light/btn_create_account'
background_down: 'atlas://gui/kivy/theming/light/btn_create_account'
background_disabled_normal: 'atlas://gui/kivy/theming/light/btn_create_act_disabled'
on_release: self.root.dispatch('on_press', self)
on_release: self.root.dispatch('on_release', self)
<CreateAccountButtonGreen@CreateAccountButtonBlue>
background_color: (1, 1, 1, 1) if self.disabled else (.415, .717, 0, 1 if self.state == 'normal' else .75)
<InfoBubble>
canvas.before:
Color:
rgba: 0, 0, 0, .7 if root.dim_background else 0
Rectangle:
size: Window.size
size_hint: None, None
width: '270dp' if root.fs else min(self.width, dp(270))
height: self.width if self.fs else (lbl.texture_size[1] + dp(27))
BoxLayout:
padding: '5dp'
Widget:
size_hint: None, 1
width: '4dp' if root.fs else '2dp'
Image:
id: img
source: root.icon
mipmap: True
size_hint: None, 1
width: (root.width - dp(20)) if root.fs else (0 if not root.icon else '32dp')
Widget:
size_hint_x: None
width: '5dp'
Label:
id: lbl
markup: True
font_size: '12sp'
text: root.message
text_size: self.width, None
valign: 'middle'
size_hint: 1, 1
width: 0 if root.fs else (root.width - img.width)
<-CreateAccountDialog>
text_color: .854, .925, .984, 1
auto_dismiss: False
size_hint: None, None
canvas.before:
Color:
rgba: 0, 0, 0, .9
Rectangle:
size: Window.size
Color:
rgba: .239, .588, .882, 1
Rectangle:
size: Window.size
crcontent: crcontent
# add electrum icon
FloatLayout:
size_hint: None, None
size: 0, 0
IconButton:
id: but_close
size_hint: None, None
size: '27dp', '27dp'
top: Window.height - dp(10)
right: Window.width - dp(10)
source: 'atlas://gui/kivy/theming/light/closebutton'
on_release: root.dispatch('on_press', self)
on_release: root.dispatch('on_release', self)
BoxLayout:
orientation: 'vertical' if self.width < self.height else 'horizontal'
padding:
min(dp(42), self.width/8), min(dp(60), self.height/9.7),\
min(dp(42), self.width/8), min(dp(72), self.height/8)
spacing: '27dp'
GridLayout:
id: grid_logo
cols: 1
pos_hint: {'center_y': .5}
size_hint: 1, .62
#height: self.minimum_height
Image:
id: logo_img
mipmap: True
allow_stretch: True
size_hint: 1, None
height: '110dp'
source: 'atlas://gui/kivy/theming/light/electrum_icon640'
Widget:
size_hint: 1, None
height: 0 if stepper.opacity else dp(15)
Label:
color: root.text_color
opacity: 0 if stepper.opacity else 1
text: 'ELECTRUM'
size_hint: 1, None
height: self.texture_size[1] if self.opacity else 0
font_size: '33sp'
font_name: 'data/fonts/tron/Tr2n.ttf'
Image:
id: stepper
allow_stretch: True
opacity: 0
source: 'atlas://gui/kivy/theming/light/stepper_left'
size_hint: 1, None
height: grid_logo.height/2.5 if self.opacity else 0
Widget:
size_hint: None, None
size: '5dp', '5dp'
GridLayout:
cols: 1
id: crcontent
spacing: '13dp'
<CreateRestoreDialog>
Label:
color: root.text_color
size_hint: 1, None
text_size: self.width, None
height: self.texture_size[1]
text:
_("Wallet file not found!!")+\
"\n\n" + _("Do you want to create a new wallet ")+\
_("or restore an existing one?")
Widget
size_hint: 1, None
height: dp(15)
GridLayout:
id: grid
orientation: 'vertical'
cols: 1
spacing: '14dp'
size_hint: 1, None
height: self.minimum_height
CreateAccountButtonGreen:
id: create
text: _('Create a Wallet')
root: root
CreateAccountButtonBlue:
id: restore
text: _('I already have a wallet')
root: root
#CreateAccountButtonBlue:
# id: watching
# text: _('Create a Watching only wallet')
# root: root
<RestoreSeedDialog>
GridLayout
# leave room for future selection of gap through a widget
# removed for mobile
id: text_input_gap
text: '5'
cols: 1
padding: 0, '12dp'
orientation: 'vertical'
spacing: '12dp'
size_hint: 1, None
height: self.minimum_height
CreateAccountTextInput:
id: text_input_seed
size_hint: 1, None
height: '110dp'
hint_text:
_('Enter your seedphrase')
Label:
font_size: '12sp'
text_size: self.width, None
size_hint: 1, None
height: self.texture_size[1]
halign: 'justify'
valign: 'middle'
text:
_('If you need additional information, please check '
'[color=#0000ff][ref=1]'
'https://electrum.org/faq.html#seed[/ref][/color]')
on_ref_press:
import webbrowser
webbrowser.open('https://electrum.org/faq.html#seed')
GridLayout:
rows: 1
spacing: '12dp'
size_hint: 1, None
height: self.minimum_height
CreateAccountButtonBlue:
id: back
text: _('Back')
root: root
CreateAccountButtonGreen:
id: next
text: _('Next')
root: root
<InitSeedDialog>
spacing: '12dp'
GridLayout:
id: grid
cols: 1
pos_hint: {'center_y': .5}
size_hint_y: None
height: dp(180)
orientation: 'vertical'
Button:
border: 4, 4, 4, 4
halign: 'justify'
valign: 'middle'
font_size: self.width/21
text_size: self.width - dp(24), self.height - dp(12)
#size_hint: 1, None
#height: self.texture_size[1] + dp(24)
background_normal: 'atlas://gui/kivy/theming/light/white_bg_round_top'
background_down: self.background_normal
text: root.message
GridLayout:
rows: 1
size_hint: 1, .7
#size_hint_y: None
#height: but_seed.texture_size[1] + dp(24)
Button:
id: but_seed
border: 4, 4, 4, 4
halign: 'justify'
valign: 'middle'
font_size: self.width/15
text: root.seed_msg
text_size: self.width - dp(24), self.height - dp(12)
background_normal: 'atlas://gui/kivy/theming/light/lightblue_bg_round_lb'
background_down: self.background_normal
Button:
id: bt
size_hint_x: .25
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:
GridLayout:
rows: 1
spacing: '12dp'
size_hint: 1, None
height: self.minimum_height
CreateAccountButtonBlue:
id: back
text: _('Back')
root: root
CreateAccountButtonGreen:
id: confirm
text: _('Confirm')
root: root
<ChangePasswordDialog>
padding: '7dp'
GridLayout:
size_hint_y: None
height: self.minimum_height
cols: 1
CreateAccountTextInput:
id: ti_wallet_name
hint_text: 'Your Wallet Name'
multiline: False
on_text_validate:
next = ti_new_password if ti_password.disabled else ti_password
next.focus = True
Widget:
size_hint_y: None
height: '13dp'
CreateAccountTextInput:
id: ti_password
hint_text: 'Enter old pincode'
size_hint_y: None
height: 0 if self.disabled else '38sp'
password: True
disabled: True if root.mode in ('new', 'create', 'restore') else False
opacity: 0 if self.disabled else 1
multiline: False
on_text_validate:
#root.validate_old_password()
ti_new_password.focus = True
Widget:
size_hint_y: None
height: 0 if ti_password.disabled else '13dp'
CreateAccountTextInput:
id: ti_new_password
hint_text: 'Enter new pincode'
multiline: False
password: True
on_text_validate: ti_confirm_password.focus = True
Widget:
size_hint_y: None
height: '13dp'
CreateAccountTextInput:
id: ti_confirm_password
hint_text: 'Confirm pincode'
password: True
multiline: False
on_text_validate: root.validate_new_password()
Widget
GridLayout:
rows: 1
spacing: '12dp'
size_hint: 1, None
height: self.minimum_height
CreateAccountButtonBlue:
id: back
text: _('Back')
root: root
disabled: True if root.mode[0] == 'r' else self.disabled
CreateAccountButtonGreen:
id: next
text: _('Confirm') if root.mode[0] == 'r' else _('Next')
root: root
###############################################
## Wallet Management
###############################################
<WalletManagement@ScrollView>
canvas.before:
Color:
rgba: .145, .145, .145, 1
Rectangle:
size: root.size
pos: root.pos
VGridLayout:
Wallets:
id: wallets_section
Plugins:
id: plugins_section
Commands:
id: commands_section
<WalletManagementItem@BoxLayout>
<Header@WalletManagementItem>
<Wallets@VGridLayout>
Header
<Plugins@VGridLayout>
Header
<Commands@VGridLayout>
Header
################################################
## This is our Root Widget of the app
################################################
StencilView
manager: manager
Drawer
id: drawer
size: root.size
WalletManagement
id: wallet_management
canvas.before:
Color:
rgba: .176, .176, .176, 1
Rectangle:
size: self.size
pos: self.pos
canvas.after:
Color
rgba: 1, 1, 1, 1
BorderImage
border: 0, 32, 0, 0
source: 'atlas://gui/kivy/theming/light/shadow_right'
pos: self.pos
size: self.size
width:
(root.width * .877) if app.ui_mode[0] == 'p'\
else root.width * .35 if app.orientation[0] == 'l'\
else root.width * .10
height: root.height
ScreenManager:
id: manager
x: wallet_management.width if app.ui_mode[0] == 't' else 0
size: root.size
canvas.before:
Color
rgba: 1, 1, 1, 1
BorderImage:
border: 2, 2, 2, 23
size: self.size
pos: self.x, self.y