From: Roman Rolinsky Date: Wed, 7 Mar 2007 14:45:12 +0000 (+0000) Subject: 0.1.8-2 X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/7df24e78685bb24fbada515e579d47bba6e6c677 0.1.8-2 ------- Fix for dealing with empty 'growable' property, using MiniFrame for properties panel, the panel is restored together with the main window. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@44630 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/wxPython/wx/tools/XRCed/CHANGES.txt b/wxPython/wx/tools/XRCed/CHANGES.txt index 39db47d191..a64e7319be 100644 --- a/wxPython/wx/tools/XRCed/CHANGES.txt +++ b/wxPython/wx/tools/XRCed/CHANGES.txt @@ -1,3 +1,10 @@ +0.1.8-2 +------- + +Fix for dealing with empty 'growable' property, using MiniFrame +for properties panel, the panel is restored together with the +main window. + 0.1.8-1 ------- diff --git a/wxPython/wx/tools/XRCed/globals.py b/wxPython/wx/tools/XRCed/globals.py index 0313077656..ef5c7895c2 100644 --- a/wxPython/wx/tools/XRCed/globals.py +++ b/wxPython/wx/tools/XRCed/globals.py @@ -15,7 +15,7 @@ import sys # Global constants progname = 'XRCed' -version = '0.1.8-1' +version = '0.1.8-2' # Minimal wxWidgets version MinWxVersion = (2,6,0) if wx.VERSION[:3] < MinWxVersion: diff --git a/wxPython/wx/tools/XRCed/panel.py b/wxPython/wx/tools/XRCed/panel.py index d231a933cc..e238c9e3b7 100644 --- a/wxPython/wx/tools/XRCed/panel.py +++ b/wxPython/wx/tools/XRCed/panel.py @@ -218,7 +218,7 @@ class ParamPage(wx.Panel): 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) diff --git a/wxPython/wx/tools/XRCed/params.py b/wxPython/wx/tools/XRCed/params.py index dfe6bd6ac6..97a39e9d0d 100644 --- a/wxPython/wx/tools/XRCed/params.py +++ b/wxPython/wx/tools/XRCed/params.py @@ -37,9 +37,9 @@ class PPanel(wx.Panel): for w in self.GetChildren(): w.Enable(value) #wx.Panel.Enable(self, value) - def SetModified(self): - self.modified = True - g.panel.SetModified(True) + def SetModified(self, state=True): + self.modified = state + if state: g.panel.SetModified(True) # Common method to set modified state def OnChange(self, evt): if self.freeze: return @@ -320,7 +320,6 @@ class ParamFont(PPanel): dlg = wx.FontDialog(self, data) if dlg.ShowModal() == wx.ID_OK: font = dlg.GetFontData().GetChosenFont() - print font.GetEncoding() if font.GetEncoding() == wx.FONTENCODING_SYSTEM: encName = '' else: @@ -421,7 +420,7 @@ class ParamUnit(PPanel): self.SetModified() except: # !!! Strange, if I use wx.LogWarning, event is re-generated - print 'incorrect unit format' + print 'ERROR: incorrect unit format' def OnSpinUp(self, evt): self.Change(1) def OnSpinDown(self, evt): @@ -625,8 +624,7 @@ class ParamContent(PPanel): if self.textModified: # text has newer value try: return self.text.GetValue().split('|') - except SyntaxError: - wx.LogError('Syntax error in parameter value: ' + self.GetName()) + except ValueError: return [] return self.value def SetValue(self, value): @@ -648,6 +646,9 @@ class ParamContent(PPanel): self.SetModified() self.textModified = False dlg.Destroy() + def SetModified(self, state=True): + PPanel.SetModified(self, state) + self.textModified = False # CheckList content class ParamContentCheckList(ParamContent): @@ -728,8 +729,7 @@ class ParamIntList(ParamContent): if self.textModified: # text has newer value try: self.value = map(int, self.text.GetValue().split('|')) - except SyntaxError: - wx.LogError('Syntax error in parameter value: ' + self.GetName()) + except ValueError: self.value = [] dlg = IntListDialog(self, self.value) if dlg.ShowModal() == wx.ID_OK: diff --git a/wxPython/wx/tools/XRCed/xrced.py b/wxPython/wx/tools/XRCed/xrced.py index 92e855b9f2..e1b80ef94f 100644 --- a/wxPython/wx/tools/XRCed/xrced.py +++ b/wxPython/wx/tools/XRCed/xrced.py @@ -311,11 +311,10 @@ class Frame(wx.Frame): tree.RegisterKeyEvents() - # !!! frame styles are broken - # Miniframe for not embedded mode - miniFrame = wx.Frame(self, -1, 'Properties & Style', - (conf.panelX, conf.panelY), - (conf.panelWidth, conf.panelHeight)) + # Miniframe for split mode + miniFrame = wx.MiniFrame(self, -1, 'Properties & Style', + (conf.panelX, conf.panelY), + (conf.panelWidth, conf.panelHeight)) self.miniFrame = miniFrame sizer2 = wx.BoxSizer() miniFrame.SetAutoLayout(True) @@ -910,6 +909,7 @@ class Frame(wx.Frame): self.miniFrame.Show(True) self.miniFrame.SetDimensions(conf.panelX, conf.panelY, conf.panelWidth, conf.panelHeight) + self.miniFrame.Layout() # Reduce width self.SetDimensions(pos.x, pos.y, max(size.width - sizePanel.width, self.minWidth), size.height) @@ -1285,14 +1285,18 @@ Homepage: http://xrced.sourceforge.net\ return def OnIconize(self, evt): - conf.x, conf.y = self.GetPosition() - conf.width, conf.height = self.GetSize() - if conf.embedPanel: - conf.sashPos = self.splitter.GetSashPosition() + if evt.Iconized(): + conf.x, conf.y = self.GetPosition() + conf.width, conf.height = self.GetSize() + if conf.embedPanel: + conf.sashPos = self.splitter.GetSashPosition() + else: + conf.panelX, conf.panelY = self.miniFrame.GetPosition() + conf.panelWidth, conf.panelHeight = self.miniFrame.GetSize() + self.miniFrame.Iconize() else: - conf.panelX, conf.panelY = self.miniFrame.GetPosition() - conf.panelWidth, conf.panelHeight = self.miniFrame.GetSize() - self.miniFrame.Iconize() + if not conf.embedPanel: + self.miniFrame.Iconize(False) evt.Skip() def OnCloseWindow(self, evt): diff --git a/wxPython/wx/tools/XRCed/xxx.py b/wxPython/wx/tools/XRCed/xxx.py index 4144307da0..9f98f0c6cb 100644 --- a/wxPython/wx/tools/XRCed/xxx.py +++ b/wxPython/wx/tools/XRCed/xxx.py @@ -314,6 +314,24 @@ class xxxObject: else: obj = self obj.name = name obj.element.setAttribute('name', name) + # Special processing for growablecols-like parameters + # represented by several nodes + def special(self, tag, node): + print 'special',tag + if not self.params.has_key(tag): + # Create new multi-group + self.params[tag] = xxxParamMulti(node) + self.params[tag].append(xxxParamInt(node)) + def setSpecial(self, param, value): + # Straightforward implementation: remove, add again + self.params[param].remove() + del self.params[param] + for i in value: + node = g.tree.dom.createElement(param) + text = g.tree.dom.createTextNode(str(i)) + node.appendChild(text) + self.element.appendChild(node) + self.special(param, node) # Imitation of FindResource/DoFindResource from xmlres.cpp def DoFindResource(parent, name, classname, recursive): @@ -771,45 +789,11 @@ class xxxFlexGridSizer(xxxGridSizer): specials = ['growablecols', 'growablerows'] allParams = ['cols', 'rows', 'vgap', 'hgap'] + specials paramDict = {'growablecols': ParamIntList, 'growablerows': ParamIntList} - # Special processing for growable* parameters - # (they are represented by several nodes) - def special(self, tag, node): - if not self.params.has_key(tag): - # Create new multi-group - self.params[tag] = xxxParamMulti(node) - self.params[tag].append(xxxParamInt(node)) - def setSpecial(self, param, value): - # Straightforward implementation: remove, add again - self.params[param].remove() - del self.params[param] - for i in value: - node = g.tree.dom.createElement(param) - text = g.tree.dom.createTextNode(str(i)) - node.appendChild(text) - self.element.appendChild(node) - self.special(param, node) class xxxGridBagSizer(xxxSizer): specials = ['growablecols', 'growablerows'] allParams = ['vgap', 'hgap'] + specials - paramDict = {'growablecols':ParamIntList, 'growablerows':ParamIntList} - # Special processing for growable* parameters - # (they are represented by several nodes) - def special(self, tag, node): - if not self.params.has_key(tag): - # Create new multi-group - self.params[tag] = xxxParamMulti(node) - self.params[tag].append(xxxParamInt(node)) - def setSpecial(self, param, value): - # Straightforward implementation: remove, add again - self.params[param].remove() - del self.params[param] - for i in value: - node = g.tree.dom.createElement(param) - text = g.tree.dom.createTextNode(str(i)) - node.appendChild(text) - self.element.appendChild(node) - self.special(param, node) + paramDict = {'growablecols': ParamIntList, 'growablerows': ParamIntList} # Container with only one child. # Not shown in tree.