gui module
Module gui provides the definition of the classes relative to the GUI:
- SBSGUILayout
- SBSGUIObject
- SBSGUILayoutComp
- class sbscommon.gui.GUIObjectList(aParentObject, aGUIObjectsAttr)
Bases:
objectClass used to provide common methods to SBSObjects that contains a list of GUIObjects: -
SBSGraph-SBSDynamicValue-SBSParamsGraph- Members:
mParentObject (
SBSObject): Parent object that contains the GUI object list.mGUIObjectsAttr (str): attribute member name in the parent object that corresponds to the GUI object list.
- createComment(aCommentText='Comment', aGUIPos=None)
Create a new comment.
- Parameters:
aCommentText (str, optional) – The text of the comment. Default to ‘Comment’
aGUIPos (list of 3 float, optional) – The comment position in the graph. Default to [0,0,0]
aLinkToNode (str, optional) – The UID of the node to associate to this comment
- Returns:
The
SBSGUIObjectcreated
- createFrame(aSize, aFrameTitle='Frame', aCommentText='', aGUIPos=None, aColor=None, aDisplayTitle=True)
Create a new framed comment.
- Parameters:
aSize (list of 2 float) – The frame size
aFrameTitle (str, optional) – The title of the frame. Default to ‘Frame’
aCommentText (str, optional) – The text of the frame. Empty by default
aGUIPos (list of 3 float, optional) – The frame position in the graph. Default to [0,0,-100]
aColor (list of 4 float between 0 and 1, optional.) – The frame color. Default to [0.196, 0.196, 0.509, 0.196]
aDisplayTitle (boolean, optional) – True to display the frame title. Default to True
- Returns:
The
SBSGUIObjectcreated
- createFrameAroundNodes(aNodeList, aFrameTitle='Frame', aCommentText='', aColor=None, aDisplayTitle=True)
Create a new framed comment around the given nodes.
- Parameters:
aNodeList (list of class:.SBSNode) – The nodes to include in the frame
aFrameTitle (str, optional) – The title of the frame. Default to ‘Frame’
aCommentText (str, optional) – The text of the frame. Empty by default
aColor (list of 4 float between 0 and 1, optional.) – The frame color. Default to [0.196, 0.196, 0.509, 0.196]
aDisplayTitle (boolean, optional) – True to display the frame title. Default to True
- Returns:
The
SBSGUIObjectcreated- Raise:
SBSImpossibleActionError
Create a new navigation pin.
- Parameters:
aPinText (str) – The text of the navigation pin
aGUIPos (list of 3 float, optional) – The navigation pin position in the graph. Default to [0,0,0]
- Returns:
The
SBSGUIObjectcreated
- deleteGUIObject(aGUIObject)
deleteGUIObject(aGUIObject): Allows to delete the given GUI object.
- Parameters:
aGUIObject (
SBSGUIObjector str) – The GUI object to remove, as a SBSGUIObject or an UID.- Returns:
True if success
- Raise:
api_exceptions.SBSImpossibleActionError
- getAllComments()
Get all comments defined in the graph
- Returns:
a list of
SBSGUIObject
- getAllFrames()
Get all frames defined in the graph
- Returns:
a list of
SBSGUIObject
- getAllGUIObjects()
Get all the GUI objects defined in the graph (Comments, Frames, Navigation Pins)
- Returns:
a list of
SBSGUIObject
Get all the navigation pins defined in the graph
- Returns:
a list of
SBSGUIObject
- getFrameRectAroundNodes(aNodeList)
Return the rectangle a frame would fill to be around the given nodes.
- Parameters:
aNodeList (list of class:.SBSNode) – The nodes to include in the frame
- Returns:
A
Rect- Raise:
SBSImpossibleActionError
- getGUIObject(aGUIObject)
getGUIObject(aGUIObject): Search for the given GUI object in the list
- Parameters:
aGUIObject (
SBSGUIObjector str) – GUI object to get, identified by its uid or as aSBSGUIObject- Returns:
A
SBSGUIObjectobject if found, None otherwise
- getNodesInFrame(aFrame)
Get all the nodes included or partially included in the given frame. The frame must be included in the parent graph, otherwise SBSImpossibleActionError is raised
- Parameters:
aFrame (
SBSGUIObject) – The frame to consider- Returns:
a list of
SBSNode- Raise:
SBSImpossibleActionError
- reframeAroundNodes(aFrame, aNodeList)
Move and resize a frame to be around the given nodes.
- Parameters:
aFrame (
SBSGUIObject) – The frame to editaNodeList (list of class:.SBSNode) – The nodes to include in the frame
- Raise:
SBSImpossibleActionError
- class sbscommon.gui.Rect(aTop=0, aLeft=0, aWidth=0, aHeight=0)
Bases:
object- containsPoint(aPoint)
Check if the given point is contained in the Rectangle.
- Parameters:
aPoint – The point to test
- Type:
list of 2 float [x, y] or tuple
- Returns:
True if the given point is contained in the Rectangle, False otherwise
- getCorners()
Get the 4 corner points of this rectangle
- Returns:
The corners of this rectangle, as a list of tuple
- class sbscommon.gui.SBSGUILayout(aGPos=None, aDocked=None, aDockDistance=None, aSize=None)
Bases:
SBSObjectClass that contains information on a GUILayout (GUI position and options) as defined in a .sbs file
- Members:
mGPos (list of 3 float, optional): position in the graph layout.
mDocked (str, optional): object is in a docked state.
mDockDistance (str, optional): original distance between the docked node and its parent (for undock purpose).
mSize (str, optional): size of the object.
- equals(other)
Check if this SBSObject is equivalent to the other SBSObject. Some members may be excluded from this check, the UIDs or GUILayout for instance.
- getUidIsUsed(aUID)
Check if the given uid is already used in the context of this SBSObject.
- Parameters:
aUID (str) – UID to check
- Returns:
True if the uid is already used, False otherwise
- Raise:
AttributeError if the function getUidIsUsed in not properly overloaded on this SBSObject
- parse(aContext, aDirAbsPath, aSBSParser, aXmlNode)
Parse recursively the given xml node to retrieve the content of the SBSObject.
- class sbscommon.gui.SBSGUILayoutComp(aDisplay=None, aGRoi=None, aGZoom=None)
Bases:
SBSObjectClass that contains information on a GUILayoutComp (Gui flags and options) as defined in a .sbs file
- Members:
mDisplay (str): display type (graph, stack, etc.).
mGRoi (str): visualized Region Of Interest of the graph.
mGZoom (str): graph zoom.
- equals(other)
Check if this SBSObject is equivalent to the other SBSObject. Some members may be excluded from this check, the UIDs or GUILayout for instance.
- getUidIsUsed(aUID)
Check if the given uid is already used in the context of this SBSObject.
- Parameters:
aUID (str) – UID to check
- Returns:
True if the uid is already used, False otherwise
- Raise:
AttributeError if the function getUidIsUsed in not properly overloaded on this SBSObject
- parse(aContext, aDirAbsPath, aSBSParser, aXmlNode)
Parse recursively the given xml node to retrieve the content of the SBSObject.
- class sbscommon.gui.SBSGUIObject(aUID='', aType='', aGUIDependency=None, aGUILayout=None, aGUIName='', aOptions=None, aTitle=None, aFrameColor=None, aIsTitleVisible=None, aIsFrameVisible=None)
Bases:
SBSObjectClass that contains information on a GUIObject as defined in a .sbs file
- Members:
mUID (str): node unique identifier in the /GUIObjects/ context.
mType (str): type of GUI object (comment, navigation pin, etc.)
mGUIDependency (str): dependency of this GUI Object on an object in the graph ( format : Type?uid(?uid…) )
mGUILayout (
SBSGUILayout):mGUIName (str): name of the GUI object.
mOptions (list of
SBSOption): list of specific options of the GUI object type.mTitle (str, optional): The object Title
mFrameColor (str, optional): frame color (RGBA Float)
mIsTitleVisible (str, optional): bool to set title visibility
mIsFrameVisible (str, optional): bool to set frame visibility
- equals(other)
Check if this SBSObject is equivalent to the other SBSObject. Some members may be excluded from this check, the UIDs or GUILayout for instance.
- getDependencyUID()
Get the UID of the node associated to this GUIObject.
- Returns:
the UID as a string if found, None otherwise
- getUidIsUsed(aUID)
Check if the given uid is already used in the context of this SBSObject.
- Parameters:
aUID (str) – UID to check
- Returns:
True if the uid is already used, False otherwise
- Raise:
AttributeError if the function getUidIsUsed in not properly overloaded on this SBSObject
- hasDependencyOn(aUID)
Checks if this GUI Object has a dependency on the given UID
- Parameters:
aUID (str) – The UID to consider
- Returns:
True if this GUI Object has a dependency on the object with the given UID, False otherwise
- isAComment()
- Returns:
True if this GUIObject is a simple comment
- isAFrame()
- Returns:
True if this GUIObject is a framed comment
- Returns:
True if this GUIObject is a navigation pin
- parse(aContext, aDirAbsPath, aSBSParser, aXmlNode)
Parse recursively the given xml node to retrieve the content of the SBSObject.
- sDefaultColor = [0.196078435, 0.196078435, 0.509803951, 0.196078435]