diff --git a/nw/core/options.py b/nw/core/options.py index 25bf1fb4..0ff7c919 100644 --- a/nw/core/options.py +++ b/nw/core/options.py @@ -78,6 +78,11 @@ class OptionState(): "columnWidth", "columnHidden", }, + "GuiProjectSettings": { + "winWidth", + "winHeight", + "replaceColW", + } } return diff --git a/nw/gui/build.py b/nw/gui/build.py index 51a9dd68..e949a846 100644 --- a/nw/gui/build.py +++ b/nw/gui/build.py @@ -871,8 +871,8 @@ class GuiBuildNovel(QDialog): "section" : self.fmtSection.text().strip(), }) - winWidth = self.mainConf.pxInt(self.width()) - winHeight = self.mainConf.pxInt(self.height()) + winWidth = self.mainConf.rpxInt(self.width()) + winHeight = self.mainConf.rpxInt(self.height()) justifyText = self.justifyText.isChecked() noStyling = self.noStyling.isChecked() textFont = self.textFont.text() diff --git a/nw/gui/projsettings.py b/nw/gui/projsettings.py index 8f5dacb3..6f8f32ba 100644 --- a/nw/gui/projsettings.py +++ b/nw/gui/projsettings.py @@ -51,9 +51,17 @@ class GuiProjectSettings(PagedDialog): self.mainConf = nw.CONFIG self.theParent = theParent self.theProject = theProject + self.optState = theProject.optState self.theProject.countStatus() self.setWindowTitle("Project Settings") + self.setMinimumWidth(self.mainConf.pxInt(570)) + self.setMinimumHeight(self.mainConf.pxInt(355)) + + self.resize( + self.mainConf.pxInt(self.optState.getInt("GuiProjectSettings", "winWidth", 570)), + self.mainConf.pxInt(self.optState.getInt("GuiProjectSettings", "winHeight", 355)) + ) self.tabMain = GuiProjectEditMain(self.theParent, self.theProject) self.tabMeta = GuiProjectEditMeta(self.theParent, self.theProject) @@ -76,7 +84,13 @@ class GuiProjectSettings(PagedDialog): return + ## + # Slots + ## + def _doSave(self): + """Save settings and close dialog. + """ logger.verbose("GuiProjectSettings save button clicked") projName = self.tabMain.editName.text() @@ -100,13 +114,23 @@ class GuiProjectSettings(PagedDialog): newList = self.tabReplace.getNewList() self.theProject.setAutoReplace(newList) - self.close() + self._doClose() return def _doClose(self): - logger.verbose("GuiProjectSettings close button clicked") + """Close the dialog. + """ + winWidth = self.mainConf.rpxInt(self.width()) + winHeight = self.mainConf.rpxInt(self.height()) + replaceColW = self.mainConf.rpxInt(self.tabReplace.listBox.columnWidth(0)) + + self.optState.setValue("GuiProjectSettings", "winWidth", winWidth) + self.optState.setValue("GuiProjectSettings", "winHeight", winHeight) + self.optState.setValue("GuiProjectSettings", "replaceColW", replaceColW) + self.close() + return # END Class GuiProjectSettings @@ -452,16 +476,23 @@ class GuiProjectEditReplace(QWidget): def __init__(self, theParent, theProject): QWidget.__init__(self, theParent) + self.mainConf = nw.CONFIG self.theParent = theParent self.theTheme = theParent.theTheme self.theProject = theProject + self.optState = theProject.optState self.arChanged = False - self.outerBox = QVBoxLayout() - self.bottomBox = QHBoxLayout() - self.listBox = QTreeWidget() + self.outerBox = QVBoxLayout() + self.bottomBox = QHBoxLayout() + + wCol0 = self.mainConf.pxInt( + self.optState.getInt("GuiProjectSettings", "replaceColW", 100) + ) + self.listBox = QTreeWidget() self.listBox.setHeaderLabels(["Keyword","Replace With"]) self.listBox.itemSelectionChanged.connect(self._selectedItem) + self.listBox.setColumnWidth(0, wCol0) self.listBox.setIndentation(0) for aKey, aVal in self.theProject.autoReplace.items():