예제 #1
0
파일: progress.py 프로젝트: bitcraft/pyglet
 def fromXML(cls, element, parent):
     """Create the object from the XML element and attach it to the parent.
     """
     kw = loadxml.parseAttributes(element)
     obj = cls(parent, **kw)
     for child in element.getchildren():
         loadxml.getConstructor(element.tag)(child, obj)
     return obj
예제 #2
0
파일: progress.py 프로젝트: pyzh/pyglet
 def fromXML(cls, element, parent):
     """Create the object from the XML element and attach it to the parent.
     """
     kw = loadxml.parseAttributes(element)
     obj = cls(parent, **kw)
     for child in element.getchildren():
         loadxml.getConstructor(element.tag)(child, obj)
     return obj
 def fromXML(cls, element, parent):
     '''Create the object from the XML element and attach it to the parent.
     '''
     kw = loadxml.parseAttributes(element)
     kw['text'] = xml.sax.saxutils.unescape(element.text)
     obj = cls(parent, **kw)
     for child in element.getchildren():
         loadxml.getConstructor(element.tag)(child, obj)
     return obj
예제 #4
0
 def fromXML(cls, element, parent):
     '''Create the object from the XML element and attach it to the parent.
     '''
     kw = loadxml.parseAttributes(element)
     text = xml.sax.saxutils.unescape(element.text)
     obj = cls(parent, text, **kw)
     for child in element.getchildren():
         loadxml.getConstructor(element.tag)(child, obj)
     return obj
예제 #5
0
    def fromXML(cls, element, parent):
        '''Create the object from the XML element and attach it to the parent.

        If scrollable then put all children loaded into a container frame.
        '''
        kw = loadxml.parseAttributes(element)
        obj = cls(parent, **kw)
        for child in element.getchildren():
            if obj.scrollable:
                loadxml.getConstructor(child.tag)(child, obj.contents)
            else:
                loadxml.getConstructor(child.tag)(child, obj)
        return obj
예제 #6
0
    def fromXML(cls, element, parent):
        '''Create the object from the XML element and attach it to the parent.

        If scrollable then put all children loaded into a container frame.
        '''
        kw = loadxml.parseAttributes(element)
        obj = cls(parent, **kw)
        for child in element.getchildren():
            if obj.scrollable:
                loadxml.getConstructor(child.tag)(child, obj.contents)
            else:
                loadxml.getConstructor(child.tag)(child, obj)
        return obj
예제 #7
0
    def fromXML(cls, element, parent):
        '''Create the object from the XML element and attach it to the parent.

        Create tabs for <tab> child tags.
        '''
        kw = loadxml.parseAttributes(element)
        obj = cls(parent, **kw)
        for child in element.getchildren():
            assert child.tag == 'tab'
            kw = loadxml.parseAttributes(child)
            label = kw.pop('label')
            tab = obj.newTab(label, **kw)
            for content in child.getchildren():
                loadxml.getConstructor(content.tag)(content, tab)
        return obj
예제 #8
0
    def fromXML(cls, element, parent):
        '''Create the object from the XML element and attach it to the parent.

        Create tabs for <tab> child tags.
        '''
        kw = loadxml.parseAttributes(element)
        obj = cls(parent, **kw)
        for child in element.getchildren():
            assert child.tag == 'tab'
            kw = loadxml.parseAttributes(child)
            label = kw.pop('label')
            tab = obj.newTab(label, **kw)
            for content in child.getchildren():
                loadxml.getConstructor(content.tag)(content, tab)
        return obj
예제 #9
0
파일: button.py 프로젝트: bitcraft/pyglet
 def fromXML(cls, element, parent):
     """Create the object from the XML element and attach it to the parent.
     """
     kw = loadxml.parseAttributes(element)
     if element.text:
         text = xml.sax.saxutils.unescape(element.text)
     else:
         text = None
     if 'image' in kw:
         kw['text'] = text
         obj = Button(parent, **kw)
     else:
         obj = TextButton(parent, text, **kw)
     for child in element.getchildren():
         loadxml.getConstructor(child.tag)(child, obj)
     return obj
예제 #10
0
 def fromXML(cls, element, parent):
     """Create the object from the XML element and attach it to the parent.
     """
     kw = loadxml.parseAttributes(element)
     if element.text:
         text = xml.sax.saxutils.unescape(element.text)
     else:
         text = None
     if 'image' in kw:
         kw['text'] = text
         obj = Button(parent, **kw)
     else:
         obj = TextButton(parent, text, **kw)
     for child in element.getchildren():
         loadxml.getConstructor(child.tag)(child, obj)
     return obj