plcopen/instances_path.ysl2
author |
Andrey Skvortsov <andrej.skvortzov@gmail.com> |
|
Mon, 13 Aug 2018 18:29:07 +0300 |
changeset 2284 |
64bb520009f3 |
parent 1949 |
c266fbaae0f6
|
child 2626 |
39d78c530cbb |
permissions |
-rw-r--r-- |
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>
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
include yslt_noindent.yml2
istylesheet xmlns:ppx="http://www.plcopen.org/xml/tc6_0201"
xmlns:xhtml="http://www.w3.org/1999/xhtml"
xmlns:ns="beremiz"
extension-element-prefixes="ns"
exclude-result-prefixes="ns" {
param "instance_type";
template "text()";
variable "project", "ns:GetProject()";
variable "stdlib", "ns:GetStdLibs()";
variable "extensions", "ns:GetExtensions()";
variable "all_types", "($project | $stdlib | $extensions)/ppx:types";
template "ppx:project" {
apply "ppx:instances/ppx:configurations/ppx:configuration";
}
template "ppx:configuration" {
apply "ppx:globalVars/ppx:variable[ppx:type/ppx:derived] | ppx:resource" {
with "parent_path" > «@name»
}
}
template "ppx:resource" {
param "parent_path";
variable "resource_path" > «$parent_path».«@name»
apply "ppx:globalVars/ppx:variable[ppx:type/ppx:derived] | ppx:pouInstance | ppx:task/ppx:pouInstance" {
with "parent_path" > «$resource_path»
}
}
template "ppx:pouInstance" {
param "parent_path";
variable "pou_instance_path" > «$parent_path».«@name»
choose {
when "@typeName=$instance_type" {
value "ns:AddInstance($pou_instance_path)";
}
otherwise {
variable "type_name" > «@typeName»
apply """$all_types/ppx:pous/ppx:pou[@name=$type_name] | \
$all_types/ppx:dataTypes/ppx:dataType[@name=$type_name]""" {
with "instance_path" > «$pou_instance_path»
}
}
}
}
template "ppx:pou" {
param "instance_path";
apply "ppx:interface/*/ppx:variable[ppx:type/ppx:derived]" {
with "parent_path" > «$instance_path»
}
}
template "ppx:dataType" {
param "instance_path";
apply "ppx:baseType/*[self::ppx:derived or self::ppx:struct or self::ppx:array]" {
with "parent_path" > «$instance_path»
}
}
template "ppx:variable" {
param "parent_path";
variable "variable_path" > «$parent_path».«@name»
apply "ppx:type/ppx:derived" {
with "variable_path" > «$variable_path»
}
}
template "ppx:derived" {
param "variable_path";
choose {
when "@name=$instance_type" {
value "ns:AddInstance($variable_path)";
}
otherwise {
variable "type_name" > «@name»
apply """$all_types/ppx:pous/ppx:pou[@name=$type_name] | \
$all_types/ppx:dataTypes/ppx:dataType[@name=$type_name]""" {
with "instance_path" > «$variable_path»
}
}
}
}
template "ppx:struct" {
param "variable_path";
foreach "ppx:variable[ppx:type/ppx:derived or ppx:type/ppx:struct or ppx:type/ppx:array]" {
variable "element_path" > «$variable_path».«@name»
}
apply "ppx:type/*[self::ppx:derived or self::ppx:struct or self::ppx:array]" {
with "variable_path" > «$element_path»
}
}
template "ppx:array" {
param "variable_path";
apply "ppx:baseType/*[self::ppx:derived or self::ppx:struct or self::ppx:array]" {
with "variable_path" > «$variable_path»
}
}
}