fix callbacks
This commit is contained in:
parent
1ee4af8686
commit
fb0574c5a0
|
@ -164,13 +164,16 @@ class ElectrumGui:
|
||||||
wallet.start_threads(self.network)
|
wallet.start_threads(self.network)
|
||||||
|
|
||||||
# init tray
|
# init tray
|
||||||
self.dark_icon = self.config.get("dark_icon", False)
|
if 1:
|
||||||
icon = QIcon(":icons/electrum_dark_icon.png") if self.dark_icon else QIcon(':icons/electrum_light_icon.png')
|
self.dark_icon = self.config.get("dark_icon", False)
|
||||||
self.tray = QSystemTrayIcon(icon, None)
|
icon = QIcon(":icons/electrum_dark_icon.png") if self.dark_icon else QIcon(':icons/electrum_light_icon.png')
|
||||||
self.tray.setToolTip('Electrum')
|
self.tray = QSystemTrayIcon(icon, None)
|
||||||
self.tray.activated.connect(self.tray_activated)
|
self.tray.setToolTip('Electrum')
|
||||||
self.build_tray_menu()
|
self.tray.activated.connect(self.tray_activated)
|
||||||
self.tray.show()
|
self.build_tray_menu()
|
||||||
|
self.tray.show()
|
||||||
|
else:
|
||||||
|
self.tray = None
|
||||||
|
|
||||||
# main window
|
# main window
|
||||||
self.main_window = w = ElectrumWindow(self.config, self.network, self)
|
self.main_window = w = ElectrumWindow(self.config, self.network, self)
|
||||||
|
@ -206,6 +209,8 @@ class ElectrumGui:
|
||||||
w.update_wallet()
|
w.update_wallet()
|
||||||
|
|
||||||
self.app.exec_()
|
self.app.exec_()
|
||||||
|
if self.tray:
|
||||||
|
self.tray.hide()
|
||||||
|
|
||||||
# clipboard persistence
|
# clipboard persistence
|
||||||
# see http://www.mail-archive.com/pyqt@riverbankcomputing.com/msg17328.html
|
# see http://www.mail-archive.com/pyqt@riverbankcomputing.com/msg17328.html
|
||||||
|
|
|
@ -408,7 +408,8 @@ class ElectrumWindow(QMainWindow):
|
||||||
self.notify(_("New transaction received. %(amount)s %(unit)s") % { 'amount' : self.format_amount(v), 'unit' : self.base_unit()})
|
self.notify(_("New transaction received. %(amount)s %(unit)s") % { 'amount' : self.format_amount(v), 'unit' : self.base_unit()})
|
||||||
|
|
||||||
def notify(self, message):
|
def notify(self, message):
|
||||||
self.tray.showMessage("Electrum", message, QSystemTrayIcon.Information, 20000)
|
if self.tray:
|
||||||
|
self.tray.showMessage("Electrum", message, QSystemTrayIcon.Information, 20000)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -486,7 +487,8 @@ class ElectrumWindow(QMainWindow):
|
||||||
if quote:
|
if quote:
|
||||||
text += "%s"%quote
|
text += "%s"%quote
|
||||||
|
|
||||||
self.tray.setToolTip(text)
|
if self.tray:
|
||||||
|
self.tray.setToolTip(text)
|
||||||
icon = QIcon(":icons/status_connected.png")
|
icon = QIcon(":icons/status_connected.png")
|
||||||
else:
|
else:
|
||||||
text = _("Not connected")
|
text = _("Not connected")
|
||||||
|
@ -2623,7 +2625,6 @@ class ElectrumWindow(QMainWindow):
|
||||||
NetworkDialog(self.wallet.network, self.config, self).do_exec()
|
NetworkDialog(self.wallet.network, self.config, self).do_exec()
|
||||||
|
|
||||||
def closeEvent(self, event):
|
def closeEvent(self, event):
|
||||||
self.tray.hide()
|
|
||||||
self.config.set_key("is_maximized", self.isMaximized())
|
self.config.set_key("is_maximized", self.isMaximized())
|
||||||
if not self.isMaximized():
|
if not self.isMaximized():
|
||||||
g = self.geometry()
|
g = self.geometry()
|
||||||
|
|
|
@ -323,6 +323,8 @@ class Network(threading.Thread):
|
||||||
self.on_peers(i, response)
|
self.on_peers(i, response)
|
||||||
elif method == 'server.banner':
|
elif method == 'server.banner':
|
||||||
self.on_banner(i, response)
|
self.on_banner(i, response)
|
||||||
|
else:
|
||||||
|
self.response_queue.put(response)
|
||||||
|
|
||||||
def process_requests_thread(self):
|
def process_requests_thread(self):
|
||||||
while self.is_running():
|
while self.is_running():
|
||||||
|
|
|
@ -103,7 +103,7 @@ class WalletSynchronizer(threading.Thread):
|
||||||
# request missing transactions
|
# request missing transactions
|
||||||
for tx_hash, tx_height in missing_tx:
|
for tx_hash, tx_height in missing_tx:
|
||||||
if (tx_hash, tx_height) not in requested_tx:
|
if (tx_hash, tx_height) not in requested_tx:
|
||||||
self.network.send([ ('blockchain.transaction.get',[tx_hash, tx_height]) ], lambda i,r: self.queue.put(r))
|
self.network.send([ ('blockchain.transaction.get',[tx_hash, tx_height]) ], self.queue.put)
|
||||||
requested_tx.append( (tx_hash, tx_height) )
|
requested_tx.append( (tx_hash, tx_height) )
|
||||||
missing_tx = []
|
missing_tx = []
|
||||||
|
|
||||||
|
|
|
@ -103,10 +103,10 @@ class TxVerifier(threading.Thread):
|
||||||
for tx_hash, tx_height in self.transactions.items():
|
for tx_hash, tx_height in self.transactions.items():
|
||||||
if tx_hash not in self.verified_tx:
|
if tx_hash not in self.verified_tx:
|
||||||
# do not request merkle branch before headers are available
|
# do not request merkle branch before headers are available
|
||||||
if tx_height > self.network.blockchain.height():
|
if tx_height > self.network.get_local_height():
|
||||||
continue
|
continue
|
||||||
if self.merkle_roots.get(tx_hash) is None and tx_hash not in requested_merkle:
|
if self.merkle_roots.get(tx_hash) is None and tx_hash not in requested_merkle:
|
||||||
if self.network.send([ ('blockchain.transaction.get_merkle',[tx_hash, tx_height]) ], lambda i,r: self.queue.put(r)):
|
if self.network.send([ ('blockchain.transaction.get_merkle',[tx_hash, tx_height]) ], self.queue.put):
|
||||||
print_error('requesting merkle', tx_hash)
|
print_error('requesting merkle', tx_hash)
|
||||||
requested_merkle.append(tx_hash)
|
requested_merkle.append(tx_hash)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue