mgvApi module

Mangrove API. Sets of tools to control Mangrove data.

Functions:

getCurrentNode: Return the current node object.

getCurrentGraph: Return the current graph object.

getCurrentProject: Return the current project object.

unlock_request: Ask for a Mangrove instance to free a node.

extractPath: Extract the shape and median color of an image.

ExeScript: Execute a script.

Classes:

MgvProject: Stores the project attributes.

MgvContext: Stores environment sets.

MgvHud: Script to launch at events.

MgvPattern: Class of Mangrove graphs.

MgvGraphTemplate: Default graph to preset new ones.

MgvGraph: Stores the nodes tree.

MgvGroup: A colored box that group nodes.

MgvNode: Mangrove node.

MgvNodeVersion: A version of a node.

MgvLink: Link object between nodes.

MgvVariable: A variable that can be attached to a graph or a node version.

MgvType: Class of a node.

MgvTypeVersion: Version of a type.

MgvTypeFile: An output file of a node.

MgvAction: An execution script that can be lauched by a node.

MgvParam: Parameter of a node.

mgvApi.ExeScript(script, textEdit=None, env=None, line_offset=0)

Execute a script and redirect the output to a text widget if provided.

Parameters:
  • script (str) – the script to execute.
  • textEdit (QWidget) – the text widget to redirect the output to.
  • line_offset (int) – if an error occured, offset the line number with this value.
class mgvApi.MgvAction(uuid=None, version=None, name='', menu='', command='', warning='', users='', stack=True, order=0)

Bases: object

Mangrove Action object.

uuid

unique id in the database.

Type:str
name

the action name.

Type:str
menu

name of menu path to the action. i.e. “MyNodes” or “MyNodes|menuA|submenuB”

Type:str
warning

message in a dialog window to confirm the action, or empty if no confirmation is needed.

Type:str
command

the python script of the action.

Type:str
users

list of users who can see this action separated by “,” or empty for all users.

Type:str
stack

True if next action has to wait this one to finish in the action stack.

Type:bool
order

used to organize the display order of the type actions.

Type:int
code = 'Action'
create()

Create the equivalent object in the database.

getJson()

Return a dictionary representing the action.

getName()

Return the name of the action.

getProject()
setName(name)

Set the name of the action.

class mgvApi.MgvBatchScript(uuid=None, project=None, name='', menu='', users='', script='', pattern='', template='')

Bases: object

Mangrove Action object.

uuid

unique id in the database.

Type:str
name

the batchscript name.

Type:str
users

list of users who can see this batchscript separated by “,” or empty for all users.

Type:str
script

the script of the hud.

Type:str
pattern

the pattern name where the batchscript will be visible or ‘All Patterns’.

Type:str
template

the template name where the batchscript will be visible or ‘All Templates’.

Type:str
code = 'BatchScript'
create()

Create the equivalent object in the database.

getJson()

Return a dictionary representing the action.

getName()
getProject()
setMenu(menu)

Set the menu of the batchscript.

setName(name)

Set the name of the batchscript.

setPattern(pattern)

Set the pattern of the batchscript.

setScript(script)

Set the script of the batchscript.

setUsers(users)

Set the users of the batchscript.

class mgvApi.MgvContext(uuid=None, project=None, name='', value='')

Bases: object

Mangrove Context object.

A context is attached to a project and store a set of variables and their values. Those variables will be set as environment variables before a node’s execution. Each type of node can specify which context to use.

uuid

unique id in the database.

Type:str
name

the name of the context.

Type:str
value

a multiline string.

Type:str
Example of value attribute:
val1=/path/file.ext SOFT_VERSION=10.5
code = 'Context'
create()

Create the equivalent object in the database.

getJson()

Return a dictionary representing the context.

getName()

Return the name of the context.

getProject()
getValue()

Return the value of the context.

setName(name)

Set the name of the context.

setValue(value)

Set the value of the context.

class mgvApi.MgvGraph(pattern=None, path=None, uuid=None, template_name='', name='', load=True)

Bases: object

Mangrove Graph object.

uuid

unique id in the database.

Type:str
name

the name of the graph.

Type:str
pattern

the pattern of the graph.

Type:MgvPattern
template_name

the name of the template to use at first opening.

Type:str
path

the keys of the graph.

Type:list of str
nodes

the nodes of the graph.

Type:list of MgvNode
groups

the groups of the graph.

Type:list of MgvGroup
user

a code composed with the current user name and a random number separated by “$”. The random number is used to differenciate multiple mangrove sessions with the same user.

Type:str
variables

variables of the graph.

Type:list of MgvVariables
code = 'Graph'
create()

Create the equivalent object in the database Also create node, group and variable objects if any.

forceNodes(nodes, port)

Asks to another Mangrove instance to free a node, force lock without response.

getFilePath()

Return the path of the mgv file corresponding to the graph, in case of no database server is used.

classmethod getFromJson(element, pattern)

Create a node from a dictionary.

getFullName()

Return the complete path of the graph from project name to last key. i.e. “MyProject:Shots:0001:0001”.

getGroups()

Return a list of the groups of the graph.

getJson()

Return a dictionary representing the graph.

getName()

Return the name of the graph.

getNode(name)

Return a node from its name.

getNodes(name='', type='')

Return graph nodes.

Examples

getNodes() getNodes(name=”toto”) getNodes(type=”render*”) getNodes(name=”toto*”, type=”render*”)

getPath()

Return the keys of the graph.

getProject()
getUser()

Return the user of the graph.

getVariables()

Return a list of the variables of the graph.

getVars()

Return a dictionary of the env variables of this graph.

getWorkDirectory()

Return the directory of the graph by filling the pattern with its keys.

refresh(graphview=None)

Reload all nodes, variables and groups from the database.

setEnv(name, value)

Set a new environment variable for this graph.

setName(name)

Set the name of the graph.

class mgvApi.MgvGraphTemplate(uuid=None, pattern=None, name='Empty', icon='')

Bases: object

Mangrove GraphTemplate object.

A template is a default graph that can be used to prefill new graphs created in a pattern. The new graph is filled at the first openning attempt, therefore it inherits the last modifications of the template.

uuid

unique id in the database.

Type:str
name

the template name.

Type:str
pattern

the pattern.

Type:MgvPattern
icon

the path of an image used in the UI to select a template when openning a new graph.

Type:str
code = 'GraphTemplate'
create()

Create the equivalent object in the database.

getIcon()

Return the icon path of the template.

getJson()

Return a dictionary representing the template.

getName()

Return the name of the template.

getProject()
setIcon(icon)

Return the icon path of the template.

setName(name)

Set the name of the template.

class mgvApi.MgvGroup(uuid=None, graph=None, name='Group', color='#3366BB', nodeuuids=None)

Bases: object

Mangrove Group object.

uuid

unique id in the database.

Type:str
name

the name of the group.

Type:str
graph

the graph of the group.

Type:MgvGraph
nodeuuids

uuids of the nodes in the group.

Type:list of str
color

color of the group, i.e. #FF0000

Type:str
addNodes(nodes)

Add nodes to the group.

code = 'Group'
create()

Create the equivalent object in the database.

delete()

Delete the group.

getColor()

Return the color of the group.

classmethod getFromJson(element, graph)

Create a group from a dictionary.

getJson()

Return a dictionary representing the group.

getName()

Return the name of the group.

getNodes()

Return a list of the nodes of the group.

getProject()
removeNodes(nodes)

Remove nodes from the group.

setColor(color)

Set the color of the group.

setName(name)

Set the name of the group.

class mgvApi.MgvHud(uuid=None, project=None, name='', script='return []', event='open')

Bases: object

Mangrove Hud object.

A hud is a script that is executed in a parallel thread at a specific event. The script should returns a value displayed in a graph Mangrove UI. The script can use the opened graph environment vars such as MGVGRAPHNAME.

uuid

unique id in the database.

Type:str
name

the name of the hud.

Type:str
script

the script of the hud. This script should return a list of strings.

Type:str
event

when to execute the script. It can be, open: when the graph is opened. select: when the selection changes. refresh: when the grah is refreshed. toggle: when the hud box is toggled.

Type:str
code = 'Hud'
create()

Create the equivalent object in the database.

getEvent()

Return the event of the hud.

classmethod getFromJson(element)

Create a hud from a dictionary.

getJson()

Return a dictionary representing the hud.

getName()

Return the name of the hud.

getProject()
getScript()

Return the script of the hud.

setEvent(event)

Set the event of the hud.

setName(name)

Set the name of the hud.

setScript(script)

Set the script of the hud.

Bases: object

Mangrove Link object. This object doesn’t have a representation object in the database, since links a converted to node uuids in the node attributes.

linkfrom

source node.

Type:MgvNode
linkto

destination node.

Type:MgvNode
delete()

Delete the link.

getProject()
class mgvApi.MgvNode(graph=None, uuid=None, type='None', name='Noname', inputLinks=None, outputLinks=None, versions=None, versionActive=None, data=None)

Bases: object

Mangrove Node object.

uuid

unique id in the database.

Type:str
name

the name of the node.

Type:str
graph

the graph of the node.

Type:MgvGraph
type

the type of the node.

Type:MgvType
versions

the versions of the node.

Type:list of MgvNodeVersion
versionActive

the active version of the node. Can be an int in the __init__ function.

Type:MgvNodeVersion
posx

the x coordinate of the node.

Type:float
posy

the y coordinate of the node.

Type:float
user

a code composed with the name of the user who has protected the node and a random number separated by “$”. The random number is used to differenciate multiple mangrove sessions with the same user. If the node is free, this value equals “free”.

Type:str

input links.

Type:list of MgvLink

output links.

Type:list of MgvLink
port

the address and port of the user who has protected the node. i.e. “192.168.0.123:10000”

Type:str
catch()

Return True if the node is protectable.

code = 'Node'
create()

Create the equivalent object in the database. Also create version objects if any, and the directory of the node if a typeFile exists in the type.

delVersion(version)

Delete a version by its id or by the version object itself.

delete(remove_files=False)

Delete the node.

Parameters:remove_files (bool) – True to delete associated files and directories.
exe(actionname=None, textEdit=None)

Execute the action of the node. Redirect the output to a text widget if provided.

free()

Free the node.

getAllData()

Return a copy of the data dictionary.

getCurrentVersion()

Return the active version of the node.

getData(name)

Return a data value.

classmethod getFromJson(element, graph)

Create a node from a dictionary.

getGraph()

Return the graph of the node.

getInputNodes()

Return the input nodes.

getInputs()

Return a list of input nodes’s custom outputs converted to string.

getJson()

Return a dictionary representing the node.

getLinkedGroup(checknodes=None)

Return all nodes wich versions are connected together.

getName()

Return the name of the node.

getNextNodes()

Return all the output nodes, recursively.

getNodePos()

Return the coordinates of the node.

getOutputNodes()

Return the output nodes.

getParameter(key)

Return a parameter value on the active version of the node.

getPath()

Return the directory of the node.

getPort()

Return the address and port of the user who has protected the node.

getPrevNodes()

Return all the input nodes, recursively.

getProject()
getType()

Return the type of the node.

getTypeForceVersion()

Return the specific type version used with this node. Return -1 for the default one.

getUser()

Return the user name of the node.

getVars()

Return a dictionary of Mangrove variables, the graph variables and the node variables.

getVersion(version_id)

Return a specific version of the node.

getVersions()

Return the versions of the node.

newVersion(version_id=None, propagate=True)

Create a new version and set it active.

Parameters:
  • version_id (int) – force the new id value.
  • propagate (bool) – if there are nodes with connected versionning, propagate or not this change.
Returns:

New version object.

Return type:

MgvNodeVersion

removeData(name)

Remove a data.

setData(name, value)

Set a data value.

setLinkTo(node)

Create a link from this node to the specified node.

setName(name)

Set the name of the node.

setNodePos(x, y)

Change the coordinates of the node.

setParameter(key, value)

Set a parameter value on the active version of the node.

setPort(port)

Set the address and port of the user who has protected the node.

setType(typ)
setTypeForceVersion(i)

Set a specific type version to use with this node. Use -1 for the default one.

setUser(user, port='', ip='')

Change the current user of the node.

setVersion(version, propagate=True)

Change the active version to the version specified.

Parameters:
  • version (MgvNodeVersion or int) – a version object or id of the node.
  • propagate (bool) – if there are nodes with connected versionning, propagate or not this change.
class mgvApi.MgvNodeVersion(uuid=None, node=None, version_id=None, variables=None, parameters=None, comment='comment', lastExec='', lastUser='', data=None, typeForceVersion=-1, locked=False)

Bases: object

Mangrove Node Version object.

Parameters is a dictionary of modified type parameters values. When set to default value, the parameter is delete from this dictionary. Data is a dictionary with custom names and values, that you can use as you need, since Mangrove doesn’t use it. Data will not be converted into environment vars.

uuid

unique id in the database.

Type:str
id

version id.

Type:int
comment

comment of the version.

Type:str
lastExec

last execution date with the format: “%d/%m/%y %H:%M”

Type:str
lastUser

user who performed the last execution.

Type:str
node

node of the version.

Type:MgvNode
locked

True if this version’s editing is forbidden in the UI.

Type:bool
variables

variables of the version.

Type:list of MgvVariable
parameters

dictionary of the parameters name and values.

Type:dict
data

dictionary of the data name and values.

Type:dict
typeForceVersion

use this specific version of the type, or -1 if the default one.

Type:int
code = 'NodeVersion'
compileObject()
compileScripts(action=None)

Compile The project head script, the type head script and the action script. Add Exceptions, the creation of the mgvInputs object and the export of the mgvOutput object at the end.

create()

Create the equivalent object in the database. Also create variable, parameter and data objects if any.

delParameter(name)

Delete a parameter of the version.

delete()

Delete the version in the database.

exe(actionname=None, textEdit=None)

Execute the action of the node. Redirect the output to a text widget if provided.

getAllData()

Return a copy of the data dictionary.

getComment()

Return the comment of the version.

getData(name)

Return a data value.

classmethod getFromJson(element)

Create a node from a dictionary.

getId()

Return the id of the version.

getJson()

Return a dictionary representing the nodeVersion.

getLastExec()

Return the last exec time of the version.

getLastUser()

Return the exec user of the version.

getOutput()

Get the custom output python object, or return a new one if none.

getParameter(name)

Return a parameter value of the version.

getParameters()

Return a parameter dictionary of the version.

getProject()
getVars()

Return a dictionary of Mangrove variables, the graph variables and the node variables for this version.

isLocked()

Return lock state of the version.

lock()

Lock the version from editong in the UI.

removeData(name)

Remove a data.

setComment(comment)

Set the comment of the version.

setData(name, value)

Set a data value.

setLastExec(lastExec, lastUser)

Set the last exec time and user of the version.

setParameter(name, value)

Set a parameter value of the version.

unlock()

Unlock the version from editong in the UI.

class mgvApi.MgvParam(uuid=None, version=None, name='', type='int', enum='', default=0, visibility=True, order=0, advanced=False)

Bases: object

Mangrove Type Paramater object.

uuid

unique id in the database.

Type:str
name

the parameter name.

Type:str
type

data type. Can be “bool”, “int”, “float”, “string”, “text”, “python”, “file” or “enum”.

Type:str
enum

enum values separated by “;”.

Type:str
default

default value.

Type:str
visibility

True if this parameter is visible in the node editor.

Type:bool
advanced

True if this parameter should be in the node editor’s advanced section.

Type:bool
order

used to organize the display order of the type parameters.

Type:int
code = 'TypeParameter'
create()

Create the equivalent object in the database.

getDefault()

Return the default values of the parameter.

getEnum()

Return the enum values of the parameter.

getJson()

Return a dictionary representing the typeParameter.

getName()

Return the name of the parameter.

getProject()
getType()

Return the type of the parameter.

getVisibility()

Return the visibility state of the parameter.

setDefault(default)

Set the default value of the parameter.

setEnum(enum)

Set the enum values of the parameter.

setName(name)

Set the name of the parameter.

setType(type)

Set the type of the parameter.

setVisibility(visibility)

Set the visibility state of the parameter.

class mgvApi.MgvPattern(project=None, uuid=None, name='', pattern='/path/${0}/${0}_${1}', graph_name='${0}_${1}', templates=None, order=0)

Bases: object

Mangrove Pattern object.

A pattern is a class of Mangrove graphs. It is used to separate graphs in categories and to specify the path of each graph data.

uuid

unique id in the database.

Type:str
name

the pattern name.

Type:str
project

the project.

Type:MgvProject
pattern

the path of the graphs in this pattern.

Type:str
graph_name

the name of the graphs in this pattern.

Type:str
order

used to organize the display order of the project patterns.

Type:int
templates

list of available templates for this pattern.

Type:list of MgvGraphTemplate
Example of pattern attribute:

/path/project/Shots/${0}/${0}_${1} In this pattern, we design two keys, ${0} and ${1} used arbitrary here as sequence and shot. The data of a graph with sequence “0100” and shot “1580” will be stored in the folder : /path/project/Shots/0100/0100_1580

Number of keys are not limited and has to be written in this format : ${number}

code = 'Pattern'
convertGraphName(keys)

Return the pattern attribute with keys replaced by the values provided.

convertPath(keys)

Return the pattern attribute with keys replaced by the values provided.

create()

Create the equivalent object in the database. Also create templates objects if any.

deleteGraph(keys)

Delete a graph in the database and all its hierarchy.

getGraphInfo(keys)

Get a graph details from its path.

Parameters:keys (list of str) – path of the graph from the pattern name to its name.
Returns
dict: a dictionary with a uuid value and a template_name value.
getGraphName()

Return the graph_name attribute of the pattern.

getGraphs()

Return a dictionary of the graphs with this pattern, organized by keys.

getJson()

Return a dictionary representing the pattern.

getName()

Return the name of the pattern.

getPattern()

Return the pattern attribute of the pattern.

getProject()
graphExists(keys)

Check if a graph exists in the database.

Parameters:keys (list of str) – the graph path from the pattern name to the last key.
Returns:True if the graph exists.
Return type:bool
setGraphName(graph_name)

Set the graph_name attribute of the pattern.

setGraphTemplate(keys, template_name)
setName(name)

Set the name of the pattern.

setOrder(order)

Set the order of the pattern.

setPattern(pattern)

Set the pattern attribute of the pattern.

class mgvApi.MgvProject(uuid=None, name='', patterns=None, types=None, contexts=None, huds=None, script='', batchScripts=None, versions_padding=3, versions_start=1)

Bases: object

Mangrove Project object.

uuid

unique id in the database.

Type:str
name

the name of the project.

Type:str
types

available types for this project.

Type:list of MgvType
patterns

patterns of this project.

Type:list of MgvPattern
contexts

contexts of this project.

Type:list of MgvContext
huds

huds of this project.

Type:list of MgvHud
script

the first part of every node’s execution python script.

Type:str
batchScripts

a list of MgvBatchScript.

Type:dict
versions_padding

padding of the versions of a node.

Type:int
versions_start

number of the first version of a node.

Type:int
static Project(name)

Get a project object from its name.

code = 'Project'
create()

Create the equivalent object in the database.

delete()

Delete the database object of this project and all its hierarchy.

getContexts()

Return a list of the contexts of the project.

getHuds()

Return a list of the huds of the project.

getJson()

Return a dictionary representing the project.

getName()

Return the name of the project.

getPattern(name)

Return a pattern of the project.

getPatterns()

Return a list of the patterns of the project.

getProject()
getScript()

Return the script of the project.

getTypes()

Return a list of the types of the project.

getVersionsPadding()

Return the padding of the node versions of the project.

getVersionsStart()

Return the first version number of the nodes of the project.

lock(user)

Try to lock the project to prevent conflictual modifications.

Parameters:user (str) – the current user name.
Returns:
The current user name if the project was free,
else the user who locked the project.
Return type:str
readType(uuid)

Get a type of this project by its uuid.

readTypes()

Read or refresh the types of the project.

setHuds(huds)

Delete the project huds and add new ones.

setName(name)

Set the name of the project.

setScript(script)

Set the script of the project.

setVersionsPadding(versions_padding)

Set the padding of the node versions of the project.

setVersionsStart(versions_start)

Set the first version number of the nodes of the project.

unlock()

Force unlock the project.

class mgvApi.MgvType(uuid=None, project=None, category='', name='None', color='#000000', shape='Rectangle', typeFiles=None, shapeVector=None, image='', context='', linkWith=None, help='', width=100, versions=None, versionActive=-1, software='')

Bases: object

Mangrove Type object.

uuid

unique id in the database.

Type:str
project

the project of the type.

Type:MgvProject
name

the typeFile name.

Type:str
category

used to arrange types in the UI left panel.

Type:str
color

the color of a node with this type, with the format “#FF0000”.

Type:str
shape

shape of the node. Can be “Rectangle”, “Circle” or “Image”.

Type:str
width

width of the node.

Type:int
shapeVector

If the shape is “Image”, this is the path around the alpha channel used to display selection outline.

Type:list of tuples
image

if the shape is “Image”, path to that image.

Type:str
linkWith

uuids of types whose node versions have to be synchronised if linked after a node of this type. Example: It is typeA, you have typeB’s uuid in this list. If you have a node nodeA of type typeA connected to a node nodeB of type typeB, then adding, deleting or changing version on nodeA will do as well on node nodeB.

Type:list of str
help

tooltip to display on the type in the UI left panel.

Type:str
typeFiles
Type:list of MgvTypeFile
versions

the versions of the type.

Type:list of MgvTypeVersion
versionActive

the active version of the type.

Type:MgvTypeVersion
code = 'Type'
create(uuid=None)

Create the equivalent object in the database. Also create typeFile and version objects if any.

getAction(name, version_id=-1)

Return an action of the active version or a specific version of the type.

getActions(version_id=-1)

Return the actions of the active version or a specific version of the type.

getCategory()

Return the category of the type.

getColor()

Return the color of the type.

classmethod getFromJson(each_type)

Create a type from a dictionary.

getHelp()

Return the toolotip of the type.

getImage()

Return the image path of the type.

getJson()

Return a dictionary representing the type.

getLinkWith()

Return the uuids of the types synchronised with this type.

getName()

Return the name of the type.

getParameter(name, version_id=-1)

Return a parameter (str) of the active version or a specific version of the type.

getParameters(version_id=-1)

Return the parameters (dict) of the active version or a specific version of the type.

getProject()
getScript(version_id=-1)

Return the script of the active version or a specific version of the type.

getShape()

Return the shape of the type.

getShapeVector()

Return the shape path coordinates of the type.

getSoftware()

Return the software of the type.

getWidth()

Return the width of the type.

setCategory(category)

Set the category of the type.

setColor(color)

Set the color of the type.

setHelp(text)

Set the tooltip of the type.

setImage(filePath)

Set the image path of the type.

setLinkWith(typeList)

Set the uuids of the types synchronised with this type.

setName(name)

Set the name of the type.

setShape(shape)

Set the shape of the type.

setSoftware(software)

Set the software of the type.

setVersionActive(version)

Set the active version of the type.

class mgvApi.MgvTypeFile(uuid=None, type=None, name='OUT1', path='${MGVNODEPATH}/VERSIONS/${MGVGRAPHNAME}_${MGVNODENAME}_v${MGVNODEVERSION}.ext', copy=True)

Bases: object

Mangrove TypeFile object.

A typeFile object stores an output file of a node.

uuid

unique id in the database.

Type:str
name

the typeFile name.

Type:str
path

the path of the output file.

Type:str
copy

True if this path has to be copied when the node is

Type:bool
versioned.
code = 'TypeFile'
create(uuid=None)

Create the equivalent object in the database.

getJson()

Return a dictionary representing the typeFile.

getProject()
setCopy(copy)

Set the copy state of the typeFile.

setName(name)

Set the name of the typeFile.

setPath(path)

Set the path of the typeFile.

class mgvApi.MgvTypeVersion(uuid=None, type=None, version_id=0, parameters=None, actions=None, script='')

Bases: object

Mangrove TypeVersion object.

uuid

unique id in the database.

Type:str
id

version id.

Type:int
actions

list of available actions for this type nodes.

Type:list of MgvAction
parameters

list of parameters for this type nodes.

Type:list of MgvParam
script

the second part of every node’s execution python script.

Type:str
code = 'TypeVersion'
create()

Create the equivalent object in the database. Also create action and typeParameter objects if any.

getAction(name)

Return an action of the version.

getActions()

Return the actions of the version.

getId()

Return the id of the version.

getJson()

Return a dictionary representing the typeVersion.

getParameter(name)

Return a parameter (str) of the version.

getParameters()

Return the parameters (dict) of the version.

getProject()
getScript()

Return the script of the version.

class mgvApi.MgvVariable(uuid=None, active=True, name='', value='', parent=None)

Bases: object

Mangrove Variable object

uuid

unique id in the database.

Type:str
name

the variable name.

Type:str
active

True if the variable has to be used.

Type:bool
value

Value of the variable.

Type:str
code = 'Variable'
create()

Create the equivalent object in the database.

getActive()

Return the active state of the variable.

classmethod getFromJson(element, parent)

Create a Variable from a dictionary

getJson()

Return a dictionary representing the variable.

getName()

Return the name of the variable.

getProject()
getValue()

Return the value of the variable.

setActive(active)

Set the active state of the variable.

setName(name)

Set the name of the variable.

setValue(value)

Set the value of the variable.

mgvApi.changeWrapper()
mgvApi.extractPath(image)

Extract the shape and median color of an image.

Parameters:image (str) – the image path.
Returns:A list of 2D coordinates and a color.
Return type:list of tuples, color
mgvApi.getCurrentGraph()

Return the current graph object, or None if failed.

mgvApi.getCurrentNode()

Return the current node object, or None if failed.

mgvApi.getCurrentProject()

Return the current project object, or None if failed.

mgvApi.isString(var)
mgvApi.mgvDicoReplace(d)

Recursively replace each variable name by its value in a dictionary.

Parameters:d (dict) – the dictionary with unevaluated variables.
Returns:a new dictionary with replaced variables names.
Return type:dict
mgvApi.mgvcopy(src, dst)

Copy a file or directory.

Parameters:
  • src (str) – source path.
  • dst (str) – destination path.
mgvApi.noBytes(dico)
mgvApi.unlock_request(address, port, path, nodename, user, fromport)

Ask for a Mangrove instance to free a node.

Parameters:
  • address (str) – IP address of the Mangrove instance.
  • port (str) – port used by the Mangrove instance.
  • path (str) – the graph full path i.e. “MyProject:Shots:0001:0001”
  • nodename (str) – the node name.
  • user (str) – the user of this Mangrove session.
  • fromport (str) – the IP address and port of this Mangrove session.
Returns:

“noroute”, “notmine”, “nochange” or “wait”

Return type:

str