gws.plugin.qfield.core

Qfield reader and writer.

Source code: gws.plugin.qfield.core

Module Contents

gws.plugin.qfield.core.GPKG_EXT = 'gpkg'
class gws.plugin.qfield.core.PackageConfig(*args, **kwargs)

Bases: gws.ConfigWithAccess

Basic config with permissions.

qgisProvider: gws.plugin.qgis.provider.Config

QGis provider settings.

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

Data models.

mapCacheLifeTime: gws.Duration = 0

Cache life time for base map layers.

class gws.plugin.qfield.core.Package

Bases: gws.Node

Configurable GWS object.

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

Configuration hook.

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.

package: Package
project: gws.Project
user: gws.User
baseDir: str
qgisFileName: str
dbFileName: str
dbPath: str
withBaseMap: bool
withData: bool
withMedia: bool
withQgis: bool
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.

package: Package
project: gws.Project
user: gws.User
baseDir: str
dbFileName: str
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.

remove = 'remove'
edit = 'edit'
baseMap = 'baseMap'
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.

update = 'update'
geometryUpdate = 'geometryUpdate'
insert = 'insert'
delete = 'delete'
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
fid: int
pkey: str
columnName: str
attributes: dict
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.

gpId: int
gpName: str
model: gws.DatabaseModel
fidToPkey: dict
columnIndex: dict
editOperations: list[EditOperation]
features: list[gws.Feature]
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
qgisId: str
modelEntry: ModelEntry
readOnly: bool
sqlFilter: str
dataSourceFileName: str
dataSourcePath: str
dataSource: str
dataProvider: str
sourceLayer: gws.SourceLayer
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.

qgisPath: str
layerMap: dict[str, LayerEntry]
modelMap: dict[str, ModelEntry]
globalProps: dict
dirsToCopy: list[str]
baseMapLayerIds: list[str]
areaOfInterest: gws.Bounds | None
offlineCopyOnlyAoi: bool
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_indices: list[dict]
log_layer_ids: list[dict]
log_removed_features: list[dict]
log_gws_columns: list[dict]
log_gws_tables: list[dict]
class gws.plugin.qfield.core.Exporter
package: Package
project: gws.Project
user: gws.User
args: ExportArgs
sourceQgisProject: gws.plugin.qgis.project.Object
targetQgisPath: str
deviceDbPath: str
localDbPath: str
qfCaps: QFieldCaps
run(args: ExportArgs)
prepare(args: ExportArgs)
write_data()
write_base_map()
write_media()
write_features(me: ModelEntry, ds: gws.gis.gdalx.DataSet)
write_base_map_layer(le: LayerEntry)
write_offline_log()
write_qgis_project()
replace_vars(s: str) str
class gws.plugin.qfield.core.QgisXmlTransformer
ex: Exporter
root: gws.XmlElement
remove: list[gws.XmlElement]
run(ex: Exporter, root_el: gws.XmlElement)
change_global_props()
update_layer_tree()
update_map_layers()
update_referenced_layers()
update_edit_widgets()
cleanup_layer_group(group_el)
remove_elements(el, parent_el)
class gws.plugin.qfield.core.Importer
package: Package
project: gws.Project
user: gws.User
args: ImportArgs
localDbPath: str
localImagePaths: list[str]
updatedModels: list[ModelEntry]
qfCaps: QFieldCaps
run(args: ImportArgs)
prepare(args: ImportArgs)
read_data()
enumerate_updated_models()
read_features()
read_images()
read_offline_log_for_model(me: ModelEntry, ol: OfflineLog) bool
read_edit_operations_for_model(me: ModelEntry, ol: OfflineLog)
read_features_for_model(me: ModelEntry, ds: gws.gis.gdalx.DataSet)
read_images_for_model(me: ModelEntry)
update_file_attributes(eo: EditOperation, file_field_map)
file_value_for_path(path)
commit_edits()
commit_edits_for_model(me: ModelEntry)
check_model(me: ModelEntry, user: gws.User, access: gws.Access) gws.Model
class gws.plugin.qfield.core.QFieldCapsParser

Read qf-related capabilities from the qgis project.

package: Package
caps: QFieldCaps
qgisCaps: gws.plugin.qgis.caps.Caps
run(package: Package) QFieldCaps
check_dirs_to_copy()
base_map_layer_ids() list[str]
layer_entry(sl: gws.SourceLayer) LayerEntry | None
postgres_layer_entry(sl, qf_props)
model_entry_for_table(sl: gws.SourceLayer) ModelEntry | None
model_entry(gp_name: str, model: gws.DatabaseModel) ModelEntry
gp_name_for_model(table_name)