gws.plugin.qfield.core

Qfield reader and writer.

Source code: gws.plugin.qfield.core

Module Contents

class gws.plugin.qfield.core.EditAction

Bases: gws.Enum

Enumeration type.

Despite being declared as extending Enum (for IDE support), this class is actually just a simple object and intended to be used as a collection of attributes. It doesn’t provide any Enum-specific utilities.

The rationale behind this is that we need Enum members (e.g. Color.RED) to be scalars, and not complex objects as in the standard Enum.

delete = 'delete'
geometryUpdate = 'geometryUpdate'
insert = 'insert'
update = 'update'
class gws.plugin.qfield.core.EditOperation(*args, **kwargs)

Bases: gws.Data

Basic data object.

This object can be instantiated by passing one or or dict arguments and/or keyword args. All dicts keys and keywords become attributes of the object.

Accessing an undefined attribute returns None and no error is raised, unless the attribute name starts with an underscore.

action: EditAction
attributes: dict
columnName: str
fid: int
pkey: str
class gws.plugin.qfield.core.ExportArgs(*args, **kwargs)

Bases: gws.Data

Basic data object.

This object can be instantiated by passing one or or dict arguments and/or keyword args. All dicts keys and keywords become attributes of the object.

Accessing an undefined attribute returns None and no error is raised, unless the attribute name starts with an underscore.

baseDir: str
dbFileName: str
dbPath: str
package: Package
project: gws.Project
qgisFileName: str
user: gws.User
withBaseMap: bool
withData: bool
withMedia: bool
withQgis: bool
class gws.plugin.qfield.core.Exporter
args: ExportArgs
deviceDbPath: str
localDbPath: str
package: Package
project: gws.Project
qfCaps: QFieldCaps
sourceQgisProject: gws.plugin.qgis.project.Object
targetQgisPath: str
user: gws.User
prepare(args: ExportArgs)
replace_vars(s: str) str
run(args: ExportArgs)
write_base_map()
write_base_map_layer(le: LayerEntry)
write_data()
write_features(me: ModelEntry, ds: gws.gis.gdalx.VectorDataSet)
write_media()
write_offline_log()
write_qgis_project()
gws.plugin.qfield.core.GPKG_EXT = 'gpkg'
class gws.plugin.qfield.core.ImportArgs(*args, **kwargs)

Bases: gws.Data

Basic data object.

This object can be instantiated by passing one or or dict arguments and/or keyword args. All dicts keys and keywords become attributes of the object.

Accessing an undefined attribute returns None and no error is raised, unless the attribute name starts with an underscore.

baseDir: str
dbFileName: str
package: Package
project: gws.Project
user: gws.User
class gws.plugin.qfield.core.Importer
args: ImportArgs
localDbPath: str
localImagePaths: list[str]
package: Package
project: gws.Project
qfCaps: QFieldCaps
updatedModels: list[ModelEntry]
user: gws.User
check_model(me: ModelEntry, user: gws.User, access: gws.Access) gws.Model
commit_edits()
commit_edits_for_model(me: ModelEntry)
enumerate_updated_models()
file_value_for_path(path)
prepare(args: ImportArgs)
read_data()
read_edit_operations_for_model(me: ModelEntry, ol: OfflineLog)
read_features()
read_features_for_model(me: ModelEntry, ds: gws.gis.gdalx.VectorDataSet)
read_images()
read_images_for_model(me: ModelEntry)
read_offline_log_for_model(me: ModelEntry, ol: OfflineLog) bool
run(args: ImportArgs)
update_file_attributes(eo: EditOperation, file_field_map)
class gws.plugin.qfield.core.LayerAction

Bases: gws.Enum

Enumeration type.

Despite being declared as extending Enum (for IDE support), this class is actually just a simple object and intended to be used as a collection of attributes. It doesn’t provide any Enum-specific utilities.

The rationale behind this is that we need Enum members (e.g. Color.RED) to be scalars, and not complex objects as in the standard Enum.

baseMap = 'baseMap'
edit = 'edit'
remove = 'remove'
class gws.plugin.qfield.core.LayerEntry(*args, **kwargs)

Bases: gws.Data

Basic data object.

This object can be instantiated by passing one or or dict arguments and/or keyword args. All dicts keys and keywords become attributes of the object.

Accessing an undefined attribute returns None and no error is raised, unless the attribute name starts with an underscore.

action: LayerAction
dataProvider: str
dataSource: str
dataSourceFileName: str
dataSourcePath: str
modelEntry: ModelEntry
qgisId: str
readOnly: bool
sourceLayer: gws.SourceLayer
sqlFilter: str
class gws.plugin.qfield.core.ModelEntry(*args, **kwargs)

Bases: gws.Data

Basic data object.

This object can be instantiated by passing one or or dict arguments and/or keyword args. All dicts keys and keywords become attributes of the object.

Accessing an undefined attribute returns None and no error is raised, unless the attribute name starts with an underscore.

columnIndex: dict
editOperations: list[EditOperation]
features: list[gws.Feature]
fidToPkey: dict
gpId: int
gpName: str
model: gws.DatabaseModel
class gws.plugin.qfield.core.OfflineLog(*args, **kwargs)

Bases: gws.Data

Basic data object.

This object can be instantiated by passing one or or dict arguments and/or keyword args. All dicts keys and keywords become attributes of the object.

Accessing an undefined attribute returns None and no error is raised, unless the attribute name starts with an underscore.

log_added_attrs: list[dict]
log_added_features: list[dict]
log_feature_updates: list[dict]
log_fids: list[dict]
log_geometry_updates: list[dict]
log_gws_columns: list[dict]
log_gws_tables: list[dict]
log_indices: list[dict]
log_layer_ids: list[dict]
log_removed_features: list[dict]
class gws.plugin.qfield.core.Package

Bases: gws.Node

Configurable GWS object.

mapCacheLifeTime: int
models: list[gws.DatabaseModel]
qgisProvider: gws.plugin.qgis.provider.Object
configure()

Configuration hook.

class gws.plugin.qfield.core.PackageConfig(*args, **kwargs)

Bases: gws.ConfigWithAccess

Basic config with permissions.

mapCacheLifeTime: gws.Duration = 0

Cache life time for base map layers.

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

Data models.

qgisProvider: gws.plugin.qgis.provider.Config

QGis provider settings.

class gws.plugin.qfield.core.QFieldCaps(*args, **kwargs)

Bases: gws.Data

Basic data object.

This object can be instantiated by passing one or or dict arguments and/or keyword args. All dicts keys and keywords become attributes of the object.

Accessing an undefined attribute returns None and no error is raised, unless the attribute name starts with an underscore.

areaOfInterest: gws.Bounds | None
baseMapLayerIds: list[str]
dirsToCopy: list[str]
globalProps: dict
layerMap: dict[str, LayerEntry]
modelMap: dict[str, ModelEntry]
offlineCopyOnlyAoi: bool
qgisPath: str
class gws.plugin.qfield.core.QFieldCapsParser

Read qf-related capabilities from the qgis project.

caps: QFieldCaps
package: Package
qgisCaps: gws.plugin.qgis.caps.Caps
base_map_layer_ids() list[str]
check_dirs_to_copy()
gp_name_for_model(table_name)
layer_entry(sl: gws.SourceLayer) LayerEntry | None
model_entry(gp_name: str, model: gws.DatabaseModel) ModelEntry
model_entry_for_table(sl: gws.SourceLayer) ModelEntry | None
postgres_layer_entry(sl, qf_props)
run(package: Package) QFieldCaps
class gws.plugin.qfield.core.QgisXmlTransformer
ex: Exporter
remove: list[gws.XmlElement]
root: gws.XmlElement
change_global_props()
cleanup_layer_group(group_el)
remove_elements(el, parent_el)
run(ex: Exporter, root_el: gws.XmlElement)
update_edit_widgets()
update_layer_tree()
update_map_layers()
update_referenced_layers()