Revert "Plugins: remove init_qt hook; clean up"
This reverts commit e20369bf94
.
This commit is contained in:
parent
a04b510395
commit
08e5aecee2
|
@ -92,6 +92,7 @@ class ElectrumGui:
|
||||||
self.build_tray_menu()
|
self.build_tray_menu()
|
||||||
self.tray.show()
|
self.tray.show()
|
||||||
self.app.connect(self.app, QtCore.SIGNAL('new_window'), self.start_new_window)
|
self.app.connect(self.app, QtCore.SIGNAL('new_window'), self.start_new_window)
|
||||||
|
run_hook('init_qt', self)
|
||||||
|
|
||||||
def build_tray_menu(self):
|
def build_tray_menu(self):
|
||||||
# Avoid immediate GC of old menu when window closed via its action
|
# Avoid immediate GC of old menu when window closed via its action
|
||||||
|
|
|
@ -2941,6 +2941,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
|
||||||
p = plugins.toggle(name)
|
p = plugins.toggle(name)
|
||||||
cb.setChecked(bool(p))
|
cb.setChecked(bool(p))
|
||||||
enable_settings_widget(p, name, i)
|
enable_settings_widget(p, name, i)
|
||||||
|
run_hook('init_qt', self.gui_object)
|
||||||
|
|
||||||
for i, descr in enumerate(plugins.descriptions.values()):
|
for i, descr in enumerate(plugins.descriptions.values()):
|
||||||
name = descr['__name__']
|
name = descr['__name__']
|
||||||
|
|
|
@ -11,11 +11,7 @@ from functools import partial
|
||||||
from electrum.plugins import hook
|
from electrum.plugins import hook
|
||||||
from exchange_rate import FxPlugin
|
from exchange_rate import FxPlugin
|
||||||
|
|
||||||
class Plugin(FxPlugin, QObject):
|
class Plugin(FxPlugin):
|
||||||
|
|
||||||
def __init__(self, parent, config, name):
|
|
||||||
FxPlugin.__init__(self, parent, config, name)
|
|
||||||
QObject.__init__(self)
|
|
||||||
|
|
||||||
def connect_fields(self, window, btc_e, fiat_e, fee_e):
|
def connect_fields(self, window, btc_e, fiat_e, fee_e):
|
||||||
|
|
||||||
|
@ -45,12 +41,16 @@ class Plugin(FxPlugin, QObject):
|
||||||
btc_e.textEdited.connect(partial(edit_changed, btc_e))
|
btc_e.textEdited.connect(partial(edit_changed, btc_e))
|
||||||
fiat_e.is_last_edited = False
|
fiat_e.is_last_edited = False
|
||||||
|
|
||||||
|
@hook
|
||||||
|
def init_qt(self, gui):
|
||||||
|
self.app = gui.app
|
||||||
|
|
||||||
@hook
|
@hook
|
||||||
def do_clear(self, window):
|
def do_clear(self, window):
|
||||||
window.fiat_send_e.setText('')
|
window.fiat_send_e.setText('')
|
||||||
|
|
||||||
def on_close(self):
|
def on_close(self):
|
||||||
self.emit(SIGNAL('close_fx_plugin'))
|
self.app.emit(SIGNAL('close_fx_plugin'))
|
||||||
|
|
||||||
def restore_window(self, window):
|
def restore_window(self, window):
|
||||||
window.update_status()
|
window.update_status()
|
||||||
|
@ -59,10 +59,10 @@ class Plugin(FxPlugin, QObject):
|
||||||
window.fiat_receive_e.hide()
|
window.fiat_receive_e.hide()
|
||||||
|
|
||||||
def on_quotes(self):
|
def on_quotes(self):
|
||||||
self.emit(SIGNAL('new_fx_quotes'))
|
self.app.emit(SIGNAL('new_fx_quotes'))
|
||||||
|
|
||||||
def on_history(self):
|
def on_history(self):
|
||||||
self.emit(SIGNAL('new_fx_history'))
|
self.app.emit(SIGNAL('new_fx_history'))
|
||||||
|
|
||||||
def on_fx_history(self, window):
|
def on_fx_history(self, window):
|
||||||
'''Called when historical fx quotes are updated'''
|
'''Called when historical fx quotes are updated'''
|
||||||
|
@ -86,7 +86,7 @@ class Plugin(FxPlugin, QObject):
|
||||||
ccy = str(self.ccy_combo.currentText())
|
ccy = str(self.ccy_combo.currentText())
|
||||||
if ccy and ccy != self.ccy:
|
if ccy and ccy != self.ccy:
|
||||||
self.set_currency(ccy)
|
self.set_currency(ccy)
|
||||||
self.emit(SIGNAL('new_fx_quotes'))
|
self.app.emit(SIGNAL('new_fx_quotes'))
|
||||||
self.hist_checkbox_update()
|
self.hist_checkbox_update()
|
||||||
|
|
||||||
def hist_checkbox_update(self):
|
def hist_checkbox_update(self):
|
||||||
|
@ -120,10 +120,10 @@ class Plugin(FxPlugin, QObject):
|
||||||
self.connect_fields(window, window.receive_amount_e, receive_e, None)
|
self.connect_fields(window, window.receive_amount_e, receive_e, None)
|
||||||
window.history_list.refresh_headers()
|
window.history_list.refresh_headers()
|
||||||
window.update_status()
|
window.update_status()
|
||||||
window.connect(self, SIGNAL('new_fx_quotes'), lambda: self.on_fx_quotes(window))
|
window.connect(window.app, SIGNAL('new_fx_quotes'), lambda: self.on_fx_quotes(window))
|
||||||
window.connect(self, SIGNAL('new_fx_history'), lambda: self.on_fx_history(window))
|
window.connect(window.app, SIGNAL('new_fx_history'), lambda: self.on_fx_history(window))
|
||||||
window.connect(self, SIGNAL('close_fx_plugin'), lambda: self.restore_window(window))
|
window.connect(window.app, SIGNAL('close_fx_plugin'), lambda: self.restore_window(window))
|
||||||
window.connect(self, SIGNAL('refresh_headers'), window.history_list.refresh_headers)
|
window.connect(window.app, SIGNAL('refresh_headers'), window.history_list.refresh_headers)
|
||||||
|
|
||||||
def settings_widget(self, window):
|
def settings_widget(self, window):
|
||||||
return EnterButton(_('Settings'), partial(self.settings_dialog, window))
|
return EnterButton(_('Settings'), partial(self.settings_dialog, window))
|
||||||
|
@ -152,7 +152,7 @@ class Plugin(FxPlugin, QObject):
|
||||||
self.get_historical_rates()
|
self.get_historical_rates()
|
||||||
else:
|
else:
|
||||||
self.config.set_key('history_rates', 'unchecked')
|
self.config.set_key('history_rates', 'unchecked')
|
||||||
self.emit(SIGNAL('refresh_headers'))
|
self.app.emit(SIGNAL('refresh_headers'))
|
||||||
|
|
||||||
def ok_clicked():
|
def ok_clicked():
|
||||||
self.timeout = 0
|
self.timeout = 0
|
||||||
|
|
Loading…
Reference in New Issue