beremiz

Fix wxHMI example after upgrading wxGlade

2018-08-13, Andrey Skvortsov
64bb520009f3
Fix wxHMI example after upgrading wxGlade

Newer wxGlade generates code to initialize GridSizer's with empty
elements.

...
grid_sizer_1.Add(self.window_1, 1, wx.ALIGN_CENTER, 0)
sizer_2.Add((0, 0), 0, 0, 0)
sizer_2.Add((0, 0), 0, 0, 0)
sizer_2.Add((0, 0), 0, 0, 0)
sizer_2.Add((0, 0), 0, 0, 0)
...

That causes following traceback, if new buttons are added
to already full sizer.

PLCobject : Traceback (most recent call last):

File "./Beremiz_service.py", line 389, in default_evaluator
res = (tocall(*args, **kwargs), None)

File "/tmp/tmpQS8ct2/runtime_0.py", line 540, in _runtime_0_start
wx.MessageBox(_("Please stop PLC to close"))

File "/tmp/tmpQS8ct2/runtime_0.py", line 504, in Init
lambda axis:( MakeButtonFunc(self, sizer, axis+"axisMinus"),

File "/tmp/tmpQS8ct2/runtime_0.py", line 502, in
lambda btname: MakeButtonFunc(self, sizer, btname), ActionButtons)

File "/tmp/tmpQS8ct2/runtime_0.py", line 461, in MakeButtonFunc
print sizer, btname

File "/usr/lib/python2.7/dist-packages/wx-3.0-gtk3/wx/_core.py", line 14453, in Add
return _core_.Sizer_Add(*args, **kwargs)

PyAssertionError: C++ assertion "Assert failure" failed at
../src/common/sizer.cpp(1401) in DoInsert(): too many items (11 > 2*5)
in grid sizer (maybe you should omit the number of either rows or
columns?)


Tested with wxGlade version 0.8.3
Closes #41
<?xml version='1.0' encoding='utf-8'?>
<project xmlns:ns1="http://www.plcopen.org/xml/tc6_0201" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.plcopen.org/xml/tc6_0201">
<fileHeader companyName="Unknown" productName="Unnamed" productVersion="1" creationDateTime="2014-01-19T11:14:47" contentDescription="This example shows how you can customize build process by using 'make'.&#10;"/>
<contentHeader name="Makefile Example" modificationDateTime="2016-10-14T14:00:01">
<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/>
<pous>
<pou name="program0" pouType="program">
<interface>
<localVars>
<variable name="LocalVara">
<type>
<INT/>
</type>
</variable>
<variable name="LocalVarb">
<type>
<INT/>
</type>
</variable>
</localVars>
</interface>
<body>
<FBD>
<inVariable localId="1" executionOrderId="0" height="27" width="77" negated="false">
<position x="52" y="368"/>
<connectionPointOut>
<relPosition x="77" y="13"/>
</connectionPointOut>
<expression>LocalVara</expression>
</inVariable>
<outVariable localId="2" executionOrderId="0" height="27" width="77" negated="false">
<position x="167" y="368"/>
<connectionPointIn>
<relPosition x="0" y="13"/>
<connection refLocalId="1">
<position x="167" y="381"/>
<position x="129" y="381"/>
</connection>
</connectionPointIn>
<expression>LocalVarb</expression>
</outVariable>
<comment localId="3" height="310" width="760">
<position x="32" y="23"/>
<content>
<xhtml:p><![CDATA[This example shows how you can customize build process by using 'make'.
Sometimes special steps need to be done to build entire project.
But it's not necessary to create another target in Beremiz every time you need to customize something in build process. Just use for that 'Generic' target and describe all necessary steps in Makefile.
For example, you can
- preprocess generated by Beremiz C source files,
- do some fancy source code transformation using any tools you want,
- use any compiler you want,
- call static analyzers,
- run integration tests on the project,
- upload source code to external build server,
- upload to the target and compile it there,
- flash/transfer your compiled binary to the target,
and much much more.
]]></xhtml:p>
</content>
</comment>
</FBD>
</body>
</pou>
</pous>
</types>
<instances>
<configurations>
<configuration name="config">
<resource name="resource1">
<task name="Tsk" priority="0" interval="T#100ms">
<pouInstance name="Inst" typeName="program0"/>
</task>
</resource>
</configuration>
</configurations>
</instances>
</project>