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'])
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)

View File

@ -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):

View File

@ -199,7 +199,7 @@ p, li { white-space: pre-wrap; }
<item>
<widget class="QCheckBox" name="remoteCheckBox">
<property name="text">
<string>Remote Control</string>
<string>Allow remote access</string>
</property>
</widget>
</item>
@ -213,6 +213,16 @@ p, li { white-space: pre-wrap; }
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="alertCheckBox">
<property name="text">
<string>Allow Alerts</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
</layout>
@ -229,12 +239,12 @@ p, li { white-space: pre-wrap; }
<rect>
<x>20</x>
<y>20</y>
<width>416</width>
<width>461</width>
<height>17</height>
</rect>
</property>
<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>
</widget>
<widget class="QGroupBox" name="internetGroupBox">
@ -247,7 +257,7 @@ p, li { white-space: pre-wrap; }
</rect>
</property>
<property name="title">
<string>Download Samples</string>
<string>Download Example Files</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
@ -280,18 +290,18 @@ p, li { white-space: pre-wrap; }
</widget>
<widget class="QWizardPage" name="DefaultsPage">
<property name="title">
<string>Configure Settings</string>
<string>Default Settings</string>
</property>
<property name="subTitle">
<string>Configure the initial value for settings</string>
<string>Set up default values to be used by OpenLP</string>
</property>
<widget class="QWidget" name="">
<widget class="QWidget" name="layoutWidget">
<property name="geometry">
<rect>
<x>20</x>
<y>20</y>
<width>252</width>
<height>58</height>
<height>88</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout">
@ -329,45 +339,35 @@ p, li { white-space: pre-wrap; }
</property>
</widget>
</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>
</widget>
</widget>
<widget class="QWizardPage" name="UpdatesPage">
<property name="title">
<string>Apply Updates</string>
</property>
<property name="subTitle">
<string>Press Finish to apply requested updates.</string>
</property>
<layout class="QVBoxLayout" name="previewLayout">
<property name="spacing">
<number>8</number>
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>40</x>
<y>190</y>
<width>471</width>
<height>17</height>
</rect>
</property>
<property name="margin">
<number>20</number>
<property name="text">
<string>Press Finish to apply all you changes and start OpenLP</string>
</property>
</layout>
</widget>
</widget>
</widget>
<resources>
<include location="../images/openlp-2.qrc"/>
</resources>
<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>
<connections/>
</ui>