-# Properties panel notebook page
-class HtmlPage(wxHtmlWindow, ParamPage):
- def __init__(self, parent, id = -1):
- wxHtmlWindow.__init__(self, parent, id)
- ParamPage.__init__(self)
- self.SetBorders(5)
- if wxGetOsVersion()[1] == 1:
- self.SetFonts('', '', [8, 10, 12, 14, 16, 19, 24])
- else:
- self.SetFonts("", "", [7, 8, 10, 12, 16, 22, 30])
- self.modified = false
- # Previous type
- self.xxxClass = self.xxxChildClass = None
- def Clear(self):
- self.SetPage(htmlHeader + 'select a tree item on the left' + htmlFooter)
- def SetPageData(self, xxx):
- if not xxx:
- self.SetPage(htmlHeader + 'this item has no properties' + htmlFooter)
- return
- self.Freeze() # doesn't seem to help
- # Don't change interface if same class
- compare = false
- if self.xxxClass and self.xxxClass == xxx.__class__:
- compare = true # a little weird code
- if xxx.hasChild:
- if self.xxxChildClass != xxx.child.__class__:
- compare = false
- if not compare: # not same
- self.SetPage(htmlHeader + xxx.generateHtml() + htmlFooter)
- self.xxxClass = xxx.__class__
- if xxx.hasChild: self.xxxChildClass = xxx.child.__class__
- self.SetValues(xxx)
- if xxx.hasChild:
- self.SetValues(xxx.child)
- self.Thaw()
+# Panel for displaying properties
+class PropPage(ParamPage):
+ def __init__(self, parent, label, xxx):
+ ParamPage.__init__(self, parent, xxx)
+ box = wxStaticBox(self, -1, label)
+ box.SetFont(labelFont)
+ topSizer = wxStaticBoxSizer(box, wxVERTICAL)
+ sizer = wxFlexGridSizer(len(xxx.allParams), 2, 1, 1)
+ if xxx.hasName:
+ label = wxStaticText(self, -1, 'XML ID:', size=(100,-1))
+ control = ParamText(self, name='XML_name')
+ sizer.AddMany([ (label, 0, wxALIGN_CENTER_VERTICAL),
+ (control, 0, wxALIGN_CENTER_VERTICAL) ])
+ self.controlName = control
+ for param in xxx.allParams:
+ present = param in xxx.params
+ if param in xxx.required:
+ label = wxStaticText(self, paramIDs[param], param + ':',
+ size = (100,-1), name = param)
+ else:
+ # Notebook has one very loooooong parameter
+ if param == 'usenotebooksizer': sParam = 'usesizer:'
+ else: sParam = param + ':'
+ label = wxCheckBox(self, paramIDs[param], sParam,
+ size = (100,-1), name = param)
+ self.checks[param] = label
+ try:
+ typeClass = xxx.paramDict[param]
+ except KeyError:
+ try:
+ # Standart type
+ typeClass = paramDict[param]
+ except KeyError:
+ # Default
+ typeClass = ParamText
+ control = typeClass(self, param)
+ control.Enable(present)
+ sizer.AddMany([ (label, 0, wxALIGN_CENTER_VERTICAL),
+ (control, 0, wxALIGN_CENTER_VERTICAL) ])
+ self.controls[param] = control
+ topSizer.Add(sizer, 1, wxALL | wxEXPAND, 3)
+ self.SetAutoLayout(true)
+ self.SetSizer(topSizer)
+ topSizer.Fit(self)