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