Chum search for logs

This commit is contained in:
Kiooeht 2011-05-12 03:47:22 -07:00
parent 123eeb4d40
commit 4883197a6f
2 changed files with 19 additions and 0 deletions

View file

@ -26,6 +26,7 @@ CHANGELOG
* Theme checking - Kiooeht [evacipatedBox] * Theme checking - Kiooeht [evacipatedBox]
* Display (De)OP/Voice messages in memos - Kiooeht [evacipatedBox] * Display (De)OP/Voice messages in memos - Kiooeht [evacipatedBox]
* Advanced Mode: Alter IRC user mode - Kiooeht [evacipatedBox] * Advanced Mode: Alter IRC user mode - Kiooeht [evacipatedBox]
* Logviewer chum search - Kiooeht [evacipatedBox]
* Bug fixes * Bug fixes
* Logviewer updates - Kiooeht [evacipatedBox] * Logviewer updates - Kiooeht [evacipatedBox]
* Memo scrollbar thing - Kiooeht [evacipatedBox] * Memo scrollbar thing - Kiooeht [evacipatedBox]

View file

@ -7,6 +7,14 @@ from generic import RightClickList, RightClickTree
from parsetools import convertTags from parsetools import convertTags
from convo import PesterText 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): class PesterLogUserSelect(QtGui.QDialog):
def __init__(self, config, theme, parent): def __init__(self, config, theme, parent):
QtGui.QDialog.__init__(self, parent) QtGui.QDialog.__init__(self, parent)
@ -44,6 +52,9 @@ class PesterLogUserSelect(QtGui.QDialog):
item.setTextColor(QtGui.QColor(self.theme["main/chums/userlistcolor"])) item.setTextColor(QtGui.QColor(self.theme["main/chums/userlistcolor"]))
self.chumsBox.addItem(item) self.chumsBox.addItem(item)
self.search = PesterLogSearchInput(theme, self)
self.search.setFocus()
self.cancel = QtGui.QPushButton("CANCEL", self) self.cancel = QtGui.QPushButton("CANCEL", self)
self.connect(self.cancel, QtCore.SIGNAL('clicked()'), self.connect(self.cancel, QtCore.SIGNAL('clicked()'),
self, QtCore.SLOT('reject()')) self, QtCore.SLOT('reject()'))
@ -58,6 +69,7 @@ class PesterLogUserSelect(QtGui.QDialog):
layout_0 = QtGui.QVBoxLayout() layout_0 = QtGui.QVBoxLayout()
layout_0.addWidget(instructions) layout_0.addWidget(instructions)
layout_0.addWidget(self.chumsBox) layout_0.addWidget(self.chumsBox)
layout_0.addWidget(self.search)
layout_0.addLayout(layout_ok) layout_0.addLayout(layout_ok)
self.setLayout(layout_0) self.setLayout(layout_0)
@ -65,6 +77,12 @@ class PesterLogUserSelect(QtGui.QDialog):
def selectedchum(self): def selectedchum(self):
return self.chumsBox.currentItem() 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() @QtCore.pyqtSlot()
def viewActivatedLog(self): def viewActivatedLog(self):
selectedchum = self.selectedchum().text() selectedchum = self.selectedchum().text()