src/eric7/Documentation/Source/eric7.Graphics.ClassItem.html

Sat, 26 Apr 2025 12:34:32 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 26 Apr 2025 12:34:32 +0200
branch
eric7
changeset 11240
c48c615c04a3
parent 10684
58c7f23ae1cb
permissions
-rw-r--r--

MicroPython
- Added a configuration option to disable the support for the no longer produced Pimoroni Pico Wireless Pack.

<!DOCTYPE html>
<html><head>
<title>eric7.Graphics.ClassItem</title>
<meta charset="UTF-8">
<link rel="stylesheet" href="styles.css">
</head>
<body>
<a NAME="top" ID="top"></a>
<h1>eric7.Graphics.ClassItem</h1>
<p>
Module implementing an UML like class item.
</p>

<h3>Global Attributes</h3>
<table>
<tr><td>None</td></tr>
</table>

<h3>Classes</h3>
<table>
<tr>
<td><a href="#ClassItem">ClassItem</a></td>
<td>Class implementing an UML like class item.</td>
</tr>
<tr>
<td><a href="#ClassModel">ClassModel</a></td>
<td>Class implementing the class model.</td>
</tr>
</table>

<h3>Functions</h3>
<table>
<tr><td>None</td></tr>
</table>

<hr />
<hr />
<a NAME="ClassItem" ID="ClassItem"></a>
<h2>ClassItem</h2>
<p>
    Class implementing an UML like class item.
</p>

<h3>Derived from</h3>
UMLItem
<h3>Class Attributes</h3>
<table>
<tr><td>ItemType</td></tr>
</table>

<h3>Class Methods</h3>
<table>
<tr>
<td><a href="#ClassItem.fromDict">fromDict</a></td>
<td>Class method to create a class item from persisted data.</td>
</tr>
</table>

<h3>Methods</h3>
<table>
<tr>
<td><a href="#ClassItem.__init__">ClassItem</a></td>
<td>Constructor</td>
</tr>
<tr>
<td><a href="#ClassItem.__calculateSize">__calculateSize</a></td>
<td>Private method to calculate the size of the class item.</td>
</tr>
<tr>
<td><a href="#ClassItem.__createTexts">__createTexts</a></td>
<td>Private method to create the text items of the class item.</td>
</tr>
<tr>
<td><a href="#ClassItem.isExternal">isExternal</a></td>
<td>Public method returning the external state.</td>
</tr>
<tr>
<td><a href="#ClassItem.paint">paint</a></td>
<td>Public method to paint the item in local coordinates.</td>
</tr>
<tr>
<td><a href="#ClassItem.parseItemDataString">parseItemDataString</a></td>
<td>Public method to parse the given persistence data.</td>
</tr>
<tr>
<td><a href="#ClassItem.setModel">setModel</a></td>
<td>Public method to set the class model.</td>
</tr>
<tr>
<td><a href="#ClassItem.toDict">toDict</a></td>
<td>Public method to collect data to be persisted.</td>
</tr>
</table>

<h3>Static Methods</h3>
<table>
<tr><td>None</td></tr>
</table>


<a NAME="ClassItem.fromDict" ID="ClassItem.fromDict"></a>
<h4>ClassItem.fromDict (class method)</h4>
<b>fromDict</b>(<i>data, colors=None</i>)
<p>
        Class method to create a class item from persisted data.
</p>

<dl>

<dt><i>data</i> (dict)</dt>
<dd>
dictionary containing the persisted data as generated
            by toDict()
</dd>
<dt><i>colors</i> (tuple of (QColor, QColor))</dt>
<dd>
tuple containing the foreground and background colors
</dd>
</dl>
<dl>
<dt>Return:</dt>
<dd>
created class item
</dd>
</dl>
<dl>
<dt>Return Type:</dt>
<dd>
ClassItem
</dd>
</dl>
<a NAME="ClassItem.__init__" ID="ClassItem.__init__"></a>
<h4>ClassItem (Constructor)</h4>
<b>ClassItem</b>(<i>model=None, external=False, x=0, y=0, rounded=False, noAttrs=False, colors=None, parent=None, scene=None, </i>)
<p>
        Constructor
</p>

<dl>

<dt><i>model</i> (ClassModel)</dt>
<dd>
class model containing the class data
</dd>
<dt><i>external</i> (boolean)</dt>
<dd>
flag indicating a class defined outside our scope
</dd>
<dt><i>x</i> (int)</dt>
<dd>
x-coordinate
</dd>
<dt><i>y</i> (int)</dt>
<dd>
y-coordinate
</dd>
<dt><i>rounded</i> (bool)</dt>
<dd>
flag indicating a rounded corner
</dd>
<dt><i>noAttrs</i> (bool)</dt>
<dd>
flag indicating, that no attributes should be shown
</dd>
<dt><i>colors</i> (tuple of (QColor, QColor))</dt>
<dd>
tuple containing the foreground and background colors
</dd>
<dt><i>parent</i> (QGraphicsItem)</dt>
<dd>
reference to the parent object
</dd>
<dt><i>scene</i> (QGraphicsScene)</dt>
<dd>
reference to the scene object
</dd>
</dl>
<a NAME="ClassItem.__calculateSize" ID="ClassItem.__calculateSize"></a>
<h4>ClassItem.__calculateSize</h4>
<b>__calculateSize</b>(<i></i>)
<p>
        Private method to calculate the size of the class item.
</p>

<a NAME="ClassItem.__createTexts" ID="ClassItem.__createTexts"></a>
<h4>ClassItem.__createTexts</h4>
<b>__createTexts</b>(<i></i>)
<p>
        Private method to create the text items of the class item.
</p>

<a NAME="ClassItem.isExternal" ID="ClassItem.isExternal"></a>
<h4>ClassItem.isExternal</h4>
<b>isExternal</b>(<i></i>)
<p>
        Public method returning the external state.
</p>

<dl>
<dt>Return:</dt>
<dd>
external state
</dd>
</dl>
<dl>
<dt>Return Type:</dt>
<dd>
bool
</dd>
</dl>
<a NAME="ClassItem.paint" ID="ClassItem.paint"></a>
<h4>ClassItem.paint</h4>
<b>paint</b>(<i>painter, option, _widget=None</i>)
<p>
        Public method to paint the item in local coordinates.
</p>

<dl>

<dt><i>painter</i> (QPainter)</dt>
<dd>
reference to the painter object
</dd>
<dt><i>option</i> (QStyleOptionGraphicsItem)</dt>
<dd>
style options
</dd>
<dt><i>_widget</i> (QWidget)</dt>
<dd>
optional reference to the widget painted on (unused)
</dd>
</dl>
<a NAME="ClassItem.parseItemDataString" ID="ClassItem.parseItemDataString"></a>
<h4>ClassItem.parseItemDataString</h4>
<b>parseItemDataString</b>(<i>_version, data</i>)
<p>
        Public method to parse the given persistence data.
</p>

<dl>

<dt><i>_version</i> (str)</dt>
<dd>
version of the data (unused)
</dd>
<dt><i>data</i> (str)</dt>
<dd>
persisted data to be parsed
</dd>
</dl>
<dl>
<dt>Return:</dt>
<dd>
flag indicating success
</dd>
</dl>
<dl>
<dt>Return Type:</dt>
<dd>
bool
</dd>
</dl>
<a NAME="ClassItem.setModel" ID="ClassItem.setModel"></a>
<h4>ClassItem.setModel</h4>
<b>setModel</b>(<i>model</i>)
<p>
        Public method to set the class model.
</p>

<dl>

<dt><i>model</i> (ClassModel)</dt>
<dd>
class model containing the class data
</dd>
</dl>
<a NAME="ClassItem.toDict" ID="ClassItem.toDict"></a>
<h4>ClassItem.toDict</h4>
<b>toDict</b>(<i></i>)
<p>
        Public method to collect data to be persisted.
</p>

<dl>
<dt>Return:</dt>
<dd>
dictionary containing data to be persisted
</dd>
</dl>
<dl>
<dt>Return Type:</dt>
<dd>
dict
</dd>
</dl>
<div align="right"><a href="#top">Up</a></div>
<hr />
<hr />
<a NAME="ClassModel" ID="ClassModel"></a>
<h2>ClassModel</h2>
<p>
    Class implementing the class model.
</p>

<h3>Derived from</h3>
UMLModel
<h3>Class Attributes</h3>
<table>
<tr><td>None</td></tr>
</table>

<h3>Class Methods</h3>
<table>
<tr><td>None</td></tr>
</table>

<h3>Methods</h3>
<table>
<tr>
<td><a href="#ClassModel.__init__">ClassModel</a></td>
<td>Constructor</td>
</tr>
<tr>
<td><a href="#ClassModel.addClassAttribute">addClassAttribute</a></td>
<td>Public method to add a class attribute to the class model.</td>
</tr>
<tr>
<td><a href="#ClassModel.addInstanceAttribute">addInstanceAttribute</a></td>
<td>Public method to add an instance attribute to the class model.</td>
</tr>
<tr>
<td><a href="#ClassModel.addMethod">addMethod</a></td>
<td>Public method to add a method to the class model.</td>
</tr>
<tr>
<td><a href="#ClassModel.getClassAttributes">getClassAttributes</a></td>
<td>Public method to retrieve the global attributes of the class.</td>
</tr>
<tr>
<td><a href="#ClassModel.getInstanceAttributes">getInstanceAttributes</a></td>
<td>Public method to retrieve the attributes of the class.</td>
</tr>
<tr>
<td><a href="#ClassModel.getMethods">getMethods</a></td>
<td>Public method to retrieve the methods of the class.</td>
</tr>
</table>

<h3>Static Methods</h3>
<table>
<tr><td>None</td></tr>
</table>


<a NAME="ClassModel.__init__" ID="ClassModel.__init__"></a>
<h4>ClassModel (Constructor)</h4>
<b>ClassModel</b>(<i>name, methods=None, instanceAttributes=None, classAttributes=None</i>)
<p>
        Constructor
</p>

<dl>

<dt><i>name</i> (str)</dt>
<dd>
the class name
</dd>
<dt><i>methods</i> (list of str)</dt>
<dd>
list of method names of the class
</dd>
<dt><i>instanceAttributes</i> (list of str)</dt>
<dd>
list of instance attribute names of the class
</dd>
<dt><i>classAttributes</i> (list of str)</dt>
<dd>
list of class attribute names of the class
</dd>
</dl>
<a NAME="ClassModel.addClassAttribute" ID="ClassModel.addClassAttribute"></a>
<h4>ClassModel.addClassAttribute</h4>
<b>addClassAttribute</b>(<i>attribute</i>)
<p>
        Public method to add a class attribute to the class model.
</p>

<dl>

<dt><i>attribute</i> (str)</dt>
<dd>
class attribute name to be added
</dd>
</dl>
<a NAME="ClassModel.addInstanceAttribute" ID="ClassModel.addInstanceAttribute"></a>
<h4>ClassModel.addInstanceAttribute</h4>
<b>addInstanceAttribute</b>(<i>attribute</i>)
<p>
        Public method to add an instance attribute to the class model.
</p>

<dl>

<dt><i>attribute</i> (str)</dt>
<dd>
instance attribute name to be added
</dd>
</dl>
<a NAME="ClassModel.addMethod" ID="ClassModel.addMethod"></a>
<h4>ClassModel.addMethod</h4>
<b>addMethod</b>(<i>method</i>)
<p>
        Public method to add a method to the class model.
</p>

<dl>

<dt><i>method</i> (str)</dt>
<dd>
method name to be added
</dd>
</dl>
<a NAME="ClassModel.getClassAttributes" ID="ClassModel.getClassAttributes"></a>
<h4>ClassModel.getClassAttributes</h4>
<b>getClassAttributes</b>(<i></i>)
<p>
        Public method to retrieve the global attributes of the class.
</p>

<dl>
<dt>Return:</dt>
<dd>
list of class attributes
</dd>
</dl>
<dl>
<dt>Return Type:</dt>
<dd>
list of str
</dd>
</dl>
<a NAME="ClassModel.getInstanceAttributes" ID="ClassModel.getInstanceAttributes"></a>
<h4>ClassModel.getInstanceAttributes</h4>
<b>getInstanceAttributes</b>(<i></i>)
<p>
        Public method to retrieve the attributes of the class.
</p>

<dl>
<dt>Return:</dt>
<dd>
list of instance attributes
</dd>
</dl>
<dl>
<dt>Return Type:</dt>
<dd>
list of str
</dd>
</dl>
<a NAME="ClassModel.getMethods" ID="ClassModel.getMethods"></a>
<h4>ClassModel.getMethods</h4>
<b>getMethods</b>(<i></i>)
<p>
        Public method to retrieve the methods of the class.
</p>

<dl>
<dt>Return:</dt>
<dd>
list of class methods
</dd>
</dl>
<dl>
<dt>Return Type:</dt>
<dd>
list of str
</dd>
</dl>
<div align="right"><a href="#top">Up</a></div>
<hr />
</body></html>

eric ide

mercurial