equal
deleted
inserted
replaced
95 XSD = None |
95 XSD = None |
96 PlugChildsTypes = [] |
96 PlugChildsTypes = [] |
97 PlugMaxCount = None |
97 PlugMaxCount = None |
98 PluginMethods = [] |
98 PluginMethods = [] |
99 LibraryControler = None |
99 LibraryControler = None |
|
100 EditorType = None |
100 |
101 |
101 def _AddParamsMembers(self): |
102 def _AddParamsMembers(self): |
102 self.PlugParams = None |
103 self.PlugParams = None |
103 if self.XSD: |
104 if self.XSD: |
104 self.Classes = GenerateClassesFromXSDstring(self.XSD) |
105 self.Classes = GenerateClassesFromXSDstring(self.XSD) |
113 # Create BaseParam |
114 # Create BaseParam |
114 self.BaseParams = _BaseParamsClass() |
115 self.BaseParams = _BaseParamsClass() |
115 self.MandatoryParams = ("BaseParams", self.BaseParams) |
116 self.MandatoryParams = ("BaseParams", self.BaseParams) |
116 self._AddParamsMembers() |
117 self._AddParamsMembers() |
117 self.PluggedChilds = {} |
118 self.PluggedChilds = {} |
|
119 self._View = None |
118 # copy PluginMethods so that it can be later customized |
120 # copy PluginMethods so that it can be later customized |
119 self.PluginMethods = [dic.copy() for dic in self.PluginMethods] |
121 self.PluginMethods = [dic.copy() for dic in self.PluginMethods] |
120 self.LoadSTLibrary() |
122 self.LoadSTLibrary() |
121 |
123 |
122 def PluginBaseXmlFilePath(self, PlugName=None): |
124 def PluginBaseXmlFilePath(self, PlugName=None): |
134 def PlugPath(self,PlugName=None): |
136 def PlugPath(self,PlugName=None): |
135 if not PlugName: |
137 if not PlugName: |
136 PlugName = self.BaseParams.getName() |
138 PlugName = self.BaseParams.getName() |
137 return os.path.join(self.PlugParent.PlugPath(), |
139 return os.path.join(self.PlugParent.PlugPath(), |
138 PlugName + NameTypeSeparator + self.PlugType) |
140 PlugName + NameTypeSeparator + self.PlugType) |
|
141 |
|
142 def PlugFullName(self): |
|
143 parent = self.PlugParent.PlugFullName() |
|
144 if parent != "": |
|
145 return parent + "." + self.BaseParams.getName() |
|
146 return self.BaseParams.getName() |
139 |
147 |
140 def GetIconPath(self, name): |
148 def GetIconPath(self, name): |
141 return opjimg(name) |
149 return opjimg(name) |
142 |
150 |
143 def PlugTestModified(self): |
151 def PlugTestModified(self): |
482 self.BaseParams.setIEC_Channel(res) |
490 self.BaseParams.setIEC_Channel(res) |
483 if DesiredChannel != res: |
491 if DesiredChannel != res: |
484 self.GetPlugRoot().logger.write_warning(_("A child with IEC channel %d already exist -> %d\n")%(DesiredChannel,res)) |
492 self.GetPlugRoot().logger.write_warning(_("A child with IEC channel %d already exist -> %d\n")%(DesiredChannel,res)) |
485 return res |
493 return res |
486 |
494 |
|
495 def _OpenView(self): |
|
496 if self.EditorType is not None and self._View is None: |
|
497 app_frame = self.GetPlugRoot().AppFrame |
|
498 |
|
499 self._View = self.EditorType(app_frame.TabsOpened, self, app_frame) |
|
500 |
|
501 app_frame.EditProjectElement(self._View, self.GetFilename()) |
|
502 |
|
503 def OnCloseEditor(self): |
|
504 self._View = None |
|
505 |
487 def OnPlugClose(self): |
506 def OnPlugClose(self): |
|
507 if self._View is not None: |
|
508 app_frame = self.GetPlugRoot().AppFrame |
|
509 if app_frame is not None: |
|
510 app_frame.DeletePage(self._View) |
488 return True |
511 return True |
489 |
512 |
490 def _doRemoveChild(self, PlugInstance): |
513 def _doRemoveChild(self, PlugInstance): |
491 # Remove all childs of child |
514 # Remove all childs of child |
492 for SubPlugInstance in PlugInstance.IterChilds(): |
515 for SubPlugInstance in PlugInstance.IterChilds(): |
807 def PluginLibraryFilePath(self): |
830 def PluginLibraryFilePath(self): |
808 return os.path.join(os.path.split(__file__)[0], "pous.xml") |
831 return os.path.join(os.path.split(__file__)[0], "pous.xml") |
809 |
832 |
810 def PlugTestModified(self): |
833 def PlugTestModified(self): |
811 return self.ChangesToSave or not self.ProjectIsSaved() |
834 return self.ChangesToSave or not self.ProjectIsSaved() |
|
835 |
|
836 def PlugFullName(self): |
|
837 return "" |
812 |
838 |
813 def GetPlugRoot(self): |
839 def GetPlugRoot(self): |
814 return self |
840 return self |
815 |
841 |
816 def GetIECLibPath(self): |
842 def GetIECLibPath(self): |