]> git.saurik.com Git - wxWidgets.git/commitdiff
0.1.8-3
authorRoman Rolinsky <rolinsky@femagsoft.com>
Thu, 8 Mar 2007 15:49:35 +0000 (15:49 +0000)
committerRoman Rolinsky <rolinsky@femagsoft.com>
Thu, 8 Mar 2007 15:49:35 +0000 (15:49 +0000)
-------

Notebook page highlighting fix. Highlight resizes when the window
is resized. ParamUnit spin button detects event handler re-entry
(wxGTK probably has a bug in wxSpinButton with repeated events).

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@44694 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

wxPython/wx/tools/XRCed/CHANGES.txt
wxPython/wx/tools/XRCed/globals.py
wxPython/wx/tools/XRCed/panel.py
wxPython/wx/tools/XRCed/params.py
wxPython/wx/tools/XRCed/tree.py
wxPython/wx/tools/XRCed/xxx.py

index a64e7319be1ac57ab7f195b9bb346f6b1441fc5d..4da16b2982f5abf88232afd168d87944d6dbf2c0 100644 (file)
@@ -1,3 +1,10 @@
+0.1.8-3
+-------
+
+Notebook page highlighting fix. Highlight resizes when the window 
+is resized. ParamUnit spin button detects event handler re-entry
+(wxGTK probably has a bug in wxSpinButton with repeated events).
+
 0.1.8-2
 -------
 
index ef5c7895c279788dea52a15f8ca5fbcba03a00b6..a46f1cf02f8b81bf82fa35c6d3da8c3fea803ead 100644 (file)
@@ -15,7 +15,7 @@ import sys
 # Global constants
 
 progname = 'XRCed'
-version = '0.1.8-2'
+version = '0.1.8-3'
 # Minimal wxWidgets version
 MinWxVersion = (2,6,0)
 if wx.VERSION[:3] < MinWxVersion:
index e238c9e3b7a21256446dad8594019af3d328490a..17b09802fab335d9f9460dfc3bc893df2a44a1b7 100644 (file)
@@ -237,6 +237,7 @@ class ParamPage(wx.Panel):
                     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())
index 97a39e9d0d3ee33d62c97f2a5b0f57e6bd656432..d08cba4aec269747f6d20f7d12e44921a5b61eb9 100644 (file)
@@ -57,8 +57,7 @@ class ParamBinaryOr(PPanel):
         self.button = wx.Button(self, self.ID_BUTTON_CHOICES, 'Edit...', size=buttonSize)
         sizer.Add(self.button, 0, wx.ALIGN_CENTER_VERTICAL)
         self.SetAutoLayout(True)
-        self.SetSizer(sizer)
-        sizer.Fit(self)
+        self.SetSizerAndFit(sizer)
         wx.EVT_BUTTON(self, self.ID_BUTTON_CHOICES, self.OnButtonChoices)
         wx.EVT_TEXT(self, self.ID_TEXT_CTRL, self.OnChange)
     def GetValue(self):
@@ -192,8 +191,7 @@ class ParamColour(PPanel):
         self.button = wx.Panel(self, self.ID_BUTTON, wx.DefaultPosition, wx.Size(20, 20))
         sizer.Add(self.button, 0, wx.ALIGN_CENTER_VERTICAL | wx.LEFT, 5)
         self.SetAutoLayout(True)
-        self.SetSizer(sizer)
-        sizer.Fit(self)
+        self.SetSizerAndFit(sizer)
         self.textModified = False
         wx.EVT_PAINT(self.button, self.OnPaintButton)
         wx.EVT_TEXT(self, self.ID_TEXT_CTRL, self.OnChange)
@@ -254,8 +252,7 @@ class ParamFont(PPanel):
         self.button = wx.Button(self, self.ID_BUTTON_SELECT, 'Select...', size=buttonSize)
         sizer.Add(self.button, 0, wx.ALIGN_CENTER_VERTICAL)
         self.SetAutoLayout(True)
-        self.SetSizer(sizer)
-        sizer.Fit(self)
+        self.SetSizerAndFit(sizer)
         self.textModified = False
         wx.EVT_BUTTON(self, self.ID_BUTTON_SELECT, self.OnButtonSelect)
         wx.EVT_TEXT(self, self.ID_TEXT_CTRL, self.OnChange)
@@ -348,8 +345,7 @@ class ParamInt(PPanel):
         self.spin.SetRange(-2147483648, 2147483647) # min/max integers
         sizer.Add(self.spin)
         self.SetAutoLayout(True)
-        self.SetSizer(sizer)
-        sizer.Fit(self)
+        self.SetSizerAndFit(sizer)
         wx.EVT_SPINCTRL(self, self.ID_SPIN_CTRL, self.OnChange)
     def GetValue(self):
         return str(self.spin.GetValue())
@@ -369,8 +365,7 @@ class ParamIntNN(PPanel):
         self.spin.SetRange(0, 10000) # min/max integers
         sizer.Add(self.spin)
         self.SetAutoLayout(True)
-        self.SetSizer(sizer)
-        sizer.Fit(self)
+        self.SetSizerAndFit(sizer)
         wx.EVT_SPINCTRL(self, self.ID_SPIN_CTRL, self.OnChange)
     def GetValue(self):
         return str(self.spin.GetValue())
@@ -387,26 +382,24 @@ class ParamUnit(PPanel):
         self.ID_TEXT_CTRL = wx.NewId()
         self.ID_SPIN_BUTTON = wx.NewId()
         sizer = wx.BoxSizer(wx.HORIZONTAL)
-        self.spin = wx.SpinButton(self, self.ID_SPIN_BUTTON, style = wx.SP_VERTICAL, size=(-1,1))
+        self.spin = wx.SpinButton(self, self.ID_SPIN_BUTTON, style = wx.SP_VERTICAL)
         textW = 60 - self.spin.GetSize()[0]
         self.text = wx.TextCtrl(self, self.ID_TEXT_CTRL, size=(textW,-1))
         self.spin.SetRange(-10000, 10000)
         sizer.Add(self.text, 0, wx.EXPAND)
         sizer.Add(self.spin, 0, wx.EXPAND)
-        #sizer.SetMinSize((50,-1))
         self.SetAutoLayout(True)
-        self.SetSizer(sizer)
-        sizer.Fit(self)
-        wx.EVT_SPIN_UP(self, self.ID_SPIN_BUTTON, self.OnSpinUp)
-        wx.EVT_SPIN_DOWN(self, self.ID_SPIN_BUTTON, self.OnSpinDown)
+        self.SetSizerAndFit(sizer)
+        self.spin.Bind(wx.EVT_SPIN_UP, self.OnSpinUp)
+        self.spin.Bind(wx.EVT_SPIN_DOWN, self.OnSpinDown)
     def GetValue(self):
         return self.text.GetValue()
     def SetValue(self, value):
-        self.freeze = True
-        if not value: value = '0'
+        if not value: value = '0'        
         self.text.SetValue(value)
-        self.freeze = False
+        self.Change(0)
     def Change(self, x):
+        self.freeze = True
         # Check if we are working with dialog units
         value = self.text.GetValue()
         units = ''
@@ -416,14 +409,19 @@ class ParamUnit(PPanel):
         try:
             intValue = int(value) + x
             self.spin.SetValue(intValue)
-            self.text.SetValue(str(intValue) + units)
-            self.SetModified()
+            if x:                       # 0 can be passed to update spin value only
+                self.text.SetValue(str(intValue) + units)
+                self.SetModified()
         except:
             # !!! Strange, if I use wx.LogWarning, event is re-generated
             print 'ERROR: incorrect unit format'
+        self.freeze = False
     def OnSpinUp(self, evt):
+        self.freeze = True
         self.Change(1)
     def OnSpinDown(self, evt):
+        if self.freeze: return
+        self.freeze = True
         self.Change(-1)
 
 class ParamMultilineText(PPanel):
@@ -437,8 +435,7 @@ class ParamMultilineText(PPanel):
         self.button = wx.Button(self, self.ID_BUTTON_EDIT, 'Edit...', size=buttonSize)
         sizer.Add(self.button, 0, wx.ALIGN_CENTER_VERTICAL)
         self.SetAutoLayout(True)
-        self.SetSizer(sizer)
-        sizer.Fit(self)
+        self.SetSizerAndFit(sizer)
         wx.EVT_BUTTON(self, self.ID_BUTTON_EDIT, self.OnButtonEdit)
         wx.EVT_TEXT(self, self.ID_TEXT_CTRL, self.OnChange)
     def GetValue(self):
@@ -467,8 +464,7 @@ class ParamText(PPanel):
         else: option = 0
         sizer.Add(self.text, option, wx.ALIGN_CENTER_VERTICAL | wx.TOP | wx.BOTTOM, 2)
         self.SetAutoLayout(True)
-        self.SetSizer(sizer)
-        sizer.Fit(self)
+        self.SetSizerAndFit(sizer)
         wx.EVT_TEXT(self, self.ID_TEXT_CTRL, self.OnChange)
     def GetValue(self):
         return self.text.GetValue()
@@ -612,8 +608,7 @@ class ParamContent(PPanel):
         self.button = wx.Button(self, self.ID_BUTTON_EDIT, 'Edit...', size=buttonSize)
         sizer.Add(self.button, 0, wx.ALIGN_CENTER_VERTICAL)
         self.SetAutoLayout(True)
-        self.SetSizer(sizer)
-        sizer.Fit(self)
+        self.SetSizerAndFit(sizer)
         self.textModified = False
         wx.EVT_BUTTON(self, self.ID_BUTTON_EDIT, self.OnButtonEdit)
         wx.EVT_TEXT(self, self.ID_TEXT_CTRL, self.OnChange)
@@ -753,8 +748,7 @@ class RadioBox(PPanel):
             topSizer.Add(button, 0, wx.RIGHT, 5)
             wx.EVT_RADIOBUTTON(self, button.GetId(), self.OnRadioChoice)
         self.SetAutoLayout(True)
-        self.SetSizer(topSizer)
-        topSizer.Fit(self)
+        self.SetSizerAndFit(topSizer)
     def SetStringSelection(self, value):
         self.freeze = True
         for i in self.choices:
@@ -813,8 +807,7 @@ class ParamFile(PPanel):
         self.button = wx.Button(self, self.ID_BUTTON_BROWSE, 'Browse...',size=buttonSize)
         sizer.Add(self.button, 0, wx.ALIGN_CENTER_VERTICAL)
         self.SetAutoLayout(True)
-        self.SetSizer(sizer)
-        sizer.Fit(self)
+        self.SetSizerAndFit(sizer)
         self.textModified = False
         wx.EVT_BUTTON(self, self.ID_BUTTON_BROWSE, self.OnButtonBrowse)
         wx.EVT_TEXT(self, self.ID_TEXT_CTRL, self.OnChange)
index c08b451fd44be44d733b853788bd92003886c8c1..da78f48859c5252ab8921a5eb7e86aa8fa28480f 100644 (file)
@@ -612,6 +612,7 @@ class XML_Tree(wx.TreeCtrl):
         # Reset selection object
         self.selection = None
         return node
+    
     # Find position relative to the top-level window
     def FindNodePos(self, item, obj=None):
         # Root at (0,0)
@@ -631,15 +632,12 @@ class XML_Tree(wx.TreeCtrl):
                         if g.testWin.highLight:
                             g.testWin.highLight.Remove()
                     break
-        # Find first ancestor which is a wxWindow (not a sizer)
+        # For sizers and notebooks we must select the first window-like parent
         winParent = itemParent
-        while self.GetPyData(winParent).isSizer:
+        while self.GetPyData(winParent).isSizer or \
+                  self.GetPyData(winParent).treeObject().__class__ == xxxNotebook:
             winParent = self.GetItemParent(winParent)
-        # Notebook children are layed out in a little strange way
-        if self.GetPyData(itemParent).treeObject().__class__ == xxxNotebook:
-            parentPos = wx.Point(0,0)
-        else:
-            parentPos = self.FindNodePos(winParent)
+        parentPos = self.FindNodePos(winParent)
         # Position (-1,-1) is really (0,0)
         pos = obj.GetPosition()
         if pos == (-1,-1): pos = (0,0)
@@ -700,7 +698,6 @@ class XML_Tree(wx.TreeCtrl):
             # If some data was modified, apply changes
             if g.panel.IsModified():
                 self.Apply(xxx, oldItem)
-                #if conf.autoRefresh:
                 if g.testWin:
                     if g.testWin.highLight:
                         g.testWin.highLight.Remove()
@@ -959,9 +956,11 @@ class XML_Tree(wx.TreeCtrl):
                 testWin.toolBar = res.LoadToolBar(testWin, STD_NAME)
                 testWin.SetToolBar(testWin.toolBar)
                 testWin.Show(True)
+            # Catch some events, set highlight
             if testWin:
                 testWin.item = item
                 wx.EVT_CLOSE(testWin, self.OnCloseTestWin)
+                wx.EVT_SIZE(testWin, self.OnSizeTestWin)
                 testWin.highLight = None
                 if highLight and not self.pendingHighLight:
                     self.HighLight(highLight)
@@ -987,6 +986,11 @@ class XML_Tree(wx.TreeCtrl):
     def OnCloseTestWin(self, evt):
         self.CloseTestWindow()
 
+    def OnSizeTestWin(self, evt):
+        if g.testWin.highLight:
+            self.HighLight(g.testWin.highLight.item)
+        evt.Skip()
+
     # Return index in parent, for real window children
     def WindowIndex(self, item):
         n = 0                           # index of sibling
index 9f98f0c6cb54a0194d505ba827f23d6fbb5cbcf7..7226d26d9104e464b62bcf703442cdcb8378e9b9 100644 (file)
@@ -317,7 +317,6 @@ class xxxObject:
     # 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)