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