Redesigned the project settings GUI to use tabs
This commit is contained in:
+20
-27
@@ -17,7 +17,7 @@ from os import path
|
|||||||
|
|
||||||
from PyQt5.QtWidgets import (
|
from PyQt5.QtWidgets import (
|
||||||
QDialog, QHBoxLayout, QVBoxLayout, QGroupBox, QFormLayout, QLineEdit, QPlainTextEdit,
|
QDialog, QHBoxLayout, QVBoxLayout, QGroupBox, QFormLayout, QLineEdit, QPlainTextEdit,
|
||||||
QPushButton, QWidget, QTabWidget
|
QPushButton, QWidget, QTabWidget, QDialogButtonBox
|
||||||
)
|
)
|
||||||
from PyQt5.QtSvg import QSvgWidget
|
from PyQt5.QtSvg import QSvgWidget
|
||||||
|
|
||||||
@@ -31,6 +31,7 @@ class GuiProjectEditor(QDialog):
|
|||||||
logger.debug("Initialising ProjectEditor ...")
|
logger.debug("Initialising ProjectEditor ...")
|
||||||
|
|
||||||
self.mainConf = nw.CONFIG
|
self.mainConf = nw.CONFIG
|
||||||
|
self.theParent = theParent
|
||||||
self.theProject = theProject
|
self.theProject = theProject
|
||||||
self.outerBox = QHBoxLayout()
|
self.outerBox = QHBoxLayout()
|
||||||
self.innerBox = QVBoxLayout()
|
self.innerBox = QVBoxLayout()
|
||||||
@@ -41,26 +42,21 @@ class GuiProjectEditor(QDialog):
|
|||||||
self.svgGradient = QSvgWidget(self.gradPath)
|
self.svgGradient = QSvgWidget(self.gradPath)
|
||||||
self.svgGradient.setFixedWidth(80)
|
self.svgGradient.setFixedWidth(80)
|
||||||
|
|
||||||
# self.tabWidget = QTabWidget()
|
self.tabMain = GuiProjectEditMain(self.theParent, self.theProject)
|
||||||
|
|
||||||
|
self.tabWidget = QTabWidget()
|
||||||
|
self.tabWidget.addTab(self.tabMain,"Settings")
|
||||||
|
|
||||||
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.tabSettings = GuiProjectEditMain(self.theProject)
|
self.buttonBox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
|
||||||
|
self.buttonBox.accepted.connect(self._doSave)
|
||||||
|
self.buttonBox.rejected.connect(self._doClose)
|
||||||
|
|
||||||
self.buttonBox = QHBoxLayout()
|
self.innerBox.addWidget(self.tabWidget)
|
||||||
self.closeButton = QPushButton("Close")
|
self.innerBox.addWidget(self.buttonBox)
|
||||||
self.closeButton.clicked.connect(self._doClose)
|
|
||||||
self.saveButton = QPushButton("Save")
|
|
||||||
self.saveButton.clicked.connect(self._doSave)
|
|
||||||
self.buttonBox.addStretch(1)
|
|
||||||
self.buttonBox.addWidget(self.closeButton)
|
|
||||||
self.buttonBox.addWidget(self.saveButton)
|
|
||||||
|
|
||||||
# self.mainGroup.setLayout(self.mainForm)
|
|
||||||
self.innerBox.addWidget(self.tabSettings)
|
|
||||||
self.innerBox.addLayout(self.buttonBox)
|
|
||||||
|
|
||||||
self.show()
|
self.show()
|
||||||
|
|
||||||
@@ -70,9 +66,9 @@ class GuiProjectEditor(QDialog):
|
|||||||
|
|
||||||
def _doSave(self):
|
def _doSave(self):
|
||||||
logger.verbose("ProjectEditor save button clicked")
|
logger.verbose("ProjectEditor save button clicked")
|
||||||
projName = self.editName.text()
|
projName = self.tabMain.editName.text()
|
||||||
bookTitle = self.editTitle.text()
|
bookTitle = self.tabMain.editTitle.text()
|
||||||
bookAuthors = self.editAuthors.toPlainText()
|
bookAuthors = self.tabMain.editAuthors.toPlainText()
|
||||||
self.theProject.setProjectName(projName)
|
self.theProject.setProjectName(projName)
|
||||||
self.theProject.setBookTitle(bookTitle)
|
self.theProject.setBookTitle(bookTitle)
|
||||||
self.theProject.setBookAuthors(bookAuthors)
|
self.theProject.setBookAuthors(bookAuthors)
|
||||||
@@ -87,17 +83,14 @@ class GuiProjectEditor(QDialog):
|
|||||||
|
|
||||||
# END Class GuiProjectEditor
|
# END Class GuiProjectEditor
|
||||||
|
|
||||||
class GuiProjectEditMain(QGroupBox):
|
class GuiProjectEditMain(QWidget):
|
||||||
|
|
||||||
def __init__(self, theProject):
|
def __init__(self, theParent, theProject):
|
||||||
QGroupBox.__init__(self)
|
QWidget.__init__(self, theParent)
|
||||||
|
|
||||||
self.theProject = theProject
|
|
||||||
|
|
||||||
# self.mainGroup = QGroupBox("Project Settings")
|
|
||||||
self.setTitle("Project Settings")
|
|
||||||
self.mainForm = QFormLayout()
|
|
||||||
|
|
||||||
|
self.theParent = theParent
|
||||||
|
self.theProject = theProject
|
||||||
|
self.mainForm = QFormLayout()
|
||||||
self.editName = QLineEdit()
|
self.editName = QLineEdit()
|
||||||
self.editTitle = QLineEdit()
|
self.editTitle = QLineEdit()
|
||||||
self.editAuthors = QPlainTextEdit()
|
self.editAuthors = QPlainTextEdit()
|
||||||
|
|||||||
Reference in New Issue
Block a user