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.

I'm writing a QGIS conversion plugin in python to be able to create Obstacle-files for a model from shapefiles.

What I want to do now is just to close the plugin cleanly. This means, to close the GUI, to delete the variables and so on. I tried to use sys.exit(), but it also closes QGIS.

How do I only close the plugin?

share|improve this question
    
Consider using an object-oriented approach while coding your plugin. If you create your dialog and your (nested) functions as object, you can just delete (del) the whole object after computations finished. –  Curlew Jun 17 '13 at 21:45
add comment

1 Answer 1

If you are using a subclass of QWidget (e.g. a QDialog or QMainWindow) you can simply call the widget's close or hide method. If you want to free memory used by your variables you can delete them with del or set them to None and they will be garbage collected.

share|improve this answer
    
Hm, this does to close the GUI. Thanks for that! But for the variables, there has to be an easier way. I have some dozens of variables, that are created or not depending on different conditions. I would have to check for any of them if it was created and delete it or not...? –  dom Apr 19 '13 at 6:45
add comment

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.