expose additional wallet properties
(lightning enabled, balance, masterpubkey) and a few smaller improvements
This commit is contained in:
@@ -122,6 +122,7 @@ Pane {
|
|||||||
onClicked: {
|
onClicked: {
|
||||||
labelEdit.text = addressdetails.label
|
labelEdit.text = addressdetails.label
|
||||||
labelContent.editmode = true
|
labelContent.editmode = true
|
||||||
|
labelEdit.focus = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
TextField {
|
TextField {
|
||||||
|
|||||||
@@ -175,6 +175,7 @@ Pane {
|
|||||||
onClicked: {
|
onClicked: {
|
||||||
labelEdit.text = txdetails.label
|
labelEdit.text = txdetails.label
|
||||||
labelContent.editmode = true
|
labelContent.editmode = true
|
||||||
|
labelEdit.focus = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
TextField {
|
TextField {
|
||||||
|
|||||||
@@ -17,39 +17,71 @@ Pane {
|
|||||||
width: parent.width
|
width: parent.width
|
||||||
height: parent.height
|
height: parent.height
|
||||||
|
|
||||||
Item {
|
GridLayout {
|
||||||
width: parent.width
|
id: detailsLayout
|
||||||
height: detailsLayout.height
|
Layout.preferredWidth: parent.width
|
||||||
|
|
||||||
|
columns: 4
|
||||||
|
|
||||||
GridLayout {
|
Label { text: 'Wallet'; Layout.columnSpan: 2; color: Material.accentColor }
|
||||||
id: detailsLayout
|
Label { text: Daemon.currentWallet.name; Layout.columnSpan: 2 }
|
||||||
|
|
||||||
|
Label { text: 'derivation prefix (BIP32)'; visible: Daemon.currentWallet.isDeterministic; color: Material.accentColor; Layout.columnSpan: 2 }
|
||||||
|
Label { text: Daemon.currentWallet.derivationPrefix; visible: Daemon.currentWallet.isDeterministic; Layout.columnSpan: 2 }
|
||||||
|
|
||||||
|
Label { text: 'txinType'; color: Material.accentColor }
|
||||||
|
Label { text: Daemon.currentWallet.txinType }
|
||||||
|
|
||||||
|
Label { text: 'is deterministic'; color: Material.accentColor }
|
||||||
|
Label { text: Daemon.currentWallet.isDeterministic }
|
||||||
|
|
||||||
|
Label { text: 'is watch only'; color: Material.accentColor }
|
||||||
|
Label { text: Daemon.currentWallet.isWatchOnly }
|
||||||
|
|
||||||
|
Label { text: 'is Encrypted'; color: Material.accentColor }
|
||||||
|
Label { text: Daemon.currentWallet.isEncrypted }
|
||||||
|
|
||||||
|
Label { text: 'is Hardware'; color: Material.accentColor }
|
||||||
|
Label { text: Daemon.currentWallet.isHardware }
|
||||||
|
|
||||||
|
Label { text: 'is Lightning'; color: Material.accentColor }
|
||||||
|
Label { text: Daemon.currentWallet.isLightning }
|
||||||
|
|
||||||
|
Label { text: 'has Seed'; color: Material.accentColor }
|
||||||
|
Label { text: Daemon.currentWallet.hasSeed; Layout.columnSpan: 3 }
|
||||||
|
|
||||||
|
Label { Layout.columnSpan:4; text: qsTr('Master Public Key'); color: Material.accentColor }
|
||||||
|
|
||||||
|
TextHighlightPane {
|
||||||
|
Layout.columnSpan: 4
|
||||||
|
Layout.fillWidth: true
|
||||||
|
padding: 0
|
||||||
|
leftPadding: constants.paddingSmall
|
||||||
|
|
||||||
|
RowLayout {
|
||||||
width: parent.width
|
width: parent.width
|
||||||
columns: 4
|
Label {
|
||||||
|
text: Daemon.currentWallet.masterPubkey
|
||||||
Label { text: 'Wallet'; Layout.columnSpan: 2 }
|
wrapMode: Text.Wrap
|
||||||
Label { text: Daemon.currentWallet.name; Layout.columnSpan: 2; color: Material.accentColor }
|
Layout.fillWidth: true
|
||||||
|
font.pixelSize: constants.fontSizeMedium
|
||||||
Label { text: 'derivation prefix (BIP32)'; visible: Daemon.currentWallet.isDeterministic; Layout.columnSpan: 2 }
|
}
|
||||||
Label { text: Daemon.currentWallet.derivationPrefix; visible: Daemon.currentWallet.isDeterministic; color: Material.accentColor; Layout.columnSpan: 2 }
|
ToolButton {
|
||||||
|
icon.source: '../../icons/share.png'
|
||||||
Label { text: 'txinType' }
|
icon.color: 'transparent'
|
||||||
Label { text: Daemon.currentWallet.txinType; color: Material.accentColor }
|
onClicked: {
|
||||||
|
var dialog = share.createObject(rootItem, {
|
||||||
Label { text: 'is deterministic' }
|
'title': qsTr('Master Public Key'),
|
||||||
Label { text: Daemon.currentWallet.isDeterministic; color: Material.accentColor }
|
'text': Daemon.currentWallet.masterPubkey
|
||||||
|
})
|
||||||
Label { text: 'is watch only' }
|
dialog.open()
|
||||||
Label { text: Daemon.currentWallet.isWatchOnly; color: Material.accentColor }
|
}
|
||||||
|
}
|
||||||
Label { text: 'is Encrypted' }
|
|
||||||
Label { text: Daemon.currentWallet.isEncrypted; color: Material.accentColor }
|
|
||||||
|
|
||||||
Label { text: 'is Hardware' }
|
|
||||||
Label { text: Daemon.currentWallet.isHardware; color: Material.accentColor }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// }
|
}
|
||||||
|
|
||||||
|
Item { width: 1; height: 1 }
|
||||||
|
|
||||||
Frame {
|
Frame {
|
||||||
id: detailsFrame
|
id: detailsFrame
|
||||||
@@ -59,49 +91,71 @@ Pane {
|
|||||||
horizontalPadding: 0
|
horizontalPadding: 0
|
||||||
background: PaneInsetBackground {}
|
background: PaneInsetBackground {}
|
||||||
|
|
||||||
ListView {
|
ColumnLayout {
|
||||||
id: listview
|
spacing: 0
|
||||||
width: parent.width
|
anchors.fill: parent
|
||||||
height: parent.height
|
|
||||||
clip: true
|
|
||||||
model: Daemon.availableWallets
|
|
||||||
|
|
||||||
delegate: AbstractButton {
|
|
||||||
width: ListView.view.width
|
|
||||||
height: row.height
|
|
||||||
|
|
||||||
|
Item {
|
||||||
|
Layout.preferredHeight: hitem.height
|
||||||
|
Layout.preferredWidth: parent.width
|
||||||
|
Rectangle {
|
||||||
|
anchors.fill: parent
|
||||||
|
color: Qt.lighter(Material.background, 1.25)
|
||||||
|
}
|
||||||
RowLayout {
|
RowLayout {
|
||||||
id: row
|
id: hitem
|
||||||
spacing: 10
|
width: parent.width
|
||||||
x: constants.paddingSmall
|
|
||||||
width: parent.width - 2 * constants.paddingSmall
|
|
||||||
|
|
||||||
Image {
|
|
||||||
id: walleticon
|
|
||||||
source: "../../icons/wallet.png"
|
|
||||||
fillMode: Image.PreserveAspectFit
|
|
||||||
Layout.preferredWidth: constants.iconSizeLarge
|
|
||||||
Layout.preferredHeight: constants.iconSizeLarge
|
|
||||||
}
|
|
||||||
|
|
||||||
Label {
|
Label {
|
||||||
|
text: qsTr('Available wallets')
|
||||||
font.pixelSize: constants.fontSizeLarge
|
font.pixelSize: constants.fontSizeLarge
|
||||||
text: model.name
|
color: Material.accentColor
|
||||||
Layout.fillWidth: true
|
|
||||||
}
|
|
||||||
|
|
||||||
Button {
|
|
||||||
text: 'Open'
|
|
||||||
onClicked: {
|
|
||||||
Daemon.load_wallet(model.path)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ScrollIndicator.vertical: ScrollIndicator { }
|
ListView {
|
||||||
}
|
id: listview
|
||||||
|
Layout.preferredWidth: parent.width
|
||||||
|
Layout.fillHeight: true
|
||||||
|
clip: true
|
||||||
|
model: Daemon.availableWallets
|
||||||
|
|
||||||
|
delegate: AbstractButton {
|
||||||
|
width: ListView.view.width
|
||||||
|
height: row.height
|
||||||
|
|
||||||
|
RowLayout {
|
||||||
|
id: row
|
||||||
|
spacing: 10
|
||||||
|
x: constants.paddingSmall
|
||||||
|
width: parent.width - 2 * constants.paddingSmall
|
||||||
|
|
||||||
|
Image {
|
||||||
|
id: walleticon
|
||||||
|
source: "../../icons/wallet.png"
|
||||||
|
fillMode: Image.PreserveAspectFit
|
||||||
|
Layout.preferredWidth: constants.iconSizeLarge
|
||||||
|
Layout.preferredHeight: constants.iconSizeLarge
|
||||||
|
}
|
||||||
|
|
||||||
|
Label {
|
||||||
|
font.pixelSize: constants.fontSizeLarge
|
||||||
|
text: model.name
|
||||||
|
Layout.fillWidth: true
|
||||||
|
}
|
||||||
|
|
||||||
|
Button {
|
||||||
|
text: 'Open'
|
||||||
|
onClicked: {
|
||||||
|
Daemon.load_wallet(model.path)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ScrollIndicator.vertical: ScrollIndicator { }
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Button {
|
Button {
|
||||||
@@ -126,4 +180,10 @@ Pane {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Component {
|
||||||
|
id: share
|
||||||
|
GenericShareDialog {
|
||||||
|
onClosed: destroy()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,5 +6,6 @@ import QtQuick.Controls.Material 2.0
|
|||||||
Pane {
|
Pane {
|
||||||
background: Rectangle {
|
background: Rectangle {
|
||||||
color: Qt.lighter(Material.background, 1.15)
|
color: Qt.lighter(Material.background, 1.15)
|
||||||
|
radius: constants.paddingSmall
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -197,6 +197,15 @@ class QEWallet(QObject):
|
|||||||
def name(self):
|
def name(self):
|
||||||
return self.wallet.basename()
|
return self.wallet.basename()
|
||||||
|
|
||||||
|
isLightningChanged = pyqtSignal()
|
||||||
|
@pyqtProperty(bool, notify=isLightningChanged)
|
||||||
|
def isLightning(self):
|
||||||
|
return bool(self.wallet.lnworker)
|
||||||
|
|
||||||
|
@pyqtProperty(bool, notify=dataChanged)
|
||||||
|
def hasSeed(self):
|
||||||
|
return self.wallet.has_seed()
|
||||||
|
|
||||||
@pyqtProperty('QString', notify=dataChanged)
|
@pyqtProperty('QString', notify=dataChanged)
|
||||||
def txinType(self):
|
def txinType(self):
|
||||||
return self.wallet.get_txin_type(self.wallet.dummy_address())
|
return self.wallet.get_txin_type(self.wallet.dummy_address())
|
||||||
@@ -224,6 +233,10 @@ class QEWallet(QObject):
|
|||||||
self._logger.debug('multiple keystores not supported yet')
|
self._logger.debug('multiple keystores not supported yet')
|
||||||
return keystores[0].get_derivation_prefix()
|
return keystores[0].get_derivation_prefix()
|
||||||
|
|
||||||
|
@pyqtProperty(str, notify=dataChanged)
|
||||||
|
def masterPubkey(self):
|
||||||
|
return self.wallet.get_master_public_key()
|
||||||
|
|
||||||
balanceChanged = pyqtSignal()
|
balanceChanged = pyqtSignal()
|
||||||
|
|
||||||
@pyqtProperty(QEAmount, notify=balanceChanged)
|
@pyqtProperty(QEAmount, notify=balanceChanged)
|
||||||
@@ -243,6 +256,13 @@ class QEWallet(QObject):
|
|||||||
self._confirmedbalance = QEAmount(amount_sat=c+x)
|
self._confirmedbalance = QEAmount(amount_sat=c+x)
|
||||||
return self._confirmedbalance
|
return self._confirmedbalance
|
||||||
|
|
||||||
|
@pyqtProperty(QEAmount, notify=balanceChanged)
|
||||||
|
def lightningBalance(self):
|
||||||
|
if not self.isLightning:
|
||||||
|
return QEAmount()
|
||||||
|
self._lightningbalance = QEAmount(amount_sat=self.wallet.lnworker.get_balance())
|
||||||
|
return self._lightningbalance
|
||||||
|
|
||||||
@pyqtSlot('QString', int, int, bool)
|
@pyqtSlot('QString', int, int, bool)
|
||||||
def send_onchain(self, address, amount, fee=None, rbf=False):
|
def send_onchain(self, address, amount, fee=None, rbf=False):
|
||||||
self._logger.info('send_onchain: %s %d' % (address,amount))
|
self._logger.info('send_onchain: %s %d' % (address,amount))
|
||||||
|
|||||||
Reference in New Issue
Block a user