Fix confnode new name format that generates an error with frame class name in wxGlade extension
--- a/Beremiz.py Thu Sep 13 02:15:29 2012 +0200
+++ b/Beremiz.py Thu Sep 13 02:18:00 2012 +0200
@@ -807,7 +807,7 @@
except:
defaultpath = os.path.expanduser("~")
- dialog = wx.DirDialog(self , _("Choose a project"), defaultpath, wx.DD_NEW_DIR_BUTTON)
+ dialog = wx.DirDialog(self , _("Choose a project"), defaultpath)
if dialog.ShowModal() == wx.ID_OK:
projectpath = dialog.GetPath()
self.Config.Write("lastopenedfolder",
@@ -842,7 +842,8 @@
except:
defaultpath = os.path.expanduser("~")
- dialog = wx.DirDialog(self , _("Choose a project"), defaultpath, wx.DD_NEW_DIR_BUTTON)
+ dialog = wx.DirDialog(self , _("Choose a project"), defaultpath, style=wx.DEFAULT_DIALOG_STYLE|
+ wx.RESIZE_BORDER)
if dialog.ShowModal() == wx.ID_OK:
self.OpenProject(dialog.GetPath())
dialog.Destroy()
@@ -1005,7 +1006,7 @@
def AddConfNode(self, ConfNodeType, confnode=None):
if self.CTR.CheckProjectPathPerm():
- ConfNodeName = "%s-0" % ConfNodeType
+ ConfNodeName = "%s_0" % ConfNodeType
if confnode is not None:
confnode.CTNAddChild(ConfNodeName, ConfNodeType)
else:
--- a/ConfigTreeNode.py Thu Sep 13 02:15:29 2012 +0200
+++ b/ConfigTreeNode.py Thu Sep 13 02:18:00 2012 +0200
@@ -352,9 +352,11 @@
# Find a free name, eventually appending digit
res = DesiredName
+ if DesiredName.endswith("_0"):
+ DesiredName = DesiredName[:-2]
suffix = 1
while res in AllNames:
- res = "%s-%d"%(DesiredName, suffix)
+ res = "%s_%d"%(DesiredName, suffix)
suffix += 1
# Get old path