labels sync for kivy
This commit is contained in:
parent
0215aee047
commit
deefd74c37
|
@ -404,6 +404,7 @@ class ElectrumWindow(App):
|
||||||
# since the callback has been called before the GUI was initialized
|
# since the callback has been called before the GUI was initialized
|
||||||
self.update_history_tab()
|
self.update_history_tab()
|
||||||
self.notify_transactions()
|
self.notify_transactions()
|
||||||
|
run_hook('load_wallet', wallet, self)
|
||||||
|
|
||||||
def update_status(self, *dt):
|
def update_status(self, *dt):
|
||||||
if not self.wallet:
|
if not self.wallet:
|
||||||
|
|
|
@ -194,12 +194,6 @@ class BasePlugin(PrintError):
|
||||||
def thread_jobs(self):
|
def thread_jobs(self):
|
||||||
return []
|
return []
|
||||||
|
|
||||||
@hook
|
|
||||||
def load_wallet(self, wallet, window): pass
|
|
||||||
|
|
||||||
@hook
|
|
||||||
def close_wallet(self): pass
|
|
||||||
|
|
||||||
def is_enabled(self):
|
def is_enabled(self):
|
||||||
return self.is_available() and self.config.get('use_'+self.name) is True
|
return self.is_available() and self.config.get('use_'+self.name) is True
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,14 @@
|
||||||
from labels import LabelsPlugin
|
from labels import LabelsPlugin
|
||||||
|
from electrum.plugins import hook
|
||||||
|
|
||||||
class Plugin(LabelsPlugin):
|
class Plugin(LabelsPlugin):
|
||||||
pass
|
|
||||||
|
@hook
|
||||||
|
def load_wallet(self, wallet, window):
|
||||||
|
self.window = window
|
||||||
|
self.start_wallet(wallet)
|
||||||
|
|
||||||
|
def on_pulled(self, wallet):
|
||||||
|
self.print_error('on pulled')
|
||||||
|
self.window.update_history_tab()
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import hashlib
|
||||||
import requests
|
import requests
|
||||||
import threading
|
import threading
|
||||||
import json
|
import json
|
||||||
|
@ -132,7 +133,17 @@ class LabelsPlugin(BasePlugin):
|
||||||
traceback.print_exc(file=sys.stderr)
|
traceback.print_exc(file=sys.stderr)
|
||||||
self.print_error("could not retrieve labels")
|
self.print_error("could not retrieve labels")
|
||||||
|
|
||||||
|
def start_wallet(self, wallet):
|
||||||
|
nonce = self.get_nonce(wallet)
|
||||||
|
self.print_error("wallet", wallet.basename(), "nonce is", nonce)
|
||||||
|
mpk = ''.join(sorted(wallet.get_master_public_keys().values()))
|
||||||
|
if not mpk:
|
||||||
|
return
|
||||||
|
password = hashlib.sha1(mpk).digest().encode('hex')[:32]
|
||||||
|
iv = hashlib.sha256(password).digest()[:16]
|
||||||
|
wallet_id = hashlib.sha256(mpk).digest().encode('hex')
|
||||||
|
self.wallets[wallet] = (password, iv, wallet_id)
|
||||||
|
# If there is an auth token we can try to actually start syncing
|
||||||
|
t = threading.Thread(target=self.pull_thread, args=(wallet, False))
|
||||||
|
t.setDaemon(True)
|
||||||
|
t.start()
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
import hashlib
|
|
||||||
import threading
|
import threading
|
||||||
from functools import partial
|
from functools import partial
|
||||||
|
|
||||||
|
@ -59,20 +58,7 @@ class Plugin(LabelsPlugin):
|
||||||
@hook
|
@hook
|
||||||
def on_new_window(self, window):
|
def on_new_window(self, window):
|
||||||
window.connect(window.app, SIGNAL('labels_changed'), window.update_tabs)
|
window.connect(window.app, SIGNAL('labels_changed'), window.update_tabs)
|
||||||
wallet = window.wallet
|
self.start_wallet(window.wallet)
|
||||||
nonce = self.get_nonce(wallet)
|
|
||||||
self.print_error("wallet", wallet.basename(), "nonce is", nonce)
|
|
||||||
mpk = ''.join(sorted(wallet.get_master_public_keys().values()))
|
|
||||||
if not mpk:
|
|
||||||
return
|
|
||||||
password = hashlib.sha1(mpk).digest().encode('hex')[:32]
|
|
||||||
iv = hashlib.sha256(password).digest()[:16]
|
|
||||||
wallet_id = hashlib.sha256(mpk).digest().encode('hex')
|
|
||||||
self.wallets[wallet] = (password, iv, wallet_id)
|
|
||||||
# If there is an auth token we can try to actually start syncing
|
|
||||||
t = threading.Thread(target=self.pull_thread, args=(wallet, False))
|
|
||||||
t.setDaemon(True)
|
|
||||||
t.start()
|
|
||||||
|
|
||||||
@hook
|
@hook
|
||||||
def on_close_window(self, window):
|
def on_close_window(self, window):
|
||||||
|
|
Loading…
Reference in New Issue