Tim Bentley has proposed merging lp:~trb143/openlp/wizard into lp:openlp. Requested reviews: OpenLP Core (openlp-core)
For more details, see: https://code.launchpad.net/~trb143/openlp/wizard/+merge/52324 First time wizard is now coded and ready to be included. Code should be fine now and it works in my testing having deleted my config and files directories. -- https://code.launchpad.net/~trb143/openlp/wizard/+merge/52324 Your team OpenLP Core is requested to review the proposed merge of lp:~trb143/openlp/wizard into lp:openlp.
=== modified file 'openlp.pyw' --- openlp.pyw 2011-03-06 07:51:24 +0000 +++ openlp.pyw 2011-03-06 14:25:40 +0000 @@ -36,6 +36,8 @@ 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 @@ 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 @@ 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 @@ 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) === modified file 'openlp/core/ui/__init__.py' --- openlp/core/ui/__init__.py 2011-02-24 05:47:38 +0000 +++ openlp/core/ui/__init__.py 2011-03-06 14:25:40 +0000 @@ -51,6 +51,8 @@ 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 @@ __all__ = ['SplashScreen', 'AboutForm', 'SettingsForm', 'MainDisplay', 'SlideController', 'ServiceManager', 'ThemeManager', 'MediaDockManager', - 'ServiceItemEditForm'] + 'ServiceItemEditForm', u'FirstTimeForm'] === added file 'openlp/core/ui/firsttimeform.py' --- openlp/core/ui/firsttimeform.py 1970-01-01 00:00:00 +0000 +++ openlp/core/ui/firsttimeform.py 2011-03-06 14:25:40 +0000 @@ -0,0 +1,212 @@ +# -*- 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.downloadSongs = unicode(translate('OpenLP.FirstTimeWizard', + 'Downloading Songs.')) + self.downloadBible = unicode(translate('OpenLP.FirstTimeWizard', + 'Downloading bible')) + self.downloadTheme = unicode(translate('OpenLP.FirstTimeWizard', + 'Downloading theme')) + + 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) + 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 initializePage(self, id): + """ + Set up the pages for Initial run through dialog + """ + wizardPage = self.page(id) + if wizardPage == self.DefaultsPage: + 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): + 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 = u'%s %s' % (self.downloadSongs, 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 = u'%s %s' % (self.downloadBible, 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 = u'%s %s' % (self.downloadTheme, 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)) + 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') === added file 'openlp/core/ui/firsttimelanguagedialog.py' --- openlp/core/ui/firsttimelanguagedialog.py 1970-01-01 00:00:00 +0000 +++ openlp/core/ui/firsttimelanguagedialog.py 2011-03-06 14:25:40 +0000 @@ -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:')) === added file 'openlp/core/ui/firsttimelanguageform.py' --- openlp/core/ui/firsttimelanguageform.py 1970-01-01 00:00:00 +0000 +++ openlp/core/ui/firsttimelanguageform.py 2011-03-06 14:25:40 +0000 @@ -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) === added file 'openlp/core/ui/firsttimewizard.py' --- openlp/core/ui/firsttimewizard.py 1970-01-01 00:00:00 +0000 +++ openlp/core/ui/firsttimewizard.py 2011-03-06 14:25:40 +0000 @@ -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'<span style="font-size:14pt; font-weight:600;">%s</span>' % \ + 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 you changes and start OpenLP')) === modified file 'openlp/core/ui/mainwindow.py' --- openlp/core/ui/mainwindow.py 2011-03-05 12:01:37 +0000 +++ openlp/core/ui/mainwindow.py 2011-03-06 14:25:40 +0000 @@ -461,7 +461,7 @@ 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. @@ -626,6 +626,11 @@ self.MediaToolBox.setCurrentIndex(savedPlugin) self.settingsForm.postSetUp() Receiver.send_message(u'cursor_normal') + # Import themes if first time + if firstTime: + self.themeManagerContents.firstTime() + self.themeManagerContents.firstTime() + def setAutoLanguage(self, value): self.LanguageGroup.setDisabled(value) === modified file 'openlp/core/ui/thememanager.py' --- openlp/core/ui/thememanager.py 2011-02-25 17:05:01 +0000 +++ openlp/core/ui/thememanager.py 2011-03-06 14:25:40 +0000 @@ -145,6 +145,20 @@ # 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 @@ '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 @@ finally: if zip: zip.close() + Receiver.send_message(u'cursor_normal') def onImportTheme(self): """ @@ -408,12 +424,14 @@ 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): """ === modified file 'openlp/core/utils/languagemanager.py' --- openlp/core/utils/languagemanager.py 2011-02-24 05:47:38 +0000 +++ openlp/core/utils/languagemanager.py 2011-03-06 14:25:40 +0000 @@ -100,12 +100,15 @@ 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 @@ 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(): === added file 'resources/forms/firsttimewizard.ui' --- resources/forms/firsttimewizard.ui 1970-01-01 00:00:00 +0000 +++ resources/forms/firsttimewizard.ui 2011-03-06 14:25:40 +0000 @@ -0,0 +1,375 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>FirstTimeWizard</class> + <widget class="QWizard" name="FirstTimeWizard"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>550</width> + <height>386</height> + </rect> + </property> + <property name="windowTitle"> + <string>First Time Wizard</string> + </property> + <property name="modal"> + <bool>true</bool> + </property> + <property name="wizardStyle"> + <enum>QWizard::ModernStyle</enum> + </property> + <property name="options"> + <set>QWizard::IndependentPages|QWizard::NoBackButtonOnStartPage</set> + </property> + <widget class="QWizardPage" name="welcomePage"> + <property name="title"> + <string/> + </property> + <property name="subTitle"> + <string/> + </property> + <layout class="QHBoxLayout" name="welcomeLayout"> + <property name="spacing"> + <number>8</number> + </property> + <property name="margin"> + <number>0</number> + </property> + <item> + <widget class="QLabel" name="importBibleImage"> + <property name="minimumSize"> + <size> + <width>163</width> + <height>0</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>163</width> + <height>16777215</height> + </size> + </property> + <property name="lineWidth"> + <number>0</number> + </property> + <property name="text"> + <string/> + </property> + <property name="pixmap"> + <pixmap resource="../images/openlp-2.qrc">:/wizards/wizard_importbible.bmp</pixmap> + </property> + <property name="indent"> + <number>0</number> + </property> + </widget> + </item> + <item> + <layout class="QVBoxLayout" name="welcomePageLayout"> + <property name="spacing"> + <number>8</number> + </property> + <item> + <widget class="QLabel" name="titleLabel"> + <property name="text"> + <string><!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></string> + </property> + </widget> + </item> + <item> + <spacer name="welcomeTopSpacer"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeType"> + <enum>QSizePolicy::Fixed</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>40</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QLabel" name="informationLabel"> + <property name="text"> + <string>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. </string> + </property> + <property name="wordWrap"> + <bool>true</bool> + </property> + <property name="margin"> + <number>10</number> + </property> + </widget> + </item> + <item> + <spacer name="welcomeBottomSpacer"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>40</height> + </size> + </property> + </spacer> + </item> + </layout> + </item> + </layout> + </widget> + <widget class="QWizardPage" name="PluginPagePage"> + <property name="title"> + <string>Activate required Plugins</string> + </property> + <property name="subTitle"> + <string>Select the Plugins you wish to use. </string> + </property> + <layout class="QVBoxLayout" name="verticalLayout_2"> + <item> + <layout class="QVBoxLayout" name="verticalLayout"> + <item> + <widget class="QCheckBox" name="songsCheckBox"> + <property name="text"> + <string>Songs</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QCheckBox" name="customCheckBox"> + <property name="text"> + <string>Custom Text</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QCheckBox" name="bibleCheckBox"> + <property name="text"> + <string>Bible</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QCheckBox" name="imageCheckBox"> + <property name="text"> + <string>Images</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QCheckBox" name="presentationCheckBox"> + <property name="text"> + <string>Presentations</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QCheckBox" name="mediaCheckBox"> + <property name="text"> + <string>Media (Audio and Video)</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QCheckBox" name="remoteCheckBox"> + <property name="text"> + <string>Allow remote access</string> + </property> + </widget> + </item> + <item> + <widget class="QCheckBox" name="songUsageCheckBox"> + <property name="text"> + <string>Monitor Song Usage</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QCheckBox" name="alertCheckBox"> + <property name="text"> + <string>Allow Alerts</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </widget> + <widget class="QWizardPage" name="downloadDefaultsPage"> + <property name="title"> + <string>Download Samples from OpenLP.org</string> + </property> + <property name="subTitle"> + <string>Select samples to downlaod and install for use.</string> + </property> + <widget class="QLabel" name="noInternetLabel"> + <property name="geometry"> + <rect> + <x>20</x> + <y>20</y> + <width>461</width> + <height>17</height> + </rect> + </property> + <property name="text"> + <string>No Internet connection found so unable to download any default files.</string> + </property> + </widget> + <widget class="QGroupBox" name="internetGroupBox"> + <property name="geometry"> + <rect> + <x>20</x> + <y>0</y> + <width>501</width> + <height>281</height> + </rect> + </property> + <property name="title"> + <string>Download Example Files</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout_4"> + <item> + <widget class="QTreeWidget" name="selectionTreeWidget"> + <property name="horizontalScrollBarPolicy"> + <enum>Qt::ScrollBarAlwaysOff</enum> + </property> + <property name="showDropIndicator" stdset="0"> + <bool>false</bool> + </property> + <property name="alternatingRowColors"> + <bool>true</bool> + </property> + <property name="selectionMode"> + <enum>QAbstractItemView::NoSelection</enum> + </property> + <attribute name="headerVisible"> + <bool>false</bool> + </attribute> + <column> + <property name="text"> + <string notr="true">1</string> + </property> + </column> + </widget> + </item> + </layout> + </widget> + </widget> + <widget class="QWizardPage" name="DefaultsPage"> + <property name="title"> + <string>Default Settings</string> + </property> + <property name="subTitle"> + <string>Set up default values to be used by OpenLP</string> + </property> + <widget class="QWidget" name="layoutWidget"> + <property name="geometry"> + <rect> + <x>20</x> + <y>20</y> + <width>491</width> + <height>113</height> + </rect> + </property> + <layout class="QGridLayout" name="gridLayout"> + <item row="0" column="0"> + <widget class="QLabel" name="displaySelectionLabel"> + <property name="text"> + <string>Default output display</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QComboBox" name="displaySelectionComboBox"> + <property name="editable"> + <bool>false</bool> + </property> + <property name="insertPolicy"> + <enum>QComboBox::NoInsert</enum> + </property> + <property name="sizeAdjustPolicy"> + <enum>QComboBox::AdjustToContents</enum> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="themeSelectionLabel"> + <property name="text"> + <string>Select the default Theme</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QComboBox" name="themeSelectionComboBox"> + <property name="sizeAdjustPolicy"> + <enum>QComboBox::AdjustToContents</enum> + </property> + </widget> + </item> + </layout> + </widget> + <widget class="QLabel" name="messageLabel"> + <property name="geometry"> + <rect> + <x>60</x> + <y>160</y> + <width>471</width> + <height>17</height> + </rect> + </property> + <property name="text"> + <string>Press Finish to apply all you changes and start OpenLP</string> + </property> + </widget> + <widget class="QLabel" name="updateLabel"> + <property name="geometry"> + <rect> + <x>60</x> + <y>220</y> + <width>351</width> + <height>17</height> + </rect> + </property> + <property name="text"> + <string/> + </property> + </widget> + </widget> + </widget> + <resources> + <include location="../images/openlp-2.qrc"/> + </resources> + <connections/> +</ui>
_______________________________________________ Mailing list: https://launchpad.net/~openlp-core Post to : openlp-core@lists.launchpad.net Unsubscribe : https://launchpad.net/~openlp-core More help : https://help.launchpad.net/ListHelp