-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCustomTimeDialog.py
46 lines (36 loc) · 1.53 KB
/
CustomTimeDialog.py
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
from PyQt5 import QtCore, QtWidgets
class CustomTimeDialog(QtWidgets.QDialog):
def __init__(self, parentWindow):
super().__init__()
self.parentWindow = parentWindow
self.init_ui()
def init_ui(self):
self.setWindowTitle('Set Start Moving Time')
layout = QtWidgets.QVBoxLayout()
self.checkbox = QtWidgets.QCheckBox("Do you want to set a custom start moving time?")
self.label = QtWidgets.QLabel('Insert the timestamp from which the rover started moving:')
self.textbox = QtWidgets.QLineEdit()
self.textbox.setText(self.parentWindow.startMovingTime)
layout.addWidget(self.checkbox)
layout.addWidget(self.label)
layout.addWidget(self.textbox)
self.ok_button = QtWidgets.QPushButton('OK')
self.ok_button.clicked.connect(self.close_dialog)
layout.addWidget(self.ok_button)
self.label.setVisible(False)
self.textbox.setVisible(False)
self.checkbox.stateChanged.connect(self.show_hide)
self.setLayout(layout)
def show_hide(self, state):
if state == QtCore.Qt.Checked:
self.label.setVisible(True)
self.textbox.setVisible(True)
self.parentWindow.isStartMovingTimeSet = True
else:
self.label.setVisible(False)
self.textbox.setVisible(False)
self.parentWindow.isStartMovingTimeSet = False
def close_dialog(self):
text = self.textbox.text()
self.parentWindow.startMovingTime = text
self.close()