Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
self.focusCalibButton.clicked.connect(self.focusCalib.start)
self.focusCalibThread.start()
try:
prevCal = np.around(np.loadtxt('calibration')[0]/10)
text = '0,1 mV --> {} nm'.format(prevCal)
self.calibrationDisplay = QtGui.QLineEdit(text)
except:
self.calibrationDisplay = QtGui.QLineEdit('0 mV --> 0 nm')
self.calibrationDisplay.setReadOnly(False)
# Focus lock widgets
self.kpEdit = QtGui.QLineEdit('-0.002')
self.kpEdit.textChanged.connect(self.unlockFocus)
self.kpLabel = QtGui.QLabel('kp')
self.kiEdit = QtGui.QLineEdit('-0.000006')
self.kiEdit.textChanged.connect(self.unlockFocus)
self.kiLabel = QtGui.QLabel('ki')
self.lockButton = QtGui.QPushButton('Lock')
self.lockButton.setCheckable(True)
self.lockButton.clicked.connect(self.toggleFocus)
self.lockButton.setSizePolicy(QtGui.QSizePolicy.Preferred,
QtGui.QSizePolicy.Expanding)
self.focusDataBox = QtGui.QCheckBox('Save focus data')
self.focusPropertiesDisplay = QtGui.QLabel(' st_dev = 0 max_dev = 0')
self.ProcessData = ProcessData(self.webcam)
self.graph = FocusLockGraph(self, main)
self.webcamgraph = WebcamGraph(self)
# Configure PyQtGraph to use black plots on a transparent background.
pg.setConfigOption('background',(0,0,0,0))
pg.setConfigOption('foreground', 'k')
#
# GPS Telemetry Data Frame
#
gpsFrame = QtGui.QFrame()
gpsFrame.setFixedSize(250,250)
gpsFrame.setFrameStyle(QtGui.QFrame.Box)
gpsFrame.setLineWidth(2)
gpsFrameTitle = QtGui.QLabel("<b><u>GPS Data</u></b>")
gpsTime = QtGui.QLabel("<b>Time:</b>")
gpsTimeValue = QtGui.QLabel("00:00:00")
gpsLatitude = QtGui.QLabel("<b>Latitude:</b>")
gpsLatitudeValue = QtGui.QLabel("-00.00000")
gpsLongitude = QtGui.QLabel("<b>Longitude:</b>")
gpsLongitudeValue = QtGui.QLabel("000.00000")
gpsAltitude = QtGui.QLabel("<b>Altitude:</b>")
gpsAltitudeValue = QtGui.QLabel("00000m")
gpsSpeed = QtGui.QLabel("<b>Speed</b>")
gpsSpeedValue = QtGui.QLabel("H 000kph V 0.0m/s")
gpsHeading = QtGui.QLabel("<b>Heading:</b>")
gpsHeadingValue = QtGui.QLabel("-")
gpsSats = QtGui.QLabel("<b>Satellites:</b>")
gpsSatsValue = QtGui.QLabel("0")
gpsFixValid = QtGui.QLabel("<b>Fix Status:</b>")
gpsFixValidValue = QtGui.QLabel("-")
gpsFrameLayout = QtGui.QGridLayout()
gpsFrameLayout.addWidget(gpsFrameTitle,0,0,1,2)
self.verticalLayout_13.addWidget(self.label_119)
self.label_120 = QtGui.QLabel(self.scrollAreaWidgetContentsDis_2)
self.label_120.setObjectName(_fromUtf8("label_120"))
self.verticalLayout_13.addWidget(self.label_120)
self.label_121 = QtGui.QLabel(self.scrollAreaWidgetContentsDis_2)
self.label_121.setObjectName(_fromUtf8("label_121"))
self.verticalLayout_13.addWidget(self.label_121)
self.label_122 = QtGui.QLabel(self.scrollAreaWidgetContentsDis_2)
self.label_122.setObjectName(_fromUtf8("label_122"))
self.verticalLayout_13.addWidget(self.label_122)
self.label_123 = QtGui.QLabel(self.scrollAreaWidgetContentsDis_2)
self.label_123.setObjectName(_fromUtf8("label_123"))
self.verticalLayout_13.addWidget(self.label_123)
self.scrollAreaDis_2.setWidget(self.scrollAreaWidgetContentsDis_2)
self.gridLayout_45.addWidget(self.scrollAreaDis_2, 3, 3, 1, 1)
self.label_129 = QtGui.QLabel(self.dockWidgetContents)
font = QtGui.QFont()
font.setBold(True)
font.setWeight(75)
self.label_129.setFont(font)
self.label_129.setObjectName(_fromUtf8("label_129"))
self.gridLayout_45.addWidget(self.label_129, 4, 0, 1, 2)
self.toolBox_2 = QtGui.QToolBox(self.dockWidgetContents)
self.toolBox_2.setObjectName(_fromUtf8("toolBox_2"))
self.page_3 = QtGui.QWidget()
self.page_3.setGeometry(QtCore.QRect(0, 0, 196, 73))
self.page_3.setObjectName(_fromUtf8("page_3"))
self.gridLayout_41 = QtGui.QGridLayout(self.page_3)
self.gridLayout_41.setObjectName(_fromUtf8("gridLayout_41"))
self.label_60 = QtGui.QLabel(self.page_3)
self.label_60.setObjectName(_fromUtf8("label_60"))
self.gridLayout_41.addWidget(self.label_60, 2, 0, 1, 1)
self.dock_buttons_parent = QtGui.QWidget()
self.dock_buttons_parent.setLayout(QtGui.QHBoxLayout())
self.dock_buttons.addWidget(self.dock_buttons_parent)
# Build axis buttons
self.axis_container = QtGui.QWidget()
self.axis_container.setLayout(QtGui.QGridLayout())
self.cb_xaxis_label = QtGui.QLabel('X axis : ')
self.axis_container.layout().addWidget(self.cb_xaxis_label, 0, 0)
self.cb_xaxis = QtGui.QComboBox()
self.axis_container.layout().addWidget(self.cb_xaxis, 0, 1)
self.cb_yaxis_label = QtGui.QLabel('Y axis : ')
self.axis_container.layout().addWidget(self.cb_yaxis_label, 1, 0)
self.cb_yaxis = QtGui.QComboBox()
self.axis_container.layout().addWidget(self.cb_yaxis, 1, 1)
self.setup_axis_buttons_label()
self.cb_xaxis.currentIndexChanged.connect(self.set_xaxis)
self.cb_yaxis.currentIndexChanged.connect(self.set_yaxis)
self.dock_buttons_parent.layout().addWidget(self.axis_container)
# Build undo / redo buttons
self.history_container = QtGui.QWidget()
self.history_container.setLayout(QtGui.QGridLayout())
pass
#
# IMU Telemetry Data Frame
#
imuFrame = QtGui.QFrame()
imuFrame.setFixedSize(250,250)
imuFrame.setFrameStyle(QtGui.QFrame.Box)
imuFrame.setLineWidth(2)
imuFrameTitle = QtGui.QLabel("<b><u>IMU Data</u></b>")
imuTime = QtGui.QLabel("<b>Time:</b>")
imuTimeValue = QtGui.QLabel("00:00:00")
imuTemp = QtGui.QLabel("<b>Temp:</b>")
imuTempValue = QtGui.QLabel("0 deg C")
imuCalStatus = QtGui.QLabel("<b>Calibration Status</b>")
imuCalStatus_System = QtGui.QLabel("<u>System</u>")
imuCalStatus_System_OK = QtGui.QLabel("?")
imuCalStatus_Gyro = QtGui.QLabel("<u>Gyro</u>")
imuCalStatus_Gyro_OK = QtGui.QLabel("?")
imuCalStatus_Accel = QtGui.QLabel("<u>Accel</u>")
imuCalStatus_Accel_OK =QtGui.QLabel("?")
imuCalStatus_Magnet = QtGui.QLabel("<u>Mag</u>")
imuCalStatus_Magnet_OK = QtGui.QLabel("?")
imuEulerLabel = QtGui.QLabel("<b><u>Euler Angles</u></b>")
imuEulerHeadingLabel = QtGui.QLabel("<b>Heading</b>")
imuEulerHeadingValue = QtGui.QLabel("0 deg")
imuEulerRollLabel = QtGui.QLabel("<b>Roll</b>")
imuEulerRollValue = QtGui.QLabel("0 deg")
imuEulerPitchLabel = QtGui.QLabel("<b>Pitch</b>")
imuEulerPitchValue = QtGui.QLabel("0 deg")
def initNMFControls(self):
self.nmfControlsLayout = QtGui.QHBoxLayout()
self.nmfControlsLayout.addStretch(1)
self.nmfControlsLayout.addWidget(QtGui.QLabel('Dictionary Size:'))
self.dictionarySizeDropDown = QtGui.QComboBox()
for dictionarySize in self.dictionarySizes:
self.dictionarySizeDropDown.addItem( str(dictionarySize) )
self.dictionarySizeDropDown.setMaximumWidth(75)
self.dictionarySizeDropDown.setCurrentIndex(self.dictionarySizes.index(self.dictionarySize))
self.dictionarySizeDropDown.currentIndexChanged.connect(self.dictionarySizeChanged)
self.nmfControlsLayout.addWidget(self.dictionarySizeDropDown)
self.nmfControlsLayout.addStretch(1)
self.nmfControlsLayout.addWidget(QtGui.QLabel('Num Updates:'))
self.numHUpdatesSpinBox = QtGui.QSpinBox()
self.nmfControlsLayout.addWidget(self.numHUpdatesSpinBox)
self.nmfControlsLayout.addStretch(1)
def set_components(self, str_colour_pairs):
''' colours are tri-tupples of rgb '''
for pair in str_colour_pairs:
s = pair[0]
c = pair[1]
lbl = QtGui.QLabel(self.ui.scrollAreaWidgetContents)
lbl.setText(s)
lbl.setStyleSheet("color: rgb(%d, %d, %d);" % c)
self.ui.labels.append(lbl)
self.ui.vlayout.addWidget(lbl)
self.ui.vlayout.addItem(self.ui.spacerItem)
def initLocalizationControls(self):
self.localizationControlsLayout = QtGui.QHBoxLayout()
self.localizationControlsLayout.addStretch(3)
self.localizationCheckBox = QtGui.QCheckBox('Enable Localization')
self.localizationCheckBox.setChecked(self.localizationEnabled)
self.localizationCheckBox.stateChanged.connect(self.localizationStateChanged)
self.localizationControlsLayout.addWidget(self.localizationCheckBox)
self.localizationControlsLayout.addStretch(1)
self.localizationWindowSizeLabel = QtGui.QLabel('Sliding Window Size:')
self.localizationControlsLayout.addWidget(self.localizationWindowSizeLabel)
self.localziaitonWindowSizeSpinBox = QtGui.QSpinBox()
self.localziaitonWindowSizeSpinBox.setMinimum(1)
self.localziaitonWindowSizeSpinBox.setMaximum(128)
self.localziaitonWindowSizeSpinBox.setValue(self.localizationWindowSize)
self.localziaitonWindowSizeSpinBox.valueChanged.connect(self.localizationParamsChanged)
self.localizationControlsLayout.addWidget(self.localziaitonWindowSizeSpinBox)
self.localizationControlsLayout.addStretch(3)
# Configure PyQtGraph to use black plots on a transparent background.
pg.setConfigOption('background',(0,0,0,0))
pg.setConfigOption('foreground', 'k')
#
# GPS Telemetry Data Frame
#
gpsFrame = QtGui.QFrame()
gpsFrame.setFixedSize(250,250)
gpsFrame.setFrameStyle(QtGui.QFrame.Box)
gpsFrame.setLineWidth(2)
gpsFrameTitle = QtGui.QLabel("<b><u>GPS Data</u></b>")
gpsTime = QtGui.QLabel("<b>Time:</b>")
gpsTimeValue = QtGui.QLabel("00:00:00")
gpsLatitude = QtGui.QLabel("<b>Latitude:</b>")
gpsLatitudeValue = QtGui.QLabel("-00.00000")
gpsLongitude = QtGui.QLabel("<b>Longitude:</b>")
gpsLongitudeValue = QtGui.QLabel("000.00000")
gpsAltitude = QtGui.QLabel("<b>Altitude:</b>")
gpsAltitudeValue = QtGui.QLabel("00000m")
gpsSpeed = QtGui.QLabel("<b>Speed</b>")
gpsSpeedValue = QtGui.QLabel("H 000kph V 0.0m/s")
gpsHeading = QtGui.QLabel("<b>Heading:</b>")
gpsHeadingValue = QtGui.QLabel("-")
gpsSats = QtGui.QLabel("<b>Satellites:</b>")
gpsSatsValue = QtGui.QLabel("0")
gpsFixValid = QtGui.QLabel("<b>Fix Status:</b>")
gpsFixValidValue = QtGui.QLabel("-")
gpsFrameLayout = QtGui.QGridLayout()
gpsFrameLayout.addWidget(gpsFrameTitle,0,0,1,2)
gpsFrameLayout.addWidget(gpsTime,1,0)
self.scrollAreaDis_2.setObjectName(_fromUtf8("scrollAreaDis_2"))
self.scrollAreaWidgetContentsDis_2 = QtGui.QWidget()
self.scrollAreaWidgetContentsDis_2.setGeometry(QtCore.QRect(0, 0, 181, 246))
self.scrollAreaWidgetContentsDis_2.setObjectName(_fromUtf8("scrollAreaWidgetContentsDis_2"))
self.verticalLayout_13 = QtGui.QVBoxLayout(self.scrollAreaWidgetContentsDis_2)
self.verticalLayout_13.setObjectName(_fromUtf8("verticalLayout_13"))
self.label_115 = QtGui.QLabel(self.scrollAreaWidgetContentsDis_2)
self.label_115.setObjectName(_fromUtf8("label_115"))
self.verticalLayout_13.addWidget(self.label_115)
self.label_116 = QtGui.QLabel(self.scrollAreaWidgetContentsDis_2)
self.label_116.setObjectName(_fromUtf8("label_116"))
self.verticalLayout_13.addWidget(self.label_116)
self.label_117 = QtGui.QLabel(self.scrollAreaWidgetContentsDis_2)
self.label_117.setObjectName(_fromUtf8("label_117"))
self.verticalLayout_13.addWidget(self.label_117)
self.label_118 = QtGui.QLabel(self.scrollAreaWidgetContentsDis_2)
self.label_118.setObjectName(_fromUtf8("label_118"))
self.verticalLayout_13.addWidget(self.label_118)
self.label_119 = QtGui.QLabel(self.scrollAreaWidgetContentsDis_2)
self.label_119.setObjectName(_fromUtf8("label_119"))
self.verticalLayout_13.addWidget(self.label_119)
self.label_120 = QtGui.QLabel(self.scrollAreaWidgetContentsDis_2)
self.label_120.setObjectName(_fromUtf8("label_120"))
self.verticalLayout_13.addWidget(self.label_120)
self.label_121 = QtGui.QLabel(self.scrollAreaWidgetContentsDis_2)
self.label_121.setObjectName(_fromUtf8("label_121"))
self.verticalLayout_13.addWidget(self.label_121)
self.label_122 = QtGui.QLabel(self.scrollAreaWidgetContentsDis_2)
self.label_122.setObjectName(_fromUtf8("label_122"))
self.verticalLayout_13.addWidget(self.label_122)
self.label_123 = QtGui.QLabel(self.scrollAreaWidgetContentsDis_2)
self.label_123.setObjectName(_fromUtf8("label_123"))