Extending the code editor¶
An object that receives events from the code editor. Override it to implement your plugin.
did_run_script(script_path: str, local: dict, exception: Exception)¶
Called when a script finished running.
- script_path – The path of the script.
- local – The
__dict__attribute of the executed script.
- exception – The exception raised by the script. Can be
By overriding this method, a new button will be added the the code editor’s toolbar.
From this function, return the icon of this button.
There are three possible return types:
- A PIL Image
- An Objective-C
- A string with the name of an SF Symbol. List of SF Symbols
This method receives the path of the script being edited as parameter. If you want to not display a button for specific scripts, raise
Parameters: script_path – The path of the script being edited. Return type: Union[Image.Image, UIImage, str]
editor_button_icon()function is implemented, this method will be called when the button in the toolbar is pressed.
Parameters: script_path – The path of the script being edited.
run_script(script_path: str, run: Callable[, None])¶
Called when a script will be executed.
run()function isn’t called, the script will not be executed.
- script_path – The path of the script to be executed.
- run – Call this function to run the script.
show_ui(view: pyto_ui.View, mode: ui_constants.PRESENTATION_MODE)¶
This function is called when a
Viewwill be presented.
- view – The
Viewto be presented.
- mode – The presentation mode.
- view – The