def loadUI(self): # Load UI main_widget = load_ui( os.path.join(os.path.realpath(os.path.dirname(__file__)), 'CalibrationWidget.ui'), self) layout = QtGui.QVBoxLayout() layout.addWidget(main_widget) self.setLayout(layout) # Find references to controls self.nextButton = self.findChild(QtGui.QPushButton, "nextButton") self.cancelButton = self.findChild(QtGui.QPushButton, "cancelButton") self.progressBar = self.findChild(QtGui.QProgressBar, "progressBar") self.targetPointLabel = self.findChild(QtGui.QLabel, "targetPointLabel") self.targetImageLabel = self.findChild(QtGui.QLabel, "targetImageLabel") self.toolheadPosLabel = self.findChild(QtGui.QLabel, "toolheadPosLabel") self.hintLabel = self.findChild(QtGui.QLabel, "hintLabel") self.graphicsView = self.findChild(QtGui.QGraphicsView, "graphicsView") # Connect signals self.nextButton.clicked.connect(self.updateProgressBar) self.nextButton.clicked.connect(self.onNextButtonClicked) self.nextButton.setEnabled(False) self.hintLabel.setText("Please connect to the machine to start") self.cancelButton.clicked.connect(self.abort)
def loadUI(self): # Load UI file main_widget = load_ui(os.path.join(os.path.realpath(os.path.dirname(__file__)), 'TrajectoryWidget.ui'), self) layout = QtGui.QVBoxLayout() layout.addWidget(main_widget) self.setLayout(layout) # Find references to controls self.calibrationFileButton = self.findChild(QtGui.QToolButton, "calibrationFileButton") self.pointsFileButton = self.findChild(QtGui.QToolButton, "pointsFileButton") self.loadButton = self.findChild(QtGui.QPushButton, "loadButton") self.stopButton = self.findChild(QtGui.QPushButton, "stopButton") self.runButton = self.findChild(QtGui.QPushButton, "runButton") self.calibrationFileLineEdit = self.findChild(QtGui.QLineEdit, "calibrationFileLineEdit") self.pointsFileLineEdit = self.findChild(QtGui.QLineEdit, "pointsFileLineEdit") self.graphicsView = self.findChild(QtGui.QGraphicsView, "graphicsView") self.trajectoryComboBox = self.findChild(QtGui.QComboBox, "trajectoryComboBox") self.indexComboBox = self.findChild(QtGui.QComboBox, "indexComboBox") self.stepSpinBox = self.findChild(QtGui.QDoubleSpinBox, "stepSpinBox") self.xScaleSpinBox = self.findChild(QtGui.QDoubleSpinBox, "xScaleSpinBox") self.yScaleSpinBox = self.findChild(QtGui.QDoubleSpinBox, "yScaleSpinBox") self.xOffsetSpinBox = self.findChild(QtGui.QDoubleSpinBox, "xOffsetSpinBox") self.yOffsetSpinBox = self.findChild(QtGui.QDoubleSpinBox, "yOffsetSpinBox") # Set spinBox limits: float_max = sys.float_info.max self.stepSpinBox.setMaximum(float_max) self.xScaleSpinBox.setMaximum(float_max) self.yScaleSpinBox.setMaximum(float_max) self.xOffsetSpinBox.setMaximum(float_max) self.yOffsetSpinBox.setMaximum(float_max) self.stepSpinBox.setMinimum(0) self.xScaleSpinBox.setMinimum(0) self.yScaleSpinBox.setMinimum(0) self.xOffsetSpinBox.setMinimum(-float_max) self.yOffsetSpinBox.setMinimum(-float_max) # Connect signals self.calibrationFileButton.clicked.connect(self.onCalibrationButtonClicked) self.pointsFileButton.clicked.connect(self.onPointsButtonClicked) self.loadButton.clicked.connect(self.onLoadButtonClicked) self.stopButton.clicked.connect(self.onStopButtonClicked) self.runButton.clicked.connect(self.onRunButtonClicked) self.trajectoryComboBox.currentIndexChanged.connect(self.onTrajectorySelectedChanged) self.indexComboBox.currentIndexChanged.connect(self.updateImage) self.stepSpinBox.valueChanged.connect(self.updateImage) self.xOffsetSpinBox.valueChanged.connect(self.updateImage) self.yOffsetSpinBox.valueChanged.connect(self.updateImage) self.xScaleSpinBox.valueChanged.connect(self.updateImage) self.yScaleSpinBox.valueChanged.connect(self.updateImage) self.runButton.setEnabled(False) self.stopButton.setEnabled(False) self.setTrajectoryControlsEnabled(False) self.trajectory_controller.finished.connect(self.onTrajectoryFinish)
def loadUI(self): # Load UI main_widget = load_ui( os.path.join(os.path.realpath(os.path.dirname(__file__)), 'ControllerGUI.ui'), self) layout = QtGui.QVBoxLayout() layout.addWidget(main_widget) self.setLayout(layout) # Get references to widgets self.portComboBox = self.findChild(QtGui.QComboBox, "portComboBox") self.baudrateComboBox = self.findChild(QtGui.QComboBox, "baudrateComboBox") self.portRefreshButton = self.findChild(QtGui.QPushButton, "portRefreshButton") self.connectButton = self.findChild(QtGui.QPushButton, "connectButton") self.resetButton = self.findChild(QtGui.QPushButton, "resetButton") self.speedLineEdit = self.findChild(QtGui.QLineEdit, "speedLineEdit") self.homeButton = self.findChild(QtGui.QPushButton, "homeButton") self.leftButton = self.findChild(QtGui.QPushButton, "leftButton") self.rightButton = self.findChild(QtGui.QPushButton, "rightButton") self.upButton = self.findChild(QtGui.QPushButton, "upButton") self.downButton = self.findChild(QtGui.QPushButton, "downButton") self.precisionCheckBox = self.findChild(QtGui.QCheckBox, "precisionCheckBox") self.keyboardCheckBox = self.findChild(QtGui.QCheckBox, "keyboardCheckBox") self.toolsGroupBox = self.findChild(QtGui.QGroupBox, "toolsGroupBox") self.statusLabel = self.findChild(QtGui.QLabel, "statusLabel") self.xPosLabel = self.findChild(QtGui.QLabel, "xPosLabel") self.yPosLabel = self.findChild(QtGui.QLabel, "yPosLabel") # Connect things to UI slots to enable functionality self.set_available_ports() self.set_available_baudrates() self.portRefreshButton.clicked.connect(self.onPortButton) self.connectButton.clicked.connect(self.onConnectButton) self.resetButton.clicked.connect(self.onResetButton) self.speedLineEdit.setEnabled(False) self.homeButton.clicked.connect(self.onHomeButton) self.homeButton.setEnabled(False) self.setMoveControlsEnabled(False) self.upButton.clicked.connect(self.onMoveUpButton) self.downButton.clicked.connect(self.onMoveDownButton) self.leftButton.clicked.connect(self.onMoveLeftButton) self.rightButton.clicked.connect(self.onMoveRightButton) self.keyboardCheckBox.stateChanged.connect(self.setFocus) self.toolsGroupBox.setEnabled(False)
def loadUI(self): # Load UI main_widget = load_ui(os.path.join(os.path.realpath(os.path.dirname(__file__)), 'ControllerGUI.ui'), self) layout = QtGui.QVBoxLayout() layout.addWidget(main_widget) self.setLayout(layout) # Get references to widgets self.portComboBox = self.findChild(QtGui.QComboBox, "portComboBox") self.baudrateComboBox = self.findChild(QtGui.QComboBox, "baudrateComboBox") self.portRefreshButton = self.findChild(QtGui.QPushButton, "portRefreshButton") self.connectButton = self.findChild(QtGui.QPushButton, "connectButton") self.resetButton = self.findChild(QtGui.QPushButton, "resetButton") self.speedLineEdit = self.findChild(QtGui.QLineEdit, "speedLineEdit") self.homeButton = self.findChild(QtGui.QPushButton, "homeButton") self.leftButton = self.findChild(QtGui.QPushButton, "leftButton") self.rightButton = self.findChild(QtGui.QPushButton, "rightButton") self.upButton = self.findChild(QtGui.QPushButton, "upButton") self.downButton = self.findChild(QtGui.QPushButton, "downButton") self.precisionCheckBox = self.findChild(QtGui.QCheckBox, "precisionCheckBox") self.keyboardCheckBox = self.findChild(QtGui.QCheckBox, "keyboardCheckBox") self.toolsGroupBox = self.findChild(QtGui.QGroupBox, "toolsGroupBox") self.statusLabel = self.findChild(QtGui.QLabel, "statusLabel") self.xPosLabel = self.findChild(QtGui.QLabel, "xPosLabel") self.yPosLabel = self.findChild(QtGui.QLabel, "yPosLabel") # Connect things to UI slots to enable functionality self.set_available_ports() self.set_available_baudrates() self.portRefreshButton.clicked.connect(self.onPortButton) self.connectButton.clicked.connect(self.onConnectButton) self.resetButton.clicked.connect(self.onResetButton) self.speedLineEdit.setEnabled(False) self.homeButton.clicked.connect(self.onHomeButton) self.homeButton.setEnabled(False) self.setMoveControlsEnabled(False) self.upButton.clicked.connect(self.onMoveUpButton) self.downButton.clicked.connect(self.onMoveDownButton) self.leftButton.clicked.connect(self.onMoveLeftButton) self.rightButton.clicked.connect(self.onMoveRightButton) self.keyboardCheckBox.stateChanged.connect(self.setFocus) self.toolsGroupBox.setEnabled(False)
def loadUI(self): # Load UI main_widget = load_ui(os.path.join(os.path.realpath(os.path.dirname(__file__)), 'CalibrationWidget.ui'), self) layout = QtGui.QVBoxLayout() layout.addWidget(main_widget) self.setLayout(layout) # Find references to controls self.nextButton = self.findChild(QtGui.QPushButton, "nextButton") self.cancelButton = self.findChild(QtGui.QPushButton, "cancelButton") self.progressBar = self.findChild(QtGui.QProgressBar, "progressBar") self.targetPointLabel = self.findChild(QtGui.QLabel, "targetPointLabel") self.targetImageLabel = self.findChild(QtGui.QLabel, "targetImageLabel") self.toolheadPosLabel = self.findChild(QtGui.QLabel, "toolheadPosLabel") self.hintLabel = self.findChild(QtGui.QLabel, "hintLabel") self.graphicsView = self.findChild(QtGui.QGraphicsView, "graphicsView") # Connect signals self.nextButton.clicked.connect(self.updateProgressBar) self.nextButton.clicked.connect(self.onNextButtonClicked) self.nextButton.setEnabled(False) self.hintLabel.setText("Please connect to the machine to start") self.cancelButton.clicked.connect(self.abort)
def loadUI(self): # Load UI file main_widget = load_ui( os.path.join(os.path.realpath(os.path.dirname(__file__)), 'TrajectoryWidget.ui'), self) layout = QtGui.QVBoxLayout() layout.addWidget(main_widget) self.setLayout(layout) # Find references to controls self.calibrationFileButton = self.findChild(QtGui.QToolButton, "calibrationFileButton") self.pointsFileButton = self.findChild(QtGui.QToolButton, "pointsFileButton") self.loadButton = self.findChild(QtGui.QPushButton, "loadButton") self.stopButton = self.findChild(QtGui.QPushButton, "stopButton") self.runButton = self.findChild(QtGui.QPushButton, "runButton") self.calibrationFileLineEdit = self.findChild( QtGui.QLineEdit, "calibrationFileLineEdit") self.pointsFileLineEdit = self.findChild(QtGui.QLineEdit, "pointsFileLineEdit") self.graphicsView = self.findChild(QtGui.QGraphicsView, "graphicsView") self.trajectoryComboBox = self.findChild(QtGui.QComboBox, "trajectoryComboBox") self.indexComboBox = self.findChild(QtGui.QComboBox, "indexComboBox") self.stepSpinBox = self.findChild(QtGui.QDoubleSpinBox, "stepSpinBox") self.xScaleSpinBox = self.findChild(QtGui.QDoubleSpinBox, "xScaleSpinBox") self.yScaleSpinBox = self.findChild(QtGui.QDoubleSpinBox, "yScaleSpinBox") self.xOffsetSpinBox = self.findChild(QtGui.QDoubleSpinBox, "xOffsetSpinBox") self.yOffsetSpinBox = self.findChild(QtGui.QDoubleSpinBox, "yOffsetSpinBox") # Set spinBox limits: float_max = sys.float_info.max self.stepSpinBox.setMaximum(float_max) self.xScaleSpinBox.setMaximum(float_max) self.yScaleSpinBox.setMaximum(float_max) self.xOffsetSpinBox.setMaximum(float_max) self.yOffsetSpinBox.setMaximum(float_max) self.stepSpinBox.setMinimum(0) self.xScaleSpinBox.setMinimum(0) self.yScaleSpinBox.setMinimum(0) self.xOffsetSpinBox.setMinimum(-float_max) self.yOffsetSpinBox.setMinimum(-float_max) # Connect signals self.calibrationFileButton.clicked.connect( self.onCalibrationButtonClicked) self.pointsFileButton.clicked.connect(self.onPointsButtonClicked) self.loadButton.clicked.connect(self.onLoadButtonClicked) self.stopButton.clicked.connect(self.onStopButtonClicked) self.runButton.clicked.connect(self.onRunButtonClicked) self.trajectoryComboBox.currentIndexChanged.connect( self.onTrajectorySelectedChanged) self.indexComboBox.currentIndexChanged.connect(self.updateImage) self.stepSpinBox.valueChanged.connect(self.updateImage) self.xOffsetSpinBox.valueChanged.connect(self.updateImage) self.yOffsetSpinBox.valueChanged.connect(self.updateImage) self.xScaleSpinBox.valueChanged.connect(self.updateImage) self.yScaleSpinBox.valueChanged.connect(self.updateImage) self.runButton.setEnabled(False) self.stopButton.setEnabled(False) self.setTrajectoryControlsEnabled(False) self.trajectory_controller.finished.connect(self.onTrajectoryFinish)