project dirtying for the lifetime of an object
Python code can then call:
project = QgsProject.instance()
with QgsProject.blockDirtying(project):
# do something
Use QgsProjectDirtyBlocker to prevent projects being marked as
dirty while creating a new project or while loading an existing
project -- avoids the titlebar temporarily showing the project
state as unsaved while it is being loaded.
This allows the project home path (which is used by the browser
to create the 'Project Home' item) to be set by users for a
project, instead of always matching the location where the project
is saved.
This allows users to set the project home to a folder which contains
data and other content, and is especially useful for organisations
where qgis projects are not stored in the root folder of a organisational
'project'.
Project home paths can also be set to relative paths, in which
case they will be relative to the project saved location.
The path can be set through the Project Properties dialog, or
by right-clicking on the Project Home browser item and
selecting 'set project home'
Sponsored by SMEC/SJ