beremiz

py_ext: fix CSV Writer

18 months ago, Edouard Tisserant
d2f5eb3c7d6e
py_ext: fix CSV Writer

fix POU logic :
- SAVE is a BOOL
- invocation of py_eval on rising edge of SAVE
- remove save python argument

fix python:
- use no encoding for file open (python2)
- re-use detected dialect if any
- use no "rt+" and truncate since no need to re-sniff dialect for output file
- return "OK" instead of "#SUCCESS", preventing POU logic to ACK result
- support creating new line if writing just after last line
- support appending data on short rows

fix example:
- use a HMI:Button to trigger CSV write instead of HMI:Input +1
- reload CSVs on on each new CSV opened in file browser
- add display of CSV write output
<?xml version='1.0' encoding='utf-8'?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.plcopen.org/xml/tc6_0201" xmlns:xhtml="http://www.w3.org/1999/xhtml" xsi:schemaLocation="http://www.plcopen.org/xml/tc6_0201">
<fileHeader companyName="Beremiz" productName="Beremiz" productVersion="0.0" creationDateTime="2008-12-14T16:53:26"/>
<contentHeader name="Beremiz non-standard POUs library" modificationDateTime="2019-08-06T14:08:26">
<coordinateInfo>
<fbd>
<scaling x="0" y="0"/>
</fbd>
<ld>
<scaling x="0" y="0"/>
</ld>
<sfc>
<scaling x="0" y="0"/>
</sfc>
</coordinateInfo>
</contentHeader>
<types>
<dataTypes>
<dataType name="HMI_SINT">
<baseType>
<SINT/>
</baseType>
</dataType>
<dataType name="HMI_INT">
<baseType>
<INT/>
</baseType>
</dataType>
<dataType name="HMI_DINT">
<baseType>
<DINT/>
</baseType>
</dataType>
<dataType name="HMI_LINT">
<baseType>
<LINT/>
</baseType>
</dataType>
<dataType name="HMI_USINT">
<baseType>
<USINT/>
</baseType>
</dataType>
<dataType name="HMI_UINT">
<baseType>
<UINT/>
</baseType>
</dataType>
<dataType name="HMI_UDINT">
<baseType>
<UDINT/>
</baseType>
</dataType>
<dataType name="HMI_ULINT">
<baseType>
<ULINT/>
</baseType>
</dataType>
<dataType name="HMI_REAL">
<baseType>
<REAL/>
</baseType>
</dataType>
<dataType name="HMI_STRING">
<baseType>
<string/>
</baseType>
</dataType>
<dataType name="HMI_BOOL">
<baseType>
<BOOL/>
</baseType>
</dataType>
<dataType name="HMI_NODE">
<baseType>
<BOOL/>
</baseType>
</dataType>
</dataTypes>
<pous/>
</types>
<instances>
<configurations/>
</instances>
</project>