Browse Source

kivy: move wallets dialog

283
ThomasV 9 years ago
parent
commit
ee4ccd9b1b
  1. 12
      gui/kivy/main_window.py
  2. 28
      gui/kivy/uix/dialogs/wallets.py
  3. 4
      gui/kivy/uix/screens.py
  4. 6
      gui/kivy/uix/ui_screens/status.kv

12
gui/kivy/main_window.py

@ -332,10 +332,6 @@ class ElectrumWindow(App):
d = LabelDialog(_('Enter wallet name'), '', f)
d.open()
def settings_dialog(self):
from uix.dialogs.settings import SettingsDialog
d = SettingsDialog(self)
d.open()
def on_stop(self):
self.stop_wallet()
@ -395,7 +391,13 @@ class ElectrumWindow(App):
def popup_dialog(self, name):
if name == 'settings':
self.settings_dialog()
from uix.dialogs.settings import SettingsDialog
d = SettingsDialog(self)
d.open()
elif name == 'wallets':
from uix.dialogs.wallets import WalletDialog
d = WalletDialog()
d.open()
else:
popup = Builder.load_file('gui/kivy/uix/ui_screens/'+name+'.kv')
popup.open()

28
gui/kivy/uix/ui_screens/wallets.kv → gui/kivy/uix/dialogs/wallets.py

@ -1,6 +1,17 @@
#:import os os
from kivy.app import App
from kivy.factory import Factory
from kivy.properties import ObjectProperty
from kivy.lang import Builder
from electrum.i18n import _
from electrum.util import base_units
Popup:
import os
from label_dialog import LabelDialog
Builder.load_string('''
#:import os os
<WalletDialog@Popup>:
title: _('Wallets')
id: popup
path: app.wallet.storage.path
@ -22,7 +33,7 @@ Popup:
size_hint_y: None
text: os.path.basename(app.wallet.storage.path)
on_release:
app.create_wallet_dialog(self)
root.name_dialog()
on_text:
popup.path = os.path.join(wallet_selector.path, self.text)
Widget
@ -35,6 +46,7 @@ Popup:
size_hint_y: 0.5
Widget
size_hint_y: 0.1
GridLayout:
cols: 2
size_hint_y: None
@ -52,3 +64,13 @@ Popup:
on_release:
popup.dismiss()
app.load_wallet_by_name(popup.path)
''')
class WalletDialog(Factory.Popup):
def name_dialog(self):
def cb(text):
if text:
self.ids.wallet_name.text = text
d = LabelDialog(_('Enter wallet name'), '', cb)
d.open()

4
gui/kivy/uix/screens.py

@ -337,7 +337,7 @@ class ReceiveScreen(CScreen):
req = self.app.wallet.make_payment_request(addr, amount, message, None)
self.app.wallet.add_payment_request(req, self.app.electrum_config)
self.app.show_error(_('Request saved'))
self.app.update_screen('requests')
self.app.update_tab('requests')
def do_new(self):
self.app.receive_address = None
@ -405,7 +405,7 @@ class InvoicesScreen(CScreen):
def do_delete(self, obj):
self.app.invoices.remove(obj.key)
self.app.update_screen('invoices')
self.app.update_tab('invoices')
class RequestsScreen(CScreen):
kvname = 'requests'

6
gui/kivy/uix/ui_screens/status.kv

@ -1,3 +1,5 @@
#:import os os
Popup:
title: "Balance"
confirmed: 0
@ -10,6 +12,10 @@ Popup:
spacing: '1dp'
GridLayout:
cols:2
Label:
text: _("Wallet:")
Label:
text: os.path.basename(app.wallet.storage.path)
Label:
text: _("Confirmed:")
Label:

Loading…
Cancel
Save