Print hook: send print output to Debugview
add this file printhook.py to Datalight/PythonModules
<python>
"""print redirector. This module will redirect the stdout to DebugView when imported"""
import sys
import EugUtil
import effet
class debugview_stdout(object):
def __init__(self, text_writer):
self.text_writer = text_writer
def write(self, message):
self.text_writer.Affichage = message
effet.RunEffetInstantane(self.text_writer)
def activate_hook():
text_writer = EugUtil.MakeObject("TEffetEugDebugWin32")
sys.stdout = debugview_stdout(text_writer)
print "Print hook activated"
</python>
now activate it with this ndf code:
<ndf>
TEffetDescriptor_EffetPythonInstantane
(
Code = """
import printhook
printhook.activate_hook()
"""
)
</ndf>