Source code for node_create_text
# This file is part of Sympathy for Data.
# Copyright (c) 2023, 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/>.
from sympathy.api import node as synode
from sympathy.api.nodeconfig import Port, Ports, Tag, Tags
[docs]
class CreateText(synode.Node):
"""Create text by writing in the text editor."""
name = 'Create Text'
icon = 'import_text.svg'
nodeid = 'org.sysess.sympathy.create.createtext'
author = 'Jin Guo'
version = '1.0'
tags = Tags(Tag.Input.Generate)
parameters = synode.parameters()
parameters.set_string('text',
label='Text',
description='Write in the editor to create output '
'text',
editor=synode.editors.textedit_editor())
outputs = Ports(
[Port.Custom('text', 'Output Text', name='output')])
def execute(self, ctx):
output = ctx.output['output']
output.set(ctx.parameters['text'].value)