commit 46a236f167efbd973b0b53aa7550500e672996d2
parent 1110f13c62c7911e4e07c907594fa01e03088bcd
Author: SomberNight <somber.night@protonmail.com>
Date: Fri, 19 Apr 2019 19:12:42 +0200
qt tabs: restore filter state after refresh
Diffstat:
7 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/electrum/gui/qt/address_list.py b/electrum/gui/qt/address_list.py
@@ -173,6 +173,7 @@ class AddressList(MyTreeView):
self.showColumn(self.Columns.FIAT_BALANCE)
else:
self.hideColumn(self.Columns.FIAT_BALANCE)
+ self.filter()
def create_menu(self, position):
from electrum.wallet import Multisig_Wallet
diff --git a/electrum/gui/qt/contact_list.py b/electrum/gui/qt/contact_list.py
@@ -121,4 +121,5 @@ class ContactList(MyTreeView):
self.set_current_idx(set_current)
# FIXME refresh loses sort order; so set "default" here:
self.sortByColumn(self.Columns.NAME, Qt.AscendingOrder)
+ self.filter()
run_hook('update_contacts_tab', self)
diff --git a/electrum/gui/qt/history_list.py b/electrum/gui/qt/history_list.py
@@ -249,9 +249,7 @@ class HistoryModel(QAbstractItemModel, PrintError):
self.endInsertRows()
if selected_row:
self.view.selectionModel().select(self.createIndex(selected_row, 0), QItemSelectionModel.Rows | QItemSelectionModel.SelectCurrent)
- f = self.view.current_filter
- if f:
- self.view.filter(f)
+ self.view.filter()
# update summary
self.summary = r['summary']
if not self.view.years and self.transactions:
diff --git a/electrum/gui/qt/invoice_list.py b/electrum/gui/qt/invoice_list.py
@@ -89,6 +89,7 @@ class InvoiceList(MyTreeView):
b = len(inv_list) > 0
self.setVisible(b)
self.parent.invoices_label.setVisible(b)
+ self.filter()
def import_invoices(self):
import_meta_gui(self.parent, _('invoices'), self.parent.invoices.import_file, self.update)
diff --git a/electrum/gui/qt/request_list.py b/electrum/gui/qt/request_list.py
@@ -135,6 +135,7 @@ class RequestList(MyTreeView):
items[self.Columns.STATUS].setIcon(read_QIcon(pr_icons.get(status)))
items[self.Columns.DESCRIPTION].setData(address, Qt.UserRole)
self.model().insertRow(self.model().rowCount(), items)
+ self.filter()
def create_menu(self, position):
idx = self.indexAt(position)
diff --git a/electrum/gui/qt/util.py b/electrum/gui/qt/util.py
@@ -547,9 +547,10 @@ class MyTreeView(QTreeView):
# we did not find the filter in any columns, hide the item
self.setRowHidden(row_num, QModelIndex(), True)
- def filter(self, p):
- p = p.lower()
- self.current_filter = p
+ def filter(self, p=None):
+ if p is not None:
+ p = p.lower()
+ self.current_filter = p
self.hide_rows()
def hide_rows(self):
diff --git a/electrum/gui/qt/utxo_list.py b/electrum/gui/qt/utxo_list.py
@@ -69,6 +69,7 @@ class UTXOList(MyTreeView):
self.update_headers(self.__class__.headers)
for idx, x in enumerate(utxos):
self.insert_utxo(idx, x)
+ self.filter()
def insert_utxo(self, idx, x):
address = x['address']