A pySketch document consists of a front-to-back ordered list of DrawingObjects. Each DrawingObject has the following properties:
'type' What type of object this is (node, link or macro (virtual)) 'position' The position of the object within the document. 'size' The size of the object within the document. 'penColour' The colour to use for drawing the objects outline. 'fillColour' Colour to use for drawing objects interior. 'lineSize' Line width (in pixels) to use for objects outline. 'startPt' The point, relative to the objects position, where an obj_LINE objects line should start. 'endPt' The point, relative to the objects position, where an obj_LINE objects line should end. 'text' The objects text (obj_TEXT objects only). 'textFont' The text objects font name. 'textSize' The text objects point size. 'textBoldface' If True, this text object will be drawn in boldface. 'textItalic' If True, this text object will be drawn in italic. 'textUnderline' If True, this text object will be drawn underlined. 'linkLength' Integer how long the link connectors of a node are 'fixed' If True, the object is connected with others and cannot be resized alone 'object' Data object (device or link) defined with the visual object 'portList' List of link objects connected to a node 'expanded' Boolean, whether the neighbours of given _node_ is expanded or not..For use in dynamic link view mode. 'zoomfactor' Integer, what zoom the visual object has right now. 'clickable' Boolean, whether the visual object is click-sensitive (triggers visual feedback) when you click on it or not. 'originalsize' QSize, the original size of the object in 100% zoom. 'macroid' Integer, the unique macroID needed to identify macro/virtual objects 'textvalign' Integer constant, where the text should be placed vertically on the object: text_CENTER, text_RIGHT or text_LEFT 'texthaling' Integer constant, where the text should be placed horizontally ont he object; text_CENTER, text_TOP or text_BOTTOM.
Definition at line 3660 of file visWindow.py.
def visWindow::DrawingObject::__init__ | ( | self, | ||
canvas, | ||||
type, | ||||
object = None , |
||||
position = QPoint(0, 0 , |
||||
size = QSize(0, 0 , |
||||
penColour = Qt.black , |
||||
fillColour = Qt.white , |
||||
lineSize = 1 , |
||||
text = None , |
||||
startPt = QPoint(0, 0 , |
||||
endPt = QPoint(0,0 , |
||||
zoomFactor = 100 , |
||||
clickable = True , |
||||
originalsize = QSize(0,0 , |
||||
macroid = -1 , |
||||
textvalign = text_CENTER , |
||||
texthalign = text_CENTER | ||||
) |
Standard constructor. 'type' is the type of object being created. This should be one of the following constants: obj_NODE, obj_LINK, obj_MACRODEVICE The remaining parameters is explained above for the class.
Definition at line 3662 of file visWindow.py.
def visWindow::DrawingObject::GetData | ( | self | ) |
Return a copy of the objects internal data. This is used to save this DrawingObject to disk.
!return a list of all member variables in this object.
Definition at line 3728 of file visWindow.py.
def visWindow::DrawingObject::SetData | ( | self, | ||
data | ||||
) |
Set the objects internal data.
is a copy of an objects member variables, as returned by getData() above. This is used to restore a previously saved DrawingObject.
Reimplemented in visWindow::Box.
Definition at line 3759 of file visWindow.py.
def visWindow::DrawingObject::GetType | ( | self | ) |
Return this DrawingObjects type (obj_NODE, obj_LINK or obj_MACRODEVICE)
Definition at line 3798 of file visWindow.py.
def visWindow::DrawingObject::SetLayer | ( | self, | ||
layer | ||||
) |
Definition at line 3801 of file visWindow.py.
def visWindow::DrawingObject::GetLayer | ( | self | ) |
Definition at line 3803 of file visWindow.py.
def visWindow::DrawingObject::SetPosition | ( | self, | ||
position, | ||||
adjust = True | ||||
) |
Set the position (top-left corner) for this DrawingObject.
- QPoint for top-left corner for this object. - whether the links to this object (if obj_NODE) should be adjusted to the new position.
Reimplemented in visWindow::Box.
Definition at line 3813 of file visWindow.py.
def visWindow::DrawingObject::GetPosition | ( | self | ) |
Return this DrawingObjects position.
!return QPoint(...) for the position of the top-left corner of this object.
Definition at line 3822 of file visWindow.py.
def visWindow::DrawingObject::GetPortIndexFrom | ( | self | ) |
For visual objects of type obj_LINK, the port index they go from an obj_NODE (port index is the internal port numbering; from 0 to n-1 for the port way).
Definition at line 3830 of file visWindow.py.
def visWindow::DrawingObject::GetPortIndexTo | ( | self | ) |
For visual objects of type obj_LINK, the port index they go to an obj_NODE (port index is the internal port numbering; from 0 to n-1 for the port way).
Definition at line 3838 of file visWindow.py.
def visWindow::DrawingObject::SetPortIndexFrom | ( | self, | ||
index | ||||
) |
Set internal port index, converted from the port number and port type.
Definition at line 3844 of file visWindow.py.
def visWindow::DrawingObject::SetPortIndexTo | ( | self, | ||
index | ||||
) |
Set internal port index, converted from the port number and port type.
Definition at line 3849 of file visWindow.py.
def visWindow::DrawingObject::GetExpanded | ( | self | ) |
The expanded status of this obj_NODE.
Definition at line 3855 of file visWindow.py.
def visWindow::DrawingObject::SetExpanded | ( | self, | ||
expanded | ||||
) |
expanded - 0: totally collapsed expanded - 1: partly collapse/expanded expanded - 2: totally expanded
Definition at line 3864 of file visWindow.py.
def visWindow::DrawingObject::SetZoomFactor | ( | self, | ||
zf | ||||
) |
Definition at line 3867 of file visWindow.py.
def visWindow::DrawingObject::GetZoomFactor | ( | self | ) |
Definition at line 3869 of file visWindow.py.
def visWindow::DrawingObject::SetSize | ( | self, | ||
size, | ||||
adjust = True | ||||
) |
Set the size for this DrawingObject.
- QSize object - whether the links and a obj_NODE should be adjusted.
Reimplemented in visWindow::Box.
Definition at line 3878 of file visWindow.py.
def visWindow::DrawingObject::GetSize | ( | self | ) |
Return this DrawingObjects size.
Definition at line 3887 of file visWindow.py.
def visWindow::DrawingObject::SetPenColour | ( | self, | ||
colour | ||||
) |
Set the pen colour used for this DrawingObject.
Definition at line 3894 of file visWindow.py.
def visWindow::DrawingObject::GetPenColour | ( | self | ) |
Return this DrawingObjects pen colour.
Definition at line 3901 of file visWindow.py.
def visWindow::DrawingObject::SetFillColour | ( | self, | ||
colour | ||||
) |
Set the fill colour used for this DrawingObject.
Definition at line 3908 of file visWindow.py.
def visWindow::DrawingObject::GetFillColour | ( | self | ) |
Return this DrawingObjects fill colour.
Definition at line 3915 of file visWindow.py.
def visWindow::DrawingObject::SetLineSize | ( | self, | ||
lineSize | ||||
) |
Set the linesize used for this DrawingObject.
Definition at line 3922 of file visWindow.py.
def visWindow::DrawingObject::GetLineSize | ( | self | ) |
Return this DrawingObjects line size.
Definition at line 3929 of file visWindow.py.
def visWindow::DrawingObject::SetStartPt | ( | self, | ||
startPt | ||||
) |
Set the starting point for this line DrawingObject.
Definition at line 3936 of file visWindow.py.
def visWindow::DrawingObject::GetStartPt | ( | self | ) |
Return the starting point for this line DrawingObject.
Definition at line 3943 of file visWindow.py.
def visWindow::DrawingObject::SetEndPt | ( | self, | ||
endPt | ||||
) |
Set the ending point for this line DrawingObject.
Definition at line 3950 of file visWindow.py.
def visWindow::DrawingObject::GetEndPt | ( | self | ) |
Return the ending point for this line DrawingObject.
Definition at line 3957 of file visWindow.py.
def visWindow::DrawingObject::SetText | ( | self, | ||
text | ||||
) |
Set the text for this DrawingObject.
Definition at line 3964 of file visWindow.py.
def visWindow::DrawingObject::GetText | ( | self | ) |
Return this DrawingObjects text.
Definition at line 3971 of file visWindow.py.
def visWindow::DrawingObject::SetTextFont | ( | self, | ||
font | ||||
) |
Set the typeface for this text DrawingObject.
Definition at line 3978 of file visWindow.py.
def visWindow::DrawingObject::GetTextFont | ( | self | ) |
Return this text DrawingObjects typeface.
Definition at line 3985 of file visWindow.py.
def visWindow::DrawingObject::SetTextSize | ( | self, | ||
size | ||||
) |
Set the point size for this text DrawingObject.
Definition at line 3992 of file visWindow.py.
def visWindow::DrawingObject::GetTextSize | ( | self | ) |
Return this text DrawingObjects text size.
Definition at line 3999 of file visWindow.py.
def visWindow::DrawingObject::SetTextBoldface | ( | self, | ||
boldface | ||||
) |
Set the boldface flag for this text DrawingObject.
Definition at line 4006 of file visWindow.py.
def visWindow::DrawingObject::GetTextBoldface | ( | self | ) |
Return this text DrawingObjects boldface flag.
Definition at line 4013 of file visWindow.py.
def visWindow::DrawingObject::SetTextItalic | ( | self, | ||
italic | ||||
) |
Set the italic flag for this text DrawingObject.
Definition at line 4020 of file visWindow.py.
def visWindow::DrawingObject::GetTextItalic | ( | self | ) |
Return this text DrawingObjects italic flag.
Definition at line 4027 of file visWindow.py.
def visWindow::DrawingObject::SetTextUnderline | ( | self, | ||
underline | ||||
) |
Set the underling flag for this text DrawingObject.
Definition at line 4034 of file visWindow.py.
def visWindow::DrawingObject::GetTextUnderline | ( | self | ) |
Return this text DrawingObjects underline flag.
Definition at line 4041 of file visWindow.py.
def visWindow::DrawingObject::IsClickable | ( | self | ) |
Definition at line 4044 of file visWindow.py.
def visWindow::DrawingObject::GetOriginalSize | ( | self | ) |
Definition at line 4046 of file visWindow.py.
def visWindow::DrawingObject::GetMacroID | ( | self | ) |
Definition at line 4048 of file visWindow.py.
def visWindow::DrawingObject::SetMacroID | ( | self, | ||
macroid | ||||
) |
Definition at line 4050 of file visWindow.py.
def visWindow::DrawingObject::SetObject | ( | self, | ||
object | ||||
) |
Assign data object to this visual object; Device for obj_NODe and Link for obj_LINK.
- the data object to be assigned to this object.
Definition at line 4060 of file visWindow.py.
def visWindow::DrawingObject::SetObjectRef | ( | self, | ||
object | ||||
) |
Assign a data object reference to this visual object; Device for obj_NODE and Link for obj_LINK
Definition at line 4070 of file visWindow.py.
def visWindow::DrawingObject::GetObject | ( | self | ) |
Return object with deviceInfo..reference
Definition at line 4077 of file visWindow.py.
def visWindow::DrawingObject::GetName | ( | self | ) |
Return name of visual object, which is retrieved from the data object it has assigned.
Definition at line 4085 of file visWindow.py.
def visWindow::DrawingObject::SetFixed | ( | self, | ||
fixed | ||||
) |
Set if object is fixed to another object
Definition at line 4091 of file visWindow.py.
def visWindow::DrawingObject::IsFixed | ( | self | ) |
Return, wheter object is fixed
Definition at line 4097 of file visWindow.py.
def visWindow::DrawingObject::SetPorts | ( | self, | ||
portType, | ||||
nr | ||||
) |
Set the number of ports of port way (only obj_NODE) for this object, we have one list for each port way (in and out)
- the port way this list of ports is assigned to - nr of ports to assigned to the given port way
Definition at line 4108 of file visWindow.py.
def visWindow::DrawingObject::GetPorts | ( | self, | ||
portType | ||||
) |
Return the number of ports of given port way.
- port way to get port list for.
!return - list of ports (port indexes) for given port way.
Definition at line 4118 of file visWindow.py.
def visWindow::DrawingObject::ClearPorts | ( | self | ) |
Remove the references to links in the port lists for this visual object (if obj_NODE).
Definition at line 4125 of file visWindow.py.
def visWindow::DrawingObject::SetPortList | ( | self, | ||
portType, | ||||
list | ||||
) |
Set the port list for the given port way.
- port way to set the port list for - list of references to links to set for this port way for this visual object.
Definition at line 4136 of file visWindow.py.
def visWindow::DrawingObject::GetPortList | ( | self, | ||
portType | ||||
) |
Return objects to all links connected to ports at portType
Definition at line 4142 of file visWindow.py.
def visWindow::DrawingObject::GetLinks | ( | self | ) |
Return all the references to links in the port lists for this visual object, if this is of type obj_NODE
!return - a list of references to link visual objects referred to in the port list of this device
Definition at line 4152 of file visWindow.py.
def visWindow::DrawingObject::FindCorrespondingPortIndex | ( | self, | ||
portnbr = "" , |
||||
porttype = "" , |
||||
portdirection = port_IN | ||||
) |
Find corresponding port index for a port number, port type and port direction collection for a port. This is "calculated" by using specific algorithms for each device type because of the big differences in how the devices are given port number and port types as well as port direction.
- the port number of the port - the port type of the port - the port direction/way of the port
!return - a tuple of port_index and port_number; the port index is the internal indexing of the port in this class, and the port number is the place where it is added to in the port list.
Definition at line 4173 of file visWindow.py.
def visWindow::DrawingObject::GetPortPosition | ( | self, | ||
index, | ||||
portdir | ||||
) |
Get the port position on a visual object (obj_NODE) as a QPoint(...) for a given port index.
- port index of the port in the given port list (port way list) - port direction/way for the port.
!return - QPoint of port (obj_NODE only)
Definition at line 4231 of file visWindow.py.
def visWindow::DrawingObject::SetSinglePort | ( | self, | ||
portType, | ||||
portNr, | ||||
link, | ||||
override = True | ||||
) |
Connect the given link to the specified port of portType.
- the port way of the port (portIN or portOUT) - the port number of the port, 1 -> n, internal indexing of the port numbers the visual object link that will be connected to a port on a visual object device - whether we should set this link to the given port even when it is taken by another link. !return - True if port is set, else False
Definition at line 4296 of file visWindow.py.
def visWindow::DrawingObject::SetConnection | ( | self, | ||
partner, | ||||
portType, | ||||
portNr, | ||||
setPartner = True | ||||
) |
Connect two DrawingObjects (links and nodes) together.
- the link or node that this object should be connected to. - the port way they should connect to on the device. - the port number (internal indexing) they should connect to on the device - whether the connection should be set for the partner of this as well (this method called for the partner as well)
!return - True if connection is set, else False
Definition at line 4329 of file visWindow.py.
def visWindow::DrawingObject::AddPoints | ( | self, | ||
point1, | ||||
point2 | ||||
) |
Add two QPoint objects together.
- the first QPoint(...) object - the second QPoint(...) object
Definition at line 4376 of file visWindow.py.
def visWindow::DrawingObject::_AdjustLinks | ( | self, | ||
startPt = None , |
||||
endPt = None | ||||
) | [private] |
If links are moved or resized; the nodes they are connected to needs to be adjusted. If nodes are moved or resized; the links that connect tot hem need to be adjusted.
- starting point QPoint(...) for the object this object needs to be adjusted to - end point QPoint(...) for the object this object need to be adjusted to
Definition at line 4390 of file visWindow.py.
def visWindow::DrawingObject::_delete | ( | self | ) | [private] |
Reimplemented in visWindow::Box, and visWindow::myLine.
Definition at line 4422 of file visWindow.py.
Definition at line 3671 of file visWindow.py.
Definition at line 3672 of file visWindow.py.
Definition at line 3673 of file visWindow.py.
Definition at line 3674 of file visWindow.py.
Definition at line 3676 of file visWindow.py.
Definition at line 3677 of file visWindow.py.
Definition at line 3678 of file visWindow.py.
Definition at line 3679 of file visWindow.py.
Definition at line 3680 of file visWindow.py.
Definition at line 3681 of file visWindow.py.
Definition at line 3682 of file visWindow.py.
Definition at line 3683 of file visWindow.py.
Definition at line 3684 of file visWindow.py.
Definition at line 3685 of file visWindow.py.
Definition at line 3686 of file visWindow.py.
Definition at line 3687 of file visWindow.py.
Definition at line 3688 of file visWindow.py.
Reimplemented in visWindow::Box, and visWindow::myLine.
Definition at line 3689 of file visWindow.py.
Definition at line 3691 of file visWindow.py.
Definition at line 3692 of file visWindow.py.
Definition at line 3693 of file visWindow.py.
Definition at line 3695 of file visWindow.py.
Definition at line 3696 of file visWindow.py.
Reimplemented in visWindow::Box, and visWindow::myLine.
Definition at line 3698 of file visWindow.py.
Definition at line 3700 of file visWindow.py.
Definition at line 3702 of file visWindow.py.
Definition at line 3704 of file visWindow.py.
Definition at line 3705 of file visWindow.py.
Definition at line 3710 of file visWindow.py.
Definition at line 4349 of file visWindow.py.
Definition at line 4352 of file visWindow.py.
Definition at line 4353 of file visWindow.py.