util/MiniTextControler.py
changeset 1735 c02818d7e29f
parent 1511 91538d0c242c
child 1736 7e61baa047f0
equal deleted inserted replaced
1734:750eeb7230a1 1735:c02818d7e29f
    27 """
    27 """
    28 
    28 
    29 import os
    29 import os
    30 
    30 
    31 class MiniTextControler:
    31 class MiniTextControler:
    32     
    32 
    33     def __init__(self, filepath, controller):
    33     def __init__(self, filepath, controller):
    34         self.FilePath = filepath
    34         self.FilePath = filepath
    35         self.BaseController = controller
    35         self.BaseController = controller
    36     
    36 
    37     def __del__(self):
    37     def __del__(self):
    38         self.BaseController = None
    38         self.BaseController = None
    39     
    39 
    40     def CTNFullName(self):
    40     def CTNFullName(self):
    41         return ""
    41         return ""
    42     
    42 
    43     def SetEditedElementText(self, tagname, text):
    43     def SetEditedElementText(self, tagname, text):
    44         file = open(self.FilePath, "w")
    44         file = open(self.FilePath, "w")
    45         file.write(text)
    45         file.write(text)
    46         file.close()
    46         file.close()
    47         
    47 
    48     def GetEditedElementText(self, tagname, debug = False):
    48     def GetEditedElementText(self, tagname, debug = False):
    49         if os.path.isfile(self.FilePath):
    49         if os.path.isfile(self.FilePath):
    50             file = open(self.FilePath, "r")
    50             file = open(self.FilePath, "r")
    51             text = file.read()
    51             text = file.read()
    52             file.close()
    52             file.close()
    53             return text
    53             return text
    54         return ""
    54         return ""
    55     
    55 
    56     def GetEditedElementInterfaceVars(self, tagname, tree=False, debug = False):
    56     def GetEditedElementInterfaceVars(self, tagname, tree=False, debug = False):
    57         return []
    57         return []
    58     
    58 
    59     def GetEditedElementType(self, tagname, debug = False):
    59     def GetEditedElementType(self, tagname, debug = False):
    60         return "program"
    60         return "program"
    61     
    61 
    62     def GetBlockType(self, type, inputs = None, debug = False):
    62     def GetBlockType(self, type, inputs = None, debug = False):
    63         return self.BaseController.GetBlockType(type, inputs, debug)
    63         return self.BaseController.GetBlockType(type, inputs, debug)
    64     
    64 
    65     def GetBlockTypes(self, tagname = "", debug = False):
    65     def GetBlockTypes(self, tagname = "", debug = False):
    66         return self.BaseController.GetBlockTypes(tagname, debug)
    66         return self.BaseController.GetBlockTypes(tagname, debug)
    67     
    67 
    68     def GetDataTypes(self, tagname = "", basetypes = True, only_locatables = False, debug = False):
    68     def GetDataTypes(self, tagname = "", basetypes = True, only_locatables = False, debug = False):
    69         return self.BaseController.GetDataTypes(tagname, basetypes, only_locatables, debug)
    69         return self.BaseController.GetDataTypes(tagname, basetypes, only_locatables, debug)
    70     
    70 
    71     def GetEnumeratedDataValues(self, debug = False):
    71     def GetEnumeratedDataValues(self, debug = False):
    72         return self.BaseController.GetEnumeratedDataValues(debug)
    72         return self.BaseController.GetEnumeratedDataValues(debug)
    73     
    73 
    74     def StartBuffering(self):
    74     def StartBuffering(self):
    75         pass
    75         pass
    76 
    76 
    77     def EndBuffering(self):
    77     def EndBuffering(self):
    78         pass
    78         pass
    79 
    79 
    80     def BufferProject(self):
    80     def BufferProject(self):
    81         pass
    81         pass
    82