Readability/readability/JsObject.py
Juraj Oravec b9d87ba86f
Save reader`s settings
closes #4
closes #7

Signed-off-by: Juraj Oravec <sgd.orava@gmail.com>
2019-06-20 21:58:52 +02:00

60 lines
1.7 KiB
Python

# Readability - plugin for Falkon
# Copyright (C) 2019 Juraj Oravec <sgd.orava@gmail.com>
#
# 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 <http://www.gnu.org/licenses/>.
import Falkon
from PySide2 import QtCore, QtGui
class JsObject(QtCore.QObject):
config = None
configChanged = QtCore.Signal()
def __init__(self, config, parent=None):
super().__init__(parent)
self.config = config
@QtCore.Slot(str)
def setColorTheme(self, colorTheme):
if colorTheme not in ("light", "sepia", "dark"):
return
if self.config["colorTheme"] != colorTheme:
self.config["colorTheme"] = colorTheme
self.configChanged.emit()
@QtCore.Slot(str)
def setFont(self, font):
if font not in ("sans-serif", "serif"):
return
if self.config["font"] != font:
self.config["font"] = font
self.configChanged.emit()
@QtCore.Slot(int)
def setFontSize(self, fontSize):
if fontSize < 1 and fontSize > 9:
return
if self.config["fontSize"] != fontSize:
self.config["fontSize"] = fontSize
self.configChanged.emit()