Code documentation

The plugin functionality is split in two files:

  1. yapycon.py

    • For the actual code of the plugin.

  2. yasara_kernel.py

    • For all YASARA functionality available within YaPyCon.

yapycon.py

Note

The description of the yapycon plugin code in the following parts of the documentation, might show up as a random collection of MainMenu, PullDownMenu, etc, statements.

It is not.

YASARA uses the docstring of a plugin to determine where in its menu hierarchy to position the option to run the plugin, whether the plugin needs to be launched over a particular selection and other parameters that are passed to it when YASARA launches it.

For more details about how this works and why the docstring of yapycon looks the way it does here, please see the following sections:

MainMenu: Window
PullDownMenu after Update frequency: Python Console

Request: YaPyCon

class yapycon.yapycon.RpcServerThread(*args, **kwargs)

Maintains the rpyc thread which allows the console process to interface with the context of the originating process.

run()

Launches the RPC ThreadedServer.

class yapycon.yapycon.YasaraContextRelayService(connection_info=None)

An rpyc service that establishes a “bridge” between the YaPyConsole plugin and subsequent processes.

Notes:
  • This object is basically a “proxy” between data in the context of the plugin process and the context of subsequent processes.

  • Although this object is entirely “visible” through the console, it is not meant to be used directly.

yapycon.yapycon.yapycon_launch_plugin(plugin_request)

Handles the initialisation and launching of the YaPyCon plugin.

Parameters:

plugin_request (str) – The request string sent by YASARA when the plugin is launched.

yapycon.yapycon.yapycon_plugin_check_if_disabled()

Checks if YaPyCon can launch.

Notes:
  • This function checks if it was possible for YaPyCon to load certain pre-requisite modules.

  • If these modules were not found, this function will signal this to YASARA (by returning a 1) and subsequently, YaPyCon’s menu option (“Python Console”) will not be available in YASARA.

Returns:

Either 0 or 1 to signal Success or Failure to launch respectively.

Return type:

int

yasara_kernel.py