2 Copyright (C) 1997-2017 JDERobot Developers Team 4 This program is free software; you can redistribute it and/or modify 5 it under the terms of the GNU General Public License as published by 6 the Free Software Foundation; either version 2 of the License, or 7 (at your option) any later version. 9 This program is distributed in the hope that it will be useful, 10 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 GNU Library General Public License for more details. 14 You should have received a copy of the GNU General Public License 15 along with this program; if not, see <http://www.gnu.org/licenses/>. 17 Authors : Okan Asik (asik.okan@gmail.com) 21 from PyQt5.QtWidgets
import QDialog, QGroupBox, \
22 QLineEdit, QVBoxLayout, QHBoxLayout, QPushButton, \
23 QWidget, QApplication, QMessageBox
24 from PyQt5.QtCore
import pyqtSignal
25 from PyQt5.QtGui
import QFontDatabase
29 timeChanged = pyqtSignal(
'int')
35 timeContainer = QGroupBox()
36 timeContainer.setTitle(
'Time (ms)')
39 fixedWidthFont = QFontDatabase.systemFont(QFontDatabase.FixedFont)
40 self.lineEdit.setFont(fixedWidthFont)
41 self.lineEdit.setText(str(timeValue))
42 vLayout = QVBoxLayout()
46 self.cancelButton.setText(
'Cancel')
50 self.acceptButton.setText(
'Accept')
53 buttonContainer = QWidget()
54 hLayout = QHBoxLayout()
57 buttonContainer.setLayout(hLayout)
58 vLayout.addWidget(buttonContainer)
59 timeContainer.setLayout(vLayout)
61 vLayout2 = QVBoxLayout()
62 vLayout2.addWidget(timeContainer)
63 self.setLayout(vLayout2)
69 if self.lineEdit.text().isdigit():
70 self.timeChanged.emit(int(self.lineEdit.text()))
73 QMessageBox.warning(self,
'Input Error',
'Please input an integer in the box')
76 if __name__ ==
'__main__':
77 app = QApplication(sys.argv)
def __init__(self, name, timeValue)