def addToLayout(self, layout): filler = QLabel(self) label = QLabel(self) label.setText("Changes take affect only after restart.") layout.addWidget(label) formLayout = QFormLayout() formLayout.setAlignment(Qt.AlignTop) layout.addLayout(formLayout) self.nmeaButton = QRadioButton("nmea", self) formLayout.addRow(self.nmeaButton, filler) self.nmeaButton.setChecked(self.useNmea) label = QLabel(self) label.setText("GPS Device:") self.deviceText = QLineEdit(self) formLayout.addRow(label, self.deviceText) self.deviceText.setToolTip('NMEA GPS device path.') if self.device != None: self.deviceText.setText(self.device) self.gpsdButton = QRadioButton("gpsd", self) formLayout.addRow(self.gpsdButton, filler) self.gpsdButton.setChecked(self.useGpsd)
def addToWidget(self, hbox): form = QFormLayout() form.setAlignment(Qt.AlignLeft | Qt.AlignTop) hbox.addLayout(form) self.createGPSLabel(form, "Latitude", "") self.createGPSLabel(form, "Longitude", "") self.createGPSLabel(form, "Altitude", "") self.createGPSLabel(form, "Speed", "") self.createGPSLabel(form, "Track", "") vbox = QVBoxLayout() vbox.setAlignment(Qt.AlignTop | Qt.AlignRight) self.compassGauge = QtPngCompassGauge(self.canMonitor, "compass", "compass1.png") self.compassGauge.setValue(0) self.compassGauge.setMaximumSize(300, 300) vbox.addWidget(self.compassGauge) self.speedDisplay = self.createLCD(QLCDNumber.Dec) self.speedDisplay.display(0) vbox.addWidget(self.speedDisplay) distanceBox = QHBoxLayout() # distanceBox.setAlignment(Qt.AlignLeft|Qt.AlignTop) resetDistanceButton = QPushButton("Reset", self.canMonitor) resetDistanceButton.clicked.connect(self._resetDistance) distanceBox.addWidget(resetDistanceButton) self.distanceLocalDisplay = self.createLCD(QLCDNumber.Dec) self.distanceLocalDisplay.display(self.localDistance) distanceBox.addWidget(self.distanceLocalDisplay) vbox.addLayout(distanceBox) self.distanceGlobalDisplay = self.createLCD(QLCDNumber.Dec) self.distanceGlobalDisplay.display(self.globalDistance) vbox.addWidget(self.distanceGlobalDisplay) hbox.addLayout(vbox)