andrej@1511: #!/usr/bin/env python andrej@1511: # -*- coding: utf-8 -*- andrej@1511: andrej@1511: # This file is part of Beremiz, a Integrated Development Environment for andrej@1511: # programming IEC 61131-3 automates supporting plcopen standard and CanFestival. andrej@1511: # andrej@1511: # Copyright (C) 2007: Edouard TISSERANT and Laurent BESSARD andrej@1511: # andrej@1511: # See COPYING file for copyrights details. andrej@1511: # andrej@1511: # This program is free software; you can redistribute it and/or andrej@1511: # modify it under the terms of the GNU General Public License andrej@1511: # as published by the Free Software Foundation; either version 2 andrej@1511: # of the License, or (at your option) any later version. andrej@1511: # andrej@1511: # This program is distributed in the hope that it will be useful, andrej@1511: # but WITHOUT ANY WARRANTY; without even the implied warranty of andrej@1511: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the andrej@1511: # GNU General Public License for more details. andrej@1511: # andrej@1511: # You should have received a copy of the GNU General Public License andrej@1511: # along with this program; if not, write to the Free Software andrej@1511: # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. andrej@1511: etisserant@14: """ Edouard@725: Minimal tab controller for a simple text editor etisserant@14: """ etisserant@14: Edouard@725: import os etisserant@14: lbessard@65: class MiniTextControler: lbessard@65: laurent@806: def __init__(self, filepath, controller): lbessard@65: self.FilePath = filepath laurent@806: self.BaseController = controller laurent@806: laurent@806: def __del__(self): laurent@806: self.BaseController = None laurent@716: Edouard@718: def CTNFullName(self): laurent@716: return "" laurent@716: lbessard@74: def SetEditedElementText(self, tagname, text): lbessard@65: file = open(self.FilePath, "w") lbessard@65: file.write(text) lbessard@65: file.close() lbessard@65: greg@273: def GetEditedElementText(self, tagname, debug = False): lbessard@65: if os.path.isfile(self.FilePath): lbessard@65: file = open(self.FilePath, "r") lbessard@65: text = file.read() lbessard@65: file.close() lbessard@65: return text lbessard@65: return "" lbessard@65: Laurent@1347: def GetEditedElementInterfaceVars(self, tagname, tree=False, debug = False): lbessard@74: return [] lbessard@74: greg@273: def GetEditedElementType(self, tagname, debug = False): lbessard@74: return "program" lbessard@74: laurent@806: def GetBlockType(self, type, inputs = None, debug = False): laurent@806: return self.BaseController.GetBlockType(type, inputs, debug) laurent@806: greg@273: def GetBlockTypes(self, tagname = "", debug = False): laurent@806: return self.BaseController.GetBlockTypes(tagname, debug) lbessard@74: laurent@630: def GetDataTypes(self, tagname = "", basetypes = True, only_locatables = False, debug = False): laurent@806: return self.BaseController.GetDataTypes(tagname, basetypes, only_locatables, debug) laurent@630: greg@273: def GetEnumeratedDataValues(self, debug = False): laurent@806: return self.BaseController.GetEnumeratedDataValues(debug) lbessard@74: lbessard@65: def StartBuffering(self): lbessard@65: pass lbessard@65: lbessard@65: def EndBuffering(self): lbessard@65: pass lbessard@65: lbessard@65: def BufferProject(self): lbessard@65: pass lbessard@65: