# HG changeset patch # User laurent # Date 1337619404 -7200 # Node ID 4645a3a398ad0722a8e82979ff20c8607c363e78 # Parent 382b2c848dac52458bd8492cfa37ff849b2a19cf Fix bugs with ConfigTreeNode diff -r 382b2c848dac -r 4645a3a398ad Beremiz.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() diff -r 382b2c848dac -r 4645a3a398ad ConfTreeNodeEditor.py --- 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 diff -r 382b2c848dac -r 4645a3a398ad ConfigTreeNode.py --- 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(""" @@ -39,7 +40,7 @@ CTNMaxCount = None ConfNodeMethods = [] LibraryControler = None - EditorType = None + EditorType = ConfTreeNodeEditor IconPath = None def _AddParamsMembers(self): diff -r 382b2c848dac -r 4645a3a398ad ProjectNodeEditor.py --- 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() diff -r 382b2c848dac -r 4645a3a398ad c_ext/CFileEditor.py --- 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() diff -r 382b2c848dac -r 4645a3a398ad py_ext/PythonEditor.py --- 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