104 self.MandatoryParams = ("BaseParams", self.BaseParams) |
104 self.MandatoryParams = ("BaseParams", self.BaseParams) |
105 self._AddParamsMembers() |
105 self._AddParamsMembers() |
106 self.PluggedChilds = {} |
106 self.PluggedChilds = {} |
107 # copy PluginMethods so that it can be later customized |
107 # copy PluginMethods so that it can be later customized |
108 self.PluginMethods = [dic.copy() for dic in self.PluginMethods] |
108 self.PluginMethods = [dic.copy() for dic in self.PluginMethods] |
109 |
109 self.LoadSTLibrary() |
|
110 |
110 def PluginBaseXmlFilePath(self, PlugName=None): |
111 def PluginBaseXmlFilePath(self, PlugName=None): |
111 return os.path.join(self.PlugPath(PlugName), "baseplugin.xml") |
112 return os.path.join(self.PlugPath(PlugName), "baseplugin.xml") |
112 |
113 |
113 def PluginXmlFilePath(self, PlugName=None): |
114 def PluginXmlFilePath(self, PlugName=None): |
114 return os.path.join(self.PlugPath(PlugName), "plugin.xml") |
115 return os.path.join(self.PlugPath(PlugName), "plugin.xml") |
115 |
116 |
116 def PluginLibraryFilePath(self, PlugName=None): |
117 def PluginLibraryFilePath(self): |
117 return os.path.join(os.path.join(os.path.split(__file__)[0], "plugins", self.PlugType, "pous.xml")) |
118 return os.path.join(os.path.join(os.path.split(__file__)[0], "plugins", self.PlugType, "pous.xml")) |
118 |
119 |
119 def PlugPath(self,PlugName=None): |
120 def PlugPath(self,PlugName=None): |
120 if not PlugName: |
121 if not PlugName: |
121 PlugName = self.BaseParams.getName() |
122 PlugName = self.BaseParams.getName() |
532 # Store it in PluggedChils |
533 # Store it in PluggedChils |
533 PluggedChildsWithSameClass.append(newPluginOpj) |
534 PluggedChildsWithSameClass.append(newPluginOpj) |
534 |
535 |
535 return newPluginOpj |
536 return newPluginOpj |
536 |
537 |
|
538 def LoadSTLibrary(self): |
|
539 # Get library blocks if plcopen library exist |
|
540 library_path = self.PluginLibraryFilePath() |
|
541 if os.path.isfile(library_path): |
|
542 self.LibraryControler = PLCControler() |
|
543 self.LibraryControler.OpenXMLFile(library_path) |
537 |
544 |
538 def LoadXMLParams(self, PlugName = None): |
545 def LoadXMLParams(self, PlugName = None): |
539 methode_name = os.path.join(self.PlugPath(PlugName), "methods.py") |
546 methode_name = os.path.join(self.PlugPath(PlugName), "methods.py") |
540 if os.path.isfile(methode_name): |
547 if os.path.isfile(methode_name): |
541 execfile(methode_name) |
548 execfile(methode_name) |
542 |
|
543 # Get library blocks if plcopen library exist |
|
544 library_path = self.PluginLibraryFilePath(PlugName) |
|
545 if os.path.isfile(library_path): |
|
546 self.LibraryControler = PLCControler() |
|
547 self.LibraryControler.OpenXMLFile(library_path) |
|
548 |
549 |
549 # Get the base xml tree |
550 # Get the base xml tree |
550 if self.MandatoryParams: |
551 if self.MandatoryParams: |
551 try: |
552 try: |
552 basexmlfile = open(self.PluginBaseXmlFilePath(PlugName), 'r') |
553 basexmlfile = open(self.PluginBaseXmlFilePath(PlugName), 'r') |
702 self.PLCDebug = None |
703 self.PLCDebug = None |
703 self.DebugThread = None |
704 self.DebugThread = None |
704 self.debug_break = False |
705 self.debug_break = False |
705 # copy PluginMethods so that it can be later customized |
706 # copy PluginMethods so that it can be later customized |
706 self.PluginMethods = [dic.copy() for dic in self.PluginMethods] |
707 self.PluginMethods = [dic.copy() for dic in self.PluginMethods] |
707 |
708 self.LoadSTLibrary() |
708 def PluginLibraryFilePath(self, PlugName=None): |
709 |
709 return os.path.join(os.path.join(os.path.split(__file__)[0], "pous.xml")) |
710 def PluginLibraryFilePath(self): |
|
711 return os.path.join(os.path.split(__file__)[0], "pous.xml") |
710 |
712 |
711 def PlugTestModified(self): |
713 def PlugTestModified(self): |
712 return self.ChangesToSave or not self.ProjectIsSaved() |
714 return self.ChangesToSave or not self.ProjectIsSaved() |
713 |
715 |
714 def GetPlugRoot(self): |
716 def GetPlugRoot(self): |