Make use of the improved layout class in Project Settings and Preferences

This commit is contained in:
Veronica K. B. Olsen
2021-02-22 20:22:49 +01:00
parent c89cb32871
commit 2152f54066
2 changed files with 24 additions and 11 deletions
+17 -1
View File
@@ -74,12 +74,14 @@ class GuiPreferences(PagedDialog):
self.buttonBox.rejected.connect(self._doClose) self.buttonBox.rejected.connect(self._doClose)
self.addControls(self.buttonBox) self.addControls(self.buttonBox)
self.resize(*self.mainConf.getPreferencesSize())
logger.debug("GuiPreferences initialisation complete") logger.debug("GuiPreferences initialisation complete")
return return
## ##
# Buttons # Slots
## ##
def _doSave(self): def _doSave(self):
@@ -102,6 +104,7 @@ class GuiPreferences(PagedDialog):
nwAlert.INFO nwAlert.INFO
) )
self._saveWindowSize()
self.accept() self.accept()
return return
@@ -109,9 +112,22 @@ class GuiPreferences(PagedDialog):
def _doClose(self): def _doClose(self):
"""Close the preferences without saving the changes. """Close the preferences without saving the changes.
""" """
self._saveWindowSize()
self.reject() self.reject()
return return
##
# Internal Functions
##
def _saveWindowSize(self):
"""Save the dialog window size.
"""
winWidth = self.mainConf.rpxInt(self.width())
winHeight = self.mainConf.rpxInt(self.height())
self.mainConf.setPreferencesSize(winWidth, winHeight)
return
# END Class GuiPreferences # END Class GuiPreferences
class GuiPreferencesGeneral(QWidget): class GuiPreferencesGeneral(QWidget):
+7 -10
View File
@@ -169,11 +169,11 @@ class GuiProjectEditMain(QWidget):
self.mainForm.addGroupLabel(self.tr("Project Settings")) self.mainForm.addGroupLabel(self.tr("Project Settings"))
xW = self.mainConf.pxInt(250) xW = self.mainConf.pxInt(250)
xH = self.mainConf.pxInt(100) xH = self.mainConf.pxInt(80)
self.editName = QLineEdit() self.editName = QLineEdit()
self.editName.setMaxLength(200) self.editName.setMaxLength(200)
self.editName.setFixedWidth(xW) self.editName.setMaximumWidth(xW)
self.editName.setText(self.theProject.projName) self.editName.setText(self.theProject.projName)
self.mainForm.addRow( self.mainForm.addRow(
self.tr("Working title"), self.tr("Working title"),
@@ -183,7 +183,7 @@ class GuiProjectEditMain(QWidget):
self.editTitle = QLineEdit() self.editTitle = QLineEdit()
self.editTitle.setMaxLength(200) self.editTitle.setMaxLength(200)
self.editTitle.setFixedWidth(xW) self.editTitle.setMaximumWidth(xW)
self.editTitle.setText(self.theProject.bookTitle) self.editTitle.setText(self.theProject.bookTitle)
self.mainForm.addRow( self.mainForm.addRow(
self.tr("Novel title"), self.tr("Novel title"),
@@ -192,12 +192,9 @@ class GuiProjectEditMain(QWidget):
) )
self.editAuthors = QPlainTextEdit() self.editAuthors = QPlainTextEdit()
bookAuthors = "" self.editAuthors.setMinimumHeight(xH)
for bookAuthor in self.theProject.bookAuthors: self.editAuthors.setMaximumWidth(xW)
bookAuthors += bookAuthor+"\n" self.editAuthors.setPlainText("\n".join(self.theProject.bookAuthors))
self.editAuthors.setPlainText(bookAuthors)
self.editAuthors.setFixedHeight(xH)
self.editAuthors.setFixedWidth(xW)
self.mainForm.addRow( self.mainForm.addRow(
self.tr("Author(s)"), self.tr("Author(s)"),
self.editAuthors, self.editAuthors,
@@ -205,7 +202,7 @@ class GuiProjectEditMain(QWidget):
) )
self.spellLang = QComboBox(self) self.spellLang = QComboBox(self)
self.spellLang.setFixedWidth(xW) self.spellLang.setMaximumWidth(xW)
theDict = self.theParent.docEditor.theDict theDict = self.theParent.docEditor.theDict
self.spellLang.addItem(self.tr("Default"), "None") self.spellLang.addItem(self.tr("Default"), "None")
if theDict is not None: if theDict is not None: