Subgroup: Project

Class: QgsProjectArchive

class qgis.core.QgsProjectArchive

Bases: qgis._core.QgsArchive

Class allowing to manage the zip/unzip actions on project file

New in version 3.0: Methods

addFile Add a new file to this archive.
auxiliaryStorageFile Returns the current .qgd auxiliary storage file or an empty string if
clear Clear the current content of this archive and create a new temporary directory.
clearProjectFile Remove the current .qgs project file from the temporary directory.
dir Returns the current temporary directory.
files Returns the list of files within this archive
projectFile Returns the current .qgs project file or an empty string if there’s none
removeFile Remove a file from this archive and from the filesystem.
unzip Clear the current content of this archive and unzip.
zip Zip the content of this archive

Attributes

auxiliaryStorageFile(self) → str

Returns the current .qgd auxiliary storage file or an empty string if there’s none

clearProjectFile(self) → bool

Remove the current .qgs project file from the temporary directory.

Returns:true if the file is well removed, false otherwise
projectFile(self) → str

Returns the current .qgs project file or an empty string if there’s none

unzip(self, zipFilename: str) → bool

Clear the current content of this archive and unzip. If a project file is found in the content, then this archive may be considered as a valid one. Files are unzipped in the temporary directory.

Parameters:zipFilename – The zip file to unzip
Returns:true if a project file has been found, false otherwise