From ceabf50cf914e152054737e10aefebcdcf4a9b7b Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" <1619840+vkbo@users.noreply.github.com> Date: Sat, 8 Aug 2020 16:01:33 +0200 Subject: [PATCH] The histogram cap setting is now saved to the options file --- nw/core/options.py | 1 + nw/gui/writingstats.py | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/nw/core/options.py b/nw/core/options.py index 3bdf88f3..a91f6f68 100644 --- a/nw/core/options.py +++ b/nw/core/options.py @@ -58,6 +58,7 @@ class OptionState(): "hideZeros", "hideNegative", "groupByDay", + "histMax", }, "GuiDocSplit": { "spLevel", diff --git a/nw/gui/writingstats.py b/nw/gui/writingstats.py index 76c45a58..387c173e 100644 --- a/nw/gui/writingstats.py +++ b/nw/gui/writingstats.py @@ -212,11 +212,14 @@ class GuiWritingStats(QDialog): self.histMax.setMinimum(100) self.histMax.setMaximum(100000) self.histMax.setSingleStep(100) + self.histMax.setValue( + self.optState.getInt("GuiWritingStats", "histMax", 2000) + ) self.histMax.valueChanged.connect(self._updateListBox) self.optsBox = QHBoxLayout() self.optsBox.addStretch(1) - self.optsBox.addWidget(QLabel("Word count cap for histogram"), 0) + self.optsBox.addWidget(QLabel("Word count cap for the histogram"), 0) self.optsBox.addWidget(self.histMax, 0) # Buttons @@ -280,6 +283,7 @@ class GuiWritingStats(QDialog): hideZeros = self.hideZeros.isChecked() hideNegative = self.hideNegative.isChecked() groupByDay = self.groupByDay.isChecked() + histMax = self.histMax.value() self.optState.setValue("GuiWritingStats", "winWidth", winWidth) self.optState.setValue("GuiWritingStats", "winHeight", winHeight) @@ -293,6 +297,7 @@ class GuiWritingStats(QDialog): self.optState.setValue("GuiWritingStats", "hideZeros", hideZeros) self.optState.setValue("GuiWritingStats", "hideNegative", hideNegative) self.optState.setValue("GuiWritingStats", "groupByDay", groupByDay) + self.optState.setValue("GuiWritingStats", "histMax", histMax) self.optState.saveSettings() self.close()