2019-05-15 19:42:17 +02:00
|
|
|
# ============================================================
|
|
|
|
# Auto Zoomer - 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/>.
|
|
|
|
# ============================================================
|
|
|
|
|
2019-05-16 13:07:52 +02:00
|
|
|
import Falkon
|
2019-05-15 19:42:17 +02:00
|
|
|
import os
|
|
|
|
from PySide2 import QtCore, QtWidgets, QtUiTools
|
|
|
|
|
|
|
|
|
|
|
|
class ListItem(QtWidgets.QWidget):
|
|
|
|
ui = None
|
|
|
|
|
|
|
|
def __init__(self, parent=None):
|
|
|
|
super().__init__(parent)
|
|
|
|
|
|
|
|
file = QtCore.QFile(os.path.join(os.path.dirname(__file__), "listItem.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)
|
|
|
|
|
2019-05-16 13:07:52 +02:00
|
|
|
for level in Falkon.WebView.zoomLevels():
|
|
|
|
self.ui.comboBoxZoomLevel.addItem(str(level) + '%')
|
|
|
|
|
2019-05-15 19:42:17 +02:00
|
|
|
def active(self):
|
|
|
|
return self.ui.checkBoxActive.isChecked()
|
|
|
|
|
|
|
|
def host(self):
|
|
|
|
return self.ui.labelHost.text()
|
|
|
|
|
|
|
|
def zoom(self):
|
2019-05-16 13:07:52 +02:00
|
|
|
return self.ui.comboBoxZoomLevel.currentIndex()
|
2019-05-15 19:42:17 +02:00
|
|
|
|
|
|
|
def setActive(self, active):
|
|
|
|
active = bool(active)
|
|
|
|
self.ui.checkBoxActive.setChecked(active)
|
|
|
|
|
|
|
|
def setHost(self, host):
|
|
|
|
host = str(host)
|
|
|
|
self.ui.labelHost.setText(host)
|
|
|
|
|
|
|
|
def setZoom(self, zoom):
|
|
|
|
zoom = int(zoom)
|
2019-05-16 13:07:52 +02:00
|
|
|
self.ui.comboBoxZoomLevel.setCurrentIndex(zoom)
|