From 49089e7e45a979986a977bc8e9e95864f0f21c4a Mon Sep 17 00:00:00 2001 From: Juraj Oravec Date: Thu, 20 Jun 2019 22:48:43 +0200 Subject: [PATCH] Add reader`s options to settings dialog Signed-off-by: Juraj Oravec --- readability/settingsDialog.py | 44 ++++++++++- readability/settingsDialog.ui | 141 +++++++++++++++++++++++++++++++--- 2 files changed, 169 insertions(+), 16 deletions(-) diff --git a/readability/settingsDialog.py b/readability/settingsDialog.py index 8e8c511..4087fef 100644 --- a/readability/settingsDialog.py +++ b/readability/settingsDialog.py @@ -41,22 +41,58 @@ class SettingsDialog(QtWidgets.QDialog): self.setLayout(layout) self.translations() - - self.ui.radioButtonLight.setChecked(self.config["icon"] == "light") - self.ui.radioButtonDark.setChecked(self.config["icon"] == "dark") - self.ui.checkBoxContextMenu.setChecked(self.config["contextMenu"]) + self.applyConfig() self.ui.buttonBoxConfirm.accepted.connect(self.accept) self.ui.buttonBoxConfirm.rejected.connect(self.reject) + def applyConfig(self): + self.ui.radioButtonLight.setChecked(self.config["icon"] == "light") + self.ui.radioButtonDark.setChecked(self.config["icon"] == "dark") + + self.ui.radioButtonSchemeLight.setChecked(self.config["colorTheme"] == "light") + self.ui.radioButtonSchemeSepia.setChecked(self.config["colorTheme"] == "sepia") + self.ui.radioButtonSchemeDark.setChecked(self.config["colorTheme"] == "dark") + + self.ui.radioButtonFontSansSerif.setChecked(self.config["font"] == "sans-serif") + self.ui.radioButtonFontSerif.setChecked(self.config["font"] == "serif") + + self.ui.comboBoxFontSize.setCurrentIndex(self.config["fontSize"] - 1) + + self.ui.checkBoxContextMenu.setChecked(self.config["contextMenu"]) + def translations(self): self.setWindowTitle(i18n("Readability Settings")) + + self.ui.groupBoxIcon.setTitle(i18n("Menu icon")) self.ui.radioButtonLight.setText(i18n("Light")) self.ui.radioButtonDark.setText(i18n("Dark")) + + self.ui.groupBoxColorScheme.setTitle(i18n("Color scheme")) + self.ui.radioButtonSchemeLight.setText(i18n("Light")) + self.ui.radioButtonSchemeSepia.setText(i18n("Sepia")) + self.ui.radioButtonSchemeDark.setText(i18n("Dark")) + + self.ui.groupBoxFont.setTitle(i18n("Font")) + self.ui.radioButtonFontSansSerif.setText(i18n("Sans-Serif")) + self.ui.radioButtonFontSerif.setText(i18n("Serif")) + self.ui.labelFontSize.setText(i18n("Font size:")) + self.ui.checkBoxContextMenu.setText(i18n("Show in context menu")) def updateData(self): self.config["icon"] = "light" if self.ui.radioButtonLight.isChecked() else "dark" + + if self.ui.radioButtonSchemeLight.isChecked(): + self.config["colorTheme"] = "light" + elif self.ui.radioButtonSchemeSepia.isChecked(): + self.config["colorTheme"] = "sepia" + else: + self.config["colorTheme"] = "dark" + + self.config["font"] = "sans-serif" if self.ui.radioButtonFontSansSerif.isChecked() else "serif" + self.config["fontSize"] = self.ui.comboBoxFontSize.currentIndex() + 1 + self.config["contextMenu"] = self.ui.checkBoxContextMenu.isChecked() def accept(self): diff --git a/readability/settingsDialog.ui b/readability/settingsDialog.ui index 90550eb..dc73889 100644 --- a/readability/settingsDialog.ui +++ b/readability/settingsDialog.ui @@ -6,8 +6,8 @@ 0 0 - 399 - 180 + 350 + 344 @@ -17,28 +17,145 @@ - - - true - + + + + + true + + + Menu icon + + + + + + Light + + + + + + + Dark + + + + + + + + + + Color scheme + + + + + + Light + + + + + + + Sepia + + + + + + + Dark + + + + + + + + + + - Menu icon: + Font - + - + - Light + Sans-Serif - + - Dark + Serif + + + + + + Font size: + + + + + + + + 10 px + + + + + 12 px + + + + + 14 px + + + + + 16 px + + + + + 18 px + + + + + 20 px + + + + + 22 px + + + + + 24 px + + + + + 26 px + + + + + +