:py:mod:`vspyx.Scripting` ========================= .. py:module:: vspyx.Scripting Package Contents ---------------- Classes ~~~~~~~ .. autoapisummary:: vspyx.Scripting.Component vspyx.Scripting.FunctionBlock vspyx.Scripting.FunctionBlock vspyx.Scripting.FunctionBlockStepHandler vspyx.Scripting.FunctionBlockStepHandler vspyx.Scripting.Module vspyx.Scripting.PythonComponent vspyx.Scripting.PythonScript vspyx.Scripting.Script vspyx.Scripting.TextAPI .. py:class:: Component Bases: :py:obj:`vspyx.Runtime.Component` .. autoapi-inheritance-diagram:: vspyx.Scripting.Component :parts: 1 :private-bases: A Component with a Tick() function, and rules about when to call it. .. py:method:: ComponentStart(self) -> Any .. py:method:: EnvironmentInitialize(self) -> Any .. py:method:: EnvironmentShutdown(self) -> Any .. py:method:: Tick(self) -> Any Execute the contents of the Scripting::Component Generally this is called on the ticking thread, triggered by Trigger(), rather than being called directly. .. py:method:: Trigger(self) -> Any Schedule the Tick to be executed as soon as possible Generally you want to call this rather than Tick() directly, so that Tick() is executed on its own thread and will not block the current thread. .. py:class:: FunctionBlock .. py:class:: FunctionBlock Bases: :py:obj:`vspyx.Runtime.Component` .. autoapi-inheritance-diagram:: vspyx.Scripting.FunctionBlock :parts: 1 :private-bases: A collection of steps that generate a PythonComponent, which is automatically added as a child. .. py:class:: CompilationContext CompilationContext .. py:class:: Func Func .. py:attribute:: Ops :annotation: :List[str] .. py:method:: PopIndent(self) -> Any .. py:method:: PushIndentingOp(self, op: str) -> Any .. py:method:: PushOp(self, op: str) -> Any .. py:attribute:: Imports :annotation: :Any .. py:attribute:: Tick :annotation: :FunctionBlock.CompilationContext.Func .. py:attribute:: OnConfigurationMutation :annotation: :vspyx.Core.Callback_634bd5c449 .. py:method:: CloneConfiguration(self) -> Any .. py:method:: New(config: Any) -> FunctionBlock :staticmethod: .. py:method:: Trigger(self) -> Any Run the Function Block now .. py:class:: FunctionBlockStepHandler .. py:class:: FunctionBlockStepHandler An object which compiles a particular FunctionBlock Step into a FunctionBlock's CompilationContext. .. py:attribute:: HandlesType :annotation: :str Returns the protobuf type string for the type that this StepHandler will handle. .. py:class:: Module Bases: :py:obj:`vspyx.Core.Module` .. autoapi-inheritance-diagram:: vspyx.Scripting.Module :parts: 1 :private-bases: Module .. py:attribute:: ActivePythonScript :annotation: :PythonScript .. py:method:: DeregisterFunctionBlockStepHandler(self, handler: FunctionBlockStepHandler) -> Any .. py:method:: GetFunctionBlockStepHandler(self, stepType: str) -> FunctionBlockStepHandler .. py:method:: NewPythonScript(self) -> PythonScript NewPythonScript(self, argv: List[str]) -> PythonScript NewPythonScript(self, argv: List[str], extraPackagePaths: List[str]) -> PythonScript .. py:method:: RegisterFunctionBlockStepHandler(self, handler: FunctionBlockStepHandler) -> Any .. py:class:: PythonComponent Bases: :py:obj:`Component` .. autoapi-inheritance-diagram:: vspyx.Scripting.PythonComponent :parts: 1 :private-bases: A Scripting::Component whose Tick() function is implemented in Python. .. py:attribute:: Code :annotation: :str .. py:attribute:: OnConfigurationMutation :annotation: :vspyx.Core.Callback_634bd5c449 .. py:method:: CloneConfiguration(self) -> Any .. py:method:: New(config: Any) -> PythonComponent :staticmethod: .. py:class:: PythonScript Bases: :py:obj:`Script`, :py:obj:`vspyx.Core.Environment` .. autoapi-inheritance-diagram:: vspyx.Scripting.PythonScript :parts: 1 :private-bases: PythonScript .. py:attribute:: Application :annotation: :vspyx.Core.Application .. py:attribute:: LastErrorTraceback :annotation: :str .. py:method:: RunModule(self, mod: str) -> Any .. py:method:: RunPath(self, path: str) -> Any .. py:method:: RunSource(self, source: str) -> Any .. py:class:: Script Bases: :py:obj:`vspyx.Core.Object` .. autoapi-inheritance-diagram:: vspyx.Scripting.Script :parts: 1 :private-bases: Script .. py:class:: RunResult Bases: :py:obj:`enum.IntEnum` .. autoapi-inheritance-diagram:: vspyx.Scripting.Script.RunResult :parts: 1 :private-bases: Enum where members are also (and must be) ints .. py:attribute:: Error :annotation: = 1 .. py:attribute:: Finished :annotation: = 0 .. py:attribute:: Paused :annotation: = 2 .. py:attribute:: LastError :annotation: :str Get a description of the last error that occured :Returns: description of the last error .. py:attribute:: OnOutput :annotation: :vspyx.Core.Callback_6ee07abf48 Callback for when the script produces text output .. py:attribute:: OnStart :annotation: :vspyx.Core.Callback_634bd5c449 Callback for when script starts .. py:method:: Run(self) -> Script.RunResult Run the script. In the case of an error, use GetLastError() to retreive error information. :Returns: result of running .. py:method:: Stop(self) -> Any .. py:class:: TextAPI Bases: :py:obj:`vspyx.Core.ResolverObject` .. autoapi-inheritance-diagram:: vspyx.Scripting.TextAPI :parts: 1 :private-bases: TextAPI .. py:attribute:: Script :annotation: :PythonScript .. py:method:: Execute(self, cmd: str) -> str Execute a command :Parameter cmd: the command :Returns: the result .. py:method:: Intellisense(self, additionalNamespace: str) -> List[str] Perform an intellisense operation This will provide available options in the current namespace, as well as additional namespace appended to it. Only full namespaces should be passed; partially finished namespaces should be handled by the client. The type of access should be included. For example, to get intellisense for the user typing "Core.St", additionalNamespace should be "Core." :Parameter additionalNamespace: an additional namespace after the current namespace :Returns: all available items .. py:method:: New() -> TextAPI :staticmethod: