Browse Source
qt history: fix slowness
arghhhhh finalllllllllllly figured it out...
3.3.3.1
SomberNight
6 years ago
No known key found for this signature in database
GPG Key ID: B33B5F232C6271E9
2 changed files with
9 additions and
3 deletions
-
electrum/gui/qt/history_list.py
-
electrum/gui/qt/util.py
|
|
@ -96,9 +96,8 @@ class HistoryModel(QAbstractItemModel, PrintError): |
|
|
|
return self.createIndex(row, column) |
|
|
|
|
|
|
|
def data(self, index: QModelIndex, role: Qt.ItemDataRole): |
|
|
|
# requires PyQt5 5.11 |
|
|
|
# indexIsValid = QAbstractItemModel.CheckIndexOptions(QAbstractItemModel.CheckIndexOption.IndexIsValid.value) |
|
|
|
# assert self.checkIndex(index, indexIsValid) |
|
|
|
# note: this method is performance-critical. |
|
|
|
# it is called a lot, and so must run extremely fast. |
|
|
|
assert index.isValid() |
|
|
|
col = index.column() |
|
|
|
tx_item = self.transactions.value_from_pos(index.row()) |
|
|
|
|
|
@ -444,6 +444,13 @@ class MyTreeView(QTreeView): |
|
|
|
self.setRootIsDecorated(False) # remove left margin |
|
|
|
self.toolbar_shown = False |
|
|
|
|
|
|
|
# When figuring out the size of columns, Qt by default looks at |
|
|
|
# the first 1000 rows (at least if resize mode is QHeaderView.ResizeToContents). |
|
|
|
# This would be REALLY SLOW, and it's not perfect anyway. |
|
|
|
# So to speed the UI up considerably, set it to |
|
|
|
# only look at as many rows as currently visible. |
|
|
|
self.header().setResizeContentsPrecision(0) |
|
|
|
|
|
|
|
def set_editability(self, items): |
|
|
|
for idx, i in enumerate(items): |
|
|
|
i.setEditable(idx in self.editable_columns) |
|
|
|