self.AddPage(self.page1, 'Properties')
# Second page
self.page2 = wxScrolledWindow(self, -1)
self.AddPage(self.page1, 'Properties')
# Second page
self.page2 = wxScrolledWindow(self, -1)
# Cache for already used panels
self.pageCache = {} # cached property panels
self.stylePageCache = {} # cached style panels
# Cache for already used panels
self.pageCache = {} # cached property panels
self.stylePageCache = {} # cached style panels
# Delete child windows and recreate page sizer
def ResetPage(self, page):
topSizer = page.GetSizer()
sizer = topSizer.GetChildren()[0].GetSizer()
for w in page.GetChildren():
# Delete child windows and recreate page sizer
def ResetPage(self, page):
topSizer = page.GetSizer()
sizer = topSizer.GetChildren()[0].GetSizer()
for w in page.GetChildren():
else:
topSizer.Add(sizer, 0, wxALL, 5)
return sizer
else:
topSizer.Add(sizer, 0, wxALL, 5)
return sizer
# Remove current objects and sizer
sizer = self.ResetPage(self.page1)
if not xxx or (not xxx.allParams and not xxx.hasName):
# Remove current objects and sizer
sizer = self.ResetPage(self.page1)
if not xxx or (not xxx.allParams and not xxx.hasName):
sizer.Add(wxStaticText(self.page1, -1, 'Select a tree item.'))
else:
g.currentXXX = xxx.treeObject()
sizer.Add(wxStaticText(self.page1, -1, 'Select a tree item.'))
else:
g.currentXXX = xxx.treeObject()
- page = PropPage(self.page1, xxx.className, xxx)
- self.pageCache[xxx.__class__] = page
+ page = PropPage(self.page1, xxx.panelName(), xxx)
+ self.pageCache[cacheID] = page
cacheID = (xxx.child.__class__, xxx.__class__)
try:
page = self.pageCache[cacheID]
cacheID = (xxx.child.__class__, xxx.__class__)
try:
page = self.pageCache[cacheID]
except KeyError:
page = StylePage(self.page2, xxx.className + ' style', xxx)
self.stylePageCache[xxx.__class__] = page
except KeyError:
page = StylePage(self.page2, xxx.className + ' style', xxx)
self.stylePageCache[xxx.__class__] = page
if not self.GetPageCount() == 2:
self.AddPage(self.page2, 'Style')
self.page2.Layout()
if not self.GetPageCount() == 2:
self.AddPage(self.page2, 'Style')
self.page2.Layout()
size = self.page2.GetSizer().GetMinSize()
self.page2.SetScrollbars(1, 1, size.width, size.height, 0, 0, True)
else:
size = self.page2.GetSizer().GetMinSize()
self.page2.SetScrollbars(1, 1, size.width, size.height, 0, 0, True)
else:
def SetModified(self, value):
# Register undo object when modifying first time
if not self.modified and value:
g.undoMan.RegisterUndo(UndoEdit())
self.modified = value
def SetModified(self, value):
# Register undo object when modifying first time
if not self.modified and value:
g.undoMan.RegisterUndo(UndoEdit())
self.modified = value
class ParamPage(wxPanel):
def __init__(self, parent, xxx):
wxPanel.__init__(self, parent, -1)
class ParamPage(wxPanel):
def __init__(self, parent, xxx):
wxPanel.__init__(self, parent, -1)
# Panel for displaying properties
class PropPage(ParamPage):
def __init__(self, parent, label, xxx):
ParamPage.__init__(self, parent, xxx)
# 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)
+ self.box = wxStaticBox(self, -1, label)
+ self.box.SetFont(g.labelFont())
+ topSizer = wxStaticBoxSizer(self.box, wxVERTICAL)
sizer = wxFlexGridSizer(len(xxx.allParams), 2, 1, 1)
sizer.AddGrowableCol(1)
if xxx.hasName:
sizer = wxFlexGridSizer(len(xxx.allParams), 2, 1, 1)
sizer.AddGrowableCol(1)
if xxx.hasName:
- label = wxStaticText(self, -1, 'XML ID:', size=(100,-1))
+ label = wxStaticText(self, -1, 'XML ID:', size=(LABEL_WIDTH,-1))
control = ParamText(self, 'XML_name', 200)
sizer.AddMany([ (label, 0, wxALIGN_CENTER_VERTICAL),
(control, 0, wxALIGN_CENTER_VERTICAL | wxBOTTOM | wxGROW, 5) ])
control = ParamText(self, 'XML_name', 200)
sizer.AddMany([ (label, 0, wxALIGN_CENTER_VERTICAL),
(control, 0, wxALIGN_CENTER_VERTICAL | wxBOTTOM | wxGROW, 5) ])
present = xxx.params.has_key(param)
if param in xxx.required:
label = wxStaticText(self, paramIDs[param], param + ':',
present = xxx.params.has_key(param)
if param in xxx.required:
label = wxStaticText(self, paramIDs[param], param + ':',
else:
# Notebook has one very loooooong parameter
if param == 'usenotebooksizer': sParam = 'usesizer:'
else: sParam = param + ':'
label = wxCheckBox(self, paramIDs[param], sParam,
else:
# Notebook has one very loooooong parameter
if param == 'usenotebooksizer': sParam = 'usesizer:'
else: sParam = param + ':'
label = wxCheckBox(self, paramIDs[param], sParam,
def __init__(self, parent, label, xxx):
ParamPage.__init__(self, parent, xxx)
box = wxStaticBox(self, -1, label)
def __init__(self, parent, label, xxx):
ParamPage.__init__(self, parent, xxx)
box = wxStaticBox(self, -1, label)
topSizer = wxStaticBoxSizer(box, wxVERTICAL)
sizer = wxFlexGridSizer(len(xxx.styles), 2, 1, 1)
sizer.AddGrowableCol(1)
for param in xxx.styles:
present = xxx.params.has_key(param)
check = wxCheckBox(self, paramIDs[param],
topSizer = wxStaticBoxSizer(box, wxVERTICAL)
sizer = wxFlexGridSizer(len(xxx.styles), 2, 1, 1)
sizer.AddGrowableCol(1)
for param in xxx.styles:
present = xxx.params.has_key(param)
check = wxCheckBox(self, paramIDs[param],
- param + ':', size = (100,-1), name = param)
+ param + ':', size = (LABEL_WIDTH,-1), name = param)