electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit 45081b1c8b20598cff2c9eff91518325f5afa6c7
parent 6fb9f2e241683c6da20d69ca95765408ec00bbf5
Author: ThomasV <thomasv@gitorious>
Date:   Thu, 23 Apr 2015 13:50:35 +0200

search box

Diffstat:
Mgui/qt/main_window.py | 23+++++++++++++++++++++++
Mgui/qt/util.py | 7+++++++
2 files changed, 30 insertions(+), 0 deletions(-)

diff --git a/gui/qt/main_window.py b/gui/qt/main_window.py @@ -382,6 +382,7 @@ class ElectrumWindow(QMainWindow): self.import_menu = self.private_keys_menu.addAction(_("&Import"), self.do_import_privkey) self.export_menu = self.private_keys_menu.addAction(_("&Export"), self.export_privkeys_dialog) wallet_menu.addAction(_("&Export History"), self.export_history_dialog) + wallet_menu.addAction(_("Search"), self.toggle_search).setShortcut(QKeySequence("Ctrl+S")) tools_menu = menubar.addMenu(_("&Tools")) @@ -1655,6 +1656,11 @@ class ElectrumWindow(QMainWindow): self.connect(self.account_selector,SIGNAL("activated(QString)"),self.change_account) sb.addPermanentWidget(self.account_selector) + self.search_box = QLineEdit() + self.search_box.textChanged.connect(self.do_search) + self.search_box.hide() + sb.addPermanentWidget(self.search_box) + if (int(qtVersion[0]) >= 4 and int(qtVersion[2]) >= 7): sb.addPermanentWidget( StatusBarButton( QIcon(":icons/switchgui.png"), _("Switch to Lite Mode"), self.go_lite ) ) @@ -1691,6 +1697,23 @@ class ElectrumWindow(QMainWindow): self.update_lock_icon() + def toggle_search(self): + self.search_box.setHidden(not self.search_box.isHidden()) + if not self.search_box.isHidden(): + self.search_box.setFocus(1) + else: + self.do_search('') + + def do_search(self, t): + i = self.tabs.currentIndex() + if i == 0: + self.history_list.filter(t, 2) + elif i == 3: + self.address_list.filter(t, 1) + elif i == 4: + self.contacts_list.filter(t, 0) + + def new_contact_dialog(self): d = QDialog(self) d.setWindowTitle(_("New Contact")) diff --git a/gui/qt/util.py b/gui/qt/util.py @@ -330,6 +330,13 @@ class MyTreeWidget(QTreeWidget): self.parent.update_history_tab() self.parent.update_completions() + def filter(self, p, column): + root = self.invisibleRootItem() + child_count = root.childCount() + for i in range(child_count): + item = root.child(i) + item.setHidden(unicode(item.text(column)).lower().find(p) == -1) + class ButtonsWidget(QWidget):