kivy: various small fixes
This commit is contained in:
parent
f30149ad49
commit
cd0ab62cae
|
@ -187,18 +187,6 @@
|
||||||
size: self.size
|
size: self.size
|
||||||
pos: self.pos
|
pos: self.pos
|
||||||
|
|
||||||
<xxCardItem@ToggleButtonBehavior+GridLayout>
|
|
||||||
canvas.before:
|
|
||||||
Color:
|
|
||||||
rgba: 0.192, .498, 0.745, 1 if self.state == 'down' else 0
|
|
||||||
Rectangle
|
|
||||||
size: self.size
|
|
||||||
pos: self.x, self.y + dp(5)
|
|
||||||
padding: '2dp', '2dp'
|
|
||||||
spacing: '2dp'
|
|
||||||
height: self.minimum_height
|
|
||||||
|
|
||||||
|
|
||||||
<CardItem@ToggleButtonBehavior+BoxLayout>
|
<CardItem@ToggleButtonBehavior+BoxLayout>
|
||||||
size_hint: 1, None
|
size_hint: 1, None
|
||||||
height: '65dp'
|
height: '65dp'
|
||||||
|
|
|
@ -205,8 +205,8 @@ class ElectrumWindow(App):
|
||||||
def on_pr(self, pr):
|
def on_pr(self, pr):
|
||||||
if pr.verify(self.contacts):
|
if pr.verify(self.contacts):
|
||||||
key = self.invoices.add(pr)
|
key = self.invoices.add(pr)
|
||||||
|
self.invoices_screen.update()
|
||||||
status = self.invoices.get_status(key)
|
status = self.invoices.get_status(key)
|
||||||
#self.invoices_screen.update()
|
|
||||||
if status == PR_PAID:
|
if status == PR_PAID:
|
||||||
self.show_error("invoice already paid")
|
self.show_error("invoice already paid")
|
||||||
self.send_screen.do_clear()
|
self.send_screen.do_clear()
|
||||||
|
@ -214,7 +214,7 @@ class ElectrumWindow(App):
|
||||||
if pr.has_expired():
|
if pr.has_expired():
|
||||||
self.show_error(_('Payment request has expired'))
|
self.show_error(_('Payment request has expired'))
|
||||||
else:
|
else:
|
||||||
self.current_pr = pr
|
self.current_invoice = pr
|
||||||
self.update_screen('send')
|
self.update_screen('send')
|
||||||
send_tab = self.tabs.ids.send_tab
|
send_tab = self.tabs.ids.send_tab
|
||||||
self.tabs.ids.panel.switch_to(send_tab)
|
self.tabs.ids.panel.switch_to(send_tab)
|
||||||
|
@ -521,6 +521,9 @@ class ElectrumWindow(App):
|
||||||
def format_amount(self, x, is_diff=False, whitespaces=False):
|
def format_amount(self, x, is_diff=False, whitespaces=False):
|
||||||
return format_satoshis(x, is_diff, 0, self.decimal_point(), whitespaces)
|
return format_satoshis(x, is_diff, 0, self.decimal_point(), whitespaces)
|
||||||
|
|
||||||
|
def format_amount_and_units(self, x):
|
||||||
|
return format_satoshis_plain(x, self.decimal_point()) + ' ' + self.base_unit
|
||||||
|
|
||||||
@profiler
|
@profiler
|
||||||
def update_wallet(self, *dt):
|
def update_wallet(self, *dt):
|
||||||
self._trigger_update_status()
|
self._trigger_update_status()
|
||||||
|
@ -717,6 +720,9 @@ class ElectrumWindow(App):
|
||||||
popup.tx_hash = obj.tx_hash
|
popup.tx_hash = obj.tx_hash
|
||||||
popup.open()
|
popup.open()
|
||||||
|
|
||||||
|
def address_dialog(self, screen):
|
||||||
|
pass
|
||||||
|
|
||||||
def amount_dialog(self, screen, show_max):
|
def amount_dialog(self, screen, show_max):
|
||||||
popup = Builder.load_file('gui/kivy/uix/ui_screens/amount.kv')
|
popup = Builder.load_file('gui/kivy/uix/ui_screens/amount.kv')
|
||||||
but_max = popup.ids.but_max
|
but_max = popup.ids.but_max
|
||||||
|
|
|
@ -205,8 +205,7 @@ class SendScreen(CScreen):
|
||||||
self.screen.message = uri.get('message', '')
|
self.screen.message = uri.get('message', '')
|
||||||
amount = uri.get('amount')
|
amount = uri.get('amount')
|
||||||
if amount:
|
if amount:
|
||||||
amount_str = str( Decimal(amount) / pow(10, self.app.decimal_point()))
|
self.screen.amount = self.format_amount_and_units(amount)
|
||||||
self.screen.amount = amount_str + ' ' + self.app.base_unit
|
|
||||||
|
|
||||||
def update(self):
|
def update(self):
|
||||||
if self.app.current_invoice:
|
if self.app.current_invoice:
|
||||||
|
@ -221,7 +220,7 @@ class SendScreen(CScreen):
|
||||||
def set_request(self, pr):
|
def set_request(self, pr):
|
||||||
self.payment_request = pr
|
self.payment_request = pr
|
||||||
self.screen.address = pr.get_requestor()
|
self.screen.address = pr.get_requestor()
|
||||||
self.screen.amount = self.app.format_amount(pr.get_amount())
|
self.screen.amount = self.app.format_amount_and_units(pr.get_amount())
|
||||||
self.screen.message = pr.get_memo()
|
self.screen.message = pr.get_memo()
|
||||||
|
|
||||||
def do_paste(self):
|
def do_paste(self):
|
||||||
|
@ -289,8 +288,7 @@ class ReceiveScreen(CScreen):
|
||||||
req = self.app.wallet.receive_requests.get(addr)
|
req = self.app.wallet.receive_requests.get(addr)
|
||||||
if req:
|
if req:
|
||||||
self.screen.message = req.get('memo')
|
self.screen.message = req.get('memo')
|
||||||
self.screen.amount = self.app.format_amount(req.get('amount')) + ' ' + self.app.base_unit
|
self.screen.amount = self.app.format_amount_and_units(req.get('amount'))
|
||||||
|
|
||||||
|
|
||||||
def amount_callback(self, popup):
|
def amount_callback(self, popup):
|
||||||
amount_label = self.screen.ids.get('amount')
|
amount_label = self.screen.ids.get('amount')
|
||||||
|
@ -378,7 +376,7 @@ class InvoicesScreen(CScreen):
|
||||||
ci.key = pr.get_id()
|
ci.key = pr.get_id()
|
||||||
ci.requestor = pr.get_requestor()
|
ci.requestor = pr.get_requestor()
|
||||||
ci.memo = pr.memo
|
ci.memo = pr.memo
|
||||||
ci.amount = self.app.format_amount(pr.get_amount())
|
ci.amount = self.app.format_amount_and_units(pr.get_amount())
|
||||||
#ci.status = self.invoices.get_status(key)
|
#ci.status = self.invoices.get_status(key)
|
||||||
exp = pr.get_expiration_date()
|
exp = pr.get_expiration_date()
|
||||||
ci.date = format_time(exp) if exp else _('Never')
|
ci.date = format_time(exp) if exp else _('Never')
|
||||||
|
@ -413,7 +411,7 @@ class RequestsScreen(CScreen):
|
||||||
ci.address = req['address']
|
ci.address = req['address']
|
||||||
ci.memo = req.get('memo', '')
|
ci.memo = req.get('memo', '')
|
||||||
#ci.status = req.get('status')
|
#ci.status = req.get('status')
|
||||||
ci.amount = self.app.format_amount(amount) if amount else ''
|
ci.amount = self.app.format_amount_and_units(amount) if amount else ''
|
||||||
ci.date = format_time(timestamp)
|
ci.date = format_time(timestamp)
|
||||||
ci.screen = self
|
ci.screen = self
|
||||||
requests_list.add_widget(ci)
|
requests_list.add_widget(ci)
|
||||||
|
|
|
@ -32,10 +32,10 @@ SendScreen:
|
||||||
size_hint: None, None
|
size_hint: None, None
|
||||||
size: '22dp', '22dp'
|
size: '22dp', '22dp'
|
||||||
pos_hint: {'center_y': .5}
|
pos_hint: {'center_y': .5}
|
||||||
TextInputBlue:
|
AmountButton:
|
||||||
id: payto_e
|
id: payto_e
|
||||||
text: s.address
|
text: s.address if s.address else _('Recipient')
|
||||||
hint_text: "Recipient"
|
on_release: app.address_dialog(s)
|
||||||
CardSeparator:
|
CardSeparator:
|
||||||
opacity: message_selection.opacity
|
opacity: message_selection.opacity
|
||||||
color: blue_bottom.foreground_color
|
color: blue_bottom.foreground_color
|
||||||
|
@ -49,7 +49,7 @@ SendScreen:
|
||||||
pos_hint: {'center_y': .5}
|
pos_hint: {'center_y': .5}
|
||||||
AmountButton:
|
AmountButton:
|
||||||
id: amount_e
|
id: amount_e
|
||||||
text: s.amount if s.amount else 'Amount'
|
text: s.amount if s.amount else _('Amount')
|
||||||
on_release: app.amount_dialog(s, True)
|
on_release: app.amount_dialog(s, True)
|
||||||
|
|
||||||
CardSeparator:
|
CardSeparator:
|
||||||
|
@ -68,7 +68,7 @@ SendScreen:
|
||||||
pos_hint: {'center_y': .5}
|
pos_hint: {'center_y': .5}
|
||||||
TextInputBlue:
|
TextInputBlue:
|
||||||
id: message_e
|
id: message_e
|
||||||
hint_text: 'Description'
|
hint_text: _('Description')
|
||||||
text: s.message
|
text: s.message
|
||||||
on_text_validate: s.message = self.text
|
on_text_validate: s.message = self.text
|
||||||
BoxLayout:
|
BoxLayout:
|
||||||
|
|
Loading…
Reference in New Issue