Added support for wxglade GUIs.
authoretisserant
Sat, 17 Jan 2009 02:36:46 +0100
changeset 301 87c925eaaa3a
parent 300 7f7912ae5ee8
child 302 d962b3d503b5
Added support for wxglade GUIs.
Beremiz_service.py
images/editWXGLADE.png
images/icons.svg
plugger.py
runtime/PLCObject.py
tests/linux/python_cwiid/hmi.wxg
tests/linux/python_cwiid/plc.xml
tests/linux/python_cwiid/runtime.py
--- a/Beremiz_service.py	Sat Jan 17 02:34:45 2009 +0100
+++ b/Beremiz_service.py	Sat Jan 17 02:36:46 2009 +0100
@@ -38,7 +38,7 @@
 """%sys.argv[0]
 
 try:
-    opts, args = getopt.getopt(sys.argv[1:], "i:p:n:x:h")
+    opts, argv = getopt.getopt(sys.argv[1:], "i:p:n:x:h")
 except getopt.GetoptError, err:
     # print help information and exit:
     print str(err) # will print something like "option -a not recognized"
@@ -73,14 +73,14 @@
         usage()
         sys.exit()
 
-if len(args) > 1:
+if len(argv) > 1:
     usage()
     sys.exit()
-elif len(args) == 1:
-    WorkingDir = args[0]
-elif len(args) == 0:
+elif len(argv) == 1:
+    WorkingDir = argv[0]
+elif len(argv) == 0:
     WorkingDir = os.getcwd()
-    args=[WorkingDir]
+    argv=[WorkingDir]
 
 if enablewx:
     try:
@@ -351,20 +351,20 @@
     os.mkdir(WorkingDir)
 
 class Server():
-    def __init__(self, name, ip, port, workdir, args):
+    def __init__(self, name, ip, port, workdir, argv, statuschange=None, evaluator=eval):
         self.continueloop = True
         self.daemon = None
         self.name = name
         self.ip = ip
         self.port = port
         self.workdir = workdir
-        self.args = args
+        self.argv = argv
         self.plcobj = None
         self.servicepublisher = None
-        self.statuschange = None
-    
-    def Loop(self, statuschange=None):
         self.statuschange = statuschange
+        self.evaluator = evaluator
+    
+    def Loop(self):
         while self.continueloop:
             self.Start()
         
@@ -378,7 +378,7 @@
     def Start(self):
         pyro.initServer()
         self.daemon=pyro.Daemon(host=self.ip, port=self.port)
-        self.plcobj = PLCObject(self.workdir, self.daemon, self.args, self.statuschange)
+        self.plcobj = PLCObject(self.workdir, self.daemon, self.argv, self.statuschange, self.evaluator)
         uri = self.daemon.connect(self.plcobj,"PLCObject")
     
         print "The daemon runs on port :",self.port
@@ -402,15 +402,32 @@
             del self.servicepublisher
         self.daemon.shutdown(True)
         
-pyroserver = Server(name, ip, port, WorkingDir, args)
 
 if havewx:
+    from threading import Semaphore
+    wx_eval_lock = Semaphore(0)
     app=wx.App(redirect=False)
-    taskbar_instance = BeremizTaskBarIcon(pyroserver)
     def statuschange(status):
         wx.CallAfter(taskbar_instance.UpdateIcon,status)
-    pyro_thread=Thread(target=pyroserver.Loop, args=[statuschange])
+        
+    eval_res = None
+    def wx_evaluator(callable, *args, **kwargs):
+        global eval_res
+        eval_res=callable(*args,**kwargs)
+        #print eval_res
+        wx_eval_lock.release()
+        
+    def evaluator(callable, *args, **kwargs):
+        wx.CallAfter(wx_evaluator,callable,*args,**kwargs)
+        wx_eval_lock.acquire()
+        return eval_res
+
+    pyroserver = Server(name, ip, port, WorkingDir, argv, statuschange, evaluator)
+    taskbar_instance = BeremizTaskBarIcon(pyroserver)
+    
+    pyro_thread=Thread(target=pyroserver.Loop)
     pyro_thread.start()
     app.MainLoop()
 else:
+    pyroserver = Server(name, ip, port, WorkingDir, argv)
     pyroserver.Loop()
Binary file images/editWXGLADE.png has changed
--- a/images/icons.svg	Sat Jan 17 02:34:45 2009 +0100
+++ b/images/icons.svg	Sat Jan 17 02:36:46 2009 +0100
@@ -41,9 +41,9 @@
      pagecolor="#ffffff"
      id="base"
      showgrid="false"
-     inkscape:zoom="5.656854"
-     inkscape:cx="241.82787"
-     inkscape:cy="888.09651"
+     inkscape:zoom="1.9999999"
+     inkscape:cx="389.62633"
+     inkscape:cy="954.22679"
      inkscape:window-x="0"
      inkscape:window-y="25"
      inkscape:current-layer="svg2"
@@ -82634,7 +82634,7 @@
        y2="144.96741"
        gradientUnits="userSpaceOnUse"
        spreadMethod="reflect"
-       gradientTransform="translate(170,0)" />
+       gradientTransform="translate(230,0)" />
     <linearGradient
        inkscape:collect="always"
        xlink:href="#linearGradient17526"
@@ -82645,7 +82645,7 @@
        y2="144.96741"
        gradientUnits="userSpaceOnUse"
        spreadMethod="reflect"
-       gradientTransform="translate(170,0)" />
+       gradientTransform="translate(230,0)" />
     <linearGradient
        inkscape:collect="always"
        xlink:href="#linearGradient17526"
@@ -82656,7 +82656,7 @@
        y2="144.96741"
        gradientUnits="userSpaceOnUse"
        spreadMethod="reflect"
-       gradientTransform="translate(170,0)" />
+       gradientTransform="translate(230,0)" />
     <linearGradient
        inkscape:collect="always"
        xlink:href="#linearGradient17526"
@@ -82667,7 +82667,7 @@
        y1="137.36218"
        x2="335"
        y2="144.96741"
-       gradientTransform="translate(110,0)" />
+       gradientTransform="translate(170,0)" />
     <linearGradient
        inkscape:collect="always"
        xlink:href="#linearGradient17546"
@@ -82853,6 +82853,162 @@
        y1="221.98289"
        x2="46.488174"
        y2="259.94464" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient34137"
+       id="linearGradient16574"
+       gradientUnits="userSpaceOnUse"
+       x1="-77.844841"
+       y1="5.1423945"
+       x2="-77.844841"
+       y2="14.276564" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient34137"
+       id="linearGradient16576"
+       gradientUnits="userSpaceOnUse"
+       x1="-77.844841"
+       y1="5.1423945"
+       x2="-77.844841"
+       y2="14.276564" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient1908"
+       id="linearGradient16578"
+       gradientUnits="userSpaceOnUse"
+       x1="-84.232422"
+       y1="10.337565"
+       x2="-71.603516"
+       y2="10.337565" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient34137"
+       id="linearGradient16580"
+       gradientUnits="userSpaceOnUse"
+       x1="-77.844841"
+       y1="5.1423945"
+       x2="-77.844841"
+       y2="14.276564" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient34137"
+       id="linearGradient16582"
+       gradientUnits="userSpaceOnUse"
+       x1="-77.844841"
+       y1="5.1423945"
+       x2="-77.844841"
+       y2="14.276564" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3256"
+       id="linearGradient16584"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="scale(1.044357,0.957527)"
+       x1="591.27606"
+       y1="330.16998"
+       x2="620.33301"
+       y2="382.54678" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient5083"
+       id="linearGradient16586"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="matrix(0.1929605,-4.2624229e-3,5.8523266e-3,0.1786386,680.44209,227.41631)"
+       x1="566.74347"
+       y1="415.15009"
+       x2="588.13922"
+       y2="458.04449" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient2345"
+       id="linearGradient16588"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="matrix(-8.3139607e-2,-3.7222758e-2,-3.2434452e-2,9.3494299e-2,693.52705,270.28905)"
+       x1="100.76616"
+       y1="77.379333"
+       x2="125.25793"
+       y2="77.379333" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient1930"
+       id="linearGradient16590"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="matrix(-7.8190371e-2,-3.5007179e-2,-3.4487422e-2,9.9412027e-2,684.96091,272.7873)"
+       x1="10.145814"
+       y1="21.762129"
+       x2="19.678274"
+       y2="15.811033" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient2355"
+       id="linearGradient16592"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="matrix(-9.5227098e-3,-1.5294307e-3,-0.8372982,1.5053504,699.75234,263.84813)"
+       x1="1270.3132"
+       y1="4.8765283"
+       x2="1247.6848"
+       y2="0.72310239" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient3970"
+       id="linearGradient16594"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="matrix(0.2028254,-4.4803884e-3,5.5677069e-3,0.1699505,680.44209,227.41631)"
+       x1="-94.151642"
+       y1="379.97745"
+       x2="-100.40970"
+       y2="374.03232" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient2560"
+       id="linearGradient16597"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="matrix(-0.1217387,-1.9552238e-2,-6.5495488e-2,0.1177522,699.8779,263.8683)"
+       spreadMethod="reflect"
+       x1="97.345161"
+       y1="112.84396"
+       x2="99.206970"
+       y2="115.81121" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient2560"
+       id="linearGradient16599"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="matrix(0.1839072,-4.062449e-3,6.1404966e-3,0.1874324,680.55604,227.23529)"
+       x1="-13.150850"
+       y1="250.48668"
+       x2="-5.5906620"
+       y2="258.31036" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient1884"
+       id="linearGradient16601"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="matrix(-8.7438501e-2,-1.4043452e-2,-9.118816e-2,0.1639442,699.8779,263.8683)"
+       x1="240.97612"
+       y1="200.61511"
+       x2="231.89941"
+       y2="205.45764" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient1884"
+       id="linearGradient16603"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="matrix(0.2064601,-4.5604396e-3,5.0398802e-3,0.1538412,680.41644,232.74127)"
+       x1="7.1050277"
+       y1="221.98289"
+       x2="46.488174"
+       y2="259.94464" />
+    <linearGradient
+       inkscape:collect="always"
+       xlink:href="#linearGradient1884"
+       id="linearGradient16605"
+       gradientUnits="userSpaceOnUse"
+       gradientTransform="matrix(0.2064601,-4.5604396e-3,5.0398802e-3,0.1538412,682.71501,230.6378)"
+       x1="7.1050277"
+       y1="221.98289"
+       x2="46.488174"
+       y2="259.94464" />
   </defs>
   <g
      id="g19063"
@@ -85408,7 +85564,7 @@
        transform="matrix(0.5324675,0,0,0.5324675,-889.75288,329.57107)" />
   </g>
   <text
-     x="113.29593"
+     x="73.295929"
      y="121.52582"
      id="text16266"
      xml:space="preserve"
@@ -85416,8 +85572,8 @@
      sodipodi:linespacing="125%"><tspan
        sodipodi:role="line"
        id="tspan16268"
-       x="113.29593"
-       y="121.52582">%% editIECrawcode editPYTHONcode EditCfile Transfer Connect Disconnect Debug %%</tspan></text>
+       x="73.295929"
+       y="121.52582">%% editIECrawcode editWXGLADE editPYTHONcode EditCfile Transfer Connect Disconnect Debug %%</tspan></text>
   <rect
      width="24"
      height="24"
@@ -85641,11 +85797,11 @@
      style="fill:#000000;fill-opacity:0;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:square;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
      id="EditCfile"
      y="131.36218"
-     x="370"
+     x="430"
      height="24"
      width="24" />
   <g
-     transform="translate(-290.13257,-140)"
+     transform="translate(-230.13257,-140)"
      id="g20864">
     <flowRoot
        style="font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:url(#linearGradient20956);fill-opacity:1;stroke:#547c1b;stroke-width:0.1061436;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;font-family:Andale Mono"
@@ -85866,7 +86022,7 @@
   <rect
      width="24"
      height="24"
-     x="430"
+     x="490"
      y="131.36218"
      id="Transfer"
      style="fill:#000000;fill-opacity:0;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:square;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
@@ -85876,32 +86032,32 @@
      style="fill:#000000;fill-opacity:0;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:square;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
      id="Connect"
      y="131.36218"
-     x="490"
+     x="550"
      height="24"
      width="24" />
   <rect
      width="24"
      height="24"
-     x="550"
+     x="610"
      y="131.36218"
      id="Disconnect"
      style="fill:#000000;fill-opacity:0;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:square;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
      inkscape:label="#rect16270" />
   <path
      style="opacity:1;fill:url(#linearGradient17534);fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.1;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:8.59499931;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
-     d="M 502,137.40625 C 498.95578,137.61016 496.40951,139.60837 495.4375,142.375 L 490,142.375 L 490,147.375 L 495.4375,147.375 C 496.41696,150.12787 498.96436,152.1385 502,152.34375 L 502,137.40625 z M 503,137.40625 L 503,152.34375 C 506.03564,152.1385 508.58304,150.12787 509.5625,147.375 L 514,147.375 L 514,142.375 L 509.5625,142.375 C 508.59049,139.60837 506.04422,137.61016 503,137.40625 z"
+     d="M 562,137.40625 C 558.95578,137.61016 556.40951,139.60837 555.4375,142.375 L 550,142.375 L 550,147.375 L 555.4375,147.375 C 556.41696,150.12787 558.96436,152.1385 562,152.34375 L 562,137.40625 z M 563,137.40625 L 563,152.34375 C 566.03564,152.1385 568.58304,150.12787 569.5625,147.375 L 574,147.375 L 574,142.375 L 569.5625,142.375 C 568.59049,139.60837 566.04422,137.61016 563,137.40625 z"
      id="path16742" />
   <path
      style="opacity:1;fill:url(#linearGradient17532);fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.1;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:8.59499931;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
-     d="M 558,137.40625 C 554.95578,137.61016 552.40951,139.60837 551.4375,142.375 L 546,142.375 L 546,147.375 L 551.4375,147.375 C 552.41696,150.12787 554.96436,152.1385 558,152.34375 L 558,137.40625 z"
+     d="M 618,137.40625 C 614.95578,137.61016 612.40951,139.60837 611.4375,142.375 L 606,142.375 L 606,147.375 L 611.4375,147.375 C 612.41696,150.12787 614.96436,152.1385 618,152.34375 L 618,137.40625 z"
      id="path16754" />
   <path
      style="opacity:1;fill:url(#linearGradient17536);fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.1;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:8.59499931;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
-     d="M 566,137.42468 L 566,152.36218 C 569.03564,152.15693 571.58304,150.1463 572.5625,147.39343 L 577,147.39343 L 577,142.39343 L 572.5625,142.39343 C 571.59049,139.6268 569.04422,137.62859 566,137.42468 z"
+     d="M 626,137.42468 L 626,152.36218 C 629.03564,152.15693 631.58304,150.1463 632.5625,147.39343 L 637,147.39343 L 637,142.39343 L 632.5625,142.39343 C 631.59049,139.6268 629.04422,137.62859 626,137.42468 z"
      id="path16750" />
   <path
      id="path17538"
-     d="M 442,137.40625 C 438.95578,137.61016 436.40951,139.60837 435.4375,142.375 L 430,142.375 L 430,147.375 L 435.4375,147.375 C 436.41696,150.12787 438.96436,152.1385 442,152.34375 L 442,137.40625 z M 443,137.40625 L 443,152.34375 C 446.03564,152.1385 448.58304,150.12787 449.5625,147.375 L 454,147.375 L 454,142.375 L 449.5625,142.375 C 448.59049,139.60837 446.04422,137.61016 443,137.40625 z"
+     d="M 502,137.40625 C 498.95578,137.61016 496.40951,139.60837 495.4375,142.375 L 490,142.375 L 490,147.375 L 495.4375,147.375 C 496.41696,150.12787 498.96436,152.1385 502,152.34375 L 502,137.40625 z M 503,137.40625 L 503,152.34375 C 506.03564,152.1385 508.58304,150.12787 509.5625,147.375 L 514,147.375 L 514,142.375 L 509.5625,142.375 C 508.59049,139.60837 506.04422,137.61016 503,137.40625 z"
      style="opacity:1;fill:url(#linearGradient17540);fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.1;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:8.59499931;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
   <path
      sodipodi:type="star"
@@ -85918,18 +86074,18 @@
      inkscape:rounded="0"
      inkscape:randomized="0"
      d="M 332,150 L 327.11751,141.54327 L 336.88249,141.54327 L 332,150 z"
-     transform="matrix(1.1031299,0.6368924,-0.6368924,1.1031299,168.02287,-226.14748)" />
+     transform="matrix(1.1031299,0.6368924,-0.6368924,1.1031299,228.02287,-226.14748)" />
   <rect
      inkscape:label="#rect16270"
      style="fill:#000000;fill-opacity:0;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:square;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
      id="Debug"
      y="131.36218"
-     x="610"
+     x="670"
      height="24"
      width="24" />
   <path
      style="opacity:1;fill:#160379;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
-     d="M 624.14211,134.18201 L 623.44846,134.37119 L 624.09481,136.75167 C 623.55664,136.88976 623.034,137.15037 622.61293,137.57144 C 622.58031,137.60404 622.56503,137.64813 622.53409,137.68179 C 621.78169,137.61864 621.00589,137.70771 620.24821,137.94979 L 619.60186,135.53777 L 618.90819,135.72696 L 619.5861,138.20203 C 618.90904,138.50465 618.25523,138.92751 617.67856,139.47899 L 615.51876,138.13898 L 615.15618,138.7538 L 617.18983,139.99922 C 616.46851,140.85118 615.98679,141.84216 615.771,142.83687 L 613.56394,142.23781 L 613.37475,142.93146 L 615.67641,143.56206 C 615.54986,144.9582 615.92466,146.33767 616.82724,147.39291 L 624.37857,139.84157 L 624.88305,140.34605 L 617.33172,147.89738 C 618.2984,148.72357 619.54404,149.1165 620.81574,149.07974 L 621.28869,150.84539 L 621.98234,150.65621 L 621.54092,149.01668 C 622.59832,148.85042 623.66579,148.38127 624.58351,147.64515 L 625.46634,149.06397 L 626.08117,148.70138 L 625.13529,147.15642 C 625.82639,146.46532 626.32697,145.65819 626.64871,144.82323 L 628.49319,145.31195 L 628.68237,144.6183 L 626.86941,144.1296 C 627.03506,143.48333 627.09629,142.82751 627.04282,142.19052 C 627.07648,142.15959 627.12057,142.14431 627.15319,142.11171 C 627.57426,141.69063 627.83486,141.16798 627.97296,140.6298 L 630.35344,141.27617 L 630.54262,140.58251 L 628.08331,139.92038 C 628.10481,139.07152 627.80055,138.21881 627.15319,137.57144 C 626.50581,136.92407 625.6531,136.61982 624.80424,136.64131 L 624.14211,134.18201 z"
+     d="M 684.14211,134.18201 L 683.44846,134.37119 L 684.09481,136.75167 C 683.55664,136.88976 683.034,137.15037 682.61293,137.57144 C 682.58031,137.60404 682.56503,137.64813 682.53409,137.68179 C 681.78169,137.61864 681.00589,137.70771 680.24821,137.94979 L 679.60186,135.53777 L 678.90819,135.72696 L 679.5861,138.20203 C 678.90904,138.50465 678.25523,138.92751 677.67856,139.47899 L 675.51876,138.13898 L 675.15618,138.7538 L 677.18983,139.99922 C 676.46851,140.85118 675.98679,141.84216 675.771,142.83687 L 673.56394,142.23781 L 673.37475,142.93146 L 675.67641,143.56206 C 675.54986,144.9582 675.92466,146.33767 676.82724,147.39291 L 684.37857,139.84157 L 684.88305,140.34605 L 677.33172,147.89738 C 678.2984,148.72357 679.54404,149.1165 680.81574,149.07974 L 681.28869,150.84539 L 681.98234,150.65621 L 681.54092,149.01668 C 682.59832,148.85042 683.66579,148.38127 684.58351,147.64515 L 685.46634,149.06397 L 686.08117,148.70138 L 685.13529,147.15642 C 685.82639,146.46532 686.32697,145.65819 686.64871,144.82323 L 688.49319,145.31195 L 688.68237,144.6183 L 686.86941,144.1296 C 687.03506,143.48333 687.09629,142.82751 687.04282,142.19052 C 687.07648,142.15959 687.12057,142.14431 687.15319,142.11171 C 687.57426,141.69063 687.83486,141.16798 687.97296,140.6298 L 690.35344,141.27617 L 690.54262,140.58251 L 688.08331,139.92038 C 688.10481,139.07152 687.80055,138.21881 687.15319,137.57144 C 686.50581,136.92407 685.6531,136.61982 684.80424,136.64131 L 684.14211,134.18201 z"
      id="path16411" />
   <rect
      style="fill:none;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:10.43299961;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
@@ -85982,11 +86138,11 @@
      style="fill:#000000;fill-opacity:0;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:square;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
      id="editPYTHONcode"
      y="131.36218"
-     x="270"
+     x="330"
      height="24"
      width="24" />
   <g
-     transform="translate(-390.13257,-140)"
+     transform="translate(-330.13257,-140)"
      id="g16441">
     <flowRoot
        style="font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:url(#linearGradient16533);fill-opacity:1;stroke:#547c1b;stroke-width:0.1061436;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;font-family:Andale Mono"
@@ -86195,4 +86351,222 @@
        d="M 683.74504,273.49232 C 682.52118,272.4238 682.05427,273.42101 681.27718,274.09784 C 681.11122,273.95433 680.94525,273.81082 680.77929,273.66732 C 681.36055,272.97034 681.65306,272.60698 682.5725,272.17027 C 682.75266,272.27845 683.47211,273.29694 683.74504,273.49232 z"
        style="fill:url(#linearGradient16555);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.25pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
   </g>
+  <rect
+     width="24"
+     height="24"
+     x="240"
+     y="131.36218"
+     id="editWXGLADE"
+     style="fill:#000000;fill-opacity:0;fill-rule:evenodd;stroke:none;stroke-width:1;stroke-linecap:square;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+     inkscape:label="#rect16270" />
+  <g
+     id="g16490"
+     transform="translate(-420.13257,-140)">
+    <flowRoot
+       transform="matrix(1.6473499,0,0,1.6473499,800.92342,263.57576)"
+       id="flowRoot16492"
+       xml:space="preserve"
+       style="font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:url(#linearGradient16582);fill-opacity:1;stroke:#547c1b;stroke-width:0.1061436;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;font-family:Andale Mono"><flowRegion
+         id="flowRegion16494"
+         style="fill:url(#linearGradient16576);fill-opacity:1;stroke:url(#linearGradient16578)"><rect
+           width="382.57648"
+           height="232.12506"
+           x="-85.494621"
+           y="2.3818817"
+           id="rect16496"
+           style="font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:url(#linearGradient16574);fill-opacity:1;stroke:#547c1b;stroke-width:0.1061436;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;font-family:Andale Mono" /></flowRegion><flowPara
+         id="flowPara16498"
+         style="fill:url(#linearGradient16580);fill-opacity:1;stroke:#547c1b;stroke-width:0.1061436;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1">Wx</flowPara></flowRoot>    <g
+       id="g16500"
+       transform="matrix(0.181771,-4.0153553e-3,5.9117061e-3,0.1804431,680.18691,229.08403)"
+       style="fill:#7f755d;fill-opacity:1">
+      <path
+         style="fill-rule:evenodd;stroke:none;stroke-width:0.25pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+         d="M 1.4170205,261.85309 L 9.1864055,255.27395 C 9.9518515,254.21564 11.377875,252.55111 10.711989,250.47625 C 10.0461,248.4014 5.4846525,241.65013 3.1398275,240.697 C 1.7535525,239.78864 0.71840855,240.54988 -0.39798145,241.67613 L -8.3708247,248.81583 L 1.4170205,261.85309 z"
+         id="path16502"
+         sodipodi:nodetypes="ccccccc" />
+      <path
+         style="fill-rule:evenodd;stroke:url(#linearGradient16584);stroke-width:0.12755789pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+         d="M 6.3306155,244.87972 C 6.3306155,244.87972 3.7145895,242.19726 2.5681985,241.86603 C 1.4218075,241.53479 -0.21785545,242.50228 -0.21785545,242.50228 L -9.1679878,250.90814 L -4.2239471,254.16031 L 6.3306155,244.87972 z"
+         id="path16504"
+         sodipodi:nodetypes="cccccc" />
+      <path
+         style="fill-rule:evenodd;stroke:none;stroke-width:0.25pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+         d="M 1.1712645,261.24893 L 9.7300545,253.87341 C 10.495502,252.8151 10.517969,252.27744 9.8520825,250.20259 C 9.1862035,248.12772 7.5403915,246.24034 6.6758715,245.16696 C 5.8113565,244.0936 5.7408825,244.27913 5.7408825,244.27913 L -4.2206337,252.95532 L 1.1712645,261.24893 z"
+         id="path16506"
+         sodipodi:nodetypes="ccccccc" />
+      <path
+         style="fill-rule:evenodd;stroke:#7f755d;stroke-width:0.25pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+         d="M 175.51025,216.82807 L 197.46364,233.74298 L 204.12164,231.58363 L 202.16407,207.12378 L 197.10375,199.73321 L 172.81106,211.0698 L 175.51025,216.82807 z"
+         id="path16508"
+         sodipodi:nodetypes="ccccccc"
+         transform="matrix(-0.538066,-9.955063e-2,-0.448862,0.758281,97.82153,199.2334)" />
+      <path
+         style="fill-rule:evenodd;stroke:none;stroke-width:0.25pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+         d="M -116.9537,358.31756 L -100.70034,336.46939 L -91.069768,343.09529 L -116.9537,358.31756 z"
+         id="path16510"
+         sodipodi:nodetypes="cccc" />
+      <path
+         style="fill-rule:evenodd;stroke:none;stroke-width:0.25pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+         d="M 107.78757,107.46646 L 173.65809,214.67963 L 181.21581,210.00104 L 114.26562,101.7082 L 107.78757,107.46646 z"
+         id="path16512"
+         sodipodi:nodetypes="ccccc"
+         transform="matrix(-0.538066,-9.955063e-2,-0.448862,0.758281,97.82153,199.2334)" />
+      <path
+         style="fill-rule:evenodd;stroke:none;stroke-width:0.25pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+         d="M -14.598686,260.57822 L -99.704366,337.78772 L -103.54647,335.69094 L -19.451374,259.12046 L -14.598686,260.57822 z"
+         id="path16514"
+         sodipodi:nodetypes="ccccc" />
+      <path
+         style="fill-rule:evenodd;stroke:none;stroke-width:0.25pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+         d="M 125.60221,97.389495 L 191.64176,204.28456 L 198.48463,201.62144 L 133.87972,96.129874 L 125.60221,97.389495 z"
+         id="path16516"
+         sodipodi:nodetypes="ccccc"
+         transform="matrix(-0.538066,-9.955063e-2,-0.448862,0.758281,97.82153,199.2334)" />
+      <path
+         style="fill-rule:evenodd;stroke:none;stroke-width:0.25pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+         d="M -9.830588,265.49155 L -93.94093,340.37129 L -96.53602,334.59238 L -13.039235,260.2047 L -9.830588,265.49155 z"
+         id="path16518"
+         sodipodi:nodetypes="ccccc" />
+      <path
+         style="fill-rule:evenodd;stroke:none;stroke-width:0.25pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+         d="M 110.00338,110.582 C 111.27578,110.83648 116.12154,105.36357 123.67926,102.84433 C 131.23699,100.32508 135.49923,99.188954 136.39896,97.929333 C 137.29869,96.669712 136.43925,93.695085 133.33988,93.430686 C 130.09271,93.15368 135.3148,88.032086 131.72037,87.852364 C 128.12145,87.672418 131.36048,82.453989 128.12145,82.81388 C 124.5267,83.213296 119.12416,83.893555 113.18594,86.412797 C 107.24773,88.932039 99.510061,93.970524 99.15017,94.690307 C 98.790278,95.410091 98.25044,98.46917 100.94963,99.548845 C 103.64882,100.62852 100.76968,102.78787 104.18865,104.58733 C 107.60763,106.38679 104.42506,111.48173 110.00338,110.582 z"
+         id="path16520"
+         sodipodi:nodetypes="ccccccccccc"
+         transform="matrix(-0.538066,-9.955063e-2,-0.448862,0.758281,97.82153,199.2334)" />
+      <path
+         style="fill-rule:evenodd;stroke:none;stroke-width:0.25pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+         d="M 173.64877,214.66374 L 181.08857,209.83267 C 181.08857,209.83267 182.77556,212.86926 183.04548,215.20855 C 183.28072,217.24734 184.08017,219.45977 182.48315,220.29203 C 181.09241,221.01677 180.07638,220.60693 178.97421,219.75219 C 177.87204,218.89745 175.55524,217.053 175.12786,216.53566 C 174.70049,216.01831 173.64877,214.66374 173.64877,214.66374 z"
+         id="path16522"
+         sodipodi:nodetypes="ccccccc"
+         transform="matrix(-0.538066,-9.955063e-2,-0.448862,0.758281,97.82153,199.2334)" />
+      <path
+         style="fill-rule:evenodd;stroke:none;stroke-width:0.25pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+         d="M -93.801751,340.32522 C -93.801751,340.32522 -97.897663,343.71564 -98.99638,344.28849 C -100.09509,344.86133 -102.91776,345.59134 -103.2362,344.8422 C -103.56274,344.07396 -102.24889,341.85896 -101.59629,340.7565 C -100.93948,339.64693 -98.769705,336.94388 -98.438557,336.57695 C -98.107409,336.21001 -96.443231,334.61775 -96.443231,334.61775 L -93.801751,340.32522 z"
+         id="path16524"
+         sodipodi:nodetypes="ccccccc" />
+      <path
+         style="fill-rule:evenodd;stroke:none;stroke-width:0.25pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+         d="M -96.344601,334.49624 C -97.169892,335.48224 -100.50622,339.12061 -102.33175,339.75455 C -103.19302,340.24788 -104.44501,340.99506 -105.15067,340.98956 C -105.85633,340.98405 -106.624,341.40064 -105.39353,339.47427 C -104.16306,337.54789 -103.63893,336.36627 -101.6981,334.46589 C -100.12383,332.67006 -97.928213,331.13259 -97.928213,331.13259 L -96.344601,334.49624 z"
+         id="path16526"
+         sodipodi:nodetypes="ccccccc" />
+      <path
+         style="fill-rule:evenodd;stroke:#000000;stroke-width:0.25pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+         d="M 197.2837,233.653 L 205.02137,239.50124 L 204.12164,231.13376 C 204.12164,231.13376 202.27339,227.63345 201.87232,228.97441 C 201.06256,231.6736 200.61523,232.01892 198.2734,230.68389 C 195.89613,229.32869 197.2837,233.653 197.2837,233.653 z"
+         id="path16528"
+         sodipodi:nodetypes="cccccc"
+         transform="matrix(-0.538066,-9.955063e-2,-0.448862,0.758281,97.82153,199.2334)" />
+      <path
+         style="opacity:0.66134183;fill-rule:evenodd;stroke:none;stroke-width:0.25pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+         d="M -20.117505,259.67677 C -15.463433,263.36921 -13.650268,263.31164 -10.473468,272.34499 C -5.0278431,265.96965 -1.9685818,264.70796 2.2270432,261.0599 C -0.5195352,255.66293 -2.6979317,251.97049 -8.2854192,249.07351 C -12.115812,253.63066 -14.923476,255.68781 -20.117505,259.67677 z"
+         id="path16530"
+         sodipodi:nodetypes="ccccc" />
+      <path
+         style="fill-rule:evenodd;stroke:none;stroke-width:0.25pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+         d="M 197.2837,233.653 L 205.02137,239.50124 L 204.12164,231.13376 C 204.12164,231.13376 202.27339,227.63345 201.87232,228.97441 C 201.06256,231.6736 200.61523,232.01892 198.2734,230.68389 C 195.89613,229.32869 197.2837,233.653 197.2837,233.653 z"
+         id="path16532"
+         sodipodi:nodetypes="cccccc"
+         transform="matrix(-0.538066,-9.955063e-2,-0.448862,0.758281,97.82153,199.2334)" />
+      <path
+         style="fill-rule:evenodd;stroke:none;stroke-width:0.25pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+         d="M -3.0784244,252.19014 L -16.418882,263.36268 L -19.013169,260.9776 L -5.9198974,250.37251 L -3.0784244,252.19014 z"
+         id="path16534"
+         sodipodi:nodetypes="ccccc" />
+      <path
+         style="fill-rule:evenodd;stroke:none;stroke-width:0.25pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+         d="M 9.6173564,249.29743 C 3.2420641,243.37924 0.56301192,248.71048 -3.7231012,252.27396 C -4.5878635,251.47893 -5.4526259,250.68391 -6.3173882,249.88888 C -3.0779069,246.19314 -1.4454866,244.26517 3.5617617,242.01579 C 4.5089194,242.62167 8.1880805,248.20943 9.6173564,249.29743 z"
+         id="path16536"
+         sodipodi:nodetypes="ccccc" />
+    </g>
+    <path
+       style="fill:#ff7556;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.25pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+       d="M 682.29306,275.84865 L 683.70096,274.59964 C 683.83718,274.40072 684.09282,274.08695 683.95617,273.70587 C 683.81951,273.3248 682.9286,272.09472 682.48588,271.92805 C 682.22205,271.76573 682.03377,271.91081 681.83256,272.12374 L 680.39015,273.47727 L 682.29306,275.84865 z"
+       id="path16538"
+       sodipodi:nodetypes="ccccccc" />
+    <path
+       style="fill:url(#linearGradient16586);fill-opacity:1;fill-rule:evenodd;stroke:url(#linearGradient16588);stroke-width:0.02369117pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+       d="M 683.10581,272.68865 C 683.10581,272.68865 682.60207,272.20321 682.38644,272.14666 C 682.17081,272.0901 681.87114,272.27582 681.87114,272.27582 L 680.25428,273.8676 L 681.19528,274.44884 L 683.10581,272.68865 z"
+       id="path16540"
+       sodipodi:nodetypes="cccccc" />
+    <path
+       style="fill:url(#linearGradient16590);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.25pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+       d="M 682.2436,275.7379 L 683.79378,274.33833 C 683.93,274.13941 683.93093,274.03986 683.79427,273.65879 C 683.65761,273.27772 683.33949,272.93536 683.17189,272.74036 C 683.00428,272.54537 682.99228,272.57998 682.99228,272.57998 L 681.18859,274.22592 L 682.2436,275.7379 z"
+       id="path16542"
+       sodipodi:nodetypes="ccccccc" />
+    <path
+       style="fill:url(#linearGradient16592);fill-opacity:1;fill-rule:evenodd;stroke:#7f755d;stroke-width:0.0312406pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+       d="M 665.03485,291.8397 L 661.48338,293.88793 L 660.98249,293.47319 L 663.11342,290.02876 L 664.20805,289.06043 L 665.76229,291.06509 L 665.03485,291.8397 z"
+       id="path16544"
+       sodipodi:nodetypes="ccccccc" />
+    <path
+       style="fill:url(#linearGradient16594);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.25pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+       d="M 660.82006,294.1801 L 663.71636,290.07167 L 665.55111,291.2577 L 660.82006,294.1801 z"
+       id="path16546"
+       sodipodi:nodetypes="cccc" />
+    <path
+       style="fill:#d98100;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.25pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+       d="M 680.51064,277.3948 L 665.39151,291.56438 L 664.999,290.77704 L 680.31238,276.47151 L 680.51064,277.3948 z"
+       id="path16548"
+       sodipodi:nodetypes="ccccc" />
+    <path
+       style="fill:#eb9a00;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.25pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+       d="M 679.30091,275.67874 L 663.90994,290.31144 L 663.18128,289.93939 L 678.38781,275.42906 L 679.30091,275.67874 z"
+       id="path16550"
+       sodipodi:nodetypes="ccccc" />
+    <path
+       style="fill:#ffe07a;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.25pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+       d="M 679.51026,275.6741 L 664.39922,289.79573 L 663.9195,289.3064 L 678.77489,275.36099 L 679.51026,275.6741 z"
+       id="path16552"
+       sodipodi:nodetypes="ccccc" />
+    <path
+       style="fill:#f5a600;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.25pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+       d="M 680.21919,276.56799 L 664.99958,290.76563 L 664.48097,289.70732 L 679.58924,275.60323 L 680.21919,276.56799 z"
+       id="path16554"
+       sodipodi:nodetypes="ccccc" />
+    <path
+       style="fill:url(#linearGradient16597);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.25pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+       d="M 680.04086,277.80167 C 679.8924,277.81722 679.83623,276.96093 679.27303,276.48047 C 678.70984,276.00001 678.36972,275.7695 678.37853,275.57591 C 678.38735,275.38232 678.70917,274.9735 679.0427,274.98614 C 679.39214,274.99938 679.27024,274.18692 679.64701,274.21961 C 680.02425,274.25234 680.11004,273.45824 680.4083,273.56186 C 680.73933,273.67686 681.2305,273.86106 681.63034,274.31528 C 682.03018,274.76951 682.41239,275.61091 682.3918,275.71903 C 682.3712,275.82716 682.18384,276.27065 681.82623,276.38036 C 681.46863,276.49007 681.58835,276.84359 681.10124,277.04393 C 680.61413,277.24428 680.53241,278.01991 680.04086,277.80167 z"
+       id="path16556"
+       sodipodi:nodetypes="ccccccccccc" />
+    <path
+       style="fill:#d98100;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.25pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+       d="M 665.3937,291.56227 L 665.02514,290.75517 C 665.02514,290.75517 664.61494,291.15939 664.4028,291.48747 C 664.21792,291.7734 663.96239,292.07487 664.05769,292.21902 C 664.14069,292.34455 664.27557,292.30276 664.45431,292.19915 C 664.63304,292.09553 665.01254,291.87094 665.09654,291.80434 C 665.18054,291.73774 665.3937,291.56227 665.3937,291.56227 z"
+       id="path16558"
+       sodipodi:nodetypes="ccccccc" />
+    <path
+       style="fill:#f5a600;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.25pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+       d="M 665.02523,290.75654 C 665.02523,290.75654 664.28253,291.40056 664.08126,291.51105 C 663.88,291.62154 663.35844,291.7682 663.29456,291.63093 C 663.22905,291.49016 663.46046,291.07502 663.57538,290.8684 C 663.69105,290.66044 664.07899,290.1515 664.13848,290.08226 C 664.19796,290.01302 664.49842,289.71163 664.49842,289.71163 L 665.02523,290.75654 z"
+       id="path16560"
+       sodipodi:nodetypes="ccccccc" />
+    <path
+       style="fill:#ffe07a;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.25pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+       d="M 664.51606,289.68875 C 664.36825,289.87453 663.7686,290.5613 663.43226,290.68608 C 663.27476,290.78089 663.04599,290.92425 662.91446,290.92614 C 662.78293,290.92803 662.64241,291.00825 662.86002,290.64684 C 663.07764,290.28543 663.16814,290.06469 663.51829,289.70517 C 663.80076,289.36649 664.20058,289.07305 664.20058,289.07305 L 664.51606,289.68875 z"
+       id="path16562"
+       sodipodi:nodetypes="ccccccc" />
+    <path
+       style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.0312406pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+       d="M 661.50864,293.87805 L 660.26587,294.58383 L 661.01805,293.40925 C 661.01805,293.40925 661.48116,292.94175 661.41562,293.13881 C 661.28394,293.53553 661.30176,293.59185 661.64351,293.44006 C 661.99043,293.28598 661.50864,293.87805 661.50864,293.87805 z"
+       id="path16564"
+       sodipodi:nodetypes="cccccc" />
+    <path
+       style="opacity:0.66134183;fill:url(#linearGradient16599);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.25pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+       d="M 678.26705,275.53471 C 679.15668,276.19859 679.49421,276.18047 680.14093,277.83841 C 681.11705,276.63667 681.67947,276.39068 682.43919,275.69859 C 681.89468,274.71155 681.46637,274.03748 680.40762,273.52459 C 679.72147,274.38335 679.21075,274.77544 678.26705,275.53471 z"
+       id="path16566"
+       sodipodi:nodetypes="ccccc" />
+    <path
+       style="fill:url(#linearGradient16601);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.25pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+       d="M 661.50864,293.87805 L 660.26587,294.58383 L 661.01805,293.40925 C 661.01805,293.40925 661.48116,292.94175 661.41562,293.13881 C 661.28394,293.53553 661.30176,293.59185 661.64351,293.44006 C 661.99043,293.28598 661.50864,293.87805 661.50864,293.87805 z"
+       id="path16568"
+       sodipodi:nodetypes="cccccc" />
+    <path
+       style="fill:url(#linearGradient16603);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.25pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+       d="M 681.35307,274.03857 L 678.9786,276.20131 L 678.48072,275.77079 L 680.78933,273.65144 L 681.35307,274.03857 z"
+       id="path16570"
+       sodipodi:nodetypes="ccccc" />
+    <path
+       style="fill:url(#linearGradient16605);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.25pt;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+       d="M 683.74504,273.49232 C 682.52118,272.4238 682.05427,273.42101 681.27718,274.09784 C 681.11122,273.95433 680.94525,273.81082 680.77929,273.66732 C 681.36055,272.97034 681.65306,272.60698 682.5725,272.17027 C 682.75266,272.27845 683.47211,273.29694 683.74504,273.49232 z"
+       id="path16572"
+       sodipodi:nodetypes="ccccc" />
+  </g>
 </svg>
--- a/plugger.py	Sat Jan 17 02:34:45 2009 +0100
+++ b/plugger.py	Sat Jan 17 02:36:46 2009 +0100
@@ -855,6 +855,10 @@
         # define name for IEC raw code file
         return os.path.join(self.PlugPath(), "runtime.py")
 
+    def _getWXGLADEpath(self):
+        # define name for IEC raw code file
+        return os.path.join(self.PlugPath(), "hmi.wxg")
+
     def GetLocations(self):
         locations = []
         filepath = os.path.join(self._getBuildPath(),"LOCATED_VARIABLES.h")
@@ -976,6 +980,14 @@
         else:
             return None
 
+    def launch_wxglade(self,options, wait=False):
+        from wxglade import __file__ as fileName
+        path    = os.path.dirname(fileName)
+        glade   = os.path.join(path,'wxglade.py')
+        mode = {False:os.P_NOWAIT, True:os.P_WAIT}[wait]
+        print (mode,sys.executable,[sys.executable]+[glade]+options)
+        os.spawnv(mode,sys.executable,[sys.executable]+[glade]+options)
+
     #######################################################################
     #
     #                C CODE GENERATION METHODS
@@ -998,6 +1010,11 @@
         pyfile=self._getPYTHONcodepath()
         if os.path.exists(pyfile):
             res += (("runtime.py", file(pyfile,"rb")),)
+        wxgfile=self._getWXGLADEpath()
+        if os.path.exists(wxgfile):
+            hmipyfile=os.path.join(self._getBuildPath(),"hmi.py")
+            self.launch_wxglade(['-o', hmipyfile, '-g','python', wxgfile], wait=True)
+            res += (("hmi.py", file(hmipyfile,"rb")),)
 
         return res
 
@@ -1102,7 +1119,7 @@
 
         python_eval_fb_list = []
         for v in self._VariablesList :
-            if v["vartype"] == "FB" and v["type"] == "PYTHON_EVAL":
+            if v["vartype"] == "FB" and v["type"] in ["PYTHON_EVAL","PYTHON_POLL"]:
                 python_eval_fb_list.append(v)
         python_eval_fb_count = max(1, len(python_eval_fb_list))
         
@@ -1290,6 +1307,19 @@
             
         new_dialog.Show()
 
+    def _editWXGLADE(self):
+        wxg_filename = self._getWXGLADEpath()
+        if not os.path.exists(wxg_filename):
+            open(wxg_filename,"w").write("""<?xml version="1.0"?>
+<application path="" name="" class="" option="0" language="python" top_window="frame_1" encoding="UTF-8" use_gettext="0" overwrite="0" use_new_namespace="1" for_version="2.8" is_template="0">
+    <object class="HMIFrame" name="frame_1" base="EditFrame">
+        <style>wxDEFAULT_FRAME_STYLE</style>
+        <title>frame_1</title>
+    </object>
+</application>
+""")
+        self.launch_wxglade([wxg_filename])
+        
     def _EditPLC(self):
         if self.PLCEditor is None:
             self.RefreshPluginsBlockLists()
@@ -1700,4 +1730,8 @@
          "name" : "Python code",
          "tooltip" : "Write Python runtime code, for use with python_eval FBs",
          "method" : "_editPYTHONcode"},
+        {"bitmap" : opjimg("editWXGLADE"),
+         "name" : "WXGLADE GUI",
+         "tooltip" : "Edit a WxWidgets GUI with WXGlade",
+         "method" : "_editWXGLADE"},
     ]
--- a/runtime/PLCObject.py	Sat Jan 17 02:34:45 2009 +0100
+++ b/runtime/PLCObject.py	Sat Jan 17 02:36:46 2009 +0100
@@ -24,8 +24,8 @@
 
 import Pyro.core as pyro
 from threading import Timer, Thread
-import ctypes, os, commands
-import sys
+import ctypes, os, commands, types, sys
+
 
 if os.name in ("nt", "ce"):
     from _ctypes import LoadLibrary as dlopen
@@ -46,8 +46,9 @@
 
 class PLCObject(pyro.ObjBase):
     _Idxs = []
-    def __init__(self, workingdir, daemon, argv, statuschange=None):
+    def __init__(self, workingdir, daemon, argv, statuschange=None, evaluator=eval):
         pyro.ObjBase.__init__(self)
+        self.evaluator = evaluator
         self.argv = [workingdir] + argv # force argv[0] to be "path" to exec...
         self.workingdir = workingdir
         self.PLCStatus = "Stopped"
@@ -57,6 +58,7 @@
         self.daemon = daemon
         self.statuschange = statuschange
         self.python_threads_vars = None
+        self.hmi_frame = None
         
         # Get the last transfered PLC if connector must be restart
         try:
@@ -181,24 +183,40 @@
     def PrepareRuntimePy(self):
         self.python_threads_vars = globals().copy()
         pyfile = os.path.join(self.workingdir, "runtime.py")
+        hmifile = os.path.join(self.workingdir, "hmi.py")
         if os.path.exists(pyfile):
             try:
                 # TODO handle exceptions in runtime.py
                 # pyfile may redefine _runtime_cleanup
                 # or even call _PythonThreadProc itself.
+                if os.path.exists(hmifile):
+                   execfile(hmifile, self.python_threads_vars)
                 execfile(pyfile, self.python_threads_vars)
+                try:
+                   # try to instanciate the first frame found.
+                   for name, obj in self.python_threads_vars.iteritems():
+                       # obj is a class
+                       if type(obj)==type(type) and issubclass(obj,self.python_threads_vars['wx'].Frame):
+                           self.hmi_frame = obj(None)
+                           self.python_threads_vars['_'+name] = self.hmi_frame
+                           self.hmi_frame.Show()
+                           break
+                except:
+                    PLCprint(traceback.format_exc())
             except:
                 PLCprint(traceback.format_exc())
 
     def BeginRuntimePy(self):
         runtime_begin = self.python_threads_vars.get("_runtime_begin",None)
         if runtime_begin is not None:
-            runtime_begin()
+            self.evaluator(runtime_begin)
 
     def FinishRuntimePy(self):
         runtime_cleanup = self.python_threads_vars.get("_runtime_cleanup",None)
         if runtime_cleanup is not None:
-            runtime_cleanup()
+            self.evaluator(runtime_cleanup)
+        if self.hmi_frame is not None:
+            self.evaluator(self.hmi_frame.Destroy)
         self.python_threads_vars = None
 
     def PythonThreadProc(self):
@@ -212,7 +230,7 @@
             if cmd is None:
                 break
             try :
-                res = str(eval(cmd,self.python_threads_vars))
+                res = str(self.evaluator(eval,cmd,self.python_threads_vars))
             except Exception,e:
                 res = "#EXCEPTION : "+str(e)
                 PLCprint(res)
@@ -227,7 +245,7 @@
                     self._resumeDebug()
                 self.PLCStatus = "Started"
                 self.StatusChange()
-                self.PrepareRuntimePy()
+                self.evaluator(self.PrepareRuntimePy)
                 self.PythonThread = Thread(target=self.PythonThreadProc)
                 self.PythonThread.start()
                 return True
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/linux/python_cwiid/hmi.wxg	Sat Jan 17 02:36:46 2009 +0100
@@ -0,0 +1,397 @@
+<?xml version="1.0"?>
+<!-- generated by wxGlade 0.6.3 on Sat Jan 17 03:40:12 2009 -->
+
+<application path="" name="" class="" option="0" language="python" top_window="frame_1" encoding="UTF-8" use_gettext="0" overwrite="0" use_new_namespace="1" for_version="2.8" is_template="0">
+    <object class="HMIFrame" name="frame_1" base="EditFrame">
+        <style>wxDEFAULT_FRAME_STYLE</style>
+        <title>frame_1</title>
+        <object class="wxGridSizer" name="grid_sizer_1" base="EditGridSizer">
+            <hgap>0</hgap>
+            <rows>3</rows>
+            <cols>3</cols>
+            <vgap>0</vgap>
+            <object class="sizeritem">
+                <flag>wxEXPAND</flag>
+                <border>0</border>
+                <option>1</option>
+                <object class="wxFlexGridSizer" name="sizer_3" base="EditFlexGridSizer">
+                    <hgap>0</hgap>
+                    <growable_rows>0,1</growable_rows>
+                    <rows>2</rows>
+                    <growable_cols>0</growable_cols>
+                    <cols>1</cols>
+                    <vgap>0</vgap>
+                    <object class="sizeritem">
+                        <flag>wxEXPAND</flag>
+                        <border>0</border>
+                        <option>0</option>
+                        <object class="wxButton" name="button_1" base="EditButton">
+                            <label>Joystick</label>
+                            <events>
+                                <handler event="EVT_BUTTON">start_manu</handler>
+                            </events>
+                        </object>
+                    </object>
+                    <object class="sizeritem">
+                        <flag>wxEXPAND</flag>
+                        <border>0</border>
+                        <option>0</option>
+                        <object class="wxButton" name="button_1_copy" base="EditButton">
+                            <label>Auto</label>
+                        </object>
+                    </object>
+                </object>
+            </object>
+            <object class="sizeritem">
+                <flag>wxEXPAND</flag>
+                <border>0</border>
+                <option>1</option>
+                <object class="wxStaticBoxSizer" name="sizer_X" base="EditStaticBoxSizer">
+                    <orient>wxHORIZONTAL</orient>
+                    <label>Axis X</label>
+                    <object class="sizeritem">
+                        <flag>wxEXPAND</flag>
+                        <border>0</border>
+                        <option>1</option>
+                        <object class="wxGridSizer" name="grid_sizer_2" base="EditGridSizer">
+                            <hgap>0</hgap>
+                            <rows>2</rows>
+                            <cols>1</cols>
+                            <vgap>0</vgap>
+                            <object class="sizeritem">
+                                <flag>wxEXPAND</flag>
+                                <border>0</border>
+                                <option>0</option>
+                                <object class="wxSpinCtrl" name="spin_ctrl_X" base="EditSpinCtrl">
+                                </object>
+                            </object>
+                            <object class="sizeritem">
+                                <flag>wxEXPAND</flag>
+                                <border>0</border>
+                                <option>1</option>
+                                <object class="wxGridSizer" name="grid_sizer_3" base="EditGridSizer">
+                                    <hgap>0</hgap>
+                                    <rows>1</rows>
+                                    <cols>2</cols>
+                                    <vgap>0</vgap>
+                                    <object class="sizeritem">
+                                        <flag>wxEXPAND</flag>
+                                        <border>0</border>
+                                        <option>0</option>
+                                        <object class="wxRadioButton" name="radio_btn_1" base="EditRadioButton">
+                                            <label>Lock</label>
+                                        </object>
+                                    </object>
+                                    <object class="sizeritem">
+                                        <flag>wxEXPAND</flag>
+                                        <border>0</border>
+                                        <option>0</option>
+                                        <object class="wxButton" name="button_3" base="EditButton">
+                                            <label>Set</label>
+                                        </object>
+                                    </object>
+                                </object>
+                            </object>
+                        </object>
+                    </object>
+                </object>
+            </object>
+            <object class="sizeritem">
+                <flag>wxEXPAND</flag>
+                <border>0</border>
+                <option>1</option>
+                <object class="wxStaticBoxSizer" name="sizer_A" base="EditStaticBoxSizer">
+                    <orient>wxHORIZONTAL</orient>
+                    <label>Axis A</label>
+                    <object class="sizeritem">
+                        <flag>wxEXPAND</flag>
+                        <border>0</border>
+                        <option>1</option>
+                        <object class="wxGridSizer" name="grid_sizer_2_copy" base="EditGridSizer">
+                            <hgap>0</hgap>
+                            <rows>2</rows>
+                            <cols>1</cols>
+                            <vgap>0</vgap>
+                            <object class="sizeritem">
+                                <flag>wxEXPAND</flag>
+                                <border>0</border>
+                                <option>0</option>
+                                <object class="wxSpinCtrl" name="spin_ctrl_A" base="EditSpinCtrl">
+                                </object>
+                            </object>
+                            <object class="sizeritem">
+                                <flag>wxEXPAND</flag>
+                                <border>0</border>
+                                <option>1</option>
+                                <object class="wxGridSizer" name="grid_sizer_3_copy_2" base="EditGridSizer">
+                                    <hgap>0</hgap>
+                                    <rows>1</rows>
+                                    <cols>2</cols>
+                                    <vgap>0</vgap>
+                                    <object class="sizeritem">
+                                        <flag>wxEXPAND</flag>
+                                        <border>0</border>
+                                        <option>0</option>
+                                        <object class="wxRadioButton" name="radio_btn_1_copy_2" base="EditRadioButton">
+                                            <label>Lock</label>
+                                        </object>
+                                    </object>
+                                    <object class="sizeritem">
+                                        <flag>wxEXPAND</flag>
+                                        <border>0</border>
+                                        <option>0</option>
+                                        <object class="wxButton" name="button_3_copy_2" base="EditButton">
+                                            <label>Set</label>
+                                        </object>
+                                    </object>
+                                </object>
+                            </object>
+                        </object>
+                    </object>
+                </object>
+            </object>
+            <object class="sizeritem">
+                <flag>wxEXPAND</flag>
+                <border>0</border>
+                <option>1</option>
+                <object class="wxStaticBoxSizer" name="sizer_1" base="EditStaticBoxSizer">
+                    <orient>wxHORIZONTAL</orient>
+                    <label>Status</label>
+                    <object class="sizeritem">
+                        <border>0</border>
+                        <option>0</option>
+                        <object class="wxStaticText" name="label_1" base="EditStaticText">
+                            <attribute>1</attribute>
+                            <label>wiimote not connected</label>
+                        </object>
+                    </object>
+                </object>
+            </object>
+            <object class="sizeritem">
+                <flag>wxEXPAND</flag>
+                <border>0</border>
+                <option>1</option>
+                <object class="wxStaticBoxSizer" name="sizer_Y" base="EditStaticBoxSizer">
+                    <orient>wxHORIZONTAL</orient>
+                    <label>Axis Y</label>
+                    <object class="sizeritem">
+                        <flag>wxEXPAND</flag>
+                        <border>0</border>
+                        <option>1</option>
+                        <object class="wxGridSizer" name="grid_sizer_2_copy_1" base="EditGridSizer">
+                            <hgap>0</hgap>
+                            <rows>2</rows>
+                            <cols>1</cols>
+                            <vgap>0</vgap>
+                            <object class="sizeritem">
+                                <flag>wxEXPAND</flag>
+                                <border>0</border>
+                                <option>0</option>
+                                <object class="wxSpinCtrl" name="spin_ctrl_Y" base="EditSpinCtrl">
+                                </object>
+                            </object>
+                            <object class="sizeritem">
+                                <flag>wxEXPAND</flag>
+                                <border>0</border>
+                                <option>1</option>
+                                <object class="wxGridSizer" name="grid_sizer_3_copy" base="EditGridSizer">
+                                    <hgap>0</hgap>
+                                    <rows>1</rows>
+                                    <cols>2</cols>
+                                    <vgap>0</vgap>
+                                    <object class="sizeritem">
+                                        <flag>wxEXPAND</flag>
+                                        <border>0</border>
+                                        <option>0</option>
+                                        <object class="wxRadioButton" name="radio_btn_1_copy" base="EditRadioButton">
+                                            <label>Lock</label>
+                                        </object>
+                                    </object>
+                                    <object class="sizeritem">
+                                        <flag>wxEXPAND</flag>
+                                        <border>0</border>
+                                        <option>0</option>
+                                        <object class="wxButton" name="button_3_copy" base="EditButton">
+                                            <label>Set</label>
+                                        </object>
+                                    </object>
+                                </object>
+                            </object>
+                        </object>
+                    </object>
+                </object>
+            </object>
+            <object class="sizeritem">
+                <flag>wxEXPAND</flag>
+                <border>0</border>
+                <option>1</option>
+                <object class="wxStaticBoxSizer" name="sizer_B" base="EditStaticBoxSizer">
+                    <orient>wxHORIZONTAL</orient>
+                    <label>Axis B</label>
+                    <object class="sizeritem">
+                        <flag>wxEXPAND</flag>
+                        <border>0</border>
+                        <option>1</option>
+                        <object class="wxGridSizer" name="grid_sizer_2_copy_2" base="EditGridSizer">
+                            <hgap>0</hgap>
+                            <rows>2</rows>
+                            <cols>1</cols>
+                            <vgap>0</vgap>
+                            <object class="sizeritem">
+                                <flag>wxEXPAND</flag>
+                                <border>0</border>
+                                <option>0</option>
+                                <object class="wxSpinCtrl" name="spin_ctrl_B" base="EditSpinCtrl">
+                                </object>
+                            </object>
+                            <object class="sizeritem">
+                                <flag>wxEXPAND</flag>
+                                <border>0</border>
+                                <option>1</option>
+                                <object class="wxGridSizer" name="grid_sizer_3_copy_3" base="EditGridSizer">
+                                    <hgap>0</hgap>
+                                    <rows>1</rows>
+                                    <cols>2</cols>
+                                    <vgap>0</vgap>
+                                    <object class="sizeritem">
+                                        <flag>wxEXPAND</flag>
+                                        <border>0</border>
+                                        <option>0</option>
+                                        <object class="wxRadioButton" name="radio_btn_1_copy_3" base="EditRadioButton">
+                                            <label>Lock</label>
+                                        </object>
+                                    </object>
+                                    <object class="sizeritem">
+                                        <flag>wxEXPAND</flag>
+                                        <border>0</border>
+                                        <option>0</option>
+                                        <object class="wxButton" name="button_3_copy_3" base="EditButton">
+                                            <label>Set</label>
+                                        </object>
+                                    </object>
+                                </object>
+                            </object>
+                        </object>
+                    </object>
+                </object>
+            </object>
+            <object class="sizeritem">
+                <flag>wxEXPAND</flag>
+                <border>0</border>
+                <option>1</option>
+                <object class="wxStaticBoxSizer" name="sizer_2" base="EditStaticBoxSizer">
+                    <orient>wxVERTICAL</orient>
+                    <label>Speed Control</label>
+                    <object class="sizeritem">
+                        <flag>wxEXPAND</flag>
+                        <border>0</border>
+                        <option>0</option>
+                        <object class="wxStaticText" name="label_2" base="EditStaticText">
+                            <style>wxALIGN_CENTRE</style>
+                            <attribute>1</attribute>
+                            <label>Max Speed</label>
+                        </object>
+                    </object>
+                    <object class="sizeritem">
+                        <flag>wxEXPAND</flag>
+                        <border>0</border>
+                        <option>0</option>
+                        <object class="wxSlider" name="slider_1_copy" base="EditSlider">
+                            <style>wxSL_HORIZONTAL|wxSL_AUTOTICKS|wxSL_LABELS</style>
+                        </object>
+                    </object>
+                    <object class="sizeritem">
+                        <flag>wxEXPAND</flag>
+                        <border>0</border>
+                        <option>0</option>
+                        <object class="wxStaticText" name="label_2_copy" base="EditStaticText">
+                            <style>wxALIGN_CENTRE</style>
+                            <attribute>1</attribute>
+                            <label>Max Acceleration</label>
+                        </object>
+                    </object>
+                    <object class="sizeritem">
+                        <flag>wxEXPAND</flag>
+                        <border>0</border>
+                        <option>0</option>
+                        <object class="wxSlider" name="slider_1" base="EditSlider">
+                            <style>wxSL_HORIZONTAL|wxSL_AUTOTICKS|wxSL_LABELS</style>
+                        </object>
+                    </object>
+                </object>
+            </object>
+            <object class="sizeritem">
+                <flag>wxEXPAND</flag>
+                <border>0</border>
+                <option>1</option>
+                <object class="wxStaticBoxSizer" name="sizer_Z" base="EditStaticBoxSizer">
+                    <orient>wxHORIZONTAL</orient>
+                    <label>Axis Z</label>
+                    <object class="sizeritem">
+                        <flag>wxEXPAND</flag>
+                        <border>0</border>
+                        <option>1</option>
+                        <object class="wxGridSizer" name="grid_sizer_2_copy_3" base="EditGridSizer">
+                            <hgap>0</hgap>
+                            <rows>2</rows>
+                            <cols>1</cols>
+                            <vgap>0</vgap>
+                            <object class="sizeritem">
+                                <flag>wxEXPAND</flag>
+                                <border>0</border>
+                                <option>0</option>
+                                <object class="wxSpinCtrl" name="spin_ctrl_Z" base="EditSpinCtrl">
+                                </object>
+                            </object>
+                            <object class="sizeritem">
+                                <flag>wxEXPAND</flag>
+                                <border>0</border>
+                                <option>1</option>
+                                <object class="wxGridSizer" name="grid_sizer_3_copy_1" base="EditGridSizer">
+                                    <hgap>0</hgap>
+                                    <rows>1</rows>
+                                    <cols>2</cols>
+                                    <vgap>0</vgap>
+                                    <object class="sizeritem">
+                                        <flag>wxEXPAND</flag>
+                                        <border>0</border>
+                                        <option>0</option>
+                                        <object class="wxRadioButton" name="radio_btn_1_copy_1" base="EditRadioButton">
+                                            <label>Lock</label>
+                                        </object>
+                                    </object>
+                                    <object class="sizeritem">
+                                        <flag>wxEXPAND</flag>
+                                        <border>0</border>
+                                        <option>0</option>
+                                        <object class="wxButton" name="button_3_copy_1" base="EditButton">
+                                            <label>Set</label>
+                                        </object>
+                                    </object>
+                                </object>
+                            </object>
+                        </object>
+                    </object>
+                </object>
+            </object>
+            <object class="sizeritem">
+                <flag>wxEXPAND</flag>
+                <border>0</border>
+                <option>0</option>
+                <object class="wxButton" name="button_2" base="EditButton">
+                    <foreground>#ff0000</foreground>
+                    <stockitem>STOP</stockitem>
+                    <label>&amp;Stop</label>
+                    <font>
+                        <size>20</size>
+                        <family>default</family>
+                        <style>normal</style>
+                        <weight>normal</weight>
+                        <underlined>0</underlined>
+                        <face></face>
+                    </font>
+                </object>
+            </object>
+        </object>
+    </object>
+</application>
--- a/tests/linux/python_cwiid/plc.xml	Sat Jan 17 02:34:45 2009 +0100
+++ b/tests/linux/python_cwiid/plc.xml	Sat Jan 17 02:36:46 2009 +0100
@@ -6,9 +6,9 @@
   <fileHeader companyName="LOLITECH"
               productName="Beremiz"
               productVersion="0.0"
-              creationDateTime="2008-12-14T16:21:19"/>
+              creationDateTime="2008-12-14 16:21:19"/>
   <contentHeader name="Beremiz Python Support Tests"
-                 modificationDateTime="2009-01-04T11:25:39">
+                 modificationDateTime="2009-01-16 21:51:43">
     <coordinateInfo>
       <pageSize x="1024" y="1024"/>
       <fbd>
@@ -40,34 +40,29 @@
             </variable>
             <variable name="py2">
               <type>
+                <derived name="python_poll"/>
+              </type>
+            </variable>
+            <variable name="py3">
+              <type>
+                <derived name="python_poll"/>
+              </type>
+            </variable>
+            <variable name="py1">
+              <type>
+                <derived name="python_poll"/>
+              </type>
+            </variable>
+            <variable name="pytest_var3">
+              <type>
+                <BOOL/>
+              </type>
+            </variable>
+            <variable name="Block1">
+              <type>
                 <derived name="python_eval"/>
               </type>
             </variable>
-            <variable name="py3">
-              <type>
-                <derived name="python_eval"/>
-              </type>
-            </variable>
-            <variable name="py1">
-              <type>
-                <derived name="python_eval"/>
-              </type>
-            </variable>
-            <variable name="pytest_var3">
-              <type>
-                <BOOL/>
-              </type>
-            </variable>
-            <variable name="Block1">
-              <type>
-                <derived name="python_eval"/>
-              </type>
-            </variable>
-            <variable name="ltch">
-              <type>
-                <derived name="RS"/>
-              </type>
-            </variable>
           </localVars>
         </interface>
         <body>
@@ -79,7 +74,7 @@
               </connectionPointOut>
               <expression>'last_point[0]'</expression>
             </inVariable>
-            <block localId="5" width="125" height="80" typeName="python_eval" instanceName="py2">
+            <block localId="5" width="125" height="80" typeName="python_poll" instanceName="py2">
               <position x="260" y="550"/>
               <inputVariables>
                 <variable formalParameter="TRIG">
@@ -119,7 +114,7 @@
                 </variable>
               </outputVariables>
             </block>
-            <block localId="8" width="125" height="80" typeName="python_eval" instanceName="py3">
+            <block localId="8" width="125" height="80" typeName="python_poll" instanceName="py3">
               <position x="260" y="660"/>
               <inputVariables>
                 <variable formalParameter="TRIG">
@@ -173,19 +168,17 @@
               </connectionPointOut>
               <expression>'btA'</expression>
             </inVariable>
-            <block localId="12" width="125" height="80" typeName="python_eval" instanceName="py1">
+            <block localId="12" width="125" height="80" typeName="python_poll" instanceName="py1">
               <position x="260" y="405"/>
               <inputVariables>
                 <variable formalParameter="TRIG">
                   <connectionPointIn>
                     <relPosition x="0" y="35"/>
-                    <connection refLocalId="37" formalParameter="OUT">
+                    <connection refLocalId="41">
                       <position x="260" y="440"/>
-                      <position x="250" y="440"/>
-                      <position x="250" y="370"/>
-                      <position x="470" y="370"/>
-                      <position x="470" y="300"/>
-                      <position x="460" y="300"/>
+                      <position x="235" y="440"/>
+                      <position x="235" y="435"/>
+                      <position x="225" y="435"/>
                     </connection>
                   </connectionPointIn>
                 </variable>
@@ -277,28 +270,6 @@
                 </variable>
               </outputVariables>
             </block>
-            <block localId="27" width="70" height="45" typeName="NOT">
-              <position x="170" y="295"/>
-              <inputVariables>
-                <variable formalParameter="IN">
-                  <connectionPointIn>
-                    <relPosition x="0" y="30"/>
-                    <connection refLocalId="26">
-                      <position x="170" y="325"/>
-                      <position x="140" y="325"/>
-                    </connection>
-                  </connectionPointIn>
-                </variable>
-              </inputVariables>
-              <inOutVariables/>
-              <outputVariables>
-                <variable formalParameter="OUT">
-                  <connectionPointOut>
-                    <relPosition x="70" y="30"/>
-                  </connectionPointOut>
-                </variable>
-              </outputVariables>
-            </block>
             <inVariable localId="31" height="30" width="160">
               <position x="570" y="740"/>
               <connectionPointOut>
@@ -463,96 +434,13 @@
               </connectionPointOut>
               <expression>', y:'</expression>
             </inVariable>
-            <block localId="37" width="80" height="65" typeName="AND">
-              <position x="380" y="270"/>
-              <inputVariables>
-                <variable formalParameter="IN1">
-                  <connectionPointIn>
-                    <relPosition x="0" y="30"/>
-                    <connection refLocalId="40" formalParameter="Q1">
-                      <position x="380" y="300"/>
-                      <position x="365" y="300"/>
-                      <position x="365" y="245"/>
-                      <position x="355" y="245"/>
-                    </connection>
-                  </connectionPointIn>
-                </variable>
-                <variable formalParameter="IN2">
-                  <connectionPointIn>
-                    <relPosition x="0" y="55"/>
-                    <connection refLocalId="27" formalParameter="OUT">
-                      <position x="380" y="325"/>
-                      <position x="240" y="325"/>
-                    </connection>
-                  </connectionPointIn>
-                </variable>
-              </inputVariables>
-              <inOutVariables/>
-              <outputVariables>
-                <variable formalParameter="OUT">
-                  <connectionPointOut>
-                    <relPosition x="80" y="30"/>
-                  </connectionPointOut>
-                </variable>
-              </outputVariables>
-            </block>
-            <inVariable localId="26" height="35" width="125">
-              <position x="15" y="310"/>
-              <connectionPointOut>
-                <relPosition x="125" y="15"/>
-              </connectionPointOut>
-              <expression>pytest_var2</expression>
-            </inVariable>
-            <outVariable localId="39" height="35" width="125">
-              <position x="515" y="285"/>
-              <connectionPointIn>
-                <relPosition x="0" y="15"/>
-                <connection refLocalId="37" formalParameter="OUT">
-                  <position x="515" y="300"/>
-                  <position x="460" y="300"/>
-                </connection>
-              </connectionPointIn>
-              <expression>pytest_var2</expression>
-            </outVariable>
-            <block localId="40" width="60" height="65" typeName="RS" instanceName="ltch">
-              <position x="295" y="215"/>
-              <inputVariables>
-                <variable formalParameter="S">
-                  <connectionPointIn>
-                    <relPosition x="0" y="30"/>
-                    <connection refLocalId="25" formalParameter="OUT">
-                      <position x="295" y="245"/>
-                      <position x="270" y="245"/>
-                      <position x="270" y="195"/>
-                      <position x="880" y="195"/>
-                      <position x="880" y="470"/>
-                      <position x="870" y="470"/>
-                    </connection>
-                  </connectionPointIn>
-                </variable>
-                <variable formalParameter="R1">
-                  <connectionPointIn>
-                    <relPosition x="0" y="55"/>
-                    <connection refLocalId="32" formalParameter="ACK">
-                      <position x="295" y="270"/>
-                      <position x="250" y="270"/>
-                      <position x="250" y="180"/>
-                      <position x="1095" y="180"/>
-                      <position x="1095" y="585"/>
-                      <position x="1085" y="585"/>
-                    </connection>
-                  </connectionPointIn>
-                </variable>
-              </inputVariables>
-              <inOutVariables/>
-              <outputVariables>
-                <variable formalParameter="Q1" negated="true">
-                  <connectionPointOut>
-                    <relPosition x="60" y="30"/>
-                  </connectionPointOut>
-                </variable>
-              </outputVariables>
-            </block>
+            <inVariable localId="41" height="30" width="100">
+              <position x="125" y="420"/>
+              <connectionPointOut>
+                <relPosition x="100" y="15"/>
+              </connectionPointOut>
+              <expression>BOOL#TRUE</expression>
+            </inVariable>
           </FBD>
         </body>
       </pou>
--- a/tests/linux/python_cwiid/runtime.py	Sat Jan 17 02:34:45 2009 +0100
+++ b/tests/linux/python_cwiid/runtime.py	Sat Jan 17 02:36:46 2009 +0100
@@ -17,8 +17,10 @@
 ################################################################################
 
 import cwiid
-
+import sys
+from threading import Thread
 ## Configuration
+wm = None
 wiimote_hwaddr = '' # Use your address to speed up the connection proccess
 #wiimote_hwaddr = '00:19:1D:5D:5D:DC'
 
@@ -30,18 +32,19 @@
     '''Wiimote callback managing method
     Recieves a message list, each element is different, see the libcwiid docs'''
     global btA, btB, last_point
+    #print messages
     #print "wiimote callback"
     for msg in messages:
-        if msg[0] == cwiid.MESG_IR:
-            # msg is of the form (cwiid.MESG_IR, (((x, y), size) or None * 4))
-            for p in msg[1]:
-                if p:
-                    pos = p['pos'][0], p['pos'][1] # point is mirrored
-                    #s = max(p['size'], 1)
-                        
-                    last_point = tuple(pos)
-                    #print "last_point",last_point
-        elif msg[0] == cwiid.MESG_BTN:
+#        if msg[0] == cwiid.MESG_IR:
+#            # msg is of the form (cwiid.MESG_IR, (((x, y), size) or None * 4))
+#            for p in msg[1]:
+#                if p:
+#                    pos = p['pos'][0], p['pos'][1] # point is mirrored
+#                    #s = max(p['size'], 1)
+#                        
+#                    last_point = tuple(pos)
+#                    #print "last_point",last_point
+        if msg[0] == cwiid.MESG_BTN:
             # msg is of the form (cwiid.MESG_BTN, cwiid.BTN_*)
             if msg[1] & cwiid.BTN_A:
                 btA = 1
@@ -55,36 +58,63 @@
                 #print "btB = 1"
             else:
                 btB = 0
+        elif msg[0] == cwiid.MESG_NUNCHUK:
+               #sbb = msg[1]['buttons']
+               last_point = msg[1]['stick']
+               #ssx = msg[1]['stick'][0]
+               #ssy = msg[1]['stick'][1]
+               #msg[1]['acc'][0]
+               #msg[1]['acc'][1]
+               #msg[1]['acc'][2]
                 #print "btB = 0"
         #elif msg[0] == cwiid.MESG_STATUS:
         #    # msg is of the form (cwiid.MESG_BTN, { 'status' : value, ... })
         #    print msg[1]
 
-try:
-#if False:
-    wm = cwiid.Wiimote(wiimote_hwaddr)
-    if wm is not None:
-        # each message will contain info about ir and buttons
-        wm.rpt_mode = cwiid.RPT_IR | cwiid.RPT_BTN # | cwiid.RPT_STATUS
-        # tell cwiid to use the callback interface and allways send button events
-        wm.enable(cwiid.FLAG_MESG_IFC
-                  #| cwiid.FLAG_NONBLOCK
-                  | cwiid.FLAG_REPEAT_BTN)
+def Connect_Wiimote(frameobj):
+    global wm,wiimote_hwaddr
+    try:
+    #if False:
+        print "Press 1+2 Now !!!!"
+        sys.stdout.flush()
+        wm = cwiid.Wiimote(wiimote_hwaddr)
+        if wm is not None:
+            # each message will contain info about ir and buttons
+            wm.rpt_mode = cwiid.RPT_BTN | cwiid.RPT_EXT # | cwiid.RPT_STATUS | cwiid.RPT_IR | 
+            # tell cwiid to use the callback interface and allways send button events
+            wm.enable(cwiid.FLAG_MESG_IFC)
+                      #| cwiid.FLAG_NONBLOCK
+                      #| cwiid.FLAG_REPEAT_BTN)
 
-        # specify wich function will manage messages AFTER the other settings
-        wm.mesg_callback = cback
+            # specify wich function will manage messages AFTER the other settings
+            wm.mesg_callback = cback
 
-        # quick check on the wiimote
-        print "Got Wiimote!"
-        st = wm.state
-        for e in st:
-            print str(e).ljust(8), ">", st[e]
-except:
-#else:
-    print "Error with wiimote " + str(wiimote_hwaddr)
-            
+            # quick check on the wiimote
+            print "Got Wiimote!"
+            frameobj.label_1.SetLabel("Got Wiimote !")
+            st = wm.state
+            for e in st:
+                print str(e).ljust(8), ">", st[e]
+    except:
+    #else:
+        print "Error with wiimote " + str(wiimote_hwaddr)
+        frameobj.label_1.SetLabel("Wiimote NOK")
+    sys.stdout.flush()
+          
 def _runtime_cleanup():
-    print "_runtime_cleanup() Called"
-    runing = 0
     if wm is not None:
         wm.close()
+
+def start_manu(self,evt):
+    self.label_1.SetLabel("press 1+2 now !!!")
+    wx.CallAfter(Connect_Wiimote, self)
+    evt.Skip()
+HMIFrame.start_manu = start_manu
+
+def _runtime_begin():
+    pass
+    #wx.CallAfter(Connect_Wiimote)
+#Thread(target=Connect_Wiimote).start()
+
+#create_frame()
+#wx.Yield()
\ No newline at end of file