Commit 34b8ec6f authored by Maxime Perrotin's avatar Maxime Perrotin

Timeout to close dialog if user does not react

parent 8ed31b01
......@@ -823,15 +823,20 @@ class sdlHandler(QObject):
to let the user decide if continuous signals shall be processed '''
# res is of type ctypes.POINTER(c_int) -> res[0]=0 to set False,
# meaning that there is no message pending in the queue
ans = -1
def timeout(question):
question.close()
question = QMessageBox(self.parent,
'Evaluate Continuous States', '')
question.setText('Do you want to send a new message'
' or evaluate continuous signals (default)?')
question.setText('Do you want to send a new message or evaluate '
'evaluate continuous signals (default in 3 sec)?')
question.addButton('Send message', QMessageBox.AcceptRole)
question.addButton('Evaluate continuous signals',
QMessageBox.RejectRole)
ans = question.exec_()
if ans == QMessageBox.AcceptRole:
QTimer().singleShot(3000, partial(timeout, question))
_ = question.exec_()
if question.result() == QMessageBox.AcceptRole:
res[0] = 1
else:
res[0] = 0
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment