# Set common button size for parameter buttons
bTmp = wx.Button(self, -1, '')
import params
- params.buttonSize = (self.DLG_SZE(buttonSize)[0], bTmp.GetSize()[1])
+ params.buttonSize = (self.DLG_SZE(buttonSizeD)[0], bTmp.GetSize()[1])
bTmp.Destroy()
del bTmp
# Register undo object when modifying first time
if not self.modified and value:
g.undoMan.RegisterUndo(UndoEdit())
+ g.frame.SetModified()
self.modified = value
def Apply(self):
param = evt.GetEventObject().GetName()
w = self.controls[param]
w.Enable(True)
- objElem = xxx.element
+ objElem = xxx.node
if evt.IsChecked():
# Ad new text node in order of allParams
w.SetValue('') # set empty (default) value
elem = g.tree.dom.createElement(param)
# Some classes are special
if param == 'font':
- xxx.params[param] = xxxParamFont(xxx.element, elem)
+ xxx.params[param] = xxxParamFont(xxx.node, elem)
elif param in xxxObject.bitmapTags:
xxx.params[param] = xxxParamBitmap(elem)
else:
xxx.params[param].remove()
del xxx.params[param]
w.SetValue('')
- w.modified = False # mark as not changed
+ w.SetModified(False) # mark as not changed
w.Enable(False)
# Set modified flag (provokes undo storing is necessary)
panel.SetModified(True)
name = self.controlName.GetValue()
if xxx.name != name:
xxx.name = name
- xxx.element.setAttribute('name', name)
+ xxx.node.setAttribute('name', name)
for param, w in self.controls.items():
if w.modified:
paramObj = xxx.params[param]
xxx.setSpecial(param, value)
else:
paramObj.update(value)
+
# Save current state
def SaveState(self):
self.origChecks = map(lambda i: (i[0], i[1].GetValue()), self.checks.items())
- self.origControls = map(lambda i: (i[0], i[1].GetValue(), i[1].IsEnabled()),
+ self.origControls = map(lambda i: (i[0], i[1].GetValue(), i[1].enabled),
self.controls.items())
if self.controlName:
self.origName = self.controlName.GetValue()
for k,v,e in state[1]:
self.controls[k].SetValue(v)
self.controls[k].Enable(e)
- if e: self.controls[k].modified = True
+ # Set all states to modified
+ if e and k in self.xxx.params: self.controls[k].modified = True
if self.controlName:
self.controlName.SetValue(state[2])
for param in xxx.allParams:
present = xxx.params.has_key(param)
if param in xxx.required:
- label = wx.StaticText(self, paramIDs[param], param + ':',
- size = (LABEL_WIDTH,-1), name = param)
+ if isinstance(xxx, xxxComment):
+ label = None
+ else:
+ label = wx.StaticText(self, paramIDs[param], param + ':',
+ size = (LABEL_WIDTH,-1), name = param)
else:
- # Notebook has one very loooooong parameter
+ # Rename some parameters
if param == 'usenotebooksizer': sParam = 'usesizer:'
+ elif param == 'option': sParam = 'proportion'
else: sParam = param + ':'
label = wx.CheckBox(self, paramIDs[param], sParam,
size = (LABEL_WIDTH,-1), name = param)
typeClass = ParamText
control = typeClass(self, param)
control.Enable(present)
- sizer.AddMany([ (label, 0, wx.ALIGN_CENTER_VERTICAL),
- (control, 0, wx.ALIGN_CENTER_VERTICAL | wx.GROW) ])
+ # Comment has only one parameter
+ if isinstance(xxx, xxxComment):
+ # Bind char event to check Enter key
+ control.text.Bind(wx.EVT_CHAR, self.OnEnter)
+ sizer.Add(control, 0, wx.ALIGN_CENTER_VERTICAL | wx.GROW)
+ else:
+ sizer.AddMany([ (label, 0, wx.ALIGN_CENTER_VERTICAL),
+ (control, 0, wx.ALIGN_CENTER_VERTICAL | wx.GROW) ])
self.controls[param] = control
topSizer.Add(sizer, 1, wx.ALL | wx.EXPAND, 3)
- self.SetAutoLayout(True)
self.SetSizer(topSizer)
topSizer.Fit(self)
+
def SetValues(self, xxx):
self.xxx = xxx
self.origChecks = []
self.origChecks.append((param, False))
self.origControls.append((param, '', False))
+ # This is called only for comment now
+ def OnEnter(self, evt):
+ if evt.GetKeyCode() == 13:
+ g.tree.Apply(self.xxx, g.tree.selection)
+ else:
+ evt.Skip()
+
################################################################################
# Style notebook page
self.SetAutoLayout(True)
self.SetSizer(topSizer)
topSizer.Fit(self)
+
# Set data for a cahced page
def SetValues(self, xxx):
self.xxx = xxx