more param renaming, some sizing fixes

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45679 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Roman Rolinsky
2007-04-26 19:52:15 +00:00
parent 5c82ed90df
commit c08eb1d348

View File

@@ -19,12 +19,18 @@ class Panel(wx.Notebook):
g.panel = panel = self g.panel = panel = self
self.modified = False self.modified = False
# Set common button size for parameter buttons # Set common sizes
bTmp = wx.Button(self, -1, '')
import params import params
params.buttonSize = (self.DLG_SZE(buttonSizeD)[0], bTmp.GetSize()[1]) cTmp = wx.Button(self, -1, '')
bTmp.Destroy() params.buttonSize = (self.DLG_SZE(buttonSizeD)[0], cTmp.GetSize()[1])
del bTmp cTmp.Destroy()
cTmp = wx.TextCtrl(self, -1, '')
params.textSize = cTmp.GetSize()
cTmp.Destroy()
cTmp = wx.CheckBox(self, -1, 'growablerows ') # this is the longest
ParamPage.labelSize = cTmp.GetSize()
cTmp.Destroy()
del cTmp
# List of child windows # List of child windows
self.pages = [] self.pages = []
@@ -170,6 +176,7 @@ class Panel(wx.Notebook):
# General class for notebook pages # General class for notebook pages
class ParamPage(wx.Panel): class ParamPage(wx.Panel):
labelSize = None
def __init__(self, parent, xxx): def __init__(self, parent, xxx):
wx.Panel.__init__(self, parent, -1) wx.Panel.__init__(self, parent, -1)
self.xxx = xxx self.xxx = xxx
@@ -266,38 +273,36 @@ class ParamPage(wx.Panel):
################################################################################ ################################################################################
LABEL_WIDTH = 125
# Panel for displaying properties # Panel for displaying properties
class PropPage(ParamPage): class PropPage(ParamPage):
renameDict = {'orient':'orientation', 'option':'proportion',
'usenotebooksizer':'usesizer', 'dontattachtoframe':'dontattach',
}
def __init__(self, parent, label, xxx): def __init__(self, parent, label, xxx):
ParamPage.__init__(self, parent, xxx) ParamPage.__init__(self, parent, xxx)
self.box = wx.StaticBox(self, -1, label) self.box = wx.StaticBox(self, -1, label)
self.box.SetFont(g.labelFont()) self.box.SetFont(g.labelFont())
topSizer = wx.StaticBoxSizer(self.box, wx.VERTICAL) topSizer = wx.StaticBoxSizer(self.box, wx.VERTICAL)
sizer = wx.FlexGridSizer(len(xxx.allParams), 2, 0, 1) sizer = wx.FlexGridSizer(len(xxx.allParams), 2, 1, 5)
sizer.AddGrowableCol(1) sizer.AddGrowableCol(1)
if xxx.hasName: if xxx.hasName:
label = wx.StaticText(self, -1, 'XML ID:', size=(LABEL_WIDTH,-1)) label = wx.StaticText(self, -1, 'XML ID:', size=self.labelSize)
control = ParamText(self, 'XML_name', 200) control = ParamText(self, 'XML_name', 200)
sizer.AddMany([ (label, 0, wx.ALIGN_CENTER_VERTICAL), sizer.AddMany([ (label, 0, wx.ALIGN_CENTER_VERTICAL),
(control, 0, wx.ALIGN_CENTER_VERTICAL | wx.BOTTOM | wx.GROW, 10) ]) (control, 0, wx.ALIGN_CENTER_VERTICAL | wx.BOTTOM | wx.GROW, 10) ])
self.controlName = control self.controlName = control
for param in xxx.allParams: for param in xxx.allParams:
present = xxx.params.has_key(param) present = xxx.params.has_key(param)
sParam = self.renameDict.get(param, param)
if param in xxx.required: if param in xxx.required:
if isinstance(xxx, xxxComment): if isinstance(xxx, xxxComment):
label = None label = None
else: else:
label = wx.StaticText(self, paramIDs[param], param + ':', label = wx.StaticText(self, paramIDs[param], sParam,
size = (LABEL_WIDTH,-1), name = param) size = self.labelSize, name = param)
else: else:
# Rename some parameters
if param == 'usenotebooksizer': sParam = 'usesizer:'
elif param == 'option': sParam = 'proportion'
else: sParam = param + ':'
label = wx.CheckBox(self, paramIDs[param], sParam, label = wx.CheckBox(self, paramIDs[param], sParam,
size = (LABEL_WIDTH,-1), name = param) size = self.labelSize, name = param)
self.checks[param] = label self.checks[param] = label
try: try:
typeClass = xxx.paramDict[param] typeClass = xxx.paramDict[param]
@@ -360,17 +365,19 @@ class PropPage(ParamPage):
# Style notebook page # Style notebook page
class StylePage(ParamPage): class StylePage(ParamPage):
renameDict = {'fg':'foreground', 'bg':'background'}
def __init__(self, parent, label, xxx): def __init__(self, parent, label, xxx):
ParamPage.__init__(self, parent, xxx) ParamPage.__init__(self, parent, xxx)
box = wx.StaticBox(self, -1, label) box = wx.StaticBox(self, -1, label)
box.SetFont(g.labelFont()) box.SetFont(g.labelFont())
topSizer = wx.StaticBoxSizer(box, wx.VERTICAL) topSizer = wx.StaticBoxSizer(box, wx.VERTICAL)
sizer = wx.FlexGridSizer(len(xxx.styles), 2, 0, 1) sizer = wx.FlexGridSizer(len(xxx.styles), 2, 1, 5)
sizer.AddGrowableCol(1) sizer.AddGrowableCol(1)
for param in xxx.styles: for param in xxx.styles:
present = xxx.params.has_key(param) present = xxx.params.has_key(param)
sParam = self.renameDict.get(param, param)
check = wx.CheckBox(self, paramIDs[param], check = wx.CheckBox(self, paramIDs[param],
param + ':', size = (LABEL_WIDTH,-1), name = param) sParam, size = self.labelSize, name = param)
check.SetValue(present) check.SetValue(present)
control = paramDict[param](self, name = param) control = paramDict[param](self, name = param)
control.Enable(present) control.Enable(present)