ap-python-commits Mailing List for AlsaPlayer Python Interface (Page 3)
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-07-23 09:00:36
|
Update of /cvsroot/ap-python/python
In directory usw-pr-cvs1:/tmp/cvs-serv32525
Added Files:
TODO
Log Message:
Add TODO list.
--- NEW FILE: TODO ---
APTK:
Widgets shouldn't eat resources when they are not visible.
|
|
From: <sj...@us...> - 2002-07-23 07:23:12
|
Update of /cvsroot/ap-python/python/aptk
In directory usw-pr-cvs1:/tmp/cvs-serv31246
Modified Files:
misc.py
Log Message:
Make * means as [a-zA-Z] in WidgetProperties.
Index: misc.py
===================================================================
RCS file: /cvsroot/ap-python/python/aptk/misc.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** misc.py 21 Jul 2002 18:15:43 -0000 1.3
--- misc.py 23 Jul 2002 07:23:07 -0000 1.4
***************
*** 49,53 ****
key = key.replace ("*", "MiU2hLo4SpI5GN999UeSED")
key = re.escape (key)
! key = "^" + key.replace ("MiU2hLo4SpI5GN999UeSED", ".*") + "$"
return re.compile (key)
--- 49,53 ----
key = key.replace ("*", "MiU2hLo4SpI5GN999UeSED")
key = re.escape (key)
! key = "^" + key.replace ("MiU2hLo4SpI5GN999UeSED", "[a-zA-Z]*") + "$"
return re.compile (key)
|
|
From: <sj...@us...> - 2002-07-22 16:27:09
|
Update of /cvsroot/ap-python/python/aptk In directory usw-pr-cvs1:/tmp/cvs-serv9621/aptk Modified Files: ChangeLog Log Message: ChangeLog updated. Index: ChangeLog =================================================================== RCS file: /cvsroot/ap-python/python/aptk/ChangeLog,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** ChangeLog 21 Jul 2002 18:16:41 -0000 1.13 --- ChangeLog 22 Jul 2002 16:27:06 -0000 1.14 *************** *** 1,2 **** --- 1,6 ---- + 2002-07-22 16:26 Evgeny Chukreev <co...@ec...> + + * info.py, playlist.py: Rewrite playlist widget for gtk2.0 + 2002-07-21 18:15 Evgeny Chukreev <co...@ec...> |
|
From: <sj...@us...> - 2002-07-22 16:27:09
|
Update of /cvsroot/ap-python/python/examples/aptk In directory usw-pr-cvs1:/tmp/cvs-serv9621/examples/aptk Modified Files: ChangeLog Log Message: ChangeLog updated. Index: ChangeLog =================================================================== RCS file: /cvsroot/ap-python/python/examples/aptk/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 22 Jul 2002 16:27:06 -0000 1.12 *************** *** 1,2 **** --- 1,6 ---- + 2002-07-22 16:26 Evgeny Chukreev <co...@ec...> + + * panel.py, playlist.py: Rewrite playlist widget for gtk2.0 + 2002-07-21 18:15 Evgeny Chukreev <co...@ec...> |
|
From: <sj...@us...> - 2002-07-22 16:26:34
|
Update of /cvsroot/ap-python/python/aptk
In directory usw-pr-cvs1:/tmp/cvs-serv9288/aptk
Modified Files:
info.py playlist.py
Log Message:
Rewrite playlist widget for gtk2.0
Index: info.py
===================================================================
RCS file: /cvsroot/ap-python/python/aptk/info.py,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** info.py 21 Jul 2002 18:15:43 -0000 1.7
--- info.py 22 Jul 2002 16:26:27 -0000 1.8
***************
*** 191,195 ****
# Defualt properties
__properties = aptk.misc.WidgetProperties ([
! ('*.tagsinfo.format', '%t - %a')
])
--- 191,195 ----
# Defualt properties
__properties = aptk.misc.WidgetProperties ([
! ('*.tagsinfo.format', '%a - %t')
])
Index: playlist.py
===================================================================
RCS file: /cvsroot/ap-python/python/aptk/playlist.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** playlist.py 21 Jul 2002 18:15:43 -0000 1.5
--- playlist.py 22 Jul 2002 16:26:27 -0000 1.6
***************
*** 24,215 ****
__license__ = "GNU"
! import gtk
!
! ###########################################################################
! class SmartList (gtk.CList):
! def __init__ (self, columns):
! """Initializer."""
! # Remember
! self.columns = columns
!
! # Call base class init-er
! gtk.GtkCList.__init__ (self, len (columns), columns)
! def append (self, values):
! """Append values. Where 'value' variable is a dict of titles and associated values."""
!
! translated = [values [column] for column in self.column]
! gtk.GtkCList.append (self, translated)
! def insert (self, row, values):
! """Insert values in row. Where 'value' variable is a dict of titles and associated values."""
! translated = [values [column] for column in self.columns]
!
! gtk.GtkCList.insert (self, row, translated)
!
! def set_column_width (self, column, width):
! """Set width for column."""
!
! gtk.GtkCList.set_column_width (self, self.columns.index (column), width)
! def set_widthes (self, widthes):
! """Set width for columns."""
! for column in self.columns:
! if widthes.has_key (column):
! self.set_column_width (self.columns.index (column), widthes [column])
! def set_pixmap (self, r, column, pixmap, mask = None):
! """Set pixmap."""
! gtk.GtkCList.set_pixmap (self, r, self.columns.index (column), pixmap, mask)
! def set_text (self, r, column, text):
! """Set text."""
! gtk.GtkCList.set_text (self, r, self.columns.index (column), text)
! def set_cell (self, r, column, value):
! """Set cell value. Could be text or a tuple where the first element is a filename with xpm data."""
! if type (value) is type (''):
! # This is a text label
!
! self.set_text (r, column, value)
! else:
! # This is an xpm filename
!
! window = self.get_window ()
! if window is None:
! self.realize ()
! window = self.get_window ()
! # Allocate pixmap
! p, m = gtk.create_pixmap_from_xpm (window, None, value [0])
!
! self.set_pixmap (r, column, p, m)
! ###############################################################################
class PlaylistWindow (gtk.Window):
! properties = {
! 'playlist.list.columns' : ['current', 'playtime', 'track', 'title',
! 'album', 'artist', 'year', 'genre'],
! 'playlist.playtime.label' : 'Playtime',
! 'playlist.track.label' : 'Track',
! 'playlist.title.label' : 'Title',
! 'playlist.current.label' : 'Current',
! 'playlist.album.label' : 'Album',
! 'playlist.artist.label' : 'Artist',
! 'playlist.year.label' : 'Year',
! 'playlist.genre.label' : 'Genre',
! 'playlist.filename.label' : 'Filename',
! 'playlist.comment.label' : 'Comment',
! 'playlist.npmark.label' : '*',
! 'playlist.playtime.xpmfile' : None,
! 'playlist.track.xpmfile' : None,
! 'playlist.title.xpmfile' : None,
! 'playlist.current.xpmfile' : None,
! 'playlist.album.xpmfile' : None,
! 'playlist.artist.xpmfile' : None,
! 'playlist.year.xpmfile' : None,
! 'playlist.genre.xpmfile' : None,
! 'playlist.filename.xpmfile' : None,
! 'playlist.comment.xpmfile' : None,
! 'playlist.npmark.xpmfile' : None
! }
!
! def __init__ (self, pl, prop = None, strip = ""):
"""Initializer."""
- # Create strip string for this class
- this_strip = (strip and strip + ".") + 'playlist'
-
# Remember
! self.pl = pl
! self.current = None
! # Init base class
! gtk.GtkWindow.__init__ (self)
!
! # Vbox
! self.vbox = gtk.GtkVBox ()
! self.add (self.vbox)
! self.vbox.show ()
!
! # LIST - - - - - - - - - -- - - - - - - - - - - - - - - - - - - -
! # Scrolled window for list
! self.scrolled = gtk.GtkScrolledWindow ()
! self.vbox.add (self.scrolled)
! self.scrolled.show ()
! self.scrolled.set_policy (1, 0)
!
! # Create list
! self.list = SmartList (prop, this_strip)
! self.scrolled.add (self.list)
!
! self.list.set_titles (prop, this_strip)
! self.list.show ()
! self.list.column_titles_passive ()
! # Create mark for the current song
! # - -- - - - - - - - - - - - - - - - - -- - - - - - - - - - - - -
! # Register new playlist interface
! pl.register (self)
! # Setup callbacks
! self.list.connect ("select_row", self.gtkcb_select_row)
def cb_insert (self, items, pos):
! """Called by alsaplayer when new items arrived."""
- gtk.threads_enter ()
- self.list.freeze ()
-
for item in items:
! values = {'current' : '',
! 'title' : item.title,
! 'filename' : item.filename,
! 'artist' : item.artist,
! 'album' : item.album,
! 'genre' : item.genre,
! 'comment' : item.comment,
! 'track' : item.track,
! 'year' : item.year,
! 'playtime' : "%02u:%02u" % divmod (item.playtime, 60)}
!
! self.list.insert (pos, values)
!
pos += 1
-
- self.list.thaw ()
- gtk.threads_leave ()
-
- def cb_set_current (self, pos):
- """Called by alsaplayer when the playing song changed."""
! gtk.threads_enter ()
!
! if self.current != pos - 1:
! # Blank previous mark
! if self.current is not None:
! self.list.set_text (self.current, 'current', '')
!
! # Mark row
! self.current = pos - 1
! self.list.set_cell (self.current, 'current', self.current_mark)
! gtk.threads_leave ()
!
! def gtkcb_select_row (self, w, row, column, event):
! """Called by gtk, when the new row is selected."""
!
! if event.type == GDK._2BUTTON_PRESS:
! gtk.threads_leave ()
! self.pl.play (row + 1)
! gtk.threads_enter ()
--- 24,180 ----
__license__ = "GNU"
! import gtk, aptk, gobject, locale
! gdk = gtk.gdk
! # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
! class List (gtk.ScrolledWindow):
! __properties = aptk.misc.WidgetProperties ([
! ('*.list.columns', ('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.*.file', None),
! ('*.list.*.alignment', 0.5),
! ('*.list.charset', None)
! ])
! __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')
! __COLUMN_TITLE = __columns.index ('title')
! __COLUMN_ALBUM = __columns.index ('album')
! __COLUMN_ARTIST = __columns.index ('artist')
! __COLUMN_PLAYTIME = __columns.index ('playtime')
! __COLUMN_GENRE = __columns.index ('genre')
! __COLUMN_FILENAME = __columns.index ('filename')
! __COLUMN_COMMENT = __columns.index ('comment')
!
! def __init__ (self, prop = None, prefix = ""):
! """Initializer."""
! # Create new properties whth our defaults added
! prop = prop and (prop + self.__properties) or self.__properties
! prefix += '.list'
! # Init base class
! gtk.ScrolledWindow.__init__ (self)
! self.set_policy (gtk.POLICY_AUTOMATIC, gtk.POLICY_ALWAYS)
! # Get properties
! columns = prop.get_value (prefix + ".columns")
! charset = prop.get_value (prefix + ".charset")
! if not charset:
! charset = locale.getlocale ()[1]
! self.__charset = charset
! # Create list model
! self.__store = gtk.ListStore (*self.__types)
! # Create tree view
! self.__treeview = gtk.TreeView (self.__store)
! 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 ()
! image.set_from_file (file)
! column.set_widget (image)
! image.show ()
! # Append column
! self.__treeview.append_column (column)
! # Show these widgets
! self.__treeview.show ()
! def insert (self, pos, title, album, artist, track, playtime,
! year, genre, comment, filename):
! """Insert new values into this list."""
!
! iter = self.__store.insert (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))
!
! # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
class PlaylistWindow (gtk.Window):
! def __init__ (self, pl, prop = None, prefix = ""):
"""Initializer."""
# Remember
! self.__pl = pl
! # 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)
def cb_insert (self, items, pos):
! """Alsaplayer's callback."""
for item in items:
! self.__list.insert (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)
pos += 1
! def __gtkcb_destroy (self, widget):
! """Called on the destroy."""
! gdk.threads_leave ()
! self.__pl.unregister (self)
! gdk.threads_enter ()
|
|
From: <sj...@us...> - 2002-07-22 16:26:34
|
Update of /cvsroot/ap-python/python/examples/aptk
In directory usw-pr-cvs1:/tmp/cvs-serv9288/examples/aptk
Modified Files:
panel.py playlist.py
Log Message:
Rewrite playlist widget for gtk2.0
Index: panel.py
===================================================================
RCS file: /cvsroot/ap-python/python/examples/aptk/panel.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** panel.py 21 Jul 2002 18:15:43 -0000 1.5
--- panel.py 22 Jul 2002 16:26:28 -0000 1.6
***************
*** 46,53 ****
win.set_resizable (gtk.FALSE)
win.set_decorated (gtk.FALSE)
# Properties
properties = aptk.misc.WidgetProperties ([
! ('.tagsinfo.format', '%t - %a (%y - %l)'),
('.control.play.button.file', 'play-sm.xpm'),
('.control.next.button.file', 'next-sm.xpm'),
--- 46,54 ----
win.set_resizable (gtk.FALSE)
win.set_decorated (gtk.FALSE)
+ 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'),
Index: playlist.py
===================================================================
RCS file: /cvsroot/ap-python/python/examples/aptk/playlist.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** playlist.py 19 Jul 2002 18:04:56 -0000 1.4
--- playlist.py 22 Jul 2002 16:26:28 -0000 1.5
***************
*** 26,57 ****
import alsaplayer, aptk, gtk
! #####################################################################
! properties = {
! 'playlist.columns' : ['current', 'playtime', 'track', 'title',
! 'album', 'artist', 'year', 'genre'],
! 'playlist.title.playtime' : ("playtime.xpm",),
! 'playlist.title.track' : ("track.xpm",),
! 'playlist.title.title' : 'Title',
! 'playlist.title.current' : ' ',
! 'playlist.title.album' : 'Album',
! 'playlist.title.artist' : 'Artist',
! 'playlist.title.year' : 'Year',
! 'playlist.title.genre' : 'Genre',
! 'playlist.current.mark' : ("current_play.xpm",)
! }
#####################################################################
pl = alsaplayer.get_playlist ()
- cp = pl.get_coreplayer ()
-
- def delete_event (foo, bar):
- gtk.mainquit ();
win = aptk.playlist.PlaylistWindow (pl, properties)
! win.connect ("delete_event", delete_event)
win.show ()
! gtk.threads_enter ()
gtk.mainloop ()
! gtk.threads_leave ()
--- 26,54 ----
import alsaplayer, aptk, gtk
+ gdk = gtk.gdk
! # Init GDK threads
! gdk.threads_init ()
!
! # 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'),
! ('.playlist.list.title.label', 'îÁÚ×ÁÎÉÅ ÐÅÓÎÉ'.decode ('koi8-r')),
! ('.playlist.list.album.label', 'áÌØÂÏÍ'.decode ('koi8-r')),
! ('.playlist.list.artist.label', 'éÓÐÏÌÎÉÔÅÌØ'.decode ('koi8-r'))
! ])
#####################################################################
pl = alsaplayer.get_playlist ()
win = aptk.playlist.PlaylistWindow (pl, properties)
! win.connect ("destroy", lambda win: gtk.main_quit ())
win.show ()
! gdk.threads_enter ()
gtk.mainloop ()
! gdk.threads_leave ()
|
|
From: <sj...@us...> - 2002-07-21 18:16:46
|
Update of /cvsroot/ap-python/python/docs In directory usw-pr-cvs1:/tmp/cvs-serv26510/docs Modified Files: ChangeLog Log Message: ChangeLog updated. Index: ChangeLog =================================================================== RCS file: /cvsroot/ap-python/python/docs/ChangeLog,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** ChangeLog 14 May 2002 15:14:47 -0000 1.10 --- ChangeLog 21 Jul 2002 18:16:41 -0000 1.11 *************** *** 1,2 **** --- 1,6 ---- + 2002-07-21 10:28 Evgeny Chukreev <co...@ec...> + + * Makefile.am: Fix make clean target. + 2002-05-14 15:12 Evgeny Chukreev <co...@ec...> |
|
From: <sj...@us...> - 2002-07-21 18:16:45
|
Update of /cvsroot/ap-python/python/examples/aptk In directory usw-pr-cvs1:/tmp/cvs-serv26510/examples/aptk Modified Files: ChangeLog Log Message: ChangeLog updated. Index: ChangeLog =================================================================== RCS file: /cvsroot/ap-python/python/examples/aptk/ChangeLog,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** ChangeLog 19 Jul 2002 18:06:14 -0000 1.10 --- ChangeLog 21 Jul 2002 18:16:41 -0000 1.11 *************** *** 1,2 **** --- 1,6 ---- + 2002-07-21 18:15 Evgeny Chukreev <co...@ec...> + + * gtkplayer.py, panel.py: Rewrite APTK to use it with PyGTK2! + 2002-07-19 18:04 Evgeny Chukreev <co...@ec...> |
|
From: <sj...@us...> - 2002-07-21 18:16:45
|
Update of /cvsroot/ap-python/python In directory usw-pr-cvs1:/tmp/cvs-serv26510 Modified Files: ChangeLog Log Message: ChangeLog updated. Index: ChangeLog =================================================================== RCS file: /cvsroot/ap-python/python/ChangeLog,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** ChangeLog 18 May 2002 14:47:15 -0000 1.25 --- ChangeLog 21 Jul 2002 18:16:41 -0000 1.26 *************** *** 1,2 **** --- 1,6 ---- + 2002-07-21 18:15 Evgeny Chukreev <co...@ec...> + + * configure.ac: Rewrite APTK to use it with PyGTK2! + 2002-05-18 07:42 Evgeny Chukreev <co...@ec...> |
|
From: <sj...@us...> - 2002-07-21 18:16:45
|
Update of /cvsroot/ap-python/python/aptk In directory usw-pr-cvs1:/tmp/cvs-serv26510/aptk Modified Files: ChangeLog Log Message: ChangeLog updated. Index: ChangeLog =================================================================== RCS file: /cvsroot/ap-python/python/aptk/ChangeLog,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** ChangeLog 19 Jul 2002 18:06:14 -0000 1.12 --- ChangeLog 21 Jul 2002 18:16:41 -0000 1.13 *************** *** 1,2 **** --- 1,8 ---- + 2002-07-21 18:15 Evgeny Chukreev <co...@ec...> + + * Makefile.am, control.py, info.py, misc.py, pan.py, playlist.py, + position.py, speed.py, volume.py: Rewrite APTK to use it with + PyGTK2! + 2002-07-19 18:04 Evgeny Chukreev <co...@ec...> |
|
From: <sj...@us...> - 2002-07-21 18:16:45
|
Update of /cvsroot/ap-python/python/src In directory usw-pr-cvs1:/tmp/cvs-serv26510/src Modified Files: ChangeLog Log Message: ChangeLog updated. Index: ChangeLog =================================================================== RCS file: /cvsroot/ap-python/python/src/ChangeLog,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** ChangeLog 21 Jul 2002 09:34:24 -0000 1.10 --- ChangeLog 21 Jul 2002 18:16:41 -0000 1.11 *************** *** 1,2 **** --- 1,6 ---- + 2002-07-21 10:27 Evgeny Chukreev <co...@ec...> + + * pydefs.h: Fix warnings for compilation with cpp-3.1 + 2002-07-21 09:27 Evgeny Chukreev <co...@ec...> |
Update of /cvsroot/ap-python/python/aptk
In directory usw-pr-cvs1:/tmp/cvs-serv26166/aptk
Modified Files:
Makefile.am control.py info.py misc.py pan.py playlist.py
position.py speed.py volume.py
Log Message:
Rewrite APTK to use it with PyGTK2!
Index: Makefile.am
===================================================================
RCS file: /cvsroot/ap-python/python/aptk/Makefile.am,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** Makefile.am 16 Jul 2002 17:08:45 -0000 1.3
--- Makefile.am 21 Jul 2002 18:15:43 -0000 1.4
***************
*** 4,8 ****
if ENABLE_APTK
aptk_DATA = $(EXTRA_DIST) control.pyc info.pyc __init__.pyc misc.pyc\
! pan.pyc position.pyc speed.pyc volume.pyc playlist.py
aptkdir = @PY_MOD_DIR@/aptk
endif
--- 4,8 ----
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
Index: control.py
===================================================================
RCS file: /cvsroot/ap-python/python/aptk/control.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** control.py 19 Jul 2002 18:04:13 -0000 1.5
--- control.py 21 Jul 2002 18:15:43 -0000 1.6
***************
*** 30,140 ****
import aptk.misc, alsaplayer, gtk
! # - - - - - - - - - - - - - - - Buttons - - - - - - - - -
class PlayButton (aptk.misc.Button):
"""Start playback.
"""
! def __init__ (self, pl, prop = None, strip = ""):
"""Initializer."""
! # Create strip string for this class
! this_strip = (strip and strip + ".") + 'play'
# Call base contructor
! aptk.misc.Button.__init__ (self, prop, this_strip)
! self.connect ("clicked", self.__cb_clicked)
self.__pl = pl
! def __cb_clicked (self, w):
! gtk.threads_leave ()
! self.__pl.play (self._pl.get_current ())
! gtk.threads_enter ()
class NextButton (aptk.misc.Button):
"""Move to next song.
"""
!
! def __init__ (self, pl, prop = None, strip = ""):
"""Initializer."""
! # Create strip string for this class
! this_strip = (strip and strip + ".") + 'next'
# Call base contructor
! aptk.misc.Button.__init__ (self, prop, this_strip)
! self.connect ("clicked", self.__cb_clicked)
self.__pl = pl
! def __cb_clicked (self, w):
! gtk.threads_leave ()
self.__pl.next ()
! gtk.threads_enter ()
class PrevButton (aptk.misc.Button):
"""Move to previous song.
"""
! def __init__ (self, pl, prop = None, strip = ""):
"""Initializer."""
! # Create strip string for this class
! this_strip = (strip and strip + ".") + 'prev'
# Call base contructor
! aptk.misc.Button.__init__ (self, prop, this_strip)
! self.connect ("clicked", self.__cb_clicked)
self.__pl = pl
! def __cb_clicked (self, w):
! gtk.threads_leave ()
self.__pl.prev ()
! gtk.threads_enter ()
class StopButton (aptk.misc.Button):
"""Stop playback.
"""
!
! def __init__ (self, pl, prop = None, strip = ""):
"""Initializer."""
! # Create strip string for this class
! this_strip = (strip and strip + ".") + 'stop'
# Call base contructor
! aptk.misc.Button.__init__ (self, prop, this_strip)
! self.connect ("clicked", self.__cb_clicked)
self.__pl = pl
! def __cb_clicked (self, w):
! gtk.threads_leave ()
! self._pl.stop ()
! gtk.threads_enter ()
! # - - - - - - - - - - - - - - - Boxes - - - - - - - - - -
class _Box:
"""Internal."""
! def __init__ (self, pl, prop = None, strip = ""):
"""Initializeer."""
! # Create strip string for this class
! this_strip = (strip and strip + ".") + 'control'
# Create buttons
! self.prev_button = PrevButton (pl, prop, this_strip)
self.add (self.prev_button)
! self.play_button = PlayButton (pl, prop, this_strip)
self.add (self.play_button)
! self.stop_button = StopButton (pl, prop, this_strip)
self.add (self.stop_button)
! self.next_button = NextButton (pl, prop, this_strip)
self.add (self.next_button)
--- 30,168 ----
import aptk.misc, alsaplayer, gtk
+ gdk = gtk.gdk
! # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
class PlayButton (aptk.misc.Button):
"""Start playback.
"""
! # Defualt properties
! __properties = aptk.misc.WidgetProperties ([
! ('*.play.button.label', 'Play')
! ])
!
! 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 += ".play"
# Call base contructor
! aptk.misc.Button.__init__ (self, prop, prefix)
! self.connect ("clicked", self.__gtkcb_clicked)
self.__pl = pl
! def __gtkcb_clicked (self, w):
! gdk.threads_leave ()
! self.__pl.play (self.__pl.get_current ())
! gdk.threads_enter ()
+ # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
class NextButton (aptk.misc.Button):
"""Move to next song.
"""
!
! # Defualt properties
! __properties = aptk.misc.WidgetProperties ([
! ('*.next.button.label', 'Next')
! ])
!
! 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 += '.next'
# Call base contructor
! aptk.misc.Button.__init__ (self, prop, prefix)
! self.connect ("clicked", self.__gtkcb_clicked)
self.__pl = pl
! def __gtkcb_clicked (self, w):
! gdk.threads_leave ()
self.__pl.next ()
! gdk.threads_enter ()
+ # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
class PrevButton (aptk.misc.Button):
"""Move to previous song.
"""
! # Defualt properties
! __properties = aptk.misc.WidgetProperties ([
! ('*.prev.button.label', 'Prev')
! ])
!
! 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 += '.prev'
# Call base contructor
! aptk.misc.Button.__init__ (self, prop, prefix)
! self.connect ("clicked", self.__gtkcb_clicked)
self.__pl = pl
! def __gtkcb_clicked (self, w):
! gdk.threads_leave ()
self.__pl.prev ()
! gdk.threads_enter ()
+ # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
class StopButton (aptk.misc.Button):
"""Stop playback.
"""
!
! # Defualt properties
! __properties = aptk.misc.WidgetProperties ([
! ('*.stop.button.label', 'Stop')
! ])
!
! 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 += ".stop"
# Call base contructor
! aptk.misc.Button.__init__ (self, prop, prefix)
! self.connect ("clicked", self.__gtkcb_clicked)
self.__pl = pl
! def __gtkcb_clicked (self, w):
! gdk.threads_leave ()
! self.__pl.stop ()
! gdk.threads_enter ()
! # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
class _Box:
"""Internal."""
! def __init__ (self, pl, prop = None, prefix = ""):
"""Initializeer."""
! # Create new properties whth our defaults added
! prefix += ".control"
# Create buttons
! self.prev_button = PrevButton (pl, prop, prefix)
self.add (self.prev_button)
! self.play_button = PlayButton (pl, prop, prefix)
self.add (self.play_button)
! self.stop_button = StopButton (pl, prop, prefix)
self.add (self.stop_button)
! self.next_button = NextButton (pl, prop, prefix)
self.add (self.next_button)
***************
*** 145,149 ****
self.next_button.show ()
! class HBox (gtk.GtkHBox, _Box):
"""Horizontal box of all control buttons.
This widget provided to create typical control panel.
--- 173,178 ----
self.next_button.show ()
! # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
! class HBox (gtk.HBox, _Box):
"""Horizontal box of all control buttons.
This widget provided to create typical control panel.
***************
*** 151,175 ****
"""
! def __init__ (self, pl, prop = None, strip = ""):
"""Initialize the HBox.
"""
! gtk.GtkHBox.__init__ (self)
! _Box.__init__ (self, pl, prop, strip)
! class VBox (gtk.GtkVBox, _Box):
"""Vertical box of all control buttons.
This widget provided to create typical control panel.
"""
! def __init__ (self, pl, prop = None, strip = ""):
"""Initialize the VBox.
"""
! gtk.GtkVBox.__init__ (self)
_Box.__init__ (self, pl, prop, relief = relief)
!
! # - - - - - - - - - - - - Final (High level) Widgets
HControl = HBox
VControl = VBox
--- 180,204 ----
"""
! def __init__ (self, pl, prop = None, prefix = ""):
"""Initialize the HBox.
"""
! gtk.HBox.__init__ (self)
! _Box.__init__ (self, pl, prop, prefix)
! # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
! class VBox (gtk.VBox, _Box):
"""Vertical box of all control buttons.
This widget provided to create typical control panel.
"""
! def __init__ (self, pl, prop = None, prefix = ""):
"""Initialize the VBox.
"""
! gtk.VBox.__init__ (self)
_Box.__init__ (self, pl, prop, relief = relief)
! # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
HControl = HBox
VControl = VBox
Index: info.py
===================================================================
RCS file: /cvsroot/ap-python/python/aptk/info.py,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** info.py 19 Jul 2002 18:04:13 -0000 1.6
--- info.py 21 Jul 2002 18:15:43 -0000 1.7
***************
*** 26,59 ****
__license__ = "GNU"
! import aptk.misc, alsaplayer, gtk, GTK
! class StreamTypeLabel (gtk.GtkLabel):
! def __init__ (self, cp):
! gtk.GtkLabel.__init__ (self, "")
! self.__cp = cp
# Start timeout which will update label
! self.__timeout = gtk.timeout_add (200, self.__cb_timeout)
! def __cb_timeout (self):
s = self.__cp.get_stream_info ().stream_type
! gtk.threads_enter ()
self.set_text (s)
! gtk.threads_leave ()
return 1
! class TimeLabel (gtk.GtkLabel):
! def __init__ (self, cp, position = None):
! gtk.GtkLabel.__init__ (self, "")
! self.__cp = cp
self.__dragging = 0
! # Start timeout which will update label
! self.__timeout = gtk.timeout_add (500, self.__cb_timeout)
# Show scale position when it is in use
--- 26,77 ----
__license__ = "GNU"
! import aptk.misc, alsaplayer, gtk
! gdk = gtk.gdk
! # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
! class StreamTypeLabel (gtk.Label):
! def __init__ (self, pl):
! """Initializer."""
!
! # Init base class
! gtk.Label.__init__ (self, "")
! # Remember for use in the timeout callback
! self.__cp = pl.get_coreplayer ()
# Start timeout which will update label
! self.__timeout = gtk.timeout_add (200, self.__gtkcb_timeout)
! def __gtkcb_timeout (self):
! """Callback for gtk timeout. Use to update label."""
!
! # Get current stream type
s = self.__cp.get_stream_info ().stream_type
! # Update label
! gdk.threads_enter ()
self.set_text (s)
! gdk.threads_leave ()
return 1
! # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
! class TimeLabel (gtk.Label):
! def __init__ (self, pl, position = None):
! """Initializer."""
!
! # Init base class
! gtk.Label.__init__ (self, "")
! # Remember for use in callback
! self.__cp = pl.get_coreplayer ()
self.__dragging = 0
! # Register this instance as the notifier for coreplayer
! self.__cp.register_notifier (self)
!
! # Register gtk signals
! self.connect ("destroy", self.__gtkcb_destroy)
# Show scale position when it is in use
***************
*** 61,71 ****
self.__adj = position.get_adjustment ()
! position.connect ("button_press_event", self.__press_event)
! position.connect ("button_release_event", self.__release_event)
! position.connect ("motion_notify_event", self.__motion_event)
- def __cb_timeout (self):
# Don't show current time if user is dargging position scale
! if self.__dragging: return 1
status = self.__cp.get_stream_info ().status
--- 79,91 ----
self.__adj = position.get_adjustment ()
! position.connect ("button_press_event", self.__gtkcb_press_event)
! position.connect ("button_release_event", self.__gtkcb_release_event)
! position.connect ("motion_notify_event", self.__gtkcb_motion_event)
!
! def cb_position_notify (self, pos=0):
! """Callback handler for position changed alsaplayer signal."""
# Don't show current time if user is dargging position scale
! if self.__dragging: return
status = self.__cp.get_stream_info ().status
***************
*** 73,79 ****
if status:
# Show status
! gtk.threads_enter ()
self.set_text (status)
! gtk.threads_leave ()
else:
# Show time
--- 93,99 ----
if status:
# Show status
! gdk.threads_enter ()
self.set_text (status)
! gdk.threads_leave ()
else:
# Show time
***************
*** 87,106 ****
t_m, t_s = divmod (total, 60)
! gtk.threads_enter ()
self.set_text ("%02u:%02u/%02u:%02u" % (m, s, t_m, t_s))
! gtk.threads_leave ()
!
! return 1
! def __press_event (self, widget, event):
"""Button press event handler."""
self.__dragging = 1
! self.__motion_event (None, None)
! def __motion_event (self, widget, event):
"""Motion notify event handler."""
! gtk.threads_leave ()
played = self.__cp.get_current_time (self.__adj.value) / 100
--- 107,125 ----
t_m, t_s = divmod (total, 60)
! gdk.threads_enter ()
self.set_text ("%02u:%02u/%02u:%02u" % (m, s, t_m, t_s))
! gdk.threads_leave ()
! def __gtkcb_press_event (self, widget, event):
"""Button press event handler."""
self.__dragging = 1
! self.__gtkcb_motion_event (None, None)
! def __gtkcb_motion_event (self, widget, event):
"""Motion notify event handler."""
! # Calculate time based on a position adjustment value
! gdk.threads_leave ()
played = self.__cp.get_current_time (self.__adj.value) / 100
***************
*** 111,139 ****
t_m, t_s = divmod (total, 60)
! gtk.threads_enter ()
self.set_text ("%02u:%02u/%02u:%02u" % (m, s, t_m, t_s))
! def __release_event (self, widget, event):
"""Button release event handler."""
self.__dragging = 0
! gtk.threads_leave ()
! self.__cb_timeout ()
! gtk.threads_enter ()
! class FullStatusHBox (gtk.GtkHBox):
! def __init__ (self, cp, position = None):
! gtk.GtkHBox.__init__ (self)
! self.stream_type_label = StreamTypeLabel (cp)
! self.time_label = TimeLabel (cp, position)
! self.stream_type_label.set_justify (GTK.JUSTIFY_LEFT)
! self.time_label.set_justify (GTK.JUSTIFY_RIGHT)
! self.pack_start (self.stream_type_label, expand=GTK.FALSE)
! self.pack_end (self.time_label, expand=GTK.FALSE, fill=GTK.TRUE)
# Show these widgets
--- 130,172 ----
t_m, t_s = divmod (total, 60)
! gdk.threads_enter ()
+ # Update label
self.set_text ("%02u:%02u/%02u:%02u" % (m, s, t_m, t_s))
! def __gtkcb_release_event (self, widget, event):
"""Button release event handler."""
self.__dragging = 0
! # Dragging is done, so we should show now playing position
! gdk.threads_leave ()
! self.cb_position_notify ()
! gdk.threads_enter ()
! def __gtkcb_destroy (self, widget):
! """Callback handler for a destroy signal."""
!
! gdk.threads_leave ()
! self.__cp.unregister_notifier (self)
! gdk.threads_enter ()
! # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
! class FullStatusHBox (gtk.HBox):
! def __init__ (self, pl, position = None):
! """Initializer."""
! # Init base class
! gtk.HBox.__init__ (self)
! # Create Widgets
! self.stream_type_label = StreamTypeLabel (pl)
! self.time_label = TimeLabel (pl, position)
!
! self.stream_type_label.set_justify (gtk.JUSTIFY_LEFT)
! self.time_label.set_justify (gtk.JUSTIFY_RIGHT)
!
! self.pack_start (self.stream_type_label, expand = gtk.FALSE)
! self.pack_end (self.time_label, expand = gtk.FALSE, fill = gtk.TRUE)
# Show these widgets
***************
*** 141,152 ****
self.time_label.show ()
! #############################################################################
!
! class TagsLabel (gtk.GtkLabel):
! properties = {
! "format" : "%a - %t (%y - %l)"
! }
!
! ch = {
't' : 'si.title',
'a' : 'si.artist',
--- 174,181 ----
self.time_label.show ()
! # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
! class TagsLabel (gtk.Label):
! # List of format tags
! __ch = {
't' : 'si.title',
'a' : 'si.artist',
***************
*** 159,181 ****
'u' : 'si.status'
}
! def __init__ (self, cp, prop = None, strip = ""):
! """Create instance label which will show tags info accordance with format string.
"""
! # Create strip string for this class
! this_strip = (strip and strip + ".") + 'tagslabel'
! # Get properties
! format = aptk.misc.get_property (self.properties, prop, 'format', this_strip)
! gtk.GtkLabel.__init__ (self, "")
! self.connect ("destroy", self.__on_destroy)
# Remember
! self.__cp = cp
# Parse and create list of members which will compose values tuple
- fmt = format [:]
i = 0;
attrs = []
--- 188,218 ----
'u' : 'si.status'
}
+
+ # Defualt properties
+ __properties = aptk.misc.WidgetProperties ([
+ ('*.tagsinfo.format', '%t - %a')
+ ])
! def __init__ (self, pl, prop = None, prefix = ""):
! """Create label object which will show tags info accordance with format string.
"""
! # Init base class
! gtk.Label.__init__ (self, "")
! # Create new properties whth our defaults added
! prop = prop and (prop + self.__properties) or self.__properties
! prefix += ".tagsinfo"
! # Get values
! fmt = prop.get_value (prefix + ".format")
!
! # Connect gtk signals
! self.connect ("destroy", self.__gtkcb_destroy)
# Remember
! self.__cp = pl.get_coreplayer ()
# Parse and create list of members which will compose values tuple
i = 0;
attrs = []
***************
*** 184,189 ****
if i == -1: break
! if self.ch.has_key (fmt [i+1]):
! attrs.append (self.ch [fmt [i+1]])
fmt = fmt [:i+1] + 's' + fmt [i+2:]
--- 221,226 ----
if i == -1: break
! if self.__ch.has_key (fmt [i+1]):
! attrs.append (self.__ch [fmt [i+1]])
fmt = fmt [:i+1] + 's' + fmt [i+2:]
***************
*** 194,201 ****
# Register callback to update label
! cp.register_notifier (self)
self.cb_start_notify (None)
def cb_start_notify (self, thread=1):
# Prepare locals for dynamic code
si = self.__cp.get_stream_info ()
--- 231,240 ----
# Register callback to update label
! self.__cp.register_notifier (self)
self.cb_start_notify (None)
def cb_start_notify (self, thread=1):
+ """Callback handler. It called when the song playback started."""
+
# Prepare locals for dynamic code
si = self.__cp.get_stream_info ()
***************
*** 208,219 ****
# Set right value
! if thread: gtk.threads_enter ()
self.set_text (s)
! if thread: gtk.threads_leave ()
! def __on_destroy (self, widget):
! """Called on the destroy."""
! gtk.threads_leave ()
self.__cp.unregister_notifier (self)
! gtk.threads_enter ()
--- 247,258 ----
# Set right value
! if thread: gdk.threads_enter ()
self.set_text (s)
! if thread: gdk.threads_leave ()
! def __gtkcb_destroy (self, widget):
! """Callback for a destroy signal."""
! gdk.threads_leave ()
self.__cp.unregister_notifier (self)
! gdk.threads_enter ()
Index: misc.py
===================================================================
RCS file: /cvsroot/ap-python/python/aptk/misc.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** misc.py 19 Jul 2002 18:04:13 -0000 1.2
--- misc.py 21 Jul 2002 18:15:43 -0000 1.3
***************
*** 24,80 ****
__license__ = "GNU"
! import gtk
! ######################################################################
! # Work with properties
! def get_property (default_prop, prop, key, strip = ""):
! fullkey = (strip and strip + ".") + key
! if prop and prop.has_key (fullkey): return prop [fullkey]
! else: return default_prop [key]
! ######################################################################
! # Button
! class Button (gtk.GtkButton):
! properties = {
! "relief" : None,
! "label" : None,
! "xpmfile" : None
! }
! def __init__ (self, prop = None, strip = ""):
"""Create button."""
! # Create strip string for this class
! this_strip = (strip and strip + ".") + 'button'
!
# Get properties
! label = get_property (self.properties, prop, 'label', this_strip)
! xpmfile = get_property (self.properties, prop, 'xpmfile', this_strip)
! relief = get_property (self.properties, prop, 'relief', this_strip)
!
! # Remember this. We will load xpm file after a parent will be set
! self.__xpmfile = xpmfile
! self.__pixmap = None
# Create button
! gtk.GtkButton.__init__ (self, label)
if relief is not None:
self.set_relief (relief)
! # Connect signals
! self.connect ("parent_set", self.__gtkcb_parent_set)
!
! def __gtkcb_parent_set (self, w, old_parent):
! """Calling by gtk if a parent is setted up."""
!
! # We have no picture to add or a picture already added
! if self.__pixmap or self.__xpmfile is None: return
!
! # Create Pixmap
! self.__pixmap = gtk.GtkPixmap (self, self.__xpmfile)
! self.add (self.__pixmap)
! self.__pixmap.show ()
--- 24,118 ----
__license__ = "GNU"
! import gtk, re
! # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
! class WidgetProperties (object):
! def __init__ (self, list = []):
! """Initializer."""
!
! self.__list = []
! # Add values from a given list
! for key, value in list:
! self.add_property (key, value)
!
! def add_property (self, key, value):
! """Add property."""
!
! key = self.__compile_key (key)
! self.__list.append ((key, value))
!
! def __compile_key (self, key):
! """Translate key into compiled regexp."""
! # Allow only * in regexps
! key = key.replace ("*", "MiU2hLo4SpI5GN999UeSED")
! key = re.escape (key)
! key = "^" + key.replace ("MiU2hLo4SpI5GN999UeSED", ".*") + "$"
! return re.compile (key)
! def has_key (self, key):
! """Return 1 if key is present."""
!
! for pattern, value in self.__list:
! if pattern.match (key): return 1
!
! return 0
!
! def get_value (self, key):
! """Return value by key."""
!
! for pattern, value in self.__list:
! if pattern.match (key): return value
!
! raise AttributeError, "key is not found"
!
! def __add__ (self, other):
! """Add another WidgetProperties object."""
!
! if type (other) is not type (self):
! raise TypeError, "you could add only WidgetProperties object"
!
! new = WidgetProperties ()
! new.__list = self.__list + other.__list
!
! return new
!
! # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
! class Button (gtk.Button):
! # Defualt properties
! __properties = WidgetProperties ([
! ('*.button.relief', None),
! ('*.button.label', ''),
! ('*.button.file', None),
! ])
! def __init__ (self, prop = None, prefix = ""):
"""Create button."""
! # Create new properties whth our defaults added
! prop = prop and (prop + self.__properties) or self.__properties
! prefix += '.button'
!
# Get properties
! file = prop.get_value (prefix + ".file")
! label = prop.get_value (prefix + ".label")
! relief = prop.get_value (prefix + ".relief")
# Create button
! if not file:
! gtk.Button.__init__ (self, label)
! else:
! gtk.Button.__init__ (self)
+ # Set relief
if relief is not None:
self.set_relief (relief)
! # Add image
! if file:
! image = gtk.Image ()
! image.set_from_file (file)
! self.add (image)
! image.show ()
Index: pan.py
===================================================================
RCS file: /cvsroot/ap-python/python/aptk/pan.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** pan.py 19 Jul 2002 18:04:13 -0000 1.4
--- pan.py 21 Jul 2002 18:15:43 -0000 1.5
***************
*** 24,54 ****
__license__ = "GNU"
! import aptk.misc, alsaplayer, gtk, GTK
!
! # - - - - - - - - Scale --------------------------------------------------
class _Scale:
! def __init__ (self, cp):
! adj = gtk.GtkAdjustment (value=cp.get_pan(), lower=-100, upper=100)
! adj.connect ("value_changed", self.__cb_pan_changed)
! self.connect ("destroy", self.__on_destroy)
! self.set_adjustment (adj)
self.set_draw_value (0)
! self.__cp = cp
self.__adj = adj
self.__cp_locked = 0
# Register callback to update scale by external changes
! cp.register_notifier (self)
! def __cb_pan_changed (self, w):
"""Gtk callback handler for scale changes."""
if not self.__cp_locked:
! gtk.threads_leave ()
self.__cp.set_pan (w.value);
! gtk.threads_enter ()
def cb_pan_changed (self, pan):
--- 24,65 ----
__license__ = "GNU"
+ import aptk.misc, alsaplayer, gtk
+ gdk = gtk.gdk
! # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
class _Scale:
! def __init__ (self, pl):
! """Initializer."""
!
! # Remember for future use
! self.__cp = pl.get_coreplayer ()
!
! # Create adjustment
! adj = gtk.Adjustment (value = self.__cp.get_pan (),
! lower = -100,
! upper = 100)
+ self.set_adjustment (adj)
self.set_draw_value (0)
! # Remember for future use
self.__adj = adj
self.__cp_locked = 0
# Register callback to update scale by external changes
! self.__cp.register_notifier (self)
! # Connect gtk signals
! adj.connect ("value_changed", self.__gtkcb_pan_changed)
! self.connect ("destroy", self.__gtkcb_destroy)
!
!
! def __gtkcb_pan_changed (self, w):
"""Gtk callback handler for scale changes."""
if not self.__cp_locked:
! gdk.threads_leave ()
self.__cp.set_pan (w.value);
! gdk.threads_enter ()
def cb_pan_changed (self, pan):
***************
*** 57,121 ****
self.__cp_locked = 1
! gtk.threads_enter ()
self.__adj.set_value (pan)
! gtk.threads_leave ()
self.__cp_locked = 0
! def __on_destroy (self, widget):
"""Called on the destroy."""
! gtk.threads_leave ()
self.__cp.unregister_notifier (self)
! gtk.threads_enter ()
!
! class HScale (gtk.GtkHScale, _Scale):
! def __init__ (self, cp):
! gtk.GtkHScale.__init__ (self)
! _Scale.__init__ (self, cp)
! class VScale (gtk.GtkVScale, _Scale):
! def __init__ (self, cp):
! gtk.GtkVScale.__init__ (self)
! _Scale.__init__ (self, cp)
! # - - - - - - - - - Button ---------------------------------------------------
class Button (aptk.misc.Button):
! def __init__ (self, cp, value, prop = None, strip = ""):
"""Intitializer."""
# Call base class initializer
! aptk.misc.Button.__init__ (self, prop, strip)
# Connect signals
! self.connect ("clicked", self.__cb_clicked)
# Remember
self.__value = value
! self.__cp = cp
!
! def __cb_clicked (self, w):
! gtk.threads_leave ()
self.__cp.set_pan (self.__value)
! gtk.threads_enter ()
! # - - - - - - - - - - - - - - - Boxes - - - - - - - - - -
class _Box:
! def __init__ (self, cp, prop = None, strip = ""):
"""Inititalizer."""
! # Create strip string for this class
! this_strip = (strip and strip + ".") + 'pan'
# Create buttons
! self.left_button = Button (cp, -100, prop, this_strip + ".left")
self.add (self.left_button)
! self.center_button = Button (cp, 0, prop, this_strip + ".center")
self.add (self.center_button)
! self.right_button = Button (cp, 100, prop, this_strip + ".right")
self.add (self.right_button)
--- 68,140 ----
self.__cp_locked = 1
! gdk.threads_enter ()
self.__adj.set_value (pan)
! gdk.threads_leave ()
self.__cp_locked = 0
! def __gtkcb_destroy (self, widget):
"""Called on the destroy."""
! gdk.threads_leave ()
self.__cp.unregister_notifier (self)
! gdk.threads_enter ()
+ # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
+ class HScale (gtk.HScale, _Scale):
+ def __init__ (self, pl):
+ gtk.HScale.__init__ (self)
+ _Scale.__init__ (self, pl)
! # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
! class VScale (gtk.VScale, _Scale):
! def __init__ (self, pl):
! gtk.VScale.__init__ (self)
! _Scale.__init__ (self, pl)
! # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
class Button (aptk.misc.Button):
! def __init__ (self, pl, value, prop = None, prefix = ""):
"""Intitializer."""
# Call base class initializer
! aptk.misc.Button.__init__ (self, prop, prefix)
# Connect signals
! self.connect ("clicked", self.__gtkcb_clicked)
# Remember
self.__value = value
! self.__cp = pl.get_coreplayer ()
! def __gtkcb_clicked (self, w):
! gdk.threads_leave ()
self.__cp.set_pan (self.__value)
! gdk.threads_enter ()
! # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
class _Box:
! # Defualt properties
! __properties = aptk.misc.WidgetProperties ([
! ('*.pan.left.button.label', 'Left'),
! ('*.pan.center.button.label', 'Center'),
! ('*.pan.right.button.label', 'Right')
! ])
!
! def __init__ (self, pl, prop = None, prefix = ""):
"""Inititalizer."""
! # Create new properties whth our defaults added
! prop = prop and (prop + self.__properties) or self.__properties
! prefix += ".pan"
# Create buttons
! self.left_button = Button (pl, -100, prop, prefix + ".left")
self.add (self.left_button)
! self.center_button = Button (pl, 0, prop, prefix + ".center")
self.add (self.center_button)
! self.right_button = Button (pl, 100, prop, prefix + ".right")
self.add (self.right_button)
***************
*** 125,148 ****
self.right_button.show ()
! class HBox (gtk.GtkHBox, _Box):
! def __init__ (self, cp, prop = None, strip = ""):
! gtk.GtkHBox.__init__ (self)
! _Box.__init__ (self, cp, prop, strip)
!
! class VBox (gtk.GtkVBox, _Box):
! def __init__ (self, cp, prop = None, strip = ""):
! gtk.GtkVBox.__init__ (self)
! _Box.__init__ (self, cp, prop, strip)
! # - - - - - - - - - - - - - Final Widgets
! class HPan (gtk.GtkHBox):
! def __init__ (self, cp, prop = None, strip = ""):
! gtk.GtkHBox.__init__ (self)
! box = HBox (cp, prop, strip)
! scale = HScale (cp)
! self.pack_start (box, expand = GTK.FALSE)
self.add (scale)
--- 144,168 ----
self.right_button.show ()
! # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
! class HBox (gtk.HBox, _Box):
! def __init__ (self, pl, prop = None, prefix = ""):
! gtk.HBox.__init__ (self)
! _Box.__init__ (self, pl, prop, prefix)
! # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
! class VBox (gtk.VBox, _Box):
! def __init__ (self, pl, prop = None, prefix = ""):
! gtk.VBox.__init__ (self)
! _Box.__init__ (self, pl, prop, prefix)
! # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
! class HPan (gtk.HBox):
! def __init__ (self, pl, prop = None, prefix = ""):
! gtk.HBox.__init__ (self)
! box = HBox (pl, prop, prefix)
! scale = HScale (pl)
! self.pack_start (box, expand = gtk.FALSE)
self.add (scale)
***************
*** 150,161 ****
scale.show ()
! class VPan (gtk.GtkVBox):
! def __init__ (self, cp, prop = None, strip = ""):
! gtk.GtkVBox.__init__ (self)
! box = VBox (cp, prop, strip)
! scale = VScale (cp)
! self.pack_start (box, expand = GTK.FALSE)
self.add (scale)
--- 170,182 ----
scale.show ()
! # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
! class VPan (gtk.VBox):
! def __init__ (self, pl, prop = None, prefix = ""):
! gtk.VBox.__init__ (self)
! box = VBox (pl, prop, prefix)
! scale = VScale (pl)
! self.pack_start (box, expand = gtk.FALSE)
self.add (scale)
Index: playlist.py
===================================================================
RCS file: /cvsroot/ap-python/python/aptk/playlist.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** playlist.py 19 Jul 2002 18:04:13 -0000 1.4
--- playlist.py 21 Jul 2002 18:15:43 -0000 1.5
***************
*** 24,31 ****
__license__ = "GNU"
! import gtk, GDK
###########################################################################
! class SmartList (gtk.GtkCList):
def __init__ (self, columns):
"""Initializer."""
--- 24,31 ----
__license__ = "GNU"
! import gtk
###########################################################################
! class SmartList (gtk.CList):
def __init__ (self, columns):
"""Initializer."""
***************
*** 37,64 ****
gtk.GtkCList.__init__ (self, len (columns), columns)
- def set_titles (self, titles):
- """Set titles from dict."""
-
- for column in self.columns:
- if titles.has_key (column):
- value = titles [column]
-
- if type (value) is type (''):
- # This is a text label
-
- gtk.GtkCList.set_column_title (self, self.columns.index (column), value)
- else:
- # This is an xpm filename
-
- window = self.get_window ()
-
- if window is None:
- self.realize ()
- window = self.get_window ()
-
- pixmap = gtk.GtkPixmap (self, value [0])
- gtk.GtkCList.set_column_widget (self, self.columns.index (column), pixmap)
- pixmap.show ()
-
def append (self, values):
"""Append values. Where 'value' variable is a dict of titles and associated values."""
--- 37,40 ----
***************
*** 119,145 ****
###############################################################################
! class PlaylistWindow (gtk.GtkWindow):
properties = {
! 'playlist.columns' : ['current', 'playtime', 'track', 'title',
'album', 'artist', 'year', 'genre'],
! 'playlist.title.playtime' : ("playtime.xpm",),
! 'playlist.title.track' : ("track.xpm",),
! 'playlist.title.title' : 'Title',
! 'playlist.title.current' : ' ',
! 'playlist.title.album' : 'Album',
! 'playlist.title.artist' : 'Artist',
! 'playlist.title.year' : 'Year',
! 'playlist.title.genre' : 'Genre',
! 'playlist.current.mark' : ("current_play.xpm",)
! }
! def __init__ (self, pl, prop):
"""Initializer."""
! # Helper function. Get value from given properties or even from default
! def prop_value (key, prop=prop):
! if prop.has_key (key): return prop [key]
! else: return default_properties [key]
!
# Remember
self.pl = pl
--- 95,132 ----
###############################################################################
! class PlaylistWindow (gtk.Window):
properties = {
! 'playlist.list.columns' : ['current', 'playtime', 'track', 'title',
'album', 'artist', 'year', 'genre'],
! 'playlist.playtime.label' : 'Playtime',
! 'playlist.track.label' : 'Track',
! 'playlist.title.label' : 'Title',
! 'playlist.current.label' : 'Current',
! 'playlist.album.label' : 'Album',
! 'playlist.artist.label' : 'Artist',
! 'playlist.year.label' : 'Year',
! 'playlist.genre.label' : 'Genre',
! 'playlist.filename.label' : 'Filename',
! 'playlist.comment.label' : 'Comment',
! 'playlist.npmark.label' : '*',
! 'playlist.playtime.xpmfile' : None,
! 'playlist.track.xpmfile' : None,
! 'playlist.title.xpmfile' : None,
! 'playlist.current.xpmfile' : None,
! 'playlist.album.xpmfile' : None,
! 'playlist.artist.xpmfile' : None,
! 'playlist.year.xpmfile' : None,
! 'playlist.genre.xpmfile' : None,
! 'playlist.filename.xpmfile' : None,
! 'playlist.comment.xpmfile' : None,
! 'playlist.npmark.xpmfile' : None
! }
! def __init__ (self, pl, prop = None, strip = ""):
"""Initializer."""
! # Create strip string for this class
! this_strip = (strip and strip + ".") + 'playlist'
!
# Remember
self.pl = pl
***************
*** 162,176 ****
# Create list
! self.list = SmartList (prop_value ('columns'))
self.scrolled.add (self.list)
! self.list.set_titles ({"current" : prop ['title for current'],
! "playtime" : prop ['title for playtime'],
! "track" : prop ['title for track'],
! "title" : prop ['title for title'],
! "album" : prop ['title for album'],
! "artist" : prop ['title for artist'],
! "year" : prop ['title for year'],
! "genre" : prop ['title for genre']})
self.list.show ()
--- 149,156 ----
# Create list
! self.list = SmartList (prop, this_strip)
self.scrolled.add (self.list)
! self.list.set_titles (prop, this_strip)
self.list.show ()
***************
*** 178,184 ****
# Create mark for the current song
- self.current_mark = prop_value ('mark for current')
-
- # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --
# - -- - - - - - - - - - - - - - - - - -- - - - - - - - - - - - -
--- 158,161 ----
Index: position.py
===================================================================
RCS file: /cvsroot/ap-python/python/aptk/position.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** position.py 6 Jul 2002 16:08:10 -0000 1.3
--- position.py 21 Jul 2002 18:15:43 -0000 1.4
***************
*** 24,38 ****
__license__ = "GNU"
! import alsaplayer, gtk, aptk.misc, GTK
! # - - - - - - - - Scale --------------------------------------------------
class _Scale:
! def __init__ (self, cp):
# Initialize adjustment
! adj = gtk.GtkAdjustment ()
self.set_adjustment (adj)
# Remember
! self.__cp = cp
self.__adj = adj
self.__dragging = 0
--- 24,41 ----
__license__ = "GNU"
! import alsaplayer, gtk, aptk.misc
! gdk = gtk.gdk
! # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
class _Scale:
! def __init__ (self, pl):
! """Initializer."""
!
# Initialize adjustment
! adj = gtk.Adjustment ()
self.set_adjustment (adj)
# Remember
! self.__cp = pl.get_coreplayer ()
self.__adj = adj
self.__dragging = 0
***************
*** 42,88 ****
# Signals
! cp.register_notifier (self)
! self.connect ("button_press_event", self.__press_event)
! self.connect ("button_release_event", self.__release_event)
! self.connect ("motion_notify_event", self.__motion_event)
! self.connect ("destroy", self.__on_destroy)
! def cb_position_notify (self, pos):
! """Callback handler for the position changes."""
! if self.__cp.can_seek ():
! gtk.threads_enter ()
! self.set_sensitive (GTK.TRUE)
! gtk.threads_leave ()
! if self.__dragging:
! value = self.__adj.value
! else:
! value = pos
# FIXME:
# Hack derived from Andy's gtk_interface.cpp. Why 34 is here? ;)
! gtk.threads_enter ()
! self.__adj.set_all (value = value,
! lower = 0,
! upper = self.__cp.get_frames () - 34,
! step_increment = 1,
! page_increment = 0,
! page_size = 0)
! gtk.threads_leave ()
! else:
! gtk.threads_enter ()
! self.set_sensitive (GTK.FALSE)
! self.__adj.set_all (value = 0,
! lower = 0,
! upper = 0,
! step_increment = 0,
! page_increment = 0,
! page_size = 0)
! gtk.threads_leave ()
! return 1
!
! def __press_event (self, widget, event):
"""Button press event handler."""
--- 45,83 ----
# Signals
! self.__cp.register_notifier (self)
! self.connect ("button_press_event", self.__gtkcb_press_event)
! self.connect ("button_release_event", self.__gtkcb_release_event)
! self.connect ("motion_notify_event", self.__gtkcb_motion_event)
! self.connect ("destroy", self.__gtkcb_destroy)
!
! # Update upper
! self.cb_start_notify (None)
!
! def cb_start_notify (self, thread = 1):
! """Callback handler for a song start event. This signal emits by AlsaPlayer."""
! can_seek = self.__cp.can_seek ()
!
! if thread: gdk.threads_enter ()
! self.__adj.upper = float (self.__cp.get_frames () - 34)
! self.set_sensitive (can_seek)
!
! if thread: gdk.threads_leave ()
!
! def cb_position_notify (self, pos):
! """Callback handler for the position changes. This signal emits by AlsaPlayer."""
!
! if self.__dragging: return
+ if self.__cp.can_seek ():
# FIXME:
# Hack derived from Andy's gtk_interface.cpp. Why 34 is here? ;)
! gdk.threads_enter ()
! self.__adj.set_value (pos)
! gdk.threads_leave ()
! def __gtkcb_press_event (self, widget, event):
"""Button press event handler."""
***************
*** 90,123 ****
self.__motion = 0
! def __motion_event (self, widget, event):
"""Motion notify event handler."""
self.__motion = 1
! def __release_event (self, widget, event):
"""Button release event handler."""
if self.__motion:
! gtk.threads_leave ()
self.__cp.seek (self.__adj.value)
! gtk.threads_enter ()
self.__dragging = 0
! def __on_destroy (self, widget):
"""Called on the destroy."""
! gtk.threads_leave ()
self.__cp.unregister_notifier (self)
! gtk.threads_enter ()
! class HScale (gtk.GtkHScale, _Scale):
def __init__ (self, cp):
! gtk.GtkHScale.__init__ (self)
_Scale.__init__ (self, cp)
!
! class VScale (gtk.GtkVScale, _Scale):
def __init__ (self, cp):
! gtk.GtkVScale.__init__ (self)
_Scale.__init__ (self, cp)
--- 85,119 ----
self.__motion = 0
! def __gtkcb_motion_event (self, widget, event):
"""Motion notify event handler."""
self.__motion = 1
! def __gtkcb_release_event (self, widget, event):
"""Button release event handler."""
if self.__motion:
! gdk.threads_leave ()
self.__cp.seek (self.__adj.value)
! gdk.threads_enter ()
self.__dragging = 0
! def __gtkcb_destroy (self, widget):
"""Called on the destroy."""
! gdk.threads_leave ()
self.__cp.unregister_notifier (self)
! gdk.threads_enter ()
! # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
! class HScale (gtk.HScale, _Scale):
def __init__ (self, cp):
! gtk.HScale.__init__ (self)
_Scale.__init__ (self, cp)
! # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
! class VScale (gtk.VScale, _Scale):
def __init__ (self, cp):
! gtk.VScale.__init__ (self)
_Scale.__init__ (self, cp)
Index: speed.py
===================================================================
RCS file: /cvsroot/ap-python/python/aptk/speed.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** speed.py 19 Jul 2002 18:04:13 -0000 1.4
--- speed.py 21 Jul 2002 18:15:43 -0000 1.5
***************
*** 24,53 ****
__license__ = "GNU"
! import alsaplayer, gtk, aptk.misc, GTK
! # - - - - - - - - Scale --------------------------------------------------
class _Scale:
! def __init__ (self, cp):
! adj = gtk.GtkAdjustment (value=cp.get_speed()*100, lower=-333, upper=333)
! adj.connect ("value_changed", self.__cb_speed_changed)
! self.connect ("destroy", self.__on_destroy)
self.set_adjustment (adj)
-
self.set_draw_value (0)
! self.__cp = cp
self.__adj = adj
self.__cp_locked = 0
# Register callback to update scale by external pan changes
! cp.register_notifier (self)
! def __cb_speed_changed (self, w):
"""Gtk callback handler for scale changes."""
if not self.__cp_locked:
! gtk.threads_leave ()
self.__cp.set_speed (w.value/100)
! gtk.threads_enter ()
def cb_speed_changed (self, speed):
--- 24,64 ----
__license__ = "GNU"
! import alsaplayer, gtk, aptk.misc
! gdk = gtk.gdk
! # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
class _Scale:
! def __init__ (self, pl):
! """Initializer."""
!
! # Remeber for future use
! self.__cp = pl.get_coreplayer ()
!
! # Create adjustmnet
! adj = gtk.Adjustment (value = self.__cp.get_speed () * 100,
! lower = -333,
! upper = 333)
!
self.set_adjustment (adj)
self.set_draw_value (0)
! # Remember for future use
self.__adj = adj
self.__cp_locked = 0
# Register callback to update scale by external pan changes
! self.__cp.register_notifier (self)
! # Connect signals
! adj.connect ("value_changed", self.__gtkcb_speed_changed)
! self.connect ("destroy", self.__gtkcb_destroy)
!
! def __gtkcb_speed_changed (self, w):
"""Gtk callback handler for scale changes."""
if not self.__cp_locked:
! gdk.threads_leave ()
self.__cp.set_speed (w.value/100)
! gdk.threads_enter ()
def cb_speed_changed (self, speed):
***************
*** 56,120 ****
self.__cp_locked = 1
! gtk.threads_enter ()
self.__adj.set_value (speed*100)
! gtk.threads_leave ()
self.__cp_locked = 0
! def __on_destroy (self, widget):
"""Called on the destroy."""
! gtk.threads_leave ()
self.__cp.unregister_notifier (self)
! gtk.threads_enter ()
! class HScale (gtk.GtkHScale, _Scale):
def __init__ (self, cp):
! gtk.GtkHScale.__init__ (self)
_Scale.__init__ (self, cp)
!
! class VScale (gtk.GtkVScale, _Scale):
def __init__ (self, cp):
! gtk.GtkVScale.__init__ (self)
_Scale.__init__ (self, cp)
!
! # - - - - - - - - - Button ---------------------------------------------------
class Button (aptk.misc.Button):
! def __init__ (self, cp, value, prop = None, strip = ""):
"""Intitializer."""
# Call base class initializer
! aptk.misc.Button.__init__ (self, prop, strip)
# Connect signals
! self.connect ("clicked", self.__cb_clicked)
# Remember
self.__value = value
! self.__cp = cp
! def __cb_clicked (self, w):
! gtk.threads_leave ()
self.__cp.set_speed (self.__value)
! gtk.threads_enter ()
! # - - - - - - - - - - - - - - - Boxes - - - - - - - - - -
class _Box:
! def __init__ (self, cp, prop = None, strip = ""):
"""Inititalizer."""
! # Create strip string for this class
! this_strip = (strip and strip + ".") + 'speed'
!
# Create buttons
! self.backward_button = Button (cp, -1, prop, this_strip + ".backward")
self.add (self.backward_button)
! self.pause_button = Button (cp, 0, prop, this_strip + ".pause")
self.add (self.pause_button)
! self.forward_button = Button (cp, 1, prop, this_strip + ".forward")
self.add (self.forward_button)
--- 67,139 ----
self.__cp_locked = 1
! gdk.threads_enter ()
self.__adj.set_value (speed*100)
! gdk.threads_leave ()
self.__cp_locked = 0
! def __gtkcb_destroy (self, widget):
"""Called on the destroy."""
! gdk.threads_leave ()
self.__cp.unregister_notifier (self)
! gdk.threads_enter ()
! # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
! class HScale (gtk.HScale, _Scale):
def __init__ (self, cp):
! gtk.HScale.__init__ (self)
_Scale.__init__ (self, cp)
! # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
! class VScale (gtk.VScale, _Scale):
def __init__ (self, cp):
! gtk.VScale.__init__ (self)
_Scale.__init__ (self, cp)
! # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
class Button (aptk.misc.Button):
! def __init__ (self, pl, value, prop = None, prefix = ""):
"""Intitializer."""
# Call base class initializer
! aptk.misc.Button.__init__ (self, prop, prefix)
# Connect signals
! self.connect ("clicked", self.__gtkcb_clicked)
# Remember
self.__value = value
! self.__cp = pl.get_coreplayer ()
! def __gtkcb_clicked (self, w):
! gdk.threads_leave ()
self.__cp.set_speed (self.__value)
! gdk.threads_enter ()
! # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
class _Box:
! # Defualt properties
! __properties = aptk.misc.WidgetProperties ([
! ('*.speed.pause.button.label', '||'),
! ('*.speed.backward.button.label', 'Rw'),
! ('*.speed.forward.button.label', 'Fw')
! ])
!
! def __init__ (self, pl, prop = None, prefix = ""):
"""Inititalizer."""
! # Create new properties whth our defaults added
! prop = prop and (prop + self.__properties) or self.__properties
! prefix += ".speed"
!
# Create buttons
! self.backward_button = Button (pl, -1, prop, prefix + ".backward")
self.add (self.backward_button)
! self.pause_button = Button (pl, 0, prop, prefix + ".pause")
self.add (self.pause_button)
! self.forward_button = Button (pl, 1, prop, prefix + ".forward")
self.add (self.forward_button)
***************
*** 124,147 ****
self.forward_button.show ()
! class HBox (gtk.GtkHBox, _Box):
! def __init__ (self, cp, prop = None, strip = ""):
! gtk.GtkHBox.__init__ (self)
! _Box.__init__ (self, cp, prop, strip)
!
! class VBox (gtk.GtkVBox, _Box):
! def __init__ (self, cp, prop = None, strip = ""):
! gtk.GtkVBox.__init__ (self)
! _Box.__init__ (self, cp, prop, strip)
! # - - - - - - - - - - - - - Final Widgets - - - - - - - - - - - - - - -
! class HSpeed (gtk.GtkHBox):
! def __init__ (self, cp, prop = None, strip = ""):
! gtk.GtkHBox.__init__ (self)
! box = HBox (cp, prop, strip)
! scale = HScale (cp)
! self.pack_start (box, expand = GTK.FALSE)
self.add (scale)
--- 143,167 ----
self.forward_button.show ()
! # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
! class HBox (gtk.HBox, _Box):
! def __init__ (self, pl, prop = None, prefix = ""):
! gtk.HBox.__init__ (self)
! _Box.__init__ (self, pl, prop, prefix)
! # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
! class VBox (gtk.VBox, _Box):
! def __init__ (self, pl, prop = None, prefix = ""):
! gtk.VBox.__init__ (self)
! _Box.__init__ (self, pl, prop, prefix)
! # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
! class HSpeed (gtk.HBox):
! def __init__ (self, pl, prop = None, prefix = ""):
! gtk.HBox.__init__ (self)
! box = HBox (pl, prop, prefix)
! scale = HScale (pl)
! self.pack_start (box, expand = gtk.FALSE)
self.add (scale)
***************
*** 149,160 ****
scale.show ()
! class VSpeed (gtk.GtkVBox):
! def __init__ (self, cp, prop = None, strip = ""):
! gtk.GtkVBox.__init__ (self)
! box = VBox (cp, prop, strip)
! scale = VScale (cp)
! self.pack_start (box, expand = GTK.FALSE)
self.add (scale)
--- 169,181 ----
scale.show ()
! # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
! class VSpeed (gtk.VBox):
! def __init__ (self, pl, prop = None, prefix = ""):
! gtk.VBox.__init__ (self)
! box = VBox (pl, prop, prefix)
! scale = VScale (pl)
! self.pack_start (box, expand = gtk.FALSE)
self.add (scale)
Index: volume.py
===================================================================
RCS file: /cvsroot/ap-python/python/aptk/volume.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** volume.py 6 Jul 2002 16:08:10 -0000 1.3
--- volume.py 21 Jul 2002 18:15:43 -0000 1.4
***************
*** 25,53 ****
import alsaplayer, gtk, aptk.misc
! # - - - - - - - - Scale --------------------------------------------------
class _Scale:
! def __init__ (self, cp):
! adj = gtk.GtkAdjustment (value=cp.get_volume(), lower=0.0, upper=100)
! adj.connect ("value_changed", self.__cb_volume_changed)
! self.connect ("destroy", self.__on_destroy)
! self.set_adjustment (adj)
self.set_draw_value (0)
! self.__cp = cp
self.__adj = adj
self.__cp_locked = 0
# Register callback to update scale by external changes
! cp.register_notifier (self)
! def __cb_volume_changed (self, w):
"""Gtk callback handler for scale changes."""
if not self.__cp_locked:
! gtk.threads_leave ()
self.__cp.set_volume (w.value);
! gtk.threads_enter ()
def cb_volume_changed (self, volume):
--- 25,64 ----
import alsaplayer, gtk, aptk.misc
+ gdk = gtk.gdk
! # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
class _Scale:
! def __init__ (self, pl):
! """Initializer."""
!
! # Remeber for future use
! self.__cp = pl.get_coreplayer ()
+ # Create adjustmnet
+ adj = gtk.Adjustment (value = self.__cp.get_volume (),
+ lower = 0.0,
+ upper = 100)
+
+ self.set_adjustment (adj)
self.set_draw_value (0)
! # Remember for future use
self.__adj = adj
self.__cp_locked = 0
# Register callback to update scale by external changes
! self.__cp.register_notifier (self)
! # Connect gtk signals
! adj.connect ("value_changed", self.__gtkcb_volume_changed)
! self.connect ("destroy", self.__gtkcb_destroy)
!
! def __gtkcb_volume_changed (self, w):
"""Gtk callback handler for scale changes."""
if not self.__cp_locked:
! gdk.threads_leave ()
self.__cp.set_volume (w.value);
! gdk.threads_enter ()
def cb_volume_changed (self, volume):
***************
*** 56,97 ****
self.__cp_locked = 1
! gtk.threads_enter ()
self.__adj.set_value (volume)
! gtk.threads_leave ()
self.__cp_locked = 0
! def __on_destroy (self, widget):
"""Called on the destroy."""
! gtk.threads_leave ()
self.__cp.unregister_notifier (self)
! gtk.threads_enter ()
!
! class HScale (gtk.GtkHScale, _Scale):
! def __init__ (self, cp):
! gtk.GtkHScale.__init__ (self)
! _Scale.__init__ (self, cp)
!
!
! class VScale (gtk.GtkVScale, _Scale):
! def __init__ (self, cp):
! gtk.GtkVScale.__init__ (self)
! _Scale.__init__ (self, cp)
! # - - - - - - - - - Button ---------------------------------------------------
! class Button (aptk.misc.Button):
! def __init__ (self, cp, value, **keys):
! aptk.misc.Button.__init__ (self, **keys)
! self.connect ("clicked", self.__cb_clicked)
! self.__value = value
! self.__cp = cp
! def __cb_clicked (self, w):
! gtk.threads_leave ()
! self.__cp.set_volume (self.__value)
! gtk.threads_enter ()
! # - - - - - - - - - - - - - Final Widgets - - - - - - - - - - - - - - -
HVolume = HScale
VVolume = VScale
--- 67,96 ----
self.__cp_locked = 1
! gdk.threads_enter ()
self.__adj.set_value (volume)
! gdk.threads_leave ()
self.__cp_locked = 0
! def __gtkcb_destroy (self, widget):
"""Called on the destroy."""
! gdk.threads_leave ()
self.__cp.unregister_notifier (self)
! gdk.threads_enter ()
! # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
! class HScale (gtk.HScale, _Scale):
! def __init__ (self, pl):
! gtk.HScale.__init__ (self)
! _Scale.__init__ (self, pl)
! # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
! class VScale (gtk.VScale, _Scale):
! def __init__ (self, pl):
! gtk.VScale.__init__ (self)
! _Scale.__init__ (self, pl)
! # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
HVolume = HScale
VVolume = VScale
|
|
From: <sj...@us...> - 2002-07-21 18:15:49
|
Update of /cvsroot/ap-python/python/examples/aptk
In directory usw-pr-cvs1:/tmp/cvs-serv26166/examples/aptk
Modified Files:
gtkplayer.py panel.py
Log Message:
Rewrite APTK to use it with PyGTK2!
Index: gtkplayer.py
===================================================================
RCS file: /cvsroot/ap-python/python/examples/aptk/gtkplayer.py,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** gtkplayer.py 19 Jul 2002 18:04:56 -0000 1.6
--- gtkplayer.py 21 Jul 2002 18:15:43 -0000 1.7
***************
*** 25,57 ****
__license__ = "GNU"
! import alsaplayer, aptk, gtk, GTK
- # Properties for widgets
- properties = {
- "control.play.button.xpmfile" : "play-sm.xpm",
- "control.play.button.relief" : GTK.RELIEF_NONE,
- "control.next.button.xpmfile" : "next-sm.xpm",
- "control.next.button.relief" : GTK.RELIEF_NONE,
- "control.prev.button.xpmfile" : "prev-sm.xpm",
- "control.prev.button.relief" : GTK.RELIEF_NONE,
- "control.stop.button.xpmfile" : "prev-sm.xpm",
- "control.stop.button.relief" : GTK.RELIEF_NONE,
- "tagslabel.format" : "%a - %t",
- "speed.pause.button.xpmfile" : "pause.xpm",
- "speed.pause.button.relief" : GTK.RELIEF_NONE,
- "speed.forward.button.xpmfile" : "f_play.xpm",
- "speed.forward.button.relief" : GTK.RELIEF_NONE,
- "speed.backward.button.xpmfile" : "r_play.xpm",
- "speed.backward.button.relief" : GTK.RELIEF_NONE,
- "pan.left.button.xpmfile" : "l_pan.xpm",
- "pan.left.button.relief" : GTK.RELIEF_NONE,
- "pan.center.button.xpmfile" : "c_pan.xpm",
- "pan.center.button.relief" : GTK.RELIEF_NONE,
- "pan.right.button.xpmfile" : "r_pan.xpm",
- "pan.right.button.relief" : GTK.RELIEF_NONE,
- }
pl = alsaplayer.get_playlist ()
- cp = pl.get_coreplayer ()
##########################################################
--- 25,52 ----
__license__ = "GNU"
! # Load modules
! import alsaplayer, aptk, gtk
! gdk = gtk.gdk
!
! # Init GDK threads
! gdk.threads_init ()
!
! # Properties
! properties = aptk.misc.WidgetProperties ([
! ('.control.play.button.file', 'play.xpm'),
! ('.control.next.button.file', 'next.xpm'),
! ('.control.stop.button.file', 'stop.xpm'),
! ('.control.prev.button.file', 'prev.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')
! ])
pl = alsaplayer.get_playlist ()
##########################################################
***************
*** 60,76 ****
gtk.mainquit ();
! win = gtk.GtkWindow ()
win.connect ("delete_event", delete_event)
! win.set_usize (340, 0)
! win.set_border_width (2)
##########################################################
! position = aptk.position.HScale (cp)
! tagslabel = aptk.info.TagsLabel (cp, properties)
! fullstatusbox = aptk.info.FullStatusHBox (cp, position)
control = aptk.control.HControl (pl, properties)
! speed = aptk.speed.HSpeed (cp, properties)
! pan = aptk.pan.HPan (cp, properties)
! volume = aptk.volume.HVolume (cp)
position.show ()
--- 55,71 ----
gtk.mainquit ();
! win = gtk.Window ()
win.connect ("delete_event", delete_event)
! win.set_default_size (340, 0)
! win.set_border_width (4)
##########################################################
! position = aptk.position.HScale (pl)
! tagslabel = aptk.info.TagsLabel (pl, properties)
! fullstatusbox = aptk.info.FullStatusHBox (pl, position)
control = aptk.control.HControl (pl, properties)
! speed = aptk.speed.HSpeed (pl, properties)
! pan = aptk.pan.HPan (pl, properties)
! volume = aptk.volume.HVolume (pl)
position.show ()
***************
*** 82,86 ****
volume.show ()
##########################################################
! main_vbox = gtk.GtkVBox ()
win.add (main_vbox)
main_vbox.add (tagslabel)
--- 77,81 ----
volume.show ()
##########################################################
! main_vbox = gtk.VBox ()
win.add (main_vbox)
main_vbox.add (tagslabel)
***************
*** 89,103 ****
main_vbox.show ()
! hbox = gtk.GtkHBox ()
main_vbox.add (hbox)
hbox.pack_start (control, expand = gtk.FALSE)
hbox.show ()
! vbox = gtk.GtkVBox ()
hbox.add (vbox)
vbox.add (speed)
vbox.show ()
! hbox2 = gtk.GtkHBox ()
vbox.add (hbox2)
hbox2.add (pan)
--- 84,98 ----
main_vbox.show ()
! hbox = gtk.HBox ()
main_vbox.add (hbox)
hbox.pack_start (control, expand = gtk.FALSE)
hbox.show ()
! vbox = gtk.VBox ()
hbox.add (vbox)
vbox.add (speed)
vbox.show ()
! hbox2 = gtk.HBox ()
vbox.add (hbox2)
hbox2.add (pan)
***************
*** 108,112 ****
win.show ()
! gtk.threads_enter ()
gtk.mainloop ()
! gtk.threads_leave ()
--- 103,107 ----
win.show ()
! gdk.threads_enter ()
gtk.mainloop ()
! gdk.threads_leave ()
Index: panel.py
===================================================================
RCS file: /cvsroot/ap-python/python/examples/aptk/panel.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** panel.py 19 Jul 2002 18:04:56 -0000 1.4
--- panel.py 21 Jul 2002 18:15:43 -0000 1.5
***************
*** 25,99 ****
__license__ = "GNU"
! import alsaplayer, aptk, gtk, GTK
! pl = alsaplayer.get_playlist ()
! ##############################################################################
! # Properties for widgets
! properties = {
! "control.play.button.xpmfile" : "play-sm.xpm",
! "control.play.button.relief" : GTK.RELIEF_NONE,
! "control.next.button.xpmfile" : "next-sm.xpm",
! "control.next.button.relief" : GTK.RELIEF_NONE,
! "control.prev.button.xpmfile" : "prev-sm.xpm",
! "control.prev.button.relief" : GTK.RELIEF_NONE,
! "control.stop.button.xpmfile" : "prev-sm.xpm",
! "control.stop.button.relief" : GTK.RELIEF_NONE,
! "tagslabel.format" : "%a - %t (%y - %l)",
! "speed.pause.button.xpmfile" : "pause.xpm",
! "speed.pause.button.relief" : GTK.RELIEF_NONE,
! "speed.forward.button.xpmfile" : "f_play.xpm",
! "speed.forward.button.relief" : GTK.RELIEF_NONE,
! "speed.backward.button.xpmfile" : "r_play.xpm",
! "speed.backward.button.relief" : GTK.RELIEF_NONE,
! "pan.left.button.xpmfile" : "l_pan.xpm",
! "pan.left.button.relief" : GTK.RELIEF_NONE,
! "pan.center.button.xpmfile" : "c_pan.xpm",
! "pan.center.button.relief" : GTK.RELIEF_NONE,
! "pan.right.button.xpmfile" : "r_pan.xpm",
! "pan.right.button.relief" : GTK.RELIEF_NONE,
! }
- ##########################################################
# Main window
! def delete_event (foo, bar):
! gtk.mainquit ();
!
! win = gtk.GtkWindow ()
! win.connect ("delete_event", delete_event)
win.set_title ("AlsaPlayer-Python Panel")
! win.set_usize (gtk.screen_width (), 0)
! win.set_uposition (0, 0)
! ##############################################################################
! ##############################################################################
! class InfoPage (gtk.GtkHBox):
! def __init__ (self, pl):
! gtk.GtkHBox.__init__ (self)
! cp = pl.get_coreplayer ()
self.set_spacing (2)
self.set_border_width (1)
! # - - - - - aptk widgets
control = aptk.control.HControl (pl, properties)
! tagslabel = aptk.info.TagsLabel (cp, properties)
! status = aptk.info.FullStatusHBox (cp)
status.set_spacing (20)
! # - - - - Frames
! control_frame = gtk.GtkFrame ()
! status_frame = gtk.GtkFrame ()
! 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
--- 25,93 ----
__license__ = "GNU"
! # Load modules
! import alsaplayer, aptk, gtk
! gdk = gtk.gdk
! # Init GDK threads
! gdk.threads_init ()
! # Get general playlist
! pl = alsaplayer.get_playlist ()
# Main window
! win = gtk.Window ()
! win.connect ("delete_event", lambda self, win: gtk.main_quit ())
+ # Setup window
win.set_title ("AlsaPlayer-Python Panel")
! win.set_size_request (gdk.screen_width (), 22)
! win.move (0, 0)
! win.stick ()
! win.set_resizable (gtk.FALSE)
! win.set_decorated (gtk.FALSE)
! # Properties
! properties = aptk.misc.WidgetProperties ([
! ('.tagsinfo.format', '%t - %a (%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')
! ])
! ##########################################################################
! class InfoPage (gtk.HBox):
! def __init__ (self, pl):
! gtk.HBox.__init__ (self)
+ # Setup itself
self.set_spacing (2)
self.set_border_width (1)
! # - - - - - APTK widgets
control = aptk.control.HControl (pl, properties)
! tagslabel = aptk.info.TagsLabel (pl, properties)
! status = aptk.info.FullStatusHBox (pl)
status.set_spacing (20)
! # - - - - - 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
***************
*** 112,121 ****
##############################################################################
! ##############################################################################
! class ControlPage (gtk.GtkHBox):
def __init__ (self, pl):
! gtk.GtkHBox.__init__ (self)
!
! cp = pl.get_coreplayer ()
self.set_spacing (2)
--- 106,112 ----
##############################################################################
! class ControlPage (gtk.HBox):
def __init__ (self, pl):
! gtk.HBox.__init__ (self)
self.set_spacing (2)
***************
*** 124,142 ****
# - - - - - aptk widgets
control = aptk.control.HControl (pl, properties)
! position = aptk.position.HScale (cp)
! time_label = aptk.info.TimeLabel (cp, position)
! speed = aptk.speed.HSpeed (cp, properties)
! pan = aptk.pan.HPan (cp, properties)
!
! volume = aptk.volume.HVolume (cp)
# - - - - Frames
! control_frame = gtk.GtkFrame ()
! position_frame = gtk.GtkFrame ()
! speed_frame = gtk.GtkFrame ()
! pan_frame = gtk.GtkFrame ()
! volume_frame = gtk.GtkFrame ()
! shadow_type = GTK.SHADOW_OUT
control_frame.set_shadow_type (shadow_type)
position_frame.set_shadow_type (shadow_type)
--- 115,132 ----
# - - - - - aptk widgets
control = aptk.control.HControl (pl, properties)
! position = aptk.position.HScale (pl)
! time_label = aptk.info.TimeLabel (pl, position)
! speed = aptk.speed.HSpeed (pl, properties)
! pan = aptk.pan.HPan (pl, properties)
! volume = aptk.volume.HVolume (pl)
# - - - - Frames
! control_frame = gtk.Frame ()
! position_frame = gtk.Frame ()
! speed_frame = gtk.Frame ()
! pan_frame = gtk.Frame ()
! volume_frame = gtk.Frame ()
! shadow_type = gtk.SHADOW_OUT
control_frame.set_shadow_type (shadow_type)
position_frame.set_shadow_type (shadow_type)
***************
*** 145,149 ****
volume_frame.set_shadow_type (shadow_type)
! self.pack_start (control_frame, expand = GTK.FALSE)
self.add (position_frame)
self.add (speed_frame)
--- 135,139 ----
volume_frame.set_shadow_type (shadow_type)
! self.pack_start (control_frame, expand = gtk.FALSE)
self.add (position_frame)
self.add (speed_frame)
***************
*** 152,162 ****
# - - - - pack to frames
! control_hbox = gtk.GtkHBox ()
control_hbox.add (control)
control_frame.add (control_hbox)
! position_hbox = gtk.GtkHBox ()
position_hbox.set_spacing (2)
! position_hbox.pack_start (time_label, expand=GTK.FALSE)
position_hbox.add (position)
position_frame.add (position_hbox)
--- 142,152 ----
# - - - - 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)
! position_hbox.pack_start (time_label, expand = gtk.FALSE)
position_hbox.add (position)
position_frame.add (position_hbox)
***************
*** 181,193 ****
position_hbox.show ()
! ##########################################################
! # Create two pages.
! # Info page goes to be visible while cursor is out of panel
! # Else control page is visible.
info_page = InfoPage (pl)
- control_page = ControlPage (pl)
info_page.show ()
control_page.show ()
# Set default mode (show info page)
mode = 1
--- 171,186 ----
position_hbox.show ()
! # Remember
! self.control_widget = control
!
! ###########################################################################
! # Create two pages
info_page = InfoPage (pl)
info_page.show ()
+
+ control_page = ControlPage (pl)
control_page.show ()
+
# Set default mode (show info page)
mode = 1
***************
*** 202,229 ****
"""Return 1 if info widget should be shown."""
! # Get gdk windows of the handling areas
! gdkwin = win.get_window ()
!
! # Get window rect
! wx1 = gdkwin.x
! wy1 = gdkwin.y
! wx2 = wx1 + gdkwin.width
! wy2 = wy1 + gdkwin.height
! # Get control rect
! cx1, cy1, cx2, cy2 = gdkcontrol = info_page.control_widget.get_allocation ()
! cx1 += wx1
! cy1 += wy1
! cx2 += cx1
! cy2 += cy1
! # Get pointer xy
! px, py = gdkwin.pointer
!
! # Pointer is within control widget
! if cx1 <= px < cx2 and cy1 <= py < cy2: return 1
! # Pointer is within main window
! if wx1 <= px < wx2 and wy1 <= py < wy2: return 0
return 1
--- 195,213 ----
"""Return 1 if info widget should be shown."""
! # Check if we aren't in window
! alloc = win.get_allocation ()
! x, y = win.get_pointer ()
! if x < 0 or x >= alloc.width or y < 0 or y >= alloc.height:
! return 1
! # 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:
! return 0
return 1
***************
*** 234,238 ****
global mode, newmode
! gtk.threads_enter ()
if newmode == 0:
--- 218,222 ----
global mode, newmode
! gdk.threads_enter ()
if newmode == 0:
***************
*** 243,247 ****
win.add (info_page)
! gtk.threads_leave ()
mode = newmode
--- 227,231 ----
win.add (info_page)
! gdk.threads_leave ()
mode = newmode
***************
*** 264,271 ****
win.connect ("enter_notify_event", pointer_moved_event)
! ##########################################################
win.show ()
! gtk.threads_enter ()
gtk.mainloop ()
! gtk.threads_leave ()
--- 248,258 ----
win.connect ("enter_notify_event", pointer_moved_event)
!
! ###########################################################################
! # Go!
!
win.show ()
! gdk.threads_enter ()
gtk.mainloop ()
! gdk.threads_leave ()
|
|
From: <sj...@us...> - 2002-07-21 18:15:49
|
Update of /cvsroot/ap-python/python In directory usw-pr-cvs1:/tmp/cvs-serv26166 Modified Files: configure.ac Log Message: Rewrite APTK to use it with PyGTK2! Index: configure.ac =================================================================== RCS file: /cvsroot/ap-python/python/configure.ac,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** configure.ac 15 May 2002 18:43:38 -0000 1.17 --- configure.ac 21 Jul 2002 18:15:42 -0000 1.18 *************** *** 116,119 **** --- 116,128 ---- enable_aptk="$enableval",enable_aptk="yes") + dnl test for pygtk 2.0 + AC_MSG_CHECKING(for PyGTK2 installed) + if $pythonpath -c "import gtk, sys; sys.exit (gtk.check_version (2, 0, 0) is not None)" >/dev/null 2>&1 ; then + AC_MSG_RESULT(found) + else + AC_MSG_RESULT(not found. APTK disabled.) + enable_aptk="no" + fi + AM_CONDITIONAL(ENABLE_APTK,test "$enable_aptk" = "yes") |
|
From: <sj...@us...> - 2002-07-21 10:28:26
|
Update of /cvsroot/ap-python/python/docs In directory usw-pr-cvs1:/tmp/cvs-serv528 Modified Files: Makefile.am Log Message: Fix make clean target. Index: Makefile.am =================================================================== RCS file: /cvsroot/ap-python/python/docs/Makefile.am,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Makefile.am 14 May 2002 15:12:20 -0000 1.6 --- Makefile.am 21 Jul 2002 10:28:21 -0000 1.7 *************** *** 1,9 **** EXTRA_DIST = mapping.html if HAVE_HAPPYDOC if ENABLE_APTK - DOC_DIR=$(datadir)/doc/alsaplayer - all-local: happydoc-build.stamp --- 1,8 ---- EXTRA_DIST = mapping.html + DOC_DIR=$(datadir)/doc/alsaplayer if HAVE_HAPPYDOC if ENABLE_APTK all-local: happydoc-build.stamp *************** *** 27,32 **** fi) ! uninstall-local: happydoc-build.stamp ! rm -f -r $(DOC_DIR)/aptk clean-local: --- 26,31 ---- fi) ! endif ! endif clean-local: *************** *** 34,37 **** rm -r -f happydoc ! endif ! endif --- 33,36 ---- rm -r -f happydoc ! uninstall-local: happydoc-build.stamp ! rm -f -r $(DOC_DIR)/aptk |
|
From: <sj...@us...> - 2002-07-21 10:27:27
|
Update of /cvsroot/ap-python/python/src
In directory usw-pr-cvs1:/tmp/cvs-serv32629
Modified Files:
pydefs.h
Log Message:
Fix warnings for compilation with cpp-3.1
Index: pydefs.h
===================================================================
RCS file: /cvsroot/ap-python/python/src/pydefs.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** pydefs.h 2 Jun 2002 09:46:38 -0000 1.3
--- pydefs.h 21 Jul 2002 10:27:24 -0000 1.4
***************
*** 21,25 ****
\
Py_BEGIN_ALLOW_THREADS \
! ((OBJECT*)self)->cobject->##CNAME (); \
Py_END_ALLOW_THREADS \
\
--- 21,25 ----
\
Py_BEGIN_ALLOW_THREADS \
! ((OBJECT*)self)->cobject->CNAME (); \
Py_END_ALLOW_THREADS \
\
***************
*** 38,42 ****
\
Py_BEGIN_ALLOW_THREADS \
! rc = ((OBJECT*)self)->cobject->##CNAME (); \
Py_END_ALLOW_THREADS \
\
--- 38,42 ----
\
Py_BEGIN_ALLOW_THREADS \
! rc = ((OBJECT*)self)->cobject->CNAME (); \
Py_END_ALLOW_THREADS \
\
***************
*** 54,58 ****
\
Py_BEGIN_ALLOW_THREADS \
! rc = ((OBJECT*)self)->cobject->##CNAME (); \
Py_END_ALLOW_THREADS \
\
--- 54,58 ----
\
Py_BEGIN_ALLOW_THREADS \
! rc = ((OBJECT*)self)->cobject->CNAME (); \
Py_END_ALLOW_THREADS \
\
***************
*** 70,74 ****
\
Py_BEGIN_ALLOW_THREADS \
! rc = ((OBJECT*)self)->cobject->##CNAME (); \
Py_END_ALLOW_THREADS \
\
--- 70,74 ----
\
Py_BEGIN_ALLOW_THREADS \
! rc = ((OBJECT*)self)->cobject->CNAME (); \
Py_END_ALLOW_THREADS \
\
|
|
From: <sj...@us...> - 2002-07-21 09:34:27
|
Update of /cvsroot/ap-python/python/src In directory usw-pr-cvs1:/tmp/cvs-serv17811/src Modified Files: ChangeLog Log Message: ChangeLog updated. Index: ChangeLog =================================================================== RCS file: /cvsroot/ap-python/python/src/ChangeLog,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** ChangeLog 6 Jul 2002 17:51:40 -0000 1.9 --- ChangeLog 21 Jul 2002 09:34:24 -0000 1.10 *************** *** 1,2 **** --- 1,9 ---- + 2002-07-21 09:27 Evgeny Chukreev <co...@ec...> + + * pycoreplayer.cpp, pyplaylist.cpp: Fix compilation with gcc 3.1. + Remove check for instance arg for CorePlayer::RegisterNotifer and + CorePlayer::UnregisterNotifier. And the same for Playlist::Register + and Playlist::Unregister. This is useful in Python2.2. + 2002-07-06 17:40 Evgeny Chukreev <co...@ec...> |
|
From: <sj...@us...> - 2002-07-21 09:27:36
|
Update of /cvsroot/ap-python/python/src
In directory usw-pr-cvs1:/tmp/cvs-serv16335
Modified Files:
pycoreplayer.cpp pyplaylist.cpp
Log Message:
Fix compilation with gcc 3.1. Remove check for instance arg for CorePlayer::RegisterNotifer and CorePlayer::UnregisterNotifier. And the same for Playlist::Register and Playlist::Unregister. This is useful in Python2.2.
Index: pycoreplayer.cpp
===================================================================
RCS file: /cvsroot/ap-python/python/src/pycoreplayer.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** pycoreplayer.cpp 6 Jul 2002 17:40:26 -0000 1.6
--- pycoreplayer.cpp 21 Jul 2002 09:27:31 -0000 1.7
***************
*** 274,281 ****
// First parameter must be instance
! if (!PyInstance_Check (instance)) {
! PyErr_SetString (PyExc_TypeError, "first parameter must be instance");
return NULL;
! }
// Allocate structure
--- 274,281 ----
// First parameter must be instance
! /* if (!PyInstance_Check (instance) && !PyCObject_Check (instance)) {
! PyErr_SetString (PyExc_TypeError, "first parameter must be instance or object");
return NULL;
! }*/
// Allocate structure
***************
*** 332,339 ****
// First parameter must be instance
! if (!PyInstance_Check (instance)) {
PyErr_SetString (PyExc_TypeError, "first parameter must be instance");
return NULL;
! }
// Search for notifiers in base
--- 332,339 ----
// First parameter must be instance
! /* if (!PyInstance_Check (instance)) {
PyErr_SetString (PyExc_TypeError, "first parameter must be instance");
return NULL;
! } */
// Search for notifiers in base
***************
*** 348,352 ****
free (notifier);
! self->registered_notifiers->erase (&(*self->registered_notifiers) [i]);
Py_DECREF (inst);
--- 348,352 ----
free (notifier);
! self->registered_notifiers->erase (self->registered_notifiers->begin() + i);
Py_DECREF (inst);
Index: pyplaylist.cpp
===================================================================
RCS file: /cvsroot/ap-python/python/src/pyplaylist.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** pyplaylist.cpp 31 May 2002 20:05:02 -0000 1.5
--- pyplaylist.cpp 21 Jul 2002 09:27:31 -0000 1.6
***************
*** 344,351 ****
// First parameter must be instance
! if (!PyInstance_Check (instance)) {
PyErr_SetString (PyExc_TypeError, "first parameter must be instance");
return NULL;
! }
Py_BEGIN_ALLOW_THREADS
--- 344,351 ----
// First parameter must be instance
! /* if (!PyInstance_Check (instance)) {
PyErr_SetString (PyExc_TypeError, "first parameter must be instance");
return NULL;
! } */
Py_BEGIN_ALLOW_THREADS
***************
*** 392,399 ****
// First parameter must be instance
! if (!PyInstance_Check (instance)) {
PyErr_SetString (PyExc_TypeError, "first parameter must be instance");
return NULL;
! }
// Search for wrapper
--- 392,399 ----
// First parameter must be instance
! /* if (!PyInstance_Check (instance)) {
PyErr_SetString (PyExc_TypeError, "first parameter must be instance");
return NULL;
! } */
// Search for wrapper
***************
*** 410,414 ****
delete wrapper;
delete (*self->registered) [i];
! self->registered->erase (&(*self->registered) [i]);
break;
--- 410,414 ----
delete wrapper;
delete (*self->registered) [i];
! self->registered->erase (self->registered->begin() +i);
break;
|
|
From: <sj...@us...> - 2002-07-19 18:06:18
|
Update of /cvsroot/ap-python/python/aptk In directory usw-pr-cvs1:/tmp/cvs-serv25901/aptk Modified Files: ChangeLog Log Message: ChangeLog updated. Index: ChangeLog =================================================================== RCS file: /cvsroot/ap-python/python/aptk/ChangeLog,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** ChangeLog 19 Jul 2002 07:36:48 -0000 1.11 --- ChangeLog 19 Jul 2002 18:06:14 -0000 1.12 *************** *** 1,2 **** --- 1,8 ---- + 2002-07-19 18:04 Evgeny Chukreev <co...@ec...> + + * control.py, info.py, misc.py, pan.py, playlist.py, speed.py: + Rewrite all widget for new properties theme. (playlist widget is + broken now). + 2002-07-19 07:34 Evgeny Chukreev <co...@ec...> |
|
From: <sj...@us...> - 2002-07-19 18:06:18
|
Update of /cvsroot/ap-python/python/examples/aptk In directory usw-pr-cvs1:/tmp/cvs-serv25901/examples/aptk Modified Files: ChangeLog Log Message: ChangeLog updated. Index: ChangeLog =================================================================== RCS file: /cvsroot/ap-python/python/examples/aptk/ChangeLog,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** ChangeLog 19 Jul 2002 07:36:48 -0000 1.9 --- ChangeLog 19 Jul 2002 18:06:14 -0000 1.10 *************** *** 1,2 **** --- 1,7 ---- + 2002-07-19 18:04 Evgeny Chukreev <co...@ec...> + + * gtkplayer.py, panel.py, playlist.py: Rewrite for new properties + theme. + 2002-07-19 07:36 Evgeny Chukreev <co...@ec...> |
|
From: <sj...@us...> - 2002-07-19 18:05:04
|
Update of /cvsroot/ap-python/python/examples/aptk
In directory usw-pr-cvs1:/tmp/cvs-serv25233
Modified Files:
gtkplayer.py panel.py playlist.py
Log Message:
Rewrite for new properties theme.
Index: gtkplayer.py
===================================================================
RCS file: /cvsroot/ap-python/python/examples/aptk/gtkplayer.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** gtkplayer.py 6 Jul 2002 16:09:36 -0000 1.5
--- gtkplayer.py 19 Jul 2002 18:04:56 -0000 1.6
***************
*** 27,30 ****
--- 27,55 ----
import alsaplayer, aptk, gtk, GTK
+ # Properties for widgets
+ properties = {
+ "control.play.button.xpmfile" : "play-sm.xpm",
+ "control.play.button.relief" : GTK.RELIEF_NONE,
+ "control.next.button.xpmfile" : "next-sm.xpm",
+ "control.next.button.relief" : GTK.RELIEF_NONE,
+ "control.prev.button.xpmfile" : "prev-sm.xpm",
+ "control.prev.button.relief" : GTK.RELIEF_NONE,
+ "control.stop.button.xpmfile" : "prev-sm.xpm",
+ "control.stop.button.relief" : GTK.RELIEF_NONE,
+ "tagslabel.format" : "%a - %t",
+ "speed.pause.button.xpmfile" : "pause.xpm",
+ "speed.pause.button.relief" : GTK.RELIEF_NONE,
+ "speed.forward.button.xpmfile" : "f_play.xpm",
+ "speed.forward.button.relief" : GTK.RELIEF_NONE,
+ "speed.backward.button.xpmfile" : "r_play.xpm",
+ "speed.backward.button.relief" : GTK.RELIEF_NONE,
+ "pan.left.button.xpmfile" : "l_pan.xpm",
+ "pan.left.button.relief" : GTK.RELIEF_NONE,
+ "pan.center.button.xpmfile" : "c_pan.xpm",
+ "pan.center.button.relief" : GTK.RELIEF_NONE,
+ "pan.right.button.xpmfile" : "r_pan.xpm",
+ "pan.right.button.relief" : GTK.RELIEF_NONE,
+ }
+
pl = alsaplayer.get_playlist ()
cp = pl.get_coreplayer ()
***************
*** 42,69 ****
##########################################################
position = aptk.position.HScale (cp)
!
! tagslabel = aptk.info.TagsLabel (cp, "%a - %t")
!
fullstatusbox = aptk.info.FullStatusHBox (cp, position)
!
! control = aptk.control.HControl (pl, play_xpmfile = "play.xpm",
! next_xpmfile = "next.xpm",
! prev_xpmfile = "prev.xpm",
! stop_xpmfile = "stop.xpm",
! relief=GTK.RELIEF_NONE,
! window=win)
!
! speed = aptk.speed.HSpeed (cp, pause_xpmfile = "pause.xpm",
! forward_xpmfile = "f_play.xpm",
! backward_xpmfile = "r_play.xpm",
! relief=GTK.RELIEF_NONE,
! window=win)
!
! pan = aptk.pan.HPan (cp, left_xpmfile="l_pan.xpm",
! right_xpmfile="r_pan.xpm",
! center_xpmfile="c_pan.xpm",
! relief=GTK.RELIEF_NONE,
! window=win)
!
volume = aptk.volume.HVolume (cp)
--- 67,75 ----
##########################################################
position = aptk.position.HScale (cp)
! tagslabel = aptk.info.TagsLabel (cp, properties)
fullstatusbox = aptk.info.FullStatusHBox (cp, position)
! control = aptk.control.HControl (pl, properties)
! speed = aptk.speed.HSpeed (cp, properties)
! pan = aptk.pan.HPan (cp, properties)
volume = aptk.volume.HVolume (cp)
Index: panel.py
===================================================================
RCS file: /cvsroot/ap-python/python/examples/aptk/panel.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** panel.py 6 Jul 2002 16:10:29 -0000 1.3
--- panel.py 19 Jul 2002 18:04:56 -0000 1.4
***************
*** 29,32 ****
--- 29,58 ----
pl = alsaplayer.get_playlist ()
+ ##############################################################################
+ # Properties for widgets
+ properties = {
+ "control.play.button.xpmfile" : "play-sm.xpm",
+ "control.play.button.relief" : GTK.RELIEF_NONE,
+ "control.next.button.xpmfile" : "next-sm.xpm",
+ "control.next.button.relief" : GTK.RELIEF_NONE,
+ "control.prev.button.xpmfile" : "prev-sm.xpm",
+ "control.prev.button.relief" : GTK.RELIEF_NONE,
+ "control.stop.button.xpmfile" : "prev-sm.xpm",
+ "control.stop.button.relief" : GTK.RELIEF_NONE,
+ "tagslabel.format" : "%a - %t (%y - %l)",
+ "speed.pause.button.xpmfile" : "pause.xpm",
+ "speed.pause.button.relief" : GTK.RELIEF_NONE,
+ "speed.forward.button.xpmfile" : "f_play.xpm",
+ "speed.forward.button.relief" : GTK.RELIEF_NONE,
+ "speed.backward.button.xpmfile" : "r_play.xpm",
+ "speed.backward.button.relief" : GTK.RELIEF_NONE,
+ "pan.left.button.xpmfile" : "l_pan.xpm",
+ "pan.left.button.relief" : GTK.RELIEF_NONE,
+ "pan.center.button.xpmfile" : "c_pan.xpm",
+ "pan.center.button.relief" : GTK.RELIEF_NONE,
+ "pan.right.button.xpmfile" : "r_pan.xpm",
+ "pan.right.button.relief" : GTK.RELIEF_NONE,
+ }
+
##########################################################
# Main window
***************
*** 53,68 ****
# - - - - - aptk widgets
! control = aptk.control.HControl (pl, play_xpmfile = "play-sm.xpm",
! next_xpmfile = "next-sm.xpm",
! prev_xpmfile = "prev-sm.xpm",
! stop_xpmfile = "stop-sm.xpm",
! relief=GTK.RELIEF_NONE,
! window=win)
!
! tagslabel = aptk.info.TagsLabel (cp, "%a - %t (%y - %l)")
status = aptk.info.FullStatusHBox (cp)
status.set_spacing (20)
- self.control_widget = control
# - - - - Frames
--- 79,87 ----
# - - - - - aptk widgets
! control = aptk.control.HControl (pl, properties)
! tagslabel = aptk.info.TagsLabel (cp, properties)
status = aptk.info.FullStatusHBox (cp)
status.set_spacing (20)
# - - - - Frames
***************
*** 89,92 ****
--- 108,114 ----
status_frame.show ()
+ # Remember
+ self.control_widget = control
+
##############################################################################
##############################################################################
***************
*** 101,126 ****
# - - - - - aptk widgets
! control = aptk.control.HControl (pl, play_xpmfile = "play-sm.xpm",
! next_xpmfile = "next-sm.xpm",
! prev_xpmfile = "prev-sm.xpm",
! stop_xpmfile = "stop-sm.xpm",
! relief=GTK.RELIEF_NONE,
! window=win)
!
position = aptk.position.HScale (cp)
!
! time_label = aptk.info.TimeLabel (cp, position)
!
! speed = aptk.speed.HSpeed (cp, pause_xpmfile = "pause.xpm",
! forward_xpmfile = "f_play.xpm",
! backward_xpmfile = "r_play.xpm",
! relief=GTK.RELIEF_NONE,
! window=win)
!
! pan = aptk.pan.HPan (cp, left_xpmfile="l_pan.xpm",
! right_xpmfile="r_pan.xpm",
! center_xpmfile="c_pan.xpm",
! relief=GTK.RELIEF_NONE,
! window=win)
volume = aptk.volume.HVolume (cp)
--- 123,131 ----
# - - - - - aptk widgets
! control = aptk.control.HControl (pl, properties)
position = aptk.position.HScale (cp)
! time_label = aptk.info.TimeLabel (cp, position)
! speed = aptk.speed.HSpeed (cp, properties)
! pan = aptk.pan.HPan (cp, properties)
volume = aptk.volume.HVolume (cp)
Index: playlist.py
===================================================================
RCS file: /cvsroot/ap-python/python/examples/aptk/playlist.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** playlist.py 19 Jul 2002 07:36:11 -0000 1.3
--- playlist.py 19 Jul 2002 18:04:56 -0000 1.4
***************
*** 28,42 ****
#####################################################################
! playlist_properties = {
! 'columns' : ['current', 'playtime', 'track', 'title', 'album', 'artist', 'year', 'genre'],
! 'title for playtime' : ("playtime.xpm",),
! 'title for track' : ("track.xpm",),
! 'title for title' : 'Title',
! 'title for current' : ' ',
! 'title for album' : 'Album',
! 'title for artist' : 'Artist',
! 'title for year' : 'Year',
! 'title for genre' : 'Genre',
! 'mark for current' : ("current_play.xpm",)
}
--- 28,43 ----
#####################################################################
! properties = {
! 'playlist.columns' : ['current', 'playtime', 'track', 'title',
! 'album', 'artist', 'year', 'genre'],
! 'playlist.title.playtime' : ("playtime.xpm",),
! 'playlist.title.track' : ("track.xpm",),
! 'playlist.title.title' : 'Title',
! 'playlist.title.current' : ' ',
! 'playlist.title.album' : 'Album',
! 'playlist.title.artist' : 'Artist',
! 'playlist.title.year' : 'Year',
! 'playlist.title.genre' : 'Genre',
! 'playlist.current.mark' : ("current_play.xpm",)
}
***************
*** 48,52 ****
gtk.mainquit ();
! win = aptk.playlist.PlaylistWindow (pl, playlist_properties)
win.connect ("delete_event", delete_event)
win.show ()
--- 49,53 ----
gtk.mainquit ();
! win = aptk.playlist.PlaylistWindow (pl, properties)
win.connect ("delete_event", delete_event)
win.show ()
|
|
From: <sj...@us...> - 2002-07-19 18:04:19
|
Update of /cvsroot/ap-python/python/aptk
In directory usw-pr-cvs1:/tmp/cvs-serv24953
Modified Files:
control.py info.py misc.py pan.py playlist.py speed.py
Log Message:
Rewrite all widget for new properties theme. (playlist widget is broken now).
Index: control.py
===================================================================
RCS file: /cvsroot/ap-python/python/aptk/control.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** control.py 6 Jul 2002 16:08:10 -0000 1.4
--- control.py 19 Jul 2002 18:04:13 -0000 1.5
***************
*** 32,107 ****
# - - - - - - - - - - - - - - - Buttons - - - - - - - - -
! class _Button (aptk.misc.Button):
! """Internal."""
!
! def __init__ (self, pl, **keys):
! aptk.misc.Button.__init__ (self, **keys)
! self.connect ("clicked", self._cb_clicked)
! self._pl = pl
!
! class PlayButton (_Button):
"""Start playback.
-
- This class takes playlist object as first argument.
- Optional arguments are same as for
- "misc.Button":misc_Button.py.html#__init__.
-
- Example::
-
- button = PlayButton (alsaplayer.get_playlist(), label="Play")
"""
! def _cb_clicked (self, w):
gtk.threads_leave ()
! self._pl.play (self._pl.get_current ())
gtk.threads_enter ()
! class NextButton (_Button):
"""Move to next song.
-
- This class takes playlist object as first argument.
- Optional arguments are same as for
- "misc.Button":misc_Button.py.html#__init__.
-
- Example::
-
- button = NextButton (alsaplayer.get_playlist(), label="Next")
"""
! def _cb_clicked (self, w):
gtk.threads_leave ()
! self._pl.next ()
gtk.threads_enter ()
! class PrevButton (_Button):
"""Move to previous song.
-
- This class takes playlist object as first argument.
- Optional arguments are same as for
- "misc.Button":misc_Button.py.html#__init__.
-
- Example::
-
- button = PrevButton (alsaplayer.get_playlist(), label="Prev")
"""
!
! def _cb_clicked (self, w):
gtk.threads_leave ()
! self._pl.prev ()
gtk.threads_enter ()
! class StopButton (_Button):
"""Stop playback.
! This class takes playlist object as first argument.
! Optional arguments are same as for
! "misc.Button":misc_Button.py.html#__init__.
!
! Example::
! button = StopButton (alsaplayer.get_playlist(), label="Stop")
! """
! def _cb_clicked (self, w):
gtk.threads_leave ()
self._pl.stop ()
--- 32,115 ----
# - - - - - - - - - - - - - - - Buttons - - - - - - - - -
! class PlayButton (aptk.misc.Button):
"""Start playback.
"""
+
+ def __init__ (self, pl, prop = None, strip = ""):
+ """Initializer."""
+
+ # Create strip string for this class
+ this_strip = (strip and strip + ".") + 'play'
+
+ # Call base contructor
+ aptk.misc.Button.__init__ (self, prop, this_strip)
+
+ self.connect ("clicked", self.__cb_clicked)
+ self.__pl = pl
! def __cb_clicked (self, w):
gtk.threads_leave ()
! self.__pl.play (self._pl.get_current ())
gtk.threads_enter ()
! class NextButton (aptk.misc.Button):
"""Move to next song.
"""
! def __init__ (self, pl, prop = None, strip = ""):
! """Initializer."""
!
! # Create strip string for this class
! this_strip = (strip and strip + ".") + 'next'
!
! # Call base contructor
! aptk.misc.Button.__init__ (self, prop, this_strip)
!
! self.connect ("clicked", self.__cb_clicked)
! self.__pl = pl
!
! def __cb_clicked (self, w):
gtk.threads_leave ()
! self.__pl.next ()
gtk.threads_enter ()
! class PrevButton (aptk.misc.Button):
"""Move to previous song.
"""
!
! def __init__ (self, pl, prop = None, strip = ""):
! """Initializer."""
!
! # Create strip string for this class
! this_strip = (strip and strip + ".") + 'prev'
!
! # Call base contructor
! aptk.misc.Button.__init__ (self, prop, this_strip)
!
! self.connect ("clicked", self.__cb_clicked)
! self.__pl = pl
!
! def __cb_clicked (self, w):
gtk.threads_leave ()
! self.__pl.prev ()
gtk.threads_enter ()
! class StopButton (aptk.misc.Button):
"""Stop playback.
+ """
! def __init__ (self, pl, prop = None, strip = ""):
! """Initializer."""
! # Create strip string for this class
! this_strip = (strip and strip + ".") + 'stop'
!
! # Call base contructor
! aptk.misc.Button.__init__ (self, prop, this_strip)
!
! self.connect ("clicked", self.__cb_clicked)
! self.__pl = pl
! def __cb_clicked (self, w):
gtk.threads_leave ()
self._pl.stop ()
***************
*** 112,130 ****
"""Internal."""
! def __init__ (self, pl, prev_label=None, prev_xpmfile=None,
! play_label=None, play_xpmfile=None,
! stop_label=None, stop_xpmfile=None,
! next_label=None, next_xpmfile=None, **keys):
! self.prev_button = PrevButton (pl, label=prev_label, xpmfile=prev_xpmfile, **keys)
self.add (self.prev_button)
! self.play_button = PlayButton (pl, label=play_label, xpmfile=play_xpmfile, **keys)
self.add (self.play_button)
! self.stop_button = StopButton (pl, label=stop_label, xpmfile=stop_xpmfile, **keys)
self.add (self.stop_button)
! self.next_button = NextButton (pl, label=next_label, xpmfile=next_xpmfile, **keys)
self.add (self.next_button)
--- 120,140 ----
"""Internal."""
! def __init__ (self, pl, prop = None, strip = ""):
! """Initializeer."""
! # Create strip string for this class
! this_strip = (strip and strip + ".") + 'control'
!
! # Create buttons
! self.prev_button = PrevButton (pl, prop, this_strip)
self.add (self.prev_button)
! self.play_button = PlayButton (pl, prop, this_strip)
self.add (self.play_button)
! self.stop_button = StopButton (pl, prop, this_strip)
self.add (self.stop_button)
! self.next_button = NextButton (pl, prop, this_strip)
self.add (self.next_button)
***************
*** 139,231 ****
This widget provided to create typical control panel.
- **Example**::
-
- box = HBox (alsaplayer.get_playlist(), prev_label="Prev",
- play_label="Play",
- stop_label="Stop",
- next_label="Next")
"""
! def __init__ (self, pl, prev_label=None, prev_xpmfile=None,
! play_label=None, play_xpmfile=None,
! stop_label=None, stop_xpmfile=None,
! next_label=None, next_xpmfile=None, **keys):
"""Initialize the HBox.
-
- Parameters:
-
- 'prev_label' -- text label for button which sets previous song as current.
-
- 'prev_xpmfile' -- xpm file name for button which sets previous song as current.
-
- 'play_label' -- text label for button which starts playback.
-
- 'play_xpmfile' -- xpm file name for button which starts playback.
-
- 'stop_label' -- text label for button which stops playback.
-
- 'stop_xpmfile' -- xpm file name for button which stops playback.
-
- 'next_label' -- text label for button which sets next song as current.
-
- 'next_xpmfile' -- xpm file name for button which sets next song as current.
-
- '**keys' -- additional, optional values for
- "misc.Button":misc_Button.py.html#__init__.
"""
gtk.GtkHBox.__init__ (self)
! _Box.__init__ (self, pl, prev_label=prev_label, prev_xpmfile=prev_xpmfile,
! play_label=play_label, play_xpmfile=play_xpmfile,
! stop_label=stop_label, stop_xpmfile=stop_xpmfile,
! next_label=next_label, next_xpmfile=next_xpmfile,
! **keys)
class VBox (gtk.GtkVBox, _Box):
"""Vertical box of all control buttons.
This widget provided to create typical control panel.
-
- **Example**::
-
- box = VBox (alsaplayer.get_playlist(), prev_label="Prev",
- play_label="Play",
- stop_label="Stop",
- next_label="Next")
"""
! def __init__ (self, pl, prev_label=None, prev_xpmfile=None,
! play_label=None, play_xpmfile=None,
! stop_label=None, stop_xpmfile=None,
! next_label=None, next_xpmfile=None, **keys):
"""Initialize the VBox.
-
- Parameters::
-
- 'prev_label' -- text label for button which sets previous song as current.
-
- 'prev_xpmfile' -- xpm file name for button which sets previous song as current.
-
- 'play_label' -- text label for button which starts playback.
-
- 'play_xpmfile' -- xpm file name for button which starts playback.
-
- 'stop_label' -- text label for button which stops playback.
-
- 'stop_xpmfile' -- xpm file name for button which stops playback.
-
- 'next_label' -- text label for button which sets next song as current.
-
- 'next_xpmfile' -- xpm file name for button which sets next song as current.
-
- '**keys' -- additional, optional values for
- "misc.Button":misc_Button.py.html#__init__.
"""
gtk.GtkVBox.__init__ (self)
! _Box.__init__ (self, pl, prev_label=prev_label, prev_xpmfile=prev_xpmfile,
! play_label=play_label, play_xpmfile=play_xpmfile,
! stop_label=stop_label, stop_xpmfile=stop_xpmfile,
! next_label=next_label, next_xpmfile=next_xpmfile,
! **keys)
--- 149,172 ----
This widget provided to create typical control panel.
"""
! def __init__ (self, pl, prop = None, strip = ""):
"""Initialize the HBox.
"""
gtk.GtkHBox.__init__ (self)
! _Box.__init__ (self, pl, prop, strip)
class VBox (gtk.GtkVBox, _Box):
"""Vertical box of all control buttons.
This widget provided to create typical control panel.
"""
! def __init__ (self, pl, prop = None, strip = ""):
"""Initialize the VBox.
"""
gtk.GtkVBox.__init__ (self)
! _Box.__init__ (self, pl, prop, relief = relief)
Index: info.py
===================================================================
RCS file: /cvsroot/ap-python/python/aptk/info.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** info.py 6 Jul 2002 16:08:10 -0000 1.5
--- info.py 19 Jul 2002 18:04:13 -0000 1.6
***************
*** 141,146 ****
--- 141,151 ----
self.time_label.show ()
+ #############################################################################
class TagsLabel (gtk.GtkLabel):
+ properties = {
+ "format" : "%a - %t (%y - %l)"
+ }
+
ch = {
't' : 'si.title',
***************
*** 155,162 ****
}
! def __init__ (self, cp, format):
"""Create instance label which will show tags info accordance with format string.
- Format of the 'format' variable is similar to mp3info -p format.
"""
gtk.GtkLabel.__init__ (self, "")
--- 160,172 ----
}
! def __init__ (self, cp, prop = None, strip = ""):
"""Create instance label which will show tags info accordance with format string.
"""
+
+ # Create strip string for this class
+ this_strip = (strip and strip + ".") + 'tagslabel'
+
+ # Get properties
+ format = aptk.misc.get_property (self.properties, prop, 'format', this_strip)
gtk.GtkLabel.__init__ (self, "")
Index: misc.py
===================================================================
RCS file: /cvsroot/ap-python/python/aptk/misc.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** misc.py 11 May 2002 00:01:09 -0000 1.1
--- misc.py 19 Jul 2002 18:04:13 -0000 1.2
***************
*** 24,41 ****
__license__ = "GNU"
-
import gtk
class Button (gtk.GtkButton):
! def __init__ (self, label=None, xpmfile=None, window=None, relief=None):
! gtk.GtkButton.__init__ (self, label)
! if xpmfile:
! data = gtk.create_pixmap_from_xpm (window, None, xpmfile)
! pixmap = gtk.GtkPixmap (*data)
! pixmap.show ()
! self.add (pixmap)
! if relief:
self.set_relief (relief)
--- 24,80 ----
__license__ = "GNU"
import gtk
+ ######################################################################
+ # Work with properties
+
+ def get_property (default_prop, prop, key, strip = ""):
+ fullkey = (strip and strip + ".") + key
+
+ if prop and prop.has_key (fullkey): return prop [fullkey]
+ else: return default_prop [key]
+
+ ######################################################################
+ # Button
+
class Button (gtk.GtkButton):
! properties = {
! "relief" : None,
! "label" : None,
! "xpmfile" : None
! }
!
! def __init__ (self, prop = None, strip = ""):
! """Create button."""
! # Create strip string for this class
! this_strip = (strip and strip + ".") + 'button'
! # Get properties
! label = get_property (self.properties, prop, 'label', this_strip)
! xpmfile = get_property (self.properties, prop, 'xpmfile', this_strip)
! relief = get_property (self.properties, prop, 'relief', this_strip)
! # Remember this. We will load xpm file after a parent will be set
! self.__xpmfile = xpmfile
! self.__pixmap = None
!
! # Create button
! gtk.GtkButton.__init__ (self, label)
!
! if relief is not None:
self.set_relief (relief)
+
+ # Connect signals
+ self.connect ("parent_set", self.__gtkcb_parent_set)
+
+ def __gtkcb_parent_set (self, w, old_parent):
+ """Calling by gtk if a parent is setted up."""
+
+ # We have no picture to add or a picture already added
+ if self.__pixmap or self.__xpmfile is None: return
+
+ # Create Pixmap
+ self.__pixmap = gtk.GtkPixmap (self, self.__xpmfile)
+ self.add (self.__pixmap)
+ self.__pixmap.show ()
Index: pan.py
===================================================================
RCS file: /cvsroot/ap-python/python/aptk/pan.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** pan.py 6 Jul 2002 16:08:10 -0000 1.3
--- pan.py 19 Jul 2002 18:04:13 -0000 1.4
***************
*** 83,92 ****
# - - - - - - - - - Button ---------------------------------------------------
class Button (aptk.misc.Button):
! def __init__ (self, cp, value, **keys):
! aptk.misc.Button.__init__ (self, **keys)
self.connect ("clicked", self.__cb_clicked)
self.__value = value
self.__cp = cp
def __cb_clicked (self, w):
gtk.threads_leave ()
--- 83,100 ----
# - - - - - - - - - Button ---------------------------------------------------
class Button (aptk.misc.Button):
! def __init__ (self, cp, value, prop = None, strip = ""):
! """Intitializer."""
!
! # Call base class initializer
! aptk.misc.Button.__init__ (self, prop, strip)
!
! # Connect signals
self.connect ("clicked", self.__cb_clicked)
+
+ # Remember
self.__value = value
self.__cp = cp
+
def __cb_clicked (self, w):
gtk.threads_leave ()
***************
*** 96,109 ****
# - - - - - - - - - - - - - - - Boxes - - - - - - - - - -
class _Box:
! def __init__ (self, cp, left_label=None, left_xpmfile=None,
! center_label=None, center_xpmfile=None,
! right_label=None, right_xpmfile=None, **keys):
! self.left_button = Button (cp, -100, label=left_label, xpmfile=left_xpmfile, **keys)
self.add (self.left_button)
! self.center_button = Button (cp, 0, label=center_label, xpmfile=center_xpmfile, **keys)
self.add (self.center_button)
! self.right_button = Button (cp, 100, label=right_label, xpmfile=right_xpmfile, **keys)
self.add (self.right_button)
--- 104,121 ----
# - - - - - - - - - - - - - - - Boxes - - - - - - - - - -
class _Box:
! def __init__ (self, cp, prop = None, strip = ""):
! """Inititalizer."""
!
! # Create strip string for this class
! this_strip = (strip and strip + ".") + 'pan'
!
! # Create buttons
! self.left_button = Button (cp, -100, prop, this_strip + ".left")
self.add (self.left_button)
! self.center_button = Button (cp, 0, prop, this_strip + ".center")
self.add (self.center_button)
! self.right_button = Button (cp, 100, prop, this_strip + ".right")
self.add (self.right_button)
***************
*** 114,133 ****
class HBox (gtk.GtkHBox, _Box):
! def __init__ (self, cp, **keys):
gtk.GtkHBox.__init__ (self)
! _Box.__init__ (self, cp, **keys)
class VBox (gtk.GtkVBox, _Box):
! def __init__ (self, cp, **keys):
gtk.GtkVBox.__init__ (self)
! _Box.__init__ (self, cp, **keys)
# - - - - - - - - - - - - - Final Widgets
class HPan (gtk.GtkHBox):
! def __init__ (self, cp, **keys):
gtk.GtkHBox.__init__ (self)
! box = HBox (cp, **keys)
scale = HScale (cp)
--- 126,145 ----
class HBox (gtk.GtkHBox, _Box):
! def __init__ (self, cp, prop = None, strip = ""):
gtk.GtkHBox.__init__ (self)
! _Box.__init__ (self, cp, prop, strip)
class VBox (gtk.GtkVBox, _Box):
! def __init__ (self, cp, prop = None, strip = ""):
gtk.GtkVBox.__init__ (self)
! _Box.__init__ (self, cp, prop, strip)
# - - - - - - - - - - - - - Final Widgets
class HPan (gtk.GtkHBox):
! def __init__ (self, cp, prop = None, strip = ""):
gtk.GtkHBox.__init__ (self)
! box = HBox (cp, prop, strip)
scale = HScale (cp)
***************
*** 139,146 ****
class VPan (gtk.GtkVBox):
! def __init__ (self, cp, **keys):
gtk.GtkVBox.__init__ (self)
! box = VBox (cp, **keys)
scale = VScale (cp)
--- 151,158 ----
class VPan (gtk.GtkVBox):
! def __init__ (self, cp, prop = None, strip = ""):
gtk.GtkVBox.__init__ (self)
! box = VBox (cp, prop, strip)
scale = VScale (cp)
Index: playlist.py
===================================================================
RCS file: /cvsroot/ap-python/python/aptk/playlist.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** playlist.py 19 Jul 2002 07:34:03 -0000 1.3
--- playlist.py 19 Jul 2002 18:04:13 -0000 1.4
***************
*** 119,144 ****
###############################################################################
- default_properties = {
- 'columns' : ['current', 'playtime', 'track', 'title', 'album', 'artist', 'year', 'genre'],
- 'title for playtime' : 'Playtime',
- 'title for track' : 'Track',
- 'title for title' : 'Title',
- 'title for current' : ' ',
- 'title for album' : 'Album',
- 'title for artist' : 'Artist',
- 'title for year' : 'Year',
- 'title for genre' : 'Genre',
- 'mark for current' : '*'
- }
-
class PlaylistWindow (gtk.GtkWindow):
def __init__ (self, pl, prop):
"""Initializer."""
! # Helper function
def prop_value (key, prop=prop):
if prop.has_key (key): return prop [key]
else: return default_properties [key]
!
# Remember
self.pl = pl
--- 119,145 ----
###############################################################################
class PlaylistWindow (gtk.GtkWindow):
+ properties = {
+ 'playlist.columns' : ['current', 'playtime', 'track', 'title',
+ 'album', 'artist', 'year', 'genre'],
+ 'playlist.title.playtime' : ("playtime.xpm",),
+ 'playlist.title.track' : ("track.xpm",),
+ 'playlist.title.title' : 'Title',
+ 'playlist.title.current' : ' ',
+ 'playlist.title.album' : 'Album',
+ 'playlist.title.artist' : 'Artist',
+ 'playlist.title.year' : 'Year',
+ 'playlist.title.genre' : 'Genre',
+ 'playlist.current.mark' : ("current_play.xpm",)
+ }
+
def __init__ (self, pl, prop):
"""Initializer."""
! # Helper function. Get value from given properties or even from default
def prop_value (key, prop=prop):
if prop.has_key (key): return prop [key]
else: return default_properties [key]
!
# Remember
self.pl = pl
***************
*** 153,156 ****
--- 154,158 ----
self.vbox.show ()
+ # LIST - - - - - - - - - -- - - - - - - - - - - - - - - - - - - -
# Scrolled window for list
self.scrolled = gtk.GtkScrolledWindow ()
***************
*** 175,181 ****
self.list.column_titles_passive ()
! # Create pixmap to mark the current song
self.current_mark = prop_value ('mark for current')
# Register new playlist interface
pl.register (self)
--- 177,186 ----
self.list.column_titles_passive ()
! # Create mark for the current song
self.current_mark = prop_value ('mark for current')
+ # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --
+
+ # - -- - - - - - - - - - - - - - - - - -- - - - - - - - - - - - -
# Register new playlist interface
pl.register (self)
Index: speed.py
===================================================================
RCS file: /cvsroot/ap-python/python/aptk/speed.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** speed.py 6 Jul 2002 16:08:10 -0000 1.3
--- speed.py 19 Jul 2002 18:04:13 -0000 1.4
***************
*** 83,93 ****
# - - - - - - - - - Button ---------------------------------------------------
class Button (aptk.misc.Button):
! def __init__ (self, cp, value, **keys):
! aptk.misc.Button.__init__ (self, **keys)
self.connect ("clicked", self.__cb_clicked)
self.__value = value
self.__cp = cp
-
def __cb_clicked (self, w):
gtk.threads_leave ()
--- 83,99 ----
# - - - - - - - - - Button ---------------------------------------------------
class Button (aptk.misc.Button):
! def __init__ (self, cp, value, prop = None, strip = ""):
! """Intitializer."""
!
! # Call base class initializer
! aptk.misc.Button.__init__ (self, prop, strip)
!
! # Connect signals
self.connect ("clicked", self.__cb_clicked)
+
+ # Remember
self.__value = value
self.__cp = cp
def __cb_clicked (self, w):
gtk.threads_leave ()
***************
*** 97,111 ****
# - - - - - - - - - - - - - - - Boxes - - - - - - - - - -
class _Box:
! def __init__ (self, cp, pause_label=None, pause_xpmfile=None,
! backward_label=None, backward_xpmfile=None,
! forward_label=None, forward_xpmfile=None, **keys):
!
! self.backward_button = Button (cp, -1, label=backward_label, xpmfile=backward_xpmfile, **keys)
self.add (self.backward_button)
! self.pause_button = Button (cp, 0, label=pause_label, xpmfile=pause_xpmfile, **keys)
self.add (self.pause_button)
! self.forward_button = Button (cp, 1, label=forward_label, xpmfile=forward_xpmfile, **keys)
self.add (self.forward_button)
--- 103,120 ----
# - - - - - - - - - - - - - - - Boxes - - - - - - - - - -
class _Box:
! def __init__ (self, cp, prop = None, strip = ""):
! """Inititalizer."""
!
! # Create strip string for this class
! this_strip = (strip and strip + ".") + 'speed'
!
! # Create buttons
! self.backward_button = Button (cp, -1, prop, this_strip + ".backward")
self.add (self.backward_button)
! self.pause_button = Button (cp, 0, prop, this_strip + ".pause")
self.add (self.pause_button)
! self.forward_button = Button (cp, 1, prop, this_strip + ".forward")
self.add (self.forward_button)
***************
*** 116,135 ****
class HBox (gtk.GtkHBox, _Box):
! def __init__ (self, cp, **keys):
gtk.GtkHBox.__init__ (self)
! _Box.__init__ (self, cp, **keys)
class VBox (gtk.GtkVBox, _Box):
! def __init__ (self, cp, **keys):
gtk.GtkVBox.__init__ (self)
! _Box.__init__ (self, cp, **keys)
# - - - - - - - - - - - - - Final Widgets - - - - - - - - - - - - - - -
class HSpeed (gtk.GtkHBox):
! def __init__ (self, cp, **keys):
gtk.GtkHBox.__init__ (self)
! box = HBox (cp, **keys)
scale = HScale (cp)
--- 125,144 ----
class HBox (gtk.GtkHBox, _Box):
! def __init__ (self, cp, prop = None, strip = ""):
gtk.GtkHBox.__init__ (self)
! _Box.__init__ (self, cp, prop, strip)
class VBox (gtk.GtkVBox, _Box):
! def __init__ (self, cp, prop = None, strip = ""):
gtk.GtkVBox.__init__ (self)
! _Box.__init__ (self, cp, prop, strip)
# - - - - - - - - - - - - - Final Widgets - - - - - - - - - - - - - - -
class HSpeed (gtk.GtkHBox):
! def __init__ (self, cp, prop = None, strip = ""):
gtk.GtkHBox.__init__ (self)
! box = HBox (cp, prop, strip)
scale = HScale (cp)
***************
*** 141,148 ****
class VSpeed (gtk.GtkVBox):
! def __init__ (self, cp, **keys):
gtk.GtkVBox.__init__ (self)
! box = VBox (cp, **keys)
scale = VScale (cp)
--- 150,157 ----
class VSpeed (gtk.GtkVBox):
! def __init__ (self, cp, prop = None, strip = ""):
gtk.GtkVBox.__init__ (self)
! box = VBox (cp, prop, strip)
scale = VScale (cp)
|
|
From: <sj...@us...> - 2002-07-19 07:36:52
|
Update of /cvsroot/ap-python/python/aptk In directory usw-pr-cvs1:/tmp/cvs-serv31265/aptk Modified Files: ChangeLog Log Message: ChangeLog updated. Index: ChangeLog =================================================================== RCS file: /cvsroot/ap-python/python/aptk/ChangeLog,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** ChangeLog 16 Jul 2002 17:12:45 -0000 1.10 --- ChangeLog 19 Jul 2002 07:36:48 -0000 1.11 *************** *** 1,2 **** --- 1,11 ---- + 2002-07-19 07:34 Evgeny Chukreev <co...@ec...> + + * playlist.py: New properties theme for playlist widget. + + 2002-07-18 09:16 Evgeny Chukreev <co...@ec...> + + * playlist.py: Add ability to mark currently playing song at + playlist window. + 2002-07-16 17:08 Evgeny Chukreev <co...@ec...> |
|
From: <sj...@us...> - 2002-07-19 07:36:52
|
Update of /cvsroot/ap-python/python/examples/aptk In directory usw-pr-cvs1:/tmp/cvs-serv31265/examples/aptk Modified Files: ChangeLog Log Message: ChangeLog updated. Index: ChangeLog =================================================================== RCS file: /cvsroot/ap-python/python/examples/aptk/ChangeLog,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** ChangeLog 16 Jul 2002 17:12:46 -0000 1.8 --- ChangeLog 19 Jul 2002 07:36:48 -0000 1.9 *************** *** 1,2 **** --- 1,12 ---- + 2002-07-19 07:36 Evgeny Chukreev <co...@ec...> + + * Makefile.am, playlist.py, playtime.xpm, track.xpm: Add pixmaps + for some titles of playlist. + + 2002-07-18 09:16 Evgeny Chukreev <co...@ec...> + + * Makefile.am, current_play.xpm, playlist.py: Mark currently + playing song at playlist window. + 2002-07-16 17:11 Evgeny Chukreev <co...@ec...> |
|
From: <sj...@us...> - 2002-07-19 07:36:14
|
Update of /cvsroot/ap-python/python/examples/aptk
In directory usw-pr-cvs1:/tmp/cvs-serv30994
Modified Files:
Makefile.am playlist.py
Added Files:
playtime.xpm track.xpm
Log Message:
Add pixmaps for some titles of playlist.
--- NEW FILE: playtime.xpm ---
/* XPM */
static char * playtime_xpm[] = {
"16 16 121 2",
" c None",
". c #D0BE5B",
"+ c #DCCC64",
"@ c #C1B35C",
"# c #B6A74F",
"$ c #A19245",
"% c #9C9153",
"& c #A59C5D",
"* c #BDB460",
"= c #E2D867",
"- c #EADF67",
"; c #BFB159",
"> c #9F9144",
", c #837E63",
"' c #979695",
") c #939393",
"! c #929292",
"~ c #999999",
"{ c #93927D",
"] c #C1B761",
"^ c #D5C553",
"/ c #C0B159",
"( c #9B8C40",
"_ c #8D8A7E",
": c #9D9D9D",
"< c #838383",
"[ c #969696",
"} c #797979",
"| c #93928F",
"1 c #B7A857",
"2 c #BEA439",
"3 c #B4A44D",
"4 c #857F65",
"5 c #A3A3A3",
"6 c #9F9F9F",
"7 c #9C9C9C",
"8 c #8B8B8B",
"9 c #8A887E",
"0 c #BB9E37",
"a c #A39446",
"b c #969594",
"c c #878787",
"d c #9B9B9B",
"e c #989898",
"f c #959595",
"g c #8F8F8F",
"h c #747474",
"i c #848484",
"j c #B9A65D",
"k c #AC912D",
"l c #CCBA51",
"m c #837A45",
"n c #555555",
"o c #383838",
"p c #323232",
"q c #313131",
"r c #363636",
"s c #2F2F2F",
"t c #868686",
"u c #7C7C7C",
"v c #B8AB76",
"w c #BCA138",
"x c #D6C557",
"y c #8A824E",
"z c #151515",
"A c #131313",
"B c #1F1F1F",
"C c #1D1D1D",
"D c #2C2C2C",
"E c #696969",
"F c #818181",
"G c #7F7F7F",
"H c #6B6B6B",
"I c #BBB682",
"J c #B59E3D",
"K c #BBB25C",
"L c #4D4D4D",
"M c #292929",
"N c #282828",
"O c #3D3D3D",
"P c #7D7D7D",
"Q c #CECA85",
"R c #A1903C",
"S c #D7CC5D",
"T c #5C5B4F",
"U c #2D2D2D",
"V c #393939",
"W c #676767",
"X c #838380",
"Y c #CDC96A",
"Z c #9F903D",
"` c #D4C655",
" . c #BDB25D",
".. c #494948",
"+. c #2B2B2B",
"@. c #494949",
"#. c #585858",
"$. c #6F6F6F",
"%. c #C8C68E",
"&. c #B0A449",
"*. c #D1C04F",
"=. c #B4A554",
"-. c #5A5852",
";. c #3F3F3F",
">. c #7B7B7B",
",. c #7B7B78",
"'. c #CBC98F",
"). c #BDB453",
"!. c #C0A439",
"~. c #BEA038",
"{. c #BAA65D",
"]. c #B1A470",
"^. c #B4B07D",
"/. c #D7D389",
"(. c #DEDA71",
"_. c #BBB04E",
":. c #A88F2E",
"<. c #BCA23B",
"[. c #C3AA43",
"}. c #BCA745",
"|. c #AC9D42",
" ",
" . + ",
" @ # $ % & * = - ",
" ; > , ' ) ! ~ { ] ^ ",
" / ( _ : < ~ [ ! } | 1 2 ",
" 3 4 [ 5 6 7 ~ [ ) 8 9 0 ",
" a b c d d e f ! g h i j k ",
" l m n o p q q r s s t u v w ",
" x y p z A B C D E F G H I J ",
" K L M M N s O t < u P Q R ",
" S T N q q U V } G W X Y Z ",
" ` ...q +.M @.#.$.G %.&. ",
" *.=.-.;.V o >.,.'.). ",
" !.~.{.].^./.(._. ",
" :.<.[.}.|. ",
" "};
--- NEW FILE: track.xpm ---
/* XPM */
static char * track_xpm[] = {
"16 16 5 1",
" c None",
". c #000000",
"+ c #424242",
"@ c #545454",
"# c #373737",
" ",
" .. ",
" ... ",
" . ",
" . ++++ ",
" . + ",
" . + ",
" . + ",
" + @@@@ ",
" + @ ",
" ++++# @ ",
" @ ",
" @ ",
" @@ @ ",
" @@@ ",
" "};
Index: Makefile.am
===================================================================
RCS file: /cvsroot/ap-python/python/examples/aptk/Makefile.am,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** Makefile.am 18 Jul 2002 09:16:02 -0000 1.4
--- Makefile.am 19 Jul 2002 07:36:08 -0000 1.5
***************
*** 1,3 ****
EXTRA_DIST = c_pan.xpm f_play.xpm gtkplayer.py l_pan.xpm mute.xpm next.xpm\
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
--- 1,4 ----
EXTRA_DIST = c_pan.xpm f_play.xpm gtkplayer.py l_pan.xpm mute.xpm next.xpm\
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
Index: playlist.py
===================================================================
RCS file: /cvsroot/ap-python/python/examples/aptk/playlist.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** playlist.py 18 Jul 2002 09:16:02 -0000 1.2
--- playlist.py 19 Jul 2002 07:36:11 -0000 1.3
***************
*** 27,30 ****
--- 27,45 ----
import alsaplayer, aptk, gtk
+ #####################################################################
+ playlist_properties = {
+ 'columns' : ['current', 'playtime', 'track', 'title', 'album', 'artist', 'year', 'genre'],
+ 'title for playtime' : ("playtime.xpm",),
+ 'title for track' : ("track.xpm",),
+ 'title for title' : 'Title',
+ 'title for current' : ' ',
+ 'title for album' : 'Album',
+ 'title for artist' : 'Artist',
+ 'title for year' : 'Year',
+ 'title for genre' : 'Genre',
+ 'mark for current' : ("current_play.xpm",)
+ }
+
+ #####################################################################
pl = alsaplayer.get_playlist ()
cp = pl.get_coreplayer ()
***************
*** 33,38 ****
gtk.mainquit ();
!
! win = aptk.playlist.PlaylistWindow (pl, "current_play.xpm")
win.connect ("delete_event", delete_event)
win.show ()
--- 48,52 ----
gtk.mainquit ();
! win = aptk.playlist.PlaylistWindow (pl, playlist_properties)
win.connect ("delete_event", delete_event)
win.show ()
|