ap-python-commits Mailing List for AlsaPlayer Python Interface (Page 2)
Status: Beta
Brought to you by:
sjah
You can subscribe to this list here.
2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(58) |
Aug
(27) |
Sep
|
Oct
|
Nov
|
Dec
|
---|
From: <sj...@us...> - 2002-08-16 05:36:18
|
Update of /cvsroot/ap-python/python/aptk In directory usw-pr-cvs1:/tmp/cvs-serv23194/aptk Modified Files: Makefile.am __init__.py misc.py playlist.py Log Message: aptk.misc.Button could be created from stock. More i18n. Add sort dialog. Index: Makefile.am =================================================================== RCS file: /cvsroot/ap-python/python/aptk/Makefile.am,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Makefile.am 21 Jul 2002 18:15:43 -0000 1.4 --- Makefile.am 16 Aug 2002 05:36:11 -0000 1.5 *************** *** 1,8 **** EXTRA_DIST = control.py info.py __init__.py misc.py pan.py position.py\ ! speed.py volume.py playlist.py if ENABLE_APTK aptk_DATA = $(EXTRA_DIST) control.pyc info.pyc __init__.pyc misc.pyc\ ! pan.pyc position.pyc speed.pyc volume.pyc playlist.pyc aptkdir = @PY_MOD_DIR@/aptk endif --- 1,9 ---- EXTRA_DIST = control.py info.py __init__.py misc.py pan.py position.py\ ! speed.py volume.py playlist.py language.py if ENABLE_APTK aptk_DATA = $(EXTRA_DIST) control.pyc info.pyc __init__.pyc misc.pyc\ ! pan.pyc position.pyc speed.pyc volume.pyc playlist.pyc\ ! language.pyc aptkdir = @PY_MOD_DIR@/aptk endif Index: __init__.py =================================================================== RCS file: /cvsroot/ap-python/python/aptk/__init__.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** __init__.py 16 Jul 2002 17:08:45 -0000 1.3 --- __init__.py 16 Aug 2002 05:36:11 -0000 1.4 *************** *** 34,35 **** --- 34,36 ---- import info import playlist + import language Index: misc.py =================================================================== RCS file: /cvsroot/ap-python/python/aptk/misc.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** misc.py 28 Jul 2002 13:45:46 -0000 1.6 --- misc.py 16 Aug 2002 05:36:11 -0000 1.7 *************** *** 91,94 **** --- 91,96 ---- ('**.button.label', ''), ('**.button.file', None), + ('**.button.stock', None), + ('**.button.size', gtk.ICON_SIZE_MENU) ]) *************** *** 104,110 **** label = prop.get_value (prefix + ".label") relief = prop.get_value (prefix + ".relief") ! # Create button ! if not file: gtk.Button.__init__ (self, label) else: --- 106,114 ---- label = prop.get_value (prefix + ".label") relief = prop.get_value (prefix + ".relief") ! stock = prop.get_value (prefix + ".stock") ! size = prop.get_value (prefix + ".size") ! # Create button ! if not file and not stock: gtk.Button.__init__ (self, label) else: *************** *** 119,122 **** --- 123,131 ---- image = gtk.Image () image.set_from_file (file) + self.add (image) + image.show () + elif stock: + image = gtk.Image () + image.set_from_stock (stock, size) self.add (image) image.show () Index: playlist.py =================================================================== RCS file: /cvsroot/ap-python/python/aptk/playlist.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** playlist.py 28 Jul 2002 13:45:46 -0000 1.12 --- playlist.py 16 Aug 2002 05:36:11 -0000 1.13 *************** *** 24,32 **** __license__ = "GNU" ! import gtk, aptk, gobject, locale gdk = gtk.gdk - # TODO: Make this code more simple and faster!!! - # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # class List (gtk.ScrolledWindow): --- 24,30 ---- __license__ = "GNU" ! import gtk, aptk, gobject, locale, aptk.language gdk = gtk.gdk # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # class List (gtk.ScrolledWindow): *************** *** 34,46 **** ('**.list.columns', ('current', 'playtime', 'track', 'title', 'album', 'artist', 'year', 'genre')), ! ('**.list.playtime.label', 'Playtime'), ! ('**.list.year.label', 'Year'), ! ('**.list.track.label', 'Track'), ! ('**.list.title.label', 'Title'), ! ('**.list.album.label', 'Album'), ! ('**.list.artist.label', 'Artist'), ! ('**.list.genre.label', 'Genre'), ! ('**.list.comment.label', 'Comment'), ! ('**.list.filename.label', 'Filename'), ('**.list.current.label', ''), ('**.list.mark.label', '-->'), --- 32,44 ---- ('**.list.columns', ('current', 'playtime', 'track', 'title', 'album', 'artist', 'year', 'genre')), ! ('**.list.playtime.label', aptk.language.tr ('Playtime')), ! ('**.list.year.label', aptk.language.tr ('Year')), ! ('**.list.track.label', aptk.language.tr ('Track')), ! ('**.list.title.label', aptk.language.tr ('Title')), ! ('**.list.album.label', aptk.language.tr ('Album')), ! ('**.list.artist.label', aptk.language.tr ('Artist')), ! ('**.list.genre.label', aptk.language.tr ('Genre')), ! ('**.list.comment.label', aptk.language.tr ('Comment')), ! ('**.list.filename.label', aptk.language.tr ('Filename')), ('**.list.current.label', ''), ('**.list.mark.label', '-->'), *************** *** 238,243 **** # Defualt properties __properties = aptk.misc.WidgetProperties ([ ! ('**.clear.button.label', 'Clear'), ! ('**.clear.warning', 'Do you want to clear playlist?'), ('**.clear.confirm', 1) ]) --- 236,241 ---- # Defualt properties __properties = aptk.misc.WidgetProperties ([ ! ('**.clear.button.label', aptk.language.tr ('Clear')), ! ('**.clear.warning', aptk.language.tr ('Do you want to clear playlist?')), ('**.clear.confirm', 1) ]) *************** *** 288,293 **** # Defualt properties __properties = aptk.misc.WidgetProperties ([ ! ('**.remove.button.label', 'Remove'), ! ('**.remove.warning', 'Do you want to remove selected items from the playlist?'), ('**.remove.confirm', 1) ]) --- 286,293 ---- # Defualt properties __properties = aptk.misc.WidgetProperties ([ ! ('**.remove.button.label', ! aptk.language.tr ('Remove')), ! ('**.remove.warning', ! aptk.language.tr ('Do you want to remove selected items from the playlist?')), ('**.remove.confirm', 1) ]) *************** *** 343,346 **** --- 343,512 ---- # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # + class SortButton (aptk.misc.Button): + """Start playback. + """ + + # Defualt properties + __properties = aptk.misc.WidgetProperties ([ + ('**.sort.button.label', aptk.language.tr ('Sort')) + ]) + + def __init__ (self, pl, prop = None, prefix = ""): + """Initializer.""" + + # Create new properties whth our defaults added + prop = prop and (prop + self.__properties) or self.__properties + prefix += ".sort" + + # Call base contructor + aptk.misc.Button.__init__ (self, prop, prefix) + + self.connect ("clicked", self.__gtkcb_clicked) + self.__pl = pl + self.__prop = prop + self.__prefix = prefix + + def __gtkcb_clicked (self, w): + """Handler for clicked signal.""" + + d = SortDialog (self.__prop, self.__prefix) + + while 1: + # Ask for sorting priority + rc = d.run () + + if rc == gtk.RESPONSE_CANCEL: break + + # Clear if answer is Yes + gtk.threads_leave () + self.__pl.sort (d.sequence) + gtk.threads_enter () + + if rc != gtk.RESPONSE_APPLY: break + + d.destroy () + + # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # + class SortDialog (gtk.Dialog): + # Defualt properties + __properties = aptk.misc.WidgetProperties ([ + ('**.dialog.list.field.label', aptk.language.tr ('Sorting field')), + ('**.dialog.sequence', 'AyLNTFGPC'), + ('**.dialog.title', aptk.language.tr ('Sorting priorities')), + ('**.dialog.list.playtime', aptk.language.tr ('Playtime')), + ('**.dialog.list.year', aptk.language.tr ('Year')), + ('**.dialog.list.track', aptk.language.tr ('Track')), + ('**.dialog.list.title', aptk.language.tr ('Title')), + ('**.dialog.list.album', aptk.language.tr ('Album')), + ('**.dialog.list.artist', aptk.language.tr ('Artist')), + ('**.dialog.list.genre', aptk.language.tr ('Genre')), + ('**.dialog.list.comment', aptk.language.tr ('Comment')), + ('**.dialog.list.filename', aptk.language.tr ('Filename')) + ]) + + __chars = { + 'a' : ("artist", gtk.TRUE), + 'A' : ("artist", gtk.FALSE), + 'l' : ("album", gtk.TRUE), + 'L' : ("album", gtk.FALSE), + 'y' : ("year", gtk.TRUE), + 'Y' : ("year", gtk.FALSE), + 'n' : ("track", gtk.TRUE), + "N" : ("track", gtk.FALSE), + "t" : ("title", gtk.TRUE), + "T" : ("title", gtk.FALSE), + "f" : ("filename", gtk.TRUE), + "F" : ("filename", gtk.FALSE), + "g" : ("genre", gtk.TRUE), + "G" : ("genre", gtk.FALSE), + "p" : ("playtime", gtk.TRUE), + "P" : ("playtime", gtk.FALSE), + "c" : ("comment", gtk.TRUE), + "C" : ("comment", gtk.FALSE) + } + + def __init__ (self, prop = None, prefix = ""): + """Initializer.""" + + # Create new properties whth our defaults added + prop = prop and (prop + self.__properties) or self.__properties + prefix += ".dialog" + + # Properties + field_column_label = prop.get_value (prefix + ".list.field.label") + self.sequence = prop.get_value (prefix + ".sequence") + title = prop.get_value (prefix + '.title') + + # Init base class + gtk.Dialog.__init__ (self, + title, + None, + gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT, + (gtk.STOCK_OK, gtk.RESPONSE_OK, + gtk.STOCK_APPLY, gtk.RESPONSE_APPLY, + gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL)) + + self.vbox.set_border_width (4) + + # List - - - - - + w = gtk.ScrolledWindow () + self.vbox.add (w) + w.set_policy (gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) + w.show () + + # Store + self.__store = gtk.ListStore (gobject.TYPE_BOOLEAN, gobject.TYPE_STRING) + + # Treeview + self.__treeview = gtk.TreeView (self.__store) + w.add (self.__treeview) + self.__treeview.show () + self.__treeview.set_reorderable (gtk.TRUE) + + # Columns + renderer = gtk.CellRendererToggle () + column = gtk.TreeViewColumn ('', renderer, active = 0) + self.__treeview.append_column (column) + renderer.connect ("toggled", self.__gtkcb_toggled) + + image = gtk.Image () + image.set_from_stock (gtk.STOCK_SORT_DESCENDING, gtk.ICON_SIZE_MENU) + column.set_widget (image) + image.show () + + renderer = gtk.CellRendererText () + column = gtk.TreeViewColumn (field_column_label, renderer, text = 1) + self.__treeview.append_column (column) + + # Add data to list + for t in self.sequence: + name, state = self.__chars [t] + name = prop.get_value (prefix + ".list." + name) + + iter = self.__store.append () + self.__store.set (iter, 1, name, + 0, state) + + def __gtkcb_toggled (self, renderer, path): + """Gtk callback for a toggle column.""" + + index = int (path) + path = (index,) + row = self.__store [path] + + # Get old value + value = row [0] + + # set new value + row [0] = not value + + # modify sequence + t = self.sequence [index] + if value: + self.sequence = self.sequence[:index] + t.upper () + self.sequence [index+1:] + else: + self.sequence = self.sequence[:index] + t.lower () + self.sequence [index+1:] + + # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # class _ButtonsBox: """Internal.""" *************** *** 352,361 **** --- 518,531 ---- self.clear_button = ClearButton (pl, prop, prefix) self.remove_button = RemoveButton (pl, list, prop, prefix) + self.sort_button = SortButton (pl, prop, prefix) # Pack buttons + self.pack_start (self.sort_button, expand = gtk.FALSE) + self.pack_end (self.clear_button, expand = gtk.FALSE) self.pack_end (self.remove_button, expand = gtk.FALSE) # Show these buttons + self.sort_button.show () self.remove_button.show () self.clear_button.show () |
From: <sj...@us...> - 2002-08-16 05:36:17
|
Update of /cvsroot/ap-python/python/examples/aptk In directory usw-pr-cvs1:/tmp/cvs-serv23194/examples/aptk Modified Files: playlist.py Log Message: aptk.misc.Button could be created from stock. More i18n. Add sort dialog. Index: playlist.py =================================================================== RCS file: /cvsroot/ap-python/python/examples/aptk/playlist.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** playlist.py 29 Jul 2002 12:38:52 -0000 1.9 --- playlist.py 16 Aug 2002 05:36:11 -0000 1.10 *************** *** 35,39 **** ('.playlist.list.columns', ('current', 'playtime', 'track', 'title', 'album', 'artist', 'year', ! 'genre', 'filename', 'comment')), ('.playlist.list.playtime.file', 'playtime.xpm'), ('.playlist.list.track.file', 'track.xpm'), --- 35,39 ---- ('.playlist.list.columns', ('current', 'playtime', 'track', 'title', 'album', 'artist', 'year', ! 'genre')), ('.playlist.list.playtime.file', 'playtime.xpm'), ('.playlist.list.track.file', 'track.xpm'), |
From: <sj...@us...> - 2002-07-29 12:38:55
|
Update of /cvsroot/ap-python/python/src In directory usw-pr-cvs1:/tmp/cvs-serv14340/src Modified Files: pyplaylist.cpp Log Message: Bind Playlist::Sort method. Index: pyplaylist.cpp =================================================================== RCS file: /cvsroot/ap-python/python/src/pyplaylist.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** pyplaylist.cpp 21 Jul 2002 09:27:31 -0000 1.6 --- pyplaylist.cpp 29 Jul 2002 12:38:52 -0000 1.7 *************** *** 47,50 **** --- 47,51 ---- // Clear clear // Paused is_paused + // Sort sort // Pause pause // UnPause unpause *************** *** 166,169 **** --- 167,187 ---- }; + // # # # # # # # # # # Sort (seq) # # # # # # # # # # # # # # # + static PyObject *pysort (PyPlaylist_Object *self, PyObject *args) + { + char *s; + + if (!PyArg_ParseTuple (args, "s:sort", &s)) + return NULL; + + Py_BEGIN_ALLOW_THREADS + self->cobject->Sort (s); + Py_END_ALLOW_THREADS + + Py_INCREF (Py_None); + return Py_None; + }; + + // # # # # # # # # # # Play (n, locking) # # # # # # # # # # # # # static PyObject *pyplay (PyPlaylist_Object *self, PyObject *args) *************** *** 431,434 **** --- 449,453 ---- {"get_length", (PyCFunction) pyget_length, METH_VARARGS}, {"next", (PyCFunction) pynext, METH_VARARGS}, + {"sort", (PyCFunction) pysort, METH_VARARGS}, {"prev", (PyCFunction) pyprev, METH_VARARGS}, {"get_current", (PyCFunction) pyget_current, METH_VARARGS}, |
From: <sj...@us...> - 2002-07-29 12:38:55
|
Update of /cvsroot/ap-python/python/examples/apcontrol In directory usw-pr-cvs1:/tmp/cvs-serv14340/examples/apcontrol Modified Files: Makefile.am README Added Files: sort.py Log Message: Bind Playlist::Sort method. --- NEW FILE: sort.py --- #!/usr/bin/env python # Sort # $Id: sort.py,v 1.1 2002/07/29 12:38:52 sjah Exp $ import apcontrol, sys s = apcontrol.Session () if s.is_running (): s.sort (sys.argv[1]) else: print 'Session 0 is not running' Index: Makefile.am =================================================================== RCS file: /cvsroot/ap-python/python/examples/apcontrol/Makefile.am,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Makefile.am 6 Jul 2002 16:17:58 -0000 1.5 --- Makefile.am 29 Jul 2002 12:38:52 -0000 1.6 *************** *** 1 **** ! EXTRA_DIST = info2.py info.py np.py add.py clear.py seek.py speed.py README pan.py volume.py pause.py unpause.py --- 1,2 ---- ! EXTRA_DIST = info2.py info.py np.py add.py clear.py seek.py speed.py\ ! README pan.py volume.py pause.py unpause.py sort.py Index: README =================================================================== RCS file: /cvsroot/ap-python/python/examples/apcontrol/README,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** README 6 Jul 2002 16:12:56 -0000 1.3 --- README 29 Jul 2002 12:38:52 -0000 1.4 *************** *** 12,15 **** --- 12,16 ---- pause.py Pause playback. unpause.py Unpause playback. + sort.py Sort playlist items. For more information look at the samples code. |
From: <sj...@us...> - 2002-07-29 12:38:55
|
Update of /cvsroot/ap-python/python/apcontrol In directory usw-pr-cvs1:/tmp/cvs-serv14340/apcontrol Modified Files: apcontrol.c pysession.c Log Message: Bind Playlist::Sort method. Index: apcontrol.c =================================================================== RCS file: /cvsroot/ap-python/python/apcontrol/apcontrol.c,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** apcontrol.c 2 Jun 2002 17:07:11 -0000 1.13 --- apcontrol.c 29 Jul 2002 12:38:52 -0000 1.14 *************** *** 189,192 **** --- 189,193 ---- MAP_SIMPLE (clear_playlist) MAP_STR (add_path) + MAP_STR (sort) MAP_STR (add_and_play) MAP_FLOAT (set_speed) *************** *** 294,297 **** --- 295,299 ---- {"clear_playlist", pyclear_playlist, METH_VARARGS}, {"add_path", pyadd_path, METH_VARARGS}, + {"sort", pysort, METH_VARARGS}, {"add_and_play", pyadd_and_play, METH_VARARGS}, {"set_speed", pyset_speed, METH_VARARGS}, Index: pysession.c =================================================================== RCS file: /cvsroot/ap-python/python/apcontrol/pysession.c,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** pysession.c 2 Jun 2002 17:07:11 -0000 1.13 --- pysession.c 29 Jul 2002 12:38:52 -0000 1.14 *************** *** 209,212 **** --- 209,213 ---- MAP_SIMPLE (clear_playlist) MAP_STR (add_path) + MAP_STR (sort) MAP_STR (add_and_play) MAP_FLOAT (set_speed) *************** *** 270,273 **** --- 271,275 ---- {"get_comment", pyget_comment, METH_VARARGS}, {"get_artist", pyget_artist, METH_VARARGS}, + {"sort", pysort, METH_VARARGS}, {"get_year", pyget_year, METH_VARARGS}, {"set_volume", pyset_volume, METH_VARARGS}, |
From: <sj...@us...> - 2002-07-29 12:38:55
|
Update of /cvsroot/ap-python/python/examples/aptk In directory usw-pr-cvs1:/tmp/cvs-serv14340/examples/aptk Modified Files: playlist.py Log Message: Bind Playlist::Sort method. Index: playlist.py =================================================================== RCS file: /cvsroot/ap-python/python/examples/aptk/playlist.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** playlist.py 25 Jul 2002 16:19:30 -0000 1.8 --- playlist.py 29 Jul 2002 12:38:52 -0000 1.9 *************** *** 35,39 **** ('.playlist.list.columns', ('current', 'playtime', 'track', 'title', 'album', 'artist', 'year', ! 'genre')), ('.playlist.list.playtime.file', 'playtime.xpm'), ('.playlist.list.track.file', 'track.xpm'), --- 35,39 ---- ('.playlist.list.columns', ('current', 'playtime', 'track', 'title', 'album', 'artist', 'year', ! 'genre', 'filename', 'comment')), ('.playlist.list.playtime.file', 'playtime.xpm'), ('.playlist.list.track.file', 'track.xpm'), |
From: <sj...@us...> - 2002-07-28 13:45:50
|
Update of /cvsroot/ap-python/python/aptk In directory usw-pr-cvs1:/tmp/cvs-serv30421/aptk Modified Files: control.py info.py misc.py pan.py playlist.py speed.py Log Message: Add ** regexp to property key and changed meaning of a * regexp. Index: control.py =================================================================== RCS file: /cvsroot/ap-python/python/aptk/control.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** control.py 28 Jul 2002 13:32:12 -0000 1.8 --- control.py 28 Jul 2002 13:45:46 -0000 1.9 *************** *** 39,43 **** # Defualt properties __properties = aptk.misc.WidgetProperties ([ ! ('*.play.button.label', 'Play') ]) --- 39,43 ---- # Defualt properties __properties = aptk.misc.WidgetProperties ([ ! ('**.play.button.label', 'Play') ]) *************** *** 67,71 **** # Defualt properties __properties = aptk.misc.WidgetProperties ([ ! ('*.next.button.label', 'Next') ]) --- 67,71 ---- # Defualt properties __properties = aptk.misc.WidgetProperties ([ ! ('**.next.button.label', 'Next') ]) *************** *** 95,99 **** # Defualt properties __properties = aptk.misc.WidgetProperties ([ ! ('*.prev.button.label', 'Prev') ]) --- 95,99 ---- # Defualt properties __properties = aptk.misc.WidgetProperties ([ ! ('**.prev.button.label', 'Prev') ]) *************** *** 123,127 **** # Defualt properties __properties = aptk.misc.WidgetProperties ([ ! ('*.stop.button.label', 'Stop') ]) --- 123,127 ---- # Defualt properties __properties = aptk.misc.WidgetProperties ([ ! ('**.stop.button.label', 'Stop') ]) *************** *** 153,157 **** # Defualt properties __properties = aptk.misc.WidgetProperties ([ ! ('*.playlist.button.label', 'Playlist') ]) --- 153,157 ---- # Defualt properties __properties = aptk.misc.WidgetProperties ([ ! ('**.playlist.button.label', 'Playlist') ]) Index: info.py =================================================================== RCS file: /cvsroot/ap-python/python/aptk/info.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** info.py 23 Jul 2002 09:01:55 -0000 1.9 --- info.py 28 Jul 2002 13:45:46 -0000 1.10 *************** *** 191,196 **** # Defualt properties __properties = aptk.misc.WidgetProperties ([ ! ('*.tagsinfo.format', '%a - %t'), ! ('*.tagsinfo.charset', None) ]) --- 191,196 ---- # Defualt properties __properties = aptk.misc.WidgetProperties ([ ! ('**.tagsinfo.format', '%a - %t'), ! ('**.tagsinfo.charset', None) ]) Index: misc.py =================================================================== RCS file: /cvsroot/ap-python/python/aptk/misc.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** misc.py 23 Jul 2002 09:01:55 -0000 1.5 --- misc.py 28 Jul 2002 13:45:46 -0000 1.6 *************** *** 47,52 **** # Allow only * in regexps ! key = key.replace ("*", "MiU2hLo4SpI5GN999UeSED") key = re.escape (key) key = "^" + key.replace ("MiU2hLo4SpI5GN999UeSED", ".*") + "$" --- 47,56 ---- # Allow only * in regexps ! key = key.replace ("**", "MiU2hLo4SpI5GN999UeSED") ! key = key.replace ("*", "wep33prir666wvr22r12rr") ! key = re.escape (key) + + key = key.replace ("wep33prir666wvr22r12rr", "[a-zA-Z]*") key = "^" + key.replace ("MiU2hLo4SpI5GN999UeSED", ".*") + "$" *************** *** 84,90 **** # Defualt properties __properties = WidgetProperties ([ ! ('*.button.relief', None), ! ('*.button.label', ''), ! ('*.button.file', None), ]) --- 88,94 ---- # Defualt properties __properties = WidgetProperties ([ ! ('**.button.relief', None), ! ('**.button.label', ''), ! ('**.button.file', None), ]) Index: pan.py =================================================================== RCS file: /cvsroot/ap-python/python/aptk/pan.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** pan.py 21 Jul 2002 18:15:43 -0000 1.5 --- pan.py 28 Jul 2002 13:45:46 -0000 1.6 *************** *** 117,123 **** # Defualt properties __properties = aptk.misc.WidgetProperties ([ ! ('*.pan.left.button.label', 'Left'), ! ('*.pan.center.button.label', 'Center'), ! ('*.pan.right.button.label', 'Right') ]) --- 117,123 ---- # Defualt properties __properties = aptk.misc.WidgetProperties ([ ! ('**.pan.left.button.label', 'Left'), ! ('**.pan.center.button.label', 'Center'), ! ('**.pan.right.button.label', 'Right') ]) Index: playlist.py =================================================================== RCS file: /cvsroot/ap-python/python/aptk/playlist.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** playlist.py 28 Jul 2002 13:32:12 -0000 1.11 --- playlist.py 28 Jul 2002 13:45:46 -0000 1.12 *************** *** 32,51 **** class List (gtk.ScrolledWindow): __properties = aptk.misc.WidgetProperties ([ ! ('*.list.columns', ('current', 'playtime', 'track', 'title', 'album', 'artist', 'year', 'genre')), ! ('*.list.playtime.label', 'Playtime'), ! ('*.list.year.label', 'Year'), ! ('*.list.track.label', 'Track'), ! ('*.list.title.label', 'Title'), ! ('*.list.album.label', 'Album'), ! ('*.list.artist.label', 'Artist'), ! ('*.list.genre.label', 'Genre'), ! ('*.list.comment.label', 'Comment'), ! ('*.list.filename.label', 'Filename'), ! ('*.list.current.label', ''), ! ('*.list.mark.label', '-->'), ! ('*.list.*.file', None), ! ('*.list.*.alignment', 0.5), ! ('*.list.charset', None) ]) --- 32,51 ---- class List (gtk.ScrolledWindow): __properties = aptk.misc.WidgetProperties ([ ! ('**.list.columns', ('current', 'playtime', 'track', 'title', 'album', 'artist', 'year', 'genre')), ! ('**.list.playtime.label', 'Playtime'), ! ('**.list.year.label', 'Year'), ! ('**.list.track.label', 'Track'), ! ('**.list.title.label', 'Title'), ! ('**.list.album.label', 'Album'), ! ('**.list.artist.label', 'Artist'), ! ('**.list.genre.label', 'Genre'), ! ('**.list.comment.label', 'Comment'), ! ('**.list.filename.label', 'Filename'), ! ('**.list.current.label', ''), ! ('**.list.mark.label', '-->'), ! ('**.list.*.file', None), ! ('**.list.*.alignment', 0.5), ! ('**.list.charset', None) ]) *************** *** 238,244 **** # Defualt properties __properties = aptk.misc.WidgetProperties ([ ! ('*.clear.button.label', 'Clear'), ! ('*.clear.warning', 'Do you want to clear playlist?'), ! ('*.clear.confirm', 1) ]) --- 238,244 ---- # Defualt properties __properties = aptk.misc.WidgetProperties ([ ! ('**.clear.button.label', 'Clear'), ! ('**.clear.warning', 'Do you want to clear playlist?'), ! ('**.clear.confirm', 1) ]) *************** *** 288,294 **** # Defualt properties __properties = aptk.misc.WidgetProperties ([ ! ('*.remove.button.label', 'Remove'), ! ('*.remove.warning', 'Do you want to remove selected items from the playlist?'), ! ('*.remove.confirm', 1) ]) --- 288,294 ---- # Defualt properties __properties = aptk.misc.WidgetProperties ([ ! ('**.remove.button.label', 'Remove'), ! ('**.remove.warning', 'Do you want to remove selected items from the playlist?'), ! ('**.remove.confirm', 1) ]) *************** *** 379,390 **** # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # class PlaylistWindow (gtk.Window): - __properties = aptk.misc.WidgetProperties ([ - ('*.playlist.clear.button.label', 'Clear'), - ('*.playlist.remove.button.label', 'Remove'), - ('*.playlist.add.button.label', 'Add'), - ('*.playlist.load.button.label', 'Load'), - ('*.playlist.save.button.label', 'Save') - ]) - def __init__ (self, pl, prop = None, prefix = ""): """Initializer.""" --- 379,382 ---- *************** *** 394,399 **** # Create new properties whth our defaults added - # prop = prop and (prop + self.__properties) or self.__properties - prop = prop and (prop + self.__properties) or self.__properties prefix += '.playlist' --- 386,389 ---- Index: speed.py =================================================================== RCS file: /cvsroot/ap-python/python/aptk/speed.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** speed.py 21 Jul 2002 18:15:43 -0000 1.5 --- speed.py 28 Jul 2002 13:45:47 -0000 1.6 *************** *** 116,122 **** # Defualt properties __properties = aptk.misc.WidgetProperties ([ ! ('*.speed.pause.button.label', '||'), ! ('*.speed.backward.button.label', 'Rw'), ! ('*.speed.forward.button.label', 'Fw') ]) --- 116,122 ---- # Defualt properties __properties = aptk.misc.WidgetProperties ([ ! ('**.speed.pause.button.label', '||'), ! ('**.speed.backward.button.label', 'Rw'), ! ('**.speed.forward.button.label', 'Fw') ]) |
From: <sj...@us...> - 2002-07-28 13:45:50
|
Update of /cvsroot/ap-python/python/examples/aptk In directory usw-pr-cvs1:/tmp/cvs-serv30421/examples/aptk Modified Files: panel.py Log Message: Add ** regexp to property key and changed meaning of a * regexp. Index: panel.py =================================================================== RCS file: /cvsroot/ap-python/python/examples/aptk/panel.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** panel.py 26 Jul 2002 14:32:55 -0000 1.10 --- panel.py 28 Jul 2002 13:45:47 -0000 1.11 *************** *** 57,61 **** ('.control.playlist.list.playtime.file', 'playtime.xpm'), ('.control.playlist.list.track.file', 'track.xpm'), ! ('.control.playlist.list.mark.file', 'current_play.xpm') ]) --- 57,62 ---- ('.control.playlist.list.playtime.file', 'playtime.xpm'), ('.control.playlist.list.track.file', 'track.xpm'), ! ('.control.playlist.list.mark.file', 'current_play.xpm'), ! ('.control.playlist.*.button.relief', gtk.RELIEF_NONE) ]) |
From: <sj...@us...> - 2002-07-28 13:32:24
|
Update of /cvsroot/ap-python/python/aptk In directory usw-pr-cvs1:/tmp/cvs-serv26913/aptk Modified Files: control.py playlist.py Log Message: Simplerify playlist widget structure. Index: control.py =================================================================== RCS file: /cvsroot/ap-python/python/aptk/control.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** control.py 23 Jul 2002 09:01:55 -0000 1.7 --- control.py 28 Jul 2002 13:32:12 -0000 1.8 *************** *** 248,252 **** gtk.VBox.__init__ (self) ! _Box.__init__ (self, pl, prop, relief = relief) # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # --- 248,252 ---- gtk.VBox.__init__ (self) ! _Box.__init__ (self, pl, prop, prefix) # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # Index: playlist.py =================================================================== RCS file: /cvsroot/ap-python/python/aptk/playlist.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** playlist.py 27 Jul 2002 16:23:32 -0000 1.10 --- playlist.py 28 Jul 2002 13:32:12 -0000 1.11 *************** *** 232,235 **** --- 232,381 ---- # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # + class ClearButton (aptk.misc.Button): + """Start playback. + """ + + # Defualt properties + __properties = aptk.misc.WidgetProperties ([ + ('*.clear.button.label', 'Clear'), + ('*.clear.warning', 'Do you want to clear playlist?'), + ('*.clear.confirm', 1) + ]) + + def __init__ (self, pl, prop = None, prefix = ""): + """Initializer.""" + + # Create new properties whth our defaults added + prop = prop and (prop + self.__properties) or self.__properties + prefix += ".clear" + + # Properties + self.__warning = prop.get_value (prefix + ".warning") + self.__confirm = prop.get_value (prefix + ".confirm") + + # Call base contructor + aptk.misc.Button.__init__ (self, prop, prefix) + + self.connect ("clicked", self.__gtkcb_clicked) + self.__pl = pl + + def __gtkcb_clicked (self, w): + """Handler for clicked signal.""" + + # Confirm this action if user warries about its data + if self.__confirm: + d = gtk.MessageDialog (self.get_toplevel (), + gtk.DIALOG_DESTROY_WITH_PARENT, + gtk.MESSAGE_QUESTION, + gtk.BUTTONS_YES_NO, + self.__warning) + + rc = d.run () + d.destroy () + + if rc != gtk.RESPONSE_YES: return + + # Clear if answer is Yes + gtk.threads_leave () + self.__pl.clear () + gtk.threads_enter () + + # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # + class RemoveButton (aptk.misc.Button): + """Start playback. + """ + + # Defualt properties + __properties = aptk.misc.WidgetProperties ([ + ('*.remove.button.label', 'Remove'), + ('*.remove.warning', 'Do you want to remove selected items from the playlist?'), + ('*.remove.confirm', 1) + ]) + + def __init__ (self, pl, list, prop = None, prefix = ""): + """Initializer.""" + + # Create new properties whth our defaults added + prop = prop and (prop + self.__properties) or self.__properties + prefix += ".remove" + + # Properties + self.__warning = prop.get_value (prefix + ".warning") + self.__confirm = prop.get_value (prefix + ".confirm") + + # Call base contructor + aptk.misc.Button.__init__ (self, prop, prefix) + + self.connect ("clicked", self.__gtkcb_clicked) + self.__pl = pl + self.__list = list + + def __gtkcb_clicked (self, w): + """Handler for remove button clicked signal.""" + + # Confirm this action if user warries about its data + if self.__confirm: + d = gtk.MessageDialog (self.get_toplevel (), + gtk.DIALOG_DESTROY_WITH_PARENT, + gtk.MESSAGE_QUESTION, + gtk.BUTTONS_YES_NO, + self.__warning) + + rc = d.run () + d.destroy () + + if rc != gtk.RESPONSE_YES: return + + selection = self.__list.get_treeview ().get_selection () + + # Create list of items + list = [] + selection.selected_foreach (lambda model, path, iter: list.append (path [0])) + + list.sort () + list.reverse () + + # TODO: FIx this dumb algorithm + gdk.threads_leave () + for n in list: + self.__pl.remove (n+1, n+1) + gdk.threads_enter () + + # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # + class _ButtonsBox: + """Internal.""" + + def __init__ (self, pl, list, prop = None, prefix = ""): + """Initializeer.""" + + # Create buttons + self.clear_button = ClearButton (pl, prop, prefix) + self.remove_button = RemoveButton (pl, list, prop, prefix) + + # Pack buttons + self.pack_end (self.clear_button, expand = gtk.FALSE) + self.pack_end (self.remove_button, expand = gtk.FALSE) + + # Show these buttons + self.remove_button.show () + self.clear_button.show () + + # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # + class ButtonsHBox (gtk.HBox, _ButtonsBox): + def __init__ (self, pl, list, prop = None, prefix = ""): + """Initializer.""" + + gtk.HBox.__init__ (self) + _ButtonsBox.__init__ (self, pl, list, prop, prefix) + + # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # + class ButtonsVBox (gtk.VBox, _ButtonsBox): + def __init__ (self, pl, list, prop = None, prefix = ""): + """Initializer""" + + gtk.VBox.__init__ (self) + _ButtonsBox.__init__ (self, pl, list, prop, prefix) + + # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # class PlaylistWindow (gtk.Window): __properties = aptk.misc.WidgetProperties ([ *************** *** 237,244 **** ('*.playlist.remove.button.label', 'Remove'), ('*.playlist.add.button.label', 'Add'), - ('*.playlist.sort.button.label', 'Sort'), ('*.playlist.load.button.label', 'Load'), ! ('*.playlist.save.button.label', 'Save'), ! ('*.playlist.clear.confirm', 'Do you want to clear playlist?') ]) --- 383,388 ---- ('*.playlist.remove.button.label', 'Remove'), ('*.playlist.add.button.label', 'Add'), ('*.playlist.load.button.label', 'Load'), ! ('*.playlist.save.button.label', 'Save') ]) *************** *** 254,260 **** prefix += '.playlist' - # Properties - self.__clear_confirm = prop.get_value (prefix + ".clear.confirm") - # Init base class gtk.Window.__init__ (self) --- 398,401 ---- *************** *** 272,304 **** self.__list.show () ! # Create hbox for buttons ! hbox = gtk.HBox () ! vbox.pack_end (hbox, expand = gtk.FALSE) ! hbox.show () ! ! # Create buttons ! self.add_button = aptk.misc.Button (prop, prefix + ".add") ! hbox.pack_start (self.add_button, expand = gtk.FALSE) ! self.add_button.show () ! ! self.remove_button = aptk.misc.Button (prop, prefix + ".remove") ! hbox.pack_start (self.remove_button, expand = gtk.FALSE) ! self.remove_button.show () ! ! self.sort_button = aptk.misc.Button (prop, prefix + ".sort") ! hbox.pack_start (self.sort_button, expand = gtk.FALSE) ! self.sort_button.show () ! ! self.clear_button = aptk.misc.Button (prop, prefix + ".clear") ! hbox.pack_start (self.clear_button, expand = gtk.FALSE) ! self.clear_button.show () ! ! self.load_button = aptk.misc.Button (prop, prefix + ".load") ! hbox.pack_start (self.load_button, expand = gtk.FALSE) ! self.load_button.show () ! ! self.save_button = aptk.misc.Button (prop, prefix + ".save") ! hbox.pack_start (self.save_button, expand = gtk.FALSE) ! self.save_button.show () # Register this object as the playlist notifier --- 413,420 ---- self.__list.show () ! # Create and add buttons box ! self.__bbox = ButtonsHBox (pl, self.__list, prop, prefix) ! vbox.pack_start (self.__bbox, expand = gtk.FALSE) ! self.__bbox.show () # Register this object as the playlist notifier *************** *** 306,311 **** # Connect signals - self.clear_button.connect ("clicked", self.__gtkcb_clear_clicked) - self.remove_button.connect ("clicked", self.__gtkcb_remove_clicked) self.connect ("destroy", self.__gtkcb_destroy) self.__list.get_treeview ().connect ("row-activated", self.__gtkcb_list_row_activated) --- 422,425 ---- *************** *** 375,414 **** self.__pl.play (path [0] + 1) gdk.threads_enter () - - def __gtkcb_clear_clicked (self, w): - """Handler for clear button clicked signal.""" - - # Confirm this action - d = gtk.MessageDialog (self, - gtk.DIALOG_DESTROY_WITH_PARENT, - gtk.MESSAGE_QUESTION, - gtk.BUTTONS_YES_NO, - self.__clear_confirm) - - rc = d.run () - d.destroy () - - # Clear if answer is Yes - if rc == gtk.RESPONSE_YES: - gtk.threads_leave () - self.__pl.clear () - gtk.threads_enter () - - def __gtkcb_remove_clicked (self, w): - """Handler for remove button clicked signal.""" - - selection = self.__list.get_treeview ().get_selection () - - # Create list of items - list = [] - selection.selected_foreach (lambda model, path, iter: list.append (path [0])) - - list.sort () - list.reverse () - - gdk.threads_leave () - for n in list: - self.__pl.remove (n+1, n+1) - gdk.threads_enter () def __gtkcb_destroy (self, widget): --- 489,492 ---- |
From: <sj...@us...> - 2002-07-27 16:23:38
|
Update of /cvsroot/ap-python/python/aptk In directory usw-pr-cvs1:/tmp/cvs-serv21190/aptk Modified Files: playlist.py Log Message: Handle remove button. Index: playlist.py =================================================================== RCS file: /cvsroot/ap-python/python/aptk/playlist.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** playlist.py 26 Jul 2002 14:32:54 -0000 1.9 --- playlist.py 27 Jul 2002 16:23:32 -0000 1.10 *************** *** 27,30 **** --- 27,32 ---- gdk = gtk.gdk + # TODO: Make this code more simple and faster!!! + # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # class List (gtk.ScrolledWindow): *************** *** 202,208 **** # Blank old marked row if self.__marked_path: ! iter = self.__store.get_iter (self.__marked_path) ! value = self.__mark_pixbuf and self.__blank_pixbuf or '' ! self.__store.set (iter, self.__COLUMN_CURRENT, value) if row != -1: --- 204,213 ---- # Blank old marked row if self.__marked_path: ! try: ! iter = self.__store.get_iter (self.__marked_path) ! value = self.__mark_pixbuf and self.__blank_pixbuf or '' ! self.__store.set (iter, self.__COLUMN_CURRENT, value) ! except: ! pass if row != -1: *************** *** 220,223 **** --- 225,234 ---- self.__store.clear () + def remove (self, n): + """Remove row.""" + + iter = self.__store.get_iter ((n,)) + self.__store.remove (iter) + # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # class PlaylistWindow (gtk.Window): *************** *** 296,299 **** --- 307,311 ---- # Connect signals self.clear_button.connect ("clicked", self.__gtkcb_clear_clicked) + self.remove_button.connect ("clicked", self.__gtkcb_remove_clicked) self.connect ("destroy", self.__gtkcb_destroy) self.__list.get_treeview ().connect ("row-activated", self.__gtkcb_list_row_activated) *************** *** 354,358 **** """Alsaplayer's callback.""" ! print "Remove: ", start, end def __gtkcb_list_row_activated (self, tree, path, column): --- 366,371 ---- """Alsaplayer's callback.""" ! for n in range (end-start+1): ! self.__list.remove (start-1) def __gtkcb_list_row_activated (self, tree, path, column): *************** *** 381,384 **** --- 394,414 ---- self.__pl.clear () gtk.threads_enter () + + def __gtkcb_remove_clicked (self, w): + """Handler for remove button clicked signal.""" + + selection = self.__list.get_treeview ().get_selection () + + # Create list of items + list = [] + selection.selected_foreach (lambda model, path, iter: list.append (path [0])) + + list.sort () + list.reverse () + + gdk.threads_leave () + for n in list: + self.__pl.remove (n+1, n+1) + gdk.threads_enter () def __gtkcb_destroy (self, widget): |
From: <sj...@us...> - 2002-07-26 14:33:47
|
Update of /cvsroot/ap-python/python/examples/aptk In directory usw-pr-cvs1:/tmp/cvs-serv2852/examples/aptk Modified Files: ChangeLog Log Message: ChangeLog updated. Index: ChangeLog =================================================================== RCS file: /cvsroot/ap-python/python/examples/aptk/ChangeLog,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** ChangeLog 24 Jul 2002 07:05:56 -0000 1.13 --- ChangeLog 26 Jul 2002 14:33:44 -0000 1.14 *************** *** 1,2 **** --- 1,12 ---- + 2002-07-26 14:32 Evgeny Chukreev <co...@ec...> + + * panel.py: Add buttons to playlist widget. Fix problem when aptk + crashed on empty lists. + + 2002-07-25 16:19 Evgeny Chukreev <co...@ec...> + + * panel.py, playlist.py: Playlist widget is thread safe now. Catch + playlist update notify. + 2002-07-24 07:04 Evgeny Chukreev <co...@ec...> |
From: <sj...@us...> - 2002-07-26 14:33:47
|
Update of /cvsroot/ap-python/python/aptk In directory usw-pr-cvs1:/tmp/cvs-serv2852/aptk Modified Files: ChangeLog Log Message: ChangeLog updated. Index: ChangeLog =================================================================== RCS file: /cvsroot/ap-python/python/aptk/ChangeLog,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** ChangeLog 24 Jul 2002 07:05:56 -0000 1.15 --- ChangeLog 26 Jul 2002 14:33:44 -0000 1.16 *************** *** 1,2 **** --- 1,12 ---- + 2002-07-26 14:32 Evgeny Chukreev <co...@ec...> + + * playlist.py: Add buttons to playlist widget. Fix problem when + aptk crashed on empty lists. + + 2002-07-25 16:19 Evgeny Chukreev <co...@ec...> + + * playlist.py: Playlist widget is thread safe now. Catch playlist + update notify. + 2002-07-24 07:04 Evgeny Chukreev <co...@ec...> |
From: <sj...@us...> - 2002-07-26 14:33:47
|
Update of /cvsroot/ap-python/python/src In directory usw-pr-cvs1:/tmp/cvs-serv2852/src Modified Files: ChangeLog Log Message: ChangeLog updated. Index: ChangeLog =================================================================== RCS file: /cvsroot/ap-python/python/src/ChangeLog,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** ChangeLog 21 Jul 2002 18:16:41 -0000 1.11 --- ChangeLog 26 Jul 2002 14:33:43 -0000 1.12 *************** *** 1,2 **** --- 1,7 ---- + 2002-07-26 06:18 Evgeny Chukreev <co...@ec...> + + * pyplaylistinterface.cpp, pyplaylistinterface.h: Remove + CbLock/CbUnlock callbacks. + 2002-07-21 10:27 Evgeny Chukreev <co...@ec...> |
From: <sj...@us...> - 2002-07-26 14:33:02
|
Update of /cvsroot/ap-python/python/aptk In directory usw-pr-cvs1:/tmp/cvs-serv2493/aptk Modified Files: playlist.py Log Message: Add buttons to playlist widget. Fix problem when aptk crashed on empty lists. Index: playlist.py =================================================================== RCS file: /cvsroot/ap-python/python/aptk/playlist.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** playlist.py 25 Jul 2002 16:19:30 -0000 1.8 --- playlist.py 26 Jul 2002 14:32:54 -0000 1.9 *************** *** 206,219 **** self.__store.set (iter, self.__COLUMN_CURRENT, value) ! # Create value to mark new row ! value = self.__mark_pixbuf or self.__mark_label ! # Set ! self.__marked_path = (row, ) ! iter = self.__store.get_iter (self.__marked_path) ! self.__store.set (iter, self.__COLUMN_CURRENT, value) # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # class PlaylistWindow (gtk.Window): def __init__ (self, pl, prop = None, prefix = ""): """Initializer.""" --- 206,235 ---- self.__store.set (iter, self.__COLUMN_CURRENT, value) ! if row != -1: ! # Create value to mark new row ! value = self.__mark_pixbuf or self.__mark_label ! # Set ! self.__marked_path = (row, ) ! iter = self.__store.get_iter (self.__marked_path) ! self.__store.set (iter, self.__COLUMN_CURRENT, value) ! ! def clear (self): ! """Clear list.""" ! ! self.__store.clear () # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # class PlaylistWindow (gtk.Window): + __properties = aptk.misc.WidgetProperties ([ + ('*.playlist.clear.button.label', 'Clear'), + ('*.playlist.remove.button.label', 'Remove'), + ('*.playlist.add.button.label', 'Add'), + ('*.playlist.sort.button.label', 'Sort'), + ('*.playlist.load.button.label', 'Load'), + ('*.playlist.save.button.label', 'Save'), + ('*.playlist.clear.confirm', 'Do you want to clear playlist?') + ]) + def __init__ (self, pl, prop = None, prefix = ""): """Initializer.""" *************** *** 224,241 **** # Create new properties whth our defaults added # prop = prop and (prop + self.__properties) or self.__properties prefix += '.playlist' # Init base class gtk.Window.__init__ (self) # Create and add list self.__list = List (prop, prefix) ! self.add (self.__list) self.__list.show () # Register this object as the playlist notifier self.__pl.register (self) # Connect signals self.connect ("destroy", self.__gtkcb_destroy) self.__list.get_treeview ().connect ("row-activated", self.__gtkcb_list_row_activated) --- 240,299 ---- # Create new properties whth our defaults added # prop = prop and (prop + self.__properties) or self.__properties + prop = prop and (prop + self.__properties) or self.__properties prefix += '.playlist' + # Properties + self.__clear_confirm = prop.get_value (prefix + ".clear.confirm") + # Init base class gtk.Window.__init__ (self) + self.set_border_width (2) + + # VBOX + vbox = gtk.VBox () + self.add (vbox) + vbox.show () + vbox.set_spacing (6) # Create and add list self.__list = List (prop, prefix) ! vbox.pack_start (self.__list) self.__list.show () + # Create hbox for buttons + hbox = gtk.HBox () + vbox.pack_end (hbox, expand = gtk.FALSE) + hbox.show () + + # Create buttons + self.add_button = aptk.misc.Button (prop, prefix + ".add") + hbox.pack_start (self.add_button, expand = gtk.FALSE) + self.add_button.show () + + self.remove_button = aptk.misc.Button (prop, prefix + ".remove") + hbox.pack_start (self.remove_button, expand = gtk.FALSE) + self.remove_button.show () + + self.sort_button = aptk.misc.Button (prop, prefix + ".sort") + hbox.pack_start (self.sort_button, expand = gtk.FALSE) + self.sort_button.show () + + self.clear_button = aptk.misc.Button (prop, prefix + ".clear") + hbox.pack_start (self.clear_button, expand = gtk.FALSE) + self.clear_button.show () + + self.load_button = aptk.misc.Button (prop, prefix + ".load") + hbox.pack_start (self.load_button, expand = gtk.FALSE) + self.load_button.show () + + self.save_button = aptk.misc.Button (prop, prefix + ".save") + hbox.pack_start (self.save_button, expand = gtk.FALSE) + self.save_button.show () + # Register this object as the playlist notifier self.__pl.register (self) # Connect signals + self.clear_button.connect ("clicked", self.__gtkcb_clear_clicked) self.connect ("destroy", self.__gtkcb_destroy) self.__list.get_treeview ().connect ("row-activated", self.__gtkcb_list_row_activated) *************** *** 286,289 **** --- 344,359 ---- gdk.threads_leave () + def cb_clear (self): + """Alsaplayer's callback.""" + + gdk.threads_enter () + self.__list.clear () + gdk.threads_leave () + + def cb_remove (self, start, end): + """Alsaplayer's callback.""" + + print "Remove: ", start, end + def __gtkcb_list_row_activated (self, tree, path, column): """Handler for a row activated signal.""" *************** *** 292,295 **** --- 362,384 ---- self.__pl.play (path [0] + 1) gdk.threads_enter () + + def __gtkcb_clear_clicked (self, w): + """Handler for clear button clicked signal.""" + + # Confirm this action + d = gtk.MessageDialog (self, + gtk.DIALOG_DESTROY_WITH_PARENT, + gtk.MESSAGE_QUESTION, + gtk.BUTTONS_YES_NO, + self.__clear_confirm) + + rc = d.run () + d.destroy () + + # Clear if answer is Yes + if rc == gtk.RESPONSE_YES: + gtk.threads_leave () + self.__pl.clear () + gtk.threads_enter () def __gtkcb_destroy (self, widget): |
From: <sj...@us...> - 2002-07-26 14:33:02
|
Update of /cvsroot/ap-python/python/examples/aptk In directory usw-pr-cvs1:/tmp/cvs-serv2493/examples/aptk Modified Files: panel.py Log Message: Add buttons to playlist widget. Fix problem when aptk crashed on empty lists. Index: panel.py =================================================================== RCS file: /cvsroot/ap-python/python/examples/aptk/panel.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** panel.py 25 Jul 2002 16:19:30 -0000 1.9 --- panel.py 26 Jul 2002 14:32:55 -0000 1.10 *************** *** 43,53 **** ('.control.prev.button.file', 'prev-sm.xpm'), ('.control.playlist.button.file', 'playlist.xpm'), ! ('*.button.relief', gtk.RELIEF_NONE), ('.speed.backward.button.file', 'r_play.xpm'), ('.speed.pause.button.file', 'pause.xpm'), ('.speed.forward.button.file', 'f_play.xpm'), ('.pan.left.button.file', 'l_pan.xpm'), ('.pan.center.button.file', 'c_pan.xpm'), ('.pan.right.button.file', 'r_pan.xpm'), ('.control.playlist.list.columns', ('current', 'playtime', 'track', 'title', 'album', 'artist', 'year', --- 43,55 ---- ('.control.prev.button.file', 'prev-sm.xpm'), ('.control.playlist.button.file', 'playlist.xpm'), ! ('.control.*.button.relief', gtk.RELIEF_NONE), ('.speed.backward.button.file', 'r_play.xpm'), ('.speed.pause.button.file', 'pause.xpm'), ('.speed.forward.button.file', 'f_play.xpm'), + ('.speed.*.button.relief', gtk.RELIEF_NONE), ('.pan.left.button.file', 'l_pan.xpm'), ('.pan.center.button.file', 'c_pan.xpm'), ('.pan.right.button.file', 'r_pan.xpm'), + ('.pan.*.button.relief', gtk.RELIEF_NONE), ('.control.playlist.list.columns', ('current', 'playtime', 'track', 'title', 'album', 'artist', 'year', |
From: <sj...@us...> - 2002-07-26 06:19:03
|
Update of /cvsroot/ap-python/python/src In directory usw-pr-cvs1:/tmp/cvs-serv23403 Modified Files: pyplaylistinterface.cpp pyplaylistinterface.h Log Message: Remove CbLock/CbUnlock callbacks. Index: pyplaylistinterface.cpp =================================================================== RCS file: /cvsroot/ap-python/python/src/pyplaylistinterface.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** pyplaylistinterface.cpp 2 Jun 2002 09:46:38 -0000 1.6 --- pyplaylistinterface.cpp 26 Jul 2002 06:18:58 -0000 1.7 *************** *** 60,113 **** } - // ------------------------- LOCK ---------------------------------- - void PyPlaylistInterfaceWrapper::CbLock () - { - BLOCK_THREADS - - // get python callback - if (PyObject_HasAttrString (pyobject, "cb_lock")) { - PyObject *cb = PyObject_GetAttrString (pyobject, "cb_lock"); - - // call - PyObject *arglist = Py_BuildValue ("()"); - PyObject *result = PyEval_CallObject (cb, arglist); - if (!result) { - PyErr_Print (); - } else - Py_DECREF (result); - - // decrease references - Py_DECREF (arglist); - Py_DECREF (cb); - } - - UNBLOCK_THREADS - } - - // ------------------------- UNLOCK ------------------------------- - void PyPlaylistInterfaceWrapper::CbUnlock () - { - BLOCK_THREADS - - // get python callback - if (PyObject_HasAttrString (pyobject, "cb_unlock")) { - PyObject *cb = PyObject_GetAttrString (pyobject, "cb_unlock"); - - // call - PyObject *arglist = Py_BuildValue ("()"); - PyObject *result = PyEval_CallObject (cb, arglist); - if (!result) { - PyErr_Print (); - } else - Py_DECREF (result); - - // decrease references - Py_DECREF (arglist); - Py_DECREF (cb); - } - - UNBLOCK_THREADS - } - // ------------------------- INSERT ---------------------------------- void PyPlaylistInterfaceWrapper::CbInsert(std::vector<PlayItem> &items, --- 60,63 ---- Index: pyplaylistinterface.h =================================================================== RCS file: /cvsroot/ap-python/python/src/pyplaylistinterface.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** pyplaylistinterface.h 2 Jun 2002 09:46:38 -0000 1.4 --- pyplaylistinterface.h 26 Jul 2002 06:18:58 -0000 1.5 *************** *** 12,17 **** virtual ~PyPlaylistInterfaceWrapper (); void CbSetCurrent(unsigned pos); - void CbLock(); - void CbUnlock(); void CbInsert(std::vector<PlayItem> &items, unsigned pos); void CbRemove(unsigned start, unsigned end); --- 12,15 ---- |
From: <sj...@us...> - 2002-07-25 16:19:37
|
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): |
From: <sj...@us...> - 2002-07-25 16:19:37
|
Update of /cvsroot/ap-python/python/examples/aptk In directory usw-pr-cvs1:/tmp/cvs-serv4092/examples/aptk Modified Files: panel.py playlist.py Log Message: Playlist widget is thread safe now. Catch playlist update notify. Index: panel.py =================================================================== RCS file: /cvsroot/ap-python/python/examples/aptk/panel.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** panel.py 24 Jul 2002 07:04:48 -0000 1.8 --- panel.py 25 Jul 2002 16:19:30 -0000 1.9 *************** *** 52,59 **** ('.control.playlist.list.columns', ('current', 'playtime', 'track', 'title', 'album', 'artist', 'year', ! 'genre', 'filename')), ('.control.playlist.list.playtime.file', 'playtime.xpm'), ('.control.playlist.list.track.file', 'track.xpm'), ! ('.playlist.list.mark.file', 'current_play.xpm') ]) --- 52,59 ---- ('.control.playlist.list.columns', ('current', 'playtime', 'track', 'title', 'album', 'artist', 'year', ! 'genre')), ('.control.playlist.list.playtime.file', 'playtime.xpm'), ('.control.playlist.list.track.file', 'track.xpm'), ! ('.control.playlist.list.mark.file', 'current_play.xpm') ]) Index: playlist.py =================================================================== RCS file: /cvsroot/ap-python/python/examples/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 *************** *** 35,39 **** ('.playlist.list.columns', ('current', 'playtime', 'track', 'title', 'album', 'artist', 'year', ! 'genre', 'filename')), ('.playlist.list.playtime.file', 'playtime.xpm'), ('.playlist.list.track.file', 'track.xpm'), --- 35,39 ---- ('.playlist.list.columns', ('current', 'playtime', 'track', 'title', 'album', 'artist', 'year', ! 'genre')), ('.playlist.list.playtime.file', 'playtime.xpm'), ('.playlist.list.track.file', 'track.xpm'), |
From: <sj...@us...> - 2002-07-24 07:06:05
|
Update of /cvsroot/ap-python/python In directory usw-pr-cvs1:/tmp/cvs-serv12950 Modified Files: ChangeLog Log Message: ChangeLog updated. Index: ChangeLog =================================================================== RCS file: /cvsroot/ap-python/python/ChangeLog,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** ChangeLog 21 Jul 2002 18:16:41 -0000 1.26 --- ChangeLog 24 Jul 2002 07:05:56 -0000 1.27 *************** *** 1,2 **** --- 1,6 ---- + 2002-07-23 09:00 Evgeny Chukreev <co...@ec...> + + * TODO: Add TODO list. + 2002-07-21 18:15 Evgeny Chukreev <co...@ec...> |
From: <sj...@us...> - 2002-07-24 07:06:05
|
Update of /cvsroot/ap-python/python/aptk In directory usw-pr-cvs1:/tmp/cvs-serv12950/aptk Modified Files: ChangeLog Log Message: ChangeLog updated. Index: ChangeLog =================================================================== RCS file: /cvsroot/ap-python/python/aptk/ChangeLog,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** ChangeLog 22 Jul 2002 16:27:06 -0000 1.14 --- ChangeLog 24 Jul 2002 07:05:56 -0000 1.15 *************** *** 1,2 **** --- 1,18 ---- + 2002-07-24 07:04 Evgeny Chukreev <co...@ec...> + + * playlist.py: Make columns reoraderable. Change selection mode to + SELECTION_MULTIPLE. Add song changing by double clicking on the + situated row. Show currently playing song with a mark in the + CURRENT column. + + 2002-07-23 09:01 Evgeny Chukreev <co...@ec...> + + * control.py, info.py, misc.py: Add support for locale chars in + info.TagsLabel. Add playlist button to control widget. + + 2002-07-23 07:23 Evgeny Chukreev <co...@ec...> + + * misc.py: Make * means as [a-zA-Z] in WidgetProperties. + 2002-07-22 16:26 Evgeny Chukreev <co...@ec...> |
From: <sj...@us...> - 2002-07-24 07:06:05
|
Update of /cvsroot/ap-python/python/examples/aptk In directory usw-pr-cvs1:/tmp/cvs-serv12950/examples/aptk Modified Files: ChangeLog Log Message: ChangeLog updated. Index: ChangeLog =================================================================== RCS file: /cvsroot/ap-python/python/examples/aptk/ChangeLog,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** ChangeLog 22 Jul 2002 16:27:06 -0000 1.12 --- ChangeLog 24 Jul 2002 07:05:56 -0000 1.13 *************** *** 1,2 **** --- 1,14 ---- + 2002-07-24 07:04 Evgeny Chukreev <co...@ec...> + + * panel.py, playlist.py: Make columns reoraderable. Change + selection mode to SELECTION_MULTIPLE. Add song changing by double + clicking on the situated row. Show currently playing song with a + mark in the CURRENT column. + + 2002-07-23 09:03 Evgeny Chukreev <co...@ec...> + + * Makefile.am, panel.py, playlist.py, playlist.xpm: Add playlist + support in panel example. + 2002-07-22 16:26 Evgeny Chukreev <co...@ec...> |
From: <sj...@us...> - 2002-07-24 07:04:53
|
Update of /cvsroot/ap-python/python/examples/aptk In directory usw-pr-cvs1:/tmp/cvs-serv12226/examples/aptk Modified Files: panel.py playlist.py Log Message: Make columns reoraderable. Change selection mode to SELECTION_MULTIPLE. Add song changing by double clicking on the situated row. Show currently playing song with a mark in the CURRENT column. Index: panel.py =================================================================== RCS file: /cvsroot/ap-python/python/examples/aptk/panel.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** panel.py 23 Jul 2002 09:03:25 -0000 1.7 --- panel.py 24 Jul 2002 07:04:48 -0000 1.8 *************** *** 50,58 **** ('.pan.center.button.file', 'c_pan.xpm'), ('.pan.right.button.file', 'r_pan.xpm'), ! ('.control.playlist.list.columns', ('playtime', 'track', 'title', 'album', 'artist', 'year', 'genre', 'filename')), ('.control.playlist.list.playtime.file', 'playtime.xpm'), ! ('.control.playlist.list.track.file', 'track.xpm') ]) --- 50,59 ---- ('.pan.center.button.file', 'c_pan.xpm'), ('.pan.right.button.file', 'r_pan.xpm'), ! ('.control.playlist.list.columns', ('current', 'playtime', 'track', 'title', 'album', 'artist', 'year', 'genre', 'filename')), ('.control.playlist.list.playtime.file', 'playtime.xpm'), ! ('.control.playlist.list.track.file', 'track.xpm'), ! ('.playlist.list.mark.file', 'current_play.xpm') ]) *************** *** 86,89 **** --- 87,91 ---- control.show () control_frame.show () + control_frame.set_border_width (1) hbox.show () Index: playlist.py =================================================================== RCS file: /cvsroot/ap-python/python/examples/aptk/playlist.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** playlist.py 23 Jul 2002 09:03:25 -0000 1.6 --- playlist.py 24 Jul 2002 07:04:48 -0000 1.7 *************** *** 33,41 **** # Properties properties = aptk.misc.WidgetProperties ([ ! ('.playlist.list.columns', ('playtime', 'track', 'title', 'album', 'artist', 'year', 'genre', 'filename')), ('.playlist.list.playtime.file', 'playtime.xpm'), ! ('.playlist.list.track.file', 'track.xpm') ]) --- 33,42 ---- # Properties properties = aptk.misc.WidgetProperties ([ ! ('.playlist.list.columns', ('current', 'playtime', 'track', 'title', 'album', 'artist', 'year', 'genre', 'filename')), ('.playlist.list.playtime.file', 'playtime.xpm'), ! ('.playlist.list.track.file', 'track.xpm'), ! ('.playlist.list.mark.file', 'current_play.xpm') ]) |
From: <sj...@us...> - 2002-07-24 07:04:53
|
Update of /cvsroot/ap-python/python/aptk In directory usw-pr-cvs1:/tmp/cvs-serv12226/aptk Modified Files: playlist.py Log Message: Make columns reoraderable. Change selection mode to SELECTION_MULTIPLE. Add song changing by double clicking on the situated row. Show currently playing song with a mark in the CURRENT column. Index: playlist.py =================================================================== RCS file: /cvsroot/ap-python/python/aptk/playlist.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** playlist.py 22 Jul 2002 16:26:27 -0000 1.6 --- playlist.py 24 Jul 2002 07:04:48 -0000 1.7 *************** *** 1,3 **** ! # playlist.py # Copyright (C) 2002 Evgeny Chukreev <co...@ec...> # --- 1,3 ---- ! # playlist.py - APTK Playlist Widgets # Copyright (C) 2002 Evgeny Chukreev <co...@ec...> # *************** *** 30,34 **** class List (gtk.ScrolledWindow): __properties = aptk.misc.WidgetProperties ([ ! ('*.list.columns', ('playtime', 'track', 'title', 'album', 'artist', 'year', 'genre')), ('*.list.playtime.label', 'Playtime'), --- 30,34 ---- class List (gtk.ScrolledWindow): __properties = aptk.misc.WidgetProperties ([ ! ('*.list.columns', ('current', 'playtime', 'track', 'title', 'album', 'artist', 'year', 'genre')), ('*.list.playtime.label', 'Playtime'), *************** *** 41,44 **** --- 41,46 ---- ('*.list.comment.label', 'Comment'), ('*.list.filename.label', 'Filename'), + ('*.list.current.label', ''), + ('*.list.mark.label', '-->'), ('*.list.*.file', None), ('*.list.*.alignment', 0.5), *************** *** 46,54 **** ]) __columns = ['year', 'track', 'title', 'album', 'artist', 'playtime', 'genre', 'filename', 'comment'] ! __types = (gobject.TYPE_STRING,) * len (__columns) __COLUMN_YEAR = __columns.index ('year') __COLUMN_TRACK = __columns.index ('track') --- 48,61 ---- ]) + # Names of the first columns __columns = ['year', 'track', 'title', 'album', 'artist', 'playtime', 'genre', 'filename', 'comment'] ! # Types of the first columns ! __types = (gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_STRING, ! gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_STRING, ! gobject.TYPE_STRING) + # Numbers for columns __COLUMN_YEAR = __columns.index ('year') __COLUMN_TRACK = __columns.index ('track') *************** *** 60,64 **** __COLUMN_FILENAME = __columns.index ('filename') __COLUMN_COMMENT = __columns.index ('comment') ! def __init__ (self, prop = None, prefix = ""): """Initializer.""" --- 67,76 ---- __COLUMN_FILENAME = __columns.index ('filename') __COLUMN_COMMENT = __columns.index ('comment') ! __COLUMN_CURRENT = len (__columns) ! ! # Blank pixbuf ! __blank_pixbuf = gdk.Pixbuf (gdk.COLORSPACE_RGB, 1, 8, 1, 1) ! __blank_pixbuf.fill (0) ! def __init__ (self, prop = None, prefix = ""): """Initializer.""" *************** *** 79,84 **** self.__charset = charset # Create list model ! self.__store = gtk.ListStore (*self.__types) # Create tree view --- 91,107 ---- self.__charset = charset + # Get mark property + mark_file = prop.get_value (prefix + ".mark.file") + if mark_file: + self.__mark_pixbuf = gdk.pixbuf_new_from_file (mark_file) + current_column_type = gobject.TYPE_OBJECT + else: + self.__mark_pixbuf = None + self.__mark_label = prop.get_value (prefix + ".mark.label") + current_column_type = gobject.TYPE_STRING + self.__marked_path = None + # Create list model ! self.__store = gtk.ListStore (*(self.__types + (current_column_type,))) # Create tree view *************** *** 86,106 **** self.add (self.__treeview) # Append columns ! for name in columns: # Create renderer ! renderer = gtk.CellRendererText () ! # Create column label = prop.get_value ("%s.%s.label" % (prefix, name)) file = prop.get_value ("%s.%s.file" % (prefix, name)) alignment = prop.get_value ("%s.%s.alignment" % (prefix, name)) ! if file: label = None ! column = gtk.TreeViewColumn (label, renderer, text = self.__columns.index (name)) column.set_resizable (gtk.TRUE) column.set_alignment (alignment) if file: image = gtk.Image () --- 109,151 ---- self.add (self.__treeview) + # Setup selection type + selection = self.__treeview.get_selection () + selection.set_mode (gtk.SELECTION_MULTIPLE) + # Append columns ! for name in columns: # Create renderer ! if name == "current": ! if mark_file: ! renderer = gtk.CellRendererPixbuf () ! column_properties = { ! 'pixbuf' : self.__COLUMN_CURRENT ! } ! else: ! renderer = gtk.CellRendererText () ! column_properties = { ! 'text' : self.__COLUMN_CURRENT ! } ! else: ! renderer = gtk.CellRendererText () ! column_properties = { ! 'text' : self.__columns.index (name) ! } ! # Settings label = prop.get_value ("%s.%s.label" % (prefix, name)) file = prop.get_value ("%s.%s.file" % (prefix, name)) alignment = prop.get_value ("%s.%s.alignment" % (prefix, name)) ! ! # Create column if file: label = None ! column = gtk.TreeViewColumn (label, renderer, **column_properties) column.set_resizable (gtk.TRUE) column.set_alignment (alignment) + column.set_reorderable (gtk.TRUE) + # Set image title if file is specified if file: image = gtk.Image () *************** *** 131,134 **** --- 176,201 ---- self.__COLUMN_FILENAME, filename.decode (self.__charset)) + def get_treeview (self): + """Return list TreeView object.""" + + return self.__treeview + + def mark_row (self, row): + """Mark row by its number.""" + + # Blank old marked row + if self.__marked_path: + iter = self.__store.get_iter (self.__marked_path) + value = self.__mark_pixbuf and self.__blank_pixbuf or '' + self.__store.set (iter, self.__COLUMN_CURRENT, value) + + # Create value to mark new row + value = self.__mark_pixbuf or self.__mark_label + + # Set + self.__marked_path = (row, ) + iter = self.__store.get_iter (self.__marked_path) + self.__store.set (iter, self.__COLUMN_CURRENT, value) + # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # class PlaylistWindow (gtk.Window): *************** *** 156,159 **** --- 223,227 ---- # Connect signals self.connect ("destroy", self.__gtkcb_destroy) + self.__list.get_treeview ().connect ("row-activated", self.__gtkcb_list_row_activated) def cb_insert (self, items, pos): *************** *** 172,175 **** --- 240,255 ---- filename = item.filename) pos += 1 + + def cb_set_current (self, row): + """Alsaplayer's callback.""" + + self.__list.mark_row (row-1) + + def __gtkcb_list_row_activated (self, tree, path, column): + """Handler for a row activated signal.""" + + gdk.threads_leave () + self.__pl.play (path [0] + 1) + gdk.threads_enter () def __gtkcb_destroy (self, widget): |
From: <sj...@us...> - 2002-07-23 09:03:27
|
Update of /cvsroot/ap-python/python/examples/aptk In directory usw-pr-cvs1:/tmp/cvs-serv797 Modified Files: Makefile.am panel.py playlist.py Added Files: playlist.xpm Log Message: Add playlist support in panel example. --- NEW FILE: playlist.xpm --- /* XPM */ static char * playlist_xpm[] = { "18 18 12 1", " c None", ". c #000000", "+ c #CBCBFF", "@ c #980098", "# c #CB98FF", "$ c #FF9898", "% c #FF3300", "& c #FF9800", "* c #FFCB66", "= c #E68600", "- c #FFCB00", "; c #A0A0A0", " ", " . ", " .+@. ", " .+#+#@. ", " .+++#+##@. ", " .+++#+#####@. ", " .+++++#+#####. ", " .@++++#+#####. ", " ...@+++#+###. ", " ..$%.@#+###.&. ", " .*.$$%.@+#.&%.. ", " =*.$$&%..%.. ", " .**.$$&%.=--. ", " =**.&.=---=.. ", " .**-.--=.. ", " =**=..; ", " ... ", " "}; Index: Makefile.am =================================================================== RCS file: /cvsroot/ap-python/python/examples/aptk/Makefile.am,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Makefile.am 19 Jul 2002 07:36:08 -0000 1.5 --- Makefile.am 23 Jul 2002 09:03:25 -0000 1.6 *************** *** 2,4 **** pause.xpm play.xpm prev.xpm r_pan.xpm r_play.xpm stop.xpm panel.py\ play-sm.xpm stop-sm.xpm prev-sm.xpm next-sm.xpm playlist.py current_play.xpm\ ! playtime.xpm track.xpm --- 2,4 ---- pause.xpm play.xpm prev.xpm r_pan.xpm r_play.xpm stop.xpm panel.py\ play-sm.xpm stop-sm.xpm prev-sm.xpm next-sm.xpm playlist.py current_play.xpm\ ! playtime.xpm track.xpm playlist.xpm Index: panel.py =================================================================== RCS file: /cvsroot/ap-python/python/examples/aptk/panel.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** panel.py 22 Jul 2002 16:26:28 -0000 1.6 --- panel.py 23 Jul 2002 09:03:25 -0000 1.7 *************** *** 35,38 **** --- 35,61 ---- pl = alsaplayer.get_playlist () + # Properties + properties = aptk.misc.WidgetProperties ([ + ('.tagsinfo.format', '%a - %t (%y - %l)'), + ('.control.play.button.file', 'play-sm.xpm'), + ('.control.next.button.file', 'next-sm.xpm'), + ('.control.stop.button.file', 'stop-sm.xpm'), + ('.control.prev.button.file', 'prev-sm.xpm'), + ('.control.playlist.button.file', 'playlist.xpm'), + ('*.button.relief', gtk.RELIEF_NONE), + ('.speed.backward.button.file', 'r_play.xpm'), + ('.speed.pause.button.file', 'pause.xpm'), + ('.speed.forward.button.file', 'f_play.xpm'), + ('.pan.left.button.file', 'l_pan.xpm'), + ('.pan.center.button.file', 'c_pan.xpm'), + ('.pan.right.button.file', 'r_pan.xpm'), + ('.control.playlist.list.columns', ('playtime', 'track', 'title', + 'album', 'artist', 'year', + 'genre', 'filename')), + ('.control.playlist.list.playtime.file', 'playtime.xpm'), + ('.control.playlist.list.track.file', 'track.xpm') + ]) + + # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # Main window win = gtk.Window () *************** *** 48,66 **** win.set_type_hint ("toolbar") ! # Properties ! properties = aptk.misc.WidgetProperties ([ ! ('.tagsinfo.format', '%a - %t (%y - %l)'), ! ('.control.play.button.file', 'play-sm.xpm'), ! ('.control.next.button.file', 'next-sm.xpm'), ! ('.control.stop.button.file', 'stop-sm.xpm'), ! ('.control.prev.button.file', 'prev-sm.xpm'), ! ('.*.*.button.relief', gtk.RELIEF_NONE), ! ('.speed.backward.button.file', 'r_play.xpm'), ! ('.speed.pause.button.file', 'pause.xpm'), ! ('.speed.forward.button.file', 'f_play.xpm'), ! ('.pan.left.button.file', 'l_pan.xpm'), ! ('.pan.center.button.file', 'c_pan.xpm'), ! ('.pan.right.button.file', 'r_pan.xpm') ! ]) ########################################################################## --- 71,90 ---- win.set_type_hint ("toolbar") ! # Create base widgets (always showing) ! hbox = gtk.HBox () ! win.add (hbox) ! ! control = aptk.control.HControl (pl, properties) ! ! shadow_type = gtk.SHADOW_OUT ! control_frame = gtk.Frame () ! control_frame.set_shadow_type (shadow_type) ! ! hbox.pack_start (control_frame, expand = gtk.FALSE) ! control_frame.add (control) ! ! control.show () ! control_frame.show () ! hbox.show () ########################################################################## *************** *** 74,78 **** # - - - - - APTK widgets - control = aptk.control.HControl (pl, properties) tagslabel = aptk.info.TagsLabel (pl, properties) --- 98,101 ---- *************** *** 81,109 **** # - - - - - Frames - control_frame = gtk.Frame () status_frame = gtk.Frame () - shadow_type = gtk.SHADOW_OUT - control_frame.set_shadow_type (shadow_type) status_frame.set_shadow_type (shadow_type) - self.pack_start (control_frame, expand = gtk.FALSE) self.pack_start (tagslabel, expand = gtk.TRUE) self.pack_end (status_frame, expand = gtk.FALSE) # - - - - pack to frames - control_frame.add (control) status_frame.add (status) # - - - - Show widgets - control.show () tagslabel.show () status.show () - control_frame.show () status_frame.show () - # Remember - self.control_widget = control - ############################################################################## class ControlPage (gtk.HBox): --- 104,122 ---- *************** *** 115,119 **** # - - - - - aptk widgets - control = aptk.control.HControl (pl, properties) position = aptk.position.HScale (pl) time_label = aptk.info.TimeLabel (pl, position) --- 128,131 ---- *************** *** 123,127 **** # - - - - Frames - control_frame = gtk.Frame () position_frame = gtk.Frame () speed_frame = gtk.Frame () --- 135,138 ---- *************** *** 129,134 **** volume_frame = gtk.Frame () - shadow_type = gtk.SHADOW_OUT - control_frame.set_shadow_type (shadow_type) position_frame.set_shadow_type (shadow_type) speed_frame.set_shadow_type (shadow_type) --- 140,143 ---- *************** *** 136,140 **** volume_frame.set_shadow_type (shadow_type) - self.pack_start (control_frame, expand = gtk.FALSE) self.add (position_frame) self.add (speed_frame) --- 145,148 ---- *************** *** 143,150 **** # - - - - pack to frames - control_hbox = gtk.HBox () - control_hbox.add (control) - control_frame.add (control_hbox) - position_hbox = gtk.HBox () position_hbox.set_spacing (2) --- 151,154 ---- *************** *** 158,162 **** # - - - - Show all these widgets - control.show () position.show () time_label.show () --- 162,165 ---- *************** *** 164,178 **** pan.show () volume.show () - control_frame.show () position_frame.show () speed_frame.show () pan_frame.show () volume_frame.show () - control_hbox.show () position_hbox.show () - # Remember - self.control_widget = control - ########################################################################### # Create two pages --- 167,176 ---- *************** *** 188,192 **** timeout_id = 0 newmode = 1 ! win.add (info_page) ########################################################## --- 186,190 ---- timeout_id = 0 newmode = 1 ! hbox.add (info_page) ########################################################## *************** *** 204,211 **** # Check if we aren't in control widget - w = mode and info_page or control_page ! alloc = w.control_widget.get_allocation () ! x, y = w.control_widget.get_pointer () if x < 0 or x >= alloc.width or y < 0 or y >= alloc.height: --- 202,208 ---- # Check if we aren't in control widget ! alloc = control.get_allocation () ! x, y = control.get_pointer () if x < 0 or x >= alloc.width or y < 0 or y >= alloc.height: *************** *** 222,230 **** if newmode == 0: ! win.remove (info_page) ! win.add (control_page) else: ! win.remove (control_page) ! win.add (info_page) gdk.threads_leave () --- 219,227 ---- if newmode == 0: ! hbox.remove (info_page) ! hbox.add (control_page) else: ! hbox.remove (control_page) ! hbox.add (info_page) gdk.threads_leave () Index: playlist.py =================================================================== RCS file: /cvsroot/ap-python/python/examples/aptk/playlist.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** playlist.py 22 Jul 2002 16:26:28 -0000 1.5 --- playlist.py 23 Jul 2002 09:03:25 -0000 1.6 *************** *** 37,44 **** 'genre', 'filename')), ('.playlist.list.playtime.file', 'playtime.xpm'), ! ('.playlist.list.track.file', 'track.xpm'), ! ('.playlist.list.title.label', 'îÁÚ×ÁÎÉÅ ÐÅÓÎÉ'.decode ('koi8-r')), ! ('.playlist.list.album.label', 'áÌØÂÏÍ'.decode ('koi8-r')), ! ('.playlist.list.artist.label', 'éÓÐÏÌÎÉÔÅÌØ'.decode ('koi8-r')) ]) --- 37,41 ---- 'genre', 'filename')), ('.playlist.list.playtime.file', 'playtime.xpm'), ! ('.playlist.list.track.file', 'track.xpm') ]) |
From: <sj...@us...> - 2002-07-23 09:01:57
|
Update of /cvsroot/ap-python/python/aptk In directory usw-pr-cvs1:/tmp/cvs-serv334 Modified Files: control.py info.py misc.py Log Message: Add support for locale chars in info.TagsLabel. Add playlist button to control widget. Index: control.py =================================================================== RCS file: /cvsroot/ap-python/python/aptk/control.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** control.py 21 Jul 2002 18:15:43 -0000 1.6 --- control.py 23 Jul 2002 09:01:55 -0000 1.7 *************** *** 29,33 **** __license__ = "GNU" ! import aptk.misc, alsaplayer, gtk gdk = gtk.gdk --- 29,33 ---- __license__ = "GNU" ! import aptk, alsaplayer, gtk gdk = gtk.gdk *************** *** 145,148 **** --- 145,170 ---- # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # + class PlaylistButton (aptk.misc.Button): + """Playlist playback. This button does nothing. + To use it, just handle its 'clicked' signal for display/hide + playlist window. + """ + + # Defualt properties + __properties = aptk.misc.WidgetProperties ([ + ('*.playlist.button.label', 'Playlist') + ]) + + def __init__ (self, pl, prop = None, prefix = ""): + """Initializer.""" + + # Create new properties whth our defaults added + prop = prop and (prop + self.__properties) or self.__properties + prefix += ".playlist" + + # Call base contructor + aptk.misc.Button.__init__ (self, prop, prefix) + + # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # class _Box: """Internal.""" *************** *** 167,170 **** --- 189,201 ---- self.add (self.next_button) + self.playlist_button = PlaylistButton (pl, prop, prefix) + self.add (self.playlist_button) + self.playlist_button.connect ("clicked", self.__gtkcb_playlist_clicked) + + # Create playlist window + self.playlist_window = aptk.playlist.PlaylistWindow (pl, prop, prefix) + self.playlist_window_is_visible = 0 + self.playlist_window.connect ("delete-event", self.__gtkcb_playlist_delete_event) + # Show all these buttons self.prev_button.show () *************** *** 172,175 **** --- 203,225 ---- self.stop_button.show () self.next_button.show () + self.playlist_button.show () + + def __gtkcb_playlist_clicked (self, w): + """Playlist button click handler.""" + + if self.playlist_window_is_visible: + self.playlist_window.hide () + self.playlist_window_is_visible = 0 + else: + self.playlist_window.show () + self.playlist_window_is_visible = 1 + + def __gtkcb_playlist_delete_event (self, w, event): + """Playlist delete event handler.""" + + self.playlist_window.hide () + self.playlist_window_is_visible = 0 + + return 1 # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # Index: info.py =================================================================== RCS file: /cvsroot/ap-python/python/aptk/info.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** info.py 22 Jul 2002 16:26:27 -0000 1.8 --- info.py 23 Jul 2002 09:01:55 -0000 1.9 *************** *** 26,30 **** __license__ = "GNU" ! import aptk.misc, alsaplayer, gtk gdk = gtk.gdk --- 26,30 ---- __license__ = "GNU" ! import aptk.misc, alsaplayer, gtk, locale gdk = gtk.gdk *************** *** 178,188 **** # List of format tags __ch = { ! 't' : 'si.title', ! 'a' : 'si.artist', ! 'l' : 'si.album', 's' : 'si.stream_type', 'g' : 'si.genre', 'y' : 'si.year', ! 'c' : 'si.comment', 'n' : 'si.track', 'u' : 'si.status' --- 178,188 ---- # List of format tags __ch = { ! 't' : 'si.title.decode (charset)', ! 'a' : 'si.artist.decode (charset)', ! 'l' : 'si.album.decode (charset)', 's' : 'si.stream_type', 'g' : 'si.genre', 'y' : 'si.year', ! 'c' : 'si.comment.decode (charset)', 'n' : 'si.track', 'u' : 'si.status' *************** *** 191,195 **** # Defualt properties __properties = aptk.misc.WidgetProperties ([ ! ('*.tagsinfo.format', '%a - %t') ]) --- 191,196 ---- # Defualt properties __properties = aptk.misc.WidgetProperties ([ ! ('*.tagsinfo.format', '%a - %t'), ! ('*.tagsinfo.charset', None) ]) *************** *** 207,210 **** --- 208,215 ---- # Get values fmt = prop.get_value (prefix + ".format") + charset = prop.get_value (prefix + ".charset") + if not charset: + charset = locale.getlocale ()[1] + self.__charset = charset # Connect gtk signals *************** *** 239,242 **** --- 244,248 ---- # Prepare locals for dynamic code si = self.__cp.get_stream_info () + charset = self.__charset # Get values Index: misc.py =================================================================== RCS file: /cvsroot/ap-python/python/aptk/misc.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** misc.py 23 Jul 2002 07:23:07 -0000 1.4 --- misc.py 23 Jul 2002 09:01:55 -0000 1.5 *************** *** 49,53 **** key = key.replace ("*", "MiU2hLo4SpI5GN999UeSED") key = re.escape (key) ! key = "^" + key.replace ("MiU2hLo4SpI5GN999UeSED", "[a-zA-Z]*") + "$" return re.compile (key) --- 49,53 ---- key = key.replace ("*", "MiU2hLo4SpI5GN999UeSED") key = re.escape (key) ! key = "^" + key.replace ("MiU2hLo4SpI5GN999UeSED", ".*") + "$" return re.compile (key) *************** *** 67,71 **** if pattern.match (key): return value ! raise AttributeError, "key is not found" def __add__ (self, other): --- 67,71 ---- if pattern.match (key): return value ! raise AttributeError, "key '%s' is not found" % key def __add__ (self, other): |