Fix bugs with ConfigTreeNode
authorlaurent
Mon, 21 May 2012 18:56:44 +0200
changeset 743 4645a3a398ad
parent 741 382b2c848dac
child 744 bdab45f96aa0
Fix bugs with ConfigTreeNode
Beremiz.py
ConfTreeNodeEditor.py
ConfigTreeNode.py
ProjectNodeEditor.py
c_ext/CFileEditor.py
py_ext/PythonEditor.py
--- a/Beremiz.py	Mon May 21 17:53:50 2012 +0200
+++ b/Beremiz.py	Mon May 21 18:56:44 2012 +0200
@@ -1741,6 +1741,14 @@
         self.Config.Write("RecentProjects", cPickle.dumps(recent_projects[:MAX_RECENT_PROJECTS]))
         self.Config.Flush()
     
+    def ResetPerspective(self):
+        IDEFrame.ResetPerspective(self)
+        self.RefreshStatusToolBar()
+    
+    def RestoreLastLayout(self):
+        IDEFrame.RestoreLastLayout(self)
+        self.RefreshStatusToolBar()
+    
     def OnNewProjectMenu(self, event):
         if self.CTR is not None and not self.CheckSaveBeforeClosing():
             return
@@ -1804,7 +1812,7 @@
                 self.RefreshConfigRecentProjects(projectpath)
                 if self.EnableDebug:
                     self.DebugVariablePanel.SetDataProducer(self.CTR)
-                self.LoadProjectOrganization()
+                self.LoadProjectLayout()
                 self._Refresh(PROJECTTREE, POUINSTANCEVARIABLESPANEL, LIBRARYTREE)
                 self.RefreshStatusToolBar()
             else:
@@ -1818,7 +1826,7 @@
         if self.CTR is not None and not self.CheckSaveBeforeClosing():
             return
         
-        self.SaveProjectOrganization()
+        self.SaveProjectLayout()
         self.ResetView()
         self._Refresh(TITLE, EDITORTOOLBAR, FILEMENU, EDITMENU)
         self.RefreshStatusToolBar()
--- a/ConfTreeNodeEditor.py	Mon May 21 17:53:50 2012 +0200
+++ b/ConfTreeNodeEditor.py	Mon May 21 18:56:44 2012 +0200
@@ -237,10 +237,13 @@
         else:
             self.Editor.Initialize(self.ParamsEditor)
     
-    def __init__(self, parent, tagname, controler, window):
+    def __init__(self, parent, controler, window, tagname=""):
         EditorPanel.__init__(self, parent, tagname, window, controler)
-    
-        self.SetIcon(wx.Bitmap(self.Controler.GetIconPath(), wx.BITMAP_TYPE_PNG))
+        
+        icon_path = self.Controler.GetIconPath()
+        if icon_path is None:
+            icon_path = opjimg("Extension")
+        self.SetIcon(wx.Bitmap(icon_path, wx.BITMAP_TYPE_PNG))
     
     def __del__(self):
         self.Controler.OnCloseEditor(self)
@@ -257,6 +260,15 @@
     def HasNoModel(self):
         return False
     
+    def GetBufferState(self):
+        return False, False
+    
+    def Undo(self):
+        pass
+    
+    def Redo(self):
+        pass
+    
     def EnableScrolling(self, enable):
         self.ScrollingEnabled = enable
     
--- a/ConfigTreeNode.py	Mon May 21 17:53:50 2012 +0200
+++ b/ConfigTreeNode.py	Mon May 21 18:56:44 2012 +0200
@@ -15,6 +15,7 @@
 from util import GetClassImporter
 
 from PLCControler import PLCControler, LOCATION_CONFNODE
+from ConfTreeNodeEditor import ConfTreeNodeEditor
 
 _BaseParamsClass = GenerateClassesFromXSDstring("""<?xml version="1.0" encoding="ISO-8859-1" ?>
         <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
@@ -39,7 +40,7 @@
     CTNMaxCount = None
     ConfNodeMethods = []
     LibraryControler = None
-    EditorType = None
+    EditorType = ConfTreeNodeEditor
     IconPath = None
     
     def _AddParamsMembers(self):
--- a/ProjectNodeEditor.py	Mon May 21 17:53:50 2012 +0200
+++ b/ProjectNodeEditor.py	Mon May 21 18:56:44 2012 +0200
@@ -11,6 +11,8 @@
         self.Editor = wx.ScrolledWindow(prnt, -1, size=wx.Size(-1, -1),
                 style=wx.TAB_TRAVERSAL|wx.SUNKEN_BORDER|wx.HSCROLL|wx.VSCROLL)
         self.Editor.SetBackgroundColour(WINDOW_COLOUR)
+        self.Editor.Bind(wx.EVT_SIZE, self.OnWindowResize)
+        self.Editor.Bind(wx.EVT_MOUSEWHEEL, self.OnMouseWheel)
         self.ParamsEditor = self.Editor
         
         # Variable allowing disabling of Editor scroll when Popup shown 
@@ -40,7 +42,7 @@
         else:
             tagname = ""
         
-        ConfTreeNodeEditor.__init__(self, parent, tagname, controler, window)
+        ConfTreeNodeEditor.__init__(self, parent, controler, window, tagname)
 
     def GetTagName(self):
         return self.Controler.CTNName()
--- a/c_ext/CFileEditor.py	Mon May 21 17:53:50 2012 +0200
+++ b/c_ext/CFileEditor.py	Mon May 21 18:56:44 2012 +0200
@@ -815,7 +815,7 @@
         self.ConfNodeEditor.SetSizer(self.MainSizer)
     
     def __init__(self, parent, controler, window):
-        ConfTreeNodeEditor.__init__(self, parent, "", controler, window)
+        ConfTreeNodeEditor.__init__(self, parent, controler, window)
     
     def GetBufferState(self):
         return self.Controler.GetBufferState()
--- a/py_ext/PythonEditor.py	Mon May 21 17:53:50 2012 +0200
+++ b/py_ext/PythonEditor.py	Mon May 21 18:56:44 2012 +0200
@@ -230,7 +230,7 @@
 
 
     def __init__(self, parent, controler, window):
-        ConfTreeNodeEditor.__init__(self, parent, "", controler, window)
+        ConfTreeNodeEditor.__init__(self, parent, controler, window)
         
         self.DisableEvents = False
         self.CurrentAction = None