Advertisement
Guest User

Untitled

a guest
Jun 26th, 2013
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.78 KB | None | 0 0
  1. from qgis.core import *
  2. from qgis.utils import *
  3. from PyQt4.QtCore import *
  4. from PyQt4.QtGui import *
  5.  
  6. devices_combo_box = qgis.utils.iface.mainWindow().findChild(QComboBox, 'mCboDevices')
  7. com_port = devices_combo_box.itemData(devices_combo_box.currentIndex()).toString()
  8. detector = QgsGPSDetector(com_port)
  9. QObject.connect(detector, SIGNAL("detected( QgsGPSConnection )"), self.connection_detected)
  10. QObject.connect(detector, SIGNAL("detectionFailed()"), self.connection_detection_failed)
  11. detector.advance()
  12.  
  13. def connection_detected(self, gps_connection):
  14.     QMessageBox.information(None, "Information", "Connection detected", QMessageBox.Ok)
  15.  
  16. def connection_detection_failed(self):
  17.     QMessageBox.information(None, "Information", "Connection detection failed", QMessageBox.Ok)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement