Fix confnode new name format that generates an error with frame class name in wxGlade extension
authorlaurent
Thu, 13 Sep 2012 02:18:00 +0200
changeset 833 3f997fb22928
parent 832 b2609a8e4cb6
child 834 d613696aad01
Fix confnode new name format that generates an error with frame class name in wxGlade extension
Beremiz.py
ConfigTreeNode.py
--- 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