Author: duncan
Date: Sat Jun 9 08:10:34 2007
New Revision: 9677
Modified:
branches/rel-1/freevo/share/skins/main/basic.fxd
branches/rel-1/freevo/share/skins/main/bluestar.fxd
branches/rel-1/freevo/share/skins/main/blurr.fxd
branches/rel-1/freevo/share/skins/main/crystal.fxd
branches/rel-1/freevo/share/skins/main/dark.fxd
branches/rel-1/freevo/share/skins/main/info.fxd
branches/rel-1/freevo/share/skins/main/mediaportal.fxd
branches/rel-1/freevo/share/skins/main/noia.fxd
branches/rel-1/freevo/share/skins/main/rain.fxd
branches/rel-1/freevo/src/gui/Window.py
branches/rel-1/freevo/src/skin.py
branches/rel-1/freevo/src/skins/main/area.py
branches/rel-1/freevo/src/skins/main/listing_area.py
branches/rel-1/freevo/src/skins/main/tvlisting_area.py
branches/rel-1/freevo/src/skins/main/xml_skin.py
branches/rel-1/freevo/src/tv/tvguide.py
Log:
[ 1733061 ] Improved int attribute handling in xml skins
Second patch from Adam Charrett applied
This are still some incorrect calculations, but doesn't crash
so it patch can be go in for further corrections
Modified: branches/rel-1/freevo/share/skins/main/basic.fxd
==============================================================================
--- branches/rel-1/freevo/share/skins/main/basic.fxd (original)
+++ branches/rel-1/freevo/share/skins/main/basic.fxd Sat Jun 9 08:10:34 2007
@@ -90,7 +90,7 @@
<view layout="view" x="580" y="110" width="200" height="300"/>
<!-- 4. listing area: the list of all items -->
- <listing layout="listing" x="50" y="110" width="510" height="470">
+ <listing layout="listing" x="50" y="110" width="510" height="470 -
(buttonbar * (buttonbar_height + 10))">
<image x="10" y="110" width="32" height="32" label="uparrow"
filename="up.png"/>
<image x="10" y="max-32" width="32" height="32"
label="downarrow"
@@ -111,7 +111,7 @@
<!-- default description: make listing area smaller, show info area -->
<menuset label="default description" inherits="normal text style">
<listing height="370"/>
- <info visible="yes" layout="info" x="10" y="490" height="100"
width="780"/>
+ <info visible="yes" layout="info" x="10" y="490 - (buttonbar *
(buttonbar_height + 10))" height="100" width="780"/>
</menuset>
<!-- default description no image: mix between the two above -->
@@ -472,12 +472,12 @@
<image width="16" height="16" label="leftarrow"
filename="left.png"/>
<image width="16" height="16" label="rightarrow"
filename="right.png"/>
</listing>
- <info layout="tv info" x="10" y="400" width="780" height="190"/>
+ <info layout="tv info" x="10" y="400" width="780" height="190 -
buttonbar_height"/>
</menuset>
<menuset label="tv submenu" inherits="default description no image">
<screen layout="screen" visible="yes"/>
- <listing x="10" y="390" height="200">
+ <listing x="10" y="390" height="200 - buttonbar_height">
<image x="750" y="390" label="uparrow"/>
<image x="750" label="downarrow"/>
</listing>
@@ -816,7 +816,20 @@
width="780" height="80"/>
<info layout="info" x="10" y="110" width="780" height="480"/>
</headlines>
-
+ <!--
+ *******************************************************
+ ** Button Bar TVGuide Info
+ ******************************************************* -->
+
+ <tvguideinfo>
+ <screen layout="screen" x="0" y="0" width="800" height="600"/>
+ <title layout="tvguideinfo title" x="10" y="70" width="780"
height="80"/>
+ <info layout="info" x="10" y="130" width="780" height="460"/>
+ </tvguideinfo>
+
+ <layout label="tvguideinfo title">
+ <content x="0" y="0" type="menu" font="title area" align="left"
valign="center"/>
+ </layout>
</skin>
</freevo>
<!-- Keep this comment at the end of the file
Modified: branches/rel-1/freevo/share/skins/main/bluestar.fxd
==============================================================================
--- branches/rel-1/freevo/share/skins/main/bluestar.fxd (original)
+++ branches/rel-1/freevo/share/skins/main/bluestar.fxd Sat Jun 9 08:10:34 2007
@@ -140,13 +140,13 @@
<!-- default description: make listing area smaller, show info area -->
<menuset label="default description">
<listing height="340"/>
- <info x="40" y="460" width="750" height="120" />
+ <info x="40" y="460" width="750" height="120 - buttonbar_height" />
</menuset>
<!-- default description no image: mix between the two above -->
<menuset label="default description no image">
<listing height="340"/>
- <info x="40" y="460" width="750" height="120" />
+ <info x="40" y="460" width="750" height="120 - buttonbar_height" />
</menuset>
<!-- special settings for audio. The default style is an image based style
-->
@@ -184,13 +184,13 @@
<menuset label="video details" inherits="normal text style">
<subtitle layout="subtitle" x="10" y="100" width="780" height="60"/>
- <listing layout="video list" x="500" y="450" width="290" height="140">
+ <listing layout="video list" x="500" y="450" width="290" height="140-
buttonbar_height">
<image label="uparrow" filename=""/>
<image label="downarrow" filename=""/>
</listing>
<view x="545" y="150"/>
- <info layout="video info" x="10" y="160" width="480" height="430"/>
+ <info layout="video info" x="10" y="160" width="480" height="430-
buttonbar_height"/>
</menuset>
@@ -265,7 +265,7 @@
<listing y="140">
<image y="140" label="uparrow"/>
</listing>
- <info layout="tv info" y="440" height="150"/>
+ <info layout="tv info" y="440" height="150 - buttonbar_height"/>
</menuset>
<layout label="tv screen">
@@ -281,7 +281,7 @@
<listing y="140">
<image y="140" label="uparrow"/>
</listing>
- <info layout="tv info" y="290" height="290"/>
+ <info layout="tv info" y="290" height="290 - buttonbar_height"/>
</menuset>
<!-- tv info area -->
Modified: branches/rel-1/freevo/share/skins/main/blurr.fxd
==============================================================================
--- branches/rel-1/freevo/share/skins/main/blurr.fxd (original)
+++ branches/rel-1/freevo/share/skins/main/blurr.fxd Sat Jun 9 08:10:34 2007
@@ -30,7 +30,7 @@
<!-- default with description and image -->
<menuset label="default description" inherits="normal text style">
<listing height="350"/>
- <info layout="description" visible="yes" x="20" y="460"
width="760" height="130"/>
+ <info layout="description" visible="yes" x="20" y="460"
width="760" height="130 - buttonbar_height"/>
</menuset>
<!-- default with description without an image -->
@@ -99,7 +99,7 @@
<!-- 4. listing area: the list of all items -->
<screen layout="video screen" visible="yes"/>
<view layout="view" x="10" y="90" width="280" height="250"
align="left"/>
- <listing x="30" y="350" width="710" height="230">
+ <listing x="30" y="350" width="710" height="230 -
buttonbar_height">
<image filename="up.png" label="uparrow" x="750" y="350"/>
<image filename="down.png" label="downarrow" x="750"
y="max-32"/>
</listing>
@@ -241,7 +241,7 @@
<menuset label="audio" inherits="normal text style">
<screen layout="audio screen"/>
<view layout="view" x="15" y="90" width="280" height="270"/>
- <info layout="audio info" x="28" y="370" width="273" height="190"/>
+ <info layout="audio info" x="28" y="370" width="273" height="190 -
buttonbar_height"/>
</menuset>
<layout label="audio screen">
@@ -250,7 +250,7 @@
<image filename="gant/music.png" x="435" y="230" width="370"
height="380"/>
<rectangle size="0" bgcolor="0x80000000" radius="10" x="12"
y="87"
- width="290" height="475"/>
+ width="290" height="475 - (buttonbar_height/2)"/>
</background>
</layout>
@@ -357,8 +357,8 @@
<menuset label="image" inherits="normal text style">
<screen layout="image screen"/>
- <listing y="80" x="60" height="430" width="700" layout="image
list"/>
- <info layout="image info" x="10" y="510" width="780" height="80"/>
+ <listing y="80" x="60"
height="430-(buttonbar*(buttonbar_height+10))" width="700" layout="image list"/>
+ <info layout="image info" x="10"
y="510-(buttonbar*(buttonbar_height-10))" width="780" height="80"/>
<view visible="no"/>
</menuset>
@@ -525,7 +525,7 @@
<screen layout="screen" x="0" y="0" width="800" height="600"/>
<title visible="no"/>
<info layout="tv info" x="10" y="80" width="760" height="115"/>
- <listing layout="tv listing" x="10" y="220" width="750"
height="350">
+ <listing layout="tv listing" x="10" y="220" width="750"
height="350-(buttonbar*(buttonbar_height-30))">
<image x="765" y="220" width="32" height="32" label="uparrow"
filename="up.png"/>
<image x="765" y="max-32" width="32" height="32"
label="downarrow"
Modified: branches/rel-1/freevo/share/skins/main/crystal.fxd
==============================================================================
--- branches/rel-1/freevo/share/skins/main/crystal.fxd (original)
+++ branches/rel-1/freevo/share/skins/main/crystal.fxd Sat Jun 9 08:10:34 2007
@@ -120,13 +120,13 @@
<!-- default description: make listing area smaller, show info area -->
<menuset label="default description">
<listing height="340"/>
- <info x="40" y="460" width="750" height="120" />
+ <info x="40" y="460" width="750" height="120-buttonbar_height" />
</menuset>
<!-- default description no image: mix between the two above -->
<menuset label="default description no image">
<listing height="340"/>
- <info x="40" y="460" width="750" height="120" />
+ <info x="40" y="460" width="750" height="120-buttonbar_height" />
</menuset>
<!-- special settings for audio. The default style is an image based style
-->
@@ -164,13 +164,13 @@
<menuset label="video details" inherits="normal text style">
<subtitle layout="subtitle" x="10" y="100" width="780" height="60"/>
- <listing layout="video list" x="500" y="450" width="290" height="140">
+ <listing layout="video list" x="500" y="450" width="290"
height="140-buttonbar_height">
<image label="uparrow" filename=""/>
<image label="downarrow" filename=""/>
</listing>
<view x="545" y="150"/>
- <info layout="video info" x="10" y="160" width="480" height="430"/>
+ <info layout="video info" x="10" y="160" width="480"
height="430-buttonbar_height"/>
</menuset>
@@ -245,7 +245,7 @@
<listing y="140">
<image y="140" label="uparrow"/>
</listing>
- <info layout="tv info" y="440" height="150"/>
+ <info layout="tv info" y="440" height="150-buttonbar_height"/>
</menuset>
<layout label="tv screen">
@@ -261,7 +261,7 @@
<listing y="140">
<image y="140" label="uparrow"/>
</listing>
- <info layout="tv info" y="290" height="290"/>
+ <info layout="tv info" y="290" height="290-buttonbar_height"/>
</menuset>
<!-- tv info area -->
Modified: branches/rel-1/freevo/share/skins/main/dark.fxd
==============================================================================
--- branches/rel-1/freevo/share/skins/main/dark.fxd (original)
+++ branches/rel-1/freevo/share/skins/main/dark.fxd Sat Jun 9 08:10:34 2007
@@ -209,7 +209,7 @@
<!-- video ************************** -->
<menuset label="video default" inherits="default textual">
- <info visible="yes" layout="video info" x="30" y="470" width="780"
height="150"/>
+ <info visible="yes" layout="video info" x="30" y="470" width="780"
height="150-"/>
</menuset>
<!-- MODE 0 -->
@@ -230,7 +230,7 @@
<!-- audio **************************** -->
<menuset label="audio default" inherits="default textual">
- <info visible="yes" layout="audio info" x="30" y="470" width="780"
height="150"/>
+ <info visible="yes" layout="audio info" x="30" y="470" width="780"
height="130-buttonbar_height"/>
</menuset>
<!-- MODE 0 -->
@@ -251,7 +251,7 @@
<!-- image **************************** -->
<menuset label="image default" inherits="default textual">
- <info visible="yes" layout="image info" x="30" y="470" width="780"
height="150"/>
+ <info visible="yes" layout="image info" x="30" y="470" width="780"
height="130-buttonbar_height"/>
</menuset>
<!-- MODE 0 -->
@@ -272,7 +272,7 @@
<!-- mail ***************************** -->
<menuset label="mail default" inherits="default textual">
- <info visible="yes" layout="mail info" x="30" y="470" width="780"
height="150"/>
+ <info visible="yes" layout="mail info" x="30" y="470" width="780"
height="130-buttonbar_height"/>
</menuset>
<menuset label="mail textual" inherits="mail default">
Modified: branches/rel-1/freevo/share/skins/main/info.fxd
==============================================================================
--- branches/rel-1/freevo/share/skins/main/info.fxd (original)
+++ branches/rel-1/freevo/share/skins/main/info.fxd Sat Jun 9 08:10:34 2007
@@ -60,13 +60,13 @@
<!-- default description: make listing area smaller, show info area -->
<menuset label="default description">
<listing height="340"/>
- <info x="40" y="460" width="750" height="120" />
+ <info x="40" y="460" width="750" height="120-buttonbar_height" />
</menuset>
<!-- default description no image: mix between the two above -->
<menuset label="default description no image">
<listing height="340"/>
- <info x="40" y="460" width="750" height="120" />
+ <info x="40" y="460" width="750" height="120-buttonbar_height" />
</menuset>
<!-- special settings for audio. The default style is an image based style
-->
@@ -103,13 +103,13 @@
<menuset label="video details" inherits="normal text style">
<subtitle layout="subtitle" x="10" y="100" width="780" height="60"/>
- <listing layout="video list" x="500" y="450" width="290" height="140">
+ <listing layout="video list" x="500" y="450" width="290"
height="140-buttonbar_height">
<image label="uparrow" filename=""/>
<image label="downarrow" filename=""/>
</listing>
<view x="545" y="150"/>
- <info layout="video info" x="10" y="160" width="480" height="430"/>
+ <info layout="video info" x="10" y="160" width="480"
height="430-buttonbar_height"/>
</menuset>
Modified: branches/rel-1/freevo/share/skins/main/mediaportal.fxd
==============================================================================
--- branches/rel-1/freevo/share/skins/main/mediaportal.fxd (original)
+++ branches/rel-1/freevo/share/skins/main/mediaportal.fxd Sat Jun 9
08:10:34 2007
@@ -101,7 +101,7 @@
<!-- 4. listing area: the list of all items -->
<screen layout="video screen" visible="yes"/>
<view layout="view" x="10" y="90" width="280" height="250"
align="left"/>
- <listing x="30" y="350" width="710" height="230">
+ <listing x="30" y="350" width="710"
height="230-(buttonbar*(buttonbar_height-10))">
<image filename="up.png" label="uparrow" x="750" y="350"/>
<image filename="down.png" label="downarrow" x="750"
y="max-32"/>
</listing>
@@ -243,7 +243,7 @@
<menuset label="audio" inherits="normal text style">
<screen layout="audio screen"/>
<view layout="view" x="15" y="90" width="280" height="300"/>
- <info layout="audio info" x="28" y="370" width="273" height="190"/>
+ <info layout="audio info" x="28" y="370" width="273"
height="190-(buttonbar*(buttonbar_height-30))"/>
</menuset>
<layout label="audio screen">
@@ -350,7 +350,7 @@
<menuset label="image" inherits="normal text style">
<screen layout="image screen"/>
<listing y="80" x="60" height="430" width="700" layout="image
list"/>
- <info layout="image info" x="10" y="510" width="780" height="80"/>
+ <info layout="image info" x="10" y="510" width="780"
height="80-buttonbar_height"/>
<view visible="no"/>
</menuset>
@@ -519,7 +519,7 @@
<screen layout="screen" x="0" y="0" width="800" height="600"/>
<title visible="no"/>
<info layout="tv info" x="10" y="80" width="760" height="115"/>
- <listing layout="tv listing" x="10" y="220" width="750"
height="350">
+ <listing layout="tv listing" x="10" y="220" width="750"
height="350-(buttonbar*(buttonbar_height-20))">
<image x="765" y="220" width="33" height="17" label="uparrow"
filename="tv_up.png"/>
<image x="765" y="max-32" width="33" height="17"
label="downarrow"
Modified: branches/rel-1/freevo/share/skins/main/noia.fxd
==============================================================================
--- branches/rel-1/freevo/share/skins/main/noia.fxd (original)
+++ branches/rel-1/freevo/share/skins/main/noia.fxd Sat Jun 9 08:10:34 2007
@@ -76,7 +76,7 @@
<listing y="140">
<image y="140" label="uparrow"/>
</listing>
- <info layout="tv info" y="440" height="150"/>
+ <info layout="tv info" y="440" height="150-buttonbar_height"/>
</menuset>
<menuset label="tv menu more info">
@@ -84,7 +84,7 @@
<listing y="140">
<image y="140" label="uparrow"/>
</listing>
- <info layout="tv info" y="290" height="290"/>
+ <info layout="tv info" y="290"
height="290-(buttonbar*(buttonbar_height-10))"/>
</menuset>
<!-- tv info area -->
Modified: branches/rel-1/freevo/share/skins/main/rain.fxd
==============================================================================
--- branches/rel-1/freevo/share/skins/main/rain.fxd (original)
+++ branches/rel-1/freevo/share/skins/main/rain.fxd Sat Jun 9 08:10:34 2007
@@ -128,13 +128,13 @@
<!-- default description: make listing area smaller, show info area -->
<menuset label="default description">
<listing height="340"/>
- <info x="40" y="460" width="750" height="120" />
+ <info x="40" y="460" width="750"
height="120-(buttonbar*(buttonbar_height-10))" />
</menuset>
<!-- default description no image: mix between the two above -->
<menuset label="default description no image">
<listing height="340"/>
- <info x="40" y="460" width="750" height="120" />
+ <info x="40" y="460" width="750"
height="120-(buttonbar*(buttonbar_height-10))" />
</menuset>
<!-- special settings for audio. The default style is an image based style
-->
@@ -178,7 +178,7 @@
</listing>
<view x="545" y="150"/>
- <info layout="video info" x="10" y="160" width="480" height="430"/>
+ <info layout="video info" x="10" y="160" width="480"
height="430-buttonbar_height"/>
</menuset>
@@ -266,7 +266,7 @@
<listing y="140">
<image y="140" label="uparrow"/>
</listing>
- <info layout="tv info" y="290" height="290"/>
+ <info layout="tv info" y="290"
height="290-(buttonbar*(buttonbar_height-10))"/>
</menuset>
<!-- tv info area -->
Modified: branches/rel-1/freevo/src/gui/Window.py
==============================================================================
--- branches/rel-1/freevo/src/gui/Window.py (original)
+++ branches/rel-1/freevo/src/gui/Window.py Sat Jun 9 08:10:34 2007
@@ -34,7 +34,7 @@
from GUIObject import GUIObject, Align
from Container import Container
-
+from skin import eval_attr
class Window(GUIObject):
"""
@@ -81,8 +81,8 @@
def __init__content__(self):
x, y, width, height = self.content_layout.x, self.content_layout.y, \
self.content_layout.width,
self.content_layout.height
- width = eval(str(width), { 'MAX': self.width }) or self.width
- height = eval(str(height), { 'MAX': self.height }) or self.height
+ width = eval_attr(str(width), self.width) or self.width
+ height = eval_attr(str(height), self.height) or self.height
self.content = Container('frame', x, y, width, height,
vertical_expansion=1)
GUIObject.add_child(self, self.content)
@@ -102,8 +102,8 @@
self.height += height
width, height = self.content_layout.width, self.content_layout.height
- self.content.width = eval(str(width), { 'MAX': self.width }) or
self.width
- self.content.height = eval(str(height), { 'MAX': self.height }) or
self.height
+ self.content.width = eval_attr(str(width), self.width ) or self.width
+ self.content.height = eval_attr(str(height), self.height) or
self.height
self.left = self.osd.width/2 - self.width/2
self.top = self.osd.height/2 - self.height/2
@@ -136,8 +136,8 @@
for o in self.background_layout:
if o[0] == 'rectangle':
r = copy.deepcopy(o[1])
- r.width = eval(str(r.width), { 'MAX' : self.get_size()[0] })
- r.height = eval(str(r.height), { 'MAX' : self.get_size()[1] })
+ r.width = eval_attr(str(r.width), self.get_size()[0])
+ r.height = eval_attr(str(r.height), self.get_size()[1])
if not r.width:
r.width = self.get_size()[0]
if not r.height:
Modified: branches/rel-1/freevo/src/skin.py
==============================================================================
--- branches/rel-1/freevo/src/skin.py (original)
+++ branches/rel-1/freevo/src/skin.py Sat Jun 9 08:10:34 2007
@@ -42,6 +42,7 @@
# -----------------------------------------------------------------------
+import plugin
import config
import sys
import os.path
@@ -84,6 +85,43 @@
"""
return not _singleton.force_redraw
+def eval_attr(attr_value, max):
+ """
+ Returns attr_value if it is not a string or evaluates it substituting max
+ for 'MAX' or 'max' in the attr_value string.
+ """
+ if isinstance(attr_value,str):
+ global attr_global_dict
+ if attr_global_dict is None:
+ attr_global_dict = {}
+
+ # Setup idlebar related values
+ p = plugin.getbyname('idlebar')
+ if p:
+ attr_global_dict['idlebar'] = 1
+ attr_global_dict['idlebar_height'] = 60
+ else:
+ attr_global_dict['idlebar'] = 0
+ attr_global_dict['idlebar_height'] = 0
+
+ # Setup buttonbar related values
+ p = plugin.getbyname('buttonbar')
+ if p:
+ attr_global_dict['buttonbar'] = 1
+ attr_global_dict['buttonbar_height'] = 60
+ else:
+ attr_global_dict['buttonbar'] = 0
+ attr_global_dict['buttonbar_height'] = 0
+ # Set max values
+ if max is not None:
+ attr_global_dict['MAX'] = max
+ attr_global_dict['max'] = max
+
+ return eval(attr_value, attr_global_dict)
+
+ return attr_value
+
+attr_global_dict = None
if __freevo_app__ == 'main':
# init the skin
Modified: branches/rel-1/freevo/src/skins/main/area.py
==============================================================================
--- branches/rel-1/freevo/src/skins/main/area.py (original)
+++ branches/rel-1/freevo/src/skins/main/area.py Sat Jun 9 08:10:34 2007
@@ -57,6 +57,7 @@
import util
from skin_utils import *
+from skin import eval_attr
import xml_skin
import screen
@@ -366,10 +367,10 @@
font_h=0
if isinstance(object.width, str):
- object.width = int(eval(object.width, {'MAX':self.area_val.width}))
+ object.width = int(eval_attr(object.width, self.area_val.width))
if isinstance(object.height, str):
- object.height = int(eval(object.height,
{'MAX':self.area_val.height}))
+ object.height = int(eval_attr(object.height, self.area_val.height))
object.x += self.area_val.x
object.y += self.area_val.y
@@ -398,9 +399,9 @@
# get the x and y value, based on MAX
if isinstance(r.x, str):
- r.x = int(eval(r.x, {'MAX':item_w}))
+ r.x = int(eval_attr(r.x, item_w))
if isinstance(r.y, str):
- r.y = int(eval(r.y, {'MAX':item_h}))
+ r.y = int(eval_attr(r.y, item_h))
# set rect width and height to something
if not r.width:
@@ -411,10 +412,10 @@
# calc width and height based on MAX settings
if isinstance(r.width, str):
- r.width = int(eval(r.width, {'MAX':item_w}))
+ r.width = int(eval_attr(r.width, item_w))
if isinstance(r.height, str):
- r.height = int(eval(r.height, {'MAX':item_h}))
+ r.height = int(eval_attr(r.height, item_h))
# correct item_w and item_h to fit the rect
item_w = max(item_w, r.width)
Modified: branches/rel-1/freevo/src/skins/main/listing_area.py
==============================================================================
--- branches/rel-1/freevo/src/skins/main/listing_area.py (original)
+++ branches/rel-1/freevo/src/skins/main/listing_area.py Sat Jun 9
08:10:34 2007
@@ -33,6 +33,7 @@
from area import Skin_Area
from skin_utils import *
+from skin import eval_attr
import config
class Listing_Area(Skin_Area):
@@ -468,7 +469,7 @@
if menuw.menu_items[-1] != menu.choices[-1] and
area.images['downarrow']:
if isinstance(area.images['downarrow'].y, str):
v = copy.copy(area.images['downarrow'])
- v.y = eval(v.y, {'MAX':(item_y0-vskip)})
+ v.y = eval_attr(v.y, (item_y0-vskip))
else:
v = area.images['downarrow']
self.drawimage(area.images['downarrow'].filename, v)
Modified: branches/rel-1/freevo/src/skins/main/tvlisting_area.py
==============================================================================
--- branches/rel-1/freevo/src/skins/main/tvlisting_area.py (original)
+++ branches/rel-1/freevo/src/skins/main/tvlisting_area.py Sat Jun 9
08:10:34 2007
@@ -36,7 +36,7 @@
import math
from area import Skin_Area, Geometry
from skin_utils import *
-
+from skin import eval_attr
class TVListing_Area(Skin_Area):
"""
@@ -389,7 +389,7 @@
if menuw.display_down_arrow and area.images['downarrow']:
if isinstance(area.images['downarrow'].y, str):
v = copy.copy(area.images['downarrow'])
- v.y = eval(v.y, {'MAX' : y0})
+ v.y = eval_attr(v.y, y0)
else:
v = area.images['downarrow']
self.drawimage(area.images['downarrow'].filename, v)
Modified: branches/rel-1/freevo/src/skins/main/xml_skin.py
==============================================================================
--- branches/rel-1/freevo/src/skins/main/xml_skin.py (original)
+++ branches/rel-1/freevo/src/skins/main/xml_skin.py Sat Jun 9 08:10:34 2007
@@ -53,6 +53,36 @@
#
# Help functions
#
+attr_global_dict = None
+
+def eval_attr(attr_value):
+ """
+ Returns attr_value if it is not a string or evaluates it substituting max
+ for 'MAX' or 'max' in the attr_value string.
+ """
+ global attr_global_dict
+
+ if attr_global_dict is None:
+ attr_global_dict = {}
+
+ # Setup idlebar related values
+ p = plugin.getbyname('idlebar')
+ if p:
+ attr_global_dict['idlebar'] = 1
+ attr_global_dict['idlebar_height'] = 60
+ else:
+ attr_global_dict['idlebar'] = 0
+ attr_global_dict['idlebar_height'] = 0
+
+ # Setup buttonbar related values
+ p = plugin.getbyname('buttonbar')
+ if p:
+ attr_global_dict['buttonbar'] = 1
+ attr_global_dict['buttonbar_height'] = 60
+ else:
+ attr_global_dict['buttonbar'] = 0
+ attr_global_dict['buttonbar_height'] = 0
+ return eval(attr_value, attr_global_dict)
def attr_int(node, attr, default, scale=0.0):
@@ -64,37 +94,12 @@
val = node.attrs[('', attr)]
if val == 'line_height':
return -1
- new_val = ''
-
- while val:
- ppos = val[1:].find('+') + 1
- mpos = val[1:].find('-') + 1
- if ppos and mpos:
- pos = min(ppos, mpos)
- elif ppos or mpos:
- pos = max(ppos, mpos)
- else:
- pos = len(val)
-
- try:
- i = int(round(scale*int(val[:pos])))
- if i < 0:
- new_val += str(i)
- else:
- new_val += '+' + str(i)
- except ValueError:
- if val[:pos].upper() in ( '+MAX', 'MAX', '-MAX' ):
- new_val += val[:pos].upper()
- elif val[:pos].lower() in ( '+font_h', 'font_h', '-font_h'
):
- new_val += val[:pos].lower()
- else:
- print 'WARNING: unsupported value %s' % val[:pos]
- val = val[pos:]
try:
- return int(new_val)
- except ValueError:
- return str(new_val)
+ value = eval(val)
+ return int(round(scale * value))
+ except:
+ return 'int(%s)' % (str(val))
except ValueError:
pass
@@ -326,6 +331,14 @@
basic prepare function
"""
try:
+ for c in self.content:
+ if XML_types[c][0] == 'int' and isinstance(getattr(self,c),
str):
+ try:
+ result = eval_attr(getattr(self, c))
+ setattr(self, c, result)
+ except:
+ pass
+
if self.visible not in ('', 'yes'):
if len(self.visible) > 4 and self.visible[:4] == 'not ':
p = plugin.getbyname(self.visible[4:])
@@ -938,6 +951,8 @@
def prepare(self):
+ global attr_global_dict
+ attr_global_dict = None
self.prepared = True
self.sets = copy.deepcopy(self._sets)
Modified: branches/rel-1/freevo/src/tv/tvguide.py
==============================================================================
--- branches/rel-1/freevo/src/tv/tvguide.py (original)
+++ branches/rel-1/freevo/src/tv/tvguide.py Sat Jun 9 08:10:34 2007
@@ -146,7 +146,7 @@
numerical INPUTs: Jump to a specific channel number
"""
- _debug_('TVGUIDE EVENT is %s' % event)
+ _debug_('TVGUIDE EVENT is %s' % event, 2)
## MENU_CHANGE_STYLE
if event == MENU_CHANGE_STYLE:
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog