dicogis.ui.workers module¶
- Name:
Workers
- Purpose:
QThread-based workers running long tasks off the GUI thread, plus a Qt-signal-based implementation of the ProgressReporter protocol.
- Author:
Julien Moura (@geojulien)
- class dicogis.ui.workers.FolderScanWorker(target_folder, parallel_scan=False, max_workers=None, progress_reporter=None, parent=None)¶
Bases:
QObjectWorker listing geodata files under a folder structure, off the GUI thread.
- __init__(target_folder, parallel_scan=False, max_workers=None, progress_reporter=None, parent=None)¶
Initialize the worker.
- Parameters:
target_folder (
str|Path) – folder to walk into to look for geographic datasets.parallel_scan (
bool) – see find_geodata_files()’ parallel_scan argument.max_workers (
int|None) – see find_geodata_files()’ max_workers argument.progress_reporter (
ProgressReporter|None) – see find_geodata_files()’ progress_reporter argument. Also what makes the scan cancellable.parent (
QObject|None) – Qt parent object.
- canceled¶
- error¶
- finished¶
- status_message¶
- class dicogis.ui.workers.PostgisProcessingWorker(sgbd_reader, serializer, progress_reporter=None, parent=None)¶
Bases:
QObjectWorker processing PostGIS tables/views, off the GUI thread.
- __init__(sgbd_reader, serializer, progress_reporter=None, parent=None)¶
Initialize the worker.
- Parameters:
sgbd_reader (
ReadPostGIS) – pre-connected PostGIS reader.serializer (
MetadatasetSerializerBase) – output serializer to write metadata into.progress_reporter (
ProgressReporter|None) – progress reporter to notify. Defaults to None.parent (
QObject|None) – Qt parent object.
- canceled¶
- error¶
- finished¶
- class dicogis.ui.workers.ProcessingWorker(processor, parent=None)¶
Bases:
QObjectWorker processing a queue of geodata files, off the GUI thread.
- __init__(processor, parent=None)¶
Initialize the worker.
- Parameters:
processor (
ProcessingFiles) – pre-configured files processor to run. It’s cancelled through the progress reporter it was built with.parent (
QObject|None) – Qt parent object.
- canceled¶
- error¶
- finished¶
- class dicogis.ui.workers.PublishWorker(input_folder, udata_api_key, udata_api_url_base, udata_api_version, udata_organization_id=None, parent=None)¶
Bases:
QObjectWorker publishing DicoGIS metadata JSON files to a uData catalog, off the GUI thread.
- __init__(input_folder, udata_api_key, udata_api_url_base, udata_api_version, udata_organization_id=None, parent=None)¶
Initialize the worker.
- Parameters:
input_folder (
Path) – folder where metadata JSON files (udata flavor) are stored.udata_api_key (
str) – API key of the account on the uData instance.udata_api_url_base (
str) – API URL of the uData instance.udata_api_version (
str) – API version of the uData instance.udata_organization_id (
str|None) – organization ID in the uData instance. Defaults to None.parent (
QObject|None) – Qt parent object.
- error¶
- finished¶
- progress_changed¶
- class dicogis.ui.workers.QtProgressReporter(parent=None)¶
Bases:
QObjectQt-signal-based implementation of the ProgressReporter protocol.
Safe to instanciate and drive from a worker thread: signals emitted here are delivered to slots connected from the GUI thread through Qt’s automatic cross-thread queued connections.
- __init__(parent=None)¶
Initialize the progress reporter.
- message_changed¶
- progress_incremented¶
- request_cancel()¶
Ask the running operation to stop at its next cancellation check.
Called from the GUI thread (a cancel button); the operation itself polls is_canceled() from its own thread(s), hence the Event.
- Return type:
- total_changed¶