Source code for node_import_table
# This file is part of Sympathy for Data.
# Copyright (c) 2013, 2017, Combine Control Systems AB
#
# Sympathy for Data is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# Sympathy for Data is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Sympathy for Data. If not, see <http://www.gnu.org/licenses/>.
import os
from sylib.importer import base
from sympathy.api import node as synode
from sympathy.api import importers
from sympathy.api.nodeconfig import Port, Ports
from sylib import docs
def _output_item_filename_hook(output_item, filename):
if not output_item.name:
output_item.name = os.path.splitext(
os.path.basename(filename))[0]
[docs]
class ImportTable(base.ImportSingle, synode.Node):
__doc__ = docs.IMPORTER_DOCS + base.URL_DOC
author = "Alexander Busck"
name = 'Table'
description = 'Import datasource as a table'
nodeid = 'org.sysess.sympathy.data.table.importtable'
icon = 'import_table.svg'
outputs = Ports([Port.Table('Imported Table', name='port1')])
plugins = (importers.TableDataImporterBase, )
related = [
'org.sysess.sympathy.data.table.importtablemultiple',
'org.sysess.sympathy.export.exporttables',
]
def _output_item_filename_hook(self, output_item, filename):
_output_item_filename_hook(output_item, filename)
[docs]
class ImportTables(base.ImportMulti, synode.Node):
__doc__ = docs.IMPORTER_DOCS + base.URL_DOC
author = "Alexander Busck"
name = 'Tables'
description = 'Import datasources as Tables.'
nodeid = 'org.sysess.sympathy.data.table.importtablemultiple'
icon = 'import_table.svg'
outputs = Ports([Port.Tables('Imported Tables', name='port1')])
plugins = (importers.TableDataImporterBase, )
related = [
'org.sysess.sympathy.data.table.importtable',
'org.sysess.sympathy.export.exporttables',
]
def _output_item_filename_hook(self, output_item, filename):
_output_item_filename_hook(output_item, filename)