From c52853341c4e3633f5a713c3884944fbb3e1c8e8 Mon Sep 17 00:00:00 2001 From: SomberNight Date: Tue, 12 Dec 2023 10:50:47 +0000 Subject: [PATCH] qt util: add VLine class, for vertical line separators --- electrum/gui/qt/channel_details.py | 8 ++------ electrum/gui/qt/transaction_dialog.py | 8 ++------ electrum/gui/qt/util.py | 11 ++++++++++- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/electrum/gui/qt/channel_details.py b/electrum/gui/qt/channel_details.py index 60c170c03..81d919203 100644 --- a/electrum/gui/qt/channel_details.py +++ b/electrum/gui/qt/channel_details.py @@ -15,7 +15,7 @@ from electrum.bitcoin import COIN from electrum.wallet import Abstract_Wallet from .util import Buttons, CloseButton, ShowQRLineEdit, MessageBoxMixin, WWLabel -from .util import QtEventListener, qt_event_listener +from .util import QtEventListener, qt_event_listener, VLine if TYPE_CHECKING: from .main_window import ElectrumWindow @@ -242,11 +242,7 @@ class ChannelDetailsDialog(QtWidgets.QDialog, MessageBoxMixin, QtEventListener): # channel stats left column hbox_stats.addLayout(form_layout_left, 50) # vertical line separator - line_separator = QtWidgets.QFrame() - line_separator.setFrameShape(QtWidgets.QFrame.VLine) - line_separator.setFrameShadow(QtWidgets.QFrame.Sunken) - line_separator.setLineWidth(1) - hbox_stats.addWidget(line_separator) + hbox_stats.addWidget(VLine()) # channel stats right column hbox_stats.addLayout(form_layout_right, 50) return hbox_stats diff --git a/electrum/gui/qt/transaction_dialog.py b/electrum/gui/qt/transaction_dialog.py index 7dbea0d9d..cf1c3e474 100644 --- a/electrum/gui/qt/transaction_dialog.py +++ b/electrum/gui/qt/transaction_dialog.py @@ -62,7 +62,7 @@ from .util import (MessageBoxMixin, read_QIcon, Buttons, icon_path, TRANSACTION_FILE_EXTENSION_FILTER_ONLY_COMPLETE_TX, TRANSACTION_FILE_EXTENSION_FILTER_ONLY_PARTIAL_TX, BlockingWaitingDialog, getSaveFileName, ColorSchemeItem, - get_iconname_qrcode) + get_iconname_qrcode, VLine) from .rate_limiter import rate_limited from .my_treeview import create_toolbar_with_menu @@ -961,11 +961,7 @@ class TxDialog(QDialog, MessageBoxMixin): hbox_stats.addLayout(vbox_left, 50) # vertical line separator - line_separator = QFrame() - line_separator.setFrameShape(QFrame.VLine) - line_separator.setFrameShadow(QFrame.Sunken) - line_separator.setLineWidth(1) - hbox_stats.addWidget(line_separator) + hbox_stats.addWidget(VLine()) # right column vbox_right = QVBoxLayout() diff --git a/electrum/gui/qt/util.py b/electrum/gui/qt/util.py index 675579745..eba59166f 100644 --- a/electrum/gui/qt/util.py +++ b/electrum/gui/qt/util.py @@ -15,7 +15,8 @@ from PyQt5.QtCore import (Qt, pyqtSignal, QCoreApplication, QThread, QSize, QRec from PyQt5.QtWidgets import (QPushButton, QLabel, QMessageBox, QHBoxLayout, QVBoxLayout, QLineEdit, QStyle, QDialog, QGroupBox, QButtonGroup, QRadioButton, QFileDialog, QWidget, QToolButton, QPlainTextEdit, QApplication, QToolTip, - QGraphicsEffect, QGraphicsScene, QGraphicsPixmapItem, QLayoutItem, QLayout, QMenu) + QGraphicsEffect, QGraphicsScene, QGraphicsPixmapItem, QLayoutItem, QLayout, QMenu, + QFrame) from electrum.i18n import _ from electrum.util import FileImportFailed, FileExportFailed, resource_path @@ -559,6 +560,14 @@ class ResizableStackedWidget(QWidget): return len(self.widgets) +class VLine(QFrame): + """Vertical line separator""" + def __init__(self): + super(VLine, self).__init__() + self.setFrameShape(self.VLine | self.Sunken) + self.setLineWidth(1) + + def address_field(addresses): hbox = QHBoxLayout() address_e = QLineEdit()