# svir.thread_worker package

## Submodules

## svir.thread_worker.abstract_worker module

class `svir.thread_worker.abstract_worker.``AbstractWorker`

  Bases: `PyQt5.QtCore.QObject`

  Abstract worker, ihnerit from this and implement the work method

  `error`
  `finished`
  `kill`()
  `progress`
  `run`()
  `set_message`
  `successfully_finished`
  `toggle_show_cancel`
  `toggle_show_progress`
  `work`()

    Reimplement this putting your calculation here available are: * self.progress.emit(0-100) * self.killed :returns: a python object - use None if killed is true

`svir.thread_worker.abstract_worker.``set_worker_message`(message, message_bar_item)

  Set the message bar to display the given message

`svir.thread_worker.abstract_worker.``start_worker`(worker, message_bar, message)

  Configure the QgsMessageBar with a Cancel button and start the worker in a new thread

  Parameters: | worker – the worker to be started message_bar – the message bar to be used to display progress message – a message describing the task to be performed

`svir.thread_worker.abstract_worker.``toggle_worker_cancel`(show_cancel, cancel_button)

  Show or hide the cancel button

  Parameters: | show_cancel (bool) – indicating if the Cancel button has to be shown cancel_button – the button to be shown or hidden

`svir.thread_worker.abstract_worker.``toggle_worker_progress`(show_progress, progress_bar)

  Set the progress to the given progress bar

  Parameters: | show_progress (bool) – if True, a 0 to 100 progress will be displayed; otherwise, an unquantified progress

`svir.thread_worker.abstract_worker.``worker_error`(e, exception_string, message_bar)

  Notify the user that something went wrong

`svir.thread_worker.abstract_worker.``worker_finished`(result, thread, worker, message_bar, message_bar_item)

  Cleanup to be executed when the worker has completed its task

## svir.thread_worker.download_platform_data_worker module

class `svir.thread_worker.download_platform_data_worker.``DownloadPlatformDataWorker`(sv_downloader, sv_variables_ids, load_geometries, country_iso_codes)

  Bases: `svir.thread_worker.abstract_worker.AbstractWorker`

  Worker, to download data from a platform

  Parameters: | sv_downloader – instance of `svir.utilities.import_sv_data.SvDownloader` sv_variables_ids – comma-separated indicator codes to be downloaded load_geometries (bool) – indicating if also zonal geometries have to be downloaded country_iso_codes – comma-separated iso codes of the countries for which we want to download socioeconomic data

  `work`()

    Returns: | (fname, msg), where fname is the name of the target csv file that will store the downloaded data, and msg is a message describing if the download is performed successfully
    Raises: | SvNetworkError

## svir.thread_worker.download_platform_project_worker module

class `svir.thread_worker.download_platform_project_worker.``DownloadPlatformProjectWorker`(sv_downloader, layer_id)

  Bases: `svir.thread_worker.abstract_worker.AbstractWorker`

  worker, to download an existing project from a platform

  `work`()

## svir.thread_worker.upload_worker module

class `svir.thread_worker.upload_worker.``UploadWorker`(hostname, session, file_stem, username, current_layer)

  Bases: `svir.thread_worker.abstract_worker.AbstractWorker`

  worker, to upload data to a platform

  `work`()

## Module contents