1#:import _ electrum.gui.kivy.i18n._
2#:import KIVY_GUI_PATH electrum.gui.kivy.KIVY_GUI_PATH
3#:import pr_color electrum.invoices.pr_color
4#:import PR_UNKNOWN electrum.invoices.PR_UNKNOWN
5#:import Factory kivy.factory.Factory
6#:import Decimal decimal.Decimal
7#:set btc_symbol chr(171)
8#:set mbtc_symbol chr(187)
9#:set font_light f'{KIVY_GUI_PATH}/data/fonts/Roboto-Condensed.ttf'
10
11<PaymentLabel@Label>
12    #color: .305, .309, .309, 1
13    text_size: self.width, None
14    halign: 'left'
15    valign: 'top'
16
17<PaymentItem@CardItem>
18    key: ''
19    address: ''
20    memo: ''
21    amount: ''
22    status: PR_UNKNOWN
23    status_str: ''
24    date: ''
25    BoxLayout:
26        spacing: '8dp'
27        height: '32dp'
28        orientation: 'vertical'
29        Widget
30        PaymentLabel:
31            text: root.memo
32            shorten: True
33            shorten_from: 'right'
34        Widget
35        PaymentLabel:
36            text: root.address
37            color: .699, .699, .699, 1
38            font_size: '13sp'
39            shorten: True
40        Widget
41    BoxLayout:
42        spacing: '8dp'
43        height: '32dp'
44        orientation: 'vertical'
45        Widget
46        PaymentLabel:
47            text: root.amount
48            halign: 'right'
49            font_size: '15sp'
50        Widget
51        PaymentLabel:
52            text: root.status_str
53            halign: 'right'
54            font_size: '13sp'
55            color: pr_color[root.status]
56        Widget
57
58<PaymentRecycleView>:
59    viewclass: 'PaymentItem'
60    RecycleBoxLayout:
61        default_size: None, dp(56)
62        default_size_hint: 1, None
63        size_hint: 1, None
64        height: self.minimum_height
65        orientation: 'vertical'
66
67<SendScreen>:
68    id: s
69    name: 'send'
70    address: ''
71    amount: ''
72    message: ''
73    is_bip70: False
74    is_lightning: False
75    is_locked: self.is_lightning or self.is_bip70
76    BoxLayout
77        padding: '12dp', '12dp', '12dp', '12dp'
78        spacing: '12dp'
79        orientation: 'vertical'
80        SendReceiveBlueBottom:
81            id: blue_bottom
82            size_hint: 1, None
83            height: self.minimum_height
84            BoxLayout:
85                size_hint: 1, None
86                height: blue_bottom.item_height
87                spacing: '5dp'
88                Image:
89                    source: f'atlas://{KIVY_GUI_PATH}/theming/atlas/light/lightning' if root.is_lightning else f'atlas://{KIVY_GUI_PATH}/theming/atlas/light/globe'
90                    size_hint: None, None
91                    size: '22dp', '22dp'
92                    pos_hint: {'center_y': .5}
93                BlueButton:
94                    id: payto_e
95                    text: s.address if s.address else _('Recipient')
96                    shorten: True
97                    on_release: Clock.schedule_once(lambda dt: app.show_info(_('Copy and paste the recipient address using the Paste button, or use the camera to scan a QR code.')))
98                    #on_release: Clock.schedule_once(lambda dt: app.popup_dialog('contacts'))
99            CardSeparator:
100                color: blue_bottom.foreground_color
101            BoxLayout:
102                size_hint: 1, None
103                height: blue_bottom.item_height
104                spacing: '5dp'
105                Image:
106                    source: f'atlas://{KIVY_GUI_PATH}/theming/atlas/light/calculator'
107                    opacity: 0.7
108                    size_hint: None, None
109                    size: '22dp', '22dp'
110                    pos_hint: {'center_y': .5}
111                BlueButton:
112                    id: amount_e
113                    default_text: _('Amount')
114                    text: s.amount if s.amount else _('Amount')
115                    disabled: root.is_bip70 or (root.is_lightning and s.amount)
116                    on_release: Clock.schedule_once(lambda dt: app.amount_dialog(s, not root.is_lightning))
117            CardSeparator:
118                color: blue_bottom.foreground_color
119            BoxLayout:
120                id: message_selection
121                size_hint: 1, None
122                height: blue_bottom.item_height
123                spacing: '5dp'
124                Image:
125                    source: f'atlas://{KIVY_GUI_PATH}/theming/atlas/light/pen'
126                    size_hint: None, None
127                    size: '22dp', '22dp'
128                    pos_hint: {'center_y': .5}
129                BlueButton:
130                    id: description
131                    text: s.message if s.message else (_('No Description') if root.is_locked else _('Description'))
132                    disabled: root.is_locked
133                    on_release: Clock.schedule_once(lambda dt: app.description_dialog(s))
134        BoxLayout:
135            size_hint: 1, None
136            height: '48dp'
137            IconButton:
138                size_hint: 0.5, 1
139                on_release: s.do_save()
140                icon: f'atlas://{KIVY_GUI_PATH}/theming/atlas/light/save'
141            IconButton:
142                size_hint: 0.5, 1
143                on_release: s.do_clear()
144                icon: f'atlas://{KIVY_GUI_PATH}/theming/atlas/light/closebutton'
145            IconButton:
146                size_hint: 0.5, 1
147                icon: f'atlas://{KIVY_GUI_PATH}/theming/atlas/light/copy'
148                on_release: s.do_paste()
149            Button:
150                id: qr
151                text:_('Scan')
152                size_hint: 1, 1
153                on_release: Clock.schedule_once(lambda dt: app.scan_qr(on_complete=app.on_qr))
154            Button:
155                text: _('Pay')
156                size_hint: 1, 1
157                on_release: s.do_pay()
158        Widget:
159            size_hint: 1, 0.1
160        PaymentRecycleView:
161            id: payments_container
162            scroll_type: ['bars', 'content']
163            bar_width: '25dp'
164