-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.qml
125 lines (111 loc) · 2.74 KB
/
main.qml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
import QtQuick 2.0
import QtQuick.Controls 2.0
import QtQuick.Controls.Material 2.0
import PythonBackendLibrary 1.0
ApplicationWindow {
title: qsTr('QtQuick2 + rospy')
id: root
width: 450
height: 400
visible: true
Material.theme: Material.Light
Material.accent: Material.Indigo
Button {
id: publishButton
x: 100
y: 84
text: qsTr("Publish")
z: 4
enabled: true
anchors.rightMargin: 25
anchors.right: parent.right
highlighted: false
onClicked: {
backend.publish_string(publishTopicName.text, valueToPublish.text)
}
}
TextField {
id: publishTopicName
y: 25
height: 40
text: qsTr("/chatter")
z: 6
anchors.right: parent.right
anchors.rightMargin: 25
anchors.left: parent.left
anchors.leftMargin: 25
selectByMouse: true
}
TextField {
id: valueToPublish
y: 84
text: qsTr("Hello, World!")
z: 5
anchors.rightMargin: 148
anchors.right: parent.right
anchors.left: parent.left
anchors.leftMargin: 25
selectByMouse: true
}
Text {
id: sliderTopicName
y: 145
height: 34
text: qsTr("Publish data to /slider topic")
z: 3
anchors.right: parent.right
anchors.rightMargin: 25
anchors.left: parent.left
anchors.leftMargin: 25
font.letterSpacing: 0
verticalAlignment: Text.AlignVCenter
font.pixelSize: 24
}
Slider {
id: slider
y: 192
height: 40
anchors.right: parent.right
anchors.rightMargin: 25
anchors.left: parent.left
anchors.leftMargin: 25
value: 0.5
onValueChanged: {
backend.publish_slider(slider.value)
}
}
PythonBackend {
id: backend
onMsg_received: {
receivedData.text = received_data
}
}
Text {
id: subscribedTopicName
y: 253
height: 34
text: qsTr("Data received on chatter topic")
z: 3
anchors.right: parent.right
anchors.rightMargin: 25
anchors.left: parent.left
anchors.leftMargin: 25
font.letterSpacing: 0
verticalAlignment: Text.AlignVCenter
font.pixelSize: 24
}
Text {
id: receivedData
y: 301
height: 85
text: qsTr("Received data will appear here...")
z: 2
anchors.right: parent.right
anchors.rightMargin: 25
anchors.left: parent.left
anchors.leftMargin: 25
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
font.pointSize: 12
enabled: false
}
}