tests/wiimote/wxglade_hmi@wxglade_hmi/hmi.wxg
author Andrey Skvortsov <andrej.skvortzov@gmail.com>
Thu, 28 Apr 2016 13:05:57 +0300
changeset 1507 d7f474d10210
parent 1157 72d14a74c643
permissions -rw-r--r--
fix issue with sometimes wrong return code of ProcessLogger


As a result of wrong return code Beremiz gives folowing traceback:
Traceback (most recent call last):
File "./Beremiz.py", line 850, in OnMenu
getattr(self.CTR, method)()
File "/home/developer/WorkData/PLC/beremiz/beremiz/ProjectController.py", line 925, in _Build
IECGenRes = self._Generate_SoftPLC()
File "/home/developer/WorkData/PLC/beremiz/beremiz/ProjectController.py", line 568, in _Generate_SoftPLC
return self._Compile_ST_to_SoftPLC()
File "/home/developer/WorkData/PLC/beremiz/beremiz/ProjectController.py", line 661, in _Compile_ST_to_SoftPLC
C_files.remove("POUS.c")
ValueError: list.remove(x): x not in list

The problem is that both threads (for reading stdout and stderr) call self.Proc.poll(),
that updates internal returncode field. This call is done without any locking and the first thread gets correct result,
but other gets 0 as retval. If 0 gets thread, that afterwards calls callback finish, then wrong return code is returned
to the parent. Now only the thread with a callback polls for the return code, other thread just checked local value.

Additionally function spin() waits now until all threads finish reading their pipes, so the results are always correct.
1157
72d14a74c643 Added wiimote input example using python-cwiid and python PLC global variable access
Edouard Tisserant
parents:
diff changeset
     1
<?xml version="1.0"?>
72d14a74c643 Added wiimote input example using python-cwiid and python PLC global variable access
Edouard Tisserant
parents:
diff changeset
     2
<!-- generated by wxGlade 0.6.4 on Thu May 16 13:24:16 2013 -->
72d14a74c643 Added wiimote input example using python-cwiid and python PLC global variable access
Edouard Tisserant
parents:
diff changeset
     3
72d14a74c643 Added wiimote input example using python-cwiid and python PLC global variable access
Edouard Tisserant
parents:
diff changeset
     4
<application path="" name="" class="" option="0" language="python" top_window="wxglade_hmi" encoding="UTF-8" use_gettext="0" overwrite="0" use_new_namespace="1" for_version="2.8" is_template="0" indent_amount="4" indent_symbol="space" source_extension=".cpp" header_extension=".h">
72d14a74c643 Added wiimote input example using python-cwiid and python PLC global variable access
Edouard Tisserant
parents:
diff changeset
     5
    <object class="Class_wxglade_hmi" name="wxglade_hmi" base="EditFrame">
72d14a74c643 Added wiimote input example using python-cwiid and python PLC global variable access
Edouard Tisserant
parents:
diff changeset
     6
        <style>wxDEFAULT_FRAME_STYLE</style>
72d14a74c643 Added wiimote input example using python-cwiid and python PLC global variable access
Edouard Tisserant
parents:
diff changeset
     7
        <title>frame_1</title>
72d14a74c643 Added wiimote input example using python-cwiid and python PLC global variable access
Edouard Tisserant
parents:
diff changeset
     8
        <object class="wxStaticBoxSizer" name="sizer_1" base="EditStaticBoxSizer">
72d14a74c643 Added wiimote input example using python-cwiid and python PLC global variable access
Edouard Tisserant
parents:
diff changeset
     9
            <orient>wxVERTICAL</orient>
72d14a74c643 Added wiimote input example using python-cwiid and python PLC global variable access
Edouard Tisserant
parents:
diff changeset
    10
            <label>Wiimote Test</label>
72d14a74c643 Added wiimote input example using python-cwiid and python PLC global variable access
Edouard Tisserant
parents:
diff changeset
    11
            <object class="sizeritem">
72d14a74c643 Added wiimote input example using python-cwiid and python PLC global variable access
Edouard Tisserant
parents:
diff changeset
    12
                <flag>wxEXPAND</flag>
72d14a74c643 Added wiimote input example using python-cwiid and python PLC global variable access
Edouard Tisserant
parents:
diff changeset
    13
                <border>0</border>
72d14a74c643 Added wiimote input example using python-cwiid and python PLC global variable access
Edouard Tisserant
parents:
diff changeset
    14
                <option>0</option>
72d14a74c643 Added wiimote input example using python-cwiid and python PLC global variable access
Edouard Tisserant
parents:
diff changeset
    15
                <object class="wxButton" name="button_1" base="EditButton">
72d14a74c643 Added wiimote input example using python-cwiid and python PLC global variable access
Edouard Tisserant
parents:
diff changeset
    16
                    <label>Connect Wiimote</label>
72d14a74c643 Added wiimote input example using python-cwiid and python PLC global variable access
Edouard Tisserant
parents:
diff changeset
    17
                    <events>
72d14a74c643 Added wiimote input example using python-cwiid and python PLC global variable access
Edouard Tisserant
parents:
diff changeset
    18
                        <handler event="EVT_BUTTON">OnConnectButton</handler>
72d14a74c643 Added wiimote input example using python-cwiid and python PLC global variable access
Edouard Tisserant
parents:
diff changeset
    19
                    </events>
72d14a74c643 Added wiimote input example using python-cwiid and python PLC global variable access
Edouard Tisserant
parents:
diff changeset
    20
                </object>
72d14a74c643 Added wiimote input example using python-cwiid and python PLC global variable access
Edouard Tisserant
parents:
diff changeset
    21
            </object>
72d14a74c643 Added wiimote input example using python-cwiid and python PLC global variable access
Edouard Tisserant
parents:
diff changeset
    22
            <object class="sizeritem">
72d14a74c643 Added wiimote input example using python-cwiid and python PLC global variable access
Edouard Tisserant
parents:
diff changeset
    23
                <flag>wxEXPAND</flag>
72d14a74c643 Added wiimote input example using python-cwiid and python PLC global variable access
Edouard Tisserant
parents:
diff changeset
    24
                <border>0</border>
72d14a74c643 Added wiimote input example using python-cwiid and python PLC global variable access
Edouard Tisserant
parents:
diff changeset
    25
                <option>0</option>
72d14a74c643 Added wiimote input example using python-cwiid and python PLC global variable access
Edouard Tisserant
parents:
diff changeset
    26
                <object class="wxButton" name="button_2" base="EditButton">
72d14a74c643 Added wiimote input example using python-cwiid and python PLC global variable access
Edouard Tisserant
parents:
diff changeset
    27
                    <label>Disconnect Wiimote</label>
72d14a74c643 Added wiimote input example using python-cwiid and python PLC global variable access
Edouard Tisserant
parents:
diff changeset
    28
                    <events>
72d14a74c643 Added wiimote input example using python-cwiid and python PLC global variable access
Edouard Tisserant
parents:
diff changeset
    29
                        <handler event="EVT_BUTTON">OnDisconnectButton</handler>
72d14a74c643 Added wiimote input example using python-cwiid and python PLC global variable access
Edouard Tisserant
parents:
diff changeset
    30
                    </events>
72d14a74c643 Added wiimote input example using python-cwiid and python PLC global variable access
Edouard Tisserant
parents:
diff changeset
    31
                </object>
72d14a74c643 Added wiimote input example using python-cwiid and python PLC global variable access
Edouard Tisserant
parents:
diff changeset
    32
            </object>
72d14a74c643 Added wiimote input example using python-cwiid and python PLC global variable access
Edouard Tisserant
parents:
diff changeset
    33
            <object class="sizeritem">
72d14a74c643 Added wiimote input example using python-cwiid and python PLC global variable access
Edouard Tisserant
parents:
diff changeset
    34
                <flag>wxEXPAND</flag>
72d14a74c643 Added wiimote input example using python-cwiid and python PLC global variable access
Edouard Tisserant
parents:
diff changeset
    35
                <border>0</border>
72d14a74c643 Added wiimote input example using python-cwiid and python PLC global variable access
Edouard Tisserant
parents:
diff changeset
    36
                <option>0</option>
72d14a74c643 Added wiimote input example using python-cwiid and python PLC global variable access
Edouard Tisserant
parents:
diff changeset
    37
                <object class="wxStaticText" name="label_1" base="EditStaticText">
72d14a74c643 Added wiimote input example using python-cwiid and python PLC global variable access
Edouard Tisserant
parents:
diff changeset
    38
                    <attribute>1</attribute>
72d14a74c643 Added wiimote input example using python-cwiid and python PLC global variable access
Edouard Tisserant
parents:
diff changeset
    39
                    <label>Status :</label>
72d14a74c643 Added wiimote input example using python-cwiid and python PLC global variable access
Edouard Tisserant
parents:
diff changeset
    40
                </object>
72d14a74c643 Added wiimote input example using python-cwiid and python PLC global variable access
Edouard Tisserant
parents:
diff changeset
    41
            </object>
72d14a74c643 Added wiimote input example using python-cwiid and python PLC global variable access
Edouard Tisserant
parents:
diff changeset
    42
            <object class="sizeritem">
72d14a74c643 Added wiimote input example using python-cwiid and python PLC global variable access
Edouard Tisserant
parents:
diff changeset
    43
                <flag>wxEXPAND</flag>
72d14a74c643 Added wiimote input example using python-cwiid and python PLC global variable access
Edouard Tisserant
parents:
diff changeset
    44
                <border>0</border>
72d14a74c643 Added wiimote input example using python-cwiid and python PLC global variable access
Edouard Tisserant
parents:
diff changeset
    45
                <option>0</option>
72d14a74c643 Added wiimote input example using python-cwiid and python PLC global variable access
Edouard Tisserant
parents:
diff changeset
    46
                <object class="wxStaticText" name="label_2" base="EditStaticText">
72d14a74c643 Added wiimote input example using python-cwiid and python PLC global variable access
Edouard Tisserant
parents:
diff changeset
    47
                    <attribute>1</attribute>
72d14a74c643 Added wiimote input example using python-cwiid and python PLC global variable access
Edouard Tisserant
parents:
diff changeset
    48
                    <label>no status</label>
72d14a74c643 Added wiimote input example using python-cwiid and python PLC global variable access
Edouard Tisserant
parents:
diff changeset
    49
                </object>
72d14a74c643 Added wiimote input example using python-cwiid and python PLC global variable access
Edouard Tisserant
parents:
diff changeset
    50
            </object>
72d14a74c643 Added wiimote input example using python-cwiid and python PLC global variable access
Edouard Tisserant
parents:
diff changeset
    51
        </object>
72d14a74c643 Added wiimote input example using python-cwiid and python PLC global variable access
Edouard Tisserant
parents:
diff changeset
    52
    </object>
72d14a74c643 Added wiimote input example using python-cwiid and python PLC global variable access
Edouard Tisserant
parents:
diff changeset
    53
</application>