plugger.py
changeset 656 c1792dfc8c7e
parent 655 5becd66cca02
child 661 5d3da49e8029
--- a/plugger.py	Mon Dec 19 01:56:13 2011 +0100
+++ b/plugger.py	Tue Dec 20 23:37:06 2011 +0100
@@ -97,6 +97,7 @@
     PlugMaxCount = None
     PluginMethods = []
     LibraryControler = None
+    EditorType = None
 
     def _AddParamsMembers(self):
         self.PlugParams = None
@@ -115,6 +116,7 @@
         self.MandatoryParams = ("BaseParams", self.BaseParams)
         self._AddParamsMembers()
         self.PluggedChilds = {}
+        self._View = None
         # copy PluginMethods so that it can be later customized
         self.PluginMethods = [dic.copy() for dic in self.PluginMethods]
         self.LoadSTLibrary()
@@ -137,6 +139,12 @@
         return os.path.join(self.PlugParent.PlugPath(),
                             PlugName + NameTypeSeparator + self.PlugType)
     
+    def PlugFullName(self):
+        parent = self.PlugParent.PlugFullName()
+        if parent != "":
+            return parent + "." + self.BaseParams.getName()
+        return self.BaseParams.getName()
+    
     def GetIconPath(self, name):
         return opjimg(name)
     
@@ -484,7 +492,22 @@
             self.GetPlugRoot().logger.write_warning(_("A child with IEC channel %d already exist -> %d\n")%(DesiredChannel,res))
         return res
 
+    def _OpenView(self):
+        if self.EditorType is not None and self._View is None:
+            app_frame = self.GetPlugRoot().AppFrame
+            
+            self._View = self.EditorType(app_frame.TabsOpened, self, app_frame)
+            
+            app_frame.EditProjectElement(self._View, self.GetFilename())
+
+    def OnCloseEditor(self):
+        self._View = None
+
     def OnPlugClose(self):
+        if self._View is not None:
+            app_frame = self.GetPlugRoot().AppFrame
+            if app_frame is not None:
+                app_frame.DeletePage(self._View)
         return True
 
     def _doRemoveChild(self, PlugInstance):
@@ -810,6 +833,9 @@
     def PlugTestModified(self):
          return self.ChangesToSave or not self.ProjectIsSaved()
 
+    def PlugFullName(self):
+        return ""
+
     def GetPlugRoot(self):
         return self