diff options
Diffstat (limited to 'src/main/python')
-rw-r--r-- | src/main/python/main.py | 6 | ||||
-rw-r--r-- | src/main/python/shapes/__init__.py | 6 | ||||
-rw-r--r-- | src/main/python/utils/graphics.py | 6 |
3 files changed, 10 insertions, 8 deletions
diff --git a/src/main/python/main.py b/src/main/python/main.py index 9bf97dd..bc65035 100644 --- a/src/main/python/main.py +++ b/src/main/python/main.py @@ -78,9 +78,9 @@ class appWindow(QMainWindow): def toolButtonClicked(self, object): currentDiagram = self.mdi.currentSubWindow().tabber.currentWidget().painter if currentDiagram: - graphic = getattr(shapes, object['object'])(*object['args']) - graphic.setPen(QPen(Qt.black, 2)) - graphic.setFlags(QGraphicsItem.ItemIsSelectable | QGraphicsItem.ItemIsMovable) + graphic = getattr(shapes, object['object'])(**map(lambda x: int(x) if x.isdigit() else x, object['args'])) + # graphic.setPen(QPen(Qt.black, 2)) + # graphic.setFlags(QGraphicsItem.ItemIsSelectable | QGraphicsItem.ItemIsMovable) currentDiagram.addItemPlus(graphic) graphic.setPos(20, 20) diff --git a/src/main/python/shapes/__init__.py b/src/main/python/shapes/__init__.py index a5a98f2..af92a6a 100644 --- a/src/main/python/shapes/__init__.py +++ b/src/main/python/shapes/__init__.py @@ -1,2 +1,4 @@ -from . import * -from PyQt5.QtWidgets import *
\ No newline at end of file +from .shapes import * +# from .line import * +from PyQt5.QtWidgets import * +dir()
\ No newline at end of file diff --git a/src/main/python/utils/graphics.py b/src/main/python/utils/graphics.py index 1e701f9..783748b 100644 --- a/src/main/python/utils/graphics.py +++ b/src/main/python/utils/graphics.py @@ -45,9 +45,9 @@ class customView(QGraphicsView): if QDropEvent.mimeData().hasText(): #QDropEvent.mimeData().text() defines intended drop item, the pos values define position obj = QDropEvent.mimeData().text().split('/') - graphic = getattr(shapes, obj[0])(*map(int, obj[1:])) - graphic.setPen(QPen(Qt.black, 2)) - graphic.setFlags(QGraphicsItem.ItemIsSelectable | QGraphicsItem.ItemIsMovable) + graphic = getattr(shapes, obj[0])(*map(lambda x: int(x) if x.isdigit() else x, obj[1:])) + # graphic.setPen(QPen(Qt.black, 2)) + # graphic.setFlags(QGraphicsItem.ItemIsSelectable | QGraphicsItem.ItemIsMovable) self.scene().addItemPlus(graphic) graphic.setPos(QDropEvent.pos().x()-150, QDropEvent.pos().y()-150) QDropEvent.acceptProposedAction() |