diff options
author | jerous <jerous@gmail.com> | 2008-05-30 19:38:45 +0200 |
---|---|---|
committer | jerous <jerous@gmail.com> | 2008-05-30 19:38:45 +0200 |
commit | 17f83c115cb8d8979fbe0888d532ab4d10885e7d (patch) | |
tree | 14d3ea83365938b95de9a342a5d5917fea43469a /winMain.py | |
parent | 9d68e40cc1fadbed9a20cd6b0ecf5c88dba94335 (diff) |
small pauze between filtering keystrokes
Diffstat (limited to 'winMain.py')
-rw-r--r-- | winMain.py | 21 |
1 files changed, 15 insertions, 6 deletions
@@ -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()): |