2011-10-02 07:52:28 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
2019-04-13 13:00:22 +00:00
|
|
|
##########################################################################
|
|
|
|
# OpenLP - Open Source Lyrics Projection #
|
|
|
|
# ---------------------------------------------------------------------- #
|
2022-02-06 09:10:17 +00:00
|
|
|
# Copyright (c) 2008-2022 OpenLP Developers #
|
2019-04-13 13:00:22 +00:00
|
|
|
# ---------------------------------------------------------------------- #
|
|
|
|
# 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 <https://www.gnu.org/licenses/>. #
|
|
|
|
##########################################################################
|
2013-02-01 21:34:23 +00:00
|
|
|
"""
|
|
|
|
The form layout
|
|
|
|
"""
|
2015-11-07 00:49:40 +00:00
|
|
|
from PyQt5 import QtCore, QtWidgets
|
2011-10-02 07:52:28 +00:00
|
|
|
|
2013-08-31 18:17:38 +00:00
|
|
|
from .themelayoutdialog import Ui_ThemeLayoutDialog
|
2011-10-02 07:52:28 +00:00
|
|
|
|
2013-02-01 21:34:23 +00:00
|
|
|
|
2015-11-07 00:49:40 +00:00
|
|
|
class ThemeLayoutForm(QtWidgets.QDialog, Ui_ThemeLayoutDialog):
|
2011-10-02 07:52:28 +00:00
|
|
|
"""
|
|
|
|
The exception dialog
|
|
|
|
"""
|
|
|
|
def __init__(self, parent):
|
2013-02-01 21:34:23 +00:00
|
|
|
"""
|
|
|
|
Constructor
|
|
|
|
"""
|
2013-07-18 14:14:29 +00:00
|
|
|
super(ThemeLayoutForm, self).__init__(parent)
|
2018-09-12 05:43:27 +00:00
|
|
|
self.setup_ui(self)
|
2011-10-02 07:52:28 +00:00
|
|
|
|
2015-11-07 00:49:40 +00:00
|
|
|
def exec(self, image):
|
2011-10-02 07:52:28 +00:00
|
|
|
"""
|
|
|
|
Run the Dialog with correct heading.
|
|
|
|
"""
|
2011-10-02 16:38:05 +00:00
|
|
|
pixmap = image.scaledToHeight(400, QtCore.Qt.SmoothTransformation)
|
2015-11-29 22:48:10 +00:00
|
|
|
pixmap.setDevicePixelRatio(self.theme_display_label.devicePixelRatio())
|
2013-12-26 17:36:00 +00:00
|
|
|
self.theme_display_label.setPixmap(pixmap)
|
|
|
|
display_aspect_ratio = float(image.width()) / image.height()
|
2022-01-21 21:32:09 +00:00
|
|
|
self.theme_display_label.setFixedSize(400, int(400 / display_aspect_ratio))
|
2015-11-07 00:49:40 +00:00
|
|
|
return QtWidgets.QDialog.exec(self)
|