From 844eb00abee76a2cbef7baa76d7a30a822605e91 Mon Sep 17 00:00:00 2001 From: Juraj Oravec Date: Tue, 11 Jun 2019 22:41:49 +0200 Subject: [PATCH] Add SettingsDialog, aloow change of icon closes GH-2 Signed-off-by: Juraj Oravec --- readability/__init__.py | 32 +++++++++- readability/data/{icon.png => icon-dark.png} | Bin readability/data/icon-light.png | Bin 0 -> 15650 bytes readability/i18n.py | 40 ++++++++++++ readability/metadata.desktop | 4 +- readability/settingsDialog.py | 62 +++++++++++++++++++ readability/settingsDialog.ui | 58 +++++++++++++++++ 7 files changed, 193 insertions(+), 3 deletions(-) rename readability/data/{icon.png => icon-dark.png} (100%) create mode 100644 readability/data/icon-light.png create mode 100644 readability/i18n.py create mode 100644 readability/settingsDialog.py create mode 100644 readability/settingsDialog.ui diff --git a/readability/__init__.py b/readability/__init__.py index 3bb4a68..8d2a587 100644 --- a/readability/__init__.py +++ b/readability/__init__.py @@ -1,12 +1,20 @@ import Falkon import os from PySide2 import QtCore, QtGui +from readability.settingsDialog import SettingsDialog class Readability(Falkon.PluginInterface, QtCore.QObject): view = None + config = None def init(self, state, settingsPath): + self.config = { + "settingsFile": os.path.join(settingsPath, "readability", "settings.ini"), + "icon": "dark" + } + self.loadSettings() + plugins = Falkon.MainApplication.instance().plugins() plugins.mainWindowCreated.connect(self.onMainWindowCreated) @@ -37,8 +45,9 @@ class Readability(Falkon.PluginInterface, QtCore.QObject): and hitTestResult.mediaUrl().isEmpty() and not hitTestResult.isContentEditable() and not hitTestResult.isContentSelected()): + icon = "icon-light.png" if self.config["icon"] == "light" else "icon-dark.png" menu.addAction( - QtGui.QIcon(os.path.join(os.path.dirname(__file__), "data", "icon.png")), + QtGui.QIcon(os.path.join(os.path.dirname(__file__), "data", icon)), "Readability", self.makeReadability ) @@ -94,5 +103,26 @@ class Readability(Falkon.PluginInterface, QtCore.QObject): self.view.page().runJavaScript(call) + def showSettings(self, parent): + settings = SettingsDialog(self.config, parent) + settings.accepted.connect(self.saveSettings) + settings.exec_() + + def saveSettings(self): + settings = QtCore.QSettings(self.config["settingsFile"], QtCore.QSettings.IniFormat) + + settings.beginGroup("Readability") + settings.setValue("icon", self.config["icon"]) + settings.endGroup() + + settings.sync() + + def loadSettings(self): + settings = QtCore.QSettings(self.config["settingsFile"], QtCore.QSettings.IniFormat) + + settings.beginGroup("Readability") + self.config["icon"] = str(settings.value("icon", self.config["icon"])) + settings.endGroup() + Falkon.registerPlugin(Readability()) diff --git a/readability/data/icon.png b/readability/data/icon-dark.png similarity index 100% rename from readability/data/icon.png rename to readability/data/icon-dark.png diff --git a/readability/data/icon-light.png b/readability/data/icon-light.png new file mode 100644 index 0000000000000000000000000000000000000000..80e0ee42121d8ad2cd1eadd33bdb33d7d69378e3 GIT binary patch literal 15650 zcmeHudpwi>|MzA&6r(;Zr(wmXP!5%x59@?VPDxZkB+6kV%yE-X$(-_0lyeD5kyNB% zVpKv!rea%jHra;RFx!2Nd_TYY@VkGH$NkrR-;eLrqlfK%z4yMZ_v`(7zn-t>^SWM1 z4tCbi4T>8;AQ1HEk;5lIAQ9lB2uMN<_%ny@T?B!^e_c9s$l>UrLtBHdpe|kt@Bx7| zGGa5#kF@MpB6^&C`QVOp_{NZT4*6#`ZVBn#3A=yr(Uvn|yI;>q=Ir}ZQzz}3e{*v> z@o_?OO{H|@wXIw*jW+pkTy;BNSM$Y97PSt+m^Pm#gZWn1%P*3QiY{km*zNc$Ajnyw z@qzfVgzAlFt;b{SU`|XW4-S*X*6FIjcP|@@-NwHM74A3dxZ0vh-daF@akXoybnl@$mE(c z<<))W3zCN-1AXq%_gUX+Rn6LZ5Sya-;Su3r-l}qk=lc8ghMKoQ^&SCB-Y|)2k^ccEh|8HD9)Tde!iS_EXXYd% zP!Ks%pe-4q6M?<2es1rd)*C*}$!#DkDa1NS%i~2C`v%BomW*OSdwZQH#f*&Bwc&0z zOtYrRU1Yv_&m=?KQ1nWAUgaipU|GbxY^)E11j2ts4P}`?%lhCWr$a#?9W~*9FuDX8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MI>-S@fNg%EHo7C6N_}44-R|W2DaxeABLDW5@*+AsSs+rDJ z+XJs|Nn2?6m8${afge!7I +# Copyright (C) 2019 Juraj Oravec +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# ============================================================ +import gettext +import os +from PySide2 import QtCore + +locale = QtCore.QLocale.system() +languages = [ + locale.name(), + locale.bcp47Name() +] +i = locale.name().find('_') +if i > 0: + languages.append(locale.name()[:i]) + +localedir = QtCore.QStandardPaths.locate( + QtCore.QStandardPaths.GenericDataLocation, + os.path.join(os.path.dirname(__file__), "locale"), + QtCore.QStandardPaths.LocateDirectory +) + +t = gettext.translation(__package__, localedir, languages, fallback=True) +i18n = t.gettext +i18np = t.ngettext diff --git a/readability/metadata.desktop b/readability/metadata.desktop index 30584a1..7ff65fa 100644 --- a/readability/metadata.desktop +++ b/readability/metadata.desktop @@ -2,11 +2,11 @@ Name=Readability Comment=Transform webpage to easy reading. -Icon=data/icon.png +Icon=data/icon-dark.png Type=Service X-Falkon-Type=Extension/Python X-Falkon-Author=Juraj Oravec X-Falkon-Email=sgd.orava@gmail.com X-Falkon-Version=1.0.0 -X-Falkon-Settings=false +X-Falkon-Settings=true diff --git a/readability/settingsDialog.py b/readability/settingsDialog.py new file mode 100644 index 0000000..766feaa --- /dev/null +++ b/readability/settingsDialog.py @@ -0,0 +1,62 @@ +# ============================================================ +# Auto Zoomer - plugin for Falkon +# Copyright (C) 2019 Juraj Oravec +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# ============================================================ + +import Falkon +import os +from PySide2 import QtCore, QtWidgets, QtUiTools +from readability.i18n import i18n + + +class SettingsDialog(QtWidgets.QDialog): + ui = None + config = None + + def __init__(self, config, parent=None): + super().__init__(parent) + + self.config = config + + file = QtCore.QFile(os.path.join(os.path.dirname(__file__), "settingsDialog.ui")) + file.open(QtCore.QFile.ReadOnly) + self.ui = QtUiTools.QUiLoader().load(file, self) + file.close() + + layout = QtWidgets.QVBoxLayout(self) + layout.addWidget(self.ui) + self.setLayout(layout) + + self.translations() + + self.ui.radioButtonLight.setChecked(self.config["icon"] == "light") + self.ui.radioButtonDark.setChecked(self.config["icon"] == "dark") + + self.ui.buttonBoxConfirm.accepted.connect(self.accept) + self.ui.buttonBoxConfirm.rejected.connect(self.reject) + + def translations(self): + self.setWindowTitle(i18n("Readability Settings")) + self.ui.radioButtonLight.setText(i18n("Light")) + self.ui.radioButtonDark.setText(i18n("Dark")) + + def updateData(self): + self.config["icon"] = "light" if self.ui.radioButtonLight.isChecked() else "dark" + + def accept(self): + self.updateData() + + super().accept() diff --git a/readability/settingsDialog.ui b/readability/settingsDialog.ui new file mode 100644 index 0000000..9e00d5f --- /dev/null +++ b/readability/settingsDialog.ui @@ -0,0 +1,58 @@ + + + Form + + + + 0 + 0 + 399 + 180 + + + + Readability Settings + + + + + + + + true + + + Menu icon: + + + + + + Light + + + + + + + Dark + + + + + + + + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + + +