From ae01a4de5428b573794e397c7f041a715cf2d09b Mon Sep 17 00:00:00 2001 From: Juraj Oravec Date: Wed, 15 May 2019 21:30:22 +0200 Subject: [PATCH] Add zoom to default zoom level on unknown hosts Signed-off-by: Juraj Oravec --- autoZoomer/autoZoomer.py | 7 ++++++- autoZoomer/settings.ui | 9 ++++++++- autoZoomer/settingsDialog.py | 2 ++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/autoZoomer/autoZoomer.py b/autoZoomer/autoZoomer.py index c9a7e42..e7a6ee0 100644 --- a/autoZoomer/autoZoomer.py +++ b/autoZoomer/autoZoomer.py @@ -32,7 +32,8 @@ class AutoZoomer(QtCore.QObject): self.config = { "settingsFile": os.path.join(settingsPath, "autoZoomer", "settings.ini"), - "active": True + "active": True, + "defaultZoom": True } self.data = {} self.remove = [] @@ -50,6 +51,7 @@ class AutoZoomer(QtCore.QObject): settings.beginGroup("AutoZoomer") self.config["active"] = str2bool(settings.value("active", True)) + self.config["defaultZoom"] = str2bool(settings.value("defaultZoom", True)) settings.endGroup() for group in settings.childGroups(): @@ -68,6 +70,7 @@ class AutoZoomer(QtCore.QObject): settings.beginGroup("AutoZoomer") settings.setValue("active", self.config["active"]) + settings.setValue("defaultZoom", self.config["defaultZoom"]) settings.endGroup() for host in self.remove: @@ -92,6 +95,8 @@ class AutoZoomer(QtCore.QObject): if host in self.data.keys(): if self.data[host]["active"]: view.setZoomLevel(self.data[host]["zoom"]) + elif self.config["defaultZoom"]: + view.setZoomLevel(Falkon.Settings.staticSettings().defaultZoomLevel) def addItem(self, host, zoom=6, active=True): if not host: diff --git a/autoZoomer/settings.ui b/autoZoomer/settings.ui index 843d9d2..ce23245 100644 --- a/autoZoomer/settings.ui +++ b/autoZoomer/settings.ui @@ -6,7 +6,7 @@ 0 0 - 379 + 390 334 @@ -102,6 +102,13 @@ + + + + On unknown host zoom to default zoom level + + + diff --git a/autoZoomer/settingsDialog.py b/autoZoomer/settingsDialog.py index 6832516..0180925 100644 --- a/autoZoomer/settingsDialog.py +++ b/autoZoomer/settingsDialog.py @@ -46,6 +46,7 @@ class SettingsDialog(QtWidgets.QDialog): self.setLayout(layout) self.ui.checkBoxEnableAutoZoomer.setChecked(self.config["active"]) + self.ui.checkBoxDefaultZoom.setChecked(self.config["defaultZoom"]) for key, value in self.data.items(): widget = ListItem() @@ -89,6 +90,7 @@ class SettingsDialog(QtWidgets.QDialog): def updateData(self): self.config["active"] = self.ui.checkBoxEnableAutoZoomer.isChecked() + self.config["defaultZoom"] = self.ui.checkBoxDefaultZoom.isChecked() self.data.clear()