spinetoolbox.project_items.data_connection.data_connection

Module for data connection class.

author:
  1. Savolainen (VTT)
date:

19.12.2017

Module Contents

class spinetoolbox.project_items.data_connection.data_connection.DataConnection(name, description, x, y, toolbox, project, logger, references=None)[source]

Bases: spinetoolbox.project_item.ProjectItem

Data Connection class.

Parameters:
  • name (str) – Object name
  • description (str) – Object description
  • x (float) – Initial X coordinate of item icon
  • y (float) – Initial Y coordinate of item icon
  • toolbox (ToolboxUI) – QMainWindow instance
  • project (SpineToolboxProject) – the project this item belongs to
  • logger (LoggerInterface) – a logger instance
  • references (list) – a list of file paths
set_up(self)[source]
static item_type()[source]

See base class.

static category()[source]

See base class.

make_signal_handler_dict(self)[source]

Returns a dictionary of all shared signals and their handlers. This is to enable simpler connecting and disconnecting.

restore_selections(self)[source]

Restore selections into shared widgets when this project item is selected.

add_files_to_references(self, paths)[source]

Add multiple file paths to reference list.

Parameters:paths (list) – A list of paths to files
do_add_files_to_references(self, paths)[source]
receive_files_dropped_on_icon(self, icon, file_paths)[source]

Called when files are dropped onto a data connection graphics item. If the item is this Data Connection’s graphics item, add the files to data.

add_files_to_data_dir(self, file_paths)[source]

Add files to data directory

add_references(self, checked=False)[source]

Let user select references to files for this data connection.

remove_references(self, checked=False)[source]

Remove selected references from reference list. Do not remove anything if there are no references selected.

do_remove_references(self, references)[source]
copy_to_project(self, checked=False)[source]

Copy selected file references to this Data Connection’s data directory.

open_reference(self, index)[source]

Open reference in default program.

open_data_file(self, index)[source]

Open data file in default program.

show_spine_datapackage_form(self)[source]

Show spine_datapackage_form widget.

datapackage_form_destroyed(self)[source]

Notify a connection that datapackage form has been destroyed.

make_new_file(self)[source]

Create a new blank file to this Data Connections data directory.

remove_files(self)[source]

Remove selected files from data directory.

file_references(self)[source]

Returns a list of paths to files that are in this item as references.

data_files(self)[source]

Returns a list of files that are in the data directory.

refresh(self, path=None)[source]

Refresh data files in Data Connection Properties. NOTE: Might lead to performance issues.

populate_reference_list(self, items, emit_item_changed=True)[source]

List file references in QTreeView. If items is None or empty list, model is cleared.

populate_data_list(self, items)[source]

List project internal data (files) in QTreeView. If items is None or empty list, model is cleared.

update_name_label(self)[source]

Update Data Connection tab name label. Used only when renaming project items.

output_resources_forward(self)[source]

see base class

_do_handle_dag_changed(self, resources)[source]

See base class.

item_dict(self)[source]

Returns a dictionary corresponding to this item.

rename(self, new_name)[source]

Rename this item.

Parameters:new_name (str) – New name
Returns:True if renaming succeeded, False otherwise
Return type:bool
tear_down(self)[source]

Tears down this item. Called by toolbox just before closing. Closes the SpineDatapackageWidget instances opened.

notify_destination(self, source_item)[source]

See base class.

static default_name_prefix()[source]

See base class.