Remote Objects¶
Remote method invocation from Python scripts to MHI application entities.
Remotable¶
- class mhi.common.remote.Remotable¶
Base class for Remote Method Invocation (RMI) enabled objects
- property main: Application¶
A reference to the
Application
object that returned thisRemotable
object.
Application¶
- class mhi.common.remote.Application¶
A Remote Application object.
This object represents the running application. It implements the “context manager” protocol, allowing a Python script to automatically close the communication channel when the application object goes out of scope.
- property silence: bool¶
When set to True, silence all popup dialogs, using the dialog’s “default” action.
- is_alive() bool ¶
Tests whether the application process is still running, and the communication socket to the application is still open.
- Returns:
True
is the application communication channel is open,False
otherwise.- Return type:
bool
- quit() None ¶
Terminate the remote application.
Note: The local side of the socket connection to the remote application is not explicitly closed. The client is responsible for explicitly closing the connection:
application.quit() application.close_connection()
or by using a context manager:
with ... as application: # interact with the application # # application.close_connection() is automatically called # when the `with` statement block exits.
- close_connection() None ¶
Terminate connection to remote application.
Note: The remote application will not be terminated. The “silence all dialog and message boxes” flag is cleared.
- property version: str¶
Application Version
- minimum_version(version: Union[str, Version]) bool ¶
Test if the remote application version is the given version or later.
- Parameters:
version (str) – The version number to test against.
- Returns:
True
if the remote application version is greater thanor equal to
version
,False
otherwise.
- Return type:
bool
- requires(version: str, msg: str = 'Feature') None ¶
Verify the remote application is the given version or later.
A
NotImplementedError
is raised if the remote application version is less than the required version.- Parameters:
version (str) – The required version number.
Decorators¶
@rmi¶
@rmi_property¶
- class mhi.common.remote.rmi_property(fget=None, fset=None, doc=None, name=None, requires=None)¶
A property which is stored in a remote object
Apply this decorator to a property of a
Remotable
object causes the property access attempts to be forwarded to the remote application object.Remote properties may never be deleted.
Context¶
- class mhi.common.remote.Context¶
A Remote Context object
This class is responsible for communications between the Python script and the remote application objects.
Calls to
rmi
methods and access tormi_properties
are pickled, and sent over a communication channel. The results of these operations are received from the communication channel, depickled, and returned to the caller. Any exception generated by the remote operation is also transfered over the communication channel and raised locally.- is_alive() bool ¶
Is a connection to the server still active?
- close() None ¶
Close communication
Socket Context¶
Queue Context¶
Exceptions¶
- class mhi.common.remote.RemoteException(message, *args)¶
Indication of an API error communicating with remote objects