spinetoolbox.project_items.data_store.data_store

Module for data store class.

authors:
  1. Savolainen (VTT), M. Marin (KTH)
date:

18.12.2017

Module Contents

class spinetoolbox.project_items.data_store.data_store.DataStore(name, description, x, y, toolbox, project, logger, url=None)[source]

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()[source]

See base class.

static category()[source]

See base class.

parse_url(self, url)[source]

Return a complete url dictionary from the given dict or string

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]

Load url into selections.

save_selections(self)[source]

Save checkbox state.

url(self)[source]

Return the url attribute, for saving the project.

_update_sa_url(self, log_errors=True)[source]
_make_url(self, log_errors=True)[source]

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

project(self)[source]

Returns current project or None if no project open.

set_path_to_sqlite_file(self, file_path)[source]

Set path to SQLite file.

open_sqlite_file(self, checked=False)[source]

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

load_url_into_selections(self, url)[source]

Load given url attribute into shared widget selections.

update_url(self, **kwargs)[source]

Set url key to value.

do_update_url(self, **kwargs)[source]
refresh_host(self)[source]

Refresh host from selections.

refresh_port(self)[source]

Refresh port from selections.

refresh_database(self)[source]

Refresh database from selections.

refresh_username(self)[source]

Refresh username from selections.

refresh_password(self)[source]

Refresh password from selections.

refresh_dialect(self, dialect)[source]
enable_dialect(self, dialect)[source]

Enable the given dialect in the item controls.

enable_no_dialect(self)[source]

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

enable_mssql(self)[source]

Adjust controls to mssql connection specification.

enable_sqlite(self)[source]

Adjust controls to sqlite connection specification.

enable_common(self)[source]

Adjust controls to ‘common’ connection specification.

open_ds_view(self, checked=False)[source]

Opens current url in the data store view.

do_open_ds_view(self)[source]

Opens current url in the data store view.

_handle_ds_view_destroyed(self)[source]
data_files(self)[source]

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

copy_url(self, checked=False)[source]

Copy db url to clipboard.

create_new_spine_database(self, checked=False)[source]

Create new (empty) Spine database.

update_name_label(self)[source]

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

_do_handle_dag_changed(self, resources)[source]

See base class.

item_dict(self)[source]

Returns a dictionary corresponding to this item.

static upgrade_from_no_version_to_version_1(item_name, old_item_dict, old_project_dir)[source]

See base class.

static custom_context_menu(parent, pos)[source]

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)[source]

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)[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 DataStoreForm instance opened by this item.

notify_destination(self, source_item)[source]

See base class.

static default_name_prefix()[source]

see base class

output_resources_backward(self)[source]

See base class.

output_resources_forward(self)[source]

See base class.