|
|
@ -21,11 +21,11 @@ from electrum.invoices import PR_PAID, PR_FAILED |
|
|
|
from electrum import blockchain |
|
|
|
from electrum.network import Network, TxBroadcastError, BestEffortRequestFailed |
|
|
|
from electrum.interface import PREFERRED_NETWORK_PROTOCOL, ServerAddr |
|
|
|
from electrum.logging import Logger |
|
|
|
from .i18n import _ |
|
|
|
|
|
|
|
from kivy.app import App |
|
|
|
from kivy.core.window import Window |
|
|
|
from kivy.logger import Logger |
|
|
|
from kivy.utils import platform |
|
|
|
from kivy.properties import (OptionProperty, AliasProperty, ObjectProperty, |
|
|
|
StringProperty, ListProperty, BooleanProperty, NumericProperty) |
|
|
@ -87,7 +87,7 @@ if TYPE_CHECKING: |
|
|
|
from electrum.paymentrequest import PaymentRequest |
|
|
|
|
|
|
|
|
|
|
|
class ElectrumWindow(App): |
|
|
|
class ElectrumWindow(App, Logger): |
|
|
|
|
|
|
|
electrum_config = ObjectProperty(None) |
|
|
|
language = StringProperty('en') |
|
|
@ -228,7 +228,7 @@ class ElectrumWindow(App): |
|
|
|
self._process_invoice_str(invoice_queued) |
|
|
|
|
|
|
|
def on_language(self, instance, language): |
|
|
|
Logger.info('language: {}'.format(language)) |
|
|
|
self.logger.info('language: {}'.format(language)) |
|
|
|
_.switch_lang(language) |
|
|
|
|
|
|
|
def update_history(self, *dt): |
|
|
@ -236,12 +236,12 @@ class ElectrumWindow(App): |
|
|
|
self.history_screen.update() |
|
|
|
|
|
|
|
def on_quotes(self, d): |
|
|
|
Logger.info("on_quotes") |
|
|
|
self.logger.info("on_quotes") |
|
|
|
self._trigger_update_status() |
|
|
|
self._trigger_update_history() |
|
|
|
|
|
|
|
def on_history(self, d): |
|
|
|
Logger.info("on_history") |
|
|
|
self.logger.info("on_history") |
|
|
|
if self.wallet: |
|
|
|
self.wallet.clear_coin_price_cache() |
|
|
|
self._trigger_update_history() |
|
|
@ -368,6 +368,7 @@ class ElectrumWindow(App): |
|
|
|
self.password = None |
|
|
|
|
|
|
|
App.__init__(self)#, **kwargs) |
|
|
|
Logger.__init__(self) |
|
|
|
|
|
|
|
self.electrum_config = config = kwargs.get('config', None) # type: SimpleConfig |
|
|
|
self.language = config.get('language', 'en') |
|
|
@ -556,6 +557,7 @@ class ElectrumWindow(App): |
|
|
|
try: |
|
|
|
return func(self, *args, **kwargs) |
|
|
|
except Exception as e: |
|
|
|
self.logger.exception('crash on startup') |
|
|
|
from .uix.dialogs.crash_reporter import CrashReporter |
|
|
|
# show the crash reporter, and when it's closed, shutdown the app |
|
|
|
cr = CrashReporter(self, exctype=type(e), value=e, tb=e.__traceback__) |
|
|
@ -568,7 +570,7 @@ class ElectrumWindow(App): |
|
|
|
''' This is the start point of the kivy ui |
|
|
|
''' |
|
|
|
import time |
|
|
|
Logger.info('Time to on_start: {} <<<<<<<<'.format(time.process_time())) |
|
|
|
self.logger.info('Time to on_start: {} <<<<<<<<'.format(time.process_time())) |
|
|
|
Window.bind(size=self.on_size, on_keyboard=self.on_keyboard) |
|
|
|
Window.bind(on_key_down=self.on_key_down) |
|
|
|
#Window.softinput_mode = 'below_target' |
|
|
@ -691,7 +693,7 @@ class ElectrumWindow(App): |
|
|
|
self._on_decrypted_storage(storage) |
|
|
|
|
|
|
|
def on_stop(self): |
|
|
|
Logger.info('on_stop') |
|
|
|
self.logger.info('on_stop') |
|
|
|
self.stop_wallet() |
|
|
|
|
|
|
|
def stop_wallet(self): |
|
|
@ -832,7 +834,7 @@ class ElectrumWindow(App): |
|
|
|
self.update_proxy_str(self.proxy_config) |
|
|
|
|
|
|
|
def on_network_event(self, event, *args): |
|
|
|
Logger.info('network event: '+ event) |
|
|
|
self.logger.info('network event: '+ event) |
|
|
|
if event == 'network_updated': |
|
|
|
self._trigger_update_interfaces() |
|
|
|
self._trigger_update_status() |
|
|
@ -983,7 +985,7 @@ class ElectrumWindow(App): |
|
|
|
notification.notify('Electrum', message, |
|
|
|
app_icon=icon, app_name='Electrum') |
|
|
|
except ImportError: |
|
|
|
Logger.Error('Notification: needs plyer; `sudo python3 -m pip install plyer`') |
|
|
|
self.logger.Error('Notification: needs plyer; `sudo python3 -m pip install plyer`') |
|
|
|
|
|
|
|
def on_pause(self): |
|
|
|
self.pause_time = time.time() |
|
|
@ -1246,7 +1248,7 @@ class ElectrumWindow(App): |
|
|
|
if self.wallet.has_password(): |
|
|
|
try: |
|
|
|
self.wallet.check_password(pw) |
|
|
|
except: |
|
|
|
except InvalidPassword: |
|
|
|
self.show_error("Invalid PIN") |
|
|
|
return |
|
|
|
self.stop_wallet() |
|
|
@ -1348,6 +1350,7 @@ class ElectrumWindow(App): |
|
|
|
try: |
|
|
|
self.wallet.lnbackups.import_channel_backup(encrypted) |
|
|
|
except Exception as e: |
|
|
|
self.logger.exception("failed to import backup") |
|
|
|
self.show_error("failed to import backup" + '\n' + str(e)) |
|
|
|
return |
|
|
|
self.lightning_channels_dialog() |
|
|
|