[Qgis-developer] Python support in project file

Giuseppe Sucameli brush.tyler at gmail.com
Wed May 23 12:24:11 PDT 2012


Hi all,

I started to work on adding python support in project files (see [1]).

I've added a new tab "Project routines" to the project properties dialog
where the user can define 3 different python routines:

one is executed when the project is loaded,
the next one when the project is saved,
and the last one when the project is closed (saved or not).

I'm also adding a safe-check, it asks to the user if enabling them.

I've few questions:

1. In [1] Martin wrote: """The routines should be able to access QGIS
application with the use of the interface in the same way how plugins do""".
I'm wondering if those routines must be functions with a specific signature
or they could just access the QGis interface using the qgis.utils.iface
since I'll use the QgsPythonRunner to run them.

2. In a loaded project with trusted scripts (the user has trusted them)
if the user changes their definitions from project properties dialog
2.a. should the new routines become active immediately when the user
clicks on the apply button in the project properies dialog,
2.b. or should become active when he saves the project (the new
projectSaved script has to be called just after the project is saved),
2.c. or should I keep the previous ones until the project is reloaded?

3. should I call them project-embedded-scripts or routines??? :)

Opinions are welcome.
Cheers.

[1] http://hub.qgis.org/wiki/quantum-gis/Google_Summer_of_Code_2012#Python-Support-in-Project-Files

-- 
Giuseppe Sucameli


More information about the Qgis-developer mailing list