spinetoolbox.project_items.exporter.worker

A worker based machinery to construct the settings data structures needed for gdx export outside the UI loop.

author:
  1. Soininen (VTT)
date:

19.12.2019

Module Contents

Classes

Worker A worker to construct export settings for a database.
_Result Contains fetched export settings.
_Logger A LoggerInterface compliant logger that relays messages to Worker’s signals.
class spinetoolbox.project_items.exporter.worker.Worker(database_url, scenario, none_fallback)[source]

Bases: PySide2.QtCore.QObject

A worker to construct export settings for a database.

thread

the thread the worker executes in

Type:QThread
Parameters:
  • database_url (str) – database’s URL
  • scenario (str, optional) – scenario name or None if ‘Base’ alternative should be used
  • none_fallback (NoneFallback) – how to handle None parameter values
database_unavailable[source]

Emitted when opening the database fails.

errored[source]

Emitted when an error occurs.

finished[source]

Emitted when the worker has finished.

msg[source]
msg_warning[source]
msg_error[source]
_fetch_settings(self)[source]

Constructs settings and parameter index settings.

set_previous_settings(self, previous_settings, previous_indexing_settings, previous_merging_settings)[source]

Makes worker update existing settings instead of just making new ones.

Parameters:
  • previous_settings (gdx.SetSettings) – existing set settings
  • previous_indexing_settings (dict) – existing indexing settings
  • previous_merging_settings (dict) – existing merging settings
static _read_scenarios(database_map)[source]
_read_settings(self)[source]

Reads fresh gdx settings from the database.

_update_indexing_settings(self, updated_settings, new_indexing_settings)[source]

Updates the parameter indexing settings according to changes in the database.

_update_merging_settings(self, updated_settings)[source]

Updates the parameter merging settings according to changes in the database

class spinetoolbox.project_items.exporter.worker._Result(time_stamp, set_settings, indexing_settings, scenarios)[source]

Contains fetched export settings.

commit_time_stamp

time of the database’s last commit

Type:datetime
set_settings

gdx export settings

Type:gdx.SetSettings
indexing_settings

parameter indexing settings

Type:dict
merging_settings

parameter merging settings

Type:dict
scenarios

map from scenario name to boolean ‘active’ flag

Type:dict
Parameters:
  • time_stamp (datetime) – time of the database’s last commit
  • set_settings (gdx.SetSettings) – gdx export settings
  • indexing_settings (dict) – parameter indexing settings
  • scenarios (dict) – map from scenario name to boolean ‘active’ flag
class spinetoolbox.project_items.exporter.worker._Logger(database_url, worker)[source]

Bases: PySide2.QtCore.QObject

A LoggerInterface compliant logger that relays messages to Worker’s signals.

Parameters:
  • database_url (str) – a database url
  • worker (Worker) – a worker
msg[source]
msg_warning[source]
msg_error[source]
relay_message(self, text)[source]
relay_warning(self, text)[source]
relay_error(self, text)[source]