RamDaemonInterface

This is a low-level Class used to communicate with the Ramses Daemon. This is a simple wrapper for the Daemon API.

One (and only one) instance is globally available (RamDaemonInterface is a singleton), by calling RamDaemonInterface.instance() or Ramses.instance().daemonInterface().

Note

You should not need this class as all communications are automatically handled by the other classes.

Static Methods

Method Arguments Description Dev Notes
instance
RamDaemonInterface
Returns the RamDaemonInterface unique instance.
checkReply
boolean
dict: reply Checks if the reply returned by a RamDaemonInterface instance is accepted, successful and has some content.

Methods

Please refer to the Daemon API reference for more information about these methods.

These methods return the reply of the Daemon converted from JSON to an object, dict, structure, or whatever best suits the language in which the add-on is implemented. This returned object can be converted to a RamObject instance using the corresponding RamObject.fromDict() static method.

Method Arguments Description Dev Notes
create
Object / Dict
string: uuid
string or Object/ Dict: data
string: objectType
Creates a new object, with the given data
getCurrentProject
RamProject or None
Gets the current project
getCurrentUser
RamUser or None
Gets the current user
getData
Object / Dict
string: uuid Gets the data of a specific RamObject.
getObjects
list of RamObject
string: objectType Gets the list of objects of a given type. The returned class type depends on the type of object and may be a derived class of RamObject.
getPath
string
string: uuid Gets the path for a specific object.
getProjects
list of RamProject
Gets the list of available projects (for the current user)
getRamsesFolderPath
string
Gets the main Ramses folder containing projects, config files, user files…
online
boolean
True if the Daemon is available
ping
Object / Dict
Gets the version and current user of the Ramses Daemon
raiseWindow Raises the Ramses Application main window
setCurrentProject
Object / Dict
string: uuid Sets the current project
setData
Object / Dict
string: uuid
string or Object/ Dict: data
Sets the data for a specific RamObject.
uuidFromPath
string
string: path
string : type = "RamObject"
Gets the UUID of a RamObject using its path.

Examples

# Python
daemon = RamDaemonInterface.instance()
reply = daemon.getProjects() # Call from the instance
if RamDaemonInterface.checkReply(reply): # Call from the class, it's a static method
    doSomething(reply['content'])
else:
    print (reply['message'])
// JavaScript
var daemon = RamDaemonInterface.instance();
var reply = daemon.getProjects(); // Call from the instance
if ( RamDaemonInterface.checkReply(reply) ) { // Call from the class, it's a static method
    doSomething(reply['content']);
}
else {
    alert (reply['message']);
}

Implementation

Python

In Python, the methods from this class return a dict as constructed from the JSON reply of the Daemon using the standard json.loads( str ) method.

JavaScript / ExtendScript

In JS, the methods from this class return a standard JS object as constructed from the JSON reply of the Daemon using the standard json2 library.


META