diff --git a/openlp.pyw b/openlp.pyw index 920908b61..39719a80e 100755 --- a/openlp.pyw +++ b/openlp.pyw @@ -36,6 +36,8 @@ from PyQt4 import QtCore, QtGui from openlp.core.lib import Receiver, check_directory_exists from openlp.core.resources import qInitResources from openlp.core.ui.mainwindow import MainWindow +from openlp.core.ui.firsttimelanguageform import FirstTimeLanguageForm +from openlp.core.ui.firsttimeform import FirstTimeForm from openlp.core.ui.exceptionform import ExceptionForm from openlp.core.ui import SplashScreen, ScreenList from openlp.core.utils import AppLocation, LanguageManager, VersionThread @@ -165,6 +167,13 @@ class OpenLP(QtGui.QApplication): self.setOrganizationDomain(u'openlp.org') self.setApplicationName(u'OpenLP') self.setApplicationVersion(app_version[u'version']) + # Decide how many screens we have and their size + screens = ScreenList(self.desktop()) + # First time checks in settings + firstTime = QtCore.QSettings().value( + u'general/first time', QtCore.QVariant(True)).toBool() + if firstTime: + FirstTimeForm(screens).exec_() if os.name == u'nt': self.setStyleSheet(application_stylesheet) show_splash = QtCore.QSettings().value( @@ -174,11 +183,10 @@ class OpenLP(QtGui.QApplication): self.splash.show() # make sure Qt really display the splash screen self.processEvents() - # Decide how many screens we have and their size - screens = ScreenList(self.desktop()) # start the main app window self.appClipboard = self.clipboard() - self.mainWindow = MainWindow(screens, app_version, self.appClipboard) + self.mainWindow = MainWindow(screens, app_version, self.appClipboard, + firstTime) self.mainWindow.show() if show_splash: # now kill the splashscreen @@ -262,10 +270,19 @@ def main(): qInitResources() # Now create and actually run the application. app = OpenLP(qt_args) - if sys.platform == 'darwin': + # Define the settings environment + QtCore.QSettings(u'OpenLP', u'OpenLP') + # First time checks in settings + # Use explicit reference as not inside a QT environment yet + if QtCore.QSettings(u'OpenLP', u'OpenLP').value( + u'general/first time', QtCore.QVariant(True)).toBool(): + if not FirstTimeLanguageForm().exec_(): + # if cancel then stop processing + sys.exit() + if sys.platform == u'darwin': OpenLP.addLibraryPath(QtGui.QApplication.applicationDirPath() + "/qt4_plugins") - #i18n Set Language + # i18n Set Language language = LanguageManager.get_language() appTranslator = LanguageManager.get_translator(language) app.installTranslator(appTranslator) diff --git a/openlp/core/ui/__init__.py b/openlp/core/ui/__init__.py index 158f7f0cd..485d2adda 100644 --- a/openlp/core/ui/__init__.py +++ b/openlp/core/ui/__init__.py @@ -51,6 +51,8 @@ class HideMode(object): Theme = 2 Screen = 3 +from firsttimeform import FirstTimeForm +from firsttimelanguageform import FirstTimeLanguageForm from themeform import ThemeForm from filerenameform import FileRenameForm from starttimeform import StartTimeForm @@ -74,4 +76,4 @@ from thememanager import ThemeManager __all__ = ['SplashScreen', 'AboutForm', 'SettingsForm', 'MainDisplay', 'SlideController', 'ServiceManager', 'ThemeManager', 'MediaDockManager', - 'ServiceItemEditForm'] + 'ServiceItemEditForm', u'FirstTimeForm'] diff --git a/openlp/core/ui/firsttimeform.py b/openlp/core/ui/firsttimeform.py new file mode 100644 index 000000000..88cd7a5cc --- /dev/null +++ b/openlp/core/ui/firsttimeform.py @@ -0,0 +1,217 @@ +# -*- 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, Armin Köhler, 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 # +############################################################################### + +import ConfigParser +import io +import logging +import os +import urllib + +from PyQt4 import QtCore, QtGui + +from firsttimewizard import Ui_FirstTimeWizard + +from openlp.core.lib import translate, PluginStatus, check_directory_exists, \ + Receiver +from openlp.core.utils import get_web_page, AppLocation + +log = logging.getLogger(__name__) + +class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): + """ + This is the Theme Import Wizard, which allows easy creation and editing of + OpenLP themes. + """ + log.info(u'ThemeWizardForm loaded') + + def __init__(self, screens, parent=None): + # check to see if we have web access + self.web = u'http://openlp.org/files/frw/' + self.config = ConfigParser.ConfigParser() + self.webAccess = get_web_page(u'%s%s' % (self.web, u'download.cfg')) + if self.webAccess: + files = self.webAccess.read() + self.config.readfp(io.BytesIO(files)) + QtGui.QWizard.__init__(self, parent) + self.setupUi(self) + for screen in screens.get_screen_list(): + self.displaySelectionComboBox.addItem(screen) + self.songsText = translate('OpenLP.FirstTimeWizard', 'Songs') + self.biblesText = translate('OpenLP.FirstTimeWizard', 'Bibles') + self.themesText = translate('OpenLP.FirstTimeWizard', 'Themes') + self.startUpdates = translate('OpenLP.FirstTimeWizard', + 'Starting Updates') + self.downloading = unicode(translate('OpenLP.FirstTimeWizard', + 'Downloading %s')) + QtCore.QObject.connect(self, + QtCore.SIGNAL(u'currentIdChanged(int)'), + self.onCurrentIdChanged) + + def exec_(self, edit=False): + """ + Run the wizard. + """ + self.setDefaults() + return QtGui.QWizard.exec_(self) + + def setDefaults(self): + """ + Set up display at start of theme edit. + """ + self.restart() + # Sort out internet access for downloads + if self.webAccess: + self.internetGroupBox.setVisible(True) + self.noInternetLabel.setVisible(False) + # If songs database exists do not allow a copy + songs = os.path.join(AppLocation.get_section_data_path(u'songs'), + u'songs.sqlite') + if not os.path.exists(songs): + treewidgetitem = QtGui.QTreeWidgetItem(self.selectionTreeWidget) + treewidgetitem.setText(0, self.songsText) + self._loadChild(treewidgetitem, u'songs', u'languages', u'songs') + treewidgetitem = QtGui.QTreeWidgetItem(self.selectionTreeWidget) + treewidgetitem.setText(0, self.biblesText) + self._loadChild(treewidgetitem, u'bibles', u'translations', + u'bible') + treewidgetitem = QtGui.QTreeWidgetItem(self.selectionTreeWidget) + treewidgetitem.setText(0, self.themesText) + self._loadChild(treewidgetitem, u'themes', u'files', 'theme') + else: + self.internetGroupBox.setVisible(False) + self.noInternetLabel.setVisible(True) + + def _loadChild(self, tree, list, tag, root): + files = self.config.get(list, tag) + files = files.split(u',') + for file in files: + if file: + child = QtGui.QTreeWidgetItem(tree) + child.setText(0, self.config.get(u'%s_%s' + % (root, file), u'title')) + child.setData(0, QtCore.Qt.UserRole, + QtCore.QVariant(self.config.get(u'%s_%s' + % (root, file), u'filename'))) + child.setCheckState(0, QtCore.Qt.Unchecked) + child.setFlags(QtCore.Qt.ItemIsUserCheckable | + QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled) + + def onCurrentIdChanged(self, pageId): + """ + Detects Page changes and updates as approprate. + """ + if self.page(pageId) == self.DefaultsPage: + self.themeSelectionComboBox.clear() + listIterator = QtGui.QTreeWidgetItemIterator( + self.selectionTreeWidget) + while listIterator.value(): + parent = listIterator.value().parent() + if parent and listIterator.value().checkState(0) \ + == QtCore.Qt.Checked: + if unicode(parent.text(0)) == self.themesText: + self.themeSelectionComboBox.addItem( + listIterator.value().text(0)) + listIterator += 1 + + def accept(self): + Receiver.send_message(u'cursor_busy') + self._updateMessage(self.startUpdates) + # Set up the Plugin status's + self._pluginStatus(self.songsCheckBox, u'songs/status') + self._pluginStatus(self.bibleCheckBox, u'bibles/status') + self._pluginStatus(self.presentationCheckBox, u'presentations/status') + self._pluginStatus(self.imageCheckBox, u'images/status') + self._pluginStatus(self.mediaCheckBox, u'media/status') + self._pluginStatus(self.remoteCheckBox, u'remotes/status') + self._pluginStatus(self.customCheckBox, u'custom/status') + self._pluginStatus(self.songUsageCheckBox, u'songusage/status') + self._pluginStatus(self.alertCheckBox, u'alerts/status') + # Build directories for downloads + songsDestination = AppLocation.get_section_data_path(u'songs') + check_directory_exists(songsDestination) + bibleDestination = AppLocation.get_section_data_path(u'bibles') + check_directory_exists(bibleDestination) + themeDestination = AppLocation.get_section_data_path(u'themes') + check_directory_exists(themeDestination) + # Install Selected Items looping through them + listIterator = QtGui.QTreeWidgetItemIterator(self.selectionTreeWidget) + while listIterator.value(): + type = listIterator.value().parent() + if listIterator.value().parent(): + if listIterator.value().checkState(0) == QtCore.Qt.Checked: + # Install items as theu have been selected + item = unicode(listIterator.value().text(0)) + # Download Song database if selected + if unicode(type.text(0)) == self.songsText: + songs = unicode(listIterator.value().data(0, + QtCore.Qt.UserRole).toString()) + message = self.downloading % item + self._updateMessage(message) + # Song database is a fixed file name + urllib.urlretrieve(u'%s%s' % (self.web, songs), + os.path.join(songsDestination, u'songs.sqlite')) + # Download and selected Bibles + if unicode(type.text(0)) == self.biblesText: + bible = unicode(listIterator.value().data(0, + QtCore.Qt.UserRole).toString()) + message = self.downloading % item + self._updateMessage(message) + urllib.urlretrieve(u'%s%s' % (self.web, bible), + os.path.join(bibleDestination, bible)) + # Download any themes + if unicode(type.text(0)) == self.themesText: + theme = unicode(listIterator.value().data(0, + QtCore.Qt.UserRole).toString()) + message = self.downloading % item + self._updateMessage(message) + urllib.urlretrieve(u'%s%s' % (self.web, theme), + os.path.join(themeDestination, theme)) + listIterator += 1 + # Set Default Display + if self.displaySelectionComboBox.currentIndex() != -1: + QtCore.QSettings().setValue(u'General/monitor', + QtCore.QVariant(self.displaySelectionComboBox. + currentIndex())) + # Set Global Theme + if self.themeSelectionComboBox.currentIndex() != -1: + QtCore.QSettings().setValue(u'themes/global theme', + QtCore.QVariant(self.themeSelectionComboBox.currentText())) + QtCore.QSettings().setValue(u'general/first time', + QtCore.QVariant(False)) + Receiver.send_message(u'cursor_normal') + return QtGui.QWizard.accept(self) + + def _pluginStatus(self, field, tag): + status = PluginStatus.Active if field.checkState() \ + == QtCore.Qt.Checked else PluginStatus.Inactive + QtCore.QSettings().setValue(tag, QtCore.QVariant(status)) + + def _updateMessage(self, text): + """ + Keep screen up to date + """ + self.updateLabel.setText(text) + Receiver.send_message(u'openlp_process_events') diff --git a/openlp/core/ui/firsttimelanguagedialog.py b/openlp/core/ui/firsttimelanguagedialog.py new file mode 100644 index 000000000..fbf817939 --- /dev/null +++ b/openlp/core/ui/firsttimelanguagedialog.py @@ -0,0 +1,55 @@ +# -*- 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, Armin Köhler, 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 # +############################################################################### + +from PyQt4 import QtCore, QtGui + +from openlp.core.lib import translate +from openlp.core.lib.ui import create_accept_reject_button_box + +class Ui_FirstTimeLanguageDialog(object): + def setupUi(self, firstTimeLanguageDialog): + firstTimeLanguageDialog.setObjectName(u'firstTimeLanguageDialog') + firstTimeLanguageDialog.resize(300, 10) + self.dialogLayout = QtGui.QGridLayout(firstTimeLanguageDialog) + self.dialogLayout.setObjectName(u'dialogLayout') + self.fileNameLabel = QtGui.QLabel(firstTimeLanguageDialog) + self.fileNameLabel.setObjectName(u'fileNameLabel') + self.dialogLayout.addWidget(self.fileNameLabel, 0, 0) + self.LanguageComboBox = QtGui.QComboBox(firstTimeLanguageDialog) + self.LanguageComboBox.setSizeAdjustPolicy(QtGui.QComboBox.AdjustToContents) + self.LanguageComboBox.setObjectName("LanguageComboBox") + self.dialogLayout.addWidget(self.LanguageComboBox, 0, 1) + self.buttonBox = create_accept_reject_button_box(firstTimeLanguageDialog, True) + self.dialogLayout.addWidget(self.buttonBox, 1, 0, 1, 2) + self.retranslateUi(firstTimeLanguageDialog) + self.setMaximumHeight(self.sizeHint().height()) + QtCore.QMetaObject.connectSlotsByName(firstTimeLanguageDialog) + + def retranslateUi(self, firstTimeLanguageDialog): + self.setWindowTitle(translate('OpenLP.FirstTimeLanguageForm', + 'Initial Set up Language')) + self.fileNameLabel.setText(translate('OpenLP.FirstTimeLanguageForm', + 'Initial Language:')) diff --git a/openlp/core/ui/firsttimelanguageform.py b/openlp/core/ui/firsttimelanguageform.py new file mode 100644 index 000000000..98489fde7 --- /dev/null +++ b/openlp/core/ui/firsttimelanguageform.py @@ -0,0 +1,67 @@ +# -*- 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, Armin Köhler, 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 # +############################################################################### + +from PyQt4 import QtGui + +from firsttimelanguagedialog import Ui_FirstTimeLanguageDialog + +from openlp.core.lib import translate +from openlp.core.utils import LanguageManager + +class FirstTimeLanguageForm(QtGui.QDialog, Ui_FirstTimeLanguageDialog): + """ + The exception dialog + """ + def __init__(self, parent=None): + QtGui.QDialog.__init__(self, parent) + self.setupUi(self) + self.qmList = LanguageManager.get_qm_list() + self.LanguageComboBox.addItem(u'Automatic') + for key in sorted(self.qmList.keys()): + self.LanguageComboBox.addItem(key) + + def exec_(self): + """ + Run the Dialog with correct heading. + """ + return QtGui.QDialog.exec_(self) + + def accept(self): + # It's the first row so must be Automatic + if self.LanguageComboBox.currentIndex() == 0: + LanguageManager.auto_language = True + LanguageManager.set_language(False, False) + else: + LanguageManager.auto_language = False + action = QtGui.QAction(None) + action.setObjectName(unicode(self.LanguageComboBox.currentText())) + LanguageManager.set_language(action, False) + return QtGui.QDialog.accept(self) + + def reject(self): + LanguageManager.auto_language = True + LanguageManager.set_language(False, False) + return QtGui.QDialog.reject(self) diff --git a/openlp/core/ui/firsttimewizard.py b/openlp/core/ui/firsttimewizard.py new file mode 100644 index 000000000..ee14b6b0e --- /dev/null +++ b/openlp/core/ui/firsttimewizard.py @@ -0,0 +1,227 @@ +# -*- 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, Armin Köhler, 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 # +############################################################################### + +from PyQt4 import QtCore, QtGui + +from openlp.core.lib import translate + + +class Ui_FirstTimeWizard(object): + def setupUi(self, FirstTimeWizard): + FirstTimeWizard.setObjectName(u'FirstTimeWizard') + FirstTimeWizard.resize(550, 386) + FirstTimeWizard.setModal(True) + FirstTimeWizard.setWizardStyle(QtGui.QWizard.ModernStyle) + FirstTimeWizard.setOptions(QtGui.QWizard.IndependentPages| + QtGui.QWizard.NoBackButtonOnStartPage) + self.welcomePage = QtGui.QWizardPage() + self.welcomePage.setTitle(u'') + self.welcomePage.setSubTitle(u'') + self.welcomePage.setObjectName(u'welcomePage') + self.welcomeLayout = QtGui.QHBoxLayout(self.welcomePage) + self.welcomeLayout.setSpacing(8) + self.welcomeLayout.setMargin(0) + self.welcomeLayout.setObjectName(u'welcomeLayout') + self.importBibleImage = QtGui.QLabel(self.welcomePage) + self.importBibleImage.setMinimumSize(QtCore.QSize(163, 0)) + self.importBibleImage.setMaximumSize(QtCore.QSize(163, 16777215)) + self.importBibleImage.setLineWidth(0) + self.importBibleImage.setText(u'') + self.importBibleImage.setPixmap( + QtGui.QPixmap(u':/wizards/wizard_importbible.bmp')) + self.importBibleImage.setIndent(0) + self.importBibleImage.setObjectName(u'importBibleImage') + self.welcomeLayout.addWidget(self.importBibleImage) + self.welcomePageLayout = QtGui.QVBoxLayout() + self.welcomePageLayout.setSpacing(8) + self.welcomePageLayout.setObjectName(u'welcomePageLayout') + self.titleLabel = QtGui.QLabel(self.welcomePage) + self.titleLabel.setObjectName(u'titleLabel') + self.welcomePageLayout.addWidget(self.titleLabel) + spacerItem = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, + QtGui.QSizePolicy.Fixed) + self.welcomePageLayout.addItem(spacerItem) + self.informationLabel = QtGui.QLabel(self.welcomePage) + self.informationLabel.setWordWrap(True) + self.informationLabel.setMargin(10) + self.informationLabel.setObjectName(u'informationLabel') + self.welcomePageLayout.addWidget(self.informationLabel) + spacerItem1 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, + QtGui.QSizePolicy.Expanding) + self.welcomePageLayout.addItem(spacerItem1) + self.welcomeLayout.addLayout(self.welcomePageLayout) + FirstTimeWizard.addPage(self.welcomePage) + self.PluginPagePage = QtGui.QWizardPage() + self.PluginPagePage.setObjectName(u'PluginPagePage') + self.verticalLayout_2 = QtGui.QVBoxLayout(self.PluginPagePage) + self.verticalLayout_2.setObjectName(u'verticalLayout_2') + self.verticalLayout = QtGui.QVBoxLayout() + self.verticalLayout.setObjectName(u'verticalLayout') + self.songsCheckBox = QtGui.QCheckBox(self.PluginPagePage) + self.songsCheckBox.setChecked(True) + self.songsCheckBox.setObjectName(u'songsCheckBox') + self.verticalLayout.addWidget(self.songsCheckBox) + self.customCheckBox = QtGui.QCheckBox(self.PluginPagePage) + self.customCheckBox.setChecked(True) + self.customCheckBox.setObjectName(u'customCheckBox') + self.verticalLayout.addWidget(self.customCheckBox) + self.bibleCheckBox = QtGui.QCheckBox(self.PluginPagePage) + self.bibleCheckBox.setChecked(True) + self.bibleCheckBox.setObjectName(u'bibleCheckBox') + self.verticalLayout.addWidget(self.bibleCheckBox) + self.imageCheckBox = QtGui.QCheckBox(self.PluginPagePage) + self.imageCheckBox.setChecked(True) + self.imageCheckBox.setObjectName(u'imageCheckBox') + self.verticalLayout.addWidget(self.imageCheckBox) + self.presentationCheckBox = QtGui.QCheckBox(self.PluginPagePage) + self.presentationCheckBox.setChecked(True) + self.presentationCheckBox.setObjectName(u'presentationCheckBox') + self.verticalLayout.addWidget(self.presentationCheckBox) + self.mediaCheckBox = QtGui.QCheckBox(self.PluginPagePage) + self.mediaCheckBox.setChecked(True) + self.mediaCheckBox.setObjectName(u'mediaCheckBox') + self.verticalLayout.addWidget(self.mediaCheckBox) + self.remoteCheckBox = QtGui.QCheckBox(self.PluginPagePage) + self.remoteCheckBox.setObjectName(u'remoteCheckBox') + self.verticalLayout.addWidget(self.remoteCheckBox) + self.songUsageCheckBox = QtGui.QCheckBox(self.PluginPagePage) + self.songUsageCheckBox.setChecked(True) + self.songUsageCheckBox.setObjectName(u'songUsageCheckBox') + self.verticalLayout.addWidget(self.songUsageCheckBox) + self.alertCheckBox = QtGui.QCheckBox(self.PluginPagePage) + self.alertCheckBox.setChecked(True) + self.alertCheckBox.setObjectName(u'alertCheckBox') + self.verticalLayout.addWidget(self.alertCheckBox) + self.verticalLayout_2.addLayout(self.verticalLayout) + FirstTimeWizard.addPage(self.PluginPagePage) + self.downloadDefaultsPage = QtGui.QWizardPage() + self.downloadDefaultsPage.setObjectName(u'downloadDefaultsPage') + self.noInternetLabel = QtGui.QLabel(self.downloadDefaultsPage) + self.noInternetLabel.setGeometry(QtCore.QRect(20, 20, 461, 17)) + self.noInternetLabel.setObjectName(u'noInternetLabel') + self.internetGroupBox = QtGui.QGroupBox(self.downloadDefaultsPage) + self.internetGroupBox.setGeometry(QtCore.QRect(20, 10, 501, 271)) + self.internetGroupBox.setObjectName(u'internetGroupBox') + self.verticalLayout_4 = QtGui.QVBoxLayout(self.internetGroupBox) + self.verticalLayout_4.setObjectName(u'verticalLayout_4') + self.selectionTreeWidget = QtGui.QTreeWidget(self.internetGroupBox) + self.selectionTreeWidget.setHorizontalScrollBarPolicy( + QtCore.Qt.ScrollBarAlwaysOff) + self.selectionTreeWidget.setProperty(u'showDropIndicator', False) + self.selectionTreeWidget.setAlternatingRowColors(True) + self.selectionTreeWidget.setObjectName(u'selectionTreeWidget') + self.selectionTreeWidget.headerItem().setText(0, u'1') + self.selectionTreeWidget.header().setVisible(False) + self.verticalLayout_4.addWidget(self.selectionTreeWidget) + FirstTimeWizard.addPage(self.downloadDefaultsPage) + self.DefaultsPage = QtGui.QWizardPage() + self.DefaultsPage.setObjectName(u'DefaultsPage') + self.layoutWidget = QtGui.QWidget(self.DefaultsPage) + self.layoutWidget.setGeometry(QtCore.QRect(20, 20, 491, 113)) + self.layoutWidget.setObjectName(u'layoutWidget') + self.gridLayout = QtGui.QGridLayout(self.layoutWidget) + self.gridLayout.setMargin(0) + self.gridLayout.setObjectName(u'gridLayout') + self.displaySelectionLabel = QtGui.QLabel(self.layoutWidget) + self.displaySelectionLabel.setObjectName(u'displaySelectionLabel') + self.gridLayout.addWidget(self.displaySelectionLabel, 0, 0, 1, 1) + self.displaySelectionComboBox = QtGui.QComboBox(self.layoutWidget) + self.displaySelectionComboBox.setEditable(False) + self.displaySelectionComboBox.setInsertPolicy(QtGui.QComboBox.NoInsert) + self.displaySelectionComboBox.setSizeAdjustPolicy( + QtGui.QComboBox.AdjustToContents) + self.displaySelectionComboBox.setObjectName(u'displaySelectionComboBox') + self.gridLayout.addWidget(self.displaySelectionComboBox, 0, 1, 1, 1) + self.themeSelectionLabel = QtGui.QLabel(self.layoutWidget) + self.themeSelectionLabel.setObjectName(u'themeSelectionLabel') + self.gridLayout.addWidget(self.themeSelectionLabel, 1, 0, 1, 1) + self.themeSelectionComboBox = QtGui.QComboBox(self.layoutWidget) + self.themeSelectionComboBox.setSizeAdjustPolicy( + QtGui.QComboBox.AdjustToContents) + self.themeSelectionComboBox.setObjectName(u'themeSelectionComboBox') + self.gridLayout.addWidget(self.themeSelectionComboBox, 1, 1, 1, 1) + self.messageLabel = QtGui.QLabel(self.DefaultsPage) + self.messageLabel.setGeometry(QtCore.QRect(60, 160, 471, 17)) + self.messageLabel.setObjectName(u'messageLabel') + self.updateLabel = QtGui.QLabel(self.DefaultsPage) + self.updateLabel.setGeometry(QtCore.QRect(60, 220, 351, 17)) + self.updateLabel.setObjectName(u'updateLabel') + FirstTimeWizard.addPage(self.DefaultsPage) + + self.retranslateUi(FirstTimeWizard) + QtCore.QMetaObject.connectSlotsByName(FirstTimeWizard) + + def retranslateUi(self, FirstTimeWizard): + FirstTimeWizard.setWindowTitle(translate( + 'OpenLP.FirstTimeWizard', 'First Time Wizard')) + self.titleLabel.setText( + u'%s' % \ + translate('OpenLP.FirstTimeWizard', + 'Welcome to the First Time Wizard')) + self.informationLabel.setText(translate('OpenLP.FirstTimeWizard', + 'This wizard will help you to configure OpenLP for initial use .' + ' Click the next button below to start the process of selection ' + 'your initial options. ')) + self.PluginPagePage.setTitle(translate('OpenLP.FirstTimeWizard', + 'Activate required Plugins')) + self.PluginPagePage.setSubTitle(translate('OpenLP.FirstTimeWizard', + 'Select the Plugins you wish to use. ')) + self.songsCheckBox.setText(translate('OpenLP.FirstTimeWizard', 'Songs')) + self.customCheckBox.setText(translate('OpenLP.FirstTimeWizard', + 'Custom Text')) + self.bibleCheckBox.setText(translate('OpenLP.FirstTimeWizard', 'Bible')) + self.imageCheckBox.setText(translate('OpenLP.FirstTimeWizard', + 'Images')) + self.presentationCheckBox.setText(translate('OpenLP.FirstTimeWizard', + 'Presentations')) + self.mediaCheckBox.setText(translate('OpenLP.FirstTimeWizard', + 'Media (Audio and Video)')) + self.remoteCheckBox.setText(translate('OpenLP.FirstTimeWizard', + 'Allow remote access')) + self.songUsageCheckBox.setText(translate('OpenLP.FirstTimeWizard', + 'Monitor Song Usage')) + self.alertCheckBox.setText(translate('OpenLP.FirstTimeWizard', + 'Allow Alerts')) + self.downloadDefaultsPage.setTitle(translate('OpenLP.FirstTimeWizard', + 'Download Samples from OpenLP.org')) + self.downloadDefaultsPage.setSubTitle(translate( + 'OpenLP.FirstTimeWizard', + 'Select samples to downlaod and install for use.')) + self.noInternetLabel.setText(translate('OpenLP.FirstTimeWizard', + 'No Internet connection found so unable to download any default' + ' files.')) + self.internetGroupBox.setTitle(translate('OpenLP.FirstTimeWizard', + 'Download Example Files')) + self.DefaultsPage.setTitle(translate('OpenLP.FirstTimeWizard', + 'Default Settings')) + self.DefaultsPage.setSubTitle(translate('OpenLP.FirstTimeWizard', + 'Set up default values to be used by OpenLP')) + self.displaySelectionLabel.setText(translate('OpenLP.FirstTimeWizard', + 'Default output display')) + self.themeSelectionLabel.setText(translate('OpenLP.FirstTimeWizard', + 'Select the default Theme')) + self.messageLabel.setText(translate('OpenLP.FirstTimeWizard', + 'Press finish to apply all your changes and start OpenLP')) diff --git a/openlp/core/ui/maindisplay.py b/openlp/core/ui/maindisplay.py index f8bd99b81..357eb655a 100644 --- a/openlp/core/ui/maindisplay.py +++ b/openlp/core/ui/maindisplay.py @@ -90,8 +90,8 @@ class MainDisplay(DisplayWidget): """ Set up and build the output screen """ - log.debug(u'Setup live = %s for monitor %s ' % (self.isLive, - self.screens.monitor_number)) + log.debug(u'Start setup for monitor %s (live = %s)' % + (self.screens.monitor_number, self.isLive)) self.usePhonon = QtCore.QSettings().value( u'media/use phonon', QtCore.QVariant(True)).toBool() self.phononActive = False @@ -102,6 +102,7 @@ class MainDisplay(DisplayWidget): self.videoWidget.setVisible(False) self.videoWidget.setGeometry(QtCore.QRect(0, 0, self.screen[u'size'].width(), self.screen[u'size'].height())) + log.debug(u'Setup Phonon for monitor %s' % self.screens.monitor_number) self.mediaObject = Phonon.MediaObject(self) self.audio = Phonon.AudioOutput(Phonon.VideoCategory, self.mediaObject) Phonon.createPath(self.mediaObject, self.videoWidget) @@ -109,6 +110,7 @@ class MainDisplay(DisplayWidget): QtCore.QObject.connect(self.mediaObject, QtCore.SIGNAL(u'stateChanged(Phonon::State, Phonon::State)'), self.videoStart) + log.debug(u'Setup webView for monitor %s' % self.screens.monitor_number) self.webView = QtWebKit.QWebView(self) self.webView.setGeometry(0, 0, self.screen[u'size'].width(), self.screen[u'size'].height()) @@ -165,6 +167,8 @@ class MainDisplay(DisplayWidget): self.primary = False else: self.primary = True + log.debug( + u'Finished setup for monitor %s' % self.screens.monitor_number) def text(self, slide): """ @@ -245,7 +249,8 @@ class MainDisplay(DisplayWidget): js = u'show_image("");' self.frame.evaluateJavaScript(js) # Update the preview frame. - Receiver.send_message(u'maindisplay_active') + if self.isLive: + Receiver.send_message(u'maindisplay_active') def resetImage(self): """ @@ -259,7 +264,8 @@ class MainDisplay(DisplayWidget): self.displayImage(None) self.override = {} # Update the preview frame. - Receiver.send_message(u'maindisplay_active') + if self.isLive: + Receiver.send_message(u'maindisplay_active') def resetVideo(self): """ @@ -276,7 +282,8 @@ class MainDisplay(DisplayWidget): self.frame.evaluateJavaScript(u'show_video("close");') self.override = {} # Update the preview frame. - Receiver.send_message(u'maindisplay_active') + if self.isLive: + Receiver.send_message(u'maindisplay_active') def videoPlay(self): """ @@ -347,7 +354,8 @@ class MainDisplay(DisplayWidget): self.videoWidget.setVisible(True) self.audio.setVolume(vol) # Update the preview frame. - Receiver.send_message(u'maindisplay_active') + if self.isLive: + Receiver.send_message(u'maindisplay_active') return self.preview() def videoStart(self, newState, oldState): @@ -481,7 +489,8 @@ class MainDisplay(DisplayWidget): self.videoPlay() self.hideMode = None # Trigger actions when display is active again - Receiver.send_message(u'maindisplay_active') + if self.isLive: + Receiver.send_message(u'maindisplay_active') def __hideMouse(self): # Hide mouse cursor when moved over display if enabled in settings diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index ba3141f97..54909b5a7 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -462,7 +462,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): actionList = ActionList() - def __init__(self, screens, applicationVersion, clipboard): + def __init__(self, screens, applicationVersion, clipboard, firstTime): """ This constructor sets up the interface, the various managers, and the plugins. @@ -627,6 +627,10 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): self.MediaToolBox.setCurrentIndex(savedPlugin) self.settingsForm.postSetUp() Receiver.send_message(u'cursor_normal') + # Import themes if first time + if firstTime: + self.themeManagerContents.firstTime() + def setAutoLanguage(self, value): self.LanguageGroup.setDisabled(value) diff --git a/openlp/core/ui/slidecontroller.py b/openlp/core/ui/slidecontroller.py index 0caa83e72..c81b987b4 100644 --- a/openlp/core/ui/slidecontroller.py +++ b/openlp/core/ui/slidecontroller.py @@ -162,7 +162,7 @@ class SlideController(QtGui.QWidget): self.themeScreen.setText( translate('OpenLP.SlideController', 'Blank to Theme')) self.desktopScreen = icon_action(self.hideMenu, u'Desktop Screen', - u':/slides/slide_desktop.png', False) + u':/slides/slide_desktop.png', False) self.desktopScreen.setText( translate('OpenLP.SlideController', 'Show Desktop')) self.hideMenu.setDefaultAction(self.blankScreen) diff --git a/openlp/core/ui/thememanager.py b/openlp/core/ui/thememanager.py index 0e04d7b46..407d0cfa8 100644 --- a/openlp/core/ui/thememanager.py +++ b/openlp/core/ui/thememanager.py @@ -145,6 +145,20 @@ class ThemeManager(QtGui.QWidget): # Last little bits of setting up self.configUpdated() + def firstTime(self): + """ + Import new themes downloaded by the first time wizard + """ + Receiver.send_message(u'cursor_busy') + encoding = get_filesystem_encoding() + files = SettingsManager.get_files(self.settingsSection, u'.otz') + for file in files: + file = os.path.join(self.path, file).encode(encoding) + self.unzipTheme(file, self.path) + delete_file(file) + self.loadThemes() + Receiver.send_message(u'cursor_normal') + def configUpdated(self, firstTime=False): """ Triggered when Config dialog is updated. @@ -370,6 +384,7 @@ class ThemeManager(QtGui.QWidget): 'Save Theme - (%s)')) % theme, SettingsManager.get_last_dir(self.settingsSection, 1)) path = unicode(path) + Receiver.send_message(u'cursor_busy') if path: SettingsManager.set_last_dir(self.settingsSection, path, 1) themePath = os.path.join(path, theme + u'.otz') @@ -395,6 +410,7 @@ class ThemeManager(QtGui.QWidget): finally: if zip: zip.close() + Receiver.send_message(u'cursor_normal') def onImportTheme(self): """ @@ -408,12 +424,14 @@ class ThemeManager(QtGui.QWidget): unicode(translate('OpenLP.ThemeManager', 'OpenLP Themes (*.theme *.otz)'))) log.info(u'New Themes %s', unicode(files)) + Receiver.send_message(u'cursor_busy') if files: for file in files: SettingsManager.set_last_dir( self.settingsSection, unicode(file)) self.unzipTheme(file, self.path) self.loadThemes() + Receiver.send_message(u'cursor_normal') def loadThemes(self): """ diff --git a/openlp/core/utils/languagemanager.py b/openlp/core/utils/languagemanager.py index ced2fa843..9cadf06e2 100644 --- a/openlp/core/utils/languagemanager.py +++ b/openlp/core/utils/languagemanager.py @@ -100,12 +100,15 @@ class LanguageManager(object): return language @staticmethod - def set_language(action): + def set_language(action, message=True): """ Set the language to translate OpenLP into ``action`` The language menu option + + ``message`` + Display the message option """ language = u'en' if action: @@ -114,13 +117,16 @@ class LanguageManager(object): language = u'%s' % qm_list[action_name] if LanguageManager.auto_language: language = u'[%s]' % language - QtCore.QSettings().setValue( + # This needs to be here for the setValue to work + settings = QtCore.QSettings(u'OpenLP', u'OpenLP') + settings.setValue( u'general/language', QtCore.QVariant(language)) log.info(u'Language file: \'%s\' written to conf file' % language) - QtGui.QMessageBox.information(None, - translate('OpenLP.LanguageManager', 'Language'), - translate('OpenLP.LanguageManager', - 'Please restart OpenLP to use your new language setting.')) + if message: + QtGui.QMessageBox.information(None, + translate('OpenLP.LanguageManager', 'Language'), + translate('OpenLP.LanguageManager', + 'Please restart OpenLP to use your new language setting.')) @staticmethod def init_qm_list(): diff --git a/openlp/plugins/songs/lib/mediaitem.py b/openlp/plugins/songs/lib/mediaitem.py index 37a404daa..4c267dd3c 100644 --- a/openlp/plugins/songs/lib/mediaitem.py +++ b/openlp/plugins/songs/lib/mediaitem.py @@ -198,7 +198,7 @@ class SongMediaItem(MediaManagerItem): Handle the exit from the edit dialog and trigger remote updates of songs """ - log.debug(u'onSongListLoad') + log.debug(u'onSongListLoad - start') # Called to redisplay the song list screen edit from a search # or from the exit of the Song edit dialog. If remote editing is active # Trigger it and clean up so it will not update again. @@ -213,6 +213,7 @@ class SongMediaItem(MediaManagerItem): self.parent.serviceManager.replaceServiceItem(item) self.onRemoteEditClear() self.onSearchTextButtonClick() + log.debug(u'onSongListLoad - finished') def displayResultsSong(self, searchresults): log.debug(u'display results Song') diff --git a/resources/forms/firsttimewizard.ui b/resources/forms/firsttimewizard.ui new file mode 100644 index 000000000..54dd80306 --- /dev/null +++ b/resources/forms/firsttimewizard.ui @@ -0,0 +1,375 @@ + + + FirstTimeWizard + + + + 0 + 0 + 550 + 386 + + + + First Time Wizard + + + true + + + QWizard::ModernStyle + + + QWizard::IndependentPages|QWizard::NoBackButtonOnStartPage + + + + + + + + + + + 8 + + + 0 + + + + + + 163 + 0 + + + + + 163 + 16777215 + + + + 0 + + + + + + :/wizards/wizard_importbible.bmp + + + 0 + + + + + + + 8 + + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Sans Serif'; font-size:10pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:14pt; font-weight:600;">Welcome to the First Time Wizard</span></p></body></html> + + + + + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 20 + 40 + + + + + + + + This wizard will help you to configure OpenLP for initial use . Click the next button below to start the process of selection your initial options. + + + true + + + 10 + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + Activate required Plugins + + + Select the Plugins you wish to use. + + + + + + + + Songs + + + true + + + + + + + Custom Text + + + true + + + + + + + Bible + + + true + + + + + + + Images + + + true + + + + + + + Presentations + + + true + + + + + + + Media (Audio and Video) + + + true + + + + + + + Allow remote access + + + + + + + Monitor Song Usage + + + true + + + + + + + Allow Alerts + + + true + + + + + + + + + + Download Samples from OpenLP.org + + + Select samples to downlaod and install for use. + + + + + 20 + 20 + 461 + 17 + + + + No Internet connection found so unable to download any default files. + + + + + + 20 + 0 + 501 + 281 + + + + Download Example Files + + + + + + Qt::ScrollBarAlwaysOff + + + false + + + true + + + QAbstractItemView::NoSelection + + + false + + + + 1 + + + + + + + + + + Default Settings + + + Set up default values to be used by OpenLP + + + + + 20 + 20 + 491 + 113 + + + + + + + Default output display + + + + + + + false + + + QComboBox::NoInsert + + + QComboBox::AdjustToContents + + + + + + + Select the default Theme + + + + + + + QComboBox::AdjustToContents + + + + + + + + + 60 + 160 + 471 + 17 + + + + Press Finish to apply all you changes and start OpenLP + + + + + + 60 + 220 + 351 + 17 + + + + + + + + + + + + + diff --git a/resources/gentoo/openlp-1.9.4.ebuild b/resources/gentoo/openlp-1.9.4.ebuild new file mode 100644 index 000000000..4e87a27b3 --- /dev/null +++ b/resources/gentoo/openlp-1.9.4.ebuild @@ -0,0 +1,30 @@ +# Copyright 1999-2009 Gentoo Foundation +# Copyright 2010 Jaak Ristioja +# Distributed under the terms of the GNU General Public License v2 +# $Header: $ + +EAPI=2 +RESTRICT_PYTHON_ABIS="3.*" +inherit python + +DESCRIPTION="Free church presentation software" +HOMEPAGE="http://openlp.org/" +SRC_URI="mirror://sourceforge/${PN}/${PV}/OpenLP-${PV}-src.tar.gz" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="alpha amd64 arm hppa ia64 ppc ppc64 sparc x86 x86-fbsd x86-freebsd amd64-linux x86-linux x86-macos x86-solaris" + +RDEPEND=">=dev-lang/python-2.5.0 + dev-python/beautifulsoup + dev-python/chardet + dev-python/lxml + dev-python/pyenchant + dev-python/PyQt4[X,multimedia] + dev-python/sqlalchemy" +DEPEND="${RDEPEND}" + +PYTHON_DEPEND="2:2.5" +PYTHON_MODNAME="openlp" + +S=${WORKDIR}/OpenLP-${PV}-src