spinetoolbox.project_items.exporter.exporter

Exporter project item.

author:
  1. Soininen (VTT)
date:

5.9.2019

Module Contents

class spinetoolbox.project_items.exporter.exporter.Exporter(name, description, settings_packs, x, y, toolbox, project, logger)[source]

Bases: spinetoolbox.project_item.ProjectItem

This project item handles all functionality regarding exporting a database to a file.

Currently, only .gdx format is supported.

Parameters:
  • name (str) – item name
  • description (str) – item description
  • settings_packs (list) – dicts mapping database URLs to _SettingsPack objects
  • x (float) – initial X coordinate of item icon
  • y (float) – initial Y coordinate of item icon
  • toolbox (ToolboxUI) – a ToolboxUI instance
  • project (SpineToolboxProject) – the project this item belongs to
  • logger (LoggerInterface) – a logger instance
set_up(self)[source]

See base class.

static item_type()[source]

See base class.

static category()[source]

See base class.

settings_pack(self, database_path)[source]
make_signal_handler_dict(self)[source]

Returns a dictionary of all shared signals and their handlers.

restore_selections(self)[source]

Restores selections and connects signals.

_connect_signals(self)[source]
_update_properties_tab(self)[source]

Updates the database list in the properties tab.

execute_forward(self, resources)[source]

See base class.

_do_handle_dag_changed(self, resources)[source]

See base class.

_start_worker(self, database_url, update_settings=False)[source]

Starts fetching settings using a worker in another thread.

_update_export_settings(self, database_url, settings)[source]

Sets new settings for given database.

_update_indexing_settings(self, database_url, indexing_settings)[source]

Sets new indexing settings for given database.

_update_indexing_domains(self, database_url, domains)[source]

Sets new indexing domains for given database.

_update_merging_settings(self, database_url, settings)[source]

Sets new merging settings for given database.

_update_merging_domains(self, database_url, domains)[source]

Sets new merging domains for given database.

_worker_finished(self, database_url)[source]

Cleans up after a worker has finished fetching export settings.

_worker_failed(self, database_url, exception)[source]

Clean up after a worker has failed fetching export settings.

_check_state(self, clear_before_check=True)[source]

Checks the status of database export settings.

Updates both the notification message (exclamation icon) and settings states.

_check_missing_file_names(self)[source]

Checks the status of output file names.

_check_duplicate_file_names(self)[source]

Checks for duplicate output file names.

_check_missing_parameter_indexing(self)[source]

Checks the status of parameter indexing settings.

_check_erroneous_databases(self)[source]

Checks errors in settings fetching from a database.

_report_notifications(self)[source]

Updates the exclamation icon and notifications labels.

_show_settings(self, database_url)[source]

Opens the item’s settings window.

_reset_settings_window(self, database_url)[source]

Sends new settings to Gdx Export Settings window.

_dispose_settings_window(self, database_url)[source]

Deletes rejected export settings windows.

_update_out_file_name(self, file_name, database_path)[source]

Pushes a new UpdateExporterOutFileNameCommand to the toolbox undo stack.

_update_settings_from_settings_window(self, database_path)[source]

Pushes a new UpdateExporterSettingsCommand to the toolbox undo stack.

undo_redo_out_file_name(self, file_name, database_path)[source]

Updates the output file name for given database

undo_or_redo_settings(self, settings, indexing_settings, indexing_domains, merging_settings, merging_domains, database_path)[source]

Updates the export settings for given database.

item_dict(self)[source]

Returns a dictionary corresponding to this item’s configuration.

_discard_settings_window(self, database_path)[source]

Discards the settings window for given database.

_send_settings_to_window(self, database_url)[source]

Resets settings in given export settings window.

update_name_label(self)[source]

See base class.

_resolve_gams_system_directory(self)[source]

Returns GAMS system path from Toolbox settings or None if GAMS default is to be used.

notify_destination(self, source_item)[source]

See base class.

_update_settings_after_db_commit(self, committed_db_maps)[source]

Refreshes export settings for databases after data has been committed to them.

static default_name_prefix()[source]

See base class.

output_resources_forward(self)[source]

See base class.

tear_down(self)[source]

See base class.

class spinetoolbox.project_items.exporter.exporter.SettingsPack(output_file_name)[source]

Bases: PySide2.QtCore.QObject

Keeper of all settings and stuff needed for exporting a database.

output_file_name

name of the export file

Type:str
settings

export settings

Type:Settings
indexing_settings

parameter indexing settings

Type:dict
indexing_domains

extra domains needed for parameter indexing

Type:list
merging_settings

parameter merging settings

Type:dict
merging_domains

extra domains needed for parameter merging

Type:list
settings_window

settings editor window

Type:GdxExportSettings
Parameters:output_file_name (str) – name of the export file
state_changed[source]

Emitted when the pack’s state changes.

state[source]

State of the pack.

to_dict(self)[source]

Stores the settings pack into a JSON compatible dictionary.

static from_dict(pack_dict, database_url, logger)[source]

Restores the settings pack from a dictionary.

class spinetoolbox.project_items.exporter.exporter._Notifications[source]

Bases: PySide2.QtCore.QObject

Holds flags for different error conditions.

duplicate_output_file_name

if True there are duplicate output file names

Type:bool
missing_output_file_name

if True the output file name is missing

Type:bool
missing_parameter_indexing

if True there are indexed parameters without indexing domains

Type:bool
erroneous_database

if True the database has issues

Type:bool
changed_due_to_settings_state[source]

Emitted when notifications have changed due to changes in settings state.

__ior__(self, other)[source]

ORs the flags with another notifications.

Parameters:other (_Notifications) – a _Notifications object
update_settings_state(self, state)[source]

Updates the notifications according to settings state.

spinetoolbox.project_items.exporter.exporter._normalize_url(url)[source]

Normalized url’s path separators to their OS specific characters.

This function is needed during the transition period from no-version to version 1 project files. It should be removed once we are using version 1 files.