Browse Source

Merge pull request #1164 from kyuupichan/genfilter

Search across multiple columns
283
ThomasV 10 years ago
parent
commit
1b868a9753
  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