Hi,
in a QGIS-plugin I need to read a template project file (*.qgs), modify it to
adapt it to the currently loaded database
etc. using xml.etree.ElementTree, write it and read it again.
....
qgsxml.write(projectfile) # writemodified project file
project = QgsProject.instance()
project.read(QFileInfo(projectfile)) # read the new project file
projectfilecontains the name of the new *.qgs projectfile
First attempt is successful, the second fails (groups are loaded but there are
no layers), third attempt is successful,
fourth fails and so on...
Everything works fine when I use the menu "project > new" before starting the
plugin.
Have i done something wrong?
Best wishes
Jörg
FH Aachen
Prof. Dr.-Ing. Jörg Höttges
Fachbereich 2 - Bauingenieurwesen
Wasserwirtschaft und Bauinformatik
FH Aachen
University of Applied Sciences
Bayernallee 9
52066 Aachen | Germany
T +49 (0)241 6009-51176
F +49 (0)241 6009-51206
http://www.fh-aachen.de/hoettges/
[email protected] <mailto:[email protected]>
_______________________________________________
QGIS-Developer mailing list
[email protected]
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer