# 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):
# 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])
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)
control.Enable(present)
# 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),
topSizer.Add(sizer, 1, wx.ALL | wx.EXPAND, 3)
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