1
0

Unregister network callbacks from QT gui

Rework the callback system in QT to make this easy, and avoid
leaking window references that prevent the window from being
GC-ed on close
This commit is contained in:
Neil Booth
2015-11-13 22:42:21 +09:00
parent 0d4de870a5
commit ae4cfc9f0b
8 changed files with 60 additions and 39 deletions

View File

@@ -34,10 +34,7 @@ class ElectrumGui:
self.wallet.start_threads(network)
self.contacts = StoreDict(self.config, 'contacts')
self.wallet.network.register_callback('updated', self.updated)
self.wallet.network.register_callback('peers', self.peers)
self.wallet.network.register_callback('banner', self.print_banner)
network.register_callback(self.on_network, ['updated', 'banner'])
self.commands = [_("[h] - displays this help text"), \
_("[i] - display transaction history"), \
_("[o] - enter payment order"), \
@@ -49,6 +46,12 @@ class ElectrumGui:
_("[q] - quit") ]
self.num_commands = len(self.commands)
def on_network(self, event, *args):
if event == 'updated':
self.updated()
elif event == 'banner':
self.print_banner()
def main_command(self):
self.print_balance()
c = raw_input("enter command: ")
@@ -65,12 +68,6 @@ class ElectrumGui:
elif c == "q" : self.done = 1
else: self.print_commands()
def peers(self):
print("got peers list:")
l = filter_protocol(self.wallet.network.get_servers(), 's')
for s in l:
print (s)
def updated(self):
s = self.get_balance()
if s != self.last_balance: