electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit 84ac33f589011bcc5aebf31a65d5f4d419034bf6
parent 51ca7a056b62b551e16d4103ccc95a38d1fe5481
Author: ThomasV <thomasv@electrum.org>
Date:   Fri,  5 Feb 2016 18:16:48 +0100

kivy: switch to send screen if a URI is passed

Diffstat:
Mgui/kivy/main.kv | 1-
Mgui/kivy/main_window.py | 35+++++++++++++++++++++++++----------
Mgui/kivy/uix/screens.py | 1-
3 files changed, 25 insertions(+), 12 deletions(-)

diff --git a/gui/kivy/main.kv b/gui/kivy/main.kv @@ -190,7 +190,6 @@ id: panel tab_height: '48dp' tab_width: panel.width/3 - default_tab: history_tab strip_border: 0, 0, 0, 0 InvoicesScreen: id: invoices_screen diff --git a/gui/kivy/main_window.py b/gui/kivy/main_window.py @@ -158,7 +158,7 @@ class ElectrumWindow(App): :data:`ui_mode` is a read only `AliasProperty` Defaults to 'phone' ''' - url = StringProperty('', allownone=True) + uri = StringProperty('', allownone=True) ''' ''' @@ -193,11 +193,7 @@ class ElectrumWindow(App): self.contacts = Contacts(self.electrum_config) self.invoices = InvoiceStore(self.electrum_config) - self.bind(url=self.set_URI) - # were we sent a url? - url = self.electrum_config.get('url', None) - if url: - self.set_URI(url) + self.bind(uri=self.on_uri) # create triggers so as to minimize updation a max of 2 times a sec self._trigger_update_wallet =\ @@ -217,7 +213,8 @@ class ElectrumWindow(App): def on_pr(self, pr): if pr.verify(self.contacts): key = self.invoices.add(pr) - self.invoices_screen.update() + if self.invoices_screen: + self.invoices_screen.update() status = self.invoices.get_status(key) if status == PR_PAID: self.show_error("invoice already paid") @@ -241,6 +238,11 @@ class ElectrumWindow(App): return self.send_screen.set_URI(url) + def on_uri(self, instance, uri): + if uri: + Logger.info("on uri:", uri) + self.switch_to('send') + self.set_URI(uri) def update_tab(self, name): s = getattr(self, name + '_screen', None) @@ -253,8 +255,13 @@ class ElectrumWindow(App): self.update_tab(tab) def switch_to(self, name): + s = getattr(self, name + '_screen', None) + if self.send_screen is None: + s = self.tabs.ids[name + '_screen'] + s.load_screen() + panel = self.tabs.ids.panel tab = self.tabs.ids[name + '_tab'] - self.tabs.ids.panel.switch_to(tab) + panel.switch_to(tab) def show_request(self, addr): self.receive_address = addr @@ -310,11 +317,15 @@ class ElectrumWindow(App): 'gui/kivy/data/fonts/Roboto-Bold.ttf') win.softinput_mode = 'below_target' - self.on_size(win, win.size) self.init_ui() self.load_wallet_by_name(self.electrum_config.get_wallet_path()) + # init plugins run_hook('init_kivy', self) + # were we sent a url? + self.uri = self.electrum_config.get('url') + # default tab + self.switch_to('send' if self.uri else 'history') def load_wallet_by_name(self, wallet_path): if not wallet_path: @@ -405,9 +416,13 @@ class ElectrumWindow(App): # load and focus the ui self.root.manager = self.root.ids['manager'] - self.recent_activity_card = None + self.history_screen = None self.contacts_screen = None + self.send_screen = None + self.invoices_screen = None + self.receive_screen = None + self.requests_screen = None self.icon = "icons/electrum.png" diff --git a/gui/kivy/uix/screens.py b/gui/kivy/uix/screens.py @@ -468,7 +468,6 @@ class TabbedCarousel(Factory.TabbedPanel): scroll_x = 0 else: scroll_x = 1. * (n - idx - 1) / (n - 1) - mation = Factory.Animation(scroll_x=scroll_x, d=.25) mation.cancel_all(scrlv) mation.start(scrlv)