diff options
author | Blaine | 2020-04-22 12:38:53 +0530 |
---|---|---|
committer | Blaine | 2020-04-22 12:38:53 +0530 |
commit | 89eeec65b7307df11c59d9dca8089f0ae62b3a47 (patch) | |
tree | 1cb72e40f2e6dbe33bc3c0f71d25bbc41a257a28 /src/main/python/utils/canvas.py | |
parent | 6416c34f957b2f0d2c5de318dc7023f9f67e9042 (diff) | |
download | Chemical-PFD-89eeec65b7307df11c59d9dca8089f0ae62b3a47.tar.gz Chemical-PFD-89eeec65b7307df11c59d9dca8089f0ae62b3a47.tar.bz2 Chemical-PFD-89eeec65b7307df11c59d9dca8089f0ae62b3a47.zip |
Switching tabs, updates combo box values
Diffstat (limited to 'src/main/python/utils/canvas.py')
-rw-r--r-- | src/main/python/utils/canvas.py | 15 |
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 |