Started adding a tabbed widget for the project settings GUI
This commit is contained in:
+44
-22
@@ -15,15 +15,18 @@ import nw
|
|||||||
|
|
||||||
from os import path
|
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
|
from PyQt5.QtSvg import QSvgWidget
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
class GuiProjectEditor(QDialog):
|
class GuiProjectEditor(QDialog):
|
||||||
|
|
||||||
def __init__(self, guiParent, theProject):
|
def __init__(self, theParent, theProject):
|
||||||
QDialog.__init__(self, guiParent)
|
QDialog.__init__(self, theParent)
|
||||||
|
|
||||||
logger.debug("Initialising ProjectEditor ...")
|
logger.debug("Initialising ProjectEditor ...")
|
||||||
|
|
||||||
@@ -37,27 +40,14 @@ class GuiProjectEditor(QDialog):
|
|||||||
self.gradPath = path.abspath(path.join(self.mainConf.appPath,"graphics","block.svg"))
|
self.gradPath = path.abspath(path.join(self.mainConf.appPath,"graphics","block.svg"))
|
||||||
self.svgGradient = QSvgWidget(self.gradPath)
|
self.svgGradient = QSvgWidget(self.gradPath)
|
||||||
self.svgGradient.setFixedWidth(80)
|
self.svgGradient.setFixedWidth(80)
|
||||||
|
|
||||||
|
# self.tabWidget = QTabWidget()
|
||||||
|
|
||||||
self.setLayout(self.outerBox)
|
self.setLayout(self.outerBox)
|
||||||
self.outerBox.addWidget(self.svgGradient)
|
self.outerBox.addWidget(self.svgGradient)
|
||||||
self.outerBox.addLayout(self.innerBox)
|
self.outerBox.addLayout(self.innerBox)
|
||||||
|
|
||||||
self.mainGroup = QGroupBox("Project Settings")
|
self.tabSettings = GuiProjectEditMain(self.theProject)
|
||||||
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.buttonBox = QHBoxLayout()
|
self.buttonBox = QHBoxLayout()
|
||||||
self.closeButton = QPushButton("Close")
|
self.closeButton = QPushButton("Close")
|
||||||
@@ -68,8 +58,8 @@ class GuiProjectEditor(QDialog):
|
|||||||
self.buttonBox.addWidget(self.closeButton)
|
self.buttonBox.addWidget(self.closeButton)
|
||||||
self.buttonBox.addWidget(self.saveButton)
|
self.buttonBox.addWidget(self.saveButton)
|
||||||
|
|
||||||
self.mainGroup.setLayout(self.mainForm)
|
# self.mainGroup.setLayout(self.mainForm)
|
||||||
self.innerBox.addWidget(self.mainGroup)
|
self.innerBox.addWidget(self.tabSettings)
|
||||||
self.innerBox.addLayout(self.buttonBox)
|
self.innerBox.addLayout(self.buttonBox)
|
||||||
|
|
||||||
self.show()
|
self.show()
|
||||||
@@ -96,3 +86,35 @@ class GuiProjectEditor(QDialog):
|
|||||||
return
|
return
|
||||||
|
|
||||||
# END Class GuiProjectEditor
|
# 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
|
||||||
|
|||||||
Reference in New Issue
Block a user