openlp/openlp/core/ui/themelayoutform.py

51 lines
2.4 KiB
Python
Raw Normal View History

2011-10-02 07:52:28 +00:00
# -*- coding: utf-8 -*-
2012-12-29 15:25:29 +00:00
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
2011-10-02 07:52:28 +00:00
###############################################################################
# OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- #
2015-12-31 22:46:06 +00:00
# Copyright (c) 2008-2016 OpenLP Developers #
2011-10-02 07:52:28 +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; version 2 of the License. #
# #
# 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, write to the Free Software Foundation, Inc., 59 #
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
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)
2011-10-02 07:52:28 +00:00
self.setupUi(self)
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)
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()
self.theme_display_label.setFixedSize(400, 400 / display_aspect_ratio)
2015-11-07 00:49:40 +00:00
return QtWidgets.QDialog.exec(self)