Skip to content
Snippets Groups Projects
Commit 03a78696 authored by ft-Demo's avatar ft-Demo
Browse files

commit by robo pro coding

parent d380a497
No related branches found
No related tags found
No related merge requests found
...@@ -31,7 +31,7 @@ TXTWindow { ...@@ -31,7 +31,7 @@ TXTWindow {
font.bold: false font.bold: false
font.italic: false font.italic: false
font.underline: false font.underline: false
horizontalAlignment: Text.AlignLeft horizontalAlignment: Text.AlignHCenter
color: "#ffffff" color: "#ffffff"
elide: Text.ElideRight elide: Text.ElideRight
x: 10 x: 10
......
<xml type="display" version="2"><item id="2" class="TXTButton"><name>txt_button_start</name><enabled>false</enabled><text>START</text><fontSize>32</fontSize><fontStyle>,bold</fontStyle><geometry><x>70</x><y>160</y><width>100</width><height>40</height></geometry></item><item id="3" class="TXTLabel"><name>txt_label_text</name><text/><fontSize>32</fontSize><fontStyle/><horizontalAlignment>left</horizontalAlignment><color>#ffffff</color><geometry><x>10</x><y>50</y><width>220</width><height>40</height></geometry></item><item id="4" class="StatusIndicator"><name>txt_status_indicator_red</name><color>#ff0000</color><active>true</active><geometry><x>140</x><y>100</y><width>50</width><height>50</height></geometry></item><item id="5" class="StatusIndicator"><name>txt_status_indicator_green</name><color>#00FF02</color><active>true</active><geometry><x>50</x><y>100</y><width>50</width><height>50</height></geometry></item></xml> <xml type="display" version="2"><item id="2" class="TXTButton"><name>txt_button_start</name><enabled>false</enabled><text>START</text><fontSize>32</fontSize><fontStyle>,bold</fontStyle><geometry><x>70</x><y>160</y><width>100</width><height>40</height></geometry></item><item id="3" class="TXTLabel"><name>txt_label_text</name><text/><fontSize>32</fontSize><fontStyle/><horizontalAlignment>center</horizontalAlignment><color>#ffffff</color><geometry><x>10</x><y>50</y><width>220</width><height>40</height></geometry></item><item id="4" class="StatusIndicator"><name>txt_status_indicator_red</name><color>#ff0000</color><active>true</active><geometry><x>140</x><y>100</y><width>50</width><height>50</height></geometry></item><item id="5" class="StatusIndicator"><name>txt_status_indicator_green</name><color>#00FF02</color><active>true</active><geometry><x>50</x><y>100</y><width>50</width><height>50</height></geometry></item></xml>
\ No newline at end of file \ No newline at end of file
...@@ -2,36 +2,245 @@ ...@@ -2,36 +2,245 @@
<variables> <variables>
<variable id="qV9Y!cd@LoJewpopu:A^">started</variable> <variable id="qV9Y!cd@LoJewpopu:A^">started</variable>
<variable id="v$.*@2*UE@I1srmr5G9g">text</variable> <variable id="v$.*@2*UE@I1srmr5G9g">text</variable>
<variable id="8urB!L,dNPRi$sK4(:Ih">active</variable>
</variables> </variables>
<block type="start_block" id="2%kYw8a0vBTkpxZMok4f" deletable="false" x="-40" y="-42"> <block type="start_block" id="2%kYw8a0vBTkpxZMok4f" deletable="false" x="0" y="0">
<statement name="statement"> <statement name="statement">
<block type="variables_set" id="q-XX(.p,:f:fB2:_RD.#"> <block type="text_print" id="[oTw]=DJXfEU+?h/ohFX">
<field name="VAR" id="qV9Y!cd@LoJewpopu:A^">started</field> <value name="TEXT">
<value name="VALUE"> <shadow type="text" id="PH=yXY{CeK!VY^7hQ*=]">
<block type="logic_boolean" id="9c^Quo2*f=1TCc`J#BV}"> <field name="TEXT">init variables...</field>
<field name="BOOL">FALSE</field> </shadow>
</block>
</value> </value>
<next> <next>
<block type="variables_set" id="Fg(g5OR4,p$5U#-EMW7d"> <block type="variables_set" id="q-XX(.p,:f:fB2:_RD.#">
<field name="VAR" id="v$.*@2*UE@I1srmr5G9g">text</field> <field name="VAR" id="qV9Y!cd@LoJewpopu:A^">started</field>
<value name="VALUE"> <value name="VALUE">
<block type="text" id="WGA(]a0i7.|g-!-;4v0c"> <block type="logic_boolean" id="9c^Quo2*f=1TCc`J#BV}">
<field name="TEXT">Initialization</field> <field name="BOOL">FALSE</field>
</block> </block>
</value> </value>
<next> <next>
<block type="loop_endless" id="$,IBS3~}Tj@Mb*6wc98%"/> <block type="variables_set" id="Fg(g5OR4,p$5U#-EMW7d">
<field name="VAR" id="v$.*@2*UE@I1srmr5G9g">text</field>
<value name="VALUE">
<block type="text" id="WGA(]a0i7.|g-!-;4v0c">
<field name="TEXT">Initialization</field>
</block>
</value>
<next>
<block type="text_print" id="RZ1psYaweg@lWu/MA2SU">
<value name="TEXT">
<shadow type="text" id="kF*h@~UepYzVLN6Vz9D9">
<field name="TEXT">start display thread...</field>
</shadow>
</value>
<next>
<block type="util_thread" id="paqj/hy=f75yw?%%rmJq">
<field name="dropdown_event">{"id":"xvqB*(k=*mtSnRY}bqw#","filename":"test_display_start.py"}</field>
<next>
<block type="loop_endless" id="$,IBS3~}Tj@Mb*6wc98%">
<statement name="DO">
<block type="variables_set" id="~p-WZw+*$:k%iUn?G$fz">
<field name="VAR" id="v$.*@2*UE@I1srmr5G9g">text</field>
<value name="VALUE">
<block type="text" id="W6(e0%Of/kw?);]Z$49a">
<field name="TEXT">Ready</field>
</block>
</value>
<next>
<block type="text_print" id="WCL:uid%B*+`#KKq1%6D">
<value name="TEXT">
<shadow type="text" id="7X}yt}!BT*XtVr:)Q]7.">
<field name="TEXT">wait until START is pressed...</field>
</shadow>
</value>
<next>
<block type="util_wait_until" id="!-WLXbC/)YC~~);}(Kz%">
<value name="value">
<block type="variables_get" id="y-xW8i$Cy$Zbq~mY=`tn">
<field name="VAR" id="qV9Y!cd@LoJewpopu:A^">started</field>
</block>
</value>
<next>
<block type="text_print" id="k;?Rzn/f*;uJKQ1(NgLP">
<value name="TEXT">
<shadow type="text" id="kEQyG7lSv$-Er/TiyX)B">
<field name="TEXT">START pressed</field>
</shadow>
</value>
<next>
<block type="variables_set" id="R.;C)G]u#U:HnJjC$cA{">
<field name="VAR" id="v$.*@2*UE@I1srmr5G9g">text</field>
<value name="VALUE">
<block type="text" id=";BNLCej/1DxVF_{Fk_)~">
<field name="TEXT">RUN</field>
</block>
</value>
<next>
<block type="controls_whileUntil" id="obPXp$y*{]FaJqR9zC0~">
<field name="MODE">WHILE</field>
<value name="BOOL">
<block type="variables_get" id="IAI-PLFr.AL5~2j,1PWi">
<field name="VAR" id="qV9Y!cd@LoJewpopu:A^">started</field>
</block>
</value>
<statement name="DO">
<block type="variables_set" id="gg+xI++^$s__2yO!MrMO">
<field name="VAR" id="8urB!L,dNPRi$sK4(:Ih">active</field>
<value name="VALUE">
<block type="logic_boolean" id="!v#NsW%bv^b-2d}{9r[q">
<field name="BOOL">TRUE</field>
</block>
</value>
<next>
<block type="util_wait_for" id="sWdG[T*$/GC^Dhv*G|ON">
<field name="format">s</field>
<value name="value">
<shadow type="math_number" id="6N}n*cl)w%Bbt]nr3UBj">
<field name="NUM">1</field>
</shadow>
</value>
<next>
<block type="variables_set" id="1jGo=)x:3Qf[t.B1wv-t">
<field name="VAR" id="8urB!L,dNPRi$sK4(:Ih">active</field>
<value name="VALUE">
<block type="logic_boolean" id="gB!LK41K5Oek.giaN*cj">
<field name="BOOL">FALSE</field>
</block>
</value>
<next>
<block type="util_wait_for" id="OJGI:hU~.ldChe(8.,tF">
<field name="format">s</field>
<value name="value">
<shadow type="math_number" id="|D|YYOEM%%OdX~^KH-Yz">
<field name="NUM">1</field>
</shadow>
</value>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</statement>
<next>
<block type="util_wait_for" id="]NOP-n!m3!qPH9$6QJaq">
<field name="format">ms</field>
<value name="value">
<shadow type="math_number" id="baX]M#-rIo2w3if%/=eI">
<field name="NUM">10</field>
</shadow>
</value>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</statement>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</next> </next>
</block> </block>
</next> </next>
</block> </block>
</statement> </statement>
</block> </block>
<block type="procedures_defnoreturn" id="xvqB*(k=*mtSnRY}bqw#" x="-33" y="206"> <block type="procedures_defnoreturn" id="xvqB*(k=*mtSnRY}bqw#" x="0" y="603">
<field name="NAME">thread_display</field> <field name="NAME">thread_display</field>
<statement name="STACK"> <statement name="STACK">
<block type="loop_endless" id="W$G8.Xs7V)cqi1MOI0_j"/> <block type="display_set_button_enabled" id="crTnAY`(LyFPym8]p`sH">
<field name="instance_name">txt_button_start</field>
<value name="value">
<shadow type="logic_boolean" id="^=vr6TZD)bjyj:_FWJF_">
<field name="BOOL">TRUE</field>
</shadow>
</value>
<next>
<block type="loop_endless" id="W$G8.Xs7V)cqi1MOI0_j">
<statement name="DO">
<block type="display_set_label_text" id="AP?t(nH6elS]),GH.$^x">
<field name="instance_name">txt_label_text</field>
<value name="value">
<shadow type="text" id=",1%hC^T`20`kY8DrTv+D">
<field name="TEXT">abc</field>
</shadow>
<block type="variables_get" id="E2X{Enk+u~n*h_J5Xj4:">
<field name="VAR" id="v$.*@2*UE@I1srmr5G9g">text</field>
</block>
</value>
<next>
<block type="display_set_status_indicator_active" id="//E*9^[CH-O}SgTwPC}t">
<field name="instance_name">txt_status_indicator_green</field>
<value name="value">
<shadow type="logic_boolean" id="V{_iby4M(nn33ioYGuY2">
<field name="BOOL">TRUE</field>
</shadow>
<block type="variables_get" id="F2Byu}m}CBUXF*zQ=w0Z">
<field name="VAR" id="8urB!L,dNPRi$sK4(:Ih">active</field>
</block>
</value>
<next>
<block type="display_set_status_indicator_active" id="xNcHR(ohWbdJf:$Z2aNN">
<field name="instance_name">txt_status_indicator_red</field>
<value name="value">
<shadow type="logic_boolean" id="9:2y1ts1O})%30sBfGER">
<field name="BOOL">TRUE</field>
</shadow>
<block type="logic_negate" id=":^XSx6euO:KloJc^!_4%">
<value name="BOOL">
<block type="variables_get" id="(^K14:ORVjYuF`[^]Lh[">
<field name="VAR" id="8urB!L,dNPRi$sK4(:Ih">active</field>
</block>
</value>
</block>
</value>
<next>
<block type="util_wait_for" id="M;#A7U9zVG|ZA`R[M1,X">
<field name="format">ms</field>
<value name="value">
<shadow type="math_number" id="b+?;/]Ve;^v^!pY_0$!2">
<field name="NUM">200</field>
</shadow>
</value>
</block>
</next>
</block>
</next>
</block>
</next>
</block>
</statement>
</block>
</next>
</block>
</statement>
</block>
<block type="display_on_button_clicked" id="1x:YOK9tE(Xt7Gga}KIv" x="0" y="873">
<field name="instance_name">txt_button_start</field>
<statement name="statement">
<block type="variables_set" id="AC/9:Bpd!e61U`4(,vv%">
<field name="VAR" id="qV9Y!cd@LoJewpopu:A^">started</field>
<value name="VALUE">
<block type="logic_boolean" id="r)@P260cPopj?bn#p?k]">
<field name="BOOL">TRUE</field>
</block>
</value>
</block>
</statement> </statement>
</block> </block>
</xml> </xml>
\ No newline at end of file
import threading
import time
from lib.controller import * from lib.controller import *
from lib.display import *
started = None started = None
text = None text = None
active = None
def thread_display(): def thread_display():
global started, text global started, text, active
display.set_attr("txt_button_start.enabled", str(True).lower())
while True: while True:
pass display.set_attr("txt_label_text.text", str(text))
display.set_attr("txt_status_indicator_green.active", str(active).lower())
display.set_attr("txt_status_indicator_red.active", str(not active).lower())
time.sleep(0.2)
def on_txt_button_start_clicked(event):
global started, text, active
started = True
display.button_clicked("txt_button_start", on_txt_button_start_clicked)
print('init variables...')
started = False started = False
text = 'Initialization' text = 'Initialization'
print('start display thread...')
threading.Thread(target=thread_display, daemon=True).start()
while True: while True:
pass text = 'Ready'
print('wait until START is pressed...')
while True:
if started:
break
time.sleep(0.010)
print('START pressed')
text = 'RUN'
while started:
active = True
time.sleep(1)
active = False
time.sleep(1)
time.sleep(0.01)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment