kivy: fix datetime, cleanup
This commit is contained in:
@@ -379,28 +379,12 @@ class ElectrumWindow(App):
|
|||||||
#setup lazy imports for mainscreen
|
#setup lazy imports for mainscreen
|
||||||
Factory.register('AnimatedPopup',
|
Factory.register('AnimatedPopup',
|
||||||
module='electrum_gui.kivy.uix.dialogs')
|
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',
|
Factory.register('QRCodeWidget',
|
||||||
module='electrum_gui.kivy.uix.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
|
# preload widgets. Remove this if you want to load the widgets on demand
|
||||||
Cache.append('electrum_widgets', 'AnimatedPopup', Factory.AnimatedPopup())
|
#Cache.append('electrum_widgets', 'AnimatedPopup', Factory.AnimatedPopup())
|
||||||
|
#Cache.append('electrum_widgets', 'QRCodeWidget', Factory.QRCodeWidget())
|
||||||
#Cache.append('electrum_widgets', 'TabbedCarousel', Factory.TabbedCarousel())
|
|
||||||
|
|
||||||
Cache.append('electrum_widgets', 'QRCodeWidget', Factory.QRCodeWidget())
|
|
||||||
Cache.append('electrum_widgets', 'CSpinner', Factory.CSpinner())
|
|
||||||
|
|
||||||
# load and focus the ui
|
# load and focus the ui
|
||||||
self.root.manager = self.root.ids['manager']
|
self.root.manager = self.root.ids['manager']
|
||||||
|
|||||||
@@ -1,3 +1,8 @@
|
|||||||
|
from weakref import ref
|
||||||
|
from decimal import Decimal
|
||||||
|
import re
|
||||||
|
import datetime
|
||||||
|
|
||||||
from kivy.app import App
|
from kivy.app import App
|
||||||
from kivy.cache import Cache
|
from kivy.cache import Cache
|
||||||
from kivy.clock import Clock
|
from kivy.clock import Clock
|
||||||
@@ -9,12 +14,11 @@ from kivy.factory import Factory
|
|||||||
|
|
||||||
from electrum.i18n import _
|
from electrum.i18n import _
|
||||||
from electrum.util import profiler
|
from electrum.util import profiler
|
||||||
|
from electrum import bitcoin
|
||||||
|
|
||||||
class CScreen(Factory.Screen):
|
class CScreen(Factory.Screen):
|
||||||
|
|
||||||
__events__ = ('on_activate', 'on_deactivate', 'on_enter', 'on_leave')
|
__events__ = ('on_activate', 'on_deactivate', 'on_enter', 'on_leave')
|
||||||
|
|
||||||
action_view = ObjectProperty(None)
|
action_view = ObjectProperty(None)
|
||||||
loaded = False
|
loaded = False
|
||||||
kvname = None
|
kvname = None
|
||||||
@@ -80,7 +84,7 @@ class HistoryScreen(CScreen):
|
|||||||
ra_dialog.item = item
|
ra_dialog.item = item
|
||||||
ra_dialog.open()
|
ra_dialog.open()
|
||||||
|
|
||||||
def parse_histories(self, items):
|
def parse_history(self, items):
|
||||||
for item in items:
|
for item in items:
|
||||||
tx_hash, conf, value, timestamp, balance = item
|
tx_hash, conf, value, timestamp, balance = item
|
||||||
time_str = _("unknown")
|
time_str = _("unknown")
|
||||||
@@ -122,23 +126,19 @@ class HistoryScreen(CScreen):
|
|||||||
def update(self, see_all=False):
|
def update(self, see_all=False):
|
||||||
|
|
||||||
history_card = self.screen.ids.recent_activity_card
|
history_card = self.screen.ids.recent_activity_card
|
||||||
histories = self.parse_histories(reversed(
|
history = self.parse_history(reversed(
|
||||||
self.app.wallet.get_history(self.app.current_account)))
|
self.app.wallet.get_history(self.app.current_account)))
|
||||||
# repopulate History Card
|
# repopulate History Card
|
||||||
last_widget = history_card.ids.content.children[-1]
|
last_widget = history_card.ids.content.children[-1]
|
||||||
history_card.ids.content.clear_widgets()
|
history_card.ids.content.clear_widgets()
|
||||||
history_add = history_card.ids.content.add_widget
|
history_add = history_card.ids.content.add_widget
|
||||||
history_add(last_widget)
|
history_add(last_widget)
|
||||||
RecentActivityItem = Factory.RecentActivityItem
|
RecentActivityItem = Factory.RecentActivityItem
|
||||||
|
|
||||||
from weakref import ref
|
|
||||||
from decimal import Decimal
|
|
||||||
|
|
||||||
get_history_rate = self.app.get_history_rate
|
get_history_rate = self.app.get_history_rate
|
||||||
count = 0
|
count = 0
|
||||||
for items in histories:
|
for item in history:
|
||||||
count += 1
|
count += 1
|
||||||
conf, icon, date_time, address, amount, balance, tx = items
|
conf, icon, date_time, address, amount, balance, tx = item
|
||||||
ri = RecentActivityItem()
|
ri = RecentActivityItem()
|
||||||
ri.icon = icon
|
ri.icon = icon
|
||||||
ri.date = date_time
|
ri.date = date_time
|
||||||
@@ -197,8 +197,6 @@ class SendScreen(CScreen):
|
|||||||
self.ids.amount_e.text = uri.get('amount', '')
|
self.ids.amount_e.text = uri.get('amount', '')
|
||||||
|
|
||||||
def do_send(self):
|
def do_send(self):
|
||||||
import re
|
|
||||||
from electrum import bitcoin
|
|
||||||
scrn = self.ids
|
scrn = self.ids
|
||||||
label = unicode(scrn.message_e.text)
|
label = unicode(scrn.message_e.text)
|
||||||
r = unicode(scrn.payto_e.text).strip()
|
r = unicode(scrn.payto_e.text).strip()
|
||||||
|
|||||||
Reference in New Issue
Block a user