- skins are now loaded first and applied later
authorFelix Domke <tmbinc@elitedvb.net>
Fri, 8 Jul 2005 16:41:35 +0000 (16:41 +0000)
committerFelix Domke <tmbinc@elitedvb.net>
Fri, 8 Jul 2005 16:41:35 +0000 (16:41 +0000)
 - this allows use skin information to build special eWidgets, depending on skin
 - add "applet"-feature: code which is executed from skin
 - example: centering of messagebox

24 files changed:
lib/python/Components/Button.py
lib/python/Components/Clock.py
lib/python/Components/ConfigList.py
lib/python/Components/GUIComponent.py
lib/python/Components/GUISkin.py
lib/python/Components/Header.py
lib/python/Components/Label.py
lib/python/Components/MenuList.py
lib/python/Components/PerServiceDisplay.py
lib/python/Components/ProgressBar.py
lib/python/Components/ServiceList.py
lib/python/Components/TextInput.py
lib/python/Components/TimeInput.py
lib/python/Components/TimerList.py
lib/python/Components/VariableText.py
lib/python/Components/VariableValue.py
lib/python/Components/VolumeBar.py
lib/python/Screens/InfoBar.py
lib/python/Screens/Menu.py
lib/python/Screens/MessageBox.py [new file with mode: 0644]
lib/python/Screens/__init__.py
lib/python/Tools/XMLTools.py
mytest.py
skin.py

index d773b2c..d9226b6 100644 (file)
@@ -29,7 +29,7 @@ class Button(HTMLComponent, GUIComponent, VariableText):
                return "<input type=\"submit\" text=\"" + self.getText() + "\">\n"
 
 # GUI:
-       def createWidget(self, parent, skindata):
+       def createWidget(self, parent):
                g = eButton(parent)
                g.selected.get().append(self.push)
                return g
index 36e0694..3beed55 100644 (file)
@@ -24,7 +24,7 @@ class Clock(HTMLComponent, GUIComponent, VariableText):
                self.setText("%2d:%02d:%02d" % (t[3], t[4], t[5]))
 
 # realisierung als GUI
-       def createWidget(self, parent, skindata):
+       def createWidget(self, parent):
                return eLabel(parent)
 
        def removeWidget(self, w):
index a2bdcb0..35ea093 100644 (file)
@@ -22,7 +22,7 @@ class ConfigList(HTMLComponent, GUIComponent):
        def invalidateCurrent(self):
                self.l.invalidateEntry(self.l.getCurrentSelectionIndex())
        
-       def GUIcreate(self, parent, skindata):
+       def GUIcreate(self, parent):
                self.instance = eListbox(parent)
                self.instance.setContent(self.l)
        
index bcd99d2..fee9341 100644 (file)
@@ -1,12 +1,17 @@
+import skin
+
 class GUIComponent:
        """ GUI component """
-
+       
        def __init__(self):
                pass
-               
+       
        def execBegin(self):
                pass
        
        def execEnd(self):
                pass
-
+       
+       # this works only with normal widgets - if you don't have self.instance, override this.
+       def applySkin(self, desktop):
+               skin.applyAllAttributes(self.instance, desktop, self.skinAttributes)
index b918e90..982cce3 100644 (file)
@@ -1,65 +1,31 @@
 from GUIComponent import *
+from skin import applyAllAttributes
 
 class GUISkin:
+       __module__ = __name__
+
        def __init__(self):
+               self.onLayoutFinish = [ ]
                pass
-       
-       def createGUIScreen(self, parent):
+
+       def createGUIScreen(self, parent, desktop):
                for (name, val) in self.items():
                        if isinstance(val, GUIComponent):
-                               val.GUIcreate(parent, None)
-       
+                               val.GUIcreate(parent)
+                               val.applySkin(desktop)
+
+               for w in self.additionalWidgets:
+                       w.instance = w.widget(parent)
+                       w.instance.thisown = 0
+                       applyAllAttributes(w.instance, desktop, w.skinAttributes)
+               
+               for f in self.onLayoutFinish:
+                       exec(f) in globals(), locals()
+
        def deleteGUIScreen(self):
                for (name, val) in self.items():
                        if isinstance(val, GUIComponent):
                                val.GUIdelete()
-                       try:
-                               val.fix()
-                       except:
-                               pass
-                       
-                       # DIESER KOMMENTAR IST NUTZLOS UND MITTLERWEILE VERALTET! (glaub ich)
-                       # BITTE NICHT LESEN!
-                       # note: you'll probably run into this assert. if this happens, don't panic!
-                       # yes, it's evil. I told you that programming in python is just fun, and 
-                       # suddently, you have to care about things you don't even know.
-                       #
-                       # but calm down, the solution is easy, at least on paper:
-                       #
-                       # Each Component, which is a GUIComponent, owns references to each
-                       # instantiated eWidget (namely in screen.data[name]["instance"], in case
-                       # you care.)
-                       # on deleteGUIscreen, all eWidget *must* (!) be deleted (otherwise,
-                       # well, problems appear. I don't want to go into details too much,
-                       # but this would be a memory leak anyway.)
-                       # The assert beyond checks for that. It asserts that the corresponding
-                       # eWidget is about to be removed (i.e., that the refcount becomes 0 after
-                       # running deleteGUIscreen).
-                       # (You might wonder why the refcount is checked for 2 and not for 1 or 0 -
-                       # one reference is still hold by the local variable 'w', another one is
-                       # hold be the function argument to sys.getrefcount itself. So only if it's
-                       # 2 at this point, the object will be destroyed after leaving deleteGUIscreen.)
-                       #
-                       # Now, how to fix this problem? You're holding a reference somewhere. (References
-                       # can only be hold from Python, as eWidget itself isn't related to the c++
-                       # way of having refcounted objects. So it must be in python.)
-                       #
-                       # It could be possible that you're calling deleteGUIscreen trough a call of
-                       # a PSignal. For example, you could try to call screen.doClose() in response
-                       # to a Button::click. This will fail. (It wouldn't work anyway, as you would
-                       # remove a dialog while running it. It never worked - enigma1 just set a 
-                       # per-mainloop variable on eWidget::close() to leave the exec()...)
-                       # That's why Session supports delayed closes. Just call Session.close() and
-                       # it will work.
-                       #
-                       # Another reason is that you just stored the data["instance"] somewhere. or
-                       # added it into a notifier list and didn't removed it.
-                       #
-                       # If you can't help yourself, just ask me. I'll be glad to help you out.
-                       # Sorry for not keeping this code foolproof. I really wanted to archive
-                       # that, but here I failed miserably. All I could do was to add this assert.
-#                      assert sys.getrefcount(w) == 2, "too many refs hold to " + str(w)
-       
+
        def close(self):
                self.deleteGUIScreen()
-
index 3ff6ab3..9f7be60 100644 (file)
@@ -14,7 +14,7 @@ class Header(HTMLComponent, GUIComponent, VariableText):
        def produceHTML(self):
                return "<h2>" + self.getText() + "</h2>\n"
 
-       def createWidget(self, parent, skindata):
+       def createWidget(self, parent):
                g = eLabel(parent)
                return g
 
index 609c6de..7402d72 100644 (file)
@@ -15,6 +15,10 @@ class Label(HTMLComponent, GUIComponent, VariableText):
                return self.getText()
 
 # GUI:
-       def createWidget(self, parent, skindata):
+       def createWidget(self, parent):
                return eLabel(parent)
        
+       def getSize(self):
+               s = self.instance.calculateSize()
+               return (s.width(), s.height())
+
index 90cd328..6fb3354 100644 (file)
@@ -12,7 +12,7 @@ class MenuList(HTMLComponent, GUIComponent):
        def getCurrent(self):
                return self.l.getCurrentSelection()
        
-       def GUIcreate(self, parent, skindata):
+       def GUIcreate(self, parent):
                self.instance = eListbox(parent)
                self.instance.setContent(self.l)
        
index bd94318..eab1e08 100644 (file)
@@ -23,7 +23,7 @@ class PerServiceDisplay(GUIComponent, VariableText):
                        # call handler
                        self.eventmap[ev]()
        
-       def createWidget(self, parent, skindata):
+       def createWidget(self, parent):
                # by default, we use a label to display our data.
                g = eLabel(parent)
                return g
index 0ae4868..68824d5 100644 (file)
@@ -10,7 +10,7 @@ class ProgressBar(HTMLComponent, GUIComponent, VariableValue):
                GUIComponent.__init__(self)
                VariableValue.__init__(self)
 
-       def createWidget(self, parent, skindata):
+       def createWidget(self, parent):
                g = eSlider(parent)
                g.setRange(0, 100)
                return g
index b1bd217..1aa3d48 100644 (file)
@@ -19,7 +19,7 @@ class ServiceList(HTMLComponent, GUIComponent):
        def moveDown(self):
                self.instance.moveSelection(self.instance.moveDown)
 
-       def GUIcreate(self, parent, skindata):
+       def GUIcreate(self, parent):
                self.instance = eListbox(parent)
                self.instance.setContent(self.l)
        
index 98b440c..e69de29 100644 (file)
@@ -1,31 +0,0 @@
-from HTMLComponent import *
-from GUIComponent import *
-
-from tools import CONNECT, DISCONNECT
-
-from enigma import eInput, eInputContentString
-
-class TextInput(HTMLComponent, GUIComponent):
-       def __init__(self):
-               GUIComponent.__init__(self)
-               self.content = eInputContentString()
-
-       def contentChanged(self):
-               print "content changed to %s!" % (self.getText())
-       
-       def getText(self):
-               return self.content.getText()
-       
-       def setText(self, text):
-               # TODO :  support unicode!
-               self.content.setText(str(text))
-       
-       def GUIcreate(self, parent, skindata):
-               self.instance = eInput(parent)
-               CONNECT(self.instance.changed, self.contentChanged)
-               self.instance.setContent(self.content)
-       
-       def GUIdelete(self):
-               DISCONNECT(self.instance.changed, self.contentChanged)
-               self.instance.setContent(None)
-               self.instance = None
index c520fdf..e69de29 100644 (file)
@@ -1,18 +0,0 @@
-from HTMLComponent import *
-from GUIComponent import *
-from VariableText import *
-
-from enigma import eInput, eInputContentNumber
-
-class TimeInput(HTMLComponent, GUIComponent):
-       def __init__(self):
-               GUIComponent.__init__(self)
-               self.content = eInputContentNumber(12, 0, 15)
-       
-       def GUIcreate(self, parent, skindata):
-               self.instance = eInput(parent)
-               self.instance.setContent(self.content)
-       
-       def GUIdelete(self):
-               self.instance.setContent(None)
-               self.instance = None
index 9ef7cc4..18c5cb1 100644 (file)
@@ -45,7 +45,7 @@ class TimerList(HTMLComponent, GUIComponent):
        def getCurrent(self):
                return self.l.getCurrentSelection()
        
-       def GUIcreate(self, parent, skindata):
+       def GUIcreate(self, parent):
                self.instance = eListbox(parent)
                self.instance.setContent(self.l)
                self.instance.setItemHeight(50)
index 694355e..76dc201 100644 (file)
@@ -1,3 +1,5 @@
+import skin
+
 class VariableText:
        """VariableText can be used for components which have a variable text, based on any widget with setText call"""
        
@@ -13,8 +15,8 @@ class VariableText:
        def getText(self):
                return self.message
        
-       def GUIcreate(self, parent, skindata):
-               self.instance = self.createWidget(parent, skindata)
+       def GUIcreate(self, parent):
+               self.instance = self.createWidget(parent)
                self.instance.setText(self.message)
        
        def GUIdelete(self):
index c94218f..8f0cef4 100644 (file)
@@ -1,3 +1,5 @@
+import skin
+
 class VariableValue:
        """VariableValue can be used for components which have a variable value (like eSlider), based on any widget with setValue call"""
        
@@ -13,8 +15,8 @@ class VariableValue:
        def getValue(self):
                return self.value
                
-       def GUIcreate(self, parent, skindata):
-               self.instance = self.createWidget(parent, skindata)
+       def GUIcreate(self, parent):
+               self.instance = self.createWidget(parent)
                self.instance.setValue(self.value)
        
        def GUIdelete(self):
index 6eace42..a6da598 100644 (file)
@@ -8,7 +8,7 @@ class VolumeBar(HTMLComponent, GUIComponent, VariableValue):
                GUIComponent.__init__(self)
                VariableValue.__init__(self)
 
-       def createWidget(self, parent, skindata):
+       def createWidget(self, parent):
                g = eSlider(parent)
                g.setRange(0, 100)
                return g
index 5112a00..ee09e57 100644 (file)
@@ -6,6 +6,8 @@ from Components.Button import Button
 from Components.ServiceName import ServiceName
 from Components.EventInfo import EventInfo
 
+from Screens.MessageBox import MessageBox
+
 from enigma import *
 
 import time
@@ -31,7 +33,7 @@ class InfoBar(Screen):
                                "hide": self.hide,
                                "toggleShow": self.toggleShow
                        })
-               self["okbutton"] = Button("mainMenu", [self.mainMenu])
+#              self["okbutton"] = Button("mainMenu", [self.mainMenu])
                
                self["CurrentTime"] = Clock()
                
@@ -77,6 +79,9 @@ class InfoBar(Screen):
                self.servicelist.zap()
                
        def instantRecord(self):
+               self.session.open(MessageBox, "this would be an instant recording! do you really know what you're doing?!")
+               return
+       
                if self.recording != None:
                        print "remove entry"
                        self.session.nav.RecordTimer.removeEntry(self.recording)
index c380931..3b54577 100644 (file)
@@ -19,6 +19,8 @@ import xml.dom.minidom
 from xml.dom import EMPTY_NAMESPACE
 from skin import elementsWithTag
 
+from Tools import XMLTools
+
 # some screens
 def doGlobal(screen):
        screen["clock"] = Clock()
@@ -74,13 +76,6 @@ mdom = xml.dom.minidom.parseString(
                </menu>
        </menu>""")
 
-def getText(nodelist):
-       rc = ""
-       for node in nodelist:
-               if node.nodeType == node.TEXT_NODE:
-                       rc = rc + node.data
-       return rc
-
 def getValbyAttr(x, attr):
        for p in range(x.attributes.length):
                a = x.attributes.item(p)
@@ -159,6 +154,7 @@ class Menu(Screen):
                self.session.open(clockDisplay, Clock())
 
        def okbuttonClick(self):
+               print "okbuttonClick"
                selection = self["menu"].getCurrent()
                selection[1]()
 
@@ -178,7 +174,7 @@ class Menu(Screen):
        def addItem(self, destList, node):
                ItemText = getValbyAttr(node, "text")
                if ItemText != "":                                                                                                                                      #check for name
-                       b = getText(node.childNodes)
+                       b = XMLTools.mergeText(node.childNodes)
                        if b != "":                                                                                                                                                             #check for function
                                destList.append((ItemText,boundFunction(self.evalText,b)))
                        else:
diff --git a/lib/python/Screens/MessageBox.py b/lib/python/Screens/MessageBox.py
new file mode 100644 (file)
index 0000000..bb6318b
--- /dev/null
@@ -0,0 +1,15 @@
+from Screen import Screen
+from Components.ActionMap import ActionMap
+from Components.Label import Label
+
+class MessageBox(Screen):
+       def __init__(self, session, text):
+               Screen.__init__(self, session)
+               
+               self["text"] = Label(text)
+
+               self["actions"] = ActionMap(["OkCancelActions"], 
+                       {
+                               "cancel": self.close
+                       })
+
index fbd2c17..c91f5f5 100644 (file)
@@ -1,4 +1,4 @@
 __all__ = ["ChannelSelection", "ClockDisplay", "ConfigMenu", 
-       "InfoBar", "Menu", "ScartLoopThrough", "Screen", "ServiceScan",
+       "InfoBar", "MessageBox", "Menu", "ScartLoopThrough", "Screen", "ServiceScan",
        "TimerEdit"]
 
index aaab467..0551362 100644 (file)
@@ -15,3 +15,11 @@ def elementsWithTag(el, tag):
                        continue
                if tag(x.tagName):
                        yield x
+
+def mergeText(nodelist):
+       rc = ""
+       for node in nodelist:
+               if node.nodeType == node.TEXT_NODE:
+                       rc = rc + node.data
+       return rc
+
index d6cfb1a..01db6e6 100644 (file)
--- a/mytest.py
+++ b/mytest.py
@@ -10,7 +10,7 @@ import ServiceReference
 
 from Navigation import Navigation
 
-from skin import applyGUIskin
+from skin import readSkin, applyAllAttributes
 
 # A screen is a function which instanciates all components of a screen into a temporary component.
 # Thus, the global stuff is a screen, too.
@@ -54,8 +54,8 @@ html = HTMLOutputDevice()
 
 class GUIOutputDevice(OutputDevice):
        parent = None
-       def create(self, comp):
-               comp.createGUIScreen(self.parent)
+       def create(self, comp, desktop):
+               comp.createGUIScreen(self.parent, desktop)
 
 class Session:
        def __init__(self):
@@ -75,7 +75,7 @@ class Session:
                
                        print sys.getrefcount(self.currentDialog)
                        del self.currentDialog.instance
-                       dump(self.currentDialog)
+#                      dump(self.currentDialog)
                        del self.currentDialog
                
                self.popCurrent()
@@ -93,16 +93,20 @@ class Session:
                return screen(self, *arguments)
        
        def instantiateDialog(self, screen, *arguments):
+               # create dialog
                dlg = self.create(screen, arguments)
+               
+               # read skin data
+               readSkin(dlg, None, dlg.skinName, self.desktop)
+
+               # create GUI view of this dialog
                assert self.desktop != None
                dlg.instance = eWindow(self.desktop)
-
+               applyAllAttributes(dlg.instance, self.desktop, dlg.skinAttributes)
                gui = GUIOutputDevice()
                gui.parent = dlg.instance
-               gui.create(dlg)
-
-               applyGUIskin(dlg, None, dlg.skinName, self.desktop)
-               
+               gui.create(dlg, self.desktop)
+               
                return dlg
         
        def pushCurrent(self):
diff --git a/skin.py b/skin.py
index bc4931f..5706507 100644 (file)
--- a/skin.py
+++ b/skin.py
@@ -2,7 +2,7 @@ from enigma import *
 import xml.dom.minidom
 from xml.dom import EMPTY_NAMESPACE
 
-from Tools.XMLTools import elementsWithTag
+from Tools.XMLTools import elementsWithTag, mergeText
 
 colorNames = dict()
 
@@ -46,11 +46,12 @@ dom = xml.dom.minidom.parseString(
                                <pixmap pos="bpBottom"      filename="data/b_w_b.png"  />
                                <pixmap pos="bpBottomRight" filename="data/b_w_br.png" />
                        </borderset>
-               </windowstyle>
+               </windowstyle> """ """
                <screen name="Menu" position="300,100" size="300,300" title="real main menu">
 <!--                   <widget name="okbutton" position="10,190" size="280,50" font="Arial;20" valign="center" halign="center" />-->
                        <widget name="title" position="10,10" size="280,20" />
                        <widget name="menu" position="10,30" size="280,200" />
+                       
                </screen>
                <screen name="ScartLoopThrough" position="0,0" size="720,576">
                </screen>
@@ -104,13 +105,38 @@ dom = xml.dom.minidom.parseString(
                        <widget name="scan_state" position="10,60" size="280,30" />
                </screen>
                <screen name="TimerEdit" position="70,100" size="590,335" title="Timer Edit">
-                       <widget name="description" position="10,10" size="580,40" font="Arial;25"/>
-                       <widget name="lbegin" position="405,102" size="103,30" font="Arial;25" />
-                       <widget name="lend" position="405,158" size="103,30" font="Arial;25" />
+                       <widget name="description" position="10,10" size="580,40" font="Arial;25" />
+                       <widget name="lbegin" position="405,102" size="103,30" font="Arial;25" foregroundColor="red" />
+                       <widget name="lend" position="405,158" size="103,30" font="Arial;25" foregroundColor="green" />
                        <widget name="begin" position="508,105" size="72,35" font="Arial;25" />
                        <widget name="end" position="508,150" size="72,35" font="Arial;25" />
                        <widget name="apply" position="10,240" size="250,35" />
                </screen>
+               <screen name="MessageBox" position="0,300" size="720,10" title="Message">
+                       <widget name="text" position="0,0" size="500,0" font="Arial;25" />
+                       <applet type="onLayoutFinish">
+# this should be factored out into some helper code, but currently demonstrated applets.
+from enigma import eSize, ePoint
+
+orgwidth = self.instance.size().width()
+orgpos = self.instance.position()
+textsize = self["text"].getSize()
+
+# y size still must be fixed in font stuff...
+textsize = (textsize[0], textsize[1] + 20)
+wsize = (textsize[0] + 20, textsize[1] + 20)
+
+# resize 
+self.instance.resize(eSize(*wsize))
+
+# resize label
+self["text"].instance.resize(eSize(*textsize))
+
+# center window
+newwidth = wsize[0]
+self.instance.move(ePoint(orgpos.x() + (orgwidth - newwidth)/2, orgpos.y()))
+                       </applet>
+               </screen>
        </skin>""")
 
 def parsePosition(str):
@@ -133,7 +159,7 @@ def parseColor(str):
                        raise ("color '%s' must be #aarrggbb or valid named color" % (str))
        return gRGB(int(str[1:], 0x10))
 
-def applyAttributes(guiObject, node, desktop):
+def collectAttributes(skinAttributes, node):
        # walk all attributes
        for p in range(node.attributes.length):
                a = node.attributes.item(p)
@@ -144,60 +170,70 @@ def applyAttributes(guiObject, node, desktop):
                # TODO: localization? as in e1?
                value = str(a.value)
                
-               # and set attributes
-               try:
-                       if attrib == 'position':
-                               guiObject.move(parsePosition(value))
-                       elif attrib == 'size':
-                               guiObject.resize(parseSize(value))
-                       elif attrib == 'title':
-                               guiObject.setTitle(value)
-                       elif attrib == 'text':
-                               guiObject.setText(value)
-                       elif attrib == 'font':
-                               guiObject.setFont(parseFont(value))
-                       elif attrib == "pixmap":
-                               ptr = gPixmapPtr()
-                               if loadPNG(ptr, value):
-                                       raise "loading PNG failed!"
-                               x = ptr
-                               ptr = ptr.__deref__()
-                               desktop.makeCompatiblePixmap(ptr)
-                               guiObject.setPixmap(ptr)
-#                              guiObject.setPixmapFromFile(value)
-                       elif attrib == "valign":
-                               try:
-                                       guiObject.setVAlign(
-                                               { "top": guiObject.alignTop,
-                                                       "center": guiObject.alignCenter,
-                                                       "bottom": guiObject.alignBottom
-                                               }[value])
-                               except KeyError:
-                                       print "valign must be either top, center or bottom!"
-                       elif attrib == "halign":
+               skinAttributes[attrib] = value
+
+def applySingleAttribute(guiObject, desktop, attrib, value):           
+       # and set attributes
+       try:
+               if attrib == 'position':
+                       guiObject.move(parsePosition(value))
+               elif attrib == 'size':
+                       guiObject.resize(parseSize(value))
+               elif attrib == 'title':
+                       guiObject.setTitle(value)
+               elif attrib == 'text':
+                       guiObject.setText(value)
+               elif attrib == 'font':
+                       guiObject.setFont(parseFont(value))
+               elif attrib == "pixmap":
+                       ptr = gPixmapPtr()
+                       if loadPNG(ptr, value):
+                               raise "loading PNG failed!"
+                       x = ptr
+                       ptr = ptr.__deref__()
+                       desktop.makeCompatiblePixmap(ptr)
+                       guiObject.setPixmap(ptr)
+                       # guiObject.setPixmapFromFile(value)
+               elif attrib == "valign":
+                       try:
+                               guiObject.setVAlign(
+                                       { "top": guiObject.alignTop,
+                                               "center": guiObject.alignCenter,
+                                               "bottom": guiObject.alignBottom
+                                       }[value])
+                       except KeyError:
+                               print "valign must be either top, center or bottom!"
+               elif attrib == "halign":
+                       try:
+                               guiObject.setHAlign(
+                                       { "left": guiObject.alignLeft,
+                                               "center": guiObject.alignCenter,
+                                               "right": guiObject.alignRight,
+                                               "block": guiObject.alignBlock
+                                       }[value])
+                       except KeyError:
+                               print "halign must be either left, center, right or block!"
+               elif attrib == "flags":
+                       flags = value.split(',')
+                       for f in flags:
                                try:
-                                       guiObject.setHAlign(
-                                               { "left": guiObject.alignLeft,
-                                                       "center": guiObject.alignCenter,
-                                                       "right": guiObject.alignRight,
-                                                       "block": guiObject.alignBlock
-                                               }[value])
+                                       fv = eWindow.__dict__[f]
+                                       guiObject.setFlag(fv)
                                except KeyError:
-                                       print "halign must be either left, center, right or block!"
-                       elif attrib == "flags":
-                               flags = value.split(',')
-                               for f in flags:
-                                       try:
-                                               fv = eWindow.__dict__[f]
-                                               guiObject.setFlag(fv)
-                                       except KeyError:
-                                               print "illegal flag %s!" % f
-                       elif attrib == "backgroundColor":
-                               guiObject.setBackgroundColor(parseColor(value))
-                       elif attrib != 'name':
-                               print "unsupported attribute " + attrib + "=" + value
-               except AttributeError:
-                       print "widget %s (%s) doesn't support attribute %s!" % ("", guiObject.__class__.__name__, attrib)
+                                       print "illegal flag %s!" % f
+               elif attrib == "backgroundColor":
+                       guiObject.setBackgroundColor(parseColor(value))
+               elif attrib == "foregroundColor":
+                       guiObject.setForegroundColor(parseColor(value))
+               elif attrib != 'name':
+                       print "unsupported attribute " + attrib + "=" + value
+       except int:
+# AttributeError:
+               print "widget %s (%s) doesn't support attribute %s!" % ("", guiObject.__class__.__name__, attrib)
+
+def applyAllAttributes(guiObject, desktop, attributes):
+       for (attrib, value) in attributes.items():
+               applySingleAttribute(guiObject, desktop, attrib, value)
 
 def loadSkin(desktop):
        print "loading skin..."
@@ -249,7 +285,7 @@ def loadSkin(desktop):
                eWindowStyleManager.getInstance(x)
                x.setStyle(style)
 
-def applyGUIskin(screen, skin, name, desktop):
+def readSkin(screen, skin, name, desktop):
        myscreen = None
        
        # first, find the corresponding screen element
@@ -261,8 +297,11 @@ def applyGUIskin(screen, skin, name, desktop):
        del skin
        
        assert myscreen != None, "no skin for screen '" + name + "' found!"
+
+       screen.skinAttributes = { }     
+       collectAttributes(screen.skinAttributes, myscreen)
        
-       applyAttributes(screen.instance, myscreen, desktop)
+       screen.additionalWidgets = [ ]
        
        # now walk all widgets
        for widget in elementsWithTag(myscreen.childNodes, "widget"):
@@ -273,20 +312,43 @@ def applyGUIskin(screen, skin, name, desktop):
                
                # get corresponding gui object
                try:
-                       guiObject = screen[wname].instance
+                       attributes = screen[wname].skinAttributes = { }
                except:
                        raise str("component with name '" + wname + "' was not found in skin of screen '" + name + "'!")
                
-               applyAttributes(guiObject, widget, desktop)
+               collectAttributes(attributes, widget)
 
        # now walk additional objects
        for widget in elementsWithTag(myscreen.childNodes, lambda x: x != "widget"):
+               if widget.tagName == "applet":
+                       codeText = mergeText(widget.childNodes).strip()
+                       type = widget.getAttribute('type')
+
+                       code = compile(codeText, "skin applet", "exec")
+                       
+                       if type == "onLayoutFinish":
+                               screen.onLayoutFinish.append(code)
+                       else:
+                               raise str("applet type '%s' unknown!" % type)
+                       
+                       continue
+               
+               class additionalWidget:
+                       pass
+               
+               w = additionalWidget()
+               
                if widget.tagName == "eLabel":
-                       guiObject = eLabel(screen.instance)
+                       w.widget = eLabel
                elif widget.tagName == "ePixmap":
-                       guiObject = ePixmap(screen.instance)
+                       w.widget = ePixmap
                else:
                        raise str("unsupported stuff : %s" % widget.tagName)
                
-               applyAttributes(guiObject, widget, desktop      )
-               guiObject.thisown = 0
+               w.skinAttributes = { }
+               collectAttributes(w.skinAttributes, widget)
+               
+               # applyAttributes(guiObject, widget, desktop)
+               # guiObject.thisown = 0
+               print screen.additionalWidgets
+               screen.additionalWidgets.append(w)