1
0

kivy: settings dialog: call update() from __init__

this is a clearer/easier-to-understand API
This commit is contained in:
SomberNight
2021-06-11 14:51:09 +02:00
parent ad06398e4e
commit 325cd950a4
3 changed files with 7 additions and 2 deletions

View File

@@ -723,6 +723,7 @@ class ElectrumWindow(App, Logger):
from .uix.dialogs.settings import SettingsDialog from .uix.dialogs.settings import SettingsDialog
if self._settings_dialog is None: if self._settings_dialog is None:
self._settings_dialog = SettingsDialog(self) self._settings_dialog = SettingsDialog(self)
else:
self._settings_dialog.update() self._settings_dialog.update()
self._settings_dialog.open() self._settings_dialog.open()
@@ -1183,6 +1184,7 @@ class ElectrumWindow(App, Logger):
from .uix.dialogs.addresses import AddressesDialog from .uix.dialogs.addresses import AddressesDialog
if self._addresses_dialog is None: if self._addresses_dialog is None:
self._addresses_dialog = AddressesDialog(self) self._addresses_dialog = AddressesDialog(self)
else:
self._addresses_dialog.update() self._addresses_dialog.update()
self._addresses_dialog.open() self._addresses_dialog.open()

View File

@@ -237,6 +237,7 @@ class AddressesDialog(Factory.Popup):
def __init__(self, app: 'ElectrumWindow'): def __init__(self, app: 'ElectrumWindow'):
Factory.Popup.__init__(self) Factory.Popup.__init__(self)
self.app = app self.app = app
self.update()
def get_card(self, addr, balance, is_used, label): def get_card(self, addr, balance, is_used, label):
ci = {} ci = {}

View File

@@ -122,6 +122,8 @@ class SettingsDialog(Factory.Popup):
self._unit_dialog = None self._unit_dialog = None
self._coinselect_dialog = None self._coinselect_dialog = None
self.update()
def update(self): def update(self):
self.wallet = self.app.wallet self.wallet = self.app.wallet
self.use_encryption = self.wallet.has_password() if self.wallet else False self.use_encryption = self.wallet.has_password() if self.wallet else False