call init_qt everytime a plugin is enabled
This commit is contained in:
parent
a8f0e4310f
commit
6101abda5d
|
@ -467,6 +467,9 @@ class ElectrumWindow(QMainWindow):
|
||||||
raise Exception('Unknown base unit')
|
raise Exception('Unknown base unit')
|
||||||
|
|
||||||
def update_status(self):
|
def update_status(self):
|
||||||
|
if not self.wallet:
|
||||||
|
return
|
||||||
|
|
||||||
if self.network is None or not self.network.is_running():
|
if self.network is None or not self.network.is_running():
|
||||||
text = _("Offline")
|
text = _("Offline")
|
||||||
icon = QIcon(":icons/status_disconnected.png")
|
icon = QIcon(":icons/status_disconnected.png")
|
||||||
|
@ -2719,7 +2722,13 @@ class ElectrumWindow(QMainWindow):
|
||||||
w.setLayout(grid)
|
w.setLayout(grid)
|
||||||
|
|
||||||
def do_toggle(cb, p, w):
|
def do_toggle(cb, p, w):
|
||||||
r = p.toggle()
|
if p.is_enabled():
|
||||||
|
if p.disable():
|
||||||
|
p.close()
|
||||||
|
else:
|
||||||
|
if p.enable():
|
||||||
|
p.init_qt(self.gui_object)
|
||||||
|
r = p.is_enabled()
|
||||||
cb.setChecked(r)
|
cb.setChecked(r)
|
||||||
if w: w.setEnabled(r)
|
if w: w.setEnabled(r)
|
||||||
|
|
||||||
|
|
|
@ -80,16 +80,6 @@ class BasePlugin:
|
||||||
def requires_settings(self):
|
def requires_settings(self):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def toggle(self):
|
|
||||||
if self.is_enabled():
|
|
||||||
if self.disable():
|
|
||||||
self.close()
|
|
||||||
else:
|
|
||||||
if self.enable():
|
|
||||||
self.init()
|
|
||||||
|
|
||||||
return self.is_enabled()
|
|
||||||
|
|
||||||
def enable(self):
|
def enable(self):
|
||||||
self.set_enabled(True)
|
self.set_enabled(True)
|
||||||
return True
|
return True
|
||||||
|
|
|
@ -81,10 +81,6 @@ class Plugin(BasePlugin):
|
||||||
def enable(self):
|
def enable(self):
|
||||||
return BasePlugin.enable(self)
|
return BasePlugin.enable(self)
|
||||||
|
|
||||||
@hook
|
|
||||||
def init_qt(self, gui):
|
|
||||||
self.gui = gui
|
|
||||||
|
|
||||||
@hook
|
@hook
|
||||||
def load_wallet(self, wallet):
|
def load_wallet(self, wallet):
|
||||||
self.wallet = wallet
|
self.wallet = wallet
|
||||||
|
|
|
@ -337,6 +337,7 @@ class Plugin(BasePlugin):
|
||||||
BasePlugin.__init__(self,a,b)
|
BasePlugin.__init__(self,a,b)
|
||||||
self.currencies = [self.fiat_unit()]
|
self.currencies = [self.fiat_unit()]
|
||||||
self.exchanges = [self.config.get('use_exchange', "Blockchain")]
|
self.exchanges = [self.config.get('use_exchange', "Blockchain")]
|
||||||
|
self.exchanger = None
|
||||||
|
|
||||||
@hook
|
@hook
|
||||||
def init_qt(self, gui):
|
def init_qt(self, gui):
|
||||||
|
@ -344,11 +345,21 @@ class Plugin(BasePlugin):
|
||||||
self.win = self.gui.main_window
|
self.win = self.gui.main_window
|
||||||
self.win.connect(self.win, SIGNAL("refresh_currencies()"), self.win.update_status)
|
self.win.connect(self.win, SIGNAL("refresh_currencies()"), self.win.update_status)
|
||||||
self.btc_rate = Decimal("0.0")
|
self.btc_rate = Decimal("0.0")
|
||||||
|
if self.exchanger is None:
|
||||||
# Do price discovery
|
# Do price discovery
|
||||||
self.exchanger = Exchanger(self)
|
self.exchanger = Exchanger(self)
|
||||||
self.exchanger.start()
|
self.exchanger.start()
|
||||||
self.gui.exchanger = self.exchanger #
|
self.gui.exchanger = self.exchanger #
|
||||||
self.add_fiat_edit()
|
self.add_fiat_edit()
|
||||||
|
self.add_fiat_edit()
|
||||||
|
self.win.update_status()
|
||||||
|
|
||||||
|
def close(self):
|
||||||
|
self.exchanger.stop()
|
||||||
|
self.exchanger = None
|
||||||
|
self.win.tabs.removeTab(1)
|
||||||
|
self.win.tabs.insertTab(1, self.win.create_send_tab(), _('Send'))
|
||||||
|
self.win.update_status()
|
||||||
|
|
||||||
def set_currencies(self, currency_options):
|
def set_currencies(self, currency_options):
|
||||||
self.currencies = sorted(currency_options)
|
self.currencies = sorted(currency_options)
|
||||||
|
@ -410,19 +421,6 @@ class Plugin(BasePlugin):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
def toggle(self):
|
|
||||||
enabled = BasePlugin.toggle(self)
|
|
||||||
self.win.update_status()
|
|
||||||
self.win.tabs.removeTab(1)
|
|
||||||
new_send_tab = self.gui.main_window.create_send_tab()
|
|
||||||
self.win.tabs.insertTab(1, new_send_tab, _('Send'))
|
|
||||||
if enabled:
|
|
||||||
self.add_fiat_edit()
|
|
||||||
return enabled
|
|
||||||
|
|
||||||
|
|
||||||
def close(self):
|
|
||||||
self.exchanger.stop()
|
|
||||||
|
|
||||||
def history_tab_update(self):
|
def history_tab_update(self):
|
||||||
if self.config.get('history_rates', 'unchecked') == "checked":
|
if self.config.get('history_rates', 'unchecked') == "checked":
|
||||||
|
|
Loading…
Reference in New Issue