def fx_dialog(self, label, dt): if self._fx_dialog is None: from fx_dialog import FxDialog def cb(): label.status = self.fx_status() self._fx_dialog = FxDialog(self.app, self.plugins, self.config, cb) self._fx_dialog.open()
class SettingsDialog(Factory.Popup): def __init__(self, app): self.app = app self.plugins = self.app.plugins self.config = self.app.electrum_config Factory.Popup.__init__(self) layout = self.ids.scrollviewlayout layout.bind(minimum_height=layout.setter('height')) # cached dialogs self._fx_dialog = None self._fee_dialog = None self._network_dialog = None self._language_dialog = None self._unit_dialog = None self._coinselect_dialog = None def update(self): self.wallet = self.app.wallet self.disable_pin = self.wallet.is_watching_only( ) if self.wallet else True self.use_encryption = self.wallet.use_encryption if self.wallet else False def get_language_name(self): return languages.get(self.config.get('language', 'en_UK'), '') def change_password(self, item, dt): self.app.change_password(self.update) def language_dialog(self, item, dt): if self._language_dialog is None: l = self.config.get('language', 'en_UK') def cb(key): self.config.set_key("language", key, True) item.lang = self.get_language_name() self.app.language = key self._language_dialog = ChoiceDialog(_('Language'), languages, l, cb) self._language_dialog.open() def unit_dialog(self, item, dt): if self._unit_dialog is None: def cb(text): self.app._set_bu(text) item.bu = self.app.base_unit self._unit_dialog = ChoiceDialog(_('Denomination'), base_units.keys(), self.app.base_unit, cb) self._unit_dialog.open() def coinselect_status(self): return coinchooser.get_name(self.app.electrum_config) def coinselect_dialog(self, item, dt): if self._coinselect_dialog is None: choosers = sorted(coinchooser.COIN_CHOOSERS.keys()) chooser_name = coinchooser.get_name(self.config) def cb(text): self.config.set_key('coin_chooser', text) item.status = text self._coinselect_dialog = ChoiceDialog(_('Coin selection'), choosers, chooser_name, cb) self._coinselect_dialog.open() def network_dialog(self, item, dt): if self._network_dialog is None: server, port, protocol, proxy, auto_connect = self.app.network.get_parameters( ) def cb(popup): server = popup.ids.host.text auto_connect = popup.ids.auto_connect.active self.app.network.set_parameters(server, port, protocol, proxy, auto_connect) item.status = self.network_status() popup = Builder.load_file('gui/kivy/uix/ui_screens/network.kv') popup.ids.host.text = server popup.ids.auto_connect.active = auto_connect popup.on_dismiss = lambda: cb(popup) self._network_dialog = popup self._network_dialog.open() def network_status(self): server, port, protocol, proxy, auto_connect = self.app.network.get_parameters( ) return 'auto-connect' if auto_connect else server def plugin_dialog(self, name, label, dt): from checkbox_dialog import CheckBoxDialog def callback(status): self.plugins.enable(name) if status else self.plugins.disable(name) label.status = 'ON' if status else 'OFF' status = bool(self.plugins.get(name)) dd = self.plugins.descriptions.get(name) descr = dd.get('description') fullname = dd.get('fullname') d = CheckBoxDialog(fullname, descr, status, callback) d.open() def fee_status(self): if self.config.get('dynamic_fees'): f = self.config.get('fee_factor', 50) + 50 return 'Dynamic, %d%%' % f else: F = self.config.get('fee_per_kb', RECOMMENDED_FEE) return self.app.format_amount_and_units(F) + '/kB' def fee_dialog(self, label, dt): if self._fee_dialog is None: from fee_dialog import FeeDialog def cb(): label.status = self.fee_status() self._fee_dialog = FeeDialog(self.app, self.config, cb) self._fee_dialog.open() def fx_status(self): p = self.plugins.get('exchange_rate') if p: source = p.exchange.name() ccy = p.get_currency() return '%s [%s]' % (ccy, source) else: return 'Disabled' def fx_dialog(self, label, dt): if self._fx_dialog is None: from fx_dialog import FxDialog def cb(): label.status = self.fx_status() self._fx_dialog = FxDialog(self.app, self.plugins, self.config, cb) self._fx_dialog.open()
class SettingsDialog(Factory.Popup): def __init__(self, app): self.app = app self.plugins = self.app.plugins self.config = self.app.electrum_config Factory.Popup.__init__(self) layout = self.ids.scrollviewlayout layout.bind(minimum_height=layout.setter('height')) # cached dialogs self._fx_dialog = None self._fee_dialog = None self._proxy_dialog = None self._language_dialog = None self._unit_dialog = None self._coinselect_dialog = None def update(self): self.wallet = self.app.wallet self.disable_pin = self.wallet.is_watching_only() if self.wallet else True self.use_encryption = self.wallet.has_password() if self.wallet else False def get_language_name(self): return languages.get(self.config.get('language', 'en_UK'), '') def change_password(self, item, dt): self.app.change_password(self.update) def language_dialog(self, item, dt): if self._language_dialog is None: l = self.config.get('language', 'en_UK') def cb(key): self.config.set_key("language", key, True) item.lang = self.get_language_name() self.app.language = key self._language_dialog = ChoiceDialog(_('Language'), languages, l, cb) self._language_dialog.open() def unit_dialog(self, item, dt): if self._unit_dialog is None: def cb(text): self.app._set_bu(text) item.bu = self.app.base_unit self._unit_dialog = ChoiceDialog(_('Denomination'), base_units.keys(), self.app.base_unit, cb) self._unit_dialog.open() def coinselect_status(self): return coinchooser.get_name(self.app.electrum_config) def coinselect_dialog(self, item, dt): if self._coinselect_dialog is None: choosers = sorted(coinchooser.COIN_CHOOSERS.keys()) chooser_name = coinchooser.get_name(self.config) def cb(text): self.config.set_key('coin_chooser', text) item.status = text self._coinselect_dialog = ChoiceDialog(_('Coin selection'), choosers, chooser_name, cb) self._coinselect_dialog.open() def proxy_status(self): server, port, protocol, proxy, auto_connect = self.app.network.get_parameters() return proxy.get('host') +':' + proxy.get('port') if proxy else _('None') def proxy_dialog(self, item, dt): if self._proxy_dialog is None: server, port, protocol, proxy, auto_connect = self.app.network.get_parameters() def callback(popup): if popup.ids.mode.text != 'None': proxy = { 'mode':popup.ids.mode.text, 'host':popup.ids.host.text, 'port':popup.ids.port.text, 'user':popup.ids.user.text, 'password':popup.ids.password.text } else: proxy = None self.app.network.set_parameters(server, port, protocol, proxy, auto_connect) item.status = self.proxy_status() popup = Builder.load_file('gui/kivy/uix/ui_screens/proxy.kv') popup.ids.mode.text = proxy.get('mode') if proxy else 'None' popup.ids.host.text = proxy.get('host') if proxy else '' popup.ids.port.text = proxy.get('port') if proxy else '' popup.ids.user.text = proxy.get('user') if proxy else '' popup.ids.password.text = proxy.get('password') if proxy else '' popup.on_dismiss = lambda: callback(popup) self._proxy_dialog = popup self._proxy_dialog.open() def plugin_dialog(self, name, label, dt): from checkbox_dialog import CheckBoxDialog def callback(status): self.plugins.enable(name) if status else self.plugins.disable(name) label.status = 'ON' if status else 'OFF' status = bool(self.plugins.get(name)) dd = self.plugins.descriptions.get(name) descr = dd.get('description') fullname = dd.get('fullname') d = CheckBoxDialog(fullname, descr, status, callback) d.open() def fee_status(self): if self.config.get('dynamic_fees', True): return fee_levels[self.config.get('fee_level', 2)] else: return self.app.format_amount_and_units(self.config.fee_per_kb()) + '/kB' def fee_dialog(self, label, dt): if self._fee_dialog is None: from fee_dialog import FeeDialog def cb(): label.status = self.fee_status() self._fee_dialog = FeeDialog(self.app, self.config, cb) self._fee_dialog.open() def boolean_dialog(self, name, title, message, dt): from checkbox_dialog import CheckBoxDialog CheckBoxDialog(title, message, getattr(self.app, name), lambda x: setattr(self.app, name, x)).open() def fx_status(self): fx = self.app.fx if fx.is_enabled(): source = fx.exchange.name() ccy = fx.get_currency() return '%s [%s]' %(ccy, source) else: return _('None') def fx_dialog(self, label, dt): if self._fx_dialog is None: from fx_dialog import FxDialog def cb(): label.status = self.fx_status() self._fx_dialog = FxDialog(self.app, self.plugins, self.config, cb) self._fx_dialog.open()
class SettingsDialog(Factory.Popup): def __init__(self, app): self.app = app self.plugins = self.app.plugins self.config = self.app.electrum_config Factory.Popup.__init__(self) layout = self.ids.scrollviewlayout layout.bind(minimum_height=layout.setter('height')) # cached dialogs self._fx_dialog = None self._fee_dialog = None self._rbf_dialog = None self._network_dialog = None self._language_dialog = None self._unit_dialog = None self._coinselect_dialog = None def update(self): self.wallet = self.app.wallet self.disable_pin = self.wallet.is_watching_only( ) if self.wallet else True self.use_encryption = self.wallet.has_password( ) if self.wallet else False def get_language_name(self): return languages.get(self.config.get('language', 'en_UK'), '') def change_password(self, item, dt): self.app.change_password(self.update) def language_dialog(self, item, dt): if self._language_dialog is None: l = self.config.get('language', 'en_UK') def cb(key): self.config.set_key("language", key, True) item.lang = self.get_language_name() self.app.language = key self._language_dialog = ChoiceDialog(_('Language'), languages, l, cb) self._language_dialog.open() def unit_dialog(self, item, dt): if self._unit_dialog is None: def cb(text): self.app._set_bu(text) item.bu = self.app.base_unit self._unit_dialog = ChoiceDialog(_('Denomination'), base_units.keys(), self.app.base_unit, cb) self._unit_dialog.open() def coinselect_status(self): return coinchooser.get_name(self.app.electrum_config) def coinselect_dialog(self, item, dt): if self._coinselect_dialog is None: choosers = sorted(coinchooser.COIN_CHOOSERS.keys()) chooser_name = coinchooser.get_name(self.config) def cb(text): self.config.set_key('coin_chooser', text) item.status = text self._coinselect_dialog = ChoiceDialog(_('Coin selection'), choosers, chooser_name, cb) self._coinselect_dialog.open() def network_dialog(self, item, dt): if self._network_dialog is None: server, port, protocol, proxy, auto_connect = self.app.network.get_parameters( ) def cb(popup): server = popup.ids.host.text auto_connect = popup.ids.auto_connect.active self.app.network.set_parameters(server, port, protocol, proxy, auto_connect) item.status = self.network_status() popup = Builder.load_file('gui/kivy/uix/ui_screens/network.kv') popup.ids.host.text = server popup.ids.auto_connect.active = auto_connect popup.on_dismiss = lambda: cb(popup) self._network_dialog = popup self._network_dialog.open() def network_status(self): server, port, protocol, proxy, auto_connect = self.app.network.get_parameters( ) return 'auto-connect' if auto_connect else server def plugin_dialog(self, name, label, dt): from checkbox_dialog import CheckBoxDialog def callback(status): self.plugins.enable(name) if status else self.plugins.disable(name) label.status = 'ON' if status else 'OFF' status = bool(self.plugins.get(name)) dd = self.plugins.descriptions.get(name) descr = dd.get('description') fullname = dd.get('fullname') d = CheckBoxDialog(fullname, descr, status, callback) d.open() def fee_status(self): if self.config.get('dynamic_fees', True): from electrum.util import fee_levels return fee_levels[self.config.get('fee_level', 2)] else: F = self.config.get('fee_per_kb', RECOMMENDED_FEE) return self.app.format_amount_and_units(F) + '/kB' def fee_dialog(self, label, dt): if self._fee_dialog is None: from fee_dialog import FeeDialog def cb(): label.status = self.fee_status() self._fee_dialog = FeeDialog(self.app, self.config, cb) self._fee_dialog.open() def rbf_status(self): return 'ON' if self.config.get('use_rbf') else 'OFF' def rbf_dialog(self, label, dt): if self._rbf_dialog is None: from checkbox_dialog import CheckBoxDialog def cb(x): self.config.set_key('use_rbf', x, True) label.status = self.rbf_status() msg = [ _('If you check this box, your transactions will be marked as non-final,' ), _('and you will have the possiblity, while they are unconfirmed, to replace them with transactions that pays higher fees.' ), _('Note that some merchants do not accept non-final transactions until they are confirmed.' ) ] fullname = _('Replace by fee') self._rbf_dialog = CheckBoxDialog( fullname, ' '.join(msg), self.config.get('use_rbf', False), cb) self._rbf_dialog.open() def fx_status(self): p = self.plugins.get('exchange_rate') if p: source = p.exchange.name() ccy = p.get_currency() return '%s [%s]' % (ccy, source) else: return 'Disabled' def fx_dialog(self, label, dt): if self._fx_dialog is None: from fx_dialog import FxDialog def cb(): label.status = self.fx_status() self._fx_dialog = FxDialog(self.app, self.plugins, self.config, cb) self._fx_dialog.open()
def fx_dialog(self, label, dt): from fx_dialog import FxDialog def cb(): label.status = self.fx_status() d = FxDialog(self.app, self.plugins, self.config, cb) d.open()
class SettingsDialog(Factory.Popup): def __init__(self, app): self.app = app self.plugins = self.app.plugins self.config = self.app.electrum_config Factory.Popup.__init__(self) layout = self.ids.scrollviewlayout layout.bind(minimum_height=layout.setter('height')) # cached dialogs self._fx_dialog = None self._fee_dialog = None self._network_dialog = None self._language_dialog = None self._unit_dialog = None self._coinselect_dialog = None def update(self): self.wallet = self.app.wallet self.watching_only = self.wallet.is_watching_only() self.use_encryption = self.wallet.use_encryption def get_language_name(self): return languages.get(self.config.get('language', 'en_UK'), '') def change_password(self, item, dt): self.app.change_password(self.update) def language_dialog(self, item, dt): if self._language_dialog is None: l = self.config.get('language', 'en_UK') def cb(key): self.config.set_key("language", key, True) item.lang = self.get_language_name() self.app.language = key self._language_dialog = ChoiceDialog(_('Language'), languages, l, cb) self._language_dialog.open() def unit_dialog(self, item, dt): if self._unit_dialog is None: def cb(text): self.app._set_bu(text) item.bu = self.app.base_unit self._unit_dialog = ChoiceDialog(_('Denomination'), base_units.keys(), self.app.base_unit, cb) self._unit_dialog.open() def coinselect_status(self): return self.app.wallet.coin_chooser_name(self.app.electrum_config) def coinselect_dialog(self, item, dt): if self._coinselect_dialog is None: from electrum import COIN_CHOOSERS choosers = sorted(COIN_CHOOSERS.keys()) chooser_name = self.app.wallet.coin_chooser_name(self.config) def cb(text): self.config.set_key('coin_chooser', text) item.status = text self._coinselect_dialog = ChoiceDialog(_('Coin selection'), choosers, chooser_name, cb) self._coinselect_dialog.open() def network_dialog(self, item, dt): if self._network_dialog is None: server, port, protocol, proxy, auto_connect = self.app.network.get_parameters() def cb(popup): server = popup.ids.host.text auto_connect = popup.ids.auto_connect.active self.app.network.set_parameters(server, port, protocol, proxy, auto_connect) item.status = self.network_status() popup = Builder.load_file('gui/kivy/uix/ui_screens/network.kv') popup.ids.host.text = server popup.ids.auto_connect.active = auto_connect popup.on_dismiss = lambda: cb(popup) self._network_dialog = popup self._network_dialog.open() def network_status(self): server, port, protocol, proxy, auto_connect = self.app.network.get_parameters() return 'auto-connect' if auto_connect else server def plugin_dialog(self, name, label, dt): from checkbox_dialog import CheckBoxDialog def callback(status): self.plugins.enable(name) if status else self.plugins.disable(name) label.status = 'ON' if status else 'OFF' status = bool(self.plugins.get(name)) dd = self.plugins.descriptions.get(name) descr = dd.get('description') fullname = dd.get('fullname') d = CheckBoxDialog(fullname, descr, status, callback) d.open() def fee_status(self): if self.config.get('dynamic_fees'): f = self.config.get('fee_factor', 50) + 50 return 'Dynamic, %d%%'%f else: F = self.config.get('fee_per_kb', RECOMMENDED_FEE) return self.app.format_amount_and_units(F) + '/kB' def fee_dialog(self, label, dt): if self._fee_dialog is None: from fee_dialog import FeeDialog def cb(): label.status = self.fee_status() self._fee_dialog = FeeDialog(self.app, self.config, cb) self._fee_dialog.open() def fx_status(self): p = self.plugins.get('exchange_rate') if p: source = p.exchange.name() ccy = p.get_currency() return '%s [%s]' %(ccy, source) else: return 'Disabled' def fx_dialog(self, label, dt): if self._fx_dialog is None: from fx_dialog import FxDialog def cb(): label.status = self.fx_status() self._fx_dialog = FxDialog(self.app, self.plugins, self.config, cb) self._fx_dialog.open()
class SettingsDialog(Factory.Popup): def __init__(self, app): self.app = app self.plugins = self.app.plugins self.config = self.app.electrum_config Factory.Popup.__init__(self) layout = self.ids.scrollviewlayout layout.bind(minimum_height=layout.setter('height')) # cached dialogs self._fx_dialog = None self._fee_dialog = None self._rbf_dialog = None self._network_dialog = None self._language_dialog = None self._unit_dialog = None self._coinselect_dialog = None def update(self): self.wallet = self.app.wallet self.disable_pin = self.wallet.is_watching_only() if self.wallet else True self.use_encryption = self.wallet.use_encryption if self.wallet else False def get_language_name(self): return languages.get(self.config.get('language', 'en_UK'), '') def change_password(self, item, dt): self.app.change_password(self.update) def language_dialog(self, item, dt): if self._language_dialog is None: l = self.config.get('language', 'en_UK') def cb(key): self.config.set_key("language", key, True) item.lang = self.get_language_name() self.app.language = key self._language_dialog = ChoiceDialog(_('Language'), languages, l, cb) self._language_dialog.open() def unit_dialog(self, item, dt): if self._unit_dialog is None: def cb(text): self.app._set_bu(text) item.bu = self.app.base_unit self._unit_dialog = ChoiceDialog(_('Denomination'), base_units.keys(), self.app.base_unit, cb) self._unit_dialog.open() def coinselect_status(self): return coinchooser.get_name(self.app.electrum_config) def coinselect_dialog(self, item, dt): if self._coinselect_dialog is None: choosers = sorted(coinchooser.COIN_CHOOSERS.keys()) chooser_name = coinchooser.get_name(self.config) def cb(text): self.config.set_key('coin_chooser', text) item.status = text self._coinselect_dialog = ChoiceDialog(_('Coin selection'), choosers, chooser_name, cb) self._coinselect_dialog.open() def network_dialog(self, item, dt): if self._network_dialog is None: server, port, protocol, proxy, auto_connect = self.app.network.get_parameters() def cb(popup): server = popup.ids.host.text auto_connect = popup.ids.auto_connect.active self.app.network.set_parameters(server, port, protocol, proxy, auto_connect) item.status = self.network_status() popup = Builder.load_file('gui/kivy/uix/ui_screens/network.kv') popup.ids.host.text = server popup.ids.auto_connect.active = auto_connect popup.on_dismiss = lambda: cb(popup) self._network_dialog = popup self._network_dialog.open() def network_status(self): server, port, protocol, proxy, auto_connect = self.app.network.get_parameters() return 'auto-connect' if auto_connect else server def plugin_dialog(self, name, label, dt): from checkbox_dialog import CheckBoxDialog def callback(status): self.plugins.enable(name) if status else self.plugins.disable(name) label.status = 'ON' if status else 'OFF' status = bool(self.plugins.get(name)) dd = self.plugins.descriptions.get(name) descr = dd.get('description') fullname = dd.get('fullname') d = CheckBoxDialog(fullname, descr, status, callback) d.open() def fee_status(self): if self.config.get('dynamic_fees', True): from electrum.util import fee_levels return fee_levels[self.config.get('fee_level', 2)] else: F = self.config.get('fee_per_kb', RECOMMENDED_FEE) return self.app.format_amount_and_units(F) + '/kB' def fee_dialog(self, label, dt): if self._fee_dialog is None: from fee_dialog import FeeDialog def cb(): label.status = self.fee_status() self._fee_dialog = FeeDialog(self.app, self.config, cb) self._fee_dialog.open() def rbf_status(self): return 'ON' if self.config.get('use_rbf') else 'OFF' def rbf_dialog(self, label, dt): if self._rbf_dialog is None: from checkbox_dialog import CheckBoxDialog def cb(x): self.config.set_key('use_rbf', x, True) label.status = self.rbf_status() msg = [_('If you check this box, your transactions will be marked as non-final,'), _('and you will have the possiblity, while they are unconfirmed, to replace them with transactions that pays higher fees.'), _('Note that some merchants do not accept non-final transactions until they are confirmed.')] fullname = _('Replace by fee') self._rbf_dialog = CheckBoxDialog(fullname, ' '.join(msg), self.config.get('use_rbf', False), cb) self._rbf_dialog.open() def fx_status(self): p = self.plugins.get('exchange_rate') if p: source = p.exchange.name() ccy = p.get_currency() return '%s [%s]' %(ccy, source) else: return 'Disabled' def fx_dialog(self, label, dt): if self._fx_dialog is None: from fx_dialog import FxDialog def cb(): label.status = self.fx_status() self._fx_dialog = FxDialog(self.app, self.plugins, self.config, cb) self._fx_dialog.open()