From ce1ab6ee5eb5b9ba2cdb236518d61cedf634a624 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sat, 26 Feb 2011 09:26:17 +0000 Subject: [PATCH 01/25] Initial bits --- openlp.pyw | 8 +++++++- openlp/core/utils/languagemanager.py | 3 +-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/openlp.pyw b/openlp.pyw index 85ba81fba..565d5936f 100755 --- a/openlp.pyw +++ b/openlp.pyw @@ -172,6 +172,10 @@ class OpenLP(QtGui.QApplication): self.setApplicationVersion(app_version[u'version']) if os.name == u'nt': self.setStyleSheet(application_stylesheet) + # First time checks in settings + if QtCore.QSettings().value( + u'general/first time', QtCore.QVariant(True)).toBool(): + print "first time" show_splash = QtCore.QSettings().value( u'general/show splash', QtCore.QVariant(True)).toBool() if show_splash: @@ -273,7 +277,9 @@ def main(): qInitResources() # Now create and actually run the application. app = OpenLP(qt_args) - #i18n Set Language + # Define the settings environment + QtCore.QSettings(u'OpenLP', u'OpenLP') + # i18n Set Language language = LanguageManager.get_language() appTranslator = LanguageManager.get_translator(language) app.installTranslator(appTranslator) diff --git a/openlp/core/utils/languagemanager.py b/openlp/core/utils/languagemanager.py index ced2fa843..43d2a8e67 100644 --- a/openlp/core/utils/languagemanager.py +++ b/openlp/core/utils/languagemanager.py @@ -89,8 +89,7 @@ class LanguageManager(object): """ Retrieve a saved language to use from settings """ - settings = QtCore.QSettings(u'OpenLP', u'OpenLP') - language = unicode(settings.value( + language = unicode(QtCore.QSettings().value( u'general/language', QtCore.QVariant(u'[en]')).toString()) log.info(u'Language file: \'%s\' Loaded from conf file' % language) reg_ex = QtCore.QRegExp("^\[(.*)\]") From 69193825a9e6e94c3ce9f942f8bebf07174d487c Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sat, 26 Feb 2011 09:26:49 +0000 Subject: [PATCH 02/25] Form --- resources/forms/firsttimewizard.ui | 373 +++++++++++++++++++++++++++++ 1 file changed, 373 insertions(+) create mode 100644 resources/forms/firsttimewizard.ui diff --git a/resources/forms/firsttimewizard.ui b/resources/forms/firsttimewizard.ui new file mode 100644 index 000000000..b4442e9f0 --- /dev/null +++ b/resources/forms/firsttimewizard.ui @@ -0,0 +1,373 @@ + + + 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 + + + + + + + Remote Control + + + + + + + Monitor Song Usage + + + true + + + + + + + + + + Download Samples from OpenLP.org + + + Select samples to downlaod and install for use. + + + + + 20 + 20 + 416 + 17 + + + + No Internet connection found so unable to download any defaults + + + + + + 30 + 50 + 441 + 191 + + + + Download Samples + + + + + + + + Sample Songs + + + + + + + Bible XXX (Repeat per bible) + + + + + + + Theme XXX (Repeat per theme) + + + + + + + + + + + Configure Settings + + + Configure the initial value for settings + + + + + 20 + 20 + 252 + 58 + + + + + + + Default output display + + + + + + + false + + + QComboBox::NoInsert + + + QComboBox::AdjustToContents + + + + + + + Select the default Theme + + + + + + + QComboBox::AdjustToContents + + + + + + + + + Apply Updates + + + Press Finish to apply requested updates. + + + + 8 + + + 20 + + + + + + + + + + FirstTimeWizard + accepted() + FirstTimeWizard + accept() + + + 455 + 368 + + + 483 + 401 + + + + + From 36534f3496617c775a6b2470cf90c7e27a8f19b3 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sat, 26 Feb 2011 11:16:21 +0000 Subject: [PATCH 03/25] Fix framework --- openlp.pyw | 3 ++- openlp/core/ui/__init__.py | 3 ++- openlp/core/ui/firsttimeform.py | 39 +++++++++++++++++++++++++++++++++ 3 files changed, 43 insertions(+), 2 deletions(-) create mode 100644 openlp/core/ui/firsttimeform.py diff --git a/openlp.pyw b/openlp.pyw index 565d5936f..be31651b3 100755 --- a/openlp.pyw +++ b/openlp.pyw @@ -37,6 +37,7 @@ 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.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 @@ -175,7 +176,7 @@ class OpenLP(QtGui.QApplication): # First time checks in settings if QtCore.QSettings().value( u'general/first time', QtCore.QVariant(True)).toBool(): - print "first time" + FirstTimeForm() #.exec_() show_splash = QtCore.QSettings().value( u'general/show splash', QtCore.QVariant(True)).toBool() if show_splash: diff --git a/openlp/core/ui/__init__.py b/openlp/core/ui/__init__.py index 158f7f0cd..a9b46ec9f 100644 --- a/openlp/core/ui/__init__.py +++ b/openlp/core/ui/__init__.py @@ -51,6 +51,7 @@ class HideMode(object): Theme = 2 Screen = 3 +from firsttimeform import FirstTimeForm from themeform import ThemeForm from filerenameform import FileRenameForm from starttimeform import StartTimeForm @@ -74,4 +75,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..f4e5471f8 --- /dev/null +++ b/openlp/core/ui/firsttimeform.py @@ -0,0 +1,39 @@ +# -*- 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 filerenamedialog import Ui_FileRenameDialog + +from openlp.core.lib import translate +from openlp.core.utils import get_web_page + +class FirstTimeForm():#QtGui.QDialog, Ui_FileRenameDialog): + + def __init__(self): + # check to see if we have web access + self.WebAccess = get_web_page(u'http://openlp.org1') + print self.WebAccess From d7a56667a4208168564da899def090a2801dcf7e Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sat, 26 Feb 2011 15:19:43 +0000 Subject: [PATCH 04/25] Framework fine --- openlp.pyw | 9 ++++++++- openlp/core/ui/firsttimeform.py | 21 ++++++++++++++++++--- 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/openlp.pyw b/openlp.pyw index be31651b3..c5568e201 100755 --- a/openlp.pyw +++ b/openlp.pyw @@ -173,10 +173,13 @@ class OpenLP(QtGui.QApplication): self.setApplicationVersion(app_version[u'version']) if os.name == u'nt': self.setStyleSheet(application_stylesheet) + print "1" # First time checks in settings if QtCore.QSettings().value( u'general/first time', QtCore.QVariant(True)).toBool(): - FirstTimeForm() #.exec_() + FirstTimeForm().exec_() + # make sure Qt really display the splash screen + self.processEvents() show_splash = QtCore.QSettings().value( u'general/show splash', QtCore.QVariant(True)).toBool() if show_splash: @@ -207,13 +210,17 @@ class OpenLP(QtGui.QApplication): return self.exec_() def hookException(self, exctype, value, traceback): + print "a" if not hasattr(self, u'mainWindow'): log.exception(''.join(format_exception(exctype, value, traceback))) return + print "b" if not hasattr(self, u'exceptionForm'): self.exceptionForm = ExceptionForm(self.mainWindow) + print "c" self.exceptionForm.exceptionTextEdit.setPlainText( ''.join(format_exception(exctype, value, traceback))) + print "d" self.setNormalCursor() self.exceptionForm.exec_() diff --git a/openlp/core/ui/firsttimeform.py b/openlp/core/ui/firsttimeform.py index f4e5471f8..44f430a90 100644 --- a/openlp/core/ui/firsttimeform.py +++ b/openlp/core/ui/firsttimeform.py @@ -24,16 +24,31 @@ # Temple Place, Suite 330, Boston, MA 02111-1307 USA # ############################################################################### +import logging + from PyQt4 import QtGui -#from filerenamedialog import Ui_FileRenameDialog +from firsttimewizard import Ui_FirstTimeWizard from openlp.core.lib import translate from openlp.core.utils import get_web_page -class FirstTimeForm():#QtGui.QDialog, Ui_FileRenameDialog): +log = logging.getLogger(__name__) - def __init__(self): +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, parent=None): # check to see if we have web access self.WebAccess = get_web_page(u'http://openlp.org1') print self.WebAccess + QtGui.QWizard.__init__(self, parent) + self.setupUi(self) + #self.registerFields() + + def accept(self): + return QtGui.QWizard.accept(self) From 88fefe5582f0edae302422cc55c216b31193da04 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sat, 26 Feb 2011 16:51:00 +0000 Subject: [PATCH 05/25] Plugins work --- openlp/core/ui/firsttimeform.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/openlp/core/ui/firsttimeform.py b/openlp/core/ui/firsttimeform.py index 44f430a90..0ca078e66 100644 --- a/openlp/core/ui/firsttimeform.py +++ b/openlp/core/ui/firsttimeform.py @@ -26,11 +26,11 @@ import logging -from PyQt4 import QtGui +from PyQt4 import QtCore, QtGui from firsttimewizard import Ui_FirstTimeWizard -from openlp.core.lib import translate +from openlp.core.lib import translate, PluginStatus from openlp.core.utils import get_web_page log = logging.getLogger(__name__) @@ -51,4 +51,18 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): #self.registerFields() def accept(self): + 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'remote/status') + self.__pluginStatus(self.customCheckBox, u'custom/status') + self.__pluginStatus(self.songUsageCheckBox, u'songusage/status') + #self.__pluginStatus(self.alertsCheckBox, u'alerts/status') 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)) From 289ce0de5f4f9cc44860afe2fae6c39abf0e6bf3 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sat, 26 Feb 2011 20:52:26 +0000 Subject: [PATCH 06/25] Start of Langauges --- openlp.pyw | 19 ++----- openlp/core/ui/firsttimeform.py | 33 ++++++++++-- resources/forms/firsttimewizard.ui | 80 +++++++++++++++--------------- 3 files changed, 73 insertions(+), 59 deletions(-) diff --git a/openlp.pyw b/openlp.pyw index c5568e201..393a1331b 100755 --- a/openlp.pyw +++ b/openlp.pyw @@ -151,10 +151,6 @@ class OpenLP(QtGui.QApplication): log.info(u'Openlp version %s' % app_version[u'version']) return app_version -# def notify(self, obj, evt): -# #TODO needed for presentation exceptions -# return QtGui.QApplication.notify(self, obj, evt) - def run(self): """ Run the OpenLP application. @@ -173,13 +169,6 @@ class OpenLP(QtGui.QApplication): self.setApplicationVersion(app_version[u'version']) if os.name == u'nt': self.setStyleSheet(application_stylesheet) - print "1" - # First time checks in settings - if QtCore.QSettings().value( - u'general/first time', QtCore.QVariant(True)).toBool(): - FirstTimeForm().exec_() - # make sure Qt really display the splash screen - self.processEvents() show_splash = QtCore.QSettings().value( u'general/show splash', QtCore.QVariant(True)).toBool() if show_splash: @@ -210,17 +199,13 @@ class OpenLP(QtGui.QApplication): return self.exec_() def hookException(self, exctype, value, traceback): - print "a" if not hasattr(self, u'mainWindow'): log.exception(''.join(format_exception(exctype, value, traceback))) return - print "b" if not hasattr(self, u'exceptionForm'): self.exceptionForm = ExceptionForm(self.mainWindow) - print "c" self.exceptionForm.exceptionTextEdit.setPlainText( ''.join(format_exception(exctype, value, traceback))) - print "d" self.setNormalCursor() self.exceptionForm.exec_() @@ -287,6 +272,10 @@ def main(): app = OpenLP(qt_args) # Define the settings environment QtCore.QSettings(u'OpenLP', u'OpenLP') + # First time checks in settings + if QtCore.QSettings().value( + u'general/first time', QtCore.QVariant(True)).toBool(): + FirstTimeForm().exec_() # i18n Set Language language = LanguageManager.get_language() appTranslator = LanguageManager.get_translator(language) diff --git a/openlp/core/ui/firsttimeform.py b/openlp/core/ui/firsttimeform.py index 0ca078e66..88220ed33 100644 --- a/openlp/core/ui/firsttimeform.py +++ b/openlp/core/ui/firsttimeform.py @@ -31,7 +31,7 @@ from PyQt4 import QtCore, QtGui from firsttimewizard import Ui_FirstTimeWizard from openlp.core.lib import translate, PluginStatus -from openlp.core.utils import get_web_page +from openlp.core.utils import get_web_page, LanguageManager log = logging.getLogger(__name__) @@ -44,12 +44,35 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): def __init__(self, parent=None): # check to see if we have web access - self.WebAccess = get_web_page(u'http://openlp.org1') - print self.WebAccess + self.webAccess = get_web_page(u'http://openlp.org1') + print self.webAccess QtGui.QWizard.__init__(self, parent) self.setupUi(self) #self.registerFields() + 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 + if self.webAccess: + self.internetGroupBox.setVisible(True) + self.noInternetLabel.setVisible(False) + else: + self.internetGroupBox.setVisible(False) + self.noInternetLabel.setVisible(True) + self.qmList = LanguageManager.get_qm_list() + for key in sorted(self.qmList.keys()): + self.LanguageComboBox.addItem(key) + def accept(self): self.__pluginStatus(self.songsCheckBox, u'songs/status') self.__pluginStatus(self.bibleCheckBox, u'bibles/status') @@ -59,7 +82,9 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): self.__pluginStatus(self.remoteCheckBox, u'remote/status') self.__pluginStatus(self.customCheckBox, u'custom/status') self.__pluginStatus(self.songUsageCheckBox, u'songusage/status') - #self.__pluginStatus(self.alertsCheckBox, u'alerts/status') + self.__pluginStatus(self.alertCheckBox, u'alerts/status') + + print self.qmList[unicode(self.LanguageComboBox.currentText())] return QtGui.QWizard.accept(self) def __pluginStatus(self, field, tag): diff --git a/resources/forms/firsttimewizard.ui b/resources/forms/firsttimewizard.ui index b4442e9f0..305fd66a0 100644 --- a/resources/forms/firsttimewizard.ui +++ b/resources/forms/firsttimewizard.ui @@ -199,7 +199,7 @@ p, li { white-space: pre-wrap; } - Remote Control + Allow remote access @@ -213,6 +213,16 @@ p, li { white-space: pre-wrap; } + + + + Allow Alerts + + + true + + + @@ -229,12 +239,12 @@ p, li { white-space: pre-wrap; } 20 20 - 416 + 461 17 - No Internet connection found so unable to download any defaults + No Internet connection found so unable to download any default files. @@ -247,7 +257,7 @@ p, li { white-space: pre-wrap; } - Download Samples + Download Example Files @@ -280,18 +290,18 @@ p, li { white-space: pre-wrap; } - Configure Settings + Default Settings - Configure the initial value for settings + Set up default values to be used by OpenLP - + 20 20 252 - 58 + 88 @@ -329,45 +339,35 @@ p, li { white-space: pre-wrap; } + + + + Select default language + + + + + + - - - - Apply Updates - - - Press Finish to apply requested updates. - - - - 8 + + + + 40 + 190 + 471 + 17 + - - 20 + + Press Finish to apply all you changes and start OpenLP - + - - - FirstTimeWizard - accepted() - FirstTimeWizard - accept() - - - 455 - 368 - - - 483 - 401 - - - - + From f295ac54075e083f1ea2a304314e18af1540086d Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sun, 27 Feb 2011 09:53:47 +0000 Subject: [PATCH 07/25] Select Language at startup --- openlp.pyw | 2 ++ openlp/core/ui/firsttimeform.py | 12 ++++++++++-- openlp/core/utils/languagemanager.py | 15 ++++++++++----- resources/forms/firsttimewizard.ui | 24 +++++++++++++++++++----- 4 files changed, 41 insertions(+), 12 deletions(-) diff --git a/openlp.pyw b/openlp.pyw index 393a1331b..c551636b8 100755 --- a/openlp.pyw +++ b/openlp.pyw @@ -276,8 +276,10 @@ def main(): if QtCore.QSettings().value( u'general/first time', QtCore.QVariant(True)).toBool(): FirstTimeForm().exec_() + pass # i18n Set Language language = LanguageManager.get_language() + print language appTranslator = LanguageManager.get_translator(language) app.installTranslator(appTranslator) if not options.no_error_form: diff --git a/openlp/core/ui/firsttimeform.py b/openlp/core/ui/firsttimeform.py index 88220ed33..2a23350a6 100644 --- a/openlp/core/ui/firsttimeform.py +++ b/openlp/core/ui/firsttimeform.py @@ -69,6 +69,8 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): else: self.internetGroupBox.setVisible(False) self.noInternetLabel.setVisible(True) + if LanguageManager.auto_language: + self.LanguageComboBox.setEnabled(False) self.qmList = LanguageManager.get_qm_list() for key in sorted(self.qmList.keys()): self.LanguageComboBox.addItem(key) @@ -83,8 +85,14 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): self.__pluginStatus(self.customCheckBox, u'custom/status') self.__pluginStatus(self.songUsageCheckBox, u'songusage/status') self.__pluginStatus(self.alertCheckBox, u'alerts/status') - - print self.qmList[unicode(self.LanguageComboBox.currentText())] + if self.autoLanguageCheckBox.checkState() == QtCore.Qt.Checked: + 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.QWizard.accept(self) def __pluginStatus(self, field, tag): diff --git a/openlp/core/utils/languagemanager.py b/openlp/core/utils/languagemanager.py index 43d2a8e67..e90a659ec 100644 --- a/openlp/core/utils/languagemanager.py +++ b/openlp/core/utils/languagemanager.py @@ -99,16 +99,20 @@ 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: action_name = u'%s' % action.objectName() + print action_name qm_list = LanguageManager.get_qm_list() language = u'%s' % qm_list[action_name] if LanguageManager.auto_language: @@ -116,10 +120,11 @@ class LanguageManager(object): QtCore.QSettings().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/resources/forms/firsttimewizard.ui b/resources/forms/firsttimewizard.ui index 305fd66a0..ec55bcd42 100644 --- a/resources/forms/firsttimewizard.ui +++ b/resources/forms/firsttimewizard.ui @@ -300,8 +300,8 @@ p, li { white-space: pre-wrap; } 20 20 - 252 - 88 + 491 + 113 @@ -339,15 +339,29 @@ p, li { white-space: pre-wrap; } - + Select default language - - + + + + QComboBox::AdjustToContents + + + + + + + Auto Language + + + true + + From b4156c809bb480f246450eb4ae5423274fd7612c Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sun, 27 Feb 2011 14:29:19 +0000 Subject: [PATCH 08/25] You can now set the Language --- openlp.pyw | 2 -- openlp/core/ui/firsttimeform.py | 18 ++++++++++++++---- openlp/core/utils/languagemanager.py | 5 +++-- 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/openlp.pyw b/openlp.pyw index c551636b8..393a1331b 100755 --- a/openlp.pyw +++ b/openlp.pyw @@ -276,10 +276,8 @@ def main(): if QtCore.QSettings().value( u'general/first time', QtCore.QVariant(True)).toBool(): FirstTimeForm().exec_() - pass # i18n Set Language language = LanguageManager.get_language() - print language appTranslator = LanguageManager.get_translator(language) app.installTranslator(appTranslator) if not options.no_error_form: diff --git a/openlp/core/ui/firsttimeform.py b/openlp/core/ui/firsttimeform.py index 2a23350a6..35cc65b1f 100644 --- a/openlp/core/ui/firsttimeform.py +++ b/openlp/core/ui/firsttimeform.py @@ -48,6 +48,9 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): print self.webAccess QtGui.QWizard.__init__(self, parent) self.setupUi(self) + QtCore.QObject.connect(self.autoLanguageCheckBox, + QtCore.SIGNAL(u'stateChanged(int)'), + self.onAutoLanguageClicked) #self.registerFields() def exec_(self, edit=False): @@ -62,15 +65,16 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): Set up display at start of theme edit. """ self.restart() - # Sort out internet access + # Sort out internet access for downloads if self.webAccess: self.internetGroupBox.setVisible(True) self.noInternetLabel.setVisible(False) else: self.internetGroupBox.setVisible(False) self.noInternetLabel.setVisible(True) - if LanguageManager.auto_language: - self.LanguageComboBox.setEnabled(False) + # Sort out Language settings + self.autoLanguageCheckBox.setChecked(True) + self.LanguageComboBox.setEnabled(False) self.qmList = LanguageManager.get_qm_list() for key in sorted(self.qmList.keys()): self.LanguageComboBox.addItem(key) @@ -81,7 +85,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): 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'remote/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') @@ -95,6 +99,12 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): LanguageManager.set_language(action, False) return QtGui.QWizard.accept(self) + def onAutoLanguageClicked(self, state): + if state == QtCore.Qt.Checked: + self.LanguageComboBox.setEnabled(False) + else: + self.LanguageComboBox.setEnabled(True) + def __pluginStatus(self, field, tag): status = PluginStatus.Active if field.checkState() \ == QtCore.Qt.Checked else PluginStatus.Inactive diff --git a/openlp/core/utils/languagemanager.py b/openlp/core/utils/languagemanager.py index e90a659ec..ebc9b4575 100644 --- a/openlp/core/utils/languagemanager.py +++ b/openlp/core/utils/languagemanager.py @@ -112,12 +112,13 @@ class LanguageManager(object): language = u'en' if action: action_name = u'%s' % action.objectName() - print action_name qm_list = LanguageManager.get_qm_list() 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) if message: From 0e773c7a1b3ddfd640ccdb78fbf2f74d0f3f53d6 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sun, 27 Feb 2011 15:33:08 +0000 Subject: [PATCH 09/25] Lists from the web now --- openlp/core/ui/firsttimeform.py | 28 +++++++++++++++- resources/forms/firsttimewizard.ui | 53 +++++++++++++++--------------- 2 files changed, 53 insertions(+), 28 deletions(-) diff --git a/openlp/core/ui/firsttimeform.py b/openlp/core/ui/firsttimeform.py index 35cc65b1f..f739b9a81 100644 --- a/openlp/core/ui/firsttimeform.py +++ b/openlp/core/ui/firsttimeform.py @@ -44,8 +44,14 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): def __init__(self, parent=None): # check to see if we have web access - self.webAccess = get_web_page(u'http://openlp.org1') + self.webAccess = get_web_page(u'http://openlp.org/files/frw/themes.lst') print self.webAccess + if self.webAccess: + self.themes = self.webAccess.read() + songs = get_web_page(u'http://openlp.org/files/frw/songs.lst') + self.songs = songs.read() + bibles = get_web_page(u'http://openlp.org/files/frw/bibles.lst') + self.bibles = bibles.read() QtGui.QWizard.__init__(self, parent) self.setupUi(self) QtCore.QObject.connect(self.autoLanguageCheckBox, @@ -78,6 +84,26 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): self.qmList = LanguageManager.get_qm_list() for key in sorted(self.qmList.keys()): self.LanguageComboBox.addItem(key) + treewidgetitem = QtGui.QTreeWidgetItem(self.selectionTreeWidget) + treewidgetitem.setText(0, u'Songs') + self.__loadChild(treewidgetitem, self.songs) + treewidgetitem = QtGui.QTreeWidgetItem(self.selectionTreeWidget) + treewidgetitem.setText(0, u'Bibles') + self.__loadChild(treewidgetitem, self.bibles) + treewidgetitem = QtGui.QTreeWidgetItem(self.selectionTreeWidget) + treewidgetitem.setText(0, u'Themes') + self.__loadChild(treewidgetitem, self.themes) + + def __loadChild(self, tree, list): + list = list.split(u'\n') + for item in list: + if item: + child = QtGui.QTreeWidgetItem(tree) + child.setText(0, item) + child.setCheckState(0, QtCore.Qt.Unchecked) + child.setFlags(QtCore.Qt.ItemIsUserCheckable | + QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled) + #self.themeSelectionComboBox.addItem(theme) def accept(self): self.__pluginStatus(self.songsCheckBox, u'songs/status') diff --git a/resources/forms/firsttimewizard.ui b/resources/forms/firsttimewizard.ui index ec55bcd42..5e20b017b 100644 --- a/resources/forms/firsttimewizard.ui +++ b/resources/forms/firsttimewizard.ui @@ -250,10 +250,10 @@ p, li { white-space: pre-wrap; } - 30 - 50 - 441 - 191 + 20 + 0 + 501 + 281 @@ -261,29 +261,28 @@ p, li { white-space: pre-wrap; } - - - - - Sample Songs - - - - - - - Bible XXX (Repeat per bible) - - - - - - - Theme XXX (Repeat per theme) - - - - + + + Qt::ScrollBarAlwaysOff + + + false + + + true + + + QAbstractItemView::NoSelection + + + false + + + + 1 + + + From df3a3cc1334cbe9688b2bb94f377399a0e446cf3 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sun, 27 Feb 2011 17:05:37 +0000 Subject: [PATCH 10/25] Oops missed the wizard --- openlp/core/ui/firsttimewizard.py | 194 ++++++++++++++++++++++++++++++ 1 file changed, 194 insertions(+) create mode 100644 openlp/core/ui/firsttimewizard.py diff --git a/openlp/core/ui/firsttimewizard.py b/openlp/core/ui/firsttimewizard.py new file mode 100644 index 000000000..68aa41285 --- /dev/null +++ b/openlp/core/ui/firsttimewizard.py @@ -0,0 +1,194 @@ +# -*- coding: utf-8 -*- + +# Form implementation generated from reading ui file 'firsttimewizard.ui' +# +# Created: Sun Feb 27 15:02:08 2011 +# by: PyQt4 UI code generator 4.8.3 +# +# WARNING! All changes made in this file will be lost! + +from PyQt4 import QtCore, QtGui + +try: + _fromUtf8 = QtCore.QString.fromUtf8 +except AttributeError: + _fromUtf8 = lambda s: s + +class Ui_FirstTimeWizard(object): + def setupUi(self, FirstTimeWizard): + FirstTimeWizard.setObjectName(_fromUtf8("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(_fromUtf8("")) + self.welcomePage.setSubTitle(_fromUtf8("")) + self.welcomePage.setObjectName(_fromUtf8("welcomePage")) + self.welcomeLayout = QtGui.QHBoxLayout(self.welcomePage) + self.welcomeLayout.setSpacing(8) + self.welcomeLayout.setMargin(0) + self.welcomeLayout.setObjectName(_fromUtf8("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(_fromUtf8("")) + self.importBibleImage.setPixmap(QtGui.QPixmap(_fromUtf8(":/wizards/wizard_importbible.bmp"))) + self.importBibleImage.setIndent(0) + self.importBibleImage.setObjectName(_fromUtf8("importBibleImage")) + self.welcomeLayout.addWidget(self.importBibleImage) + self.welcomePageLayout = QtGui.QVBoxLayout() + self.welcomePageLayout.setSpacing(8) + self.welcomePageLayout.setObjectName(_fromUtf8("welcomePageLayout")) + self.titleLabel = QtGui.QLabel(self.welcomePage) + self.titleLabel.setObjectName(_fromUtf8("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(_fromUtf8("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(_fromUtf8("PluginPagePage")) + self.verticalLayout_2 = QtGui.QVBoxLayout(self.PluginPagePage) + self.verticalLayout_2.setObjectName(_fromUtf8("verticalLayout_2")) + self.verticalLayout = QtGui.QVBoxLayout() + self.verticalLayout.setObjectName(_fromUtf8("verticalLayout")) + self.songsCheckBox = QtGui.QCheckBox(self.PluginPagePage) + self.songsCheckBox.setChecked(True) + self.songsCheckBox.setObjectName(_fromUtf8("songsCheckBox")) + self.verticalLayout.addWidget(self.songsCheckBox) + self.customCheckBox = QtGui.QCheckBox(self.PluginPagePage) + self.customCheckBox.setChecked(True) + self.customCheckBox.setObjectName(_fromUtf8("customCheckBox")) + self.verticalLayout.addWidget(self.customCheckBox) + self.bibleCheckBox = QtGui.QCheckBox(self.PluginPagePage) + self.bibleCheckBox.setChecked(True) + self.bibleCheckBox.setObjectName(_fromUtf8("bibleCheckBox")) + self.verticalLayout.addWidget(self.bibleCheckBox) + self.imageCheckBox = QtGui.QCheckBox(self.PluginPagePage) + self.imageCheckBox.setChecked(True) + self.imageCheckBox.setObjectName(_fromUtf8("imageCheckBox")) + self.verticalLayout.addWidget(self.imageCheckBox) + self.presentationCheckBox = QtGui.QCheckBox(self.PluginPagePage) + self.presentationCheckBox.setChecked(True) + self.presentationCheckBox.setObjectName(_fromUtf8("presentationCheckBox")) + self.verticalLayout.addWidget(self.presentationCheckBox) + self.mediaCheckBox = QtGui.QCheckBox(self.PluginPagePage) + self.mediaCheckBox.setChecked(True) + self.mediaCheckBox.setObjectName(_fromUtf8("mediaCheckBox")) + self.verticalLayout.addWidget(self.mediaCheckBox) + self.remoteCheckBox = QtGui.QCheckBox(self.PluginPagePage) + self.remoteCheckBox.setObjectName(_fromUtf8("remoteCheckBox")) + self.verticalLayout.addWidget(self.remoteCheckBox) + self.songUsageCheckBox = QtGui.QCheckBox(self.PluginPagePage) + self.songUsageCheckBox.setChecked(True) + self.songUsageCheckBox.setObjectName(_fromUtf8("songUsageCheckBox")) + self.verticalLayout.addWidget(self.songUsageCheckBox) + self.alertCheckBox = QtGui.QCheckBox(self.PluginPagePage) + self.alertCheckBox.setChecked(True) + self.alertCheckBox.setObjectName(_fromUtf8("alertCheckBox")) + self.verticalLayout.addWidget(self.alertCheckBox) + self.verticalLayout_2.addLayout(self.verticalLayout) + FirstTimeWizard.addPage(self.PluginPagePage) + self.downloadDefaultsPage = QtGui.QWizardPage() + self.downloadDefaultsPage.setObjectName(_fromUtf8("downloadDefaultsPage")) + self.noInternetLabel = QtGui.QLabel(self.downloadDefaultsPage) + self.noInternetLabel.setGeometry(QtCore.QRect(20, 20, 461, 17)) + self.noInternetLabel.setObjectName(_fromUtf8("noInternetLabel")) + self.internetGroupBox = QtGui.QGroupBox(self.downloadDefaultsPage) + self.internetGroupBox.setGeometry(QtCore.QRect(20, 10, 501, 271)) + self.internetGroupBox.setObjectName(_fromUtf8("internetGroupBox")) + self.verticalLayout_4 = QtGui.QVBoxLayout(self.internetGroupBox) + self.verticalLayout_4.setObjectName(_fromUtf8("verticalLayout_4")) + self.selectionTreeWidget = QtGui.QTreeWidget(self.internetGroupBox) + self.selectionTreeWidget.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) + self.selectionTreeWidget.setProperty(_fromUtf8("showDropIndicator"), False) + self.selectionTreeWidget.setAlternatingRowColors(True) + #self.selectionTreeWidget.setSelectionMode(QtGui.QAbstractItemView.NoSelection) + self.selectionTreeWidget.setObjectName(_fromUtf8("selectionTreeWidget")) + self.selectionTreeWidget.headerItem().setText(0, _fromUtf8("1")) + self.selectionTreeWidget.header().setVisible(False) + self.verticalLayout_4.addWidget(self.selectionTreeWidget) + FirstTimeWizard.addPage(self.downloadDefaultsPage) + self.DefaultsPage = QtGui.QWizardPage() + self.DefaultsPage.setObjectName(_fromUtf8("DefaultsPage")) + self.layoutWidget = QtGui.QWidget(self.DefaultsPage) + self.layoutWidget.setGeometry(QtCore.QRect(20, 20, 491, 113)) + self.layoutWidget.setObjectName(_fromUtf8("layoutWidget")) + self.gridLayout = QtGui.QGridLayout(self.layoutWidget) + self.gridLayout.setMargin(0) + self.gridLayout.setObjectName(_fromUtf8("gridLayout")) + self.displaySelectionLabel = QtGui.QLabel(self.layoutWidget) + self.displaySelectionLabel.setObjectName(_fromUtf8("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(_fromUtf8("displaySelectionComboBox")) + self.gridLayout.addWidget(self.displaySelectionComboBox, 0, 1, 1, 1) + self.themeSelectionLabel = QtGui.QLabel(self.layoutWidget) + self.themeSelectionLabel.setObjectName(_fromUtf8("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(_fromUtf8("themeSelectionComboBox")) + self.gridLayout.addWidget(self.themeSelectionComboBox, 1, 1, 1, 1) + self.languageLabel = QtGui.QLabel(self.layoutWidget) + self.languageLabel.setObjectName(_fromUtf8("languageLabel")) + self.gridLayout.addWidget(self.languageLabel, 3, 0, 1, 1) + self.LanguageComboBox = QtGui.QComboBox(self.layoutWidget) + self.LanguageComboBox.setSizeAdjustPolicy(QtGui.QComboBox.AdjustToContents) + self.LanguageComboBox.setObjectName(_fromUtf8("LanguageComboBox")) + self.gridLayout.addWidget(self.LanguageComboBox, 3, 1, 1, 1) + self.autoLanguageCheckBox = QtGui.QCheckBox(self.layoutWidget) + self.autoLanguageCheckBox.setChecked(True) + self.autoLanguageCheckBox.setObjectName(_fromUtf8("autoLanguageCheckBox")) + self.gridLayout.addWidget(self.autoLanguageCheckBox, 2, 0, 1, 1) + self.label = QtGui.QLabel(self.DefaultsPage) + self.label.setGeometry(QtCore.QRect(40, 190, 471, 17)) + self.label.setObjectName(_fromUtf8("label")) + FirstTimeWizard.addPage(self.DefaultsPage) + + self.retranslateUi(FirstTimeWizard) + QtCore.QMetaObject.connectSlotsByName(FirstTimeWizard) + + def retranslateUi(self, FirstTimeWizard): + FirstTimeWizard.setWindowTitle(QtGui.QApplication.translate("FirstTimeWizard", "First Time Wizard", None, QtGui.QApplication.UnicodeUTF8)) + self.titleLabel.setText(QtGui.QApplication.translate("FirstTimeWizard", "\n" +"\n" +"

Welcome to the First Time Wizard

", None, QtGui.QApplication.UnicodeUTF8)) + self.informationLabel.setText(QtGui.QApplication.translate("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. ", None, QtGui.QApplication.UnicodeUTF8)) + self.PluginPagePage.setTitle(QtGui.QApplication.translate("FirstTimeWizard", "Activate required Plugins", None, QtGui.QApplication.UnicodeUTF8)) + self.PluginPagePage.setSubTitle(QtGui.QApplication.translate("FirstTimeWizard", "Select the Plugins you wish to use. ", None, QtGui.QApplication.UnicodeUTF8)) + self.songsCheckBox.setText(QtGui.QApplication.translate("FirstTimeWizard", "Songs", None, QtGui.QApplication.UnicodeUTF8)) + self.customCheckBox.setText(QtGui.QApplication.translate("FirstTimeWizard", "Custom Text", None, QtGui.QApplication.UnicodeUTF8)) + self.bibleCheckBox.setText(QtGui.QApplication.translate("FirstTimeWizard", "Bible", None, QtGui.QApplication.UnicodeUTF8)) + self.imageCheckBox.setText(QtGui.QApplication.translate("FirstTimeWizard", "Images", None, QtGui.QApplication.UnicodeUTF8)) + self.presentationCheckBox.setText(QtGui.QApplication.translate("FirstTimeWizard", "Presentations", None, QtGui.QApplication.UnicodeUTF8)) + self.mediaCheckBox.setText(QtGui.QApplication.translate("FirstTimeWizard", "Media (Audio and Video)", None, QtGui.QApplication.UnicodeUTF8)) + self.remoteCheckBox.setText(QtGui.QApplication.translate("FirstTimeWizard", "Allow remote access", None, QtGui.QApplication.UnicodeUTF8)) + self.songUsageCheckBox.setText(QtGui.QApplication.translate("FirstTimeWizard", "Monitor Song Usage", None, QtGui.QApplication.UnicodeUTF8)) + self.alertCheckBox.setText(QtGui.QApplication.translate("FirstTimeWizard", "Allow Alerts", None, QtGui.QApplication.UnicodeUTF8)) + self.downloadDefaultsPage.setTitle(QtGui.QApplication.translate("FirstTimeWizard", "Download Samples from OpenLP.org", None, QtGui.QApplication.UnicodeUTF8)) + self.downloadDefaultsPage.setSubTitle(QtGui.QApplication.translate("FirstTimeWizard", "Select samples to downlaod and install for use.", None, QtGui.QApplication.UnicodeUTF8)) + self.noInternetLabel.setText(QtGui.QApplication.translate("FirstTimeWizard", "No Internet connection found so unable to download any default files.", None, QtGui.QApplication.UnicodeUTF8)) + self.internetGroupBox.setTitle(QtGui.QApplication.translate("FirstTimeWizard", "Download Example Files", None, QtGui.QApplication.UnicodeUTF8)) + self.DefaultsPage.setTitle(QtGui.QApplication.translate("FirstTimeWizard", "Default Settings", None, QtGui.QApplication.UnicodeUTF8)) + self.DefaultsPage.setSubTitle(QtGui.QApplication.translate("FirstTimeWizard", "Set up default values to be used by OpenLP", None, QtGui.QApplication.UnicodeUTF8)) + self.displaySelectionLabel.setText(QtGui.QApplication.translate("FirstTimeWizard", "Default output display", None, QtGui.QApplication.UnicodeUTF8)) + self.themeSelectionLabel.setText(QtGui.QApplication.translate("FirstTimeWizard", "Select the default Theme", None, QtGui.QApplication.UnicodeUTF8)) + self.languageLabel.setText(QtGui.QApplication.translate("FirstTimeWizard", "Select default language", None, QtGui.QApplication.UnicodeUTF8)) + self.autoLanguageCheckBox.setText(QtGui.QApplication.translate("FirstTimeWizard", "Auto Language", None, QtGui.QApplication.UnicodeUTF8)) + self.label.setText(QtGui.QApplication.translate("FirstTimeWizard", "Press Finish to apply all you changes and start OpenLP", None, QtGui.QApplication.UnicodeUTF8)) + From a10ad04254766b2588514b3a89fc14c8166e175a Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Wed, 2 Mar 2011 17:44:33 +0000 Subject: [PATCH 11/25] Add first time language dialog --- openlp.pyw | 9 ++- openlp/core/ui/__init__.py | 1 + openlp/core/ui/firsttimeform.py | 24 +------- openlp/core/ui/firsttimelanguagedialog.py | 55 +++++++++++++++++++ openlp/core/ui/firsttimelanguageform.py | 67 +++++++++++++++++++++++ openlp/core/ui/firsttimewizard.py | 13 ----- 6 files changed, 131 insertions(+), 38 deletions(-) create mode 100644 openlp/core/ui/firsttimelanguagedialog.py create mode 100644 openlp/core/ui/firsttimelanguageform.py diff --git a/openlp.pyw b/openlp.pyw index 393a1331b..56626cf48 100755 --- a/openlp.pyw +++ b/openlp.pyw @@ -37,6 +37,7 @@ 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 @@ -275,14 +276,18 @@ def main(): # First time checks in settings if QtCore.QSettings().value( u'general/first time', QtCore.QVariant(True)).toBool(): - FirstTimeForm().exec_() + FirstTimeLanguageForm().exec_() # i18n Set Language language = LanguageManager.get_language() appTranslator = LanguageManager.get_translator(language) app.installTranslator(appTranslator) + # First time checks in settings + if QtCore.QSettings().value( + u'general/first time', QtCore.QVariant(True)).toBool(): + FirstTimeForm().exec_() if not options.no_error_form: sys.excepthook = app.hookException - sys.exit(app.run()) + sys.exit()#(app.run()) if __name__ == u'__main__': """ diff --git a/openlp/core/ui/__init__.py b/openlp/core/ui/__init__.py index a9b46ec9f..485d2adda 100644 --- a/openlp/core/ui/__init__.py +++ b/openlp/core/ui/__init__.py @@ -52,6 +52,7 @@ class HideMode(object): Screen = 3 from firsttimeform import FirstTimeForm +from firsttimelanguageform import FirstTimeLanguageForm from themeform import ThemeForm from filerenameform import FileRenameForm from starttimeform import StartTimeForm diff --git a/openlp/core/ui/firsttimeform.py b/openlp/core/ui/firsttimeform.py index f739b9a81..76f88b8b1 100644 --- a/openlp/core/ui/firsttimeform.py +++ b/openlp/core/ui/firsttimeform.py @@ -31,7 +31,7 @@ from PyQt4 import QtCore, QtGui from firsttimewizard import Ui_FirstTimeWizard from openlp.core.lib import translate, PluginStatus -from openlp.core.utils import get_web_page, LanguageManager +from openlp.core.utils import get_web_page log = logging.getLogger(__name__) @@ -54,9 +54,6 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): self.bibles = bibles.read() QtGui.QWizard.__init__(self, parent) self.setupUi(self) - QtCore.QObject.connect(self.autoLanguageCheckBox, - QtCore.SIGNAL(u'stateChanged(int)'), - self.onAutoLanguageClicked) #self.registerFields() def exec_(self, edit=False): @@ -79,11 +76,6 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): self.internetGroupBox.setVisible(False) self.noInternetLabel.setVisible(True) # Sort out Language settings - self.autoLanguageCheckBox.setChecked(True) - self.LanguageComboBox.setEnabled(False) - self.qmList = LanguageManager.get_qm_list() - for key in sorted(self.qmList.keys()): - self.LanguageComboBox.addItem(key) treewidgetitem = QtGui.QTreeWidgetItem(self.selectionTreeWidget) treewidgetitem.setText(0, u'Songs') self.__loadChild(treewidgetitem, self.songs) @@ -115,22 +107,8 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): self.__pluginStatus(self.customCheckBox, u'custom/status') self.__pluginStatus(self.songUsageCheckBox, u'songusage/status') self.__pluginStatus(self.alertCheckBox, u'alerts/status') - if self.autoLanguageCheckBox.checkState() == QtCore.Qt.Checked: - 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.QWizard.accept(self) - def onAutoLanguageClicked(self, state): - if state == QtCore.Qt.Checked: - self.LanguageComboBox.setEnabled(False) - else: - self.LanguageComboBox.setEnabled(True) - def __pluginStatus(self, field, tag): status = PluginStatus.Active if field.checkState() \ == QtCore.Qt.Checked else PluginStatus.Inactive 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..e3ed16796 --- /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() + 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): + print "Accept" +# if self.autoLanguageCheckBox.checkState() == QtCore.Qt.Checked: +# 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): + print "Reject" + 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 index 68aa41285..e9a1db232 100644 --- a/openlp/core/ui/firsttimewizard.py +++ b/openlp/core/ui/firsttimewizard.py @@ -142,17 +142,6 @@ class Ui_FirstTimeWizard(object): self.themeSelectionComboBox.setSizeAdjustPolicy(QtGui.QComboBox.AdjustToContents) self.themeSelectionComboBox.setObjectName(_fromUtf8("themeSelectionComboBox")) self.gridLayout.addWidget(self.themeSelectionComboBox, 1, 1, 1, 1) - self.languageLabel = QtGui.QLabel(self.layoutWidget) - self.languageLabel.setObjectName(_fromUtf8("languageLabel")) - self.gridLayout.addWidget(self.languageLabel, 3, 0, 1, 1) - self.LanguageComboBox = QtGui.QComboBox(self.layoutWidget) - self.LanguageComboBox.setSizeAdjustPolicy(QtGui.QComboBox.AdjustToContents) - self.LanguageComboBox.setObjectName(_fromUtf8("LanguageComboBox")) - self.gridLayout.addWidget(self.LanguageComboBox, 3, 1, 1, 1) - self.autoLanguageCheckBox = QtGui.QCheckBox(self.layoutWidget) - self.autoLanguageCheckBox.setChecked(True) - self.autoLanguageCheckBox.setObjectName(_fromUtf8("autoLanguageCheckBox")) - self.gridLayout.addWidget(self.autoLanguageCheckBox, 2, 0, 1, 1) self.label = QtGui.QLabel(self.DefaultsPage) self.label.setGeometry(QtCore.QRect(40, 190, 471, 17)) self.label.setObjectName(_fromUtf8("label")) @@ -188,7 +177,5 @@ class Ui_FirstTimeWizard(object): self.DefaultsPage.setSubTitle(QtGui.QApplication.translate("FirstTimeWizard", "Set up default values to be used by OpenLP", None, QtGui.QApplication.UnicodeUTF8)) self.displaySelectionLabel.setText(QtGui.QApplication.translate("FirstTimeWizard", "Default output display", None, QtGui.QApplication.UnicodeUTF8)) self.themeSelectionLabel.setText(QtGui.QApplication.translate("FirstTimeWizard", "Select the default Theme", None, QtGui.QApplication.UnicodeUTF8)) - self.languageLabel.setText(QtGui.QApplication.translate("FirstTimeWizard", "Select default language", None, QtGui.QApplication.UnicodeUTF8)) - self.autoLanguageCheckBox.setText(QtGui.QApplication.translate("FirstTimeWizard", "Auto Language", None, QtGui.QApplication.UnicodeUTF8)) self.label.setText(QtGui.QApplication.translate("FirstTimeWizard", "Press Finish to apply all you changes and start OpenLP", None, QtGui.QApplication.UnicodeUTF8)) From b34726e7901b1abf6ee81d2ffc0a33ae2d9d4dd5 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Wed, 2 Mar 2011 17:53:26 +0000 Subject: [PATCH 12/25] Hook up dialog and get working --- openlp.pyw | 2 +- openlp/core/ui/firsttimelanguageform.py | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/openlp.pyw b/openlp.pyw index 56626cf48..f006002c0 100755 --- a/openlp.pyw +++ b/openlp.pyw @@ -287,7 +287,7 @@ def main(): FirstTimeForm().exec_() if not options.no_error_form: sys.excepthook = app.hookException - sys.exit()#(app.run()) + sys.exit(app.run()) if __name__ == u'__main__': """ diff --git a/openlp/core/ui/firsttimelanguageform.py b/openlp/core/ui/firsttimelanguageform.py index e3ed16796..98489fde7 100644 --- a/openlp/core/ui/firsttimelanguageform.py +++ b/openlp/core/ui/firsttimelanguageform.py @@ -39,6 +39,7 @@ class FirstTimeLanguageForm(QtGui.QDialog, Ui_FirstTimeLanguageDialog): 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) @@ -49,19 +50,18 @@ class FirstTimeLanguageForm(QtGui.QDialog, Ui_FirstTimeLanguageDialog): return QtGui.QDialog.exec_(self) def accept(self): - print "Accept" -# if self.autoLanguageCheckBox.checkState() == QtCore.Qt.Checked: -# 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) + # 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): - print "Reject" LanguageManager.auto_language = True LanguageManager.set_language(False, False) return QtGui.QDialog.reject(self) From 3369f4ff09be71346492e1b641da3b4576a25045 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Wed, 2 Mar 2011 19:01:18 +0000 Subject: [PATCH 13/25] Add web configuration --- openlp.pyw | 2 +- openlp/core/ui/firsttimeform.py | 44 ++++++++++++++++----------------- 2 files changed, 22 insertions(+), 24 deletions(-) diff --git a/openlp.pyw b/openlp.pyw index f006002c0..56626cf48 100755 --- a/openlp.pyw +++ b/openlp.pyw @@ -287,7 +287,7 @@ def main(): FirstTimeForm().exec_() if not options.no_error_form: sys.excepthook = app.hookException - sys.exit(app.run()) + sys.exit()#(app.run()) if __name__ == u'__main__': """ diff --git a/openlp/core/ui/firsttimeform.py b/openlp/core/ui/firsttimeform.py index 76f88b8b1..b4921bdc9 100644 --- a/openlp/core/ui/firsttimeform.py +++ b/openlp/core/ui/firsttimeform.py @@ -24,6 +24,8 @@ # Temple Place, Suite 330, Boston, MA 02111-1307 USA # ############################################################################### +import ConfigParser +import io import logging from PyQt4 import QtCore, QtGui @@ -44,14 +46,11 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): def __init__(self, parent=None): # check to see if we have web access - self.webAccess = get_web_page(u'http://openlp.org/files/frw/themes.lst') - print self.webAccess + self.config = ConfigParser.ConfigParser() + self.webAccess = get_web_page(u'http://openlp.org/files/frw/download.cfg') if self.webAccess: - self.themes = self.webAccess.read() - songs = get_web_page(u'http://openlp.org/files/frw/songs.lst') - self.songs = songs.read() - bibles = get_web_page(u'http://openlp.org/files/frw/bibles.lst') - self.bibles = bibles.read() + files = self.webAccess.read() + self.config.readfp(io.BytesIO(files)) QtGui.QWizard.__init__(self, parent) self.setupUi(self) #self.registerFields() @@ -72,30 +71,29 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): if self.webAccess: self.internetGroupBox.setVisible(True) self.noInternetLabel.setVisible(False) + treewidgetitem = QtGui.QTreeWidgetItem(self.selectionTreeWidget) + treewidgetitem.setText(0, u'Songs') + self.__loadChild(treewidgetitem, u'songs', u'languages', u'songs') + treewidgetitem = QtGui.QTreeWidgetItem(self.selectionTreeWidget) + treewidgetitem.setText(0, u'Bibles') + self.__loadChild(treewidgetitem, u'bibles', u'translations', u'bible') + treewidgetitem = QtGui.QTreeWidgetItem(self.selectionTreeWidget) + treewidgetitem.setText(0, u'Themes') + self.__loadChild(treewidgetitem, u'themes', u'files', 'theme') else: self.internetGroupBox.setVisible(False) self.noInternetLabel.setVisible(True) - # Sort out Language settings - treewidgetitem = QtGui.QTreeWidgetItem(self.selectionTreeWidget) - treewidgetitem.setText(0, u'Songs') - self.__loadChild(treewidgetitem, self.songs) - treewidgetitem = QtGui.QTreeWidgetItem(self.selectionTreeWidget) - treewidgetitem.setText(0, u'Bibles') - self.__loadChild(treewidgetitem, self.bibles) - treewidgetitem = QtGui.QTreeWidgetItem(self.selectionTreeWidget) - treewidgetitem.setText(0, u'Themes') - self.__loadChild(treewidgetitem, self.themes) - def __loadChild(self, tree, list): - list = list.split(u'\n') - for item in list: - if item: + 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, item) + child.setText(0, self.config.get(u'%s_%s' %(root, file), u'title')) child.setCheckState(0, QtCore.Qt.Unchecked) child.setFlags(QtCore.Qt.ItemIsUserCheckable | QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled) - #self.themeSelectionComboBox.addItem(theme) def accept(self): self.__pluginStatus(self.songsCheckBox, u'songs/status') From b09b36da8ee67e004057256599feb53934e31d70 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Wed, 2 Mar 2011 21:47:55 +0000 Subject: [PATCH 14/25] Move theme to default selection --- openlp/core/ui/firsttimeform.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/openlp/core/ui/firsttimeform.py b/openlp/core/ui/firsttimeform.py index b4921bdc9..baf4624d6 100644 --- a/openlp/core/ui/firsttimeform.py +++ b/openlp/core/ui/firsttimeform.py @@ -91,10 +91,26 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): 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)) == u'Themes': + self.themeSelectionComboBox.addItem(listIterator.value().text(0)) + listIterator += 1 + def accept(self): self.__pluginStatus(self.songsCheckBox, u'songs/status') self.__pluginStatus(self.bibleCheckBox, u'bibles/status') @@ -105,6 +121,17 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): self.__pluginStatus(self.customCheckBox, u'custom/status') self.__pluginStatus(self.songUsageCheckBox, u'songusage/status') self.__pluginStatus(self.alertCheckBox, u'alerts/status') + + 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 + print type, listIterator.value().data(0, QtCore.Qt.UserRole).toString() + #if type == u'Themes': + #self.themeSelectionComboBox.addItem(listIterator.value().text()) + listIterator += 1 return QtGui.QWizard.accept(self) def __pluginStatus(self, field, tag): From 4927bad4d2e244da4418ba32cb021c86ff0cdd4f Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Fri, 4 Mar 2011 18:22:44 +0000 Subject: [PATCH 15/25] Start updates --- openlp/core/ui/firsttimeform.py | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/openlp/core/ui/firsttimeform.py b/openlp/core/ui/firsttimeform.py index baf4624d6..7fcf4596b 100644 --- a/openlp/core/ui/firsttimeform.py +++ b/openlp/core/ui/firsttimeform.py @@ -27,13 +27,15 @@ 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 -from openlp.core.utils import get_web_page +from openlp.core.lib import translate, PluginStatus, check_directory_exists +from openlp.core.utils import get_web_page, AppLocation log = logging.getLogger(__name__) @@ -46,8 +48,9 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): def __init__(self, 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'http://openlp.org/files/frw/download.cfg') + 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)) @@ -123,14 +126,27 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): self.__pluginStatus(self.alertCheckBox, u'alerts/status') listIterator = QtGui.QTreeWidgetItemIterator(self.selectionTreeWidget) + 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) while listIterator.value(): type = listIterator.value().parent() if listIterator.value().parent(): if listIterator.value().checkState(0) == QtCore.Qt.Checked: # Install - print type, listIterator.value().data(0, QtCore.Qt.UserRole).toString() - #if type == u'Themes': - #self.themeSelectionComboBox.addItem(listIterator.value().text()) + if unicode(type.text(0)) == u'Bibles': + theme = unicode(listIterator.value().data(0, + QtCore.Qt.UserRole).toString()) + urllib.urlretrieve(u'%s%s' % (self.web, theme), + os.path.join(bibleDestination, theme)) + if unicode(type.text(0)) == u'Themes': + theme = unicode(listIterator.value().data(0, + QtCore.Qt.UserRole).toString()) + urllib.urlretrieve(u'%s%s' % (self.web, theme), + os.path.join(themeDestination, theme)) listIterator += 1 return QtGui.QWizard.accept(self) From cb661bf1ce912407247e649d4593024ec81ce18c Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sat, 5 Mar 2011 09:23:47 +0000 Subject: [PATCH 16/25] bibles and themes work --- openlp.pyw | 30 +++++++++-------- openlp/core/ui/firsttimeform.py | 54 ++++++++++++++++++++++--------- openlp/core/ui/firsttimewizard.py | 13 +++++--- openlp/core/ui/mainwindow.py | 5 ++- openlp/core/ui/thememanager.py | 18 +++++++++++ 5 files changed, 85 insertions(+), 35 deletions(-) diff --git a/openlp.pyw b/openlp.pyw index 650c00725..76c263ea5 100755 --- a/openlp.pyw +++ b/openlp.pyw @@ -151,7 +151,7 @@ class OpenLP(QtGui.QApplication): log.info(u'Openlp version %s' % app_version[u'version']) return app_version - def run(self, screens): + def run(self): """ Run the OpenLP application. """ @@ -167,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( @@ -178,7 +185,8 @@ class OpenLP(QtGui.QApplication): self.processEvents() # 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 @@ -265,11 +273,11 @@ def main(): # Define the settings environment QtCore.QSettings(u'OpenLP', u'OpenLP') # First time checks in settings - if QtCore.QSettings().value( - u'general/first time', QtCore.QVariant(True)).toBool(): - if not FirstTimeLanguageForm().exec_(): - # if cancel then stop processing - sys.exit() +# if QtCore.QSettings().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") @@ -277,15 +285,9 @@ def main(): language = LanguageManager.get_language() appTranslator = LanguageManager.get_translator(language) app.installTranslator(appTranslator) - # Decide how many screens we have and their size - screens = ScreenList(app.desktop()) - # First time checks in settings - if QtCore.QSettings().value( - u'general/first time', QtCore.QVariant(True)).toBool(): - FirstTimeForm(screens).exec_() if not options.no_error_form: sys.excepthook = app.hookException - sys.exit()#(app.run(screens)) + sys.exit(app.run()) if __name__ == u'__main__': """ diff --git a/openlp/core/ui/firsttimeform.py b/openlp/core/ui/firsttimeform.py index 4c2c699b6..df21b93d5 100644 --- a/openlp/core/ui/firsttimeform.py +++ b/openlp/core/ui/firsttimeform.py @@ -34,7 +34,7 @@ from PyQt4 import QtCore, QtGui from firsttimewizard import Ui_FirstTimeWizard -from openlp.core.lib import translate, PluginStatus, check_directory_exists +from openlp.core.lib import translate, PluginStatus, check_directory_exists, Receiver from openlp.core.utils import get_web_page, AppLocation log = logging.getLogger(__name__) @@ -58,6 +58,17 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): 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): """ @@ -76,13 +87,13 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): self.internetGroupBox.setVisible(True) self.noInternetLabel.setVisible(False) treewidgetitem = QtGui.QTreeWidgetItem(self.selectionTreeWidget) - treewidgetitem.setText(0, u'Songs') + treewidgetitem.setText(0, self.songsText) self.__loadChild(treewidgetitem, u'songs', u'languages', u'songs') treewidgetitem = QtGui.QTreeWidgetItem(self.selectionTreeWidget) - treewidgetitem.setText(0, u'Bibles') + treewidgetitem.setText(0, self.biblesText) self.__loadChild(treewidgetitem, u'bibles', u'translations', u'bible') treewidgetitem = QtGui.QTreeWidgetItem(self.selectionTreeWidget) - treewidgetitem.setText(0, u'Themes') + treewidgetitem.setText(0, self.themesText) self.__loadChild(treewidgetitem, u'themes', u'files', 'theme') else: self.internetGroupBox.setVisible(False) @@ -94,9 +105,11 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): for file in files: if file: child = QtGui.QTreeWidgetItem(tree) - child.setText(0, self.config.get(u'%s_%s' %(root, file), u'title')) + 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'))) + 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) @@ -107,15 +120,18 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): """ wizardPage = self.page(id) if wizardPage == self.DefaultsPage: - listIterator = QtGui.QTreeWidgetItemIterator(self.selectionTreeWidget) + 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)) == u'Themes': + 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) self.__pluginStatus(self.songsCheckBox, u'songs/status') self.__pluginStatus(self.bibleCheckBox, u'bibles/status') self.__pluginStatus(self.presentationCheckBox, u'presentations/status') @@ -138,14 +154,18 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): if listIterator.value().parent(): if listIterator.value().checkState(0) == QtCore.Qt.Checked: # Install - if unicode(type.text(0)) == u'Bibles': - theme = unicode(listIterator.value().data(0, - QtCore.Qt.UserRole).toString()) - urllib.urlretrieve(u'%s%s' % (self.web, theme), - os.path.join(bibleDestination, theme)) - if unicode(type.text(0)) == u'Themes': + if unicode(type.text(0)) == self.biblesText: + bible = unicode(listIterator.value().data(0, + QtCore.Qt.UserRole).toString()) + message = u'%s %s' % (self.downloadBible, bible) + self.__updateMessage(message) + urllib.urlretrieve(u'%s%s' % (self.web, bible), + os.path.join(bibleDestination, bible)) + if unicode(type.text(0)) == self.themesText: theme = unicode(listIterator.value().data(0, QtCore.Qt.UserRole).toString()) + message = u'%s %s' % (self.downloadTheme, bible) + self.__updateMessage(message) urllib.urlretrieve(u'%s%s' % (self.web, theme), os.path.join(themeDestination, theme)) listIterator += 1 @@ -155,3 +175,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): status = PluginStatus.Active if field.checkState() \ == QtCore.Qt.Checked else PluginStatus.Inactive QtCore.QSettings().setValue(tag, QtCore.QVariant(status)) + + def __updateMessage(self, text): + self.updateLabel.setText(text) + Receiver.send_message(u'openlp_process_events') diff --git a/openlp/core/ui/firsttimewizard.py b/openlp/core/ui/firsttimewizard.py index 70805bfea..081ac9991 100644 --- a/openlp/core/ui/firsttimewizard.py +++ b/openlp/core/ui/firsttimewizard.py @@ -163,13 +163,16 @@ class Ui_FirstTimeWizard(object): QtGui.QComboBox.AdjustToContents) self.themeSelectionComboBox.setObjectName(u'themeSelectionComboBox') self.gridLayout.addWidget(self.themeSelectionComboBox, 1, 1, 1, 1) - self.label = QtGui.QLabel(self.DefaultsPage) - self.label.setGeometry(QtCore.QRect(40, 190, 471, 17)) - self.label.setObjectName(u'label') + 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(OpenLP.FirstTimeWizard) + QtCore.QMetaObject.connectSlotsByName(FirstTimeWizard) def retranslateUi(self, FirstTimeWizard): FirstTimeWizard.setWindowTitle(translate( @@ -220,5 +223,5 @@ class Ui_FirstTimeWizard(object): 'Default output display')) self.themeSelectionLabel.setText(translate('OpenLP.FirstTimeWizard', 'Select the default Theme')) - self.label.setText(translate('OpenLP.FirstTimeWizard', + self.messageLabel.setText(translate('OpenLP.FirstTimeWizard', 'Press Finish to apply all you changes and start OpenLP')) diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index 7a67331ad..d7d6a89f9 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -461,7 +461,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. @@ -626,6 +626,9 @@ 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/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): """ From 1e0ca83729d78355c3f86c88dc56d5f36246f232 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sat, 5 Mar 2011 14:17:32 +0000 Subject: [PATCH 17/25] Open up again --- openlp.pyw | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openlp.pyw b/openlp.pyw index 76c263ea5..ee5d9691a 100755 --- a/openlp.pyw +++ b/openlp.pyw @@ -172,8 +172,8 @@ class OpenLP(QtGui.QApplication): # First time checks in settings firstTime = QtCore.QSettings().value( u'general/first time', QtCore.QVariant(True)).toBool() -# if firstTime: -# FirstTimeForm(screens).exec_() + if firstTime: + FirstTimeForm(screens).exec_() if os.name == u'nt': self.setStyleSheet(application_stylesheet) show_splash = QtCore.QSettings().value( From cf0a970184ff9988b557e62cdf41aab02cc7d821 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sun, 6 Mar 2011 13:44:35 +0000 Subject: [PATCH 18/25] Tidy ups --- openlp.pyw | 11 ++++---- openlp/core/ui/firsttimeform.py | 47 +++++++++++++++++++++++++++------ openlp/core/ui/mainwindow.py | 4 +-- 3 files changed, 47 insertions(+), 15 deletions(-) diff --git a/openlp.pyw b/openlp.pyw index ee5d9691a..39719a80e 100755 --- a/openlp.pyw +++ b/openlp.pyw @@ -273,11 +273,12 @@ def main(): # Define the settings environment QtCore.QSettings(u'OpenLP', u'OpenLP') # First time checks in settings -# if QtCore.QSettings().value( -# u'general/first time', QtCore.QVariant(True)).toBool(): -# if not FirstTimeLanguageForm().exec_(): -# # if cancel then stop processing -# sys.exit() + # 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") diff --git a/openlp/core/ui/firsttimeform.py b/openlp/core/ui/firsttimeform.py index df21b93d5..cd3a1754e 100644 --- a/openlp/core/ui/firsttimeform.py +++ b/openlp/core/ui/firsttimeform.py @@ -34,7 +34,8 @@ from PyQt4 import QtCore, QtGui from firsttimewizard import Ui_FirstTimeWizard -from openlp.core.lib import translate, PluginStatus, check_directory_exists, Receiver +from openlp.core.lib import translate, PluginStatus, check_directory_exists, \ + Receiver from openlp.core.utils import get_web_page, AppLocation log = logging.getLogger(__name__) @@ -91,7 +92,8 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): 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') + 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') @@ -127,11 +129,13 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): if parent and listIterator.value().checkState(0) \ == QtCore.Qt.Checked: if unicode(parent.text(0)) == self.themesText: - self.themeSelectionComboBox.addItem(listIterator.value().text(0)) + 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') @@ -141,34 +145,58 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): self.__pluginStatus(self.customCheckBox, u'custom/status') self.__pluginStatus(self.songUsageCheckBox, u'songusage/status') self.__pluginStatus(self.alertCheckBox, u'alerts/status') - - listIterator = QtGui.QTreeWidgetItemIterator(self.selectionTreeWidget) + # 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 + # 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, bible) + 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, bible) + 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): @@ -177,5 +205,8 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): 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/mainwindow.py b/openlp/core/ui/mainwindow.py index bd5e45193..229394247 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -627,8 +627,8 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): self.settingsForm.postSetUp() Receiver.send_message(u'cursor_normal') # Import themes if first time -# if firstTime: -# self.themeManagerContents.firstTime() + if firstTime: + self.themeManagerContents.firstTime() def setAutoLanguage(self, value): self.LanguageGroup.setDisabled(value) From ff61f14bdebd081f824b645f2f1602d00e65b35c Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sun, 6 Mar 2011 14:15:35 +0000 Subject: [PATCH 19/25] Fix Language setting for first time --- openlp/core/ui/mainwindow.py | 2 ++ openlp/core/utils/languagemanager.py | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index 229394247..bec6d03e4 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -629,6 +629,8 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): # Import themes if first time if firstTime: self.themeManagerContents.firstTime() + self.themeManagerContents.firstTime() + def setAutoLanguage(self, value): self.LanguageGroup.setDisabled(value) diff --git a/openlp/core/utils/languagemanager.py b/openlp/core/utils/languagemanager.py index ebc9b4575..9cadf06e2 100644 --- a/openlp/core/utils/languagemanager.py +++ b/openlp/core/utils/languagemanager.py @@ -89,7 +89,8 @@ class LanguageManager(object): """ Retrieve a saved language to use from settings """ - language = unicode(QtCore.QSettings().value( + settings = QtCore.QSettings(u'OpenLP', u'OpenLP') + language = unicode(settings.value( u'general/language', QtCore.QVariant(u'[en]')).toString()) log.info(u'Language file: \'%s\' Loaded from conf file' % language) reg_ex = QtCore.QRegExp("^\[(.*)\]") From 47b72badda6700bf0411cac045d336b264874ad3 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sun, 6 Mar 2011 19:25:35 +0000 Subject: [PATCH 20/25] Merge fixes --- openlp/core/ui/firsttimeform.py | 46 ++++++++++++++++----------------- openlp/core/ui/mainwindow.py | 1 - 2 files changed, 23 insertions(+), 24 deletions(-) diff --git a/openlp/core/ui/firsttimeform.py b/openlp/core/ui/firsttimeform.py index cd3a1754e..3e7993c80 100644 --- a/openlp/core/ui/firsttimeform.py +++ b/openlp/core/ui/firsttimeform.py @@ -38,7 +38,7 @@ from openlp.core.lib import translate, PluginStatus, check_directory_exists, \ Receiver from openlp.core.utils import get_web_page, AppLocation -log = logging.getLogger(__name__) +log = logging.getLogger(_name_) class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): """ @@ -47,7 +47,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): """ log.info(u'ThemeWizardForm loaded') - def __init__(self, screens, parent=None): + 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() @@ -55,7 +55,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): if self.webAccess: files = self.webAccess.read() self.config.readfp(io.BytesIO(files)) - QtGui.QWizard.__init__(self, parent) + QtGui.QWizard._init_(self, parent) self.setupUi(self) for screen in screens.get_screen_list(): self.displaySelectionComboBox.addItem(screen) @@ -65,7 +65,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): self.startUpdates = translate('OpenLP.FirstTimeWizard', 'Starting Updates') self.downloadSongs = unicode(translate('OpenLP.FirstTimeWizard', - 'Downloading Songs.')) + 'Downloading songs')) self.downloadBible = unicode(translate('OpenLP.FirstTimeWizard', 'Downloading bible')) self.downloadTheme = unicode(translate('OpenLP.FirstTimeWizard', @@ -89,19 +89,19 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): self.noInternetLabel.setVisible(False) treewidgetitem = QtGui.QTreeWidgetItem(self.selectionTreeWidget) treewidgetitem.setText(0, self.songsText) - self.__loadChild(treewidgetitem, u'songs', u'languages', u'songs') + 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', + 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') + self._loadChild(treewidgetitem, u'themes', u'files', 'theme') else: self.internetGroupBox.setVisible(False) self.noInternetLabel.setVisible(True) - def __loadChild(self, tree, list, tag, root): + def _loadChild(self, tree, list, tag, root): files = self.config.get(list, tag) files = files.split(u',') for file in files: @@ -134,17 +134,17 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): listIterator += 1 def accept(self): - self.__updateMessage(self.startUpdates) + 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') + 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) @@ -165,7 +165,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): songs = unicode(listIterator.value().data(0, QtCore.Qt.UserRole).toString()) message = u'%s %s' % (self.downloadSongs, item) - self.__updateMessage(message) + 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')) @@ -174,7 +174,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): bible = unicode(listIterator.value().data(0, QtCore.Qt.UserRole).toString()) message = u'%s %s' % (self.downloadBible, item) - self.__updateMessage(message) + self._updateMessage(message) urllib.urlretrieve(u'%s%s' % (self.web, bible), os.path.join(bibleDestination, bible)) # Download any themes @@ -182,7 +182,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): theme = unicode(listIterator.value().data(0, QtCore.Qt.UserRole).toString()) message = u'%s %s' % (self.downloadTheme, item) - self.__updateMessage(message) + self._updateMessage(message) urllib.urlretrieve(u'%s%s' % (self.web, theme), os.path.join(themeDestination, theme)) listIterator += 1 @@ -199,12 +199,12 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): QtCore.QVariant(False)) return QtGui.QWizard.accept(self) - def __pluginStatus(self, field, tag): + 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): + def _updateMessage(self, text): """ Keep screen up to date """ diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index bec6d03e4..bb35936d5 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -629,7 +629,6 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): # Import themes if first time if firstTime: self.themeManagerContents.firstTime() - self.themeManagerContents.firstTime() def setAutoLanguage(self, value): From 3b9adbb1db343b5d3f99d50d70d96fa2923434e8 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sun, 6 Mar 2011 19:44:33 +0000 Subject: [PATCH 21/25] Merge fixes 2 --- openlp/core/ui/firsttimeform.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/openlp/core/ui/firsttimeform.py b/openlp/core/ui/firsttimeform.py index 3e7993c80..7da2ff0b3 100644 --- a/openlp/core/ui/firsttimeform.py +++ b/openlp/core/ui/firsttimeform.py @@ -38,7 +38,7 @@ from openlp.core.lib import translate, PluginStatus, check_directory_exists, \ Receiver from openlp.core.utils import get_web_page, AppLocation -log = logging.getLogger(_name_) +log = logging.getLogger(__name__) class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): """ @@ -47,7 +47,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): """ log.info(u'ThemeWizardForm loaded') - def _init_(self, screens, parent=None): + 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() @@ -55,7 +55,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): if self.webAccess: files = self.webAccess.read() self.config.readfp(io.BytesIO(files)) - QtGui.QWizard._init_(self, parent) + QtGui.QWizard.__init__(self, parent) self.setupUi(self) for screen in screens.get_screen_list(): self.displaySelectionComboBox.addItem(screen) @@ -65,11 +65,11 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): self.startUpdates = translate('OpenLP.FirstTimeWizard', 'Starting Updates') self.downloadSongs = unicode(translate('OpenLP.FirstTimeWizard', - 'Downloading songs')) + 'Downloading songs: %s')) self.downloadBible = unicode(translate('OpenLP.FirstTimeWizard', - 'Downloading bible')) + 'Downloading bible: %s')) self.downloadTheme = unicode(translate('OpenLP.FirstTimeWizard', - 'Downloading theme')) + 'Downloading theme: %s')) def exec_(self, edit=False): """ @@ -164,7 +164,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): if unicode(type.text(0)) == self.songsText: songs = unicode(listIterator.value().data(0, QtCore.Qt.UserRole).toString()) - message = u'%s %s' % (self.downloadSongs, item) + message = self.downloadSongs % item self._updateMessage(message) # Song database is a fixed file name urllib.urlretrieve(u'%s%s' % (self.web, songs), @@ -173,7 +173,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): if unicode(type.text(0)) == self.biblesText: bible = unicode(listIterator.value().data(0, QtCore.Qt.UserRole).toString()) - message = u'%s %s' % (self.downloadBible, item) + message = self.downloadBible % item self._updateMessage(message) urllib.urlretrieve(u'%s%s' % (self.web, bible), os.path.join(bibleDestination, bible)) @@ -181,7 +181,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): if unicode(type.text(0)) == self.themesText: theme = unicode(listIterator.value().data(0, QtCore.Qt.UserRole).toString()) - message = u'%s %s' % (self.downloadTheme, item) + message = self.downloadTheme % item self._updateMessage(message) urllib.urlretrieve(u'%s%s' % (self.web, theme), os.path.join(themeDestination, theme)) From f1f6c6bd3e22c41d96034aa619184c86fbdd7d54 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sun, 6 Mar 2011 20:09:03 +0000 Subject: [PATCH 22/25] Merge fixes 3 --- openlp/core/ui/firsttimeform.py | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/openlp/core/ui/firsttimeform.py b/openlp/core/ui/firsttimeform.py index 7da2ff0b3..e1dd31778 100644 --- a/openlp/core/ui/firsttimeform.py +++ b/openlp/core/ui/firsttimeform.py @@ -64,12 +64,8 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): self.themesText = translate('OpenLP.FirstTimeWizard', 'Themes') self.startUpdates = translate('OpenLP.FirstTimeWizard', 'Starting Updates') - self.downloadSongs = unicode(translate('OpenLP.FirstTimeWizard', - 'Downloading songs: %s')) - self.downloadBible = unicode(translate('OpenLP.FirstTimeWizard', - 'Downloading bible: %s')) - self.downloadTheme = unicode(translate('OpenLP.FirstTimeWizard', - 'Downloading theme: %s')) + self.downloading = unicode(translate('OpenLP.FirstTimeWizard', + 'Downloading %s')) def exec_(self, edit=False): """ @@ -164,7 +160,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): if unicode(type.text(0)) == self.songsText: songs = unicode(listIterator.value().data(0, QtCore.Qt.UserRole).toString()) - message = self.downloadSongs % item + message = self.downloading % item self._updateMessage(message) # Song database is a fixed file name urllib.urlretrieve(u'%s%s' % (self.web, songs), @@ -173,7 +169,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): if unicode(type.text(0)) == self.biblesText: bible = unicode(listIterator.value().data(0, QtCore.Qt.UserRole).toString()) - message = self.downloadBible % item + message = self.downloading % item self._updateMessage(message) urllib.urlretrieve(u'%s%s' % (self.web, bible), os.path.join(bibleDestination, bible)) @@ -181,7 +177,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): if unicode(type.text(0)) == self.themesText: theme = unicode(listIterator.value().data(0, QtCore.Qt.UserRole).toString()) - message = self.downloadTheme % item + message = self.downloading % item self._updateMessage(message) urllib.urlretrieve(u'%s%s' % (self.web, theme), os.path.join(themeDestination, theme)) From faa0d2740a74e0885a0ad231ebdc8facf3dba821 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Mon, 7 Mar 2011 17:38:04 +0000 Subject: [PATCH 23/25] Stop song database overwrite --- openlp/core/ui/firsttimeform.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/openlp/core/ui/firsttimeform.py b/openlp/core/ui/firsttimeform.py index e1dd31778..fb2a0a3fe 100644 --- a/openlp/core/ui/firsttimeform.py +++ b/openlp/core/ui/firsttimeform.py @@ -83,9 +83,13 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): 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') + # 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', From e535c4e04022d74d8951cbd79c07ea8d9b3d17e1 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Mon, 7 Mar 2011 19:04:40 +0100 Subject: [PATCH 24/25] fixed Bug #727710 Fixes: https://launchpad.net/bugs/727710 --- openlp/core/ui/maindisplay.py | 15 ++++++++++----- openlp/core/ui/slidecontroller.py | 2 +- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/openlp/core/ui/maindisplay.py b/openlp/core/ui/maindisplay.py index f8bd99b81..4a12ca05e 100644 --- a/openlp/core/ui/maindisplay.py +++ b/openlp/core/ui/maindisplay.py @@ -245,7 +245,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 +260,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 +278,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 +350,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 +485,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/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) From 80f4c67daad5febbf929d6831a6a55e7485f19f2 Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Tue, 8 Mar 2011 08:52:01 +0200 Subject: [PATCH 25/25] Added an initial Gentoo ebuild file. --- resources/gentoo/openlp-1.9.4.ebuild | 30 ++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 resources/gentoo/openlp-1.9.4.ebuild 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