diff -r e9d01d824086 -r 93bc4c2cf376 PLCControler.py --- a/PLCControler.py Thu Feb 01 18:09:34 2007 +0100 +++ b/PLCControler.py Wed Feb 07 18:43:32 2007 +0100 @@ -34,6 +34,28 @@ [ITEM_UNEDITABLE, ITEM_PROJECT, ITEM_POU, ITEM_CLASS, ITEM_VARIABLE, ITEM_TRANSITION, ITEM_ACTION, ITEM_CONFIGURATION, ITEM_RESOURCE] = range(9) +""" +pyxsval is not complete and the parts that are not supported print some error +reports. This class is used for not displaying them +""" +class HolePseudoFile: + """ Base class for file like objects to facilitate StdOut for the Shell.""" + def __init__(self, output = None): + if output is None: output = [] + self.output = output + + def writelines(self, l): + map(self.write, l) + + def write(self, s): + pass + + def flush(self): + pass + + def isatty(self): + return false + #------------------------------------------------------------------------------- # Undo Buffer for PLCOpenEditor #------------------------------------------------------------------------------- @@ -1755,7 +1777,7 @@ def OpenXMLFile(self, filepath): if sys: - sys.stdout = plcopen.HolePseudoFile() + sys.stdout = HolePseudoFile() tree = pyxsval.parseAndValidate(filepath, "plcopen/TC6_XML_V10_B.xsd") if sys: sys.stdout = sys.__stdout__ @@ -1781,7 +1803,7 @@ text += self.Project.generateXMLText("project", 0, extras) if sys: - sys.stdout = plcopen.HolePseudoFile() + sys.stdout = HolePseudoFile() pyxsval.parseAndValidateString(text, open("plcopen/TC6_XML_V10_B.xsd","r").read()) if sys: sys.stdout = sys.__stdout__