spine_io.connection_manager

Contains ConnectionManager class.

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

1.6.2019

Module Contents

class spine_io.connection_manager.ConnectionManager(connection, parent=None)[source]

Bases: PySide2.QtCore.QObject

Class to manage data connections in another thread.

Parameters:connection (class) – A class derived from SourceConnection, e.g. CSVConnector
startTableGet[source]
startDataGet[source]
startMappedDataGet[source]
connectionFailed[source]
connectionReady[source]
closeConnection[source]
error[source]
fetchingData[source]
dataReady[source]
tablesReady[source]
mappedDataReady[source]
is_connected[source]
table_options[source]
source[source]
source_type[source]
set_table(self, table)[source]

Sets the current table of the data source.

Parameters:{str} -- str with table name (table) –
request_tables(self)[source]

Get tables tables from source, emits two singals, fetchingData: ConnectionManager is busy waiting for data startTableGet: a signal that the worker in another thread is listening to know when to run get a list of table names.

request_data(self, table=None, max_rows=-1)[source]

Request data from emits dataReady to with data

Keyword Arguments:
 
  • {str} -- which table to get data from (default (table) – {None})
  • {int} -- how many rows to read (default (max_rows) – {-1})
request_mapped_data(self, table_mappings, max_rows=-1)[source]

Get mapped data from csv file

Parameters:{dict} -- dict with filename as key and a list of mappings as value (table_mappings) –
Keyword Arguments:
 {int} -- number of rows to read, if -1 read all rows (default (max_rows) – {-1})
connection_ui(self)[source]

launches a modal ui that prompts the user to select source.

ex: fileselect if source is a file.

init_connection(self)[source]

Creates a Worker and a new thread to read source data. If there is an existing thread close that one.

_handle_connection_ready(self)[source]
_handle_tables_ready(self, table_options)[source]
_new_options(self)[source]
set_table_options(self, options)[source]

Sets connection manager options for current connector

Parameters:{dict} -- Dict with option settings (options) –
option_widget(self)[source]

Return a Qwidget with options for reading data from a table in source

close_connection(self)[source]

Close and delete thread and worker

class spine_io.connection_manager.ConnectionWorker(source, connection, parent=None)[source]

Bases: PySide2.QtCore.QObject

A class for delegating SourceConnection operations to another QThread.

Parameters:
  • source (str) – path of the source file
  • connection (class) – A class derived from SourceConnection for connecting to the source file
connectionFailed[source]
error[source]
connectionReady[source]
tablesReady[source]
dataReady[source]
mappedDataReady[source]
init_connection(self)[source]

Connect to data source

tables(self)[source]
data(self, table, options, max_rows)[source]
mapped_data(self, table_mappings, options, max_rows)[source]
disconnect(self)[source]