diff --git a/nw/gui/projecteditor.py b/nw/gui/projecteditor.py index c7638b87..1eccc5d3 100644 --- a/nw/gui/projecteditor.py +++ b/nw/gui/projecteditor.py @@ -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