spinetoolbox.project_items.data_store

Data store plugin.

author:
  1. Marin (KTH)
date:

12.9.2019

Package Contents

class spinetoolbox.project_items.data_store.item_maker(name, description, x, y, toolbox, project, logger, url=None)

Bases: spinetoolbox.project_item.ProjectItem

Data Store 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
  • url (str or dict) – SQLAlchemy url
static item_type()

See base class.

static category()

See base class.

parse_url(self, url)

Return a complete url dictionary from the given dict or string

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)

Load url into selections.

save_selections(self)

Save checkbox state.

url(self)

Return the url attribute, for saving the project.

_update_sa_url(self, log_errors=True)
_make_url(self, log_errors=True)

Returns a sqlalchemy url from the current url attribute or None if not valid.

project(self)

Returns current project or None if no project open.

set_path_to_sqlite_file(self, file_path)

Set path to SQLite file.

open_sqlite_file(self, checked=False)

Open file browser where user can select the path to an SQLite file that they want to use.

load_url_into_selections(self, url)

Load given url attribute into shared widget selections.

update_url(self, **kwargs)

Set url key to value.

do_update_url(self, **kwargs)
refresh_host(self)

Refresh host from selections.

refresh_port(self)

Refresh port from selections.

refresh_database(self)

Refresh database from selections.

refresh_username(self)

Refresh username from selections.

refresh_password(self)

Refresh password from selections.

refresh_dialect(self, dialect)
enable_dialect(self, dialect)

Enable the given dialect in the item controls.

enable_no_dialect(self)

Adjust widget enabled status to default when no dialect is selected.

enable_mssql(self)

Adjust controls to mssql connection specification.

enable_sqlite(self)

Adjust controls to sqlite connection specification.

enable_common(self)

Adjust controls to ‘common’ connection specification.

open_ds_view(self, checked=False)

Opens current url in the data store view.

do_open_ds_view(self)

Opens current url in the data store view.

_handle_ds_view_destroyed(self)
data_files(self)

Return a list of files that are in this items data directory.

copy_url(self, checked=False)

Copy db url to clipboard.

create_new_spine_database(self, checked=False)

Create new (empty) Spine database.

update_name_label(self)

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

_do_handle_dag_changed(self, resources)

See base class.

item_dict(self)

Returns a dictionary corresponding to this item.

static upgrade_from_no_version_to_version_1(item_name, old_item_dict, old_project_dir)

See base class.

static custom_context_menu(parent, pos)

Returns the context menu for this item.

Parameters:
  • parent (QWidget) – The widget that is controlling the menu
  • pos (QPoint) – Position on screen
apply_context_menu_action(self, parent, action)

Applies given action from context menu. Implement in subclasses as needed.

Parameters:
  • parent (QWidget) – The widget that is controlling the menu
  • action (str) – The selected action
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 DataStoreForm instance opened by this item.

notify_destination(self, source_item)

See base class.

static default_name_prefix()

see base class

output_resources_backward(self)

See base class.

output_resources_forward(self)

See base class.

class spinetoolbox.project_items.data_store.DataStoreIcon(toolbox, x, y, w, h, name)[source]

Bases: spinetoolbox.graphics_items.ProjectItemIcon

Data Store icon for the Design View.

Parameters:
  • toolbox (ToolBoxUI) – QMainWindow 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 spinetoolbox.project_items.data_store.DataStorePropertiesWidget(toolbox)[source]

Bases: PySide2.QtWidgets.QWidget

Widget for the Data Store Item Properties.

Parameters:toolbox (ToolboxUI) – The toolbox instance where this widget should be embedded
class spinetoolbox.project_items.data_store.AddDataStoreWidget(toolbox, x, y)[source]

Bases: spinetoolbox.widgets.add_project_item_widget.AddProjectItemWidget

A widget to query user’s preferences for a new item.

toolbox

Parent widget

Type:ToolboxUI
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.

spinetoolbox.project_items.data_store.item_rank = 0[source]
spinetoolbox.project_items.data_store.item_category[source]
spinetoolbox.project_items.data_store.item_type[source]
spinetoolbox.project_items.data_store.item_icon = :/icons/project_item_icons/database.svg[source]
spinetoolbox.project_items.data_store.icon_maker[source]
spinetoolbox.project_items.data_store.properties_widget_maker[source]
spinetoolbox.project_items.data_store.add_form_maker[source]