ProjectController.py
changeset 806 abf1afc1f04d
parent 801 435e49e80832
child 813 1460273f40ed
--- a/ProjectController.py	Mon Aug 27 22:13:43 2012 +0200
+++ b/ProjectController.py	Mon Aug 27 23:36:57 2012 +0200
@@ -14,7 +14,7 @@
 
 import targets
 import connectors
-from util.misc import CheckPathPerm, GetClassImporter
+from util.misc import CheckPathPerm, GetClassImporter, IECCodeViewer
 from util.MiniTextControler import MiniTextControler
 from util.ProcessLogger import ProcessLogger
 from util.FileManagementPanel import FileManagementPanel
@@ -948,8 +948,7 @@
             if self._IECCodeView is None:
                 plc_file = self._getIECcodepath()
             
-                self._IECCodeView = TextViewer(self.AppFrame.TabsOpened, "", None, None, instancepath=name)
-                #self._IECCodeView.Enable(False)
+                self._IECCodeView = IECCodeViewer(self.AppFrame.TabsOpened, "", None, None, instancepath=name)
                 self._IECCodeView.SetTextSyntax("ALL")
                 self._IECCodeView.SetKeywords(IEC_KEYWORDS)
                 try:
@@ -958,6 +957,7 @@
                     text = '(* No IEC code have been generated at that time ! *)'
                 self._IECCodeView.SetText(text = text)
                 self._IECCodeView.SetIcon(GetBitmap("ST"))
+                setattr(self._IECCodeView, "_OnClose", self.OnCloseEditor)
             
             if self._IECCodeView is not None:
                 self.AppFrame.EditProjectElement(self._IECCodeView, name)
@@ -966,14 +966,14 @@
         
         elif name == "IEC raw code":
             if self._IECRawCodeView is None:
-                controler = MiniTextControler(self._getIECrawcodepath())
+                controler = MiniTextControler(self._getIECrawcodepath(), self)
                 
-                self._IECRawCodeView = TextViewer(self.AppFrame.TabsOpened, "", None, controler, instancepath=name)
-                #self._IECRawCodeView.Enable(False)
+                self._IECRawCodeView = IECCodeViewer(self.AppFrame.TabsOpened, "", None, controler, instancepath=name)
                 self._IECRawCodeView.SetTextSyntax("ALL")
                 self._IECRawCodeView.SetKeywords(IEC_KEYWORDS)
                 self._IECRawCodeView.RefreshView()
                 self._IECRawCodeView.SetIcon(GetBitmap("ST"))
+                setattr(self._IECRawCodeView, "_OnClose", self.OnCloseEditor)
             
             if self._IECRawCodeView is not None:
                 self.AppFrame.EditProjectElement(self._IECRawCodeView, name)