summaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorBlaine2020-04-28 22:27:41 +0530
committerBlaine2020-04-28 22:27:41 +0530
commita64e5e224d29636a5d9e80b5760da7993d795bcd (patch)
treef099bcf085d172a59527417371717e0fe6a81f59 /src/main
parent4f47a375887aecb2778800f375f4c4e037bf26a6 (diff)
downloadChemical-PFD-a64e5e224d29636a5d9e80b5760da7993d795bcd.tar.gz
Chemical-PFD-a64e5e224d29636a5d9e80b5760da7993d795bcd.tar.bz2
Chemical-PFD-a64e5e224d29636a5d9e80b5760da7993d795bcd.zip
The Fix?
Diffstat (limited to 'src/main')
-rw-r--r--src/main/python/main.py3
-rw-r--r--src/main/python/utils/canvas.py12
-rw-r--r--src/main/python/utils/fileWindow.py12
3 files changed, 14 insertions, 13 deletions
diff --git a/src/main/python/main.py b/src/main/python/main.py
index 207701e..9fc08bf 100644
--- a/src/main/python/main.py
+++ b/src/main/python/main.py
@@ -42,6 +42,7 @@ class appWindow(QMainWindow):
mainLayout.setObjectName("Main Layout")
self.mdi = QMdiArea(self) #create area for files to be displayed
+ self.mdi.setObjectName('mdi area')
#create toolbar and add the toolbar plus mdi to layout
self.createToolbar()
@@ -70,7 +71,7 @@ class appWindow(QMainWindow):
if not project.tabList: # important when unpickling a file instead
project.newDiagram() #create a new tab in the new file
project.show()
- project.resizeHandler(self.mdi)
+ project.resizeHandler()
def openProject(self):
#show the open file dialog to open a saved file, then unpickle it.
diff --git a/src/main/python/utils/canvas.py b/src/main/python/utils/canvas.py
index b158b99..8bac15f 100644
--- a/src/main/python/utils/canvas.py
+++ b/src/main/python/utils/canvas.py
@@ -55,19 +55,19 @@ class canvas(QWidget):
frameWidth = self.view.frameWidth()
self.view.setSceneRect(0, 0, width - frameWidth*2, height)
# give the view some time to adjust itself
- QApplication.processEvents()
- prect = self.parent().parentWidget().parentWidget().size()
- width = width + frameWidth*2
- height = height + frameWidth * 2
+ prect = self.parent().parentWidget().parentWidget().parentWidget().rect()
+ width = width + 50
+ height = height + 100
if self.view.verticalScrollBar().isVisible():
width += self.style().pixelMetric(QStyle.PM_ScrollBarExtent)
if self.view.horizontalScrollBar().isVisible():
height += self.style().pixelMetric(QStyle.PM_ScrollBarExtent)
- self.view.setFixedWidth(min(prect.width() - frameWidth*2, width))
- self.view.setFixedHeight(min(prect.height() - frameWidth*2, height))
+ self.view.setFixedWidth(min(prect.width() - 50, width))
+ self.view.setFixedHeight(min(prect.height() - 100, height))
# self.resize(width + frameWidth * 2, height + frameWidth * 2)
+
def resizeEvent(self, event):
#overloaded function to also view size on window update
self.adjustView()
diff --git a/src/main/python/utils/fileWindow.py b/src/main/python/utils/fileWindow.py
index 9a679e9..929bde0 100644
--- a/src/main/python/utils/fileWindow.py
+++ b/src/main/python/utils/fileWindow.py
@@ -50,11 +50,11 @@ class fileWindow(QMdiSubWindow):
def resizeHandler(self, parent = None):
# experimental resize Handler to handle resize on parent resize.
- parentRect = parent.rect() if parent else self.parentWidget().rect()
- width, height = self.tabber.currentWidget().dimensions
- frameWidth = self.tabber.currentWidget().view.frameWidth()
- width = min(parentRect.width(), width + frameWidth*2)
- height = min(parentRect.height(), height + frameWidth*2)
+ parentRect = parent.parentWidget().rect() if parent else self.parentWidget().parentWidget().rect()
+ current = self.tabber.currentWidget()
+ width, height = current.dimensions
+ width = min(parentRect.width(), width + 50)
+ height = min(parentRect.height(), height + 100)
self.setFixedSize(width, height)
# self.tabber.resize(width, height)
self.tabber.currentWidget().adjustView()
@@ -72,7 +72,7 @@ class fileWindow(QMdiSubWindow):
self.resizeHandler()
def resizeEvent(self, event):
- print(self.size())
+ self.resizeHandler()
super(fileWindow, self).resizeEvent(event)
@property