spinetoolbox.project_items.data_connection
¶
Data connection plugin.
author: |
|
---|---|
date: | 12.9.2019 |
Subpackages¶
Submodules¶
Package Contents¶
-
class
spinetoolbox.project_items.data_connection.
DataConnectionIcon
(toolbox, x, y, w, h, name)[source]¶ Bases:
spinetoolbox.graphics_items.ProjectItemIcon
Data Connection icon for the Design View.
Parameters: - toolbox (ToolboxUI) – main window instance
- x (float) – Icon x coordinate
- y (float) – Icon y coordinate
- w (float) – Width of master icon
- h (float) – Height of master icon
- name (str) – Item name
-
class
_SignalHolder
¶ Bases:
PySide2.QtCore.QObject
-
files_dropped_on_icon
¶ A signal that it triggered when files are dragged and dropped on the item.
-
-
dragEnterEvent
(self, event)¶ Drag and drop action enters. Accept file drops from the filesystem.
Parameters: event (QGraphicsSceneDragDropEvent) – Event
-
dragLeaveEvent
(self, event)¶ Drag and drop action leaves.
Parameters: event (QGraphicsSceneDragDropEvent) – Event
-
dragMoveEvent
(self, event)¶ Accept event.
-
dropEvent
(self, event)¶ Emit files_dropped_on_dc signal from scene, with this instance, and a list of files for each dropped url.
-
select_on_drag_over
(self)¶ Called when the timer started in drag_enter_event is elapsed. Select this item if the drag action is still over it.
-
class
spinetoolbox.project_items.data_connection.
item_maker
(name, description, x, y, toolbox, project, logger, references=None)¶ 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)¶
-
static
item_type
()¶ See base class.
-
static
category
()¶ See base class.
-
make_signal_handler_dict
(self)¶ Returns a dictionary of all shared signals and their handlers. This is to enable simpler connecting and disconnecting.
-
restore_selections
(self)¶ Restore selections into shared widgets when this project item is selected.
-
add_files_to_references
(self, paths)¶ Add multiple file paths to reference list.
Parameters: paths (list) – A list of paths to files
-
do_add_files_to_references
(self, paths)¶
-
receive_files_dropped_on_icon
(self, icon, file_paths)¶ 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)¶ Add files to data directory
-
add_references
(self, checked=False)¶ Let user select references to files for this data connection.
-
remove_references
(self, checked=False)¶ Remove selected references from reference list. Do not remove anything if there are no references selected.
-
do_remove_references
(self, references)¶
-
copy_to_project
(self, checked=False)¶ Copy selected file references to this Data Connection’s data directory.
-
open_reference
(self, index)¶ Open reference in default program.
-
open_data_file
(self, index)¶ Open data file in default program.
-
show_spine_datapackage_form
(self)¶ Show spine_datapackage_form widget.
-
datapackage_form_destroyed
(self)¶ Notify a connection that datapackage form has been destroyed.
-
make_new_file
(self)¶ Create a new blank file to this Data Connections data directory.
-
remove_files
(self)¶ Remove selected files from data directory.
-
file_references
(self)¶ Returns a list of paths to files that are in this item as references.
-
data_files
(self)¶ Returns a list of files that are in the data directory.
-
refresh
(self, path=None)¶ Refresh data files in Data Connection Properties. NOTE: Might lead to performance issues.
-
populate_reference_list
(self, items, emit_item_changed=True)¶ List file references in QTreeView. If items is None or empty list, model is cleared.
-
populate_data_list
(self, items)¶ List project internal data (files) in QTreeView. If items is None or empty list, model is cleared.
-
update_name_label
(self)¶ Update Data Connection tab name label. Used only when renaming project items.
-
output_resources_forward
(self)¶ see base class
-
_do_handle_dag_changed
(self, resources)¶ See base class.
-
item_dict
(self)¶ Returns a dictionary corresponding to this item.
-
rename
(self, new_name)¶ Rename this item.
Parameters: new_name (str) – New name Returns: True if renaming succeeded, False otherwise Return type: bool
-
tear_down
(self)¶ Tears down this item. Called by toolbox just before closing. Closes the SpineDatapackageWidget instances opened.
-
notify_destination
(self, source_item)¶ See base class.
-
static
default_name_prefix
()¶ See base class.
-
class
spinetoolbox.project_items.data_connection.
DataConnectionPropertiesWidget
(toolbox)[source]¶ Bases:
PySide2.QtWidgets.QWidget
Widget for the Data Connection Item Properties.
Parameters: toolbox (ToolboxUI) – The toolbox instance where this widget should be embedded -
connect_signals
(self)¶ Connect signals to slots.
Create and show a context-menu in data connection properties references view.
Parameters: pos (QPoint) – Mouse position
Create and show a context-menu in data connection properties data view.
Parameters: pos (QPoint) – Mouse position
-
-
class
spinetoolbox.project_items.data_connection.
AddDataConnectionWidget
(toolbox, x, y)[source]¶ Bases:
spinetoolbox.widgets.add_project_item_widget.AddProjectItemWidget
A widget to query user’s preferences for a new item.
-
x
¶ X coordinate of new item
Type: int
-
y
¶ Y coordinate of new item
Type: int
Initialize class.
-
call_add_item
(self)¶ Creates new Item according to user’s selections.
-