Browse Source

Filter on an array of columns. Make search string lower case too.

283
Neil Booth 10 years ago
parent
commit
72cf707e61
  1. 10
      gui/qt/main_window.py
  2. 6
      gui/qt/util.py

10
gui/qt/main_window.py

@ -1717,15 +1717,15 @@ class ElectrumWindow(QMainWindow):
def do_search(self, t):
i = self.tabs.currentIndex()
if i == 0:
self.history_list.filter(t, 2)
self.history_list.filter(t, [1, 2, 3]) # Date, Description, Amount
elif i == 1:
self.invoices_list.filter(t, 2)
self.invoices_list.filter(t, [0, 1, 2, 3]) # Date, Requestor, Description, Amount
elif i == 2:
self.receive_list.filter(t, 3)
self.receive_list.filter(t, [0, 1, 2, 3, 4]) # Date, Account, Address, Description, Amount
elif i == 3:
self.address_list.filter(t, 1)
self.address_list.filter(t, [0,1, 2]) # Address, Label, Balance
elif i == 4:
self.contacts_list.filter(t, 0)
self.contacts_list.filter(t, [0, 1]) # Key, Value
def new_contact_dialog(self):

6
gui/qt/util.py

@ -340,9 +340,11 @@ class MyTreeWidget(QTreeWidget):
for x in self.get_leaves(item):
yield x
def filter(self, p, column):
def filter(self, p, columns):
p = unicode(p).lower()
for item in self.get_leaves(self.invisibleRootItem()):
item.setHidden(unicode(item.text(column)).lower().find(p) == -1)
item.setHidden(all([unicode(item.text(column)).lower().find(p) == -1
for column in columns]))
class ButtonsWidget(QWidget):

Loading…
Cancel
Save