|
|
@ -81,7 +81,7 @@ class Exchanger(ThreadJob): |
|
|
|
self.parent.refresh_fields() |
|
|
|
|
|
|
|
def run(self): |
|
|
|
if self.parent.gui and self.timeout <= time.time(): |
|
|
|
if self.parent.parent.windows and self.timeout <= time.time(): |
|
|
|
self.update_rate() |
|
|
|
self.timeout = time.time() + 150 |
|
|
|
|
|
|
@ -170,8 +170,11 @@ class Plugin(BasePlugin): |
|
|
|
self.resp_hist = {} |
|
|
|
self.btc_rate = Decimal("0.0") |
|
|
|
self.network = None |
|
|
|
self.gui = None |
|
|
|
self.wallet_tx_list = {} |
|
|
|
# For mid-session plugin loads |
|
|
|
for window in parent.windows: |
|
|
|
self.new_window(window) |
|
|
|
self.new_wallets([window.wallet for window in parent.windows]) |
|
|
|
|
|
|
|
@hook |
|
|
|
def set_network(self, network): |
|
|
@ -182,14 +185,6 @@ class Plugin(BasePlugin): |
|
|
|
if network: |
|
|
|
network.add_job(self.exchanger) |
|
|
|
|
|
|
|
@hook |
|
|
|
def init_qt(self, gui): |
|
|
|
self.gui = gui |
|
|
|
# For mid-session plugin loads |
|
|
|
for window in gui.windows: |
|
|
|
self.new_window(window) |
|
|
|
self.new_wallets([window.wallet for window in gui.windows]) |
|
|
|
|
|
|
|
@hook |
|
|
|
def new_window(self, window): |
|
|
|
window.connect(window, SIGNAL("refresh_currencies()"), |
|
|
@ -203,14 +198,14 @@ class Plugin(BasePlugin): |
|
|
|
BasePlugin.close(self) |
|
|
|
self.set_network(None) |
|
|
|
self.exchanger = None |
|
|
|
for window in self.gui.windows: |
|
|
|
for window in self.parent.windows: |
|
|
|
window.send_fiat_e.hide() |
|
|
|
window.receive_fiat_e.hide() |
|
|
|
window.update_status() |
|
|
|
|
|
|
|
def set_currencies(self, currency_options): |
|
|
|
self.currencies = sorted(currency_options) |
|
|
|
for window in self.gui.windows: |
|
|
|
for window in self.parent.windows: |
|
|
|
window.emit(SIGNAL("refresh_currencies()")) |
|
|
|
window.emit(SIGNAL("refresh_currencies_combo()")) |
|
|
|
|
|
|
@ -323,9 +318,8 @@ class Plugin(BasePlugin): |
|
|
|
else: |
|
|
|
return |
|
|
|
|
|
|
|
if self.gui: |
|
|
|
for window in self.gui.windows: |
|
|
|
window.need_update.set() |
|
|
|
for window in self.parent.windows: |
|
|
|
window.need_update.set() |
|
|
|
|
|
|
|
def requires_settings(self): |
|
|
|
return True |
|
|
@ -421,7 +415,7 @@ class Plugin(BasePlugin): |
|
|
|
hist_checkbox.setEnabled(True) |
|
|
|
else: |
|
|
|
disable_check() |
|
|
|
for window in self.gui.windows: |
|
|
|
for window in self.parent.windows: |
|
|
|
window.update_status() |
|
|
|
try: |
|
|
|
self.fiat_button |
|
|
@ -448,7 +442,7 @@ class Plugin(BasePlugin): |
|
|
|
else: |
|
|
|
disable_check() |
|
|
|
set_currencies(combo) |
|
|
|
for window in self.gui.windows: |
|
|
|
for window in self.parent.windows: |
|
|
|
window.update_status() |
|
|
|
|
|
|
|
def on_change_hist(checked): |
|
|
@ -457,7 +451,7 @@ class Plugin(BasePlugin): |
|
|
|
self.get_historical_rates() |
|
|
|
else: |
|
|
|
self.config.set_key('history_rates', 'unchecked') |
|
|
|
for window in self.gui.windows: |
|
|
|
for window in self.parent.windows: |
|
|
|
window.history_list.setHeaderLabels( [ '', '', _('Date'), _('Description') , _('Amount'), _('Balance')] ) |
|
|
|
window.history_list.setColumnCount(6) |
|
|
|
|
|
|
@ -489,7 +483,7 @@ class Plugin(BasePlugin): |
|
|
|
combo.currentIndexChanged.connect(on_change) |
|
|
|
combo_ex.currentIndexChanged.connect(on_change_ex) |
|
|
|
hist_checkbox.stateChanged.connect(on_change_hist) |
|
|
|
for window in self.gui.windows: |
|
|
|
for window in self.parent.windows: |
|
|
|
combo.connect(window, SIGNAL('refresh_currencies_combo()'), lambda: set_currencies(combo)) |
|
|
|
combo_ex.connect(d, SIGNAL('refresh_exchanges_combo()'), lambda: set_exchanges(combo_ex)) |
|
|
|
ok_button.clicked.connect(lambda: ok_clicked()) |
|
|
@ -508,7 +502,7 @@ class Plugin(BasePlugin): |
|
|
|
|
|
|
|
def refresh_fields(self): |
|
|
|
'''Update the display at the new rate''' |
|
|
|
for window in self.gui.windows: |
|
|
|
for window in self.parent.windows: |
|
|
|
for field in window.fx_fields.values(): |
|
|
|
field.textEdited.emit(field.text()) |
|
|
|
|
|
|
|