blark.solution.TwincatSourceCodeItem

class blark.solution.TwincatSourceCodeItem(saved_path: PurePath, local_path: Path | None, subtype: str | None, link_always: bool, raw_contents: bytes, contents: TcDUT | TcPOU | TcIO | TcGVL | TcTTO, guid: str | None = None, parent: TwincatPlcProject | None = None)[source]

Bases: object

A wrapper for all TwinCAT project source code files.

Information from the project may be stored here alongside that of the source code file itself. The contents of the source code file are stored in contents, with raw_contents holding raw bytes from the file.

Methods

__init__(saved_path, local_path, subtype, ...)

from_compile_xml(xml[, parent])

save_to(path[, delimiter])

to_file_contents([delimiter])

Attributes

guid

The globally unique identifier for the source code item.

parent

The parent project, if applicable.

saved_path

The path according to the solution:r likely a Windows-formatted path which is case-insensitive.

local_path

The corresponding local filename.

subtype

The subtype of the file.

link_always

Link always set?

raw_contents

Raw file contents.

contents

Contents loaded into a type-specific class.

saved_path: PurePath

The path according to the solution:r likely a Windows-formatted path which is case-insensitive.

local_path: Path | None

The corresponding local filename.

subtype: str | None

The subtype of the file.

Link always set?

raw_contents: bytes

Raw file contents.

contents: TcDUT | TcPOU | TcIO | TcGVL | TcTTO

Contents loaded into a type-specific class.

guid: str | None = None

The globally unique identifier for the source code item.

parent: TwincatPlcProject | None = None

The parent project, if applicable.

to_file_contents(delimiter: str = '\r\n') bytes[source]
save_to(path: str | Path, delimiter: str = '\r\n') None[source]
classmethod from_compile_xml(xml: Element, parent: TwincatPlcProject | None = None) Self | None[source]
__init__(saved_path: PurePath, local_path: Path | None, subtype: str | None, link_always: bool, raw_contents: bytes, contents: TcDUT | TcPOU | TcIO | TcGVL | TcTTO, guid: str | None = None, parent: TwincatPlcProject | None = None) None