summaryrefslogtreecommitdiff
path: root/src/main/python/utils
diff options
context:
space:
mode:
authorBlaine2020-04-23 15:35:49 +0530
committerBlaine2020-04-23 15:35:49 +0530
commit9879d34bb984c7d4ef466c79472b3193275365b1 (patch)
tree28282b37e0d1e490e1b84b61209bcdfd8cdddca4 /src/main/python/utils
parent38568178ac8541700ca19cf73843fc3f1b2a928f (diff)
downloadChemical-PFD-9879d34bb984c7d4ef466c79472b3193275365b1.tar.gz
Chemical-PFD-9879d34bb984c7d4ef466c79472b3193275365b1.tar.bz2
Chemical-PFD-9879d34bb984c7d4ef466c79472b3193275365b1.zip
can change canvas and ppi sizes
Diffstat (limited to 'src/main/python/utils')
-rw-r--r--src/main/python/utils/canvas.py34
1 files changed, 28 insertions, 6 deletions
diff --git a/src/main/python/utils/canvas.py b/src/main/python/utils/canvas.py
index 2e2e0d9..2d840f6 100644
--- a/src/main/python/utils/canvas.py
+++ b/src/main/python/utils/canvas.py
@@ -11,11 +11,11 @@ from .sizes import paperSizes, ppiList, sheetDimensionList
class canvas(QWidget):
- def __init__(self, parent=None, size= 4, ppi= 1):
+ def __init__(self, parent=None, size= 'A4', ppi= '72'):
super(canvas, self).__init__(parent)
- self._ppi = ppiList[ppi]
- self._canvasSize = sheetDimensionList[size]
+ self._ppi = ppi
+ self._canvasSize = size
self.painter = QGraphicsScene()
self.painter.setSceneRect(0, 0, *paperSizes[self.canvasSize][self.ppi])
@@ -81,11 +81,11 @@ class canvas(QWidget):
self.painter.addItem(graphic)
class fileWindow(QMdiSubWindow):
- def __init__(self, parent = None, title = 'New Project', size = 4, ppi = 1):
+ def __init__(self, parent = None, title = 'New Project', size = 'A4', ppi = '72'):
super(fileWindow, self).__init__(parent)
- self._ppi = ppiList[ppi]
- self._canvasSize = sheetDimensionList[size]
+ self._ppi = ppi
+ self._canvasSize = size
self.widget = QWidget(self)
layout = QHBoxLayout(self.widget)
@@ -104,6 +104,28 @@ class fileWindow(QMdiSubWindow):
self.setWidget(self.widget)
self.setWindowTitle(title)
+ @property
+ def canvasSize(self):
+ return self._canvasSize
+ @property
+ def ppi(self):
+ return self._ppi
+
+ @canvasSize.setter
+ def canvasSize(self, size):
+ self._canvasSize = sheetDimensionList.index(size)
+ if self.tabCount:
+ activeTab = self.tabber.currentWidget()
+ activeTab.canvasSize = size
+
+ @ppi.setter
+ def ppi(self, ppi):
+ self._ppi = ppiList.index(ppi)
+ if self.tabCount:
+ activeTab = self.tabber.currentWidget()
+ activeTab.ppi = ppi
+
+
def changeTab(self, currentIndex):
pass