summaryrefslogtreecommitdiff
path: root/winMain.py
diff options
context:
space:
mode:
authorjerous <jerous@gmail.com>2008-05-30 19:38:45 +0200
committerjerous <jerous@gmail.com>2008-05-30 19:38:45 +0200
commit17f83c115cb8d8979fbe0888d532ab4d10885e7d (patch)
tree14d3ea83365938b95de9a342a5d5917fea43469a /winMain.py
parent9d68e40cc1fadbed9a20cd6b0ecf5c88dba94335 (diff)
small pauze between filtering keystrokes
Diffstat (limited to 'winMain.py')
-rw-r--r--winMain.py21
1 files changed, 15 insertions, 6 deletions
diff --git a/winMain.py b/winMain.py
index 7221590..eabf523 100644
--- a/winMain.py
+++ b/winMain.py
@@ -425,6 +425,7 @@ class Playlist(QtGui.QWidget):
headers=None
winMain=None
onKeyPress=None
+ _timerID=None
def __init__(self, parent, wMain, headers, name, onDoubleClick, onKeyPress):
QtGui.QWidget.__init__(self, parent)
@@ -443,14 +444,22 @@ class Playlist(QtGui.QWidget):
frame.addWidget(self.lstSongs)
self.setLayout(frame)
- self.connect(self.txtFilter, QtCore.SIGNAL('textChanged(const QString&)'),
- self.filter)
- self.connect(self.txtFilter, QtCore.SIGNAL('editingFinished()'),
- self.filter)
-
+ self.connect(self.txtFilter, QtCore.SIGNAL('textChanged(const QString&)'), self.txtFilterChange)
+ self.connect(self.txtFilter, QtCore.SIGNAL('editingFinished()'), self.txtFilterQuit)
+
+ _prevTxtFilter=None
+ def timerEvent(self, event):
+ if self.txtFilter.text()!=self._prevTxtFilter:
+ self.filter()
def keyPressEvent(self, event):
self.onKeyPress(event)
-
+ def txtFilterChange(self):
+ if self._timerID==None:
+ self._timerID=self.startTimer(500)
+ def txtFilterQuit(self):
+ if self._timerID:
+ self.killTimer(self._timerID)
+ self._timerID=None
def update(self, songs):
self.lstSongs.updateSongs(songs)
if len(self.txtFilter.text()):