diff --git a/openlp/core/ui/__init__.py b/openlp/core/ui/__init__.py index e754480e0..7d2dfa0ba 100644 --- a/openlp/core/ui/__init__.py +++ b/openlp/core/ui/__init__.py @@ -54,6 +54,7 @@ class HideMode(object): from firsttimeform import FirstTimeForm from firsttimelanguageform import FirstTimeLanguageForm +from themelayoutform import ThemeLayoutForm from themeform import ThemeForm from filerenameform import FileRenameForm from starttimeform import StartTimeForm diff --git a/openlp/core/ui/themeform.py b/openlp/core/ui/themeform.py index 1ac2cf754..cbb83073d 100644 --- a/openlp/core/ui/themeform.py +++ b/openlp/core/ui/themeform.py @@ -33,6 +33,7 @@ from PyQt4 import QtCore, QtGui from openlp.core.lib import Receiver, translate from openlp.core.lib.theme import BackgroundType, BackgroundGradientType from openlp.core.lib.ui import UiStrings, critical_error_message_box +from openlp.core.ui import ThemeLayoutForm from openlp.core.utils import get_images_filter from themewizard import Ui_ThemeWizard @@ -58,6 +59,7 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard): self.registerFields() self.updateThemeAllowed = True self.temp_background_filename = u'' + self.themeLayoutForm = ThemeLayoutForm(self) QtCore.QObject.connect(self.backgroundComboBox, QtCore.SIGNAL(u'currentIndexChanged(int)'), self.onBackgroundComboBoxCurrentIndexChanged) @@ -88,6 +90,9 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard): self.onShadowCheckCheckBoxStateChanged) QtCore.QObject.connect(self.footerColorButton, QtCore.SIGNAL(u'clicked()'), self.onFooterColorButtonClicked) + QtCore.QObject.connect(self, + QtCore.SIGNAL(u'customButtonClicked(int)'), + self.onCustom1ButtonClicked) QtCore.QObject.connect(self.mainPositionCheckBox, QtCore.SIGNAL(u'stateChanged(int)'), self.onMainPositionCheckBoxStateChanged) @@ -231,7 +236,6 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard): """ if self.page(pageId) == self.areaPositionPage: self.setOption(QtGui.QWizard.HaveCustomButton1, True) - self._generate_layout() else: self.setOption(QtGui.QWizard.HaveCustomButton1, False) if self.page(pageId) == self.previewPage: @@ -241,22 +245,21 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard): self.displayAspectRatio = float(frame.width()) / frame.height() self.resizeEvent() - def _generate_layout(self): + def onCustom1ButtonClicked(self, number): width = self.thememanager.mainwindow.renderer.width height = self.thememanager.mainwindow.renderer.height pixmap = QtGui.QPixmap(width, height) pixmap.fill(QtCore.Qt.white) paint = QtGui.QPainter(pixmap) paint.setPen(QtGui.QPen(QtCore.Qt.blue, 2)) - paint.drawRect(self.thememanager.mainwindow.renderer.get_main_rectangle(self.theme)) + paint.drawRect(self.thememanager.mainwindow.renderer. + get_main_rectangle(self.theme)) paint.setPen(QtGui.QPen(QtCore.Qt.red, 2)) - paint.drawRect(self.thememanager.mainwindow.renderer.get_footer_rectangle(self.theme)) + paint.drawRect(self.thememanager.mainwindow.renderer. + get_footer_rectangle(self.theme)) paint.end() - pixmap = pixmap.scaledToHeight(150, QtCore.Qt.SmoothTransformation) - #self.themeLayoutLabel.setFixedSize(pixmap.width() + 2, pixmap.height() + 2) - #self.themeLayoutLabel.setPixmap(pixmap) - #self.displayAspectRatio = float(pixmap.width()) / pixmap.height() - #self.resizeEvent() + self.themeLayoutForm.exec_(pixmap) + def onOutlineCheckCheckBoxStateChanged(self, state): """ diff --git a/openlp/core/ui/themelayoutdialog.py b/openlp/core/ui/themelayoutdialog.py new file mode 100644 index 000000000..d9770be23 --- /dev/null +++ b/openlp/core/ui/themelayoutdialog.py @@ -0,0 +1,65 @@ +# -*- coding: utf-8 -*- +# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 + +############################################################################### +# OpenLP - Open Source Lyrics Projection # +# --------------------------------------------------------------------------- # +# Copyright (c) 2008-2011 Raoul Snyman # +# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # +# Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # +# Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # +# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Frode Woldsund # +# --------------------------------------------------------------------------- # +# 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 # +############################################################################### + +from PyQt4 import QtCore, QtGui + +from openlp.core.lib import translate +from openlp.core.lib.ui import create_accept_reject_button_box + + +class Ui_ThemeLayoutDialog(object): + def setupUi(self, themeLayoutDialog): + themeLayoutDialog.setObjectName(u'themeLayoutDialogDialog') + themeLayoutDialog.resize(300, 200) + self.previewLayout = QtGui.QVBoxLayout(themeLayoutDialog) + self.previewLayout.setObjectName(u'PreviewLayout') + self.previewArea = QtGui.QWidget(themeLayoutDialog) + self.previewArea.setObjectName(u'PreviewArea') + self.previewAreaLayout = QtGui.QGridLayout(self.previewArea) + self.previewAreaLayout.setMargin(0) + self.previewAreaLayout.setColumnStretch(0, 1) + self.previewAreaLayout.setRowStretch(0, 1) + self.previewAreaLayout.setObjectName(u'PreviewAreaLayout') + self.themeDisplayLabel = QtGui.QLabel(self.previewArea) + self.themeDisplayLabel.setFrameShape(QtGui.QFrame.Box) + self.themeDisplayLabel.setScaledContents(True) + self.themeDisplayLabel.setObjectName(u'ThemeDisplayLabel') + self.previewAreaLayout.addWidget(self.themeDisplayLabel) + self.previewLayout.addWidget(self.previewArea) + self.buttonBox = QtGui.QDialogButtonBox(themeLayoutDialog) + self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Ok) + self.buttonBox.setObjectName(u'ButtonBox') + QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(u'accepted()'), + themeLayoutDialog.accept) + self.previewLayout.addWidget(self.buttonBox) + self.retranslateUi(themeLayoutDialog) + QtCore.QMetaObject.connectSlotsByName(themeLayoutDialog) + + def retranslateUi(self, themeLayoutDialog): + themeLayoutDialog.setWindowTitle( + translate('OpenLP.StartTimeForm', 'Theme Layout')) + diff --git a/openlp/core/ui/themelayoutform.py b/openlp/core/ui/themelayoutform.py new file mode 100644 index 000000000..b1984c01a --- /dev/null +++ b/openlp/core/ui/themelayoutform.py @@ -0,0 +1,54 @@ +# -*- coding: utf-8 -*- +# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 + +############################################################################### +# OpenLP - Open Source Lyrics Projection # +# --------------------------------------------------------------------------- # +# Copyright (c) 2008-2011 Raoul Snyman # +# Portions copyright (c) 2008-2011 Tim Bentley, Gerald Britton, Jonathan # +# Corwin, Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, # +# Armin Köhler, Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias # +# Põldaru, Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # +# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Frode Woldsund # +# --------------------------------------------------------------------------- # +# 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 # +############################################################################### + +from PyQt4 import QtGui, QtCore + +from themelayoutdialog import Ui_ThemeLayoutDialog + +from openlp.core.lib import translate +from openlp.core.lib.ui import UiStrings, critical_error_message_box + +class ThemeLayoutForm(QtGui.QDialog, Ui_ThemeLayoutDialog): + """ + The exception dialog + """ + def __init__(self, parent): + QtGui.QDialog.__init__(self, parent) + self.setupUi(self) + + def exec_(self, image): + """ + Run the Dialog with correct heading. + """ + pixmap = image.scaledToHeight(150, QtCore.Qt.SmoothTransformation) + self.themeDisplayLabel.setPixmap(image) + return QtGui.QDialog.exec_(self) + + def accept(self): + return QtGui.QDialog.accept(self) + + diff --git a/resources/forms/themelayout.ui b/resources/forms/themelayout.ui new file mode 100644 index 000000000..2152fc5d0 --- /dev/null +++ b/resources/forms/themelayout.ui @@ -0,0 +1,81 @@ + + + ThemeLayout + + + + 0 + 0 + 400 + 300 + + + + Theme Layout + + + + + 50 + 260 + 341 + 32 + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + 20 + 10 + 361 + 231 + + + + + + + + + + + buttonBox + accepted() + ThemeLayout + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + ThemeLayout + reject() + + + 316 + 260 + + + 286 + 274 + + + + +