spinetoolbox.widgets.import_preview_widget

Contains ImportPreviewWidget, and MappingTableMenu classes.

author:
  1. Vennström (VTT)
date:

1.6.2019

Module Contents

class spinetoolbox.widgets.import_preview_widget.ImportPreviewWidget(connector, parent)[source]

Bases: PySide2.QtWidgets.QWidget

A Widget for defining one or more Mappings associated to a data Source (CSV file, Excel file, etc). Currently it’s being embedded in ImportDialog and ImportPreviewWindow.

Parameters:connector (ConnectionManager) –
tableChecked[source]
mappedDataReady[source]
previewDataUpdated[source]
checked_tables[source]
set_loading_status(self, status)[source]

Sets widgets enable state

connection_ready(self)[source]

Requests new tables data from connector

select_table(self, selection)[source]

Set selected table and request data from connector

check_list_item(self, item)[source]

Set the check state of item

handle_connector_error(self, error_message)[source]
request_mapped_data(self)[source]
update_tables(self, tables)[source]

Update list of tables

update_preview_data(self, data, header)[source]
use_settings(self, settings)[source]
get_settings_dict(self)[source]

Returns a dictionary with type of connector, connector options for tables, mappings for tables, selected tables.

Returns:[Dict] – dict with settings
close_connection(self)[source]

Close connector connection.

_new_column_types(self)[source]
_new_row_types(self)[source]
_update_display_row_types(self)[source]
show_source_table_context_menu(self, pos)[source]

Context menu for connection links.

Parameters:pos (QPoint) – Mouse position
copy_mappings(self, table)[source]
copy_options(self, table)[source]
paste_mappings(self, table)[source]
paste_options(self, table)[source]
class spinetoolbox.widgets.import_preview_widget.MappingTableMenu(parent=None)[source]

Bases: PySide2.QtWidgets.QMenu

A menu to let users define a Mapping from a data table. Used to generate the context menu for ImportPreviewWidget._ui_table

set_model(self, model)[source]
set_mapping(self, name='', map_type=None, value=None)[source]
request_menu(self, QPos=None)[source]
class spinetoolbox.widgets.import_preview_widget.TableMenu(parent, position, can_paste_option, can_paste_mapping)[source]

Bases: spinetoolbox.widgets.custom_menus.CustomContextMenu

Menu for tables in data source

spinetoolbox.widgets.import_preview_widget._sanitize_data(data, header)[source]

Fills empty data cells with None.