# HG changeset patch # User lbessard # Date 1200995614 -3600 # Node ID f7832baaad8480ead181052c306ba03df348f86c # Parent 189ebdde3eb9f42cf7a2c2118c529917c8f5284f Bug on enumerated datatype values editor fixed diff -r 189ebdde3eb9 -r f7832baaad84 DataTypeEditor.py --- 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)