Subgroup: Read

Class: QgsReadWriteContext

class qgis.core.QgsReadWriteContext

Bases: sip.wrapper

Constructor for QgsReadWriteContext.

QgsReadWriteContext(QgsReadWriteContext)

The class is used as a container of context for various read/write operations on other objects.

New in version 3.0: Methods

pathResolver Returns path resolver for conversion between relative and absolute paths
projectTranslator Returns the project translator
pushMessage Append a message to the context
setPathResolver Sets up path resolver for conversion between relative and absolute paths
setProjectTranslator Sets the project translator.
takeMessages Returns the stored messages and remove them

Signals

Attributes

class ReadWriteMessage(message: str, level: Qgis.MessageLevel = Qgis.Warning, categories: Iterable[str] = [])

Bases: sip.wrapper

Construct a container for QgsReadWriteContext error or warning messages

QgsReadWriteContext.ReadWriteMessage(QgsReadWriteContext.ReadWriteMessage)

categories(self) → List[str]

Returns the stack of categories of the message

level(self) → Qgis.MessageLevel

Returns the message level

message(self) → str

Returns the message string

enterCategory

alias of qgis.core.additions.readwritecontextentercategory.ReadWriteContextEnterCategory

pathResolver(self) → QgsPathResolver

Returns path resolver for conversion between relative and absolute paths

projectTranslator(self) → QgsProjectTranslator

Returns the project translator

New in version 3.4.

pushMessage(self, message: str, level: Qgis.MessageLevel = Qgis.Warning)

Append a message to the context

New in version 3.2.

setPathResolver(self, resolver: QgsPathResolver)

Sets up path resolver for conversion between relative and absolute paths

setProjectTranslator(self, projectTranslator: QgsProjectTranslator)

Sets the project translator. Means it shouldn’t conform mDefaultTranslator anymore. It’s usually the QgsProject where the function with the context is made and won’t be changed anymore.

New in version 3.4.

takeMessages(self) → object

Returns the stored messages and remove them

New in version 3.2.