--- a/DataTypeEditor.py Wed Jan 16 09:52:37 2008 +0100
+++ b/DataTypeEditor.py Tue Jan 22 10:53:34 2008 +0100
@@ -316,15 +316,20 @@
def OnEnumeratedValueEndEdit(self, event):
text = event.GetText()
- if text.upper() in [string.upper() for string in self.EnumeratedValues.GetStrings()]:
- message = wx.MessageDialog(self, "\"%s\" value already defined!"%text, "Error", wx.OK|wx.ICON_ERROR)
- message.ShowModal()
- message.Destroy()
- event.Veto()
- elif text.upper() in IEC_KEYWORDS:
- message = wx.MessageDialog(self, "\"%s\" is a keyword. It can't be used!"%text, "Error", wx.OK|wx.ICON_ERROR)
- message.ShowModal()
- message.Destroy()
+ if self.EnumeratedValues.GetStrings()[event.GetIndex()].upper() != text.upper():
+ if text.upper() in [string.upper() for string in self.EnumeratedValues.GetStrings()]:
+ message = wx.MessageDialog(self, "\"%s\" value already defined!"%text, "Error", wx.OK|wx.ICON_ERROR)
+ message.ShowModal()
+ message.Destroy()
+ event.Veto()
+ elif text.upper() in IEC_KEYWORDS:
+ message = wx.MessageDialog(self, "\"%s\" is a keyword. It can't be used!"%text, "Error", wx.OK|wx.ICON_ERROR)
+ message.ShowModal()
+ message.Destroy()
+ else:
+ wx.CallAfter(self.RefreshEnumeratedValues)
+ wx.CallAfter(self.RefreshTypeInfos)
+ event.Skip()
else:
wx.CallAfter(self.RefreshEnumeratedValues)
wx.CallAfter(self.RefreshTypeInfos)