author | laurent |
Thu, 13 Sep 2012 02:19:02 +0200 | |
changeset 834 | d613696aad01 |
parent 772 | 98786137232d |
child 1511 | 91538d0c242c |
permissions | -rw-r--r-- |
732 | 1 |
from weakref import ref |
728
e0424e96e3fd
refactoring - library support is not anymore attached to configtree nodes, but handles by project controller
Edouard Tisserant
parents:
diff
changeset
|
2 |
|
e0424e96e3fd
refactoring - library support is not anymore attached to configtree nodes, but handles by project controller
Edouard Tisserant
parents:
diff
changeset
|
3 |
class POULibrary: |
732 | 4 |
def __init__(self, CTR, LibName, TypeStack): |
772
98786137232d
Fixed import dependency order for POUlibrary and PLCControler
Edouard Tisserant
parents:
732
diff
changeset
|
5 |
from PLCControler import PLCControler |
732 | 6 |
self.CTR = ref(CTR) |
731 | 7 |
self.LibName = LibName |
728
e0424e96e3fd
refactoring - library support is not anymore attached to configtree nodes, but handles by project controller
Edouard Tisserant
parents:
diff
changeset
|
8 |
self.LibraryControler = PLCControler() |
e0424e96e3fd
refactoring - library support is not anymore attached to configtree nodes, but handles by project controller
Edouard Tisserant
parents:
diff
changeset
|
9 |
self.LibraryControler.OpenXMLFile(self.GetLibraryPath()) |
e0424e96e3fd
refactoring - library support is not anymore attached to configtree nodes, but handles by project controller
Edouard Tisserant
parents:
diff
changeset
|
10 |
self.LibraryControler.ClearConfNodeTypes() |
e0424e96e3fd
refactoring - library support is not anymore attached to configtree nodes, but handles by project controller
Edouard Tisserant
parents:
diff
changeset
|
11 |
self.LibraryControler.AddConfNodeTypesList(TypeStack) |
e0424e96e3fd
refactoring - library support is not anymore attached to configtree nodes, but handles by project controller
Edouard Tisserant
parents:
diff
changeset
|
12 |
self.program = None; |
e0424e96e3fd
refactoring - library support is not anymore attached to configtree nodes, but handles by project controller
Edouard Tisserant
parents:
diff
changeset
|
13 |
|
e0424e96e3fd
refactoring - library support is not anymore attached to configtree nodes, but handles by project controller
Edouard Tisserant
parents:
diff
changeset
|
14 |
def GetSTCode(self): |
e0424e96e3fd
refactoring - library support is not anymore attached to configtree nodes, but handles by project controller
Edouard Tisserant
parents:
diff
changeset
|
15 |
if not self.program: |
e0424e96e3fd
refactoring - library support is not anymore attached to configtree nodes, but handles by project controller
Edouard Tisserant
parents:
diff
changeset
|
16 |
self.program = self.LibraryControler.GenerateProgram()[0]+"\n" |
e0424e96e3fd
refactoring - library support is not anymore attached to configtree nodes, but handles by project controller
Edouard Tisserant
parents:
diff
changeset
|
17 |
return self.program |
e0424e96e3fd
refactoring - library support is not anymore attached to configtree nodes, but handles by project controller
Edouard Tisserant
parents:
diff
changeset
|
18 |
|
731 | 19 |
def GetName(self): |
20 |
return self.LibName |
|
732 | 21 |
|
22 |
def GetCTR(self): |
|
23 |
return self.CTR() |
|
728
e0424e96e3fd
refactoring - library support is not anymore attached to configtree nodes, but handles by project controller
Edouard Tisserant
parents:
diff
changeset
|
24 |
|
e0424e96e3fd
refactoring - library support is not anymore attached to configtree nodes, but handles by project controller
Edouard Tisserant
parents:
diff
changeset
|
25 |
def GetTypes(self): |
e0424e96e3fd
refactoring - library support is not anymore attached to configtree nodes, but handles by project controller
Edouard Tisserant
parents:
diff
changeset
|
26 |
return {"name" : self.GetName(), "types": self.LibraryControler.Project} |
e0424e96e3fd
refactoring - library support is not anymore attached to configtree nodes, but handles by project controller
Edouard Tisserant
parents:
diff
changeset
|
27 |
|
e0424e96e3fd
refactoring - library support is not anymore attached to configtree nodes, but handles by project controller
Edouard Tisserant
parents:
diff
changeset
|
28 |
def GetLibraryPath(self): |
e0424e96e3fd
refactoring - library support is not anymore attached to configtree nodes, but handles by project controller
Edouard Tisserant
parents:
diff
changeset
|
29 |
raise Exception("Not implemented") |
e0424e96e3fd
refactoring - library support is not anymore attached to configtree nodes, but handles by project controller
Edouard Tisserant
parents:
diff
changeset
|
30 |
|
e0424e96e3fd
refactoring - library support is not anymore attached to configtree nodes, but handles by project controller
Edouard Tisserant
parents:
diff
changeset
|
31 |
def Generate_C(self, buildpath, varlist, IECCFLAGS): |
e0424e96e3fd
refactoring - library support is not anymore attached to configtree nodes, but handles by project controller
Edouard Tisserant
parents:
diff
changeset
|
32 |
# Pure python or IEC libs doesn't produce C code |
e0424e96e3fd
refactoring - library support is not anymore attached to configtree nodes, but handles by project controller
Edouard Tisserant
parents:
diff
changeset
|
33 |
return ((""), [], False), "" |