Browse Source

kivy: fix datetime, cleanup

283
ThomasV 9 years ago
parent
commit
f8ccf3cd37
  1. 20
      gui/kivy/main_window.py
  2. 24
      gui/kivy/uix/screens.py

20
gui/kivy/main_window.py

@ -379,28 +379,12 @@ class ElectrumWindow(App):
#setup lazy imports for mainscreen
Factory.register('AnimatedPopup',
module='electrum_gui.kivy.uix.dialogs')
#Factory.register('TabbedCarousel',
# module='electrum_gui.kivy.uix.screens')
Factory.register('ScreenDashboard',
module='electrum_gui.kivy.uix.screens')
#Factory.register('EffectWidget',
# module='electrum_gui.kivy.uix.effectwidget')
Factory.register('QRCodeWidget',
module='electrum_gui.kivy.uix.qrcodewidget')
Factory.register('MainScreen',
module='electrum_gui.kivy.uix.screens')
Factory.register('CSpinner',
module='electrum_gui.kivy.uix.screens')
# preload widgets. Remove this if you want to load the widgets on demand
Cache.append('electrum_widgets', 'AnimatedPopup', Factory.AnimatedPopup())
#Cache.append('electrum_widgets', 'TabbedCarousel', Factory.TabbedCarousel())
Cache.append('electrum_widgets', 'QRCodeWidget', Factory.QRCodeWidget())
Cache.append('electrum_widgets', 'CSpinner', Factory.CSpinner())
#Cache.append('electrum_widgets', 'AnimatedPopup', Factory.AnimatedPopup())
#Cache.append('electrum_widgets', 'QRCodeWidget', Factory.QRCodeWidget())
# load and focus the ui
self.root.manager = self.root.ids['manager']

24
gui/kivy/uix/screens.py

@ -1,3 +1,8 @@
from weakref import ref
from decimal import Decimal
import re
import datetime
from kivy.app import App
from kivy.cache import Cache
from kivy.clock import Clock
@ -9,12 +14,11 @@ from kivy.factory import Factory
from electrum.i18n import _
from electrum.util import profiler
from electrum import bitcoin
class CScreen(Factory.Screen):
__events__ = ('on_activate', 'on_deactivate', 'on_enter', 'on_leave')
action_view = ObjectProperty(None)
loaded = False
kvname = None
@ -80,7 +84,7 @@ class HistoryScreen(CScreen):
ra_dialog.item = item
ra_dialog.open()
def parse_histories(self, items):
def parse_history(self, items):
for item in items:
tx_hash, conf, value, timestamp, balance = item
time_str = _("unknown")
@ -122,23 +126,19 @@ class HistoryScreen(CScreen):
def update(self, see_all=False):
history_card = self.screen.ids.recent_activity_card
histories = self.parse_histories(reversed(
self.app.wallet.get_history(self.app.current_account)))
history = self.parse_history(reversed(
self.app.wallet.get_history(self.app.current_account)))
# repopulate History Card
last_widget = history_card.ids.content.children[-1]
history_card.ids.content.clear_widgets()
history_add = history_card.ids.content.add_widget
history_add(last_widget)
RecentActivityItem = Factory.RecentActivityItem
from weakref import ref
from decimal import Decimal
get_history_rate = self.app.get_history_rate
count = 0
for items in histories:
for item in history:
count += 1
conf, icon, date_time, address, amount, balance, tx = items
conf, icon, date_time, address, amount, balance, tx = item
ri = RecentActivityItem()
ri.icon = icon
ri.date = date_time
@ -197,8 +197,6 @@ class SendScreen(CScreen):
self.ids.amount_e.text = uri.get('amount', '')
def do_send(self):
import re
from electrum import bitcoin
scrn = self.ids
label = unicode(scrn.message_e.text)
r = unicode(scrn.payto_e.text).strip()

Loading…
Cancel
Save