diff options
Diffstat (limited to 'src/main/python/utils/canvas.py')
-rw-r--r-- | src/main/python/utils/canvas.py | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/src/main/python/utils/canvas.py b/src/main/python/utils/canvas.py index 480a2e1..4d1fda4 100644 --- a/src/main/python/utils/canvas.py +++ b/src/main/python/utils/canvas.py @@ -1,12 +1,13 @@ -from PyQt5.QtCore import Qt, QPointF +from PyQt5.QtCore import Qt, QPointF, QRectF from PyQt5.QtGui import QBrush, QPalette from PyQt5.QtWidgets import (QFileDialog, QApplication, QHBoxLayout, QMenu, - QTabWidget, QWidget, QSpacerItem, QStyle,) + QTabWidget, QWidget, QSpacerItem, QStyle, QGraphicsProxyWidget) from . import dialogs from .graphics import customView, customScene from .data import paperSizes, ppiList, sheetDimensionList from .app import shapeGrips, lines +from .streamTable import streamTable, moveRect import shapes @@ -24,7 +25,7 @@ class canvas(customView): self._ppi = ppi self._canvasSize = size self._landscape = landscape - # self.setFixedSize(parent.size()) + self.streamTable = None #Create area for the graphic items to be placed, this is just here right now for the future # when we will draw items on this, this might be changed if QGraphicScene is subclassed. @@ -38,7 +39,20 @@ class canvas(customView): self.parentMdiArea = parentMdiArea self.parentFileWindow = parentFileWindow self.customContextMenuRequested.connect(self.sideViewContextMenu) - + + def addStreamTable(self, pos=QPointF(0, 0), table=None): + self.streamTable = table if table else streamTable(5, 5, canvas=self) + + self.streamTableRect = moveRect(-10, -10, 10, 10) + self.streamTableRect.setFlags(moveRect.ItemIsMovable | + moveRect.ItemIsSelectable) + self.streamTableProxy = QGraphicsProxyWidget(self.streamTableRect) + self.streamTableProxy.setWidget(self.streamTable) + self.painter.addItem(self.streamTableRect) + self.streamTableRect.setPos(pos) + # proxy = self.painter.addWidget(self.streamTable) + # proxy.setPos(pos) + def sideViewContextMenu(self, pos): self.parentFileWindow.sideViewContextMenu(self.mapTo(self.parentFileWindow, pos)) |