Browse Source

qt coins tab: Ctrl+F now searches the whole prevout string

(not just the truncated string that is displayed in the list)
patch-4
SomberNight 4 years ago
parent
commit
1436760d3d
No known key found for this signature in database GPG Key ID: B33B5F232C6271E9
  1. 14
      electrum/gui/qt/util.py
  2. 5
      electrum/gui/qt/utxo_list.py

14
electrum/gui/qt/util.py

@ -551,6 +551,7 @@ class MyTreeView(QTreeView):
ROLE_CLIPBOARD_DATA = Qt.UserRole + 100 ROLE_CLIPBOARD_DATA = Qt.UserRole + 100
ROLE_CUSTOM_PAINT = Qt.UserRole + 101 ROLE_CUSTOM_PAINT = Qt.UserRole + 101
ROLE_EDIT_KEY = Qt.UserRole + 102 ROLE_EDIT_KEY = Qt.UserRole + 102
ROLE_FILTER_DATA = Qt.UserRole + 103
filter_columns: Iterable[int] filter_columns: Iterable[int]
@ -679,6 +680,14 @@ class MyTreeView(QTreeView):
# overriding this might allow avoiding storing duplicate data # overriding this might allow avoiding storing duplicate data
return self.get_role_data_from_coordinate(row, col, role=self.ROLE_EDIT_KEY) return self.get_role_data_from_coordinate(row, col, role=self.ROLE_EDIT_KEY)
def get_filter_data_from_coordinate(self, row, col) -> str:
filter_data = self.get_role_data_from_coordinate(row, col, role=self.ROLE_FILTER_DATA)
if filter_data:
return filter_data
txt = self.get_text_from_coordinate(row, col)
txt = txt.lower()
return txt
def hide_row(self, row_num): def hide_row(self, row_num):
""" """
row_num is for self.model(). So if there is a proxy, it is the row number row_num is for self.model(). So if there is a proxy, it is the row number
@ -690,9 +699,8 @@ class MyTreeView(QTreeView):
self.setRowHidden(row_num, QModelIndex(), False) self.setRowHidden(row_num, QModelIndex(), False)
return return
for column in self.filter_columns: for column in self.filter_columns:
txt = self.get_text_from_coordinate(row_num, column) filter_data = self.get_filter_data_from_coordinate(row_num, column)
txt = txt.lower() if self.current_filter in filter_data:
if self.current_filter in txt:
# the filter matched, but the date filter might apply # the filter matched, but the date filter might apply
self.setRowHidden(row_num, QModelIndex(), bool(should_hide)) self.setRowHidden(row_num, QModelIndex(), bool(should_hide))
break break

5
electrum/gui/qt/utxo_list.py

@ -217,3 +217,8 @@ class UTXOList(MyTreeView):
menu.addAction(_("Unfreeze Addresses"), lambda: self.parent.set_frozen_state_of_addresses(addrs, False)) menu.addAction(_("Unfreeze Addresses"), lambda: self.parent.set_frozen_state_of_addresses(addrs, False))
menu.exec_(self.viewport().mapToGlobal(position)) menu.exec_(self.viewport().mapToGlobal(position))
def get_filter_data_from_coordinate(self, row, col):
if col == self.Columns.OUTPOINT:
return self.get_role_data_from_coordinate(row, col, role=self.ROLE_PREVOUT_STR)
return super().get_filter_data_from_coordinate(row, col)

Loading…
Cancel
Save