summaryrefslogtreecommitdiff
path: root/src/main/python/utils
diff options
context:
space:
mode:
authorBlaine2020-04-22 12:38:53 +0530
committerBlaine2020-04-22 12:38:53 +0530
commit89eeec65b7307df11c59d9dca8089f0ae62b3a47 (patch)
tree1cb72e40f2e6dbe33bc3c0f71d25bbc41a257a28 /src/main/python/utils
parent6416c34f957b2f0d2c5de318dc7023f9f67e9042 (diff)
downloadChemical-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')
-rw-r--r--src/main/python/utils/canvas.py15
-rw-r--r--src/main/python/utils/sizes.py46
2 files changed, 31 insertions, 30 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
diff --git a/src/main/python/utils/sizes.py b/src/main/python/utils/sizes.py
index fc444cf..4d0686b 100644
--- a/src/main/python/utils/sizes.py
+++ b/src/main/python/utils/sizes.py
@@ -1,32 +1,36 @@
paperSizes = {
"A0": {
- 72: {2384, 3370},
- 96: {3179, 4494},
- 150: {4967, 7022},
- 300: {9933, 14043}
+ "72": {2384, 3370},
+ "96": {3179, 4494},
+ "150": {4967, 7022},
+ "300": {9933, 14043}
},
"A1": {
- 72: {1684, 2384},
- 96: {2245, 3179},
- 150: {3508, 4967},
- 300: {7016, 9933}
+ "72": {1684, 2384},
+ "96": {2245, 3179},
+ "150": {3508, 4967},
+ "300": {7016, 9933}
},
"A2": {
- 72: {1191, 1684},
- 96: {1587, 2245},
- 150: {2480, 3508},
- 300: {4960, 7016}
+ "72": {1191, 1684},
+ "96": {1587, 2245},
+ "150": {2480, 3508},
+ "300": {4960, 7016}
},
"A3": {
- 72: {842, 1191},
- 96: {1123, 1587},
- 150: {1754, 2480},
- 300: {3508, 4960}
+ "72": {842, 1191},
+ "96": {1123, 1587},
+ "150": {1754, 2480},
+ "300": {3508, 4960}
},
"A4": {
- 72: {595, 842},
- 96: {794, 1123},
- 150: {1240, 1754},
- 300: {2480, 3508}
+ "72": {595, 842},
+ "96": {794, 1123},
+ "150": {1240, 1754},
+ "300": {2480, 3508}
}
-} \ No newline at end of file
+}
+
+sheetDimensionList = [f'A{i}' for i in range(5)]
+
+ppiList = ["72", "96", "150", "300"] \ No newline at end of file