AutoZoomer/autoZoomer/listItem.py
Juraj Oravec 3f55fd0eb9
Initial commit
Signed-off-by: Juraj Oravec <sgd.orava@gmail.com>
2019-05-15 19:42:17 +02:00

58 lines
1.8 KiB
Python

# ============================================================
# 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/>.
# ============================================================
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)
def active(self):
return self.ui.checkBoxActive.isChecked()
def host(self):
return self.ui.labelHost.text()
def zoom(self):
return self.ui.spinBoxZoomLevel.value()
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)
self.ui.spinBoxZoomLevel.setValue(zoom)