mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-08-31 17:31:36 +00:00
Implemented receiving addresses to lite gui
This commit is contained in:
parent
32f3a42c04
commit
6394712392
3 changed files with 76 additions and 6 deletions
|
@ -34,6 +34,22 @@ MiniWindow QPushButton {
|
||||||
min-height: 23px;
|
min-height: 23px;
|
||||||
padding: 2px;
|
padding: 2px;
|
||||||
}
|
}
|
||||||
|
#receive_button
|
||||||
|
{
|
||||||
|
color: #777;
|
||||||
|
border: 1px solid #CCC;
|
||||||
|
border-radius: 0px;
|
||||||
|
background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
|
||||||
|
stop: 0 white, stop: 1 #E6E6E6);
|
||||||
|
min-height: 25px;
|
||||||
|
min-width: 30px;
|
||||||
|
}
|
||||||
|
#receive_button[isActive=true]
|
||||||
|
{
|
||||||
|
color: #575757;
|
||||||
|
background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
|
||||||
|
stop: 0 white, stop: 1 #D1D1D1);
|
||||||
|
}
|
||||||
|
|
||||||
#address_input, #amount_input
|
#address_input, #amount_input
|
||||||
{
|
{
|
||||||
|
|
|
@ -26,6 +26,7 @@ import time
|
||||||
import wallet
|
import wallet
|
||||||
import webbrowser
|
import webbrowser
|
||||||
import history_widget
|
import history_widget
|
||||||
|
import receiving_widget
|
||||||
import util
|
import util
|
||||||
import csv
|
import csv
|
||||||
import datetime
|
import datetime
|
||||||
|
@ -171,10 +172,6 @@ class MiniWindow(QDialog):
|
||||||
self.balance_label = BalanceLabel(self.change_quote_currency)
|
self.balance_label = BalanceLabel(self.change_quote_currency)
|
||||||
self.balance_label.setObjectName("balance_label")
|
self.balance_label.setObjectName("balance_label")
|
||||||
|
|
||||||
self.receive_button = QPushButton(_("&Receive"))
|
|
||||||
self.receive_button.setObjectName("receive_button")
|
|
||||||
self.receive_button.setDefault(True)
|
|
||||||
self.receive_button.clicked.connect(self.copy_address)
|
|
||||||
|
|
||||||
# Bitcoin address code
|
# Bitcoin address code
|
||||||
self.address_input = QLineEdit()
|
self.address_input = QLineEdit()
|
||||||
|
@ -214,12 +211,17 @@ class MiniWindow(QDialog):
|
||||||
self.send_button.setDisabled(True);
|
self.send_button.setDisabled(True);
|
||||||
self.send_button.clicked.connect(self.send)
|
self.send_button.clicked.connect(self.send)
|
||||||
|
|
||||||
|
# Creating the receive button
|
||||||
|
self.receive_button = QPushButton(_("&Receive"))
|
||||||
|
self.receive_button.setObjectName("receive_button")
|
||||||
|
self.receive_button.setDefault(True)
|
||||||
|
|
||||||
main_layout = QGridLayout(self)
|
main_layout = QGridLayout(self)
|
||||||
|
|
||||||
main_layout.addWidget(self.balance_label, 0, 0)
|
main_layout.addWidget(self.balance_label, 0, 0)
|
||||||
main_layout.addWidget(self.receive_button, 0, 1)
|
main_layout.addWidget(self.receive_button, 0, 1)
|
||||||
|
|
||||||
main_layout.addWidget(self.address_input, 1, 0, 1, -1)
|
main_layout.addWidget(self.address_input, 1, 0)
|
||||||
|
|
||||||
main_layout.addWidget(self.amount_input, 2, 0)
|
main_layout.addWidget(self.amount_input, 2, 0)
|
||||||
main_layout.addWidget(self.send_button, 2, 1)
|
main_layout.addWidget(self.send_button, 2, 1)
|
||||||
|
@ -228,8 +230,41 @@ class MiniWindow(QDialog):
|
||||||
self.history_list.setObjectName("history")
|
self.history_list.setObjectName("history")
|
||||||
self.history_list.hide()
|
self.history_list.hide()
|
||||||
self.history_list.setAlternatingRowColors(True)
|
self.history_list.setAlternatingRowColors(True)
|
||||||
main_layout.addWidget(self.history_list, 3, 0, 1, -1)
|
|
||||||
|
|
||||||
|
main_layout.addWidget(self.history_list, 3, 0, 1, 2)
|
||||||
|
|
||||||
|
|
||||||
|
self.receiving = receiving_widget.ReceivingWidget(self)
|
||||||
|
self.receiving.setObjectName("receiving")
|
||||||
|
|
||||||
|
# Add to the right side
|
||||||
|
self.receiving_box = QGroupBox(_("Select a receiving address"))
|
||||||
|
extra_layout = QGridLayout()
|
||||||
|
|
||||||
|
# Checkbox to filter used addresses
|
||||||
|
hide_used = QCheckBox(_('Hide used addresses'))
|
||||||
|
hide_used.setChecked(True)
|
||||||
|
hide_used.stateChanged.connect(self.receiving.toggle_used)
|
||||||
|
|
||||||
|
# Events for receiving addresses
|
||||||
|
self.receiving.clicked.connect(self.receiving.copy_address)
|
||||||
|
self.receiving.itemDoubleClicked.connect(self.receiving.edit_label)
|
||||||
|
self.receiving.itemChanged.connect(self.receiving.update_label)
|
||||||
|
|
||||||
|
# Label
|
||||||
|
extra_layout.addWidget( QLabel(_('Selecting an address will copy it to the clipboard.\nDouble clicking the label will allow you to edit it.') ),0,0)
|
||||||
|
|
||||||
|
extra_layout.addWidget(self.receiving, 1,0)
|
||||||
|
extra_layout.addWidget(hide_used, 2,0)
|
||||||
|
extra_layout.setColumnMinimumWidth(0,200)
|
||||||
|
|
||||||
|
self.receiving_box.setLayout(extra_layout)
|
||||||
|
main_layout.addWidget(self.receiving_box,0,3,-1,3)
|
||||||
|
self.receiving_box.hide()
|
||||||
|
|
||||||
|
self.receive_button.clicked.connect(self.toggle_receiving_layout)
|
||||||
|
|
||||||
|
# Creating the menu bar
|
||||||
menubar = QMenuBar()
|
menubar = QMenuBar()
|
||||||
electrum_menu = menubar.addMenu(_("&Bitcoin"))
|
electrum_menu = menubar.addMenu(_("&Bitcoin"))
|
||||||
|
|
||||||
|
@ -283,6 +318,7 @@ class MiniWindow(QDialog):
|
||||||
show_about = help_menu.addAction(_("&About"))
|
show_about = help_menu.addAction(_("&About"))
|
||||||
show_about.triggered.connect(self.show_about)
|
show_about.triggered.connect(self.show_about)
|
||||||
main_layout.setMenuBar(menubar)
|
main_layout.setMenuBar(menubar)
|
||||||
|
self.main_layout = main_layout
|
||||||
|
|
||||||
quit_shortcut = QShortcut(QKeySequence("Ctrl+Q"), self)
|
quit_shortcut = QShortcut(QKeySequence("Ctrl+Q"), self)
|
||||||
quit_shortcut.activated.connect(self.close)
|
quit_shortcut.activated.connect(self.close)
|
||||||
|
@ -303,6 +339,20 @@ class MiniWindow(QDialog):
|
||||||
self.setObjectName("main_window")
|
self.setObjectName("main_window")
|
||||||
self.show()
|
self.show()
|
||||||
|
|
||||||
|
def toggle_receiving_layout(self):
|
||||||
|
if self.receiving_box.isVisible():
|
||||||
|
self.receiving_box.hide()
|
||||||
|
self.receive_button.setProperty("isActive", False)
|
||||||
|
|
||||||
|
qApp.style().unpolish(self.receive_button)
|
||||||
|
qApp.style().polish(self.receive_button)
|
||||||
|
else:
|
||||||
|
self.receiving_box.show()
|
||||||
|
self.receive_button.setProperty("isActive", 'true')
|
||||||
|
|
||||||
|
qApp.style().unpolish(self.receive_button)
|
||||||
|
qApp.style().polish(self.receive_button)
|
||||||
|
|
||||||
def toggle_theme(self, theme_name):
|
def toggle_theme(self, theme_name):
|
||||||
old_path = QDir.currentPath()
|
old_path = QDir.currentPath()
|
||||||
self.actuator.change_theme(theme_name)
|
self.actuator.change_theme(theme_name)
|
||||||
|
@ -464,8 +514,10 @@ class MiniWindow(QDialog):
|
||||||
|
|
||||||
def show_history(self, toggle_state):
|
def show_history(self, toggle_state):
|
||||||
if toggle_state:
|
if toggle_state:
|
||||||
|
self.main_layout.setRowMinimumHeight(3,200)
|
||||||
self.history_list.show()
|
self.history_list.show()
|
||||||
else:
|
else:
|
||||||
|
self.main_layout.setRowMinimumHeight(3,0)
|
||||||
self.history_list.hide()
|
self.history_list.hide()
|
||||||
|
|
||||||
def backup_wallet(self):
|
def backup_wallet(self):
|
||||||
|
@ -883,6 +935,7 @@ class MiniDriver(QObject):
|
||||||
tx_history = self.wallet.get_tx_history()
|
tx_history = self.wallet.get_tx_history()
|
||||||
self.window.update_history(tx_history)
|
self.window.update_history(tx_history)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
app = QApplication(sys.argv)
|
app = QApplication(sys.argv)
|
||||||
with open(rsrc("style.css")) as style_file:
|
with open(rsrc("style.css")) as style_file:
|
||||||
|
|
1
setup.py
1
setup.py
|
@ -59,6 +59,7 @@ setup(name = "Electrum",
|
||||||
'electrum.pyqrnative',
|
'electrum.pyqrnative',
|
||||||
'electrum.qrscanner',
|
'electrum.qrscanner',
|
||||||
'electrum.history_widget',
|
'electrum.history_widget',
|
||||||
|
'electrum.receiving_widget',
|
||||||
'electrum.simple_config',
|
'electrum.simple_config',
|
||||||
'electrum.socks',
|
'electrum.socks',
|
||||||
'electrum.bmp',
|
'electrum.bmp',
|
||||||
|
|
Loading…
Add table
Reference in a new issue