From 530a2c5f1038d6ee280aaf99f47483a27ce7fbbd Mon Sep 17 00:00:00 2001 From: Blaine Date: Thu, 11 Jun 2020 21:49:18 +0530 Subject: replace canvas from qwidget to qgraphicsview --- src/main/python/utils/fileWindow.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/main/python/utils/fileWindow.py') diff --git a/src/main/python/utils/fileWindow.py b/src/main/python/utils/fileWindow.py index 28a576e..01710fb 100644 --- a/src/main/python/utils/fileWindow.py +++ b/src/main/python/utils/fileWindow.py @@ -74,6 +74,7 @@ class fileWindow(QMdiSubWindow): def resizeHandler(self): # resize Handler to handle resize cases. parentRect = self.mdiArea().size() + print(parentRect) current = self.tabber.currentWidget() width, height = current.dimensions @@ -82,6 +83,7 @@ class fileWindow(QMdiSubWindow): width = parentRect.width() height = parentRect.height() self.moveSideViewCloseButton() + self.sideView.setSceneRect(0, 0, self.size().width()//2 - self.sideView.frameWidth(), self.size().height()//2) else: width = min(parentRect.width(), width + 100) -- cgit From ffff3aba43422ccb74ead3b288bbf1935f7e52ac Mon Sep 17 00:00:00 2001 From: Blaine Date: Thu, 11 Jun 2020 21:53:05 +0530 Subject: restore scroll bars on side View --- src/main/python/utils/fileWindow.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/main/python/utils/fileWindow.py') diff --git a/src/main/python/utils/fileWindow.py b/src/main/python/utils/fileWindow.py index 01710fb..2ef68c6 100644 --- a/src/main/python/utils/fileWindow.py +++ b/src/main/python/utils/fileWindow.py @@ -83,7 +83,7 @@ class fileWindow(QMdiSubWindow): width = parentRect.width() height = parentRect.height() self.moveSideViewCloseButton() - self.sideView.setSceneRect(0, 0, self.size().width()//2 - self.sideView.frameWidth(), self.size().height()//2) + self.sideView.resize(self.size().width()//2 - self.sideView.frameWidth(), self.size().height()) else: width = min(parentRect.width(), width + 100) -- cgit From 6ac91c9a9fc3adc2ed23e396ab718cba3e21a188 Mon Sep 17 00:00:00 2001 From: Blaine Date: Thu, 11 Jun 2020 22:46:00 +0530 Subject: side view fixed --- src/main/python/utils/fileWindow.py | 46 ++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 24 deletions(-) (limited to 'src/main/python/utils/fileWindow.py') diff --git a/src/main/python/utils/fileWindow.py b/src/main/python/utils/fileWindow.py index 2ef68c6..6fee493 100644 --- a/src/main/python/utils/fileWindow.py +++ b/src/main/python/utils/fileWindow.py @@ -2,7 +2,7 @@ from PyQt5.QtCore import Qt, pyqtSignal, QPoint from PyQt5.QtGui import QIcon from PyQt5.QtWidgets import (QFileDialog, QHBoxLayout, QMdiSubWindow, QMenu, QPushButton, QSizePolicy, - QSplitter, QWidget, QStyle) + QSplitter, QWidget, QStyle, QSizePolicy) from os import path from . import dialogs from .graphics import customView @@ -38,8 +38,17 @@ class fileWindow(QMdiSubWindow): self.mainWidget = QWidget(self) layout = QHBoxLayout(self.mainWidget) self.createSideViewArea() #create the side view objects + + left = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred) + left.setHorizontalStretch(1) + self.tabber.setSizePolicy(left) + + right = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred) + right.setHorizontalStretch(1) + self.sideView.setSizePolicy(right) + layout.addWidget(self.tabber) - layout.addWidget(self.splitter) + # layout.addWidget(self.splitter) layout.addWidget(self.sideView) self.mainWidget.setLayout(layout) self.setWidget(self.mainWidget) @@ -57,7 +66,7 @@ class fileWindow(QMdiSubWindow): def createSideViewArea(self): #creates the side view widgets and sets them to invisible - self.splitter = QSplitter(Qt.Vertical ,self) + # self.splitter = QSplitter(Qt.Vertical ,self) self.sideView = customView(parent = self) self.sideView.setInteractive(False) self.sideViewCloseButton = QPushButton('×', self.sideView) @@ -66,36 +75,26 @@ class fileWindow(QMdiSubWindow): self.sideViewCloseButton.setFixedSize(20, 20) self.moveSideViewCloseButton() self.sideViewCloseButton.clicked.connect(lambda: setattr(self, 'sideViewTab', None)) - self.splitter.setVisible(False) + # self.splitter.setVisible(False) self.sideView.setVisible(False) self.sideView.setContextMenuPolicy(Qt.CustomContextMenu) self.sideView.customContextMenuRequested.connect(self.sideViewContextMenu) + self.sideView.resize(self.width()//2 - self.sideView.frameWidth(), self.height()) def resizeHandler(self): # resize Handler to handle resize cases. parentRect = self.mdiArea().size() - print(parentRect) current = self.tabber.currentWidget() width, height = current.dimensions - - # if side view is visible, set width to maximum possible, else use minimum requirement - if self.sideViewTab: - width = parentRect.width() - height = parentRect.height() - self.moveSideViewCloseButton() - self.sideView.resize(self.size().width()//2 - self.sideView.frameWidth(), self.size().height()) - - else: - width = min(parentRect.width(), width + 100) - height = min(parentRect.height(), height + 200) + width = min(parentRect.width(), width + 100) + height = min(parentRect.height(), height + 150) if len(self.parent().parent().subWindowList()) > 1: height -= 20 - # set element dimensions + # set element dimensions self.setFixedSize(width, height) - self.tabber.resize(width, height) - self.tabber.currentWidget().adjustView() + current.adjustView() def contextMenu(self, point): #function to display the right click menu at point of right click @@ -120,16 +119,15 @@ class fileWindow(QMdiSubWindow): def sideViewToggle(self): #Function checks if current side view tab is set, and toggles view as required if self.sideViewTab: - self.splitter.setVisible(True) + # self.splitter.setVisible(True) self.sideView.setVisible(True) self.sideView.setScene(self.tabber.currentWidget().painter) - self.moveSideViewCloseButton() self.resizeHandler() return True else: - self.splitter.setVisible(False) - self.sideView.setVisible(False) - self.resizeHandler() + # self.splitter.setVisible(False) + self.sideView.setVisible(False) + self.resizeHandler() return False def moveSideViewCloseButton(self): -- cgit From b073940397bd4397636550a05fe8c4b9b6d9b156 Mon Sep 17 00:00:00 2001 From: Blaine Date: Fri, 12 Jun 2020 11:39:33 +0530 Subject: fix minor cases on sizing --- src/main/python/utils/fileWindow.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/main/python/utils/fileWindow.py') diff --git a/src/main/python/utils/fileWindow.py b/src/main/python/utils/fileWindow.py index 6fee493..6d35437 100644 --- a/src/main/python/utils/fileWindow.py +++ b/src/main/python/utils/fileWindow.py @@ -86,8 +86,14 @@ class fileWindow(QMdiSubWindow): parentRect = self.mdiArea().size() current = self.tabber.currentWidget() width, height = current.dimensions - width = min(parentRect.width(), width + 100) - height = min(parentRect.height(), height + 150) + + if self.sideViewTab: + width2, height2 = self.sideViewTab.dimensions + width = min(parentRect.width(), width + width2) + height = min(parentRect.height(), height + height2) + else: + width = min(parentRect.width(), width + 100) + height = min(parentRect.height(), height + 150) if len(self.parent().parent().subWindowList()) > 1: height -= 20 -- cgit