summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/python/main.py21
-rw-r--r--src/main/python/utils/fileWindow.py26
2 files changed, 32 insertions, 15 deletions
diff --git a/src/main/python/main.py b/src/main/python/main.py
index 6bd23c4..8302b09 100644
--- a/src/main/python/main.py
+++ b/src/main/python/main.py
@@ -4,10 +4,9 @@ import sys
from fbs_runtime.application_context.PyQt5 import ApplicationContext
from PyQt5.QtCore import QObject, Qt, pyqtSignal, pyqtSlot
from PyQt5.QtGui import QBrush, QColor, QImage, QPainter, QPalette
-from PyQt5.QtWidgets import (QComboBox, QFileDialog, QFormLayout,
- QGraphicsScene, QGraphicsView, QGridLayout,
+from PyQt5.QtWidgets import (QComboBox, QFileDialog, QFormLayout, QVBoxLayout,
QHBoxLayout, QLabel, QMainWindow, QMenu, QMenuBar,
- QPushButton, QTabWidget, QWidget, QMdiArea, QMessageBox)
+ QPushButton, QWidget, QMdiArea, QListWidget)
from utils.canvas import canvas
from utils.fileWindow import fileWindow
@@ -38,8 +37,10 @@ class appWindow(QMainWindow):
self.menuGenerate.addAction("Report", self.generateReport)
# create new layout for the main widget
- mainLayout = QHBoxLayout(self.mainWidget)
+ mainLayout = QHBoxLayout()
mainLayout.setObjectName("Main Layout")
+ fileLayout = QVBoxLayout()
+ fileLayout.setObjectName("file window + tabs space")
self.mdi = QMdiArea(self) #create area for files to be displayed
self.mdi.setObjectName('mdi area')
@@ -47,8 +48,13 @@ class appWindow(QMainWindow):
#create toolbar and add the toolbar plus mdi to layout
self.createToolbar()
mainLayout.addWidget(self.toolbar)
- mainLayout.addWidget(self.mdi)
+ fileLayout.addWidget(self.mdi)
+ self.createTabSpace()
+ fileLayout.addWidget(self.tabSpace)
+
+ mainLayout.addLayout(fileLayout)
+
#declare main window layout
self.mainWidget.setLayout(mainLayout)
self.setCentralWidget(self.mainWidget)
@@ -63,6 +69,11 @@ class appWindow(QMainWindow):
toolbarLayout = QFormLayout(self.toolbar)
self.toolbar.setLayout(toolbarLayout)
+ def createTabSpace(self):
+ self.tabSpace = QListWidget(self.mainWidget)
+ self.tabSpace.setFlow(QListWidget.LeftToRight)
+ self.tabSpace.setFixedHeight(25)
+
def newProject(self):
#call to create a new file inside mdi area
project = fileWindow(self.mdi)
diff --git a/src/main/python/utils/fileWindow.py b/src/main/python/utils/fileWindow.py
index c4cf128..26aa165 100644
--- a/src/main/python/utils/fileWindow.py
+++ b/src/main/python/utils/fileWindow.py
@@ -1,7 +1,7 @@
import pickle
from PyQt5.QtCore import Qt
-from PyQt5.QtWidgets import QMdiSubWindow, QFileDialog, QMenu
+from PyQt5.QtWidgets import QMdiSubWindow, QFileDialog, QMenu, QSizePolicy
from . import dialogs
from .canvas import canvas
@@ -16,6 +16,7 @@ class fileWindow(QMdiSubWindow):
def __init__(self, parent = None, title = 'New Project', size = 'A4', ppi = '72'):
super(fileWindow, self).__init__(parent)
+ self.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
#Uses a custom QTabWidget that houses a custom new Tab Button, used to house the seperate
# diagrams inside a file
self.tabber = customTabWidget(self)
@@ -48,8 +49,9 @@ class fileWindow(QMdiSubWindow):
# helper function to add a new tab on pressing new tab button, using the add tab method on QTabWidget
diagram = canvas(self.tabber)
diagram.setObjectName("New")
- self.tabber.addTab(diagram, "New")
-
+ index = self.tabber.addTab(diagram, "New")
+ self.tabber.setCurrentIndex(index)
+
def resizeHandler(self):
# experimental resize Handler to handle resize on parent resize.
parentRect = self.mdiArea().rect()
@@ -74,19 +76,23 @@ class fileWindow(QMdiSubWindow):
self.resizeHandler()
def resizeEvent(self, event):
- self.resizeHandler()
- super(fileWindow, self).resizeEvent(event)
+ # self.resizeHandler()
+ # super(fileWindow, self).resizeEvent(event)
+ pass
def stateChange(self, oldState, newState):
+ areaRect = self.mdiArea().rect()
if newState == Qt.WindowMinimized:
- print("minimized")
- elif newState == Qt.WindowFullScreen:
- print("maximized")
+ pass
+ elif newState == Qt.WindowMaximized:
+ pass
else:
if oldState == Qt.WindowMinimized:
- print("min to full")
+ # print("min to full")
+ pass
else:
- print("max to full")
+ # print("max to full")
+ pass
@property
def tabList(self):