From 8f2da0e6773370e92f32fc6886fe94294b0f4ae2 Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Wed, 29 Oct 2008 19:40:28 +0000 Subject: [PATCH] Added the About dialog in! bzr-revno: 49 --- openlp.org 2.0.e4p | 24 +++++--------- openlp.org 2.0.e4q | 2 +- openlp.org 2.0.e4t | 2 +- openlp/ui/__init__.py | 1 - openlp/ui/forms/__init__.py | 2 ++ openlp/ui/forms/about.py | 62 ++++++++++++++++++++--------------- openlp/ui/forms/mainwindow.py | 7 ++++ 7 files changed, 56 insertions(+), 44 deletions(-) diff --git a/openlp.org 2.0.e4p b/openlp.org 2.0.e4p index 2fc330f8c..514207f0d 100644 --- a/openlp.org 2.0.e4p +++ b/openlp.org 2.0.e4p @@ -1,7 +1,7 @@ - + Python @@ -67,24 +67,12 @@ ui __init__.py - - openlp - ui - forms - Ui_mainwindow.py - openlp ui forms __init__.py - - openlp - ui - forms - Ui_about.py - openlp __init__.py @@ -141,9 +129,15 @@ openlp - resources + ui forms - Ui_about.py + about.py + + + openlp + ui + forms + mainwindow.py diff --git a/openlp.org 2.0.e4q b/openlp.org 2.0.e4q index cd634305f..40fdb4b7a 100644 --- a/openlp.org 2.0.e4q +++ b/openlp.org 2.0.e4q @@ -1,7 +1,7 @@ - + \ No newline at end of file diff --git a/openlp.org 2.0.e4t b/openlp.org 2.0.e4t index 384fa8f77..c4cb78254 100644 --- a/openlp.org 2.0.e4t +++ b/openlp.org 2.0.e4t @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/openlp/ui/__init__.py b/openlp/ui/__init__.py index 6635407f1..b16ed4f5a 100644 --- a/openlp/ui/__init__.py +++ b/openlp/ui/__init__.py @@ -15,4 +15,3 @@ 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 """ - diff --git a/openlp/ui/forms/__init__.py b/openlp/ui/forms/__init__.py index 4c81ec29e..0f00669f8 100644 --- a/openlp/ui/forms/__init__.py +++ b/openlp/ui/forms/__init__.py @@ -18,3 +18,5 @@ Place, Suite 330, Boston, MA 02111-1307 USA from mainwindow import MainWindow from about import AboutForm + +__all__ = ['MainWindow', 'AboutForm'] diff --git a/openlp/ui/forms/about.py b/openlp/ui/forms/about.py index 6d5b1690a..1816f9bf7 100644 --- a/openlp/ui/forms/about.py +++ b/openlp/ui/forms/about.py @@ -11,17 +11,21 @@ from PyQt4 import QtCore, QtGui from openlp.resources import * class AboutForm(object): - def setupUi(self, AboutDialog): - AboutDialog.setObjectName("AboutDialog") - AboutDialog.resize(470, 481) + def __init__(self): + self.about_form = QtGui.QDialog() + self.setupUi() + + def setupUi(self): + self.about_form.setObjectName("about_form") + self.about_form.resize(470, 481) icon = QtGui.QIcon() icon.addPixmap(QtGui.QPixmap(":/Logo/favicon.ico"), QtGui.QIcon.Normal, QtGui.QIcon.Off) - AboutDialog.setWindowIcon(icon) - self.AboutDialogLayout = QtGui.QVBoxLayout(AboutDialog) + self.about_form.setWindowIcon(icon) + self.AboutDialogLayout = QtGui.QVBoxLayout(self.about_form) self.AboutDialogLayout.setSpacing(8) self.AboutDialogLayout.setMargin(8) self.AboutDialogLayout.setObjectName("AboutDialogLayout") - self.Logo = QtGui.QLabel(AboutDialog) + self.Logo = QtGui.QLabel(self.about_form) self.Logo.setAutoFillBackground(True) self.Logo.setStyleSheet("background-color: rgb(255, 255, 255);") self.Logo.setFrameShape(QtGui.QFrame.WinPanel) @@ -32,7 +36,7 @@ class AboutForm(object): self.Logo.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter) self.Logo.setObjectName("Logo") self.AboutDialogLayout.addWidget(self.Logo) - self.AboutNotebook = QtGui.QTabWidget(AboutDialog) + self.AboutNotebook = QtGui.QTabWidget(self.about_form) self.AboutNotebook.setObjectName("AboutNotebook") self.LicenseTab = QtGui.QWidget() self.LicenseTab.setObjectName("LicenseTab") @@ -112,7 +116,7 @@ class AboutForm(object): self.CreditsTabLayout.addWidget(self.CreditsScrollArea) self.AboutNotebook.addTab(self.CreditsTab, "") self.AboutDialogLayout.addWidget(self.AboutNotebook) - self.ButtonWidget = QtGui.QWidget(AboutDialog) + self.ButtonWidget = QtGui.QWidget(self.about_form) self.ButtonWidget.setObjectName("ButtonWidget") self.ButtonWidgetLayout = QtGui.QHBoxLayout(self.ButtonWidget) self.ButtonWidgetLayout.setSpacing(8) @@ -127,24 +131,24 @@ class AboutForm(object): self.CloseButton.setObjectName("CloseButton") self.ButtonWidgetLayout.addWidget(self.CloseButton) self.AboutDialogLayout.addWidget(self.ButtonWidget) - self.extContributeItem = QtGui.QAction(AboutDialog) + self.extContributeItem = QtGui.QAction(self.about_form) self.extContributeItem.setObjectName("extContributeItem") - self.retranslateUi(AboutDialog) + self.retranslateUi() self.AboutNotebook.setCurrentIndex(0) - QtCore.QObject.connect(self.CloseButton, QtCore.SIGNAL("clicked()"), AboutDialog.close) - QtCore.QMetaObject.connectSlotsByName(AboutDialog) - AboutDialog.setTabOrder(self.CreditsScrollArea, self.ContributeButton) + QtCore.QObject.connect(self.CloseButton, QtCore.SIGNAL("clicked()"), self.about_form.close) + QtCore.QMetaObject.connectSlotsByName(self.about_form) + self.about_form.setTabOrder(self.CreditsScrollArea, self.ContributeButton) - def retranslateUi(self, AboutDialog): - AboutDialog.setWindowTitle(QtGui.QApplication.translate("AboutDialog", "About openlp.org", None, QtGui.QApplication.UnicodeUTF8)) - self.CopyrightLabel.setText(QtGui.QApplication.translate("AboutDialog", "Copyright © 2004-2008 openlp.org Foundation", None, QtGui.QApplication.UnicodeUTF8)) - self.AboutAuthors.setText(QtGui.QApplication.translate("AboutDialog", "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.", None, QtGui.QApplication.UnicodeUTF8)) - self.License1Label.setText(QtGui.QApplication.translate("AboutDialog", "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.", None, QtGui.QApplication.UnicodeUTF8)) - self.License2Label.setText(QtGui.QApplication.translate("AboutDialog", "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.", None, QtGui.QApplication.UnicodeUTF8)) - self.License3Label.setText(QtGui.QApplication.translate("AboutDialog", "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.", None, QtGui.QApplication.UnicodeUTF8)) - self.AboutNotebook.setTabText(self.AboutNotebook.indexOf(self.LicenseTab), QtGui.QApplication.translate("AboutDialog", "License", None, QtGui.QApplication.UnicodeUTF8)) - self.CreditsLabel.setText(QtGui.QApplication.translate("AboutDialog", "\n" + def retranslateUi(self): + self.about_form.setWindowTitle(QtGui.QApplication.translate("about_form", "About openlp.org", None, QtGui.QApplication.UnicodeUTF8)) + self.CopyrightLabel.setText(QtGui.QApplication.translate("about_form", "Copyright © 2004-2008 openlp.org Foundation", None, QtGui.QApplication.UnicodeUTF8)) + self.AboutAuthors.setText(QtGui.QApplication.translate("about_form", "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.", None, QtGui.QApplication.UnicodeUTF8)) + self.License1Label.setText(QtGui.QApplication.translate("about_form", "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.", None, QtGui.QApplication.UnicodeUTF8)) + self.License2Label.setText(QtGui.QApplication.translate("about_form", "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.", None, QtGui.QApplication.UnicodeUTF8)) + self.License3Label.setText(QtGui.QApplication.translate("about_form", "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.", None, QtGui.QApplication.UnicodeUTF8)) + self.AboutNotebook.setTabText(self.AboutNotebook.indexOf(self.LicenseTab), QtGui.QApplication.translate("about_form", "License", None, QtGui.QApplication.UnicodeUTF8)) + self.CreditsLabel.setText(QtGui.QApplication.translate("about_form", "\n" "\n" @@ -201,7 +205,13 @@ class AboutForm(object): "

on the cross, setting us free from sin. We

\n" "

bring this software to you for free because

\n" "

He has set us free.

", None, QtGui.QApplication.UnicodeUTF8)) - self.AboutNotebook.setTabText(self.AboutNotebook.indexOf(self.CreditsTab), QtGui.QApplication.translate("AboutDialog", "Credits", None, QtGui.QApplication.UnicodeUTF8)) - self.ContributeButton.setText(QtGui.QApplication.translate("AboutDialog", "Contribute", None, QtGui.QApplication.UnicodeUTF8)) - self.CloseButton.setText(QtGui.QApplication.translate("AboutDialog", "Close", None, QtGui.QApplication.UnicodeUTF8)) - self.extContributeItem.setText(QtGui.QApplication.translate("AboutDialog", "&Contribute", None, QtGui.QApplication.UnicodeUTF8)) + self.AboutNotebook.setTabText(self.AboutNotebook.indexOf(self.CreditsTab), QtGui.QApplication.translate("about_form", "Credits", None, QtGui.QApplication.UnicodeUTF8)) + self.ContributeButton.setText(QtGui.QApplication.translate("about_form", "Contribute", None, QtGui.QApplication.UnicodeUTF8)) + self.CloseButton.setText(QtGui.QApplication.translate("about_form", "Close", None, QtGui.QApplication.UnicodeUTF8)) + self.extContributeItem.setText(QtGui.QApplication.translate("about_form", "&Contribute", None, QtGui.QApplication.UnicodeUTF8)) + + def show(self): + screen = QtGui.QDesktopWidget().screenGeometry() + size = self.about_form.geometry() + self.about_form.move((screen.width() - size.width()) / 2, (screen.height() - size.height()) / 2) + self.about_form.show() diff --git a/openlp/ui/forms/mainwindow.py b/openlp/ui/forms/mainwindow.py index c2970778e..489c12883 100644 --- a/openlp/ui/forms/mainwindow.py +++ b/openlp/ui/forms/mainwindow.py @@ -27,11 +27,13 @@ Place, Suite 330, Boston, MA 02111-1307 USA from PyQt4 import QtCore, QtGui from openlp.resources import * +from openlp.ui.forms.about import AboutForm class MainWindow(object): def __init__(self): self.main_window = QtGui.QMainWindow() self.setupUi() + self.about_form = AboutForm() def setupUi(self): self.main_window.setObjectName("main_window") @@ -860,6 +862,8 @@ class MainWindow(object): QtCore.QObject.connect(self.ThemeManagerDock, QtCore.SIGNAL("visibilityChanged(bool)"), self.ViewThemeManagerItem.setChecked) QtCore.QMetaObject.connectSlotsByName(self.main_window) + QtCore.QObject.connect(self.HelpAboutItem, QtCore.SIGNAL("triggered()"), self.onHelpAboutItemClicked) + def retranslateUi(self): self.main_window.setWindowTitle(QtGui.QApplication.translate("main_window", "openlp.org 2.0", None, QtGui.QApplication.UnicodeUTF8)) self.FileMenu.setTitle(QtGui.QApplication.translate("main_window", "&File", None, QtGui.QApplication.UnicodeUTF8)) @@ -1005,3 +1009,6 @@ class MainWindow(object): def show(self): self.main_window.showMaximized() + + def onHelpAboutItemClicked(self): + self.about_form.show()