POULibrary.py
author Edouard Tisserant
Sat, 19 May 2012 12:41:48 +0200
changeset 731 4fc681ed0c61
parent 728 e0424e96e3fd
child 732 c4b0f117e106
permissions -rw-r--r--
refecored library extension machanism
728
e0424e96e3fd refactoring - library support is not anymore attached to configtree nodes, but handles by project controller
Edouard Tisserant
parents:
diff changeset
     1
from PLCControler import PLCControler
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:
731
4fc681ed0c61 refecored library extension machanism
Edouard Tisserant
parents: 728
diff changeset
     4
    def __init__(self, LibName, TypeStack):
4fc681ed0c61 refecored library extension machanism
Edouard Tisserant
parents: 728
diff changeset
     5
        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
     6
        self.LibraryControler = PLCControler()
e0424e96e3fd refactoring - library support is not anymore attached to configtree nodes, but handles by project controller
Edouard Tisserant
parents:
diff changeset
     7
        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
     8
        self.LibraryControler.ClearConfNodeTypes()
e0424e96e3fd refactoring - library support is not anymore attached to configtree nodes, but handles by project controller
Edouard Tisserant
parents:
diff changeset
     9
        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
    10
        self.program = None;
e0424e96e3fd refactoring - library support is not anymore attached to configtree nodes, but handles by project controller
Edouard Tisserant
parents:
diff changeset
    11
e0424e96e3fd refactoring - library support is not anymore attached to configtree nodes, but handles by project controller
Edouard Tisserant
parents:
diff changeset
    12
    def GetSTCode(self):
e0424e96e3fd refactoring - library support is not anymore attached to configtree nodes, but handles by project controller
Edouard Tisserant
parents:
diff changeset
    13
        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
    14
            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
    15
        return self.program 
e0424e96e3fd refactoring - library support is not anymore attached to configtree nodes, but handles by project controller
Edouard Tisserant
parents:
diff changeset
    16
731
4fc681ed0c61 refecored library extension machanism
Edouard Tisserant
parents: 728
diff changeset
    17
    def GetName(self):
4fc681ed0c61 refecored library extension machanism
Edouard Tisserant
parents: 728
diff changeset
    18
        return self.LibName
728
e0424e96e3fd refactoring - library support is not anymore attached to configtree nodes, but handles by project controller
Edouard Tisserant
parents:
diff changeset
    19
        
e0424e96e3fd refactoring - library support is not anymore attached to configtree nodes, but handles by project controller
Edouard Tisserant
parents:
diff changeset
    20
    def GetTypes(self):
e0424e96e3fd refactoring - library support is not anymore attached to configtree nodes, but handles by project controller
Edouard Tisserant
parents:
diff changeset
    21
        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
    22
e0424e96e3fd refactoring - library support is not anymore attached to configtree nodes, but handles by project controller
Edouard Tisserant
parents:
diff changeset
    23
    def GetLibraryPath(self):
e0424e96e3fd refactoring - library support is not anymore attached to configtree nodes, but handles by project controller
Edouard Tisserant
parents:
diff changeset
    24
        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
    25
e0424e96e3fd refactoring - library support is not anymore attached to configtree nodes, but handles by project controller
Edouard Tisserant
parents:
diff changeset
    26
    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
    27
        # 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
    28
        return ((""), [], False), ""