qt: whitespace, imports
This commit is contained in:
@@ -284,7 +284,8 @@ class HistoryModel(CustomModel, Logger):
|
|||||||
if selected:
|
if selected:
|
||||||
selected_row = selected.row()
|
selected_row = selected.row()
|
||||||
fx = self.window.fx
|
fx = self.window.fx
|
||||||
if fx: fx.history_used_spot = False
|
if fx:
|
||||||
|
fx.history_used_spot = False
|
||||||
wallet = self.window.wallet
|
wallet = self.window.wallet
|
||||||
self.set_visibility_of_columns()
|
self.set_visibility_of_columns()
|
||||||
transactions = wallet.get_full_history(
|
transactions = wallet.get_full_history(
|
||||||
@@ -397,7 +398,7 @@ class HistoryModel(CustomModel, Logger):
|
|||||||
continue
|
continue
|
||||||
self.update_tx_mined_status(tx_hash, tx_mined_info)
|
self.update_tx_mined_status(tx_hash, tx_mined_info)
|
||||||
|
|
||||||
def headerData(self, section: int, orientation: Qt.Orientation, role: Qt.ItemDataRole):
|
def headerData(self, section: int, orientation: Qt.Orientation, role: int = Qt.ItemDataRole.DisplayRole):
|
||||||
assert orientation == Qt.Orientation.Horizontal
|
assert orientation == Qt.Orientation.Horizontal
|
||||||
if role != Qt.ItemDataRole.DisplayRole:
|
if role != Qt.ItemDataRole.DisplayRole:
|
||||||
return None
|
return None
|
||||||
@@ -601,8 +602,8 @@ class HistoryList(MyTreeView, AcceptFileDragDrop):
|
|||||||
return
|
return
|
||||||
fx = self.main_window.fx
|
fx = self.main_window.fx
|
||||||
h = self.wallet.get_detailed_history(
|
h = self.wallet.get_detailed_history(
|
||||||
from_timestamp = time.mktime(self.start_date.timetuple()) if self.start_date else None,
|
from_timestamp=time.mktime(self.start_date.timetuple()) if self.start_date else None,
|
||||||
to_timestamp = time.mktime(self.end_date.timetuple()) if self.end_date else None,
|
to_timestamp=time.mktime(self.end_date.timetuple()) if self.end_date else None,
|
||||||
fx=fx)
|
fx=fx)
|
||||||
summary = h['summary']
|
summary = h['summary']
|
||||||
if not summary:
|
if not summary:
|
||||||
@@ -691,7 +692,7 @@ class HistoryList(MyTreeView, AcceptFileDragDrop):
|
|||||||
column = index.column()
|
column = index.column()
|
||||||
key = get_item_key(tx_item)
|
key = get_item_key(tx_item)
|
||||||
if column == HistoryColumns.DESCRIPTION:
|
if column == HistoryColumns.DESCRIPTION:
|
||||||
if self.wallet.set_label(key, text): #changed
|
if self.wallet.set_label(key, text): # changed
|
||||||
self.hm.update_label(index)
|
self.hm.update_label(index)
|
||||||
self.main_window.update_completions()
|
self.main_window.update_completions()
|
||||||
elif column == HistoryColumns.FIAT_VALUE:
|
elif column == HistoryColumns.FIAT_VALUE:
|
||||||
@@ -764,7 +765,8 @@ class HistoryList(MyTreeView, AcceptFileDragDrop):
|
|||||||
copy_menu.addAction(_("Transaction ID"), lambda: self.place_text_on_clipboard(tx_hash, title="TXID"))
|
copy_menu.addAction(_("Transaction ID"), lambda: self.place_text_on_clipboard(tx_hash, title="TXID"))
|
||||||
menu_edit = menu.addMenu(_("Edit"))
|
menu_edit = menu.addMenu(_("Edit"))
|
||||||
for c in self.editable_columns:
|
for c in self.editable_columns:
|
||||||
if self.isColumnHidden(c): continue
|
if self.isColumnHidden(c):
|
||||||
|
continue
|
||||||
label = self.hm.headerData(c, Qt.Orientation.Horizontal, Qt.ItemDataRole.DisplayRole)
|
label = self.hm.headerData(c, Qt.Orientation.Horizontal, Qt.ItemDataRole.DisplayRole)
|
||||||
# TODO use siblingAtColumn when min Qt version is >=5.11
|
# TODO use siblingAtColumn when min Qt version is >=5.11
|
||||||
persistent = QPersistentModelIndex(org_idx.sibling(org_idx.row(), c))
|
persistent = QPersistentModelIndex(org_idx.sibling(org_idx.row(), c))
|
||||||
|
|||||||
@@ -20,9 +20,10 @@ from PyQt6.QtWidgets import (QPushButton, QLabel, QMessageBox, QHBoxLayout, QVBo
|
|||||||
QFrame)
|
QFrame)
|
||||||
|
|
||||||
from electrum.i18n import _
|
from electrum.i18n import _
|
||||||
from electrum.util import FileImportFailed, FileExportFailed, resource_path
|
from electrum.util import (FileImportFailed, FileExportFailed, resource_path, EventListener, event_listener,
|
||||||
from electrum.util import EventListener, event_listener, get_logger, UserCancelled, UserFacingException
|
get_logger, UserCancelled, UserFacingException)
|
||||||
from electrum.invoices import PR_UNPAID, PR_PAID, PR_EXPIRED, PR_INFLIGHT, PR_UNKNOWN, PR_FAILED, PR_ROUTING, PR_UNCONFIRMED, PR_BROADCASTING, PR_BROADCAST
|
from electrum.invoices import (PR_UNPAID, PR_PAID, PR_EXPIRED, PR_INFLIGHT, PR_UNKNOWN, PR_FAILED, PR_ROUTING,
|
||||||
|
PR_UNCONFIRMED, PR_BROADCASTING, PR_BROADCAST)
|
||||||
from electrum.logging import Logger
|
from electrum.logging import Logger
|
||||||
from electrum.qrreader import MissingQrDetectionLib, QrCodeResult
|
from electrum.qrreader import MissingQrDetectionLib, QrCodeResult
|
||||||
|
|
||||||
@@ -1248,6 +1249,7 @@ def getSaveFileName(
|
|||||||
def icon_path(icon_basename: str):
|
def icon_path(icon_basename: str):
|
||||||
return resource_path('gui', 'icons', icon_basename)
|
return resource_path('gui', 'icons', icon_basename)
|
||||||
|
|
||||||
|
|
||||||
def internal_plugin_icon_path(plugin_name, icon_basename: str):
|
def internal_plugin_icon_path(plugin_name, icon_basename: str):
|
||||||
return resource_path('plugins', plugin_name, icon_basename)
|
return resource_path('plugins', plugin_name, icon_basename)
|
||||||
|
|
||||||
@@ -1256,11 +1258,13 @@ def internal_plugin_icon_path(plugin_name, icon_basename: str):
|
|||||||
def read_QIcon(icon_basename: str) -> QIcon:
|
def read_QIcon(icon_basename: str) -> QIcon:
|
||||||
return QIcon(icon_path(icon_basename))
|
return QIcon(icon_path(icon_basename))
|
||||||
|
|
||||||
|
|
||||||
def read_QPixmap_from_bytes(b: bytes) -> QPixmap:
|
def read_QPixmap_from_bytes(b: bytes) -> QPixmap:
|
||||||
qp = QPixmap()
|
qp = QPixmap()
|
||||||
qp.loadFromData(b)
|
qp.loadFromData(b)
|
||||||
return qp
|
return qp
|
||||||
|
|
||||||
|
|
||||||
def read_QIcon_from_bytes(b: bytes) -> QIcon:
|
def read_QIcon_from_bytes(b: bytes) -> QIcon:
|
||||||
qp = read_QPixmap_from_bytes(b)
|
qp = read_QPixmap_from_bytes(b)
|
||||||
return QIcon(qp)
|
return QIcon(qp)
|
||||||
@@ -1473,10 +1477,12 @@ def qt_event_listener(func):
|
|||||||
self.qt_callback_signal.emit( (func,) + args)
|
self.qt_callback_signal.emit( (func,) + args)
|
||||||
return decorator
|
return decorator
|
||||||
|
|
||||||
|
|
||||||
def insert_spaces(text: str, every_chars: int) -> str:
|
def insert_spaces(text: str, every_chars: int) -> str:
|
||||||
'''Insert spaces at every Nth character to allow for WordWrap'''
|
'''Insert spaces at every Nth character to allow for WordWrap'''
|
||||||
return ' '.join(text[i:i+every_chars] for i in range(0, len(text), every_chars))
|
return ' '.join(text[i:i+every_chars] for i in range(0, len(text), every_chars))
|
||||||
|
|
||||||
|
|
||||||
class _ABCQObjectMeta(type(QObject), ABCMeta): pass
|
class _ABCQObjectMeta(type(QObject), ABCMeta): pass
|
||||||
class _ABCQWidgetMeta(type(QWidget), ABCMeta): pass
|
class _ABCQWidgetMeta(type(QWidget), ABCMeta): pass
|
||||||
class AbstractQObject(QObject, ABC, metaclass=_ABCQObjectMeta): pass
|
class AbstractQObject(QObject, ABC, metaclass=_ABCQObjectMeta): pass
|
||||||
|
|||||||
@@ -28,13 +28,11 @@ import copy
|
|||||||
|
|
||||||
from PyQt6.QtCore import Qt, QUrl
|
from PyQt6.QtCore import Qt, QUrl
|
||||||
from PyQt6.QtGui import QTextCharFormat, QFont
|
from PyQt6.QtGui import QTextCharFormat, QFont
|
||||||
from PyQt6.QtWidgets import QVBoxLayout, QHBoxLayout, QLabel, QTextBrowser
|
from PyQt6.QtWidgets import QVBoxLayout, QHBoxLayout, QLabel
|
||||||
|
|
||||||
from electrum.i18n import _
|
from electrum.i18n import _
|
||||||
|
|
||||||
from .util import WindowModalDialog, ButtonsLineEdit, ShowQRLineEdit, ColorScheme, Buttons, CloseButton, MONOSPACE_FONT, WWLabel
|
from .util import WindowModalDialog, ColorScheme, Buttons, CloseButton, MONOSPACE_FONT, WWLabel
|
||||||
from .history_list import HistoryList, HistoryModel
|
|
||||||
from .qrtextedit import ShowQRTextEdit
|
|
||||||
from .transaction_dialog import TxOutputColoring, QTextBrowserWithDefaultSize
|
from .transaction_dialog import TxOutputColoring, QTextBrowserWithDefaultSize
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
@@ -56,7 +54,11 @@ class UTXODialog(WindowModalDialog):
|
|||||||
self.parents_list.anchorClicked.connect(self.open_tx) # send links to our handler
|
self.parents_list.anchorClicked.connect(self.open_tx) # send links to our handler
|
||||||
self.parents_list.setFont(QFont(MONOSPACE_FONT))
|
self.parents_list.setFont(QFont(MONOSPACE_FONT))
|
||||||
self.parents_list.setReadOnly(True)
|
self.parents_list.setReadOnly(True)
|
||||||
self.parents_list.setTextInteractionFlags(self.parents_list.textInteractionFlags() | Qt.TextInteractionFlag.LinksAccessibleByMouse | Qt.TextInteractionFlag.LinksAccessibleByKeyboard)
|
self.parents_list.setTextInteractionFlags(
|
||||||
|
self.parents_list.textInteractionFlags() |
|
||||||
|
Qt.TextInteractionFlag.LinksAccessibleByMouse |
|
||||||
|
Qt.TextInteractionFlag.LinksAccessibleByKeyboard
|
||||||
|
)
|
||||||
self.txo_color_parent = TxOutputColoring(
|
self.txo_color_parent = TxOutputColoring(
|
||||||
legend=_("Direct parent"), color=ColorScheme.BLUE, tooltip=_("Direct parent"))
|
legend=_("Direct parent"), color=ColorScheme.BLUE, tooltip=_("Direct parent"))
|
||||||
self.txo_color_uncle = TxOutputColoring(
|
self.txo_color_uncle = TxOutputColoring(
|
||||||
|
|||||||
Reference in New Issue
Block a user