From fe02f16a928a711e3e0f4d82753e848f590af05b Mon Sep 17 00:00:00 2001 From: Juraj Oravec Date: Thu, 16 May 2019 13:07:52 +0200 Subject: [PATCH] Use comboBox for zoom level selection Signed-off-by: Juraj Oravec --- autoZoomer/listItem.py | 8 ++++++-- autoZoomer/listItem.ui | 29 ++++++++++++++++++++++------- autoZoomer/settings.ui | 21 ++++++++++----------- autoZoomer/settingsDialog.py | 7 ++++++- 4 files changed, 44 insertions(+), 21 deletions(-) diff --git a/autoZoomer/listItem.py b/autoZoomer/listItem.py index ae4a1cd..1072418 100644 --- a/autoZoomer/listItem.py +++ b/autoZoomer/listItem.py @@ -16,6 +16,7 @@ # along with this program. If not, see . # ============================================================ +import Falkon import os from PySide2 import QtCore, QtWidgets, QtUiTools @@ -35,6 +36,9 @@ class ListItem(QtWidgets.QWidget): layout.addWidget(self.ui) self.setLayout(layout) + for level in Falkon.WebView.zoomLevels(): + self.ui.comboBoxZoomLevel.addItem(str(level) + '%') + def active(self): return self.ui.checkBoxActive.isChecked() @@ -42,7 +46,7 @@ class ListItem(QtWidgets.QWidget): return self.ui.labelHost.text() def zoom(self): - return self.ui.spinBoxZoomLevel.value() + return self.ui.comboBoxZoomLevel.currentIndex() def setActive(self, active): active = bool(active) @@ -54,4 +58,4 @@ class ListItem(QtWidgets.QWidget): def setZoom(self, zoom): zoom = int(zoom) - self.ui.spinBoxZoomLevel.setValue(zoom) + self.ui.comboBoxZoomLevel.setCurrentIndex(zoom) diff --git a/autoZoomer/listItem.ui b/autoZoomer/listItem.ui index 5fff85e..cd04d4e 100644 --- a/autoZoomer/listItem.ui +++ b/autoZoomer/listItem.ui @@ -6,10 +6,16 @@ 0 0 - 354 - 30 + 387 + 28 + + + 0 + 0 + + Form @@ -24,7 +30,7 @@ 0 - + @@ -40,11 +46,20 @@ - - - 18 + + + Qt::Horizontal - + + + 0 + 20 + + + + + + diff --git a/autoZoomer/settings.ui b/autoZoomer/settings.ui index ce23245..e4d303a 100644 --- a/autoZoomer/settings.ui +++ b/autoZoomer/settings.ui @@ -6,8 +6,8 @@ 0 0 - 390 - 334 + 520 + 358 @@ -30,21 +30,20 @@ - - - 18 - - - 6 - - + - + + + + 400 + 200 + + QAbstractScrollArea::AdjustIgnored diff --git a/autoZoomer/settingsDialog.py b/autoZoomer/settingsDialog.py index e35d383..94edb9e 100644 --- a/autoZoomer/settingsDialog.py +++ b/autoZoomer/settingsDialog.py @@ -16,6 +16,7 @@ # along with this program. If not, see . # ============================================================ +import Falkon import os from PySide2 import QtCore, QtWidgets, QtUiTools from autoZoomer.listItem import ListItem @@ -46,6 +47,10 @@ class SettingsDialog(QtWidgets.QDialog): layout.addWidget(self.ui) self.setLayout(layout) + for level in Falkon.WebView.zoomLevels(): + self.ui.comboBoxNew.addItem(str(level) + '%') + self.ui.comboBoxNew.setCurrentIndex(Falkon.WebView.zoomLevels().index(100)) + self.translations() self.ui.checkBoxEnableAutoZoomer.setChecked(self.config["active"]) @@ -122,7 +127,7 @@ class SettingsDialog(QtWidgets.QDialog): def handleItemAdd(self): host = self.ui.lineEditNew.text() - zoom = self.ui.spinBoxNew.value() + zoom = self.ui.comboBoxNew.currentIndex() if not host: return