--- a/eric6/Graphics/UMLGraphicsView.py Tue May 04 19:30:25 2021 +0200 +++ b/eric6/Graphics/UMLGraphicsView.py Tue May 04 20:03:40 2021 +0200 @@ -39,8 +39,10 @@ """ Constructor - @param scene reference to the scene object (QGraphicsScene) - @param parent parent widget of the view (QWidget) + @param scene reference to the scene object + @type QGraphicsScene + @param parent parent widget of the view + @type QWidget """ E5GraphicsView.__init__(self, scene, parent) self.setObjectName("UMLGraphicsView") @@ -189,7 +191,8 @@ """ Private slot called when the scene changes. - @param areas list of rectangles that contain changes (list of QRectF) + @param areas list of rectangles that contain changes + @type list of QRectF """ if len(self.scene().selectedItems()) > 0: self.deleteShapeAct.setEnabled(True) @@ -214,7 +217,8 @@ """ Public method to populate a toolbar with our actions. - @return the populated toolBar (QToolBar) + @return the populated toolBar + @rtype QToolBar """ toolBar = QToolBar(self.tr("Graphics"), self) toolBar.setIconSize(UI.Config.ToolBarIconSize) @@ -243,9 +247,11 @@ Public method to filter a list of items. @param items list of items as returned by the scene object - (QGraphicsItem) - @param itemType type to be filtered (class) - @return list of interesting collision items (QGraphicsItem) + @type QGraphicsItem + @param itemType type to be filtered + @type class + @return list of interesting collision items + @rtype QGraphicsItem """ return [itm for itm in items if isinstance(itm, itemType)] @@ -253,7 +259,8 @@ """ Public method to select the given items. - @param items list of items to be selected (list of QGraphicsItemItem) + @param items list of items to be selected + @type list of QGraphicsItemItem """ # step 1: deselect all items self.unselectItems() @@ -267,7 +274,8 @@ """ Public method to select an item. - @param item item to be selected (QGraphicsItemItem) + @param item item to be selected + @type QGraphicsItemItem """ if isinstance(item, UMLItem): item.setSelected(not item.isSelected()) @@ -329,7 +337,8 @@ Public method to adjust the scene size to the diagram size. @param limit flag indicating to limit the scene to the - initial size (boolean) + initial size + @type bool """ super().autoAdjustSceneSize(limit=limit) self.__checkSizeActions() @@ -472,7 +481,8 @@ """ Private slot to generate a print preview. - @param printer reference to the printer object (QPrinter) + @param printer reference to the printer object + @type QPrinter """ super().printDiagram(printer, self.diagramName) @@ -480,7 +490,8 @@ """ Public slot to set the diagram name. - @param name diagram name (string) + @param name diagram name + @type str """ self.diagramName = name @@ -488,7 +499,8 @@ """ Private slot to align the selected shapes. - @param alignment alignment type (Qt.AlignmentFlag) + @param alignment alignment type + @type Qt.AlignmentFlag """ # step 1: get all selected items items = self.scene().selectedItems() @@ -564,8 +576,10 @@ """ Private method to calculate the bounding rectangle of the given items. - @param items list of items to operate on (list of UMLItem) - @return bounding rectangle (QRectF) + @param items list of items to operate on + @type list of UMLItem + @return bounding rectangle + @rtype QRectF """ rect = self.scene().sceneRect() right = rect.left() @@ -584,7 +598,8 @@ """ Protected method handling key press events. - @param evt reference to the key event (QKeyEvent) + @param evt reference to the key event + @type QKeyEvent """ key = evt.key() if key in [Qt.Key.Key_Up, Qt.Key.Key_Down, Qt.Key.Key_Left, @@ -618,7 +633,8 @@ """ Protected method to handle wheel events. - @param evt reference to the wheel event (QWheelEvent) + @param evt reference to the wheel event + @type QWheelEvent """ if evt.modifiers() & Qt.KeyboardModifier.ControlModifier: delta = evt.angleDelta().y() @@ -635,8 +651,10 @@ """ Public method handling events. - @param evt reference to the event (QEvent) - @return flag indicating, if the event was handled (boolean) + @param evt reference to the event + @type QEvent + @return flag indicating, if the event was handled + @rtype bool """ if evt.type() == QEvent.Type.Gesture: self.gestureEvent(evt) @@ -648,7 +666,8 @@ """ Protected method handling gesture events. - @param evt reference to the gesture event (QGestureEvent + @param evt reference to the gesture event + @type QGestureEvent """ pinch = evt.gesture(Qt.GestureType.PinchGesture) if pinch: @@ -662,7 +681,8 @@ """ Public method to get the ID to be assigned to an item. - @return item ID (integer) + @return item ID + @rtype int """ self.__itemId += 1 return self.__itemId @@ -671,8 +691,10 @@ """ Public method to find an UML item based on the ID. - @param itemId of the item to search for (integer) - @return item found (UMLItem) or None + @param itemId of the item to search for + @type int + @return item found or None + @rtype UMLItem """ for item in self.scene().items(): try: @@ -687,8 +709,10 @@ """ Public method to find an UML item based on its name. - @param name name to look for (string) - @return item found (UMLItem) or None + @param name name to look for + @type str + @return item found or None + @rtype UMLItem """ for item in self.scene().items(): try: @@ -703,7 +727,8 @@ """ Public method to get a list of data to be persisted. - @return list of data to be persisted (list of strings) + @return list of data to be persisted + @rtype list of str """ lines = [ "diagram_name: {0}".format(self.diagramName), @@ -725,10 +750,13 @@ """ Public method to parse persisted data. - @param version version of the data (string) - @param data persisted data to be parsed (list of string) + @param version version of the data + @type str + @param data persisted data to be parsed + @type list of str @return tuple of flag indicating success (boolean) and faulty line - number (integer) + number + @rtype int """ umlItems = {}