X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b372319fa08ce9b2794040bcdcb82b559d53da25..38b36b4c679d20adb70d1695f3be9b801fdbf556:/wxPython/wx/tools/XRCed/panel.py diff --git a/wxPython/wx/tools/XRCed/panel.py b/wxPython/wx/tools/XRCed/panel.py index 08600bc384..d05dc3793c 100644 --- a/wxPython/wx/tools/XRCed/panel.py +++ b/wxPython/wx/tools/XRCed/panel.py @@ -160,6 +160,7 @@ class Panel(wx.Notebook): # 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): @@ -241,7 +242,7 @@ class ParamPage(wx.Panel): # 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() @@ -258,7 +259,8 @@ class ParamPage(wx.Panel): 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]) @@ -290,8 +292,9 @@ class PropPage(ParamPage): 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) @@ -309,6 +312,8 @@ class PropPage(ParamPage): 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), @@ -317,6 +322,7 @@ class PropPage(ParamPage): topSizer.Add(sizer, 1, wx.ALL | wx.EXPAND, 3) self.SetSizer(topSizer) topSizer.Fit(self) + def SetValues(self, xxx): self.xxx = xxx self.origChecks = [] @@ -343,6 +349,13 @@ class PropPage(ParamPage): 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 @@ -369,6 +382,7 @@ class StylePage(ParamPage): self.SetAutoLayout(True) self.SetSizer(topSizer) topSizer.Fit(self) + # Set data for a cahced page def SetValues(self, xxx): self.xxx = xxx