forked from openlp/openlp
Start UI component library - add_welcome_page
This commit is contained in:
parent
1ca6827c29
commit
64ab5c29b4
57
openlp/core/lib/ui.py
Normal file
57
openlp/core/lib/ui.py
Normal file
@ -0,0 +1,57 @@
|
||||
# -*- 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, Jonathan Corwin, Michael #
|
||||
# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian #
|
||||
# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, #
|
||||
# Carsten Tinggaard, 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 #
|
||||
###############################################################################
|
||||
"""
|
||||
The :mod:`ui` module provides standard UI components for OpenLP.
|
||||
"""
|
||||
import logging
|
||||
|
||||
from PyQt4 import QtGui
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
def add_welcome_page(parent, image):
|
||||
"""
|
||||
Generate an opening welcome page for a wizard using a provided image.
|
||||
|
||||
``image``
|
||||
A splash image for the wizard.
|
||||
"""
|
||||
parent.welcomePage = QtGui.QWizardPage()
|
||||
parent.welcomePage.setPixmap(QtGui.QWizard.WatermarkPixmap,
|
||||
QtGui.QPixmap(image))
|
||||
parent.welcomePage.setObjectName(u'WelcomePage')
|
||||
parent.welcomeLayout = QtGui.QVBoxLayout(parent.welcomePage)
|
||||
parent.welcomeLayout.setObjectName(u'WelcomeLayout')
|
||||
parent.titleLabel = QtGui.QLabel(parent.welcomePage)
|
||||
parent.titleLabel.setObjectName(u'TitleLabel')
|
||||
parent.welcomeLayout.addWidget(parent.titleLabel)
|
||||
parent.welcomeLayout.addSpacing(40)
|
||||
parent.informationLabel = QtGui.QLabel(parent.welcomePage)
|
||||
parent.informationLabel.setWordWrap(True)
|
||||
parent.informationLabel.setObjectName(u'InformationLabel')
|
||||
parent.welcomeLayout.addWidget(parent.informationLabel)
|
||||
parent.welcomeLayout.addStretch()
|
||||
parent.addPage(parent.welcomePage)
|
@ -27,7 +27,7 @@
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import translate, build_icon
|
||||
from openlp.core.ui.wizard import addWelcomePage
|
||||
from openlp.core.lib.ui import add_welcome_page
|
||||
|
||||
class Ui_ThemeWizard(object):
|
||||
def setupUi(self, themeWizard):
|
||||
@ -37,7 +37,7 @@ class Ui_ThemeWizard(object):
|
||||
themeWizard.setOptions(QtGui.QWizard.IndependentPages |
|
||||
QtGui.QWizard.NoBackButtonOnStartPage)
|
||||
# Welcome Page
|
||||
addWelcomePage(themeWizard, u':/wizards/wizard_createtheme.bmp')
|
||||
add_welcome_page(themeWizard, u':/wizards/wizard_createtheme.bmp')
|
||||
# Background Page
|
||||
self.backgroundPage = QtGui.QWizardPage()
|
||||
self.backgroundPage.setObjectName(u'BackgroundPage')
|
||||
|
@ -31,6 +31,7 @@ import logging
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.core.lib import build_icon, Receiver
|
||||
from openlp.core.lib.ui import add_welcome_page
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
@ -63,7 +64,7 @@ class OpenLPWizard(QtGui.QWizard):
|
||||
self.setOptions(QtGui.QWizard.IndependentPages |
|
||||
QtGui.QWizard.NoBackButtonOnStartPage |
|
||||
QtGui.QWizard.NoBackButtonOnLastPage)
|
||||
addWelcomePage(self, image)
|
||||
add_welcome_page(self, image)
|
||||
self.addCustomPages()
|
||||
self.addProgressPage()
|
||||
self.retranslateUi()
|
||||
@ -145,27 +146,3 @@ class OpenLPWizard(QtGui.QWizard):
|
||||
self.finishButton.setVisible(True)
|
||||
self.cancelButton.setVisible(False)
|
||||
Receiver.send_message(u'openlp_process_events')
|
||||
|
||||
def addWelcomePage(parent, image):
|
||||
"""
|
||||
Generate an opening welcome page for a wizard using a provided image.
|
||||
|
||||
``image``
|
||||
A splash image for the wizard.
|
||||
"""
|
||||
parent.welcomePage = QtGui.QWizardPage()
|
||||
parent.welcomePage.setPixmap(QtGui.QWizard.WatermarkPixmap,
|
||||
QtGui.QPixmap(image))
|
||||
parent.welcomePage.setObjectName(u'WelcomePage')
|
||||
parent.welcomeLayout = QtGui.QVBoxLayout(parent.welcomePage)
|
||||
parent.welcomeLayout.setObjectName(u'WelcomeLayout')
|
||||
parent.titleLabel = QtGui.QLabel(parent.welcomePage)
|
||||
parent.titleLabel.setObjectName(u'TitleLabel')
|
||||
parent.welcomeLayout.addWidget(parent.titleLabel)
|
||||
parent.welcomeLayout.addSpacing(40)
|
||||
parent.informationLabel = QtGui.QLabel(parent.welcomePage)
|
||||
parent.informationLabel.setWordWrap(True)
|
||||
parent.informationLabel.setObjectName(u'InformationLabel')
|
||||
parent.welcomeLayout.addWidget(parent.informationLabel)
|
||||
parent.welcomeLayout.addStretch()
|
||||
parent.addPage(parent.welcomePage)
|
||||
|
Loading…
Reference in New Issue
Block a user