tkivy: fix datetime, cleanup - electrum - Electrum Bitcoin wallet HTML git clone https://git.parazyd.org/electrum DIR Log DIR Files DIR Refs DIR Submodules --- DIR commit f8ccf3cd37ed4ad183b8ef6cc6357630a757c911 DIR parent 913e957f4acdb7c3a533b061d921047a9edab40c HTML Author: ThomasV <thomasv@electrum.org> Date: Wed, 7 Oct 2015 13:06:28 +0200 kivy: fix datetime, cleanup Diffstat: M gui/kivy/main_window.py | 20 ++------------------ M gui/kivy/uix/screens.py | 24 +++++++++++------------- 2 files changed, 13 insertions(+), 31 deletions(-) --- DIR diff --git a/gui/kivy/main_window.py b/gui/kivy/main_window.py t@@ -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'] DIR diff --git a/gui/kivy/uix/screens.py b/gui/kivy/uix/screens.py t@@ -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 t@@ -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 t@@ -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") t@@ -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 t@@ -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()