Remote Objects¶
Remote method invocation from Python scripts to MHI application entities.
Remotable¶
-
class
mhi.enerplot.common.remote.
Remotable
¶ Base class for Remote Method Invocation (RMI) enabled objects
-
main
¶ A reference to the
Application
object that returned thisRemotable
object.
-
Application¶
-
class
mhi.enerplot.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.
-
silence
¶ When set to True, silence all popup dialogs, using the dialog’s “default” action.
-
is_alive
()¶ 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
()¶ 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
()¶ Terminate connection to remote application.
Note: The remote application will not be terminated. The “silence all dialog and message boxes” flag is cleared.
-
Decorators¶
@rmi¶
@rmi_property¶
-
class
mhi.enerplot.common.remote.
rmi_property
(fget=None, fset=None, fdel=None, doc=None, name=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.enerplot.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.