Pyjnius loader classΒΆ

The PyjniusLoader class provides lazy Java loading support used by specific assets that depend on Java-backed calculations.

class omotes_simulator_core.entities.assets.pyjnius_loader.PyjniusLoader

Class to load Pyjnius and connect to Rosim.

This is a singleton and you should only use PyjniusLoader.get_loader() instead of constructing this class directly.

Also ensure that after loading this class, the process is not forked into a subprocess as this will destroy the connection to Pyjnius and may lead to an indefinite hang when using Java code.

static download_rosim_jar() str

Download the Rosim JAR files.

This function will download the required Rosim JAR files into the bin folder. It will download it from the latest release on github of the simulator-core repository. If there is already a rosim jar in the bin folder it will not download it and use that one. If you want the downloaded the latest one, simply delete your local copy. We have implemented this to bypass the 100 mb size limit on pypi. It returns the name of the downloaded JAR file.

static get_loader() PyjniusLoader

Get the global instance of the PyjniusLoader.

This loader allows to load Java classes. This is the preferred method of retrieving a reference to the PyjniusLoader.

load_class(classpath: str) Callable

Load a Java class.

If it has been loaded previously, the reference to the class will be loaded from cache. Otherwise, it is loaded through pyjnius.