Started adding a tabbed widget for the project settings GUI

This commit is contained in:
Veronica K. B. Olsen
2019-05-19 14:27:57 +02:00
parent 2a1b371974
commit b790fe7db9
+44 -22
View File
@@ -15,15 +15,18 @@ import nw
from os import path
from PyQt5.QtWidgets import QDialog, QHBoxLayout, QVBoxLayout, QGroupBox, QFormLayout, QLineEdit, QPlainTextEdit, QPushButton
from PyQt5.QtWidgets import (
QDialog, QHBoxLayout, QVBoxLayout, QGroupBox, QFormLayout, QLineEdit, QPlainTextEdit,
QPushButton, QWidget, QTabWidget
)
from PyQt5.QtSvg import QSvgWidget
logger = logging.getLogger(__name__)
class GuiProjectEditor(QDialog):
def __init__(self, guiParent, theProject):
QDialog.__init__(self, guiParent)
def __init__(self, theParent, theProject):
QDialog.__init__(self, theParent)
logger.debug("Initialising ProjectEditor ...")
@@ -37,27 +40,14 @@ class GuiProjectEditor(QDialog):
self.gradPath = path.abspath(path.join(self.mainConf.appPath,"graphics","block.svg"))
self.svgGradient = QSvgWidget(self.gradPath)
self.svgGradient.setFixedWidth(80)
# self.tabWidget = QTabWidget()
self.setLayout(self.outerBox)
self.outerBox.addWidget(self.svgGradient)
self.outerBox.addLayout(self.innerBox)
self.mainGroup = QGroupBox("Project Settings")
self.mainForm = QFormLayout()
self.editName = QLineEdit()
self.editTitle = QLineEdit()
self.editAuthors = QPlainTextEdit()
self.mainForm.addRow("Working Title", self.editName)
self.mainForm.addRow("Book Title", self.editTitle)
self.mainForm.addRow("Book Authors", self.editAuthors)
self.editName.setText(self.theProject.projName)
self.editTitle.setText(self.theProject.bookTitle)
bookAuthors = ""
for bookAuthor in self.theProject.bookAuthors:
bookAuthors += bookAuthor+"\n"
self.editAuthors.setPlainText(bookAuthors)
self.tabSettings = GuiProjectEditMain(self.theProject)
self.buttonBox = QHBoxLayout()
self.closeButton = QPushButton("Close")
@@ -68,8 +58,8 @@ class GuiProjectEditor(QDialog):
self.buttonBox.addWidget(self.closeButton)
self.buttonBox.addWidget(self.saveButton)
self.mainGroup.setLayout(self.mainForm)
self.innerBox.addWidget(self.mainGroup)
# self.mainGroup.setLayout(self.mainForm)
self.innerBox.addWidget(self.tabSettings)
self.innerBox.addLayout(self.buttonBox)
self.show()
@@ -96,3 +86,35 @@ class GuiProjectEditor(QDialog):
return
# END Class GuiProjectEditor
class GuiProjectEditMain(QGroupBox):
def __init__(self, theProject):
QGroupBox.__init__(self)
self.theProject = theProject
# self.mainGroup = QGroupBox("Project Settings")
self.setTitle("Project Settings")
self.mainForm = QFormLayout()
self.editName = QLineEdit()
self.editTitle = QLineEdit()
self.editAuthors = QPlainTextEdit()
self.mainForm.addRow("Working Title", self.editName)
self.mainForm.addRow("Book Title", self.editTitle)
self.mainForm.addRow("Book Authors", self.editAuthors)
self.editName.setText(self.theProject.projName)
self.editTitle.setText(self.theProject.bookTitle)
bookAuthors = ""
for bookAuthor in self.theProject.bookAuthors:
bookAuthors += bookAuthor+"\n"
self.editAuthors.setPlainText(bookAuthors)
self.setLayout(self.mainForm)
return
# END Class GuiProjectEditMain