Browse Source

use QEAvailableWalletListModel for available wallets

patch-4
Sander van Grieken 3 years ago
parent
commit
4b3f79f41c
  1. 23
      electrum/gui/qml/qedaemon.py

23
electrum/gui/qml/qedaemon.py

@ -80,10 +80,14 @@ class QEDaemon(QObject):
_logger = get_logger(__name__)
_loaded_wallets = QEWalletListModel()
_available_wallets = None
walletLoaded = pyqtSignal()
walletRequiresPassword = pyqtSignal()
activeWalletsChanged = pyqtSignal()
availableWalletsChanged = pyqtSignal()
_current_wallet = None
@pyqtSlot()
@ -112,20 +116,13 @@ class QEDaemon(QObject):
return self._current_wallet.wallet.basename()
return ''
@pyqtProperty(QEWalletListModel)
@pyqtProperty(QEWalletListModel, notify=activeWalletsChanged)
def activeWallets(self):
return self._loaded_wallets
@pyqtProperty(QEWalletListModel)
@pyqtProperty(QEAvailableWalletListModel, notify=availableWalletsChanged)
def availableWallets(self):
available = []
availableListModel = QEWalletListModel(self)
wallet_folder = os.path.dirname(self.daemon.config.get_wallet_path())
with os.scandir(wallet_folder) as it:
for i in it:
if i.is_file():
available.append(i.path)
for path in sorted(available):
wallet = self.daemon.get_wallet(path)
availableListModel.add_wallet(wallet_path = path, wallet = wallet)
return availableListModel
if not self._available_wallets:
self._available_wallets = QEAvailableWalletListModel(self.daemon)
return self._available_wallets

Loading…
Cancel
Save