diff options
author | Blaine | 2020-04-21 17:10:08 +0530 |
---|---|---|
committer | Blaine | 2020-04-21 17:10:08 +0530 |
commit | f661c76ccfa3f72f1f20055bb670f41e59080179 (patch) | |
tree | 232e6b60c37c55d1df67b6b1abfab4540910a7f1 /src/main/python/main.py | |
parent | 16332668592bb1fcaa1b4f1bbd48c65bb55bc139 (diff) | |
download | Chemical-PFD-f661c76ccfa3f72f1f20055bb670f41e59080179.tar.gz Chemical-PFD-f661c76ccfa3f72f1f20055bb670f41e59080179.tar.bz2 Chemical-PFD-f661c76ccfa3f72f1f20055bb670f41e59080179.zip |
defaults for ppi/size, fixed? weird bev on tab add
Diffstat (limited to 'src/main/python/main.py')
-rw-r--r-- | src/main/python/main.py | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/src/main/python/main.py b/src/main/python/main.py index b42329e..fa615ff 100644 --- a/src/main/python/main.py +++ b/src/main/python/main.py @@ -13,6 +13,8 @@ class appWindow(QMainWindow): def __init__(self, parent=None): super(appWindow, self).__init__(parent) self.resize(1280, 720) + self._defaultPPI = 72 + self._defaultCanvasSize = "A0" titleMenu = self.menuBar() self.mainWidget = QWidget(self) @@ -30,7 +32,7 @@ class appWindow(QMainWindow): # QObject.connect(self.tabber, pyqtSignal(QTabWidget.tabCloseRequested(int)), self, pyqtSlot(QTabWidget.closetab(int))) # add close action to tabs self.createToolbar() - mainLayout.addLayout(self.toolbar, 0, 0, -1, 2) + mainLayout.addLayout(self.toolbar, 0, 0, -1, 1) mainLayout.addWidget(self.tabber, 0, 2, -1, 10) self.mainWidget.setLayout(mainLayout) @@ -57,13 +59,19 @@ class appWindow(QMainWindow): self.toolbar.setWidget(1, QFormLayout.FieldRole, ppiComboBox) def setCanvasSize(self, size): - self.tabber.currentWidget().canvasSize = size + self._defaultCanvasSize = size + activeCanvas = self.tabber.currentWidget() + if activeCanvas: + activeCanvas.canvasSize = size - def setCanvasPPI(self, ppi): - self.tabber.currentWidget().ppi = ppi + def setCanvasPPI(self, ppi): + self._defaultPPI = ppi + activeCanvas = self.tabber.currentWidget() + if activeCanvas: + activeCanvas.ppi = ppi def newDiagram(self): - diagram = canvas() + diagram = canvas(size = self._defaultCanvasSize, ppi = self._defaultPPI) self.tabber.addTab(diagram, "New") def saveImage(self): |