Start of Langauges

This commit is contained in:
Tim Bentley 2011-02-26 20:52:26 +00:00
parent 88fefe5582
commit 289ce0de5f
3 changed files with 73 additions and 59 deletions

View File

@ -151,10 +151,6 @@ class OpenLP(QtGui.QApplication):
log.info(u'Openlp version %s' % app_version[u'version']) log.info(u'Openlp version %s' % app_version[u'version'])
return app_version return app_version
# def notify(self, obj, evt):
# #TODO needed for presentation exceptions
# return QtGui.QApplication.notify(self, obj, evt)
def run(self): def run(self):
""" """
Run the OpenLP application. Run the OpenLP application.
@ -173,13 +169,6 @@ class OpenLP(QtGui.QApplication):
self.setApplicationVersion(app_version[u'version']) self.setApplicationVersion(app_version[u'version'])
if os.name == u'nt': if os.name == u'nt':
self.setStyleSheet(application_stylesheet) 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( show_splash = QtCore.QSettings().value(
u'general/show splash', QtCore.QVariant(True)).toBool() u'general/show splash', QtCore.QVariant(True)).toBool()
if show_splash: if show_splash:
@ -210,17 +199,13 @@ class OpenLP(QtGui.QApplication):
return self.exec_() return self.exec_()
def hookException(self, exctype, value, traceback): def hookException(self, exctype, value, traceback):
print "a"
if not hasattr(self, u'mainWindow'): if not hasattr(self, u'mainWindow'):
log.exception(''.join(format_exception(exctype, value, traceback))) log.exception(''.join(format_exception(exctype, value, traceback)))
return return
print "b"
if not hasattr(self, u'exceptionForm'): if not hasattr(self, u'exceptionForm'):
self.exceptionForm = ExceptionForm(self.mainWindow) self.exceptionForm = ExceptionForm(self.mainWindow)
print "c"
self.exceptionForm.exceptionTextEdit.setPlainText( self.exceptionForm.exceptionTextEdit.setPlainText(
''.join(format_exception(exctype, value, traceback))) ''.join(format_exception(exctype, value, traceback)))
print "d"
self.setNormalCursor() self.setNormalCursor()
self.exceptionForm.exec_() self.exceptionForm.exec_()
@ -287,6 +272,10 @@ def main():
app = OpenLP(qt_args) app = OpenLP(qt_args)
# Define the settings environment # Define the settings environment
QtCore.QSettings(u'OpenLP', u'OpenLP') 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 # i18n Set Language
language = LanguageManager.get_language() language = LanguageManager.get_language()
appTranslator = LanguageManager.get_translator(language) appTranslator = LanguageManager.get_translator(language)

View File

@ -31,7 +31,7 @@ from PyQt4 import QtCore, QtGui
from firsttimewizard import Ui_FirstTimeWizard from firsttimewizard import Ui_FirstTimeWizard
from openlp.core.lib import translate, PluginStatus 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__) log = logging.getLogger(__name__)
@ -44,12 +44,35 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
def __init__(self, parent=None): def __init__(self, parent=None):
# check to see if we have web access # 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.org1')
print self.WebAccess print self.webAccess
QtGui.QWizard.__init__(self, parent) QtGui.QWizard.__init__(self, parent)
self.setupUi(self) self.setupUi(self)
#self.registerFields() #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): def accept(self):
self.__pluginStatus(self.songsCheckBox, u'songs/status') self.__pluginStatus(self.songsCheckBox, u'songs/status')
self.__pluginStatus(self.bibleCheckBox, u'bibles/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.remoteCheckBox, u'remote/status')
self.__pluginStatus(self.customCheckBox, u'custom/status') self.__pluginStatus(self.customCheckBox, u'custom/status')
self.__pluginStatus(self.songUsageCheckBox, u'songusage/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) return QtGui.QWizard.accept(self)
def __pluginStatus(self, field, tag): def __pluginStatus(self, field, tag):

View File

@ -199,7 +199,7 @@ p, li { white-space: pre-wrap; }
<item> <item>
<widget class="QCheckBox" name="remoteCheckBox"> <widget class="QCheckBox" name="remoteCheckBox">
<property name="text"> <property name="text">
<string>Remote Control</string> <string>Allow remote access</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -213,6 +213,16 @@ p, li { white-space: pre-wrap; }
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="QCheckBox" name="alertCheckBox">
<property name="text">
<string>Allow Alerts</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
</layout> </layout>
</item> </item>
</layout> </layout>
@ -229,12 +239,12 @@ p, li { white-space: pre-wrap; }
<rect> <rect>
<x>20</x> <x>20</x>
<y>20</y> <y>20</y>
<width>416</width> <width>461</width>
<height>17</height> <height>17</height>
</rect> </rect>
</property> </property>
<property name="text"> <property name="text">
<string>No Internet connection found so unable to download any defaults</string> <string>No Internet connection found so unable to download any default files.</string>
</property> </property>
</widget> </widget>
<widget class="QGroupBox" name="internetGroupBox"> <widget class="QGroupBox" name="internetGroupBox">
@ -247,7 +257,7 @@ p, li { white-space: pre-wrap; }
</rect> </rect>
</property> </property>
<property name="title"> <property name="title">
<string>Download Samples</string> <string>Download Example Files</string>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_4"> <layout class="QVBoxLayout" name="verticalLayout_4">
<item> <item>
@ -280,18 +290,18 @@ p, li { white-space: pre-wrap; }
</widget> </widget>
<widget class="QWizardPage" name="DefaultsPage"> <widget class="QWizardPage" name="DefaultsPage">
<property name="title"> <property name="title">
<string>Configure Settings</string> <string>Default Settings</string>
</property> </property>
<property name="subTitle"> <property name="subTitle">
<string>Configure the initial value for settings</string> <string>Set up default values to be used by OpenLP</string>
</property> </property>
<widget class="QWidget" name=""> <widget class="QWidget" name="layoutWidget">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>20</x> <x>20</x>
<y>20</y> <y>20</y>
<width>252</width> <width>252</width>
<height>58</height> <height>88</height>
</rect> </rect>
</property> </property>
<layout class="QGridLayout" name="gridLayout"> <layout class="QGridLayout" name="gridLayout">
@ -329,45 +339,35 @@ p, li { white-space: pre-wrap; }
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="0">
<widget class="QLabel" name="languageLabel">
<property name="text">
<string>Select default language</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QComboBox" name="LanguageComboBox"/>
</item>
</layout> </layout>
</widget> </widget>
</widget> <widget class="QLabel" name="label">
<widget class="QWizardPage" name="UpdatesPage"> <property name="geometry">
<property name="title"> <rect>
<string>Apply Updates</string> <x>40</x>
</property> <y>190</y>
<property name="subTitle"> <width>471</width>
<string>Press Finish to apply requested updates.</string> <height>17</height>
</property> </rect>
<layout class="QVBoxLayout" name="previewLayout">
<property name="spacing">
<number>8</number>
</property> </property>
<property name="margin"> <property name="text">
<number>20</number> <string>Press Finish to apply all you changes and start OpenLP</string>
</property> </property>
</layout> </widget>
</widget> </widget>
</widget> </widget>
<resources> <resources>
<include location="../images/openlp-2.qrc"/> <include location="../images/openlp-2.qrc"/>
</resources> </resources>
<connections> <connections/>
<connection>
<sender>FirstTimeWizard</sender>
<signal>accepted()</signal>
<receiver>FirstTimeWizard</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>455</x>
<y>368</y>
</hint>
<hint type="destinationlabel">
<x>483</x>
<y>401</y>
</hint>
</hints>
</connection>
</connections>
</ui> </ui>