From 4883197a6f3b6516e3d63cade80e9044314759e0 Mon Sep 17 00:00:00 2001 From: Kiooeht Date: Thu, 12 May 2011 03:47:22 -0700 Subject: [PATCH] Chum search for logs --- CHANGELOG.mkdn | 1 + logviewer.py | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/CHANGELOG.mkdn b/CHANGELOG.mkdn index 2917f76..c50f509 100644 --- a/CHANGELOG.mkdn +++ b/CHANGELOG.mkdn @@ -26,6 +26,7 @@ CHANGELOG * Theme checking - Kiooeht [evacipatedBox] * Display (De)OP/Voice messages in memos - Kiooeht [evacipatedBox] * Advanced Mode: Alter IRC user mode - Kiooeht [evacipatedBox] +* Logviewer chum search - Kiooeht [evacipatedBox] * Bug fixes * Logviewer updates - Kiooeht [evacipatedBox] * Memo scrollbar thing - Kiooeht [evacipatedBox] diff --git a/logviewer.py b/logviewer.py index a3ca095..30d9e7c 100644 --- a/logviewer.py +++ b/logviewer.py @@ -7,6 +7,14 @@ from generic import RightClickList, RightClickTree from parsetools import convertTags from convo import PesterText +class PesterLogSearchInput(QtGui.QLineEdit): + def __init__(self, theme, parent=None): + QtGui.QLineEdit.__init__(self, parent) + self.setStyleSheet(theme["convo/input/style"] + "margin-right:0px;") + def keyPressEvent(self, event): + QtGui.QLineEdit.keyPressEvent(self, event) + self.parent().logSearch(self.text()) + class PesterLogUserSelect(QtGui.QDialog): def __init__(self, config, theme, parent): QtGui.QDialog.__init__(self, parent) @@ -44,6 +52,9 @@ class PesterLogUserSelect(QtGui.QDialog): item.setTextColor(QtGui.QColor(self.theme["main/chums/userlistcolor"])) self.chumsBox.addItem(item) + self.search = PesterLogSearchInput(theme, self) + self.search.setFocus() + self.cancel = QtGui.QPushButton("CANCEL", self) self.connect(self.cancel, QtCore.SIGNAL('clicked()'), self, QtCore.SLOT('reject()')) @@ -58,6 +69,7 @@ class PesterLogUserSelect(QtGui.QDialog): layout_0 = QtGui.QVBoxLayout() layout_0.addWidget(instructions) layout_0.addWidget(self.chumsBox) + layout_0.addWidget(self.search) layout_0.addLayout(layout_ok) self.setLayout(layout_0) @@ -65,6 +77,12 @@ class PesterLogUserSelect(QtGui.QDialog): def selectedchum(self): return self.chumsBox.currentItem() + def logSearch(self, search): + found = self.chumsBox.findItems(search, QtCore.Qt.MatchStartsWith) + print found + if len(found) > 0 and len(found) < self.chumsBox.count(): + self.chumsBox.setCurrentItem(found[0]) + @QtCore.pyqtSlot() def viewActivatedLog(self): selectedchum = self.selectedchum().text()