class
ScriptTextListObject.
ScriptTextListMarker
Bases: object
Marker object to check whether an ScriptObject is a textlist object.
Version added
3.5.11.0
is_textlist
Gets a value indicating whether this ScriptApplicationMarker is a textlist.
Return type
bool
Returns
True if it is a textlist; otherwise False.
class
ScriptTextListObject.
ScriptTextListObject
Bases: ScriptTextListObject.ScriptTextListMarker
ScriptObjects which are a textlist object are extended with this interface.
Version added
3.5.11.0
addlanguage
language
Adds a new language to the text list.
If the language already exists, it is not added twice.
removelanguage
language
Removes a new language to the text list.
rows
Gets the collection of the rows currently configured within this textlist.
Return type
languagecount
Gets the current number of languages in this textlist.
Return type
int
getlanguage
index
Returns the language with the given index.
Parameters
index (int) -- The index of the language to return.
Raises
ArgumentOutOfRangeException -- Thrown when the given index is not in the valid range.
Return type
str
updatetextids
Only for global textlist.
Calls the command 'Update Visualization Text IDs' for this textlist. This command updates all inconsistent IDs in a static text list.
checkids
Only for global textlist.
Calls the command 'Check Visualization Text IDs' for this textlist. This command checks whether the ID of a text list entry in the project is correct and reports the result.
removeunusedids
Only for global textlist.
Calls the command 'Remove Unused Text List Entries' for this textlist. This command checks whether a text list entry in the project is used as static text. If not, CODESYS removes it from the text list.
importfile
importfile
Like in import/export dialog: The file can contain text list entries both for the global text list and for text lists.
importreplacementfile
importfile
Like in import/export dialog: The replacement file contains replacements for the global text list.
Parameters
importfile (str) -- Name and path of a file of type csv.
export
exportfile
Like in import/export dialog: exports all the texts from all the text lists in the current project.
class
ScriptTextListObject.
ScriptTextListRow
Bases: object
A row within an ScriptTextListObject.
Version added
3.5.11.0
id
The identification of the row.
Return type
str
defaulttext
The default text entry in this row.
Return type
str
setlanguagetext
language
text
Sets the text in the row, for a defined language.
Parameters
language (str) -- The languagename, which defines the language entry, to use.
text (str) -- The text to set for this language.
Raises
ArgumentOutOfRangeException -- Thrown when the language does not yet exist in the textlist.
Return type
bool
Returns
True if the text could be set, otherwise False.
setdefaulttext
defaulttext
Sets the defaulttext in this row.
Parameters
defaulttext (str) -- The defaultext to set for this row.
Return type
bool
Returns
True if the text could be set, otherwise False.
languagetextcount
Gets the current number of languagetexts in this row.
Return type
int
languagetext
index
Gets the languagetext.
Parameters
index (int) -- The index of the languagetext to return.
Raises
ArgumentOutOfRangeException -- Thrown when the given index is not in the valid range.
Return type
str
Returns
The language text.
class
ScriptTextListObject.
ScriptTextListItemsCollection
Bases: list
The items currently managed by the textlist object.
Version added
3.5.11.0
add
id
defaulttext
Adds a new row to the current textlist.
Parameters
id (str) -- The id to assign to the newly inserted row. Must not yet be existing.
defaulttext (str) -- The default text.
Return type
Returns
The newly created ScriptTextListRow.
remove
id
Removes the ScriptTextListRow with the given id.
Parameters
id (str) -- The id of the item to remove.
Raises
KeyNotFoundException -- Thrown when no entry with the given id exists.
class
ScriptTextListObject.
ScriptTextListObjectContainer
Bases: object
Projects and Application Objects are extended with this interface.
Version added
3.5.11.0
create_textlist
name=None
Creates a new textlist object in the current context (either application or project global).
Parameters
name (str) -- The name of the new textlist object. In case of None, a default name will be generated.
Raises
ArgumentException -- Thrown when a textlist with the given name already exists within the current context.
Return type
Returns
The newly created textlist object.
get_global_textlist
Returns the global textlist object or creates a new one if not yet existing.
Typically this method can be called on projects only. Only in case of special customizations of the programming system, it is allowed to call this on an application too.
Return type
Returns
The global textlist.
has_global_textlist
Checks whether there is already a global textlist in the current location.
Only in case of special customizations of the programming system, it is allowed to call this on an application too.
Raises
InvalidOperationException -- Thrown when called on applications when this is not allowed.
Return type
bool