summaryrefslogtreecommitdiff
path: root/winMain.py
diff options
context:
space:
mode:
authorjerous <jerous@gmail.com>2008-05-29 18:45:31 +0200
committerjerous <jerous@gmail.com>2008-05-29 18:45:31 +0200
commit45e7e0b558940e02c788a9bbb144cc75192ca7f1 (patch)
treeaf589acf853292011faf2a662e57b3cc70da87b2 /winMain.py
parent1d6ec05f4932200d91b148b18feec860c9b77c74 (diff)
tracking song on change
Diffstat (limited to 'winMain.py')
-rw-r--r--winMain.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/winMain.py b/winMain.py
index 904b416..f27f49b 100644
--- a/winMain.py
+++ b/winMain.py
@@ -133,6 +133,23 @@ class SongList(QtGui.QWidget):
self.repaint()
+ def visibleSongs(self):
+ ret=[]
+ for row in xrange(self.topRow, min(self.numSongs, self.topRow+self.numRows)-1):
+ ret.append(self.fSongs[row])
+ return ret
+
+ def ensureVisible(self, id):
+ if len(filter(lambda song: song.getID()==id, self.visibleSongs())):
+ return
+ row=0
+ for song in self.fSongs:
+ if song.getID()==id:
+ self.vScrollbar.setValue(row-self.numRows/2)
+ self.repaint()
+ break
+ row+=1
+
def onVScroll(self, value):
" 'if value<0' needed because minimum can be after init <0 at some point ..."
@@ -436,6 +453,8 @@ class Playlist(QtGui.QWidget):
def selectRow(self, row):
self.lstSongs.selectRow(row)
+ def ensureVisible(self, id):
+ self.lstSongs.ensureVisible(id)
class winMain(QtGui.QWidget):
"Elements"
@@ -671,6 +690,7 @@ class winMain(QtGui.QWidget):
try:
self.slrTime.setMaximum(monty.getStatus()['length'])
self.slrTime.setEnabled(True)
+ lst.ensureVisible(params['newSongID'])
except:
pass