2008-11-28 14:05:41 +00:00
# -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
2009-09-08 19:58:05 +00:00
###############################################################################
# OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- #
# Copyright (c) 2008-2009 Raoul Snyman #
# Portions copyright (c) 2008-2009 Martin Thompson, Tim Bentley, Carsten #
# Tinggaard, Jon Tibble, Jonathan Corwin, Maikel Stuivenberg, Scott Guerrieri #
# --------------------------------------------------------------------------- #
# 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 #
###############################################################################
2008-11-28 14:05:41 +00:00
from PyQt4 import QtCore , QtGui
2009-09-29 02:54:32 +00:00
from openlp . core . lib import translate , buildIcon
2008-11-28 14:05:41 +00:00
2009-05-20 20:17:20 +00:00
class AboutForm ( QtGui . QDialog ) :
2009-06-02 19:02:12 +00:00
"""
The About dialog
"""
2008-11-28 14:05:41 +00:00
2009-03-01 09:13:27 +00:00
def __init__ ( self , parent = None ) :
2009-06-02 19:02:12 +00:00
"""
Do some initialisation stuff
"""
2009-05-20 20:17:20 +00:00
QtGui . QDialog . __init__ ( self , parent )
2009-03-01 09:13:27 +00:00
self . setupUi ( self )
2008-11-28 14:05:41 +00:00
2009-03-01 09:13:27 +00:00
def setupUi ( self , AboutForm ) :
2009-06-02 19:02:12 +00:00
"""
Set up user interface
"""
2009-05-22 18:30:25 +00:00
AboutForm . setObjectName ( u ' AboutForm ' )
2009-03-01 09:13:27 +00:00
AboutForm . resize ( 470 , 481 )
2009-09-29 02:54:32 +00:00
icon = buildIcon ( u ' :/icon/openlp-logo-16x16.png ' )
2009-03-01 09:13:27 +00:00
AboutForm . setWindowIcon ( icon )
AboutFormLayout = QtGui . QVBoxLayout ( AboutForm )
AboutFormLayout . setSpacing ( 8 )
AboutFormLayout . setMargin ( 8 )
2009-05-22 18:30:25 +00:00
AboutFormLayout . setObjectName ( u ' AboutDialogLayout ' )
2009-03-01 09:13:27 +00:00
self . Logo = QtGui . QLabel ( AboutForm )
2008-11-28 14:05:41 +00:00
self . Logo . setAutoFillBackground ( False )
2009-05-22 18:30:25 +00:00
self . Logo . setStyleSheet ( u ' background-color: rgb(255, 255, 255); ' )
2009-06-02 19:02:12 +00:00
self . Logo . setLineWidth ( 0 )
2009-05-22 18:30:25 +00:00
self . Logo . setPixmap ( QtGui . QPixmap ( u ' :/graphics/openlp-about-logo.png ' ) )
2008-11-28 14:05:41 +00:00
self . Logo . setScaledContents ( False )
2009-06-02 19:02:12 +00:00
self . Logo . setAlignment ( QtCore . Qt . AlignCenter )
2009-05-22 18:30:25 +00:00
self . Logo . setObjectName ( u ' Logo ' )
2009-03-01 09:13:27 +00:00
AboutFormLayout . addWidget ( self . Logo )
self . AboutNotebook = QtGui . QTabWidget ( AboutForm )
2009-05-22 18:30:25 +00:00
self . AboutNotebook . setObjectName ( u ' AboutNotebook ' )
2008-11-28 14:05:41 +00:00
self . LicenseTab = QtGui . QWidget ( )
2009-05-22 18:30:25 +00:00
self . LicenseTab . setObjectName ( u ' LicenseTab ' )
2008-11-28 14:05:41 +00:00
self . LicenseTabLayout = QtGui . QVBoxLayout ( self . LicenseTab )
self . LicenseTabLayout . setSpacing ( 8 )
self . LicenseTabLayout . setMargin ( 8 )
2009-05-22 18:30:25 +00:00
self . LicenseTabLayout . setObjectName ( u ' LicenseTabLayout ' )
2008-11-28 14:05:41 +00:00
self . CopyrightLabel = QtGui . QLabel ( self . LicenseTab )
2009-05-22 18:30:25 +00:00
self . CopyrightLabel . setObjectName ( u ' CopyrightLabel ' )
2008-11-28 14:05:41 +00:00
self . LicenseTabLayout . addWidget ( self . CopyrightLabel )
self . AboutAuthors = QtGui . QLabel ( self . LicenseTab )
2009-06-02 19:02:12 +00:00
self . AboutAuthors . setAlignment (
QtCore . Qt . AlignJustify | QtCore . Qt . AlignVCenter )
2008-11-28 14:05:41 +00:00
self . AboutAuthors . setWordWrap ( True )
2009-05-22 18:30:25 +00:00
self . AboutAuthors . setObjectName ( u ' AboutAuthors ' )
2008-11-28 14:05:41 +00:00
self . LicenseTabLayout . addWidget ( self . AboutAuthors )
self . License1Label = QtGui . QLabel ( self . LicenseTab )
2009-06-02 19:02:12 +00:00
self . License1Label . setAlignment (
QtCore . Qt . AlignJustify | QtCore . Qt . AlignVCenter )
2008-11-28 14:05:41 +00:00
self . License1Label . setWordWrap ( True )
2009-05-22 18:30:25 +00:00
self . License1Label . setObjectName ( u ' License1Label ' )
2008-11-28 14:05:41 +00:00
self . LicenseTabLayout . addWidget ( self . License1Label )
self . License2Label = QtGui . QLabel ( self . LicenseTab )
2009-06-02 19:02:12 +00:00
self . License2Label . setAlignment (
QtCore . Qt . AlignJustify | QtCore . Qt . AlignVCenter )
2008-11-28 14:05:41 +00:00
self . License2Label . setWordWrap ( True )
2009-05-22 18:30:25 +00:00
self . License2Label . setObjectName ( u ' License2Label ' )
2008-11-28 14:05:41 +00:00
self . LicenseTabLayout . addWidget ( self . License2Label )
self . License3Label = QtGui . QLabel ( self . LicenseTab )
2009-06-02 19:02:12 +00:00
self . License3Label . setAlignment (
QtCore . Qt . AlignJustify | QtCore . Qt . AlignVCenter )
2008-11-28 14:05:41 +00:00
self . License3Label . setWordWrap ( True )
2009-05-22 18:30:25 +00:00
self . License3Label . setObjectName ( u ' License3Label ' )
2008-11-28 14:05:41 +00:00
self . LicenseTabLayout . addWidget ( self . License3Label )
2009-05-22 18:30:25 +00:00
self . AboutNotebook . addTab ( self . LicenseTab , u ' License ' )
2008-11-28 14:05:41 +00:00
self . CreditsTab = QtGui . QWidget ( )
2009-05-22 18:30:25 +00:00
self . CreditsTab . setObjectName ( u ' CreditsTab ' )
2008-11-28 14:05:41 +00:00
self . CreditsTabLayout = QtGui . QVBoxLayout ( self . CreditsTab )
2009-06-02 19:02:12 +00:00
self . CreditsTabLayout . setSpacing ( 0 )
self . CreditsTabLayout . setMargin ( 8 )
2009-05-22 18:30:25 +00:00
self . CreditsTabLayout . setObjectName ( u ' CreditsTabLayout ' )
2008-12-14 19:50:17 +00:00
self . CreditsTextEdit = QtGui . QTextEdit ( self . CreditsTab )
2008-12-03 19:13:23 +00:00
self . CreditsTextEdit . setReadOnly ( True )
2009-05-22 18:30:25 +00:00
self . CreditsTextEdit . setObjectName ( u ' CreditsTextEdit ' )
2008-12-03 19:13:23 +00:00
self . CreditsTabLayout . addWidget ( self . CreditsTextEdit )
2009-05-22 18:30:25 +00:00
self . AboutNotebook . addTab ( self . CreditsTab , u ' Credits ' )
2009-03-01 09:13:27 +00:00
AboutFormLayout . addWidget ( self . AboutNotebook )
self . ButtonWidget = QtGui . QWidget ( AboutForm )
2009-05-22 18:30:25 +00:00
self . ButtonWidget . setObjectName ( u ' ButtonWidget ' )
2008-11-28 14:05:41 +00:00
self . ButtonWidgetLayout = QtGui . QHBoxLayout ( self . ButtonWidget )
self . ButtonWidgetLayout . setSpacing ( 8 )
self . ButtonWidgetLayout . setMargin ( 0 )
2009-05-22 18:30:25 +00:00
self . ButtonWidgetLayout . setObjectName ( u ' ButtonWidgetLayout ' )
2009-06-02 19:02:12 +00:00
spacerItem = QtGui . QSpacerItem ( 275 , 20 , QtGui . QSizePolicy . Expanding ,
QtGui . QSizePolicy . Minimum )
2008-11-28 14:05:41 +00:00
self . ButtonWidgetLayout . addItem ( spacerItem )
self . ContributeButton = QtGui . QPushButton ( self . ButtonWidget )
2009-05-22 18:30:25 +00:00
self . ContributeButton . setObjectName ( u ' ContributeButton ' )
2008-11-28 14:05:41 +00:00
self . ButtonWidgetLayout . addWidget ( self . ContributeButton )
self . CloseButton = QtGui . QPushButton ( self . ButtonWidget )
2009-05-22 18:30:25 +00:00
self . CloseButton . setObjectName ( u ' CloseButton ' )
2008-11-28 14:05:41 +00:00
self . ButtonWidgetLayout . addWidget ( self . CloseButton )
2009-03-01 09:13:27 +00:00
AboutFormLayout . addWidget ( self . ButtonWidget )
self . extContributeItem = QtGui . QAction ( AboutForm )
2009-05-22 18:30:25 +00:00
self . extContributeItem . setObjectName ( u ' extContributeItem ' )
2009-06-02 19:02:12 +00:00
# Do translation
2009-03-01 09:13:27 +00:00
self . retranslateUi ( AboutForm )
2008-12-02 20:09:08 +00:00
self . AboutNotebook . setCurrentIndex ( 0 )
2009-06-02 19:02:12 +00:00
QtCore . QObject . connect ( self . CloseButton , QtCore . SIGNAL ( u ' clicked() ' ) ,
AboutForm . close )
QtCore . QObject . connect ( self . ContributeButton ,
QtCore . SIGNAL ( u ' clicked() ' ) , self . onContributeButtonClicked )
2009-03-01 09:13:27 +00:00
QtCore . QMetaObject . connectSlotsByName ( AboutForm )
2008-11-28 14:05:41 +00:00
2009-03-01 09:13:27 +00:00
def retranslateUi ( self , AboutForm ) :
2009-06-02 19:02:12 +00:00
"""
Set up translation
"""
AboutForm . setWindowTitle ( translate ( u ' AboutDialog ' , u ' About openlp.org ' ) )
self . CopyrightLabel . setText ( translate ( u ' AboutDialog ' ,
u ' Copyright (c) 2004-2009 openlp.org Foundation ' ) )
self . AboutAuthors . setText ( translate ( u ' AboutDialog ' ,
u ' openlp.org is written and maintained by volunteers. If you would like to see more free Christian software being written, please consider contributing by using the button below. ' ) )
self . License1Label . setText ( translate ( u ' AboutDialog ' ,
u ' 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 2 of the License, or (at your option) any later version. ' ) )
self . License2Label . setText ( translate ( u ' AboutDialog ' ,
u ' 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. ' ) )
self . License3Label . setText ( translate ( u ' AboutDialog ' ,
u ' 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. ' ) )
self . AboutNotebook . setTabText (
self . AboutNotebook . indexOf ( self . LicenseTab ) ,
translate ( u ' AboutDialog ' , u ' License ' ) )
2009-05-22 18:30:25 +00:00
self . CreditsTextEdit . setPlainText ( translate ( u ' AboutDialog ' ,
2009-06-02 19:02:12 +00:00
u ' Project Lead \n '
u ' Raoul \" superfly \" Snyman \n '
u ' \n '
u ' Developers \n '
u ' Tim \" TRB143 \" Bentley \n '
u ' Jonathan \" gushie \" Corwin \n '
u ' Scott \" sguerrieri \" Guerrieri \n '
u ' Raoul \" superfly \" Snyman \n '
u ' Martin \" mijiti \" Thompson \n '
2009-09-29 17:18:18 +00:00
u ' Jon \" Meths \" Tibble \n '
2009-06-02 19:02:12 +00:00
u ' Carsten \" catini \" Tingaard ' ) )
self . AboutNotebook . setTabText (
self . AboutNotebook . indexOf ( self . CreditsTab ) ,
translate ( u ' AboutDialog ' , u ' Credits ' ) )
2009-05-22 18:30:25 +00:00
self . ContributeButton . setText ( translate ( u ' AboutDialog ' , u ' Contribute ' ) )
self . CloseButton . setText ( translate ( u ' AboutDialog ' , u ' Close ' ) )
self . extContributeItem . setText ( translate ( u ' AboutDialog ' , u ' &Contribute ' ) )
2008-11-28 14:05:41 +00:00
def onContributeButtonClicked ( self ) :
2009-06-02 19:02:12 +00:00
"""
Launch a web browser and go to the contribute page on the site .
"""
2008-11-28 14:05:41 +00:00
import webbrowser
url = " http://www.openlp.org/en/documentation/introduction/contributing.html "
webbrowser . open_new ( url )