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

commit by robo pro coding

parent 03a78696
No related branches found
No related tags found
No related merge requests found
...@@ -42,7 +42,7 @@ TXTWindow { ...@@ -42,7 +42,7 @@ TXTWindow {
StatusIndicator { StatusIndicator {
id: txt_status_indicator_red id: txt_status_indicator_red
color: "#ff0000" color: "#ff0000"
active: true active: false
x: 140 x: 140
y: 100 y: 100
width: 50 width: 50
...@@ -51,10 +51,22 @@ TXTWindow { ...@@ -51,10 +51,22 @@ TXTWindow {
StatusIndicator { StatusIndicator {
id: txt_status_indicator_green id: txt_status_indicator_green
color: "#00FF02" color: "#00FF02"
active: true active: false
x: 50 x: 50
y: 100 y: 100
width: 50 width: 50
height: 50 height: 50
} }
TXTSlider {
id: txt_slider_delay
from: 1
value: 2
to: 5
orientation: Qt.Horizontal
enabled: false
x: 10
y: 5
width: 220
height: 40
}
} }
<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> <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>false</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>false</active><geometry><x>50</x><y>100</y><width>50</width><height>50</height></geometry></item><item id="6" class="TXTSlider"><name>txt_slider_delay</name><value>2</value><from>1</from><to>5</to><orientation>Qt.Horizontal</orientation><enabled>false</enabled><geometry><x>10</x><y>5</y><width>220</width><height>40</height></geometry></item></xml>
\ No newline at end of file \ No newline at end of file
This diff is collapsed.
...@@ -4,13 +4,15 @@ from lib.controller import * ...@@ -4,13 +4,15 @@ from lib.controller import *
from lib.display import * from lib.display import *
started = None started = None
delay_sec = None
text = None text = None
active = None active = None
def thread_display(): def thread_display():
global started, text, active global started, delay_sec, text, active
display.set_attr("txt_button_start.enabled", str(True).lower()) display.set_attr("txt_button_start.enabled", str(True).lower())
display.set_attr("txt_slider_delay.enabled", str(True).lower())
while True: while True:
display.set_attr("txt_label_text.text", str(text)) 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_green.active", str(active).lower())
...@@ -19,18 +21,28 @@ def thread_display(): ...@@ -19,18 +21,28 @@ def thread_display():
def on_txt_button_start_clicked(event): def on_txt_button_start_clicked(event):
global started, text, active global started, delay_sec, text, active
started = True started = True
print('START pressed')
def on_txt_slider_delay_moved(event):
global started, delay_sec, text, active
delay_sec = int(event['value'])
print('Delay changed')
display.button_clicked("txt_button_start", on_txt_button_start_clicked) display.button_clicked("txt_button_start", on_txt_button_start_clicked)
display.slider_moved("txt_slider_delay", on_txt_slider_delay_moved)
print('init variables...') print('init variables...')
started = False started = False
delay_sec = 1
text = 'Initialization' text = 'Initialization'
print('start display thread...') print('start display thread...')
threading.Thread(target=thread_display, daemon=True).start() threading.Thread(target=thread_display, daemon=True).start()
print('start loop')
while True: while True:
text = 'Ready' text = 'Ready'
print('wait until START is pressed...') print('wait until START is pressed...')
...@@ -38,13 +50,12 @@ while True: ...@@ -38,13 +50,12 @@ while True:
if started: if started:
break break
time.sleep(0.010) time.sleep(0.010)
print('START pressed')
text = 'RUN' text = 'RUN'
print('RUN')
while started: while started:
active = True active = True
time.sleep(1) time.sleep(delay_sec)
active = False active = False
time.sleep(1) time.sleep(delay_sec)
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