Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
RoboMission_display_start
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
fischertechnik examples
STEM Coding RoboMission
RoboMission_display_start
Commits
d03f1940
Commit
d03f1940
authored
4 months ago
by
ft-Demo
Browse files
Options
Downloads
Patches
Plain Diff
commit by robo pro coding
parent
03a78696
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
lib/display.qml
+14
-2
14 additions, 2 deletions
lib/display.qml
lib/display.xml
+1
-1
1 addition, 1 deletion
lib/display.xml
test_display_start.blockly
+169
-111
169 additions, 111 deletions
test_display_start.blockly
test_display_start.py
+17
-6
17 additions, 6 deletions
test_display_start.py
with
201 additions
and
120 deletions
lib/display.qml
+
14
−
2
View file @
d03f1940
...
@@ -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
:
tru
e
active
:
fals
e
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
:
tru
e
active
:
fals
e
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
}
}
}
This diff is collapsed.
Click to expand it.
lib/display.xml
+
1
−
1
View file @
d03f1940
<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.
Click to expand it.
test_display_start.blockly
+
169
−
111
View file @
d03f1940
This diff is collapsed.
Click to expand it.
test_display_start.py
+
17
−
6
View file @
d03f1940
...
@@ -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
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment