- default fonts handled in windowstyle
authorFelix Domke <tmbinc@elitedvb.net>
Wed, 30 Mar 2005 07:28:17 +0000 (07:28 +0000)
committerFelix Domke <tmbinc@elitedvb.net>
Wed, 30 Mar 2005 07:28:17 +0000 (07:28 +0000)
 - fixed 32bit ARGB support (drawLine)
 - add sdl (but currently disabled)
 - fixed /dev/vc/0 -> /dev/stdin for console input
 - added alignment to label
 - fixed skin parsing (getElementsByTagName didn't do what i expected)

19 files changed:
lib/driver/rcconsole.cpp
lib/dvb/db.cpp
lib/gdi/Makefile.am
lib/gdi/gfont.cpp [new file with mode: 0644]
lib/gdi/gfont.h [new file with mode: 0644]
lib/gdi/gpixmap.cpp
lib/gdi/gpixmap.h
lib/gdi/grc.cpp
lib/gdi/grc.h
lib/gdi/sdl.cpp [new file with mode: 0644]
lib/gdi/sdl.h [new file with mode: 0644]
lib/gui/ebutton.cpp
lib/gui/elabel.cpp
lib/gui/elabel.h
lib/gui/ewidgetdesktop.cpp
lib/gui/ewindowstyle.cpp
lib/gui/ewindowstyle.h
lib/python/enigma_python.i
skin.py

index 3b5397b..98ebed4 100644 (file)
@@ -112,7 +112,7 @@ class eRCConsoleInit
        eRCConsoleDriver driver;
        eRCConsole device;
 public:
-       eRCConsoleInit(): driver("/dev/vc/0"), device(&driver)
+       eRCConsoleInit(): driver("/dev/stdin"), device(&driver)
        {
        }
 };
index fb41df9..cdc05fc 100644 (file)
@@ -30,6 +30,7 @@ eDVBService &eDVBService::operator=(const eDVBService &s)
 RESULT eDVBService::getName(const eServiceReference &ref, std::string &name)
 {
        name = m_service_name;
+       return 0;
 }
 
 int eDVBService::checkFilter(const eServiceReferenceDVB &ref, const eDVBChannelQuery &query)
index 419163c..abb75b7 100644 (file)
@@ -5,4 +5,4 @@ noinst_LIBRARIES = libenigma_gdi.a
 
 libenigma_gdi_a_SOURCES = \
        region.cpp grc.cpp epng.cpp erect.cpp fb.cpp font.cpp font_arabic.cpp gfbdc.cpp  \
-       glcddc.cpp gpixmap.cpp lcd.cpp
+       glcddc.cpp gpixmap.cpp lcd.cpp sdl.cpp gfont.cpp
diff --git a/lib/gdi/gfont.cpp b/lib/gdi/gfont.cpp
new file mode 100644 (file)
index 0000000..14fc8f3
--- /dev/null
@@ -0,0 +1,3 @@
+#include <lib/gdi/gfont.h>
+
+DEFINE_REF(gFont);
diff --git a/lib/gdi/gfont.h b/lib/gdi/gfont.h
new file mode 100644 (file)
index 0000000..d6697ce
--- /dev/null
@@ -0,0 +1,41 @@
+#ifndef __lib_gdi_gfont_h
+#define __lib_gdi_gfont_h
+
+#include <lib/base/object.h>
+#include <string>
+
+/**
+ * \brief A softreference to a font.
+ *
+ * The font is specified by a name and a size.
+ * \c gFont is part of the \ref gdi.
+ */
+class gFont: public iObject
+{
+DECLARE_REF(gFont);
+public:
+
+       std::string family;
+       int pointSize;
+       
+       /**
+        * \brief Constructs a font with the given name and size.
+        * \param family The name of the font, for example "NimbusSansL-Regular Sans L Regular".
+        * \param pointSize the size of the font in PIXELS.
+        */
+       gFont(const std::string &family, int pointSize):
+                       family(family), pointSize(pointSize)
+       {
+       }
+       
+       virtual ~gFont()
+       {
+       }
+       
+       gFont()
+               :pointSize(0)
+       {
+       }
+};
+
+#endif
index 7b7b91a..c2c75e7 100644 (file)
@@ -1,8 +1,6 @@
 #include <lib/gdi/gpixmap.h>
 #include <lib/gdi/region.h>
 
-DEFINE_REF(gFont);
-
 gLookup::gLookup()
        :size(0), lookup(0)
 {
@@ -107,7 +105,7 @@ void gPixmap::unlock()
 
 void gPixmap::fill(const gRegion &region, const gColor &color)
 {
-       int i;
+       unsigned int i;
        for (i=0; i<region.rects.size(); ++i)
        {
                const eRect &area = region.rects[i];
@@ -139,7 +137,7 @@ void gPixmap::fill(const gRegion &region, const gColor &color)
 
 void gPixmap::blit(const gPixmap &src, ePoint pos, const gRegion &clip, int flag)
 {
-       for (int i=0; i<clip.rects.size(); ++i)
+       for (unsigned int i=0; i<clip.rects.size(); ++i)
        {
                eRect area=eRect(pos, src.getSize());
                area&=clip.rects[i];
@@ -269,11 +267,27 @@ static inline int sgn(int a)
 
 void gPixmap::line(const gRegion &clip, ePoint start, ePoint dst, gColor color)
 {
-       __u8 *srf = (__u8*)surface->data;
+       __u8 *srf8 = 0;
+       __u32 *srf32 = 0; 
        int stride = surface->stride;
        
        if (clip.rects.empty())
                return;
+               
+       __u32 col;
+       if (surface->bpp == 8)
+       {
+               srf8 = (__u8*)surface->data;
+       } else if (surface->bpp == 32)
+       {
+               srf32 = (__u32*)surface->data;
+               
+               if (surface->clut.data && color < surface->clut.colors)
+                       col=(surface->clut.data[color].a<<24)|(surface->clut.data[color].r<<16)|(surface->clut.data[color].g<<8)|(surface->clut.data[color].b);
+               else
+                       col=0x10101*color;
+               col^=0xFF000000;                        
+       }
        
        int xa = start.x(), ya = start.y(), xb = dst.x(), yb = dst.y();
        int dx, dy, x, y, s1, s2, e, temp, swap, i;
@@ -292,6 +306,7 @@ void gPixmap::line(const gRegion &clip, ePoint start, ePoint dst, gColor color)
        } else
                swap=0;
        e = 2*dy-dx;
+       
        int lasthit = 0;
        for(i=1; i<=dx; i++)
        {
@@ -328,7 +343,11 @@ void gPixmap::line(const gRegion &clip, ePoint start, ePoint dst, gColor color)
                        } while (!clip.rects[a].contains(x, y));
                        lasthit = a;
                }
-               srf[y * stride + x] = color;
+               
+               if (srf8)
+                       srf8[y * stride + x] = color;
+               if (srf32)
+                       srf32[y * stride/4 + x] = col;
 fail:
                while (e>=0)
                {
index 396d92b..e549787 100644 (file)
@@ -81,40 +81,6 @@ struct gLookup
        void build(int size, const gPalette &pal, const gRGB &start, const gRGB &end);
 };
 
-/**
- * \brief A softreference to a font.
- *
- * The font is specified by a name and a size.
- * \c gFont is part of the \ref gdi.
- */
-class gFont: public iObject
-{
-DECLARE_REF(gFont);
-public:
-
-       std::string family;
-       int pointSize;
-       
-       /**
-        * \brief Constructs a font with the given name and size.
-        * \param family The name of the font, for example "NimbusSansL-Regular Sans L Regular".
-        * \param pointSize the size of the font in PIXELS.
-        */
-       gFont(const std::string &family, int pointSize):
-                       family(family), pointSize(pointSize)
-       {
-       }
-       
-       virtual ~gFont()
-       {
-       }
-       
-       gFont()
-               :pointSize(0)
-       {
-       }
-};
-
 struct gSurface
 {
        int type;
index a63aef9..e774896 100644 (file)
@@ -302,6 +302,10 @@ void gPainter::clippop()
 
 void gPainter::flush()
 {
+       gOpcode o;
+       o.opcode = gOpcode::flush;
+       o.dc = m_dc.grabRef();
+       m_rc->submit(o);
 }
 
 void gPainter::end()
@@ -340,15 +344,16 @@ void gDC::exec(gOpcode *o)
        case gOpcode::renderText:
        {
                ePtr<eTextPara> para = new eTextPara(o->parm.renderText->area);
+               int flags = o->parm.renderText->flags;
                assert(m_current_font);
                para->setFont(m_current_font);
-               para->renderString(o->parm.renderText->text, 0);
+               para->renderString(o->parm.renderText->text, (flags & gPainter::RT_WRAP) ? RS_WRAP : 0);
                
-               if (o->parm.renderText->flags & gPainter::RT_HALIGN_RIGHT)
+               if (flags & gPainter::RT_HALIGN_RIGHT)
                        para->realign(eTextPara::dirRight);
-               else if (o->parm.renderText->flags & gPainter::RT_HALIGN_CENTER)
+               else if (flags & gPainter::RT_HALIGN_CENTER)
                        para->realign(eTextPara::dirCenter);
-               else if (o->parm.renderText->flags & gPainter::RT_HALIGN_BLOCK)
+               else if (flags & gPainter::RT_HALIGN_BLOCK)
                        para->realign(eTextPara::dirBlock);
                
                ePoint offset = m_current_offset;
@@ -454,6 +459,8 @@ void gDC::exec(gOpcode *o)
                        m_current_offset  = o->parm.setOffset->value;
                delete o->parm.setOffset;
                break;
+       case gOpcode::flush:
+               break;
        default:
                eFatal("illegal opcode %d. expect memory leak!", o->opcode);
        }
index f682990..8de5dad 100644 (file)
@@ -17,6 +17,7 @@
 #include <lib/gdi/erect.h>
 #include <lib/gdi/gpixmap.h>
 #include <lib/gdi/region.h>
+#include <lib/gdi/gfont.h>
 
 class eTextPara;
 
@@ -44,6 +45,8 @@ struct gOpcode
                
                setClip, addClip, popClip,
                
+               flush,
+               
                end,shutdown
        } opcode;
 
@@ -178,10 +181,16 @@ public:
        enum
        {
                        // todo, make mask. you cannot align both right AND center AND block ;)
+               RT_HALIGN_LEFT = 0,  /* default */
                RT_HALIGN_RIGHT = 1,
                RT_HALIGN_CENTER = 2,
                RT_HALIGN_BLOCK = 4,
-               RT_VALIGN_CENTER = 8
+               
+               RT_VALIGN_TOP = 0,  /* default */
+               RT_VALIGN_CENTER = 8,
+               RT_VALIGN_BOTTOM = 16,
+               
+               RT_WRAP = 32
        };
        void renderText(const eRect &position, const std::string &string, int flags=0);
        
diff --git a/lib/gdi/sdl.cpp b/lib/gdi/sdl.cpp
new file mode 100644 (file)
index 0000000..591487f
--- /dev/null
@@ -0,0 +1,85 @@
+#include <lib/gdi/sdl.h>
+
+#include <lib/base/init.h>
+#include <lib/base/init_num.h>
+
+#include <SDL.h>
+
+gSDLDC *gSDLDC::m_instance;
+
+gSDLDC::gSDLDC()
+{
+       if (SDL_Init(SDL_INIT_VIDEO) < 0)
+       {
+               eWarning("Could not initialize SDL: %s", SDL_GetError());
+               return;
+       }
+       
+       m_screen = SDL_SetVideoMode(720, 576, 32, SDL_HWSURFACE);
+       if (!m_screen)
+       {
+               eWarning("Could not create SDL surface: %s", SDL_GetError());
+               return;
+       }
+
+       m_instance=this;
+       
+       m_surface.type = 0;
+       m_surface.x = m_screen->w;
+       m_surface.y = m_screen->h;
+       m_surface.bpp = m_screen->format->BitsPerPixel;
+       m_surface.bypp = m_screen->format->BytesPerPixel;
+       m_surface.stride = m_screen->pitch;
+       m_surface.data = m_screen->pixels;
+       m_surface.clut.colors=256;
+       m_surface.clut.data=new gRGB[m_surface.clut.colors];
+       
+       m_pixmap = new gPixmap(&m_surface);
+       
+       memset(m_surface.clut.data, 0, sizeof(*m_surface.clut.data)*m_surface.clut.colors);
+}
+
+gSDLDC::~gSDLDC()
+{
+       SDL_Quit();
+       m_instance=0;
+}
+
+void gSDLDC::setPalette()
+{
+       if (!m_surface.clut.data)
+               return;
+       
+/*     for (int i=0; i<256; ++i)
+       {
+               fb->CMAP()->red[i]=ramp[m_surface.clut.data[i].r]<<8;
+               fb->CMAP()->green[i]=ramp[m_surface.clut.data[i].g]<<8;
+               fb->CMAP()->blue[i]=ramp[m_surface.clut.data[i].b]<<8;
+               fb->CMAP()->transp[i]=rampalpha[m_surface.clut.data[i].a]<<8;
+               if (!fb->CMAP()->red[i])
+                       fb->CMAP()->red[i]=0x100;
+       }
+       fb->PutCMAP(); */
+}
+
+void gSDLDC::exec(gOpcode *o)
+{
+       switch (o->opcode)
+       {
+       case gOpcode::setPalette:
+       {
+               gDC::exec(o);
+               setPalette();
+               break;
+       }
+       case gOpcode::flush:
+               SDL_Flip(m_screen);
+               eDebug("FLUSH");
+               break;
+       default:
+               gDC::exec(o);
+               break;
+       }
+}
+
+eAutoInitPtr<gSDLDC> init_gSDLDC(eAutoInitNumbers::graphic-1, "gSDLDC");
diff --git a/lib/gdi/sdl.h b/lib/gdi/sdl.h
new file mode 100644 (file)
index 0000000..20ff04f
--- /dev/null
@@ -0,0 +1,27 @@
+#ifndef __lib_gdi_sdl_h
+#define __lib_gdi_sdl_h
+
+#include "fb.h"
+#include "gpixmap.h"
+#include "grc.h"
+
+#include <SDL.h>
+
+class gSDLDC: public gDC
+{
+       SDL_Surface *m_screen;
+       static gSDLDC *m_instance;
+       void exec(gOpcode *opcode);
+
+       void setPalette();
+       gSurface m_surface;
+public:
+       
+       gSDLDC();
+       virtual ~gSDLDC();
+       static int getInstance(ePtr<gSDLDC> &ptr) { if (!m_instance) return -1; ptr = m_instance; return 0; }
+       int islocked() { return 0; }
+};
+
+
+#endif
index 06cfda0..30824df 100644 (file)
@@ -2,6 +2,9 @@
 
 eButton::eButton(eWidget *parent): eLabel(parent)
 {
+               /* default to center alignment */
+       m_valign = alignCenter;
+       m_halign = alignCenter;
 }
 
 void eButton::push()
index 281a9d2..3519a7a 100644 (file)
@@ -2,7 +2,14 @@
 
 eLabel::eLabel(eWidget *parent): eWidget(parent)
 {
+       ePtr<eWindowStyle> style;
+       getStyle(style);
        
+       style->getFont(eWindowStyle::fontStatic, m_font);
+       
+               /* default to topleft alignment */
+       m_valign = alignTop;
+       m_halign = alignLeft;
 }
 
 int eLabel::event(int event, void *data, void *data2)
@@ -18,14 +25,34 @@ int eLabel::event(int event, void *data, void *data2)
                eWidget::event(event, data, data2);
 
                gPainter &painter = *(gPainter*)data2;
-               ePtr<gFont> fnt = new gFont("Arial", 14);
-               painter.setFont(fnt);
+               painter.setFont(m_font);
                style->setStyle(painter, eWindowStyle::styleLabel);
-               painter.renderText(eRect(0, 0, size().width(), size().height()), m_text, gPainter::RT_HALIGN_CENTER|gPainter::RT_VALIGN_CENTER);
+               
+               int flags = 0;
+               if (m_valign == alignTop)
+                       flags |= gPainter::RT_VALIGN_TOP;
+               else if (m_valign == alignCenter)
+                       flags |= gPainter::RT_VALIGN_CENTER;
+               else if (m_valign == alignBottom)
+                       flags |= gPainter::RT_VALIGN_BOTTOM;
+
+               if (m_halign == alignLeft)
+                       flags |= gPainter::RT_HALIGN_LEFT;
+               else if (m_halign == alignCenter)
+                       flags |= gPainter::RT_HALIGN_CENTER;
+               else if (m_halign == alignRight)
+                       flags |= gPainter::RT_HALIGN_RIGHT;
+               else if (m_halign == alignBlock)
+                       flags |= gPainter::RT_HALIGN_BLOCK;
+               
+               flags |= gPainter::RT_WRAP;
+               painter.renderText(eRect(0, 0, size().width(), size().height()), m_text, flags);
                
                return 0;
        }
+       case evtChangedFont:
        case evtChangedText:
+       case evtChangedAlignment:
                invalidate();
                return 0;
        default:
@@ -40,3 +67,21 @@ void eLabel::setText(const std::string &string)
        m_text = string;
        event(evtChangedText);
 }
+
+void eLabel::setFont(gFont *font)
+{
+       m_font = font;
+       event(evtChangedFont);
+}
+
+void eLabel::setVAlign(int align)
+{
+       m_valign = align;
+       event(evtChangedAlignment);
+}
+
+void eLabel::setHAlign(int align)
+{
+       m_halign = align;
+       event(evtChangedAlignment);
+}
index b1f7c2c..7e07f43 100644 (file)
@@ -8,12 +8,30 @@ class eLabel: public eWidget
 public:
        eLabel(eWidget *parent);
        void setText(const std::string &string);
+       void setFont(gFont *font);
+       
+       enum
+       {
+               alignLeft,
+               alignTop=alignLeft,
+               alignCenter,
+               alignRight,
+               alignBottom=alignRight,
+               alignBlock
+       };
+       
+       void setVAlign(int align);
+       void setHAlign(int align);
 protected:
+       ePtr<gFont> m_font;
+       int m_valign, m_halign;
        int event(int event, void *data=0, void *data2=0);
 private:
        enum eLabelEvent
        {
-               evtChangedText = evtUserWidget
+               evtChangedText = evtUserWidget,
+               evtChangedFont,
+               evtChangedAlignment
        };
        std::string m_text;
 };
index 1b5cf9b..96f7463 100644 (file)
@@ -82,6 +82,8 @@ void eWidgetDesktop::paint()
        painter.setBackgroundColor(m_background_color);
        painter.clear();
        
+       painter.flush();
+       
        m_dirty_region = gRegion();
 }
 
index 25b8946..a2e0efb 100644 (file)
@@ -110,6 +110,27 @@ void eWindowStyleSimple::drawFrame(gPainter &painter, const eRect &frame, int wh
        painter.line(frame.bottomLeft1(), frame.topLeft1());
 }
 
+RESULT eWindowStyleSimple::getFont(int what, ePtr<gFont> &fnt)
+{
+       fnt = 0;
+       switch (what)
+       {
+       case fontStatic:
+               fnt = new gFont("Arial", 12);
+               break;
+       case fontButton:
+               fnt = new gFont("Arial", 20);
+               break;
+       case fontTitlebar:
+               fnt = new gFont("Arial", 25);
+               break;
+       default:
+               return -1;
+       }
+       return 0;
+}
+
+#if 0
 DEFINE_REF(eWindowStyleSkinned);
 
 eWindowStyleSkinned::eWindowStyleSkinned()
@@ -140,3 +161,4 @@ void eWindowStyleSkinned::drawBorder(gPainter &painter, const eSize &size, const
 {
 }
 
+#endif
index 0014bfa..f11d99d 100644 (file)
@@ -27,8 +27,15 @@ public:
                frameButton,
                frameListboxEntry
        };
+       
+       enum {
+               fontStatic,
+               fontButton,
+               fontTitlebar
+       };
+       
+       virtual RESULT getFont(int what, ePtr<gFont> &font) = 0;
        virtual ~eWindowStyle() = 0;
-
 };
 
 class eWindowStyleSimple: public eWindowStyle
@@ -46,8 +53,10 @@ public:
        void paintBackground(gPainter &painter, const ePoint &offset, const eSize &size);
        void setStyle(gPainter &painter, int what);
        void drawFrame(gPainter &painter, const eRect &frame, int what);
+       RESULT getFont(int what, ePtr<gFont> &font);
 };
 
+#if 0
 class eWindowStyleSkinned: public eWindowStyle
 {
        DECLARE_REF(eWindowStyleSkinned);
@@ -86,5 +95,6 @@ private:
        
        void drawBorder(gPainter &painter, const eSize &size, const struct borderSet &border, int where);
 };
+#endif
 
 #endif
index 096254f..59133cc 100644 (file)
@@ -58,6 +58,7 @@ is usually caused by not marking PSignals as immutable.
 #include <lib/components/scan.h>
 #include <lib/nav/pcore.h>
 #include <lib/actions/action.h>
+#include <lib/gdi/gfont.h>
 
 extern void runMainloop();
 extern void quitMainloop();
@@ -106,6 +107,7 @@ extern PSignal1<void,int> &keyPressedSignal();
 %include <lib/components/scan.h>
 %include <lib/nav/pcore.h>
 %include <lib/actions/action.h>
+%include <lib/gdi/gfont.h>
 
 /**************  eptr  **************/
 
diff --git a/skin.py b/skin.py
index db4812a..6ef8f93 100644 (file)
--- a/skin.py
+++ b/skin.py
@@ -14,7 +14,7 @@ dom = xml.dom.minidom.parseString(
        """
        <skin>
                <screen name="mainMenu" position="300,100" size="300,300" title="real main menu">
-                       <widget name="okbutton" position="10,190" size="280,50" />
+                       <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,140" />
                </screen>
@@ -44,6 +44,12 @@ dom = xml.dom.minidom.parseString(
 """)
 
 
+def elementsWithTag(el, tag):
+       for x in el:
+               if x.nodeType != xml.dom.minidom.Element.nodeType:
+                       continue
+               if x.tagName == tag:
+                       yield x
 
 def parsePosition(str):
        x, y = str.split(',')
@@ -53,6 +59,10 @@ def parseSize(str):
        x, y = str.split(',')
        return eSize(int(x), int(y))
 
+def parseFont(str):
+       name, size = str.split(':')
+       return gFont(name, int(size))
+
 def applyAttributes(guiObject, node):
        # walk all attributes
        for p in range(node.attributes.length):
@@ -65,33 +75,58 @@ def applyAttributes(guiObject, node):
                value = str(a.value)
                
                # and set attributes
-               if attrib == 'position':
-                       guiObject.move(parsePosition(value))
-               elif attrib == 'size':
-                       guiObject.resize(parseSize(value))
-               elif attrib == 'title':
-                       guiObject.setTitle(value)
-               elif attrib != 'name':
-                       print "unsupported attribute " + attrib + "=" + value
+               try:
+                       if attrib == 'position':
+                               guiObject.move(parsePosition(value))
+                       elif attrib == 'size':
+                               guiObject.resize(parseSize(value))
+                       elif attrib == 'title':
+                               guiObject.setTitle(value)
+                       elif attrib == 'font':
+                               guiObject.setFont(parseFont(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 != 'name':
+                               print "unsupported attribute " + attrib + "=" + value
+               except AttributeError:
+                       print "widget %s (%s) doesn't support attribute %s!" % ("", guiObject.__class__.__name__, attrib)
 
 def applyGUIskin(screen, parent, skin, name):
        
        myscreen = None
        
        # first, find the corresponding screen element
-       skin = dom.getElementsByTagName("skin")[0]
-       screens = skin.getElementsByTagName("screen")
-       del skin
-       for x in screens:
+       skin = dom.childNodes[0]
+       assert skin.tagName == "skin", "root element in skin must be 'skin'!"
+       
+       for x in elementsWithTag(skin.childNodes, "screen"):
                if x.getAttribute('name') == name:
                        myscreen = x
+       del skin
        
        assert myscreen != None, "no skin for screen '" + name + "' found!"
        
        applyAttributes(parent, myscreen)
        
        # now walk all widgets
-       for widget in myscreen.getElementsByTagName("widget"):
+       for widget in elementsWithTag(myscreen.childNodes, "widget"):
                wname = widget.getAttribute('name')
                if wname == None:
                        print "widget has no name!"