summaryrefslogtreecommitdiff
path: root/src/main/python/utils/canvas.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/python/utils/canvas.py')
-rw-r--r--src/main/python/utils/canvas.py15
1 files changed, 6 insertions, 9 deletions
diff --git a/src/main/python/utils/canvas.py b/src/main/python/utils/canvas.py
index 258d901..a01092c 100644
--- a/src/main/python/utils/canvas.py
+++ b/src/main/python/utils/canvas.py
@@ -1,15 +1,14 @@
from PyQt5.QtCore import Qt
from PyQt5.QtGui import QBrush
from PyQt5.QtWidgets import QWidget, QGraphicsScene, QGraphicsView, QHBoxLayout
-from .sizes import paperSizes
+from .sizes import paperSizes, sheetDimensionList, ppiList
class canvas(QWidget):
- def __init__(self, parent=None, size= "A0", ppi= 72):
+ def __init__(self, parent=None, size= 0, ppi= 1):
super(canvas, self).__init__(parent)
- self._ppi = ppi
- self._canvasSize = size
+ self._ppi = ppiList[ppi]
+ self._canvasSize = sheetDimensionList[size]
self.resize(1280, 720)
-
self.painter = QGraphicsScene(0, 0, *paperSizes[self.canvasSize][self.ppi])
self.painter.setBackgroundBrush(QBrush(Qt.white))
@@ -36,11 +35,9 @@ class canvas(QWidget):
self._canvasSize = size
if self.painter:
self.painter.setSceneRect(0, 0, *paperSizes[self.canvasSize][self.ppi])
- # print(*paperSizes[self.canvasSize][self.ppi])
@ppi.setter
def ppi(self, ppi):
- self._ppi = int(ppi)
+ self._ppi = ppi
if self.painter:
- self.painter.setSceneRect(0, 0, *paperSizes[self.canvasSize][self.ppi])
- # print(*paperSizes[self.canvasSize][self.ppi]) \ No newline at end of file
+ self.painter.setSceneRect(0, 0, *paperSizes[self.canvasSize][self.ppi]) \ No newline at end of file