Bug on subrange SpinCtrls with Windows fixed
authorlbessard
Mon, 10 Dec 2007 11:06:46 +0100
changeset 130 38421cd7c8ff
parent 129 ae2421aa0aa4
child 131 bc534997aecc
Bug on subrange SpinCtrls with Windows fixed
DataTypeEditor.py
--- a/DataTypeEditor.py	Sun Dec 09 19:01:36 2007 +0100
+++ b/DataTypeEditor.py	Mon Dec 10 11:06:46 2007 +0100
@@ -308,6 +308,7 @@
         self.EnumeratedPanel.Hide()
         self.ArrayPanel.Hide()
         self.CurrentPanel = "Directly"
+        self.Initializing = False
         
         self.ParentWindow = window
         self.Controler = controler
@@ -350,6 +351,7 @@
         pass
 
     def RefreshView(self):
+        self.Initializing = True
         self.DirectlyBaseType.Clear()
         self.ArrayBaseType.Clear()
         for datatype in self.Controler.GetDataTypes(self.TagName):
@@ -387,6 +389,7 @@
                 self.ArrayDimensions.SetStrings(type_infos["dimensions"])
                 self.ArrayInitialValue.SetValue(type_infos["initial"])
             self.RefreshDisplayedInfos()
+        self.Initializing = False
 
     def OnDerivationTypeChanged(self, event):
         self.RefreshDisplayedInfos()
@@ -403,15 +406,17 @@
         event.Skip()
 
     def OnSubrangeMinimumChanged(self, event):
-        wx.CallAfter(self.SubrangeMinimum.SetValue, min(self.SubrangeMaximum.GetValue(), self.SubrangeMinimum.GetValue()))
-        wx.CallAfter(self.RefreshSubrangeInitialValueRange)
-        wx.CallAfter(self.RefreshTypeInfos)
+        if self.Initializing:
+            wx.CallAfter(self.SubrangeMinimum.SetValue, min(self.SubrangeMaximum.GetValue(), self.SubrangeMinimum.GetValue()))
+            wx.CallAfter(self.RefreshSubrangeInitialValueRange)
+            wx.CallAfter(self.RefreshTypeInfos)
         event.Skip()
 
     def OnSubrangeMaximumChanged(self, event):
-        wx.CallAfter(self.SubrangeMaximum.SetValue, max(self.SubrangeMinimum.GetValue(), self.SubrangeMaximum.GetValue()))
-        wx.CallAfter(self.RefreshSubrangeInitialValueRange)
-        wx.CallAfter(self.RefreshTypeInfos)
+        if self.Initializing:
+            wx.CallAfter(self.SubrangeMaximum.SetValue, max(self.SubrangeMinimum.GetValue(), self.SubrangeMaximum.GetValue()))
+            wx.CallAfter(self.RefreshSubrangeInitialValueRange)
+            wx.CallAfter(self.RefreshTypeInfos)
         event.Skip()
 
     def OnDimensionsChanged(self, event):