Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from qgis.core import *
- from qgis.utils import *
- from PyQt4.QtCore import *
- from PyQt4.QtGui import *
- devices_combo_box = qgis.utils.iface.mainWindow().findChild(QComboBox, 'mCboDevices')
- com_port = devices_combo_box.itemData(devices_combo_box.currentIndex()).toString()
- detector = QgsGPSDetector(com_port)
- QObject.connect(detector, SIGNAL("detected( QgsGPSConnection )"), self.connection_detected)
- QObject.connect(detector, SIGNAL("detectionFailed()"), self.connection_detection_failed)
- detector.advance()
- def connection_detected(self, gps_connection):
- QMessageBox.information(None, "Information", "Connection detected", QMessageBox.Ok)
- def connection_detection_failed(self):
- QMessageBox.information(None, "Information", "Connection detection failed", QMessageBox.Ok)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement