qml: clean up Channels/ChannelBackups, implement proper count property on QEFilterProxyModel
This commit is contained in:
@@ -2,7 +2,6 @@ import QtQuick 2.6
|
|||||||
import QtQuick.Layouts 1.0
|
import QtQuick.Layouts 1.0
|
||||||
import QtQuick.Controls 2.3
|
import QtQuick.Controls 2.3
|
||||||
import QtQuick.Controls.Material 2.0
|
import QtQuick.Controls.Material 2.0
|
||||||
import QtQml.Models 2.2
|
|
||||||
|
|
||||||
import org.electrum 1.0
|
import org.electrum 1.0
|
||||||
|
|
||||||
@@ -66,7 +65,7 @@ Pane {
|
|||||||
ScrollIndicator.vertical: ScrollIndicator { }
|
ScrollIndicator.vertical: ScrollIndicator { }
|
||||||
|
|
||||||
Label {
|
Label {
|
||||||
visible: Daemon.currentWallet.channelModel.count == 0
|
visible: listview.model.count == 0
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
width: listview.width * 4/5
|
width: listview.width * 4/5
|
||||||
font.pixelSize: constants.fontSizeXXLarge
|
font.pixelSize: constants.fontSizeXXLarge
|
||||||
@@ -99,20 +98,6 @@ Pane {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Component {
|
|
||||||
id: swapDialog
|
|
||||||
SwapDialog {
|
|
||||||
onClosed: destroy()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Component {
|
|
||||||
id: openChannelDialog
|
|
||||||
OpenChannelDialog {
|
|
||||||
onClosed: destroy()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Component {
|
Component {
|
||||||
id: importChannelBackupDialog
|
id: importChannelBackupDialog
|
||||||
ImportChannelBackupDialog {
|
ImportChannelBackupDialog {
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ Pane {
|
|||||||
ScrollIndicator.vertical: ScrollIndicator { }
|
ScrollIndicator.vertical: ScrollIndicator { }
|
||||||
|
|
||||||
Label {
|
Label {
|
||||||
visible: Daemon.currentWallet.channelModel.count == 0
|
visible: listview.model.count == 0
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
width: listview.width * 4/5
|
width: listview.width * 4/5
|
||||||
font.pixelSize: constants.fontSizeXXLarge
|
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 {
|
Component {
|
||||||
id: swapDialog
|
id: swapDialog
|
||||||
SwapDialog {
|
SwapDialog {
|
||||||
@@ -157,11 +149,4 @@ Pane {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Component {
|
|
||||||
id: importChannelBackupDialog
|
|
||||||
ImportChannelBackupDialog {
|
|
||||||
onClosed: destroy()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
from PyQt5.QtCore import QSortFilterProxyModel
|
from PyQt5.QtCore import pyqtSignal, pyqtProperty, QSortFilterProxyModel, QModelIndex
|
||||||
|
|
||||||
from electrum.logging import get_logger
|
from electrum.logging import get_logger
|
||||||
|
|
||||||
@@ -11,6 +11,11 @@ class QEFilterProxyModel(QSortFilterProxyModel):
|
|||||||
super().__init__(parent)
|
super().__init__(parent)
|
||||||
self.setSourceModel(parent_model)
|
self.setSourceModel(parent_model)
|
||||||
|
|
||||||
|
countChanged = pyqtSignal()
|
||||||
|
@pyqtProperty(int, notify=countChanged)
|
||||||
|
def count(self):
|
||||||
|
return self.rowCount(QModelIndex())
|
||||||
|
|
||||||
def isCustomFilter(self):
|
def isCustomFilter(self):
|
||||||
return self._filter_value is not None
|
return self._filter_value is not None
|
||||||
|
|
||||||
@@ -23,5 +28,4 @@ class QEFilterProxyModel(QSortFilterProxyModel):
|
|||||||
|
|
||||||
parent_model = self.sourceModel()
|
parent_model = self.sourceModel()
|
||||||
d = parent_model.data(parent_model.index(s_row, 0, s_parent), self.filterRole())
|
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
|
return True if self._filter_value is None else d == self._filter_value
|
||||||
|
|||||||
Reference in New Issue
Block a user