Update of /cvsroot/ap-python/python/aptk
In directory usw-pr-cvs1:/tmp/cvs-serv4092/aptk
Modified Files:
playlist.py
Log Message:
Playlist widget is thread safe now. Catch playlist update notify.
Index: playlist.py
===================================================================
RCS file: /cvsroot/ap-python/python/aptk/playlist.py,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** playlist.py 24 Jul 2002 07:04:48 -0000 1.7
--- playlist.py 25 Jul 2002 16:19:30 -0000 1.8
***************
*** 82,86 ****
# Init base class
gtk.ScrolledWindow.__init__ (self)
! self.set_policy (gtk.POLICY_AUTOMATIC, gtk.POLICY_ALWAYS)
# Get properties
--- 82,86 ----
# Init base class
gtk.ScrolledWindow.__init__ (self)
! self.set_policy (gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
# Get properties
***************
*** 176,179 ****
--- 176,195 ----
self.__COLUMN_FILENAME, filename.decode (self.__charset))
+ def set (self, pos, title, album, artist, track, playtime,
+ year, genre, comment, filename):
+ """Set new values for the existing row."""
+
+ iter = self.__store.get_iter ((pos,))
+ self.__store.set (iter,
+ self.__COLUMN_TITLE, title.decode (self.__charset),
+ self.__COLUMN_ALBUM, album.decode (self.__charset),
+ self.__COLUMN_ARTIST, artist.decode (self.__charset),
+ self.__COLUMN_TRACK, track.decode (self.__charset),
+ self.__COLUMN_PLAYTIME, "%02u:%02u" % divmod (playtime, 60),
+ self.__COLUMN_YEAR, year.decode (self.__charset),
+ self.__COLUMN_GENRE, genre.decode (self.__charset),
+ self.__COLUMN_COMMENT, comment.decode (self.__charset),
+ self.__COLUMN_FILENAME, filename.decode (self.__charset))
+
def get_treeview (self):
"""Return list TreeView object."""
***************
*** 228,231 ****
--- 244,249 ----
"""Alsaplayer's callback."""
+ gdk.threads_enter ()
+
for item in items:
self.__list.insert (pos,
***************
*** 241,248 ****
--- 259,288 ----
pos += 1
+ gdk.threads_leave ()
+
+ def cb_updated (self, item, pos):
+ """Alsaplayer's callback."""
+
+ gdk.threads_enter ()
+
+ self.__list.set (pos,
+ title = item.title,
+ artist = item.artist,
+ album = item.album,
+ year = item.year,
+ genre = item.genre,
+ playtime = item.playtime,
+ track = item.track,
+ comment = item.comment,
+ filename = item.filename)
+
+ gdk.threads_leave ()
+
def cb_set_current (self, row):
"""Alsaplayer's callback."""
+ gdk.threads_enter ()
self.__list.mark_row (row-1)
+ gdk.threads_leave ()
def __gtkcb_list_row_activated (self, tree, path, column):
|