spinetoolbox.project_items.exporter.exporter¶
Exporter project item.
| author: |
|
|---|---|
| date: | 5.9.2019 |
Module Contents¶
Classes¶
Exporter |
This project item handles all functionality regarding exporting a database to a file. |
Functions¶
_normalize_url(url) |
Normalized url’s path separators to their OS specific characters. |
_latest_database_commit_time_stamp(url) |
Returns the latest commit timestamp from database at given URL or None. |
-
class
spinetoolbox.project_items.exporter.exporter.Exporter(toolbox, project, logger, name, description, settings_packs, x, y, cancel_on_export_error=None, cancel_on_error=None)[source]¶ Bases:
spinetoolbox.project_item.ProjectItemThis project item handles all functionality regarding exporting a database to a file.
Currently, only .gdx format is supported.
Parameters: - toolbox (ToolboxUI) – a ToolboxUI instance
- project (SpineToolboxProject) – the project this item belongs to
- logger (LoggerInterface) – a logger instance
- 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
- cancel_on_export_error (bool, options) – legacy
cancel_on_erroroption - cancel_on_error (bool, options) – True if execution should fail on all export errors, False to ignore certain error cases; optional to provide backwards compatibility
-
make_signal_handler_dict(self)[source]¶ Returns a dictionary of all shared signals and their handlers.
-
_read_scenarios(self, database_url)[source]¶ Reads scenarios from database.
Parameters: database_url (str) – database url Returns: a mapping from scenario name to boolean ‘active’ flag Return type: dict
-
_update_properties_tab(self)[source]¶ Updates the database list and scenario combo boxes in the properties tab.
-
_start_worker(self, database_url, update_settings=False)[source]¶ Starts fetching settings using a worker in another thread.
-
_worker_finished(self, database_url, result)[source]¶ Gets and updates and export settings pack from a worker.
-
_worker_failed(self, database_url, exception)[source]¶ Clean up after a worker has failed fetching export settings.
-
_cancel_worker(self, database_url)[source]¶ Cleans up after worker has given up 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.
-
_reset_settings_window(self, database_url)[source]¶ Sends new settings to Gdx Export Settings window.
-
_update_out_file_name(self, file_name, database_path)[source]¶ Pushes a new UpdateExporterOutFileNameCommand to the toolbox undo stack.
-
_update_scenario(self, scenario, database_url)[source]¶ Updates the selected scenario.
Parameters: - scenario (str or NoneType) – selected scenario
- database_url (str) – database URL
-
set_scenario(self, scenario, database_url)[source]¶ Sets the selected scenario in settings pack.
Parameters: - scenario (str or NoneType) – selected scenario
- database_url (str) – database URL
-
_update_settings_from_settings_window(self, database_path)[source]¶ Pushes a new UpdateExporterSettingsCommand to the toolbox undo stack.
-
_cancel_on_error_option_changed(self, checkbox_state)[source]¶ Handles changes to the Cancel export on error option.
-
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, merging_settings, none_fallback, none_export, database_path)[source]¶ Updates the export settings for given database.
-
_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_settings_after_db_commit(self, committed_db_maps, cookie)[source]¶ Refreshes export settings for databases after data has been committed to them.
-
static
upgrade_v1_to_v2(item_name, item_dict)[source]¶ Upgrades item’s dictionary from v1 to v2.
Changes: - output_file_name and database_url stay the same but state is set to Fetching.
Parameters: - item_name (str) – item’s name
- item_dict (dict) – Version 1 item dictionary
Returns: Version 2 Exporter dictionary
Return type: dict