[Ap-python-commits] python/aptk control.py,1.6,1.7 info.py,1.8,1.9 misc.py,1.4,1.5
Status: Beta
Brought to you by:
sjah
|
From: <sj...@us...> - 2002-07-23 09:01:57
|
Update of /cvsroot/ap-python/python/aptk
In directory usw-pr-cvs1:/tmp/cvs-serv334
Modified Files:
control.py info.py misc.py
Log Message:
Add support for locale chars in info.TagsLabel. Add playlist button to control widget.
Index: control.py
===================================================================
RCS file: /cvsroot/ap-python/python/aptk/control.py,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** control.py 21 Jul 2002 18:15:43 -0000 1.6
--- control.py 23 Jul 2002 09:01:55 -0000 1.7
***************
*** 29,33 ****
__license__ = "GNU"
! import aptk.misc, alsaplayer, gtk
gdk = gtk.gdk
--- 29,33 ----
__license__ = "GNU"
! import aptk, alsaplayer, gtk
gdk = gtk.gdk
***************
*** 145,148 ****
--- 145,170 ----
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
+ class PlaylistButton (aptk.misc.Button):
+ """Playlist playback. This button does nothing.
+ To use it, just handle its 'clicked' signal for display/hide
+ playlist window.
+ """
+
+ # Defualt properties
+ __properties = aptk.misc.WidgetProperties ([
+ ('*.playlist.button.label', 'Playlist')
+ ])
+
+ def __init__ (self, pl, prop = None, prefix = ""):
+ """Initializer."""
+
+ # Create new properties whth our defaults added
+ prop = prop and (prop + self.__properties) or self.__properties
+ prefix += ".playlist"
+
+ # Call base contructor
+ aptk.misc.Button.__init__ (self, prop, prefix)
+
+ # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
class _Box:
"""Internal."""
***************
*** 167,170 ****
--- 189,201 ----
self.add (self.next_button)
+ self.playlist_button = PlaylistButton (pl, prop, prefix)
+ self.add (self.playlist_button)
+ self.playlist_button.connect ("clicked", self.__gtkcb_playlist_clicked)
+
+ # Create playlist window
+ self.playlist_window = aptk.playlist.PlaylistWindow (pl, prop, prefix)
+ self.playlist_window_is_visible = 0
+ self.playlist_window.connect ("delete-event", self.__gtkcb_playlist_delete_event)
+
# Show all these buttons
self.prev_button.show ()
***************
*** 172,175 ****
--- 203,225 ----
self.stop_button.show ()
self.next_button.show ()
+ self.playlist_button.show ()
+
+ def __gtkcb_playlist_clicked (self, w):
+ """Playlist button click handler."""
+
+ if self.playlist_window_is_visible:
+ self.playlist_window.hide ()
+ self.playlist_window_is_visible = 0
+ else:
+ self.playlist_window.show ()
+ self.playlist_window_is_visible = 1
+
+ def __gtkcb_playlist_delete_event (self, w, event):
+ """Playlist delete event handler."""
+
+ self.playlist_window.hide ()
+ self.playlist_window_is_visible = 0
+
+ return 1
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
Index: info.py
===================================================================
RCS file: /cvsroot/ap-python/python/aptk/info.py,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** info.py 22 Jul 2002 16:26:27 -0000 1.8
--- info.py 23 Jul 2002 09:01:55 -0000 1.9
***************
*** 26,30 ****
__license__ = "GNU"
! import aptk.misc, alsaplayer, gtk
gdk = gtk.gdk
--- 26,30 ----
__license__ = "GNU"
! import aptk.misc, alsaplayer, gtk, locale
gdk = gtk.gdk
***************
*** 178,188 ****
# List of format tags
__ch = {
! 't' : 'si.title',
! 'a' : 'si.artist',
! 'l' : 'si.album',
's' : 'si.stream_type',
'g' : 'si.genre',
'y' : 'si.year',
! 'c' : 'si.comment',
'n' : 'si.track',
'u' : 'si.status'
--- 178,188 ----
# List of format tags
__ch = {
! 't' : 'si.title.decode (charset)',
! 'a' : 'si.artist.decode (charset)',
! 'l' : 'si.album.decode (charset)',
's' : 'si.stream_type',
'g' : 'si.genre',
'y' : 'si.year',
! 'c' : 'si.comment.decode (charset)',
'n' : 'si.track',
'u' : 'si.status'
***************
*** 191,195 ****
# Defualt properties
__properties = aptk.misc.WidgetProperties ([
! ('*.tagsinfo.format', '%a - %t')
])
--- 191,196 ----
# Defualt properties
__properties = aptk.misc.WidgetProperties ([
! ('*.tagsinfo.format', '%a - %t'),
! ('*.tagsinfo.charset', None)
])
***************
*** 207,210 ****
--- 208,215 ----
# Get values
fmt = prop.get_value (prefix + ".format")
+ charset = prop.get_value (prefix + ".charset")
+ if not charset:
+ charset = locale.getlocale ()[1]
+ self.__charset = charset
# Connect gtk signals
***************
*** 239,242 ****
--- 244,248 ----
# Prepare locals for dynamic code
si = self.__cp.get_stream_info ()
+ charset = self.__charset
# Get values
Index: misc.py
===================================================================
RCS file: /cvsroot/ap-python/python/aptk/misc.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** misc.py 23 Jul 2002 07:23:07 -0000 1.4
--- misc.py 23 Jul 2002 09:01:55 -0000 1.5
***************
*** 49,53 ****
key = key.replace ("*", "MiU2hLo4SpI5GN999UeSED")
key = re.escape (key)
! key = "^" + key.replace ("MiU2hLo4SpI5GN999UeSED", "[a-zA-Z]*") + "$"
return re.compile (key)
--- 49,53 ----
key = key.replace ("*", "MiU2hLo4SpI5GN999UeSED")
key = re.escape (key)
! key = "^" + key.replace ("MiU2hLo4SpI5GN999UeSED", ".*") + "$"
return re.compile (key)
***************
*** 67,71 ****
if pattern.match (key): return value
! raise AttributeError, "key is not found"
def __add__ (self, other):
--- 67,71 ----
if pattern.match (key): return value
! raise AttributeError, "key '%s' is not found" % key
def __add__ (self, other):
|