gws.plugin.qfieldcloud.core

QField project configuration and object.

Source code: gws.plugin.qfieldcloud.core

Module Contents

gws.plugin.qfieldcloud.core.db_field_name(name: str) → str

Model field name for a GeoPackage column name, the reverse of gp_field_name.

exception gws.plugin.qfieldcloud.core.DeltaApplyError

Bases: gws.Error

Raised when a delta payload cannot be applied.

class gws.plugin.qfieldcloud.core.DeltaStatus(*args, **kwargs)

Bases: gws.Data

Status of a delta, as returned to QField.

content: gws.plugin.qfieldcloud.api.Delta

Delta as sent by QField.

created_at: str

Creation time.

created_by: str

Login name of the user who sent the delta.

deltafile_id: str

Id of the delta payload.

id: str

Delta id.

output: str

Error message, if the delta could not be applied.

status: gws.plugin.qfieldcloud.api.DeltaStatusType

Delta status.

updated_at: str

Last update time.

gws.plugin.qfieldcloud.core.gp_field_name(name: str) → str

GeoPackage column name for a model field name. fid is renamed to fid_gws, because GDAL uses it internally.

class gws.plugin.qfieldcloud.core.ProjectConfig(*args, **kwargs)

Bases: gws.ConfigWithAccess

Project offered to QField, packaged from a QGIS project.

mapCacheLifeTime: gws.Duration = '0'

How long rendered offline base maps are reused.

models: list[gws.ext.config.model] | None

Data models for editable layers, matched by table name.

provider: gws.plugin.qgis.provider.Config

QGIS project the QField package is built from.

syncFiles: list[SyncFileConfig] | None

File fields whose content is sent to QField. (added in 8.5)

thumbnail: gws.FilePath | None

Thumbnail image shown in the project details. (added in 8.5)

title: str = ''

Project title shown in QField.

class gws.plugin.qfieldcloud.core.QfcProject

Bases: gws.Node

Project offered to QField.

Holds the QGIS provider of the source project, the models for editable layers and the base map settings used when the project is packaged.

mapCacheLifeTime: int

How long rendered base maps are reused, in seconds. 0 disables the cache.

models: list[gws.DatabaseModel]

Configured models for editable layers.

qgisProvider: gws.plugin.qgis.provider.Object

QGIS provider for the source project.

syncFiles: list[SyncFile]

File fields whose content is sent to QField.

thumbnail: str

Path to the thumbnail image, or an empty string.

title: str

Project title, the uid if no title is configured.

configure()

Configuration hook.

Called when the node is initialized. Raising an exception here aborts the creation of the node.

configure_sync_file(cfg: SyncFileConfig) → SyncFile

Find the file field for a syncFiles entry.

The columns are checked in the field config, because file fields set their column names in post_configure.

Parameters:

cfg – syncFiles entry.

Returns:

The file field and the blob flag.

Raises:

gws.ConfigurationError – If the name does not match exactly one file field in the project models, the field has no contentColumn, or has no nameColumn and useBlob is not set.

class gws.plugin.qfieldcloud.core.SyncFile(*args, **kwargs)

Bases: gws.Data

File field whose content is sent to QField.

field: gws.plugin.model_field.file.Object

File field.

model: gws.Model

Model the file field belongs to.

useBlob: bool

Send the content as a binary GeoPackage column, named after the contentColumn, instead of a file under the path in the nameColumn.

class gws.plugin.qfieldcloud.core.SyncFileConfig(*args, **kwargs)

Bases: gws.Config

File field whose content is sent to QField. (added in 8.5)

field: str

Name of a file field in the project models.

useBlob: bool = False

Send the content as a binary GeoPackage column instead of a file.