Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

having build some (two) minor plugins, it's now time for me to link a few (perl-) applications to qgis. As there is no perl-interface in qgis I thought the best way to link both worlds together is a kind of messaging system. It should work like tis:

  • the perl-app sends a message to a certain folder
  • qgis starts a separete loop which looks every second, whether there is an incoming message in that folder
  • Qgis performs the necessary stuff an deletes the message again.
  • Or vice versa.

My question is how to start such a loop in qgis and how to do this at qgis-startup.

By the way - is there a possibility to "automate" QGis from external python applications? And if so is there any example code?

Thanks and regards

share|improve this question

1 Answer 1

You can do this with a plugin, using a QTimer.

In the init method of the plugin:

self.timer = QTimer()
self.timer.timeout.connect(self.timer_fired)
self.timer.start(10000)

Then define the timer_fired method:

def timer_fired(self):
    QMessageBox.information(None, "Timer", "Timer Fired")

In this example, QGIS will popup a message box every 10 seconds. For this to work, obviously QGIS must be running and your plugin loaded.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.