1 # Name: xxx.py ('xxx' is easy to distinguish from 'wx' :) )
2 # Purpose: XML interface classes
3 # Author: Roman Rolinsky <rolinsky@mema.ucl.ac.be>
7 from wxPython
.wx
import *
8 from wxPython
.xrc
import *
9 from xml
.dom
import minidom
10 import wxPython
.lib
.wxpTag
14 # Parameter value class
16 # Standard use: for text nodes
17 def __init__(self
, node
):
19 if not node
.hasChildNodes():
20 # If does not have child nodes, create empty text node
21 text
= tree
.dom
.createTextNode('')
22 node
.appendChild(text
)
24 text
= node
.childNodes
[0] # first child must be text node
25 assert text
.nodeType
== minidom
.Node
.TEXT_NODE
27 # Value returns string
29 return str(self
.textNode
.data
)
30 def update(self
, value
):
31 self
.textNode
.data
= value
33 self
.node
.parentNode
.removeChild(self
.node
)
37 class xxxParamContent
:
38 def __init__(self
, node
):
40 data
, l
= [], [] # data is needed to quicker value retrieval
41 nodes
= node
.childNodes
[:] # make a copy of the child list
43 if n
.nodeType
== minidom
.Node
.ELEMENT_NODE
:
44 assert n
.tagName
== 'item', 'bad content content'
45 if not n
.hasChildNodes():
46 # If does not have child nodes, create empty text node
47 text
= tree
.dom
.createTextNode('')
48 node
.appendChild(text
)
51 text
= n
.childNodes
[0] # first child must be text node
52 assert text
.nodeType
== minidom
.Node
.TEXT_NODE
54 data
.append(text
.data
)
58 self
.l
, self
.data
= l
, data
61 def update(self
, value
):
62 # If number if items is not the same, recreate children
63 if len(value
) != len(self
.l
): # remove first if number of items has changed
64 for n
in self
.node
.childNodes
:
65 self
.node
.removeChild(n
)
68 itemElem
= tree
.dom
.createElement('item')
69 itemText
= tree
.dom
.createTextNode(str)
70 itemElem
.appendChild(itemText
)
71 self
.node
.appendChild(itemElem
)
74 for i
in range(len(value
)):
75 self
.l
[i
].data
= value
[i
]
78 ################################################################################
80 # Classes to interface DOM objects
83 hasChildren
= false
# has children elements?
84 hasStyle
= true
# almost everyone
85 hasName
= true
# has name attribute?
86 isSizer
= hasChild
= false
87 # Style parameters (all optional)
88 styles
= ['fg', 'bg', 'font', 'enabled', 'focused', 'hidden', 'tooltip']
91 # Required paremeters: none by default
93 # Default parameters with default values
97 # Window styles and extended styles
101 # Construct a new xxx object from DOM element
102 # parent is parent xxx object (or None if none), element is DOM element object
103 def __init__(self
, parent
, element
):
105 self
.element
= element
108 self
.className
= element
.getAttribute('class')
109 if self
.hasName
: self
.name
= element
.getAttribute('name')
110 # Set parameters (text element children)
112 nodes
= element
.childNodes
[:]
114 if node
.nodeType
== minidom
.Node
.ELEMENT_NODE
:
117 continue # do nothing for object children here
118 if not tag
in self
.allParams
and not tag
in self
.styles
:
119 print 'WARNING: unknown parameter for %s: %s' % \
120 (self
.className
, tag
)
121 elif tag
in self
.specials
:
122 self
.special(tag
, node
)
123 elif tag
== 'content':
124 self
.params
[tag
] = xxxParamContent(node
)
125 elif tag
== 'font': # has children
126 self
.params
[tag
] = xxxParamFont(self
, node
)
127 else: # simple parameter
128 self
.params
[tag
] = xxxParam(node
)
130 # Remove all other nodes
131 element
.removeChild(node
)
134 def generateHtml(self
, prefix
=''):
136 html
= '<table cellspacing=0 cellpadding=0><tr><td width=120>\
137 <font size="+1"><b>%s</b></font></td>' % self
.className
138 # Has id (name) attribute
141 <td><wxp module="xxx" class="ParamText" width=150>
142 <param name="name" value="data_name">
144 html
+= '</table><p>'
145 html
+= '<table cellspacing=0 cellpadding=0>\n'
146 # Add required parameters
147 for param
in self
.allParams
:
148 # Add checkbox or just text
149 if param
in self
.required
:
150 html
+= '<tr><td width=20></td><td width=100>%s: </td>' % param
151 else: # optional parameter
153 <tr><td width=20><wxp class="wxCheckBox">
154 <param name="id" value="%d">
155 <param name="size" value="(20,-1)">
156 <param name="name" value="%s">
157 <param name="label" value=("")>
158 </wxp></td><td width=100>%s: </td>
159 """ % (paramIDs
[param
], prefix
+ 'check_' + param
, param
)
162 # Local or overriden type
163 typeClass
= self
.paramDict
[param
].__name
__
167 typeClass
= paramDict
[param
].__name
__
170 typeClass
= 'ParamText'
172 <td><wxp module="xxx" class="%s">
173 <param name="id" value="%d">
174 <param name="name" value="%s">
176 """ % (typeClass
, -1, prefix
+ 'data_' + param
)
179 # Returns real tree object
180 def treeObject(self
):
181 if self
.hasChild
: return self
.child
183 # Returns tree image index
185 if self
.hasChild
: return self
.child
.treeImage()
187 # Class name plus wx name
189 if self
.hasChild
: return self
.child
.treeName()
190 if self
.hasName
and self
.name
: return self
.className
+ ' "' + self
.name
+ '"'
191 return self
.className
193 ################################################################################
195 class xxxParamFont(xxxParam
):
196 allParams
= ['size', 'style', 'weight', 'family', 'underlined',
198 def __init__(self
, parent
, element
):
199 xxxObject
.__init
__(self
, parent
, element
)
200 self
.parentNode
= element
# required to behave similar to DOM node
202 for p
in self
.allParams
:
204 v
.append(str(self
.params
[p
].data
))
208 def update(self
, value
):
209 # `value' is a list of strings corresponding to all parameters
211 for node
in elem
.childNodes
:
212 elem
.removeChild(node
)
216 for param
in self
.allParams
:
218 fontElem
= tree
.dom
.createElement(param
)
219 textNode
= tree
.dom
.createTextNode(value
[i
])
220 self
.params
[param
] = textNode
221 fontElem
.appendChild(textNode
)
222 elem
.appendChild(fontElem
)
227 ################################################################################
229 class xxxContainer(xxxObject
):
232 ################################################################################
235 class xxxPanel(xxxContainer
):
236 allParams
= ['pos', 'size', 'style']
237 styles
= ['fg', 'bg', 'font', 'enabled', 'focused', 'hidden', 'exstyle',
239 winStyles
= ['wxNO_3D', 'wxTAB_TRAVERSAL', 'wxCLIP_CHILDREN']
240 exStyles
= ['wxWS_EX_VALIDATE_RECURSIVELY']
242 class xxxDialog(xxxContainer
):
243 allParams
= ['title', 'pos', 'size', 'style']
245 winStyles
= ['wxDEFAULT_DIALOG_STYLE', 'wxSTAY_ON_TOP',
246 'wxDIALOG_MODAL', 'wxDIALOG_MODELESS',
247 'wxCAPTION', 'wxSYSTEM_MENU', 'wxRESIZE_BORDER', 'wxRESIZE_BOX',
249 'wxNO_3D', 'wxTAB_TRAVERSAL', 'wxCLIP_CHILDREN']
250 styles
= ['fg', 'bg', 'font', 'enabled', 'focused', 'hidden', 'exstyle',
252 exStyles
= ['wxWS_EX_VALIDATE_RECURSIVELY']
254 class xxxFrame(xxxContainer
):
255 allParams
= ['title', 'centered', 'pos', 'size', 'style']
256 paramDict
= {'centered': ParamBool}
258 winStyles
= ['wxDEFAULT_FRAME_STYLE', 'wxDEFAULT_DIALOG_STYLE',
260 'wxCAPTION', 'wxSYSTEM_MENU', 'wxRESIZE_BORDER',
261 'wxRESIZE_BOX', 'wxMINIMIZE_BOX', 'wxMAXIMIZE_BOX',
262 'wxFRAME_FLOAT_ON_PARENT', 'wxFRAME_TOOL_WINDOW',
263 'wxNO_3D', 'wxTAB_TRAVERSAL', 'wxCLIP_CHILDREN']
264 styles
= ['fg', 'bg', 'font', 'enabled', 'focused', 'hidden', 'exstyle',
266 exStyles
= ['wxWS_EX_VALIDATE_RECURSIVELY']
268 class xxxTool(xxxObject
):
269 allParams
= ['bitmap', 'bitmap2', 'toggle', 'tooltip', 'longhelp']
270 paramDict
= {'bitmap2': ParamFile}
273 class xxxToolBar(xxxContainer
):
274 allParams
= ['bitmapsize', 'margins', 'packing', 'separation',
275 'pos', 'size', 'style']
277 paramDict
= {'bitmapsize': ParamPosSize
, 'margins': ParamPosSize
,
278 'packing': ParamInt
, 'separation': ParamInt
,
279 'style': ParamNonGenericStyle
}
280 winStyles
= ['wxTB_FLAT', 'wxTB_DOCKABLE', 'wxTB_VERTICAL', 'wxTB_HORIZONTAL']
282 ################################################################################
285 class xxxBitmap(xxxObject
):
286 allParams
= ['bitmap']
287 required
= ['bitmap']
289 class xxxIcon(xxxObject
):
293 ################################################################################
296 class xxxStaticText(xxxObject
):
297 allParams
= ['label', 'pos', 'size', 'style']
299 winStyles
= ['wxALIGN_LEFT', 'wxALIGN_RIGHT', 'wxALIGN_CENTRE', 'wxST_NO_AUTORESIZE']
301 class xxxStaticLine(xxxObject
):
302 allParams
= ['pos', 'size', 'style']
303 winStyles
= ['wxLI_HORIZONTAL', 'wxLI_VERTICAL']
305 class xxxStaticBitmap(xxxObject
):
306 allParams
= ['bitmap', 'pos', 'size', 'style']
307 required
= ['bitmap']
309 class xxxTextCtrl(xxxObject
):
310 allParams
= ['value', 'pos', 'size', 'style']
311 winStyles
= ['wxTE_PROCESS_ENTER', 'wxTE_PROCESS_TAB', 'wxTE_MULTILINE',
312 'wxTE_PASSWORD', 'wxTE_READONLY', 'wxHSCROLL']
314 class xxxChoice(xxxObject
):
315 allParams
= ['content', 'selection', 'pos', 'size', 'style']
316 required
= ['content']
317 winStyles
= ['wxCB_SORT']
319 class xxxSlider(xxxObject
):
320 allParams
= ['value', 'min', 'max', 'pos', 'size', 'style',
321 'tickfreq', 'pagesize', 'linesize', 'thumb', 'tick',
323 paramDict
= {'value': ParamInt
, 'tickfreq': ParamInt
, 'pagesize': ParamInt
,
324 'linesize': ParamInt
, 'thumb': ParamInt
, 'thumb': ParamInt
,
325 'tick': ParamInt
, 'selmin': ParamInt
, 'selmax': ParamInt
}
326 required
= ['value', 'min', 'max']
327 winStyles
= ['wxSL_HORIZONTAL', 'wxSL_VERTICAL', 'wxSL_AUTOTICKS', 'wxSL_LABELS',
328 'wxSL_LEFT', 'wxSL_RIGHT', 'wxSL_TOP', 'wxSL_BOTTOM',
329 'wxSL_BOTH', 'wxSL_SELRANGE']
331 class xxxGauge(xxxObject
):
332 allParams
= ['range', 'pos', 'size', 'style', 'value', 'shadow', 'bezel']
333 paramDict
= {'range': ParamInt
, 'value': ParamInt
,
334 'shadow': ParamInt
, 'bezel': ParamInt
}
335 winStyles
= ['wxGA_HORIZONTAL', 'wxGA_VERTICAL', 'wxGA_PROGRESSBAR', 'wxGA_SMOOTH']
337 class xxxScrollBar(xxxObject
):
338 allParams
= ['pos', 'size', 'style', 'value', 'thumbsize', 'range', 'pagesize']
339 paramDict
= {'value': ParamInt
, 'range': ParamInt
, 'thumbsize': ParamInt
,
340 'pagesize': ParamInt
}
341 winStyles
= ['wxSB_HORIZONTAL', 'wxSB_VERTICAL']
343 class xxxListCtrl(xxxObject
):
344 allParams
= ['pos', 'size', 'style']
345 winStyles
= ['wxLC_LIST', 'wxLC_REPORT', 'wxLC_ICON', 'wxLC_SMALL_ICON',
346 'wxLC_ALIGN_TOP', 'wxLC_ALIGN_LEFT', 'wxLC_AUTOARRANGE',
347 'wxLC_USER_TEXT', 'wxLC_EDIT_LABELS', 'wxLC_NO_HEADER',
348 'wxLC_SINGLE_SEL', 'wxLC_SORT_ASCENDING', 'wxLC_SORT_DESCENDING']
351 xxxCheckList
= xxxListCtrl
353 class xxxTreeCtrl(xxxObject
):
354 allParams
= ['pos', 'size', 'style']
355 winStyles
= ['wxTR_HAS_BUTTONS', 'wxTR_NO_LINES', 'wxTR_LINES_AT_ROOT',
356 'wxTR_EDIT_LABELS', 'wxTR_MULTIPLE']
358 class xxxHtmlWindow(xxxObject
):
359 allParams
= ['pos', 'size', 'style', 'borders', 'url', 'htmlcode']
360 paramDict
= {'borders': ParamInt}
361 winStyles
= ['wxHW_SCROLLBAR_NEVER', 'wxHW_SCROLLBAR_AUTO']
363 class xxxCalendar(xxxObject
):
364 allParams
= ['pos', 'size', 'style']
366 class xxxNotebook(xxxContainer
):
367 allParams
= ['usenotebooksizer', 'pos', 'size', 'style']
368 paramDict
= {'usenotebooksizer': ParamBool}
369 winStyles
= ['wxNB_FIXEDWIDTH', 'wxNB_LEFT', 'wxNB_RIGHT', 'wxNB_BOTTOM']
371 ################################################################################
374 class xxxButton(xxxObject
):
375 allParams
= ['label', 'default', 'pos', 'size', 'style']
376 paramDict
= {'default': ParamBool}
378 winStyles
= ['wxBU_LEFT', 'wxBU_TOP', 'wxBU_RIGHT', 'wxBU_BOTTOM']
380 class xxxBitmapButton(xxxObject
):
381 allParams
= ['bitmap', 'selected', 'focus', 'disabled', 'default',
382 'pos', 'size', 'style']
383 required
= ['bitmap']
384 winStyles
= ['wxBU_AUTODRAW', 'wxBU_LEFT', 'wxBU_TOP',
385 'wxBU_RIGHT', 'wxBU_BOTTOM']
387 class xxxRadioButton(xxxObject
):
388 allParams
= ['label', 'value', 'pos', 'size', 'style']
389 paramDict
= {'value': ParamBool}
391 winStyles
= ['wxRB_GROUP']
393 class xxxSpinButton(xxxObject
):
394 allParams
= ['pos', 'size', 'style']
395 winStyles
= ['wxSP_HORIZONTAL', 'wxSP_VERTICAL', 'wxSP_ARROW_KEYS', 'wxSP_WRAP']
397 ################################################################################
400 class xxxStaticBox(xxxObject
):
401 allParams
= ['label', 'pos', 'size', 'style']
404 class xxxRadioBox(xxxObject
):
405 allParams
= ['label', 'content', 'selection', 'dimension', 'pos', 'size', 'style']
406 paramDict
= {'dimension': ParamInt}
407 required
= ['label', 'content']
408 winStyles
= ['wxRA_SPECIFY_ROWS', 'wxRA_SPECIFY_COLS']
410 class xxxCheckBox(xxxObject
):
411 allParams
= ['label', 'pos', 'size', 'style']
414 class xxxComboBox(xxxObject
):
415 allParams
= ['content', 'selection', 'value', 'pos', 'size', 'style']
416 required
= ['content']
417 winStyles
= ['wxCB_SIMPLE', 'wxCB_SORT', 'wxCB_READONLY', 'wxCB_DROPDOWN']
419 class xxxListBox(xxxObject
):
420 allParams
= ['content', 'selection', 'pos', 'size', 'style']
421 required
= ['content']
422 winStyles
= ['wxLB_SINGLE', 'wxLB_MULTIPLE', 'wxLB_EXTENDED', 'wxLB_HSCROLL',
423 'wxLB_ALWAYS_SB', 'wxLB_NEEDED_SB', 'wxLB_SORT']
425 ################################################################################
428 class xxxSizer(xxxContainer
):
429 hasName
= hasStyle
= false
430 paramDict
= {'orient': ParamOrient}
433 class xxxBoxSizer(xxxSizer
):
434 allParams
= ['orient']
435 required
= ['orient']
436 default
= {'orient': 'wxVERTICAL'}
437 # Tree icon depends on orientation
439 if self
.params
['orient'].value() == 'wxHORIZONTAL': return self
.imageH
440 else: return self
.imageV
442 class xxxStaticBoxSizer(xxxBoxSizer
):
443 allParams
= ['label', 'orient']
444 required
= ['label', 'orient']
445 default
= {'orient': 'wxVERTICAL'}
447 class xxxGridSizer(xxxSizer
):
448 allParams
= ['cols', 'rows', 'vgap', 'hgap']
450 default
= {'cols': '2', 'rows': '2'}
452 # For repeated parameters
455 self
.l
, self
.data
= [], []
456 def append(self
, param
):
458 self
.data
.append(param
.value())
464 self
.l
, self
.data
= [], []
466 class xxxFlexGridSizer(xxxGridSizer
):
467 specials
= ['growablecols', 'growablerows']
468 allParams
= ['cols', 'rows', 'vgap', 'hgap'] + specials
469 paramDict
= {'growablecols':ParamContent, 'growablerows':ParamContent}
470 # Special processing for growable* parameters
471 # (they are represented by several nodes)
472 def special(self
, tag
, node
):
473 if tag
not in self
.params
.keys():
474 self
.params
[tag
] = xxxParamMulti()
475 self
.params
[tag
].append(xxxParam(node
))
476 def setSpecial(self
, param
, value
):
477 # Straightforward implementation: remove, add again
478 self
.params
[param
].remove()
479 del self
.params
[param
]
481 node
= tree
.dom
.createElement(param
)
482 text
= tree
.dom
.createTextNode(str)
483 node
.appendChild(text
)
484 self
.element
.appendChild(node
)
485 self
.special(param
, node
)
487 # Container with only one child.
489 class xxxChildContainer(xxxObject
):
490 hasName
= hasStyle
= false
492 def __init__(self
, parent
, element
):
493 xxxObject
.__init
__(self
, parent
, element
)
494 # Must have one child with 'object' tag, but we don't check it
495 nodes
= element
.childNodes
[:] # create copy
497 if node
.nodeType
== minidom
.Node
.ELEMENT_NODE
:
498 if node
.tagName
== 'object':
499 # Create new xxx object for child node
500 self
.child
= MakeXXXFromDOM(self
, node
)
501 self
.child
.parent
= parent
502 # Copy hasChildren and isSizer attributes
503 self
.hasChildren
= self
.child
.hasChildren
504 self
.isSizer
= self
.child
.isSizer
507 element
.removeChild(node
)
509 assert 0, 'no child found'
510 def generateHtml(self
):
511 return xxxObject
.generateHtml(self
, '_') + '<hr>\n' + \
512 self
.child
.generateHtml()
514 class xxxSizerItem(xxxChildContainer
):
515 allParams
= ['option', 'flag', 'border']
516 paramDict
= {'option': ParamInt}
517 def __init__(self
, parent
, element
):
518 xxxChildContainer
.__init
__(self
, parent
, element
)
519 # Remove pos parameter - unnecessary for sizeritems
520 if 'pos' in self
.child
.allParams
:
521 self
.child
.allParams
= self
.child
.allParams
[:]
522 self
.child
.allParams
.remove('pos')
524 class xxxNotebookPage(xxxChildContainer
):
525 allParams
= ['label', 'selected']
526 paramDict
= {'selected': ParamBool}
528 def __init__(self
, parent
, element
):
529 xxxChildContainer
.__init
__(self
, parent
, element
)
530 # pos and size dont matter for notebookpages
531 if 'pos' in self
.child
.allParams
:
532 self
.child
.allParams
= self
.child
.allParams
[:]
533 self
.child
.allParams
.remove('pos')
534 if 'size' in self
.child
.allParams
:
535 self
.child
.allParams
= self
.child
.allParams
[:]
536 self
.child
.allParams
.remove('size')
538 class xxxSpacer(xxxObject
):
539 hasName
= hasStyle
= false
540 allParams
= ['size', 'option', 'flag', 'border']
541 paramDict
= {'option': ParamInt}
542 default
= {'size': '0,0'}
544 class xxxMenuBar(xxxContainer
):
547 class xxxMenu(xxxContainer
):
548 allParams
= ['label']
549 default
= {'label': ''}
550 paramDict
= {'style': ParamNonGenericStyle}
# no generic styles
551 winStyles
= ['wxMENU_TEAROFF']
553 class xxxMenuItem(xxxObject
):
554 allParams
= ['checkable', 'label', 'accel', 'help']
555 default
= {'label': ''}
557 class xxxSeparator(xxxObject
):
558 hasName
= hasStyle
= false
561 ################################################################################
565 'wxDialog': xxxDialog
,
568 'wxToolBar': xxxToolBar
,
570 'wxBitmap': xxxBitmap
,
573 'wxButton': xxxButton
,
574 'wxBitmapButton': xxxBitmapButton
,
575 'wxRadioButton': xxxRadioButton
,
576 'wxSpinButton': xxxSpinButton
,
578 'wxStaticBox': xxxStaticBox
,
579 'wxStaticBitmap': xxxStaticBitmap
,
580 'wxRadioBox': xxxRadioBox
,
581 'wxComboBox': xxxComboBox
,
582 'wxCheckBox': xxxCheckBox
,
583 'wxListBox': xxxListBox
,
585 'wxStaticText': xxxStaticText
,
586 'wxStaticLine': xxxStaticLine
,
587 'wxTextCtrl': xxxTextCtrl
,
588 'wxChoice': xxxChoice
,
589 'wxSlider': xxxSlider
,
591 'wxScrollBar': xxxScrollBar
,
592 'wxTreeCtrl': xxxTreeCtrl
,
593 'wxListCtrl': xxxListCtrl
,
594 'wxCheckList': xxxCheckList
,
595 'wxNotebook': xxxNotebook
,
596 'notebookpage': xxxNotebookPage
,
597 'wxHtmlWindow': xxxHtmlWindow
,
598 'wxCalendar': xxxCalendar
,
600 'wxBoxSizer': xxxBoxSizer
,
601 'wxStaticBoxSizer': xxxStaticBoxSizer
,
602 'wxGridSizer': xxxGridSizer
,
603 'wxFlexGridSizer': xxxFlexGridSizer
,
604 'sizeritem': xxxSizerItem
,
607 'wxMenuBar': xxxMenuBar
,
609 'wxMenuItem': xxxMenuItem
,
610 'separator': xxxSeparator
,
613 # Create IDs for all parameters of all classes
614 paramIDs
= {'fg': wxNewId(), 'bg': wxNewId(), 'exstyle': wxNewId(), 'font': wxNewId(),
615 'enabled': wxNewId(), 'focused': wxNewId(), 'hidden': wxNewId(),
618 for cl
in xxxDict
.values():
619 for param
in cl
.allParams
+ cl
.paramDict
.keys():
620 if not paramIDs
.has_key(param
):
621 paramIDs
[param
] = wxNewId()
623 ################################################################################
626 # Test for object elements
628 return node
.nodeType
== minidom
.Node
.ELEMENT_NODE
and node
.tagName
== 'object'
630 # Make XXX object from some DOM object, selecting correct class
631 def MakeXXXFromDOM(parent
, element
):
633 return xxxDict
[element
.getAttribute('class')](parent
, element
)
635 # Verify that it's not recursive exception
636 if element
.getAttribute('class') not in xxxDict
.keys():
637 print 'ERROR: unknown class:', element
.getAttribute('class')
640 # Make empty DOM element
641 def MakeEmptyDOM(className
):
642 elem
= tree
.dom
.createElement('object')
643 elem
.setAttribute('class', className
)
644 # Set required and default parameters
645 xxxClass
= xxxDict
[className
]
646 defaultNotRequired
= filter(lambda x
, l
=xxxClass
.required
: x
not in l
,
647 xxxClass
.default
.keys())
648 for param
in xxxClass
.required
+ defaultNotRequired
:
649 textElem
= tree
.dom
.createElement(param
)
651 textNode
= tree
.dom
.createTextNode(xxxClass
.default
[param
])
653 textNode
= tree
.dom
.createTextNode('')
654 textElem
.appendChild(textNode
)
655 elem
.appendChild(textElem
)
658 # Make empty XXX object
659 def MakeEmptyXXX(parent
, className
):
660 # Make corresponding DOM object first
661 elem
= MakeEmptyDOM(className
)
662 # If parent is a sizer, we should create sizeritem object, except for spacers
664 if parent
.isSizer
and className
!= 'spacer':
665 sizerItemElem
= MakeEmptyDOM('sizeritem')
666 sizerItemElem
.appendChild(elem
)
668 elif isinstance(parent
, xxxNotebook
):
669 pageElem
= MakeEmptyDOM('notebookpage')
670 pageElem
.appendChild(elem
)
672 # Now just make object
673 return MakeXXXFromDOM(parent
, elem
)