Update of /cvsroot/freevo/freevo/src/skins/main
In directory sc8-pr-cvs1:/tmp/cvs-serv20070/src/skins/main
Modified Files:
info_area.py xml_skin.py
Log Message:
Info_Area now support images as
<img src="file" x="1" y="2" width="123" height="456" />
x and y are optional and will be set to "pen position" when not specified.
width and height are also optional and defaults to the image size.
file is the filename.
<img> will define FLOAT images, not inline ones. You can simulate inline
images with <goto_pos>... Maybe someday, if needed, someone can implement it.
Index: info_area.py
===================================================================
RCS file: /cvsroot/freevo/freevo/src/skins/main/info_area.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** info_area.py 3 Oct 2003 10:55:10 -0000 1.4
--- info_area.py 21 Oct 2003 23:46:21 -0000 1.5
***************
*** 10,13 ****
--- 10,23 ----
# -----------------------------------------------------------------------
# $Log$
+ # Revision 1.5 2003/10/21 23:46:21 gsbarbieri
+ # Info_Area now support images as
+ # <img src="file" x="1" y="2" width="123" height="456" />
+ # x and y are optional and will be set to "pen position" when not specified.
+ # width and height are also optional and defaults to the image size.
+ # file is the filename.
+ #
+ # <img> will define FLOAT images, not inline ones. You can simulate inline
+ # images with <goto_pos>... Maybe someday, if needed, someone can implement it.
+ #
# Revision 1.4 2003/10/03 10:55:10 dischi
# i18n fix
***************
*** 107,118 ****
for i in list:
! if i.y + i.height > self.content.height:
! break
! self.write_text( i.text,
! i.font, self.content,
! ( self.content.x + i.x), ( self.content.y + i.y ),
! i.width , i.height,
! align_v = i.valign, align_h = i.align,
! mode = i.mode )
self.last_item = self.infoitem
--- 117,139 ----
for i in list:
! if isinstance( i, xml_skin.XML_FormatText ):
! if i.y + i.height > self.content.height:
! break
! self.write_text( i.text,
! i.font, self.content,
! ( self.content.x + i.x), ( self.content.y + i.y ),
! i.width , i.height,
! align_v = i.valign, align_h = i.align,
! mode = i.mode )
!
! elif isinstance( i, xml_skin.XML_FormatImg ):
! if i.src:
! tmp = ( self.content.x + i.x, self.content.y + i.y,
! i.width, i.height )
! self.draw_image( i.src, tmp )
! else:
! print _( "ERROR" ) + ": missing 'src' attribute in skin tag!"
!
!
self.last_item = self.infoitem
***************
*** 292,296 ****
else:
element = element[ i[ -1 ] ]
!
#
# Tag: <goto_pos>
--- 313,317 ----
else:
element = element[ i[ -1 ] ]
!
#
# Tag: <goto_pos>
***************
*** 308,311 ****
--- 329,356 ----
if element.y != None:
y = y + element.y
+ #
+ # Tag: <img>
+ #
+ elif isinstance( element, xml_skin.XML_FormatImg ):
+ # Image is a float object
+ if element.x == None:
+ element.x = x
+
+ if element.y == None:
+ element.y = y
+ else:
+ my_y = y
+
+ if element.width == None or element.height == None:
+ image = osd.loadbitmap( element.src, True )
+ size = image.get_size()
+
+ if element.width == None:
+ element.width = size[ 0 ]
+
+ if element.height == None:
+ element.height = size[ 1 ]
+
+ ret_list += [ element ]
#
***************
*** 369,373 ****
x += element.width
ret_list += [ element ]
!
# We should shrink the width and go next line (overflow)
--- 414,418 ----
x += element.width
ret_list += [ element ]
!
# We should shrink the width and go next line (overflow)
***************
*** 385,391 ****
last_line = ret_list[ last_newline : new_last_newline ]
for j in last_line:
! font = j.font
! if j.text and j.height > newline_height:
! newline_height = j.height
y = y + newline_height
last_newline = new_last_newline
--- 430,438 ----
last_line = ret_list[ last_newline : new_last_newline ]
for j in last_line:
! if isinstance( j, xml_skin.XML_FormatText ):
! font = j.font
! if j.text and j.height > newline_height:
! newline_height = j.height
!
y = y + newline_height
last_newline = new_last_newline
Index: xml_skin.py
===================================================================
RCS file: /cvsroot/freevo/freevo/src/skins/main/xml_skin.py,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** xml_skin.py 3 Oct 2003 16:46:13 -0000 1.14
--- xml_skin.py 21 Oct 2003 23:46:22 -0000 1.15
***************
*** 10,13 ****
--- 10,23 ----
# -----------------------------------------------------------------------
# $Log$
+ # Revision 1.15 2003/10/21 23:46:22 gsbarbieri
+ # Info_Area now support images as
+ # <img src="file" x="1" y="2" width="123" height="456" />
+ # x and y are optional and will be set to "pen position" when not specified.
+ # width and height are also optional and defaults to the image size.
+ # file is the filename.
+ #
+ # <img> will define FLOAT images, not inline ones. You can simulate inline
+ # images with <goto_pos>... Maybe someday, if needed, someone can implement it.
+ #
# Revision 1.14 2003/10/03 16:46:13 dischi
# moved the encoding type (latin-1) to the config file config.LOCALE
***************
*** 270,274 ****
self.outicon = attr_str(node, "outicon", self.outicon)
! def prepaire(self, search_dirs, image_names):
if self.image:
self.image = search_file(self.image, search_dirs)
--- 280,284 ----
self.outicon = attr_str(node, "outicon", self.outicon)
! def prepare(self, search_dirs, image_names):
if self.image:
self.image = search_file(self.image, search_dirs)
***************
*** 290,294 ****
def prepare(self, search_dirs, image_names):
for i in self.items:
! self.items[i].prepaire(search_dirs, image_names)
# ======================================================================
--- 300,304 ----
def prepare(self, search_dirs, image_names):
for i in self.items:
! self.items[i].prepare(search_dirs, image_names)
# ======================================================================
***************
*** 525,529 ****
def prepare(self, font, color, search_dirs, image_names):
! self.content.prepare(font, color)
for b in self.background:
b.prepare(color, search_dirs, image_names)
--- 535,539 ----
def prepare(self, font, color, search_dirs, image_names):
! self.content.prepare(font, color, search_dirs)
for b in self.background:
b.prepare(color, search_dirs, image_names)
***************
*** 562,566 ****
self.types[type].rectangle = XML_rectangle()
self.types[type].rectangle.parse(rnode, scale,
current_dir)
! elif rnode.name in ( u'if', u'text', u'newline', u'goto_pos'
):
if (not hasattr( self.types[ type ], 'fcontent' )) or \
delete_fcontent:
--- 572,576 ----
self.types[type].rectangle = XML_rectangle()
self.types[type].rectangle.parse(rnode, scale,
current_dir)
! elif rnode.name in ( u'if', u'text', u'newline',
u'goto_pos', u'img' ):
if (not hasattr( self.types[ type ], 'fcontent' )) or \
delete_fcontent:
***************
*** 576,583 ****
elif rnode.name == u'goto_pos':
child = XML_FormatGotopos()
self.types[ type ].fcontent += [ child ]
self.types[ type ].fcontent[-1].parse(rnode, scale,
current_dir)
!
if not self.types.has_key('default'):
self.types['default'] = XML_data(('font',))
--- 586,595 ----
elif rnode.name == u'goto_pos':
child = XML_FormatGotopos()
+ elif rnode.name == u'img':
+ child = XML_FormatImg()
self.types[ type ].fcontent += [ child ]
self.types[ type ].fcontent[-1].parse(rnode, scale,
current_dir)
!
if not self.types.has_key('default'):
self.types['default'] = XML_data(('font',))
***************
*** 586,590 ****
! def prepare(self, font, color):
XML_data.prepare(self)
if self.font:
--- 598,602 ----
! def prepare(self, font, color, search_dirs):
XML_data.prepare(self)
if self.font:
***************
*** 611,615 ****
if hasattr( self.types[type], 'fcontent' ):
for i in self.types[type].fcontent:
! i.prepare( font, color )
--- 623,627 ----
if hasattr( self.types[type], 'fcontent' ):
for i in self.types[type].fcontent:
! i.prepare( font, color, search_dirs )
***************
*** 642,646 ****
if self.expression: self.expression = self.expression.strip()
! def prepare(self, font, color):
if self.font:
try:
--- 654,658 ----
if self.expression: self.expression = self.expression.strip()
! def prepare(self, font, color, search_dirs):
if self.font:
try:
***************
*** 669,673 ****
self.mode = 'relative'
! def prepare(self, font, color):
pass
--- 681,685 ----
self.mode = 'relative'
! def prepare(self, font, color, search_dirs):
pass
***************
*** 679,685 ****
pass
! def prepare(self, font, color):
pass
class XML_FormatIf:
--- 691,714 ----
pass
! def prepare(self, font, color, search_dirs):
pass
+ class XML_FormatImg( XML_data ):
+ def __init__( self ):
+ XML_data.__init__( self, ( 'x', 'y', 'width', 'height' ) )
+ self.x = None
+ self.y = None
+ self.width = None
+ self.height = None
+ self.src = ''
+
+ def parse( self, node, scale, c_dir = '' ):
+ XML_data.parse( self, node, scale, c_dir )
+ self.src = attr_str( node, 'src', self.src )
+
+ def prepare(self, font, color, search_dirs ):
+ self.src = search_file( self.src, search_dirs )
+
+
class XML_FormatIf:
***************
*** 700,710 ****
elif subnode.name == u'goto_pos':
child = XML_FormatGotopos()
child.parse( subnode, scale, c_dir )
self.content += [ child ]
! def prepare(self, font, color):
for i in self.content:
! i.prepare( font, color )
--- 729,741 ----
elif subnode.name == u'goto_pos':
child = XML_FormatGotopos()
+ elif subnode.name == u'img':
+ child = XML_FormatImg()
child.parse( subnode, scale, c_dir )
self.content += [ child ]
! def prepare(self, font, color, search_dirs):
for i in self.content:
! i.prepare( font, color, search_dirs )
-------------------------------------------------------
This SF.net email is sponsored by OSDN developer relations
Here's your chance to show off your extensive product knowledge
We want to know what you know. Tell us and you have a chance to win $100
http://www.zoomerang.com/survey.zgi?HRPT1X3RYQNC5V4MLNSV3E54
_______________________________________________
Freevo-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog