From 843d6bc29f6057606230bf55d48b560862fe66b8 Mon Sep 17 00:00:00 2001 From: brenda-br Date: Mon, 20 Feb 2023 00:07:41 +0530 Subject: Repositioning Line Grips and change color of Size Grip and Show Grips on hovering Size Grip --- src/main/python/utils/graphics.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/main/python/utils/graphics.py') diff --git a/src/main/python/utils/graphics.py b/src/main/python/utils/graphics.py index 5a44400..7398a2d 100644 --- a/src/main/python/utils/graphics.py +++ b/src/main/python/utils/graphics.py @@ -1,5 +1,5 @@ from PyQt5.QtCore import Qt, QPointF, pyqtSignal -from PyQt5.QtGui import QPen, QKeySequence +from PyQt5.QtGui import QPen, QKeySequence, QTransform, QCursor from PyQt5.QtWidgets import QGraphicsView, QGraphicsScene, QGraphicsProxyWidget, QGraphicsItem, QUndoStack, QAction, QUndoView from .undo import * @@ -147,6 +147,13 @@ class CustomScene(QGraphicsScene): self.movingItem = None #clear movingitem reference return super(CustomScene, self).mouseReleaseEvent(event) + def mouseMoveEvent(self, mouseEvent): + item = self.itemAt(mouseEvent.scenePos().x(), mouseEvent.scenePos().y(), + QTransform()) + if isinstance(item,shapes.SizeGripItem): + item.parentItem().showGripItem() + super(CustomScene,self).mouseMoveEvent(mouseEvent) + def reInsertLines(self): currentIndex = self.undoStack.index() i = 2 -- cgit From e816c10f23eda7f8727ee691d89921b7f8f462b6 Mon Sep 17 00:00:00 2001 From: brenda-br Date: Mon, 20 Feb 2023 15:19:50 +0530 Subject: Thicker and bigger size grip --- src/main/python/utils/graphics.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/main/python/utils/graphics.py') diff --git a/src/main/python/utils/graphics.py b/src/main/python/utils/graphics.py index 7398a2d..b66e68b 100644 --- a/src/main/python/utils/graphics.py +++ b/src/main/python/utils/graphics.py @@ -115,8 +115,7 @@ class CustomScene(QGraphicsScene): for j in i.lines: self.count+=1 self.undoStack.push(deleteCommand(j, self)) - if itemToDelete.__class__ != shapes.line.Grabber: - self.undoStack.push(deleteCommand(itemToDelete, self)) + self.undoStack.push(deleteCommand(itemToDelete, self)) def itemMoved(self, movedItem, lastPos): #item move event, checks if item is moved -- cgit From 2fd33c0f594531aa473664f5ddf71d3af1c9f427 Mon Sep 17 00:00:00 2001 From: brenda-br Date: Tue, 21 Feb 2023 13:04:53 +0530 Subject: Fix #32 Select all and delete working --- src/main/python/utils/graphics.py | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) (limited to 'src/main/python/utils/graphics.py') diff --git a/src/main/python/utils/graphics.py b/src/main/python/utils/graphics.py index b66e68b..c4e1843 100644 --- a/src/main/python/utils/graphics.py +++ b/src/main/python/utils/graphics.py @@ -105,17 +105,15 @@ class CustomScene(QGraphicsScene): # (slot) used to delete all selected items, and add undo action for each of them if self.selectedItems(): for item in self.selectedItems(): - if(issubclass(item.__class__,shapes.LineGripItem) or issubclass(item.__class__,shapes.SizeGripItem) ): - itemToDelete = item.parentItem() - else: - itemToDelete = item - self.count = 0 - if(issubclass(itemToDelete.__class__,shapes.NodeItem)): - for i in itemToDelete.lineGripItems: - for j in i.lines: - self.count+=1 - self.undoStack.push(deleteCommand(j, self)) - self.undoStack.push(deleteCommand(itemToDelete, self)) + if issubclass(item.__class__,shapes.NodeItem) or isinstance(item,shapes.Line): + itemToDelete = item + self.count = 0 + if(issubclass(itemToDelete.__class__,shapes.NodeItem)): + for i in itemToDelete.lineGripItems: + for j in i.lines: + self.count+=1 + self.undoStack.push(deleteCommand(j, self)) + self.undoStack.push(deleteCommand(itemToDelete, self)) def itemMoved(self, movedItem, lastPos): #item move event, checks if item is moved -- cgit From a6814bfd4c6a9eb228a8939d1dee0dd0b5d16786 Mon Sep 17 00:00:00 2001 From: brenda-br Date: Tue, 21 Feb 2023 14:07:35 +0530 Subject: Fix #33 Restrict Movable area of Node Items --- src/main/python/utils/graphics.py | 1 + 1 file changed, 1 insertion(+) (limited to 'src/main/python/utils/graphics.py') diff --git a/src/main/python/utils/graphics.py b/src/main/python/utils/graphics.py index c4e1843..1b797d5 100644 --- a/src/main/python/utils/graphics.py +++ b/src/main/python/utils/graphics.py @@ -44,6 +44,7 @@ class CustomView(QGraphicsView): graphic = getattr(shapes, obj[0])(*map(lambda x: int(x) if x.isdigit() else x, obj[1:])) graphic.setPos(QDropEvent.pos().x(), QDropEvent.pos().y()) self.scene().addItemPlus(graphic) + graphic.setParent(self) QDropEvent.acceptProposedAction() def wheelEvent(self, QWheelEvent): -- cgit From 02644569419711f7a69154055817d8507761b517 Mon Sep 17 00:00:00 2001 From: brenda-br Date: Tue, 21 Feb 2023 22:07:06 +0530 Subject: Size Grip Activated on double click --- src/main/python/utils/graphics.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/main/python/utils/graphics.py') diff --git a/src/main/python/utils/graphics.py b/src/main/python/utils/graphics.py index 1b797d5..80eb5e7 100644 --- a/src/main/python/utils/graphics.py +++ b/src/main/python/utils/graphics.py @@ -149,7 +149,7 @@ class CustomScene(QGraphicsScene): item = self.itemAt(mouseEvent.scenePos().x(), mouseEvent.scenePos().y(), QTransform()) if isinstance(item,shapes.SizeGripItem): - item.parentItem().showGripItem() + item.parentItem().showLineGripItem() super(CustomScene,self).mouseMoveEvent(mouseEvent) def reInsertLines(self): -- cgit