Graphs Views and Items

Abstract Graphs and Views

NodeGraph

class pipeLion.ui.graphs.nodeGraph.NodeGraph(parentAsset, project, admin=False, user=None, parent=None)[source]

NodeGraph is derived by QGraphicsScene

it defines a graphics-scene which shows Node-objects, which are representing AbstractAssets

addAllNodes()[source]

method to add all nodes, which where created and put into the allItems instance variable, to this scene.

autoplaceAllNodes()[source]

wrapper, to autoplaace all nodes.

autoplaceNode(node, currentPos=PyQt4.QtCore.QPointF())[source]

this function defines a rule to autoplace one node at a time. it is made to be called recursively.

Parameters:
  • node (UserNode) – node which should be placed
  • currentPos (QPointF) – position where the node should be placed
Returns:

position of the given node

Return type:

QPointF

changeSelection()[source]

method is called everytime if the selection of this scene has changed

chooseNode(node)[source]

this method decides wether it should append or remove the given node from the selectedNodes-list and therefore, which nodes have to be set as chosen.

:param node:the graphicsItem which was selected in the NodeGraph :type node: Node

clearChosenNodes()[source]

this will clear the list of chosen items and will mark each node as unchosen

createAllNodes(parentNode)[source]

method to create allNode which are needed for the scene. This method can be reimplemented in case the node-creation should be different for default for each dependent asset of the given parentNode a Node will be created recursively

Parameters:parentNode (Node) – the parentNode-object
drawItems(painter, items, options, widget=None)[source]

this is a wrapper to set the drawing order of nodes and connections. it is a reimplemented of the QGraphicsScene

Connections should be painted before Nodes

mouseReleaseEvent(event)[source]

method will forward the mouseReleaseEvent to the item, which was currently clicked on

setParentAsset(parentAsset)[source]

method can be used to switch the parentNode of this QGraphicsScene it will clear all items and repaint everything

Parameters:parentAsset (AbstractAssets) – the topNode-asset of this scene
setUser(user)[source]

set the user of this QGraphicsScene

Parameters:user (User) – registred user

TableGraph

class pipeLion.ui.graphs.tableGraph.TableGraph(selectedAssets=None, editable=True, parent=None)[source]

TableGraph is derived by QGraphicsScene

It defines a standardized way to show any kind of table rules for the tables can be defined by adding entries to the tables dictionary, which is a property-method of this class

depending on which table-view is set by the currentTableType instance variable the scene paints different kind of tables and offers different editing modes.

createAllTaskEntries()[source]

this will create all table-items and the table-background and add them to its scene.

getSelectedNodes(selectedAssets)[source]

method will generate a list with all dependent assets from all selected assets without double entries

Parameters:selectedAssets (list of AbstractAsset) – list of selected assets
Returns:list of assets
Return type:list of AbstractAsset
getTimeline(selectedAssets)[source]

this method outsources a complex functionality from a lambda-function in the tables-property dictionary

Parameters:selectedAssets (list of AbstractAsset) – list of the assets, represented by the Nodes, selected in the adminGraph
Returns:a list of dates including the timespan of all assets in selectedAssets an in addition to a certain handleLength
Return type:list of datetime.timedelta
moveUser(delta, asset)[source]

this method outsources a complex functionality from a lambda-function in the tables-property dictionary

Parameters:
  • delta (int) – amount of colums the mouse was moved in y position -1=one column to the left 1=one column top the right
  • asset (AbstractAsset) – asset on which the event was performed
tableTypeChanged(tableType)[source]

method to define what happens, when the table-type changes

Parameters:tableType (string) – name of the new tableType
tables[source]

tables returns a dictionary which holds lambda rules on how to treat a certain table-type

the dictionary is build up as follows:

{
        'X-Axsis/Y-Axis' : #string description eg: time/task
                {
                        'all' : lambda selectedAssets: function to get all values of the x-achsis, #mandatory
                        'getter' : lambda item: function to get all values of the current item, #mandatory
                        'sort' : lambda items: function to sort the output of 'all' and 'getter', #optional
                        'str' : lambda item: function to convert the item to a string(display information), #optional
                        'rowSorting' : lambda selectedAssets: allows to sort all rows from top to bottom #optional
                        'changeMin' : lambda delta, item: function to define what should be done with the item in case the in-point of an item was changed in the interface, #optional
                        'changeMax' : lambda delta, item: function to define what should be done with the item in case the out-point of an item was changed in the interface, #optional
                        'move' : lambda delta, item: function to define what should be done with the item in case an item was moved in the interface, #optional
                        'deleteExisting' : lambda column, item: function to define what should be done with the item in case the item was deleted in the interface, #optional
                        'createNew' : lambda column, item: function to define what should be done with the item in case a new item was created in the interface, #optional
                        'keepSeparate' : True/False indicates if the entries should be kept separately or if they should be grouped together. default is grouping #optional
                }
}

Note

all mandatory items have to be defined and all optional items define user-actions. if an action is not defined, the missing interaction is not available in the interface

Returns:the table-definition-dictionary
Return type:dictionary
updateItems()[source]

method to update all items in the table

updateTable(selectedNodes)[source]

method will repaint the entire scene

Abstract Items

Node

class pipeLion.ui.graphs.node.Node(asset=None, nodeDict={}, project=None, parent=None)[source]

The Node-class is a QGraphicsItem which is used to create a node in the Node-graoh, which represents an AbstractAsset

boundingRect()[source]

reimplemented function of QGraphicsItem

Returns:a rectangle
Return type:QRectF
checkCollision()[source]

method checks if the node doesn’t collide with other nodes. if it does, it will be moved until it found the first free spot

drawNodeName()[source]

combines the asset-name and the asset-version toone string

Returns:name of this node-item
Return type:string
getHeight()[source]

get the height of the node

Returns:height
Return type:int
getNodeShape(painter)[source]

draw the node

Returns:the painter-object, which is used to draw the item
Return type:QPainter
getStateColor[source]

calculates the color of the backdrop state of this node

Returns:state gradient
Return type:QGradient
getWidth()[source]

get the width of the node

Returns:width
Return type:int
isChosen()[source]

the chosen parameter is similar to the isSelected parameter, but enables the pipeLion to figure out the correct selection order, which is important for some menu-tools, like connect. this method will return wether this node was chosen or not

Returns:wether this node was chosen or not
Return type:bool
mouseDoubleClickEvent(event)[source]

everytime there was a double-click a signal called nodeSelected(QString, QString) is emitted

mouseReleaseEvent(event)[source]

every time a node was clicked this method will check for collisions

nodeColor[source]

generates the color of the node using the colorManager’s module getColorFromObject

Returns:node-color
Return type:QColor
paint(painter, option, widget)[source]

reimplemented function of QGraphicsItem method will paint the item

paintUser(painter)[source]

method is a wrapper around paintUserImage to allow to draw multiple users to be drawn, in case the AbstractAsset of this item is a GroupAsset

Returns:the painter-object, which is used to draw the item
Return type:QPainter
paintUserImage(user, iteration, painter)[source]

for each user assigned to the AbstractAsset of this object this method will create a new icon and will color this item depending on which user it paints:

if no user is assigned the user will be drawn red if a user was assigned the icon will be drawn blue and if you were assigned the icon will be green
Returns:the painter-object, which is used to draw the item
Return type:QPainter
setChosen(value)[source]

this method will set the chosen parameter to the given value

Parameters:value (bool) – the value wether if this node was chosen or not

Connection

class pipeLion.ui.graphs.connection.Connection(parentNode=None, nodeDict={}, parent=None)[source]

this Class is derived from QGraphicsItem it will draw all connections between its parentNode and the parents-node-childrens-nodes

the connection will have a different look, depending on the type of connection, which is drawn

boundingRect()[source]

reimplementment of QGraphicsItem method returns the items bounding box

Returns:a rectangle
Return type:QRectF
paint(painter, option, widget)[source]

reimplementment of QGraphicsItem method paints this item to the QGraphicsScene

paintAllConnections(painter)[source]

method will paint all connections beween of its parentNode, and the arrowtips

Returns:the painter object, which paints this item
Return type:QPainter

TableTask

class pipeLion.ui.graphs.tableTask.TableTask(tableRulesDict, dataObject, row, bg, editable=True, parent=None)[source]

TableTask is derived by QGraphicsItem

The class describes an item in a TableGraph scene and therefore an table-item.

within this class there are methods to automatically generate different user-interactions, depending on a given tableRulesDictionary.

boundingRect()[source]

reimplementment of QGraphicsItem method is used to get the bbox

Returns:a rectangle
Return type:QRectF
changeMax(moveDelta)[source]

wrapper to call the changeMax lambda-function in the tableRulesDict instance variable

Parameters:moveDelta (int) – the mouse movement between the last mouse press and the last mouse release in columns
changeMin(moveDelta)[source]

wrapper to call the changeMin lambda-function in the tableRulesDict instance variable

Parameters:moveDelta (int) – the mouse movement between the last mouse press and the last mouse release in columns
createNew(tablePos)[source]

wrapper to call the createNew lambda-function in the tableRulesDict instance variable

Parameters:tablePos (int) – mouse position of the last release event in columns
deleteExisting(tablePos)[source]

wrapper to call the deleteExisting lambda-function in the tableRulesDict instance variable

Parameters:tablePos (int) – mouse position of the last release event in columns
max[source]

function to get the maximum value of all values of this item

Returns:minimum value
Return type:variant object
min[source]

function to get the minimum value of all values of this item

Returns:minimum value
Return type:variant object
mousePressEvent(event)[source]

will store the press-position in the lastClick instance variable

Parameters:event (QMousePressEvent) – mouse press event
mouseReleaseEvent(event)[source]

controles the mouse release event. it will calculate the mouse-move-delta between the press event and the release event, and it will decide depending on the position of the press event if it should call the changeMin, changeMax or move command

Parameters:event (QMouseReleaseEvent) – mouse release event
move(moveDelta)[source]

wrapper to call the move lambda-function in the tableRulesDict instance variable

Parameters:moveDelta (int) – the mouse movement between the last mouse press and the last mouse release in columns
offsetX[source]

method will calculate the scene-pixels to the first entry of this item

Returns:offset-pixels for x-Axis
Return type:int
offsetY[source]

method will calculate the scene-pixels to the row of this item

Returns:offset-pixels for yAxis
Return type:int
paint(painter, option, widget)[source]

reimplementment of QGraphicsItem method is used to paint the item

prepareData()[source]

method will gather all item entries and sort them into groups of blocks. eg:

if there are the entries 1,2,3,6,7,8,10,11,15 the result will be:
dataGroups = [
        [1.2.3],
        [6.7.8],
        [10.11],
        [15]
]

Note

the group-list is also stored in the dataGroups instance variable

Returns:the group-list
Return type:list of list
size[source]

this will return the size of the bounding box

Returns:size of bbox
Return type:QSizeF
topLeft[source]

method returns the topLeft point of the first item, drawn

Returns:top-left corner of the column/row field of the first item
Return type:QPointF
updateTask(row)[source]

this method will change the row of this item in the table

Parameters:row (int) – new row number

TableBg

class pipeLion.ui.graphs.tableBg.TableBg(tableRulesDict, selectedNodes=None, parent=None)[source]

TableBg is derived by QGraphicsItem

This class is used to draw a background to the TableGraph depending on which data is selected and which tableType is checked

boundingRect()[source]

reimplementment of QGraphicsItem returns the bbox

Returns:a rectangle
Return type:QRectF
cellRect(x, y)[source]

method returns a rectangle describing one cell of the table

Parameters:
  • x (int) – x-axis-position of the cell (row-number)
  • y (int) – y-axis-position of the cell (column-number)
Returns:

a rectangle

Return type:

QRectF

contextMenuEvent(event)[source]

method will create a contect menue with a selection of table-types. this selection is connected to the TableGraph-object and will change the table-type for the entire scene

Parameters:event (QContextMenuEvent) – context menu event
drawHeader(painter)[source]

function which paints the header of the table

Parameters:painter (QPainter) – painter object, which draws the item to the scene
Returns:painter object, which draws the item to the scene
Return type:QPainter
drawTitle(painter)[source]

function which paints the title of the table

Parameters:painter (QPainter) – painter object, which draws the item to the scene
Returns:painter object, which draws the item to the scene
Return type:QPainter
getAllColumns()[source]

method wrapps around the ‘all’ lambda function in the tableRulesDict and creates a list of header-data stored in the columns instance variable This way the TableBg-object knows which data is encoded in which column

Returns:columns instance variable
Return type:list of variant objects
getCurrentColumn(data)[source]

method returns the column number where the header-data is data

Parameters:data (variant object) – data which should be searched for in the header
Returns:column number
Return type:int
getCurrentColumnInfo(column)[source]

method returns the header-data in column x

Parameters:column (int) – number of the column
Returns:header-data in column given by column
Return type:variant object
paint(painter, option, widget)[source]

reimplementment of QGraphicsItem paints the table

size[source]

returns the width and the height of the whole table

Returns:size of table
Return type:QSizeF
topLeft[source]

returns the top-left corner of the whole table

Returns:top-left corner
Return type:QPointF
updateTable(selectedNodes)[source]

method will redraw the whole table and update the selectedNodes instance variable

Parameters:selectedNodes (list of AbstractAsset or variant objects) – all asset-objects, selected in the scene

Derived Items

DependencyGraph

class pipeLion.ui.graphs.dependencyGraph.DependencyGraph(parentAsset, project, admin=False, user=None, parent=None)[source]

DependencyGraph is derived by the NodeGraph

the class defines a node-scene, which lists all dependencies of the parentNode on the left side and all children of the parentNode ion the right side

autoplaceNode(node, currentPos=PyQt4.QtCore.QPointF())[source]

to change the placement of the nodes, this method was reimplemented

it will place all dependent nodes of the parentNode to the left of the parentNode and all children of the parentNode on the right

Parameters:
  • node (UserNode) – node which should be placed
  • currentPos (QPointF) – position where the node should be placed
Returns:

position of the given node

Return type:

QPointF

createAllNodes(parentNode)[source]

reimplementment of NodeGraph in this function a node for each dependency and each child of the parentNode is created

Parameters:parentNode (Node) – the parentNode

UserNode

class pipeLion.ui.graphs.userNode.UserNode(asset=None, nodeDict={}, project=None, parent=None)[source]

this class is derived by the Node-class it defines a node, but instead painting the asset’s name and version as nodeName it will draw the assigned users

drawNodeName()[source]

method is a reimplementment of Node and defines the name which will be drawn onto the node-item

Returns:assigned user name/s
Return type:string
userListToShortNames()[source]

method to shorten the names of users

Returns:list of short user-names, comma-separated
Return type:string

Table Of Contents

Previous topic

utils

Next topic

QT

This Page