plugger.py
changeset 403 ae4a85291441
parent 402 984e238e63d0
child 411 8261c8f1e365
equal deleted inserted replaced
402:984e238e63d0 403:ae4a85291441
   558                     if getattr(PlugClass, "__init__", None):
   558                     if getattr(PlugClass, "__init__", None):
   559                         PlugClass.__init__(_self)
   559                         PlugClass.__init__(_self)
   560                     _self.PlugRequestSave()
   560                     _self.PlugRequestSave()
   561                     #just created, must be saved
   561                     #just created, must be saved
   562                     _self.ChangesToSave = True
   562                     _self.ChangesToSave = True
   563             
   563                 
   564             def _getBuildPath(_self):
   564             def _getBuildPath(_self):
   565                 return self._getBuildPath()
   565                 return self._getBuildPath()
   566             
   566             
   567         # Create the object out of the resulting class
   567         # Create the object out of the resulting class
   568         newPluginOpj = FinalPlugClass()
   568         newPluginOpj = FinalPlugClass()
   569         # Store it in PluggedChils
   569         # Store it in PluggedChils
   570         PluggedChildsWithSameClass.append(newPluginOpj)
   570         PluggedChildsWithSameClass.append(newPluginOpj)
   571         
   571         
   572         return newPluginOpj
   572         return newPluginOpj
   573             
   573     
       
   574     def ClearPluggedChilds(self):
       
   575         for child in self.IterChilds():
       
   576             child.ClearPluggedChilds()
       
   577         self.PluggedChilds = {}
       
   578     
   574     def LoadSTLibrary(self):
   579     def LoadSTLibrary(self):
   575         # Get library blocks if plcopen library exist
   580         # Get library blocks if plcopen library exist
   576         library_path = self.PluginLibraryFilePath()
   581         library_path = self.PluginLibraryFilePath()
   577         if os.path.isfile(library_path):
   582         if os.path.isfile(library_path):
   578             self.LibraryControler = PLCControler()
   583             self.LibraryControler = PLCControler()
   878 
   883 
   879         if os.path.isfile(self._getIECrawcodepath()):
   884         if os.path.isfile(self._getIECrawcodepath()):
   880             self.ShowMethod("_showIECcode", True)
   885             self.ShowMethod("_showIECcode", True)
   881 
   886 
   882         return None
   887         return None
       
   888     
       
   889     def CloseProject(self):
       
   890         self.ClearPluggedChilds()
       
   891         self.AppFrame.Unbind(wx.EVT_TIMER, self.StatusTimer)
   883     
   892     
   884     def SaveProject(self):
   893     def SaveProject(self):
   885         if not self.SaveXMLFile():
   894         if not self.SaveXMLFile():
   886             self.SaveXMLFile(os.path.join(self.ProjectPath, 'plc.xml'))
   895             self.SaveXMLFile(os.path.join(self.ProjectPath, 'plc.xml'))
   887         result = self.PlugRequestSave()
   896         result = self.PlugRequestSave()