diff options
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/python/main.py | 5 | ||||
-rw-r--r-- | src/main/python/shapes/__init__.py | 2 | ||||
-rw-r--r-- | src/main/python/utils/graphics.py | 5 |
3 files changed, 8 insertions, 4 deletions
diff --git a/src/main/python/main.py b/src/main/python/main.py index 190745c..db34119 100644 --- a/src/main/python/main.py +++ b/src/main/python/main.py @@ -7,7 +7,6 @@ from PyQt5.QtGui import QBrush, QColor, QImage, QPainter, QPalette, QPen from PyQt5.QtWidgets import (QComboBox, QFileDialog, QFormLayout, QVBoxLayout, QHBoxLayout, QLabel, QMainWindow, QMenu, QPushButton, QWidget, QMdiArea, QSplitter, QGraphicsItem) -from PyQt5 import QtWidgets from utils.canvas import canvas from utils.fileWindow import fileWindow @@ -15,6 +14,8 @@ from utils.data import ppiList, sheetDimensionList from utils import dialogs from utils.toolbar import toolbar +import shapes + class appWindow(QMainWindow): """ Application entry point, subclasses QMainWindow and implements the main widget, @@ -74,7 +75,7 @@ class appWindow(QMainWindow): def toolButtonClicked(self, object): currentDiagram = self.mdi.currentSubWindow().tabber.currentWidget().painter if currentDiagram: - graphic = getattr(QtWidgets, object['object'])(*object['args']) + graphic = getattr(shapes, object['object'])(*object['args']) graphic.setPen(QPen(Qt.black, 2)) graphic.setFlags(QGraphicsItem.ItemIsSelectable | QGraphicsItem.ItemIsMovable) currentDiagram.addItemPlus(graphic) diff --git a/src/main/python/shapes/__init__.py b/src/main/python/shapes/__init__.py new file mode 100644 index 0000000..a5a98f2 --- /dev/null +++ b/src/main/python/shapes/__init__.py @@ -0,0 +1,2 @@ +from . import * +from PyQt5.QtWidgets import *
\ No newline at end of file diff --git a/src/main/python/utils/graphics.py b/src/main/python/utils/graphics.py index 08fc2d5..62c62f7 100644 --- a/src/main/python/utils/graphics.py +++ b/src/main/python/utils/graphics.py @@ -1,11 +1,12 @@ from PyQt5.QtCore import Qt, QPointF from PyQt5.QtGui import QPen, QKeySequence from PyQt5.QtWidgets import QGraphicsView, QGraphicsScene, QGraphicsProxyWidget, QGraphicsItem, QUndoStack, QAction, QUndoView -from PyQt5 import QtWidgets from .undo import * from .dialogs import showUndoDialog +import shapes + class customView(QGraphicsView): """ Defines custom QGraphicsView with zoom features and drag-drop accept event, overriding wheel event @@ -42,7 +43,7 @@ class customView(QGraphicsView): #defines item drop, fetches text, creates corresponding QGraphicItem and adds it to scene if QDropEvent.mimeData().hasText(): #QDropEvent.mimeData().text() defines intended drop item, the pos values define position - graphic = getattr(QtWidgets, QDropEvent.mimeData().text())(QDropEvent.pos().x()-150, QDropEvent.pos().y()-150, 300, 300) + graphic = getattr(shapes, QDropEvent.mimeData().text())(QDropEvent.pos().x()-150, QDropEvent.pos().y()-150, 300, 300) graphic.setPen(QPen(Qt.black, 2)) graphic.setFlags(QGraphicsItem.ItemIsSelectable | QGraphicsItem.ItemIsMovable) self.scene().addItemPlus(graphic) |