editors/IECCodeViewer.py
author Edouard Tisserant
Tue, 13 May 2014 00:43:06 +0200
changeset 1406 82db84fe88ea
parent 1262 7b9259945453
child 1511 91538d0c242c
permissions -rw-r--r--
Added 'NamedConstant' drag'n'drop in programs. It does create a simple variable with initial value and is usefull for drag'n'drop constants from extensions while keeping a name associated with constant

from editors.TextViewer import TextViewer
from plcopen.plcopen import TestTextElement

class IECCodeViewer(TextViewer):
    
    def __del__(self):
        TextViewer.__del__(self)
        if getattr(self, "_OnClose"):
            self._OnClose(self)
    
    def Paste(self):
        if self.Controler is not None:
            TextViewer.Paste(self)
    
    def Search(self, criteria):
        return [((self.TagName, "body", 0),) + result for result in TestTextElement(self.Editor.GetText(), criteria)]