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. laurent@815: andrej@1881: andrej@1881: from __future__ import absolute_import laurent@815: from editors.TextViewer import TextViewer Laurent@1057: from plcopen.plcopen import TestTextElement laurent@815: andrej@1736: laurent@815: class IECCodeViewer(TextViewer): andrej@1735: laurent@815: def __del__(self): laurent@815: TextViewer.__del__(self) laurent@815: if getattr(self, "_OnClose"): Laurent@1057: self._OnClose(self) andrej@1735: Laurent@1262: def Paste(self): Laurent@1262: if self.Controler is not None: Laurent@1262: TextViewer.Paste(self) andrej@1735: Laurent@1057: def Search(self, criteria): andrej@1511: return [((self.TagName, "body", 0),) + result for result in TestTextElement(self.Editor.GetText(), criteria)]