diff --git a/electrum/gui/qml/components/ChannelBackups.qml b/electrum/gui/qml/components/ChannelBackups.qml index ab090e210..491976d9f 100644 --- a/electrum/gui/qml/components/ChannelBackups.qml +++ b/electrum/gui/qml/components/ChannelBackups.qml @@ -2,7 +2,6 @@ import QtQuick 2.6 import QtQuick.Layouts 1.0 import QtQuick.Controls 2.3 import QtQuick.Controls.Material 2.0 -import QtQml.Models 2.2 import org.electrum 1.0 @@ -66,7 +65,7 @@ Pane { ScrollIndicator.vertical: ScrollIndicator { } Label { - visible: Daemon.currentWallet.channelModel.count == 0 + visible: listview.model.count == 0 anchors.centerIn: parent width: listview.width * 4/5 font.pixelSize: constants.fontSizeXXLarge @@ -99,20 +98,6 @@ Pane { } } - Component { - id: swapDialog - SwapDialog { - onClosed: destroy() - } - } - - Component { - id: openChannelDialog - OpenChannelDialog { - onClosed: destroy() - } - } - Component { id: importChannelBackupDialog ImportChannelBackupDialog { diff --git a/electrum/gui/qml/components/Channels.qml b/electrum/gui/qml/components/Channels.qml index 810a36142..c05c14c8b 100644 --- a/electrum/gui/qml/components/Channels.qml +++ b/electrum/gui/qml/components/Channels.qml @@ -89,7 +89,7 @@ Pane { ScrollIndicator.vertical: ScrollIndicator { } Label { - visible: Daemon.currentWallet.channelModel.count == 0 + visible: listview.model.count == 0 anchors.centerIn: parent width: listview.width * 4/5 font.pixelSize: constants.fontSizeXXLarge @@ -135,14 +135,6 @@ Pane { } - Connections { - target: Daemon.currentWallet - function onImportChannelBackupFailed(message) { - var dialog = app.messageDialog.createObject(root, { text: message }) - dialog.open() - } - } - Component { id: swapDialog SwapDialog { @@ -157,11 +149,4 @@ Pane { } } - Component { - id: importChannelBackupDialog - ImportChannelBackupDialog { - onClosed: destroy() - } - } - } diff --git a/electrum/gui/qml/qemodelfilter.py b/electrum/gui/qml/qemodelfilter.py index dc7a0a36b..f024bea4a 100644 --- a/electrum/gui/qml/qemodelfilter.py +++ b/electrum/gui/qml/qemodelfilter.py @@ -1,4 +1,4 @@ -from PyQt5.QtCore import QSortFilterProxyModel +from PyQt5.QtCore import pyqtSignal, pyqtProperty, QSortFilterProxyModel, QModelIndex from electrum.logging import get_logger @@ -11,6 +11,11 @@ class QEFilterProxyModel(QSortFilterProxyModel): super().__init__(parent) self.setSourceModel(parent_model) + countChanged = pyqtSignal() + @pyqtProperty(int, notify=countChanged) + def count(self): + return self.rowCount(QModelIndex()) + def isCustomFilter(self): return self._filter_value is not None @@ -23,5 +28,4 @@ class QEFilterProxyModel(QSortFilterProxyModel): parent_model = self.sourceModel() d = parent_model.data(parent_model.index(s_row, 0, s_parent), self.filterRole()) - # self._logger.debug(f'DATA in FilterProxy is {repr(d)}') return True if self._filter_value is None else d == self._filter_value