Main window done

This commit is contained in:
Tim Bentley 2012-12-29 13:15:42 +00:00
parent 2b6b6d5756
commit 4b6292220a
9 changed files with 365 additions and 681 deletions

View File

@ -1,5 +1,5 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 # vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
@ -42,16 +42,13 @@ class Ui_FileRenameDialog(object):
self.fileNameLabel.setObjectName(u'fileNameLabel') self.fileNameLabel.setObjectName(u'fileNameLabel')
self.dialogLayout.addWidget(self.fileNameLabel, 0, 0) self.dialogLayout.addWidget(self.fileNameLabel, 0, 0)
self.fileNameEdit = QtGui.QLineEdit(fileRenameDialog) self.fileNameEdit = QtGui.QLineEdit(fileRenameDialog)
self.fileNameEdit.setValidator(QtGui.QRegExpValidator( self.fileNameEdit.setValidator(QtGui.QRegExpValidator(QtCore.QRegExp(r'[^/\\?*|<>\[\]":+%]+'), self))
QtCore.QRegExp(r'[^/\\?*|<>\[\]":+%]+'), self))
self.fileNameEdit.setObjectName(u'fileNameEdit') self.fileNameEdit.setObjectName(u'fileNameEdit')
self.dialogLayout.addWidget(self.fileNameEdit, 0, 1) self.dialogLayout.addWidget(self.fileNameEdit, 0, 1)
self.buttonBox = create_button_box(fileRenameDialog, u'buttonBox', self.buttonBox = create_button_box(fileRenameDialog, u'buttonBox', [u'cancel', u'ok'])
[u'cancel', u'ok'])
self.dialogLayout.addWidget(self.buttonBox, 1, 0, 1, 2) self.dialogLayout.addWidget(self.buttonBox, 1, 0, 1, 2)
self.retranslateUi(fileRenameDialog) self.retranslateUi(fileRenameDialog)
self.setMaximumHeight(self.sizeHint().height()) self.setMaximumHeight(self.sizeHint().height())
def retranslateUi(self, fileRenameDialog): def retranslateUi(self, fileRenameDialog):
self.fileNameLabel.setText(translate('OpenLP.FileRenameForm', self.fileNameLabel.setText(translate('OpenLP.FileRenameForm', 'New File Name:'))
'New File Name:'))

View File

@ -1,5 +1,5 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 # vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
@ -46,9 +46,7 @@ class FileRenameForm(QtGui.QDialog, Ui_FileRenameDialog):
Run the Dialog with correct heading. Run the Dialog with correct heading.
""" """
if copy: if copy:
self.setWindowTitle(translate('OpenLP.FileRenameForm', self.setWindowTitle(translate('OpenLP.FileRenameForm', 'File Copy'))
'File Copy'))
else: else:
self.setWindowTitle(translate('OpenLP.FileRenameForm', self.setWindowTitle(translate('OpenLP.FileRenameForm', 'File Rename'))
'File Rename'))
return QtGui.QDialog.exec_(self) return QtGui.QDialog.exec_(self)

View File

@ -1,5 +1,5 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 # vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
@ -39,8 +39,7 @@ from ConfigParser import SafeConfigParser
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from openlp.core.lib import translate, PluginStatus, Receiver, build_icon, \ from openlp.core.lib import translate, PluginStatus, Receiver, build_icon, check_directory_exists, Settings
check_directory_exists, Settings
from openlp.core.utils import get_web_page, AppLocation, get_filesystem_encoding from openlp.core.utils import get_web_page, AppLocation, get_filesystem_encoding
from firsttimewizard import Ui_FirstTimeWizard, FirstTimePage from firsttimewizard import Ui_FirstTimeWizard, FirstTimePage
@ -65,8 +64,7 @@ class ThemeScreenshotThread(QtCore.QThread):
filename = config.get(u'theme_%s' % theme, u'filename') filename = config.get(u'theme_%s' % theme, u'filename')
screenshot = config.get(u'theme_%s' % theme, u'screenshot') screenshot = config.get(u'theme_%s' % theme, u'screenshot')
urllib.urlretrieve(u'%s%s' % (self.parent().web, screenshot), urllib.urlretrieve(u'%s%s' % (self.parent().web, screenshot),
os.path.join(unicode(gettempdir(), get_filesystem_encoding()), os.path.join(unicode(gettempdir(), get_filesystem_encoding()), u'openlp', screenshot))
u'openlp', screenshot))
item = QtGui.QListWidgetItem(title, self.parent().themesListWidget) item = QtGui.QListWidgetItem(title, self.parent().themesListWidget)
item.setData(QtCore.Qt.UserRole, filename) item.setData(QtCore.Qt.UserRole, filename)
item.setCheckState(QtCore.Qt.Unchecked) item.setCheckState(QtCore.Qt.Unchecked)
@ -97,12 +95,11 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
'Downloading %s...') 'Downloading %s...')
QtCore.QObject.connect(self.cancelButton, QtCore.SIGNAL('clicked()'), QtCore.QObject.connect(self.cancelButton, QtCore.SIGNAL('clicked()'),
self.onCancelButtonClicked) self.onCancelButtonClicked)
QtCore.QObject.connect(self.noInternetFinishButton, QtCore.QObject.connect(self.noInternetFinishButton, QtCore.SIGNAL('clicked()'),
QtCore.SIGNAL('clicked()'), self.onNoInternetFinishButtonClicked) self.onNoInternetFinishButtonClicked)
QtCore.QObject.connect(self, QtCore.QObject.connect(self, QtCore.SIGNAL(u'currentIdChanged(int)'), self.onCurrentIdChanged)
QtCore.SIGNAL(u'currentIdChanged(int)'), self.onCurrentIdChanged) QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'config_screen_changed'),
QtCore.QObject.connect(Receiver.get_receiver(), self.updateScreenListCombo)
QtCore.SIGNAL(u'config_screen_changed'), self.updateScreenListCombo)
def exec_(self): def exec_(self):
""" """
@ -126,10 +123,8 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
songs = self.config.get(u'songs', u'languages') songs = self.config.get(u'songs', u'languages')
songs = songs.split(u',') songs = songs.split(u',')
for song in songs: for song in songs:
title = unicode(self.config.get( title = unicode(self.config.get(u'songs_%s' % song, u'title'), u'utf8')
u'songs_%s' % song, u'title'), u'utf8') filename = unicode(self.config.get(u'songs_%s' % song, u'filename'), u'utf8')
filename = unicode(self.config.get(
u'songs_%s' % song, u'filename'), u'utf8')
item = QtGui.QListWidgetItem(title, self.songsListWidget) item = QtGui.QListWidgetItem(title, self.songsListWidget)
item.setData(QtCore.Qt.UserRole, filename) item.setData(QtCore.Qt.UserRole, filename)
item.setCheckState(QtCore.Qt.Unchecked) item.setCheckState(QtCore.Qt.Unchecked)
@ -137,17 +132,13 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
bible_languages = self.config.get(u'bibles', u'languages') bible_languages = self.config.get(u'bibles', u'languages')
bible_languages = bible_languages.split(u',') bible_languages = bible_languages.split(u',')
for lang in bible_languages: for lang in bible_languages:
language = unicode(self.config.get( language = unicode(self.config.get(u'bibles_%s' % lang, u'title'), u'utf8')
u'bibles_%s' % lang, u'title'), u'utf8') langItem = QtGui.QTreeWidgetItem(self.biblesTreeWidget, [language])
langItem = QtGui.QTreeWidgetItem(
self.biblesTreeWidget, [language])
bibles = self.config.get(u'bibles_%s' % lang, u'translations') bibles = self.config.get(u'bibles_%s' % lang, u'translations')
bibles = bibles.split(u',') bibles = bibles.split(u',')
for bible in bibles: for bible in bibles:
title = unicode(self.config.get( title = unicode(self.config.get(u'bible_%s' % bible, u'title'), u'utf8')
u'bible_%s' % bible, u'title'), u'utf8') filename = unicode(self.config.get(u'bible_%s' % bible, u'filename'))
filename = unicode(self.config.get(
u'bible_%s' % bible, u'filename'))
item = QtGui.QTreeWidgetItem(langItem, [title]) item = QtGui.QTreeWidgetItem(langItem, [title])
item.setData(0, QtCore.Qt.UserRole, filename) item.setData(0, QtCore.Qt.UserRole, filename)
item.setCheckState(0, QtCore.Qt.Unchecked) item.setCheckState(0, QtCore.Qt.Unchecked)
@ -199,8 +190,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
if self.hasRunWizard: if self.hasRunWizard:
self.noInternetLabel.setText(self.noInternetText) self.noInternetLabel.setText(self.noInternetText)
else: else:
self.noInternetLabel.setText(self.noInternetText + self.noInternetLabel.setText(self.noInternetText + self.cancelWizardText)
self.cancelWizardText)
elif pageId == FirstTimePage.Defaults: elif pageId == FirstTimePage.Defaults:
self.themeComboBox.clear() self.themeComboBox.clear()
for iter in xrange(self.themesListWidget.count()): for iter in xrange(self.themesListWidget.count()):
@ -249,7 +239,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
Process the triggering of the cancel button. Process the triggering of the cancel button.
""" """
if self.lastId == FirstTimePage.NoInternet or \ if self.lastId == FirstTimePage.NoInternet or \
(self.lastId <= FirstTimePage.Plugins and not self.hasRunWizard): (self.lastId <= FirstTimePage.Plugins and not self.hasRunWizard):
QtCore.QCoreApplication.exit() QtCore.QCoreApplication.exit()
sys.exit() sys.exit()
self.downloadCancelled = True self.downloadCancelled = True
@ -304,8 +294,8 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
item = self.themesListWidget.item(index) item = self.themesListWidget.item(index)
if item.data(QtCore.Qt.UserRole) == filename: if item.data(QtCore.Qt.UserRole) == filename:
break break
item.setIcon(build_icon(os.path.join(unicode(gettempdir(), item.setIcon(build_icon(os.path.join(unicode(gettempdir(), get_filesystem_encoding()), u'openlp',
get_filesystem_encoding()), u'openlp', screenshot))) screenshot)))
def _getFileSize(self, url): def _getFileSize(self, url):
site = urllib.urlopen(url) site = urllib.urlopen(url)
@ -372,15 +362,12 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
self.progressBar.setValue(0) self.progressBar.setValue(0)
self.progressBar.setMinimum(0) self.progressBar.setMinimum(0)
self.progressBar.setMaximum(self.max_progress) self.progressBar.setMaximum(self.max_progress)
self.progressPage.setTitle(translate('OpenLP.FirstTimeWizard', self.progressPage.setTitle(translate('OpenLP.FirstTimeWizard', 'Setting Up And Downloading'))
'Setting Up And Downloading')) self.progressPage.setSubTitle(
self.progressPage.setSubTitle(translate('OpenLP.FirstTimeWizard', translate('OpenLP.FirstTimeWizard', 'Please wait while OpenLP is set up and your data is downloaded.'))
'Please wait while OpenLP is set up '
'and your data is downloaded.'))
else: else:
self.progressBar.setVisible(False) self.progressBar.setVisible(False)
self.progressPage.setTitle(translate('OpenLP.FirstTimeWizard', self.progressPage.setTitle(translate('OpenLP.FirstTimeWizard', 'Setting Up'))
'Setting Up'))
self.progressPage.setSubTitle(u'Setup complete.') self.progressPage.setSubTitle(u'Setup complete.')
self.repaint() self.repaint()
Receiver.send_message(u'openlp_process_events') Receiver.send_message(u'openlp_process_events')
@ -395,12 +382,10 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
self.progressBar.setValue(self.progressBar.maximum()) self.progressBar.setValue(self.progressBar.maximum())
if self.hasRunWizard: if self.hasRunWizard:
self.progressLabel.setText(translate('OpenLP.FirstTimeWizard', self.progressLabel.setText(translate('OpenLP.FirstTimeWizard',
'Download complete.' 'Download complete. Click the finish button to return to OpenLP.'))
' Click the finish button to return to OpenLP.'))
else: else:
self.progressLabel.setText(translate('OpenLP.FirstTimeWizard', self.progressLabel.setText(translate('OpenLP.FirstTimeWizard',
'Download complete.' 'Download complete. Click the finish button to start OpenLP.'))
' Click the finish button to start OpenLP.'))
else: else:
if self.hasRunWizard: if self.hasRunWizard:
self.progressLabel.setText(translate('OpenLP.FirstTimeWizard', self.progressLabel.setText(translate('OpenLP.FirstTimeWizard',
@ -419,15 +404,13 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
Run the tasks in the wizard. Run the tasks in the wizard.
""" """
# Set plugin states # Set plugin states
self._incrementProgressBar(translate('OpenLP.FirstTimeWizard', self._incrementProgressBar(translate('OpenLP.FirstTimeWizard', 'Enabling selected plugins...'))
'Enabling selected plugins...'))
self._setPluginStatus(self.songsCheckBox, u'songs/status') self._setPluginStatus(self.songsCheckBox, u'songs/status')
self._setPluginStatus(self.bibleCheckBox, u'bibles/status') self._setPluginStatus(self.bibleCheckBox, u'bibles/status')
# TODO Presentation plugin is not yet working on Mac OS X. # TODO Presentation plugin is not yet working on Mac OS X.
# For now just ignore it. # For now just ignore it.
if sys.platform != 'darwin': if sys.platform != 'darwin':
self._setPluginStatus(self.presentationCheckBox, self._setPluginStatus(self.presentationCheckBox, u'presentations/status')
u'presentations/status')
self._setPluginStatus(self.imageCheckBox, u'images/status') self._setPluginStatus(self.imageCheckBox, u'images/status')
self._setPluginStatus(self.mediaCheckBox, u'media/status') self._setPluginStatus(self.mediaCheckBox, u'media/status')
self._setPluginStatus(self.remoteCheckBox, u'remotes/status') self._setPluginStatus(self.remoteCheckBox, u'remotes/status')
@ -447,8 +430,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
filename = item.data(QtCore.Qt.UserRole) filename = item.data(QtCore.Qt.UserRole)
self._incrementProgressBar(self.downloading % filename, 0) self._incrementProgressBar(self.downloading % filename, 0)
self.previous_size = 0 self.previous_size = 0
destination = os.path.join(songs_destination, destination = os.path.join(songs_destination, unicode(filename))
unicode(filename))
self.urlGetFile(u'%s%s' % (self.web, filename), destination) self.urlGetFile(u'%s%s' % (self.web, filename), destination)
# Download Bibles # Download Bibles
bibles_iterator = QtGui.QTreeWidgetItemIterator( bibles_iterator = QtGui.QTreeWidgetItemIterator(
@ -459,8 +441,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
bible = item.data(0, QtCore.Qt.UserRole) bible = item.data(0, QtCore.Qt.UserRole)
self._incrementProgressBar(self.downloading % bible, 0) self._incrementProgressBar(self.downloading % bible, 0)
self.previous_size = 0 self.previous_size = 0
self.urlGetFile(u'%s%s' % (self.web, bible), self.urlGetFile(u'%s%s' % (self.web, bible), os.path.join(bibles_destination, bible))
os.path.join(bibles_destination, bible))
bibles_iterator += 1 bibles_iterator += 1
# Download themes # Download themes
for i in xrange(self.themesListWidget.count()): for i in xrange(self.themesListWidget.count()):
@ -469,20 +450,15 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
theme = item.data(QtCore.Qt.UserRole) theme = item.data(QtCore.Qt.UserRole)
self._incrementProgressBar(self.downloading % theme, 0) self._incrementProgressBar(self.downloading % theme, 0)
self.previous_size = 0 self.previous_size = 0
self.urlGetFile(u'%s%s' % (self.web, theme), self.urlGetFile(u'%s%s' % (self.web, theme), os.path.join(themes_destination, theme))
os.path.join(themes_destination, theme))
# Set Default Display # Set Default Display
if self.displayComboBox.currentIndex() != -1: if self.displayComboBox.currentIndex() != -1:
Settings().setValue(u'General/monitor', Settings().setValue(u'General/monitor', self.displayComboBox.currentIndex())
self.displayComboBox.currentIndex()) self.screens.set_current_display(self.displayComboBox.currentIndex())
self.screens.set_current_display(
self.displayComboBox.currentIndex())
# Set Global Theme # Set Global Theme
if self.themeComboBox.currentIndex() != -1: if self.themeComboBox.currentIndex() != -1:
Settings().setValue(u'themes/global theme', Settings().setValue(u'themes/global theme', self.themeComboBox.currentText())
self.themeComboBox.currentText())
def _setPluginStatus(self, field, tag): def _setPluginStatus(self, field, tag):
status = PluginStatus.Active if field.checkState() \ status = PluginStatus.Active if field.checkState() == QtCore.Qt.Checked else PluginStatus.Inactive
== QtCore.Qt.Checked else PluginStatus.Inactive
Settings().setValue(tag, status) Settings().setValue(tag, status)

View File

@ -1,5 +1,5 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 # vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
@ -49,22 +49,17 @@ class Ui_FirstTimeLanguageDialog(object):
self.languageLabel.setObjectName(u'languageLabel') self.languageLabel.setObjectName(u'languageLabel')
self.languageLayout.addWidget(self.languageLabel) self.languageLayout.addWidget(self.languageLabel)
self.languageComboBox = QtGui.QComboBox(languageDialog) self.languageComboBox = QtGui.QComboBox(languageDialog)
self.languageComboBox.setSizeAdjustPolicy( self.languageComboBox.setSizeAdjustPolicy(QtGui.QComboBox.AdjustToContents)
QtGui.QComboBox.AdjustToContents)
self.languageComboBox.setObjectName("languageComboBox") self.languageComboBox.setObjectName("languageComboBox")
self.languageLayout.addWidget(self.languageComboBox) self.languageLayout.addWidget(self.languageComboBox)
self.dialogLayout.addLayout(self.languageLayout) self.dialogLayout.addLayout(self.languageLayout)
self.buttonBox = create_button_box(languageDialog, u'buttonBox', self.buttonBox = create_button_box(languageDialog, u'buttonBox', [u'cancel', u'ok'])
[u'cancel', u'ok'])
self.dialogLayout.addWidget(self.buttonBox) self.dialogLayout.addWidget(self.buttonBox)
self.retranslateUi(languageDialog) self.retranslateUi(languageDialog)
self.setMaximumHeight(self.sizeHint().height()) self.setMaximumHeight(self.sizeHint().height())
def retranslateUi(self, languageDialog): def retranslateUi(self, languageDialog):
self.setWindowTitle(translate('OpenLP.FirstTimeLanguageForm', self.setWindowTitle(translate('OpenLP.FirstTimeLanguageForm', 'Select Translation'))
'Select Translation')) self.infoLabel.setText(
self.infoLabel.setText(translate('OpenLP.FirstTimeLanguageForm', translate('OpenLP.FirstTimeLanguageForm', 'Choose the translation you\'d like to use in OpenLP.'))
'Choose the translation you\'d like to use in OpenLP.')) self.languageLabel.setText(translate('OpenLP.FirstTimeLanguageForm', 'Translation:'))
self.languageLabel.setText(translate('OpenLP.FirstTimeLanguageForm',
'Translation:'))

View File

@ -1,5 +1,5 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 # vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #

View File

@ -1,5 +1,5 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 # vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
@ -51,10 +51,8 @@ class Ui_FirstTimeWizard(object):
FirstTimeWizard.resize(550, 386) FirstTimeWizard.resize(550, 386)
FirstTimeWizard.setModal(True) FirstTimeWizard.setModal(True)
FirstTimeWizard.setWizardStyle(QtGui.QWizard.ModernStyle) FirstTimeWizard.setWizardStyle(QtGui.QWizard.ModernStyle)
FirstTimeWizard.setOptions(QtGui.QWizard.IndependentPages | FirstTimeWizard.setOptions(QtGui.QWizard.IndependentPages | QtGui.QWizard.NoBackButtonOnStartPage |
QtGui.QWizard.NoBackButtonOnStartPage | QtGui.QWizard.NoBackButtonOnLastPage |QtGui.QWizard.HaveCustomButton1)
QtGui.QWizard.NoBackButtonOnLastPage |
QtGui.QWizard.HaveCustomButton1)
self.finishButton = self.button(QtGui.QWizard.FinishButton) self.finishButton = self.button(QtGui.QWizard.FinishButton)
self.noInternetFinishButton = self.button(QtGui.QWizard.CustomButton1) self.noInternetFinishButton = self.button(QtGui.QWizard.CustomButton1)
self.cancelButton = self.button(QtGui.QWizard.CancelButton) self.cancelButton = self.button(QtGui.QWizard.CancelButton)
@ -175,8 +173,7 @@ class Ui_FirstTimeWizard(object):
self.themeComboBox = QtGui.QComboBox(self.defaultsPage) self.themeComboBox = QtGui.QComboBox(self.defaultsPage)
self.themeComboBox.setEditable(False) self.themeComboBox.setEditable(False)
self.themeComboBox.setInsertPolicy(QtGui.QComboBox.NoInsert) self.themeComboBox.setInsertPolicy(QtGui.QComboBox.NoInsert)
self.themeComboBox.setSizeAdjustPolicy( self.themeComboBox.setSizeAdjustPolicy(QtGui.QComboBox.AdjustToContents)
QtGui.QComboBox.AdjustToContents)
self.themeComboBox.setObjectName(u'themeComboBox') self.themeComboBox.setObjectName(u'themeComboBox')
self.defaultsLayout.addRow(self.themeLabel, self.themeComboBox) self.defaultsLayout.addRow(self.themeLabel, self.themeComboBox)
FirstTimeWizard.setPage(FirstTimePage.Defaults, self.defaultsPage) FirstTimeWizard.setPage(FirstTimePage.Defaults, self.defaultsPage)
@ -198,41 +195,27 @@ class Ui_FirstTimeWizard(object):
def retranslateUi(self, FirstTimeWizard): def retranslateUi(self, FirstTimeWizard):
FirstTimeWizard.setWindowTitle(translate( FirstTimeWizard.setWindowTitle(translate(
'OpenLP.FirstTimeWizard', 'First Time Wizard')) 'OpenLP.FirstTimeWizard', 'First Time Wizard'))
self.titleLabel.setText( self.titleLabel.setText(u'<span style="font-size:14pt; font-weight:600;">%s</span>' % \
u'<span style="font-size:14pt; font-weight:600;">%s</span>' % \ translate('OpenLP.FirstTimeWizard', 'Welcome to the First Time Wizard'))
translate('OpenLP.FirstTimeWizard',
'Welcome to the First Time Wizard'))
self.informationLabel.setText(translate('OpenLP.FirstTimeWizard', self.informationLabel.setText(translate('OpenLP.FirstTimeWizard',
'This wizard will help you to configure OpenLP for initial use.' 'This wizard will help you to configure OpenLP for initial use.'
' Click the next button below to start.')) ' Click the next button below to start.'))
self.pluginPage.setTitle(translate('OpenLP.FirstTimeWizard', self.pluginPage.setTitle(translate('OpenLP.FirstTimeWizard', 'Activate required Plugins'))
'Activate required Plugins')) self.pluginPage.setSubTitle(translate('OpenLP.FirstTimeWizard','Select the Plugins you wish to use. '))
self.pluginPage.setSubTitle(translate('OpenLP.FirstTimeWizard',
'Select the Plugins you wish to use. '))
self.songsCheckBox.setText(translate('OpenLP.FirstTimeWizard', 'Songs')) self.songsCheckBox.setText(translate('OpenLP.FirstTimeWizard', 'Songs'))
self.customCheckBox.setText(translate('OpenLP.FirstTimeWizard', self.customCheckBox.setText(translate('OpenLP.FirstTimeWizard','Custom Slides'))
'Custom Slides'))
self.bibleCheckBox.setText(translate('OpenLP.FirstTimeWizard', 'Bible')) self.bibleCheckBox.setText(translate('OpenLP.FirstTimeWizard', 'Bible'))
self.imageCheckBox.setText(translate('OpenLP.FirstTimeWizard', self.imageCheckBox.setText(translate('OpenLP.FirstTimeWizard', 'Images'))
'Images'))
# TODO Presentation plugin is not yet working on Mac OS X. # TODO Presentation plugin is not yet working on Mac OS X.
# For now just ignore it. # For now just ignore it.
if sys.platform != 'darwin': if sys.platform != 'darwin':
self.presentationCheckBox.setText(translate('OpenLP.FirstTimeWizard', self.presentationCheckBox.setText(translate('OpenLP.FirstTimeWizard', 'Presentations'))
'Presentations')) self.mediaCheckBox.setText(translate('OpenLP.FirstTimeWizard', 'Media (Audio and Video)'))
self.mediaCheckBox.setText(translate('OpenLP.FirstTimeWizard', self.remoteCheckBox.setText(translate('OpenLP.FirstTimeWizard', 'Allow remote access'))
'Media (Audio and Video)')) self.songUsageCheckBox.setText(translate('OpenLP.FirstTimeWizard', 'Monitor Song Usage'))
self.remoteCheckBox.setText(translate('OpenLP.FirstTimeWizard', self.alertCheckBox.setText(translate('OpenLP.FirstTimeWizard', 'Allow Alerts'))
'Allow remote access')) self.noInternetPage.setTitle(translate('OpenLP.FirstTimeWizard', 'No Internet Connection'))
self.songUsageCheckBox.setText(translate('OpenLP.FirstTimeWizard', self.noInternetPage.setSubTitle(translate('OpenLP.FirstTimeWizard', 'Unable to detect an Internet connection.'))
'Monitor Song Usage'))
self.alertCheckBox.setText(translate('OpenLP.FirstTimeWizard',
'Allow Alerts'))
self.noInternetPage.setTitle(translate('OpenLP.FirstTimeWizard',
'No Internet Connection'))
self.noInternetPage.setSubTitle(translate(
'OpenLP.FirstTimeWizard',
'Unable to detect an Internet connection.'))
self.noInternetText = translate('OpenLP.FirstTimeWizard', self.noInternetText = translate('OpenLP.FirstTimeWizard',
'No Internet connection was found. The First Time Wizard needs an ' 'No Internet connection was found. The First Time Wizard needs an '
'Internet connection in order to be able to download sample ' 'Internet connection in order to be able to download sample '
@ -244,27 +227,16 @@ class Ui_FirstTimeWizard(object):
self.cancelWizardText = translate('OpenLP.FirstTimeWizard', self.cancelWizardText = translate('OpenLP.FirstTimeWizard',
'\n\nTo cancel the First Time Wizard completely (and not start ' '\n\nTo cancel the First Time Wizard completely (and not start '
'OpenLP), click the Cancel button now.') 'OpenLP), click the Cancel button now.')
self.songsPage.setTitle(translate('OpenLP.FirstTimeWizard', self.songsPage.setTitle(translate('OpenLP.FirstTimeWizard', 'Sample Songs'))
'Sample Songs')) self.songsPage.setSubTitle(translate('OpenLP.FirstTimeWizard', 'Select and download public domain songs.'))
self.songsPage.setSubTitle(translate('OpenLP.FirstTimeWizard', self.biblesPage.setTitle(translate('OpenLP.FirstTimeWizard', 'Sample Bibles'))
'Select and download public domain songs.')) self.biblesPage.setSubTitle(translate('OpenLP.FirstTimeWizard', 'Select and download free Bibles.'))
self.biblesPage.setTitle(translate('OpenLP.FirstTimeWizard', self.themesPage.setTitle(translate('OpenLP.FirstTimeWizard', 'Sample Themes'))
'Sample Bibles')) self.themesPage.setSubTitle(translate('OpenLP.FirstTimeWizard', 'Select and download sample themes.'))
self.biblesPage.setSubTitle(translate('OpenLP.FirstTimeWizard', self.defaultsPage.setTitle(translate('OpenLP.FirstTimeWizard', 'Default Settings'))
'Select and download free Bibles.'))
self.themesPage.setTitle(translate('OpenLP.FirstTimeWizard',
'Sample Themes'))
self.themesPage.setSubTitle(translate('OpenLP.FirstTimeWizard',
'Select and download sample themes.'))
self.defaultsPage.setTitle(translate('OpenLP.FirstTimeWizard',
'Default Settings'))
self.defaultsPage.setSubTitle(translate('OpenLP.FirstTimeWizard', self.defaultsPage.setSubTitle(translate('OpenLP.FirstTimeWizard',
'Set up default settings to be used by OpenLP.')) 'Set up default settings to be used by OpenLP.'))
self.displayLabel.setText(translate('OpenLP.FirstTimeWizard', self.displayLabel.setText(translate('OpenLP.FirstTimeWizard', 'Default output display:'))
'Default output display:')) self.themeLabel.setText(translate('OpenLP.FirstTimeWizard', 'Select default theme:'))
self.themeLabel.setText(translate('OpenLP.FirstTimeWizard', self.progressLabel.setText(translate('OpenLP.FirstTimeWizard', 'Starting configuration process...'))
'Select default theme:')) FirstTimeWizard.setButtonText(QtGui.QWizard.CustomButton1, translate('OpenLP.FirstTimeWizard', 'Finish'))
self.progressLabel.setText(translate('OpenLP.FirstTimeWizard',
'Starting configuration process...'))
FirstTimeWizard.setButtonText(QtGui.QWizard.CustomButton1,
translate('OpenLP.FirstTimeWizard', 'Finish'))

View File

@ -1,5 +1,5 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 # vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
@ -189,21 +189,15 @@ class GeneralTab(SettingsTab):
self.rightLayout.addWidget(self.settingsGroupBox) self.rightLayout.addWidget(self.settingsGroupBox)
self.rightLayout.addStretch() self.rightLayout.addStretch()
# Signals and slots # Signals and slots
QtCore.QObject.connect(self.overrideRadioButton, QtCore.QObject.connect(self.overrideRadioButton, QtCore.SIGNAL(u'toggled(bool)'),
QtCore.SIGNAL(u'toggled(bool)'), self.onOverrideRadioButtonPressed) self.onOverrideRadioButtonPressed)
QtCore.QObject.connect(self.customHeightValueEdit, QtCore.QObject.connect(self.customHeightValueEdit, QtCore.SIGNAL(u'valueChanged(int)'), self.onDisplayChanged)
QtCore.SIGNAL(u'valueChanged(int)'), self.onDisplayChanged) QtCore.QObject.connect(self.customWidthValueEdit, QtCore.SIGNAL(u'valueChanged(int)'), self.onDisplayChanged)
QtCore.QObject.connect(self.customWidthValueEdit, QtCore.QObject.connect(self.customYValueEdit, QtCore.SIGNAL(u'valueChanged(int)'), self.onDisplayChanged)
QtCore.SIGNAL(u'valueChanged(int)'), self.onDisplayChanged) QtCore.QObject.connect(self.customXValueEdit, QtCore.SIGNAL(u'valueChanged(int)'), self.onDisplayChanged)
QtCore.QObject.connect(self.customYValueEdit, QtCore.QObject.connect(self.monitorComboBox, QtCore.SIGNAL(u'currentIndexChanged(int)'), self.onDisplayChanged)
QtCore.SIGNAL(u'valueChanged(int)'), self.onDisplayChanged)
QtCore.QObject.connect(self.customXValueEdit,
QtCore.SIGNAL(u'valueChanged(int)'), self.onDisplayChanged)
QtCore.QObject.connect(self.monitorComboBox,
QtCore.SIGNAL(u'currentIndexChanged(int)'), self.onDisplayChanged)
# Reload the tab, as the screen resolution/count may have changed. # Reload the tab, as the screen resolution/count may have changed.
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'config_screen_changed'), self.load)
QtCore.SIGNAL(u'config_screen_changed'), self.load)
# Remove for now # Remove for now
self.usernameLabel.setVisible(False) self.usernameLabel.setVisible(False)
self.usernameEdit.setVisible(False) self.usernameEdit.setVisible(False)
@ -215,40 +209,25 @@ class GeneralTab(SettingsTab):
Translate the general settings tab to the currently selected language Translate the general settings tab to the currently selected language
""" """
self.tabTitleVisible = translate('OpenLP.GeneralTab', 'General') self.tabTitleVisible = translate('OpenLP.GeneralTab', 'General')
self.monitorGroupBox.setTitle(translate('OpenLP.GeneralTab', self.monitorGroupBox.setTitle(translate('OpenLP.GeneralTab', 'Monitors'))
'Monitors')) self.monitorRadioButton.setText(translate('OpenLP.GeneralTab', 'Select monitor for output display:'))
self.monitorRadioButton.setText(translate('OpenLP.GeneralTab', self.displayOnMonitorCheck.setText(translate('OpenLP.GeneralTab', 'Display if a single screen'))
'Select monitor for output display:')) self.startupGroupBox.setTitle(translate('OpenLP.GeneralTab', 'Application Startup'))
self.displayOnMonitorCheck.setText( self.warningCheckBox.setText(translate('OpenLP.GeneralTab', 'Show blank screen warning'))
translate('OpenLP.GeneralTab', 'Display if a single screen')) self.autoOpenCheckBox.setText(translate('OpenLP.GeneralTab', 'Automatically open the last service'))
self.startupGroupBox.setTitle( self.showSplashCheckBox.setText(translate('OpenLP.GeneralTab', 'Show the splash screen'))
translate('OpenLP.GeneralTab', 'Application Startup')) self.checkForUpdatesCheckBox.setText(translate('OpenLP.GeneralTab', 'Check for updates to OpenLP'))
self.warningCheckBox.setText( self.settingsGroupBox.setTitle(translate('OpenLP.GeneralTab', 'Application Settings'))
translate('OpenLP.GeneralTab', 'Show blank screen warning'))
self.autoOpenCheckBox.setText(translate('OpenLP.GeneralTab',
'Automatically open the last service'))
self.showSplashCheckBox.setText(
translate('OpenLP.GeneralTab', 'Show the splash screen'))
self.checkForUpdatesCheckBox.setText(
translate('OpenLP.GeneralTab', 'Check for updates to OpenLP'))
self.settingsGroupBox.setTitle(
translate('OpenLP.GeneralTab', 'Application Settings'))
self.saveCheckServiceCheckBox.setText(translate('OpenLP.GeneralTab', self.saveCheckServiceCheckBox.setText(translate('OpenLP.GeneralTab',
'Prompt to save before starting a new service')) 'Prompt to save before starting a new service'))
self.autoUnblankCheckBox.setText(translate('OpenLP.GeneralTab', self.autoUnblankCheckBox.setText(translate('OpenLP.GeneralTab', 'Unblank display when adding new live item'))
'Unblank display when adding new live item')) self.autoPreviewCheckBox.setText(translate('OpenLP.GeneralTab', 'Automatically preview next item in service'))
self.autoPreviewCheckBox.setText(translate('OpenLP.GeneralTab', self.timeoutLabel.setText(translate('OpenLP.GeneralTab', 'Timed slide interval:'))
'Automatically preview next item in service'))
self.timeoutLabel.setText(translate('OpenLP.GeneralTab',
'Timed slide interval:'))
self.timeoutSpinBox.setSuffix(translate('OpenLP.GeneralTab', ' sec')) self.timeoutSpinBox.setSuffix(translate('OpenLP.GeneralTab', ' sec'))
self.ccliGroupBox.setTitle( self.ccliGroupBox.setTitle(translate('OpenLP.GeneralTab', 'CCLI Details'))
translate('OpenLP.GeneralTab', 'CCLI Details'))
self.numberLabel.setText(UiStrings().CCLINumberLabel) self.numberLabel.setText(UiStrings().CCLINumberLabel)
self.usernameLabel.setText( self.usernameLabel.setText(translate('OpenLP.GeneralTab', 'SongSelect username:'))
translate('OpenLP.GeneralTab', 'SongSelect username:')) self.passwordLabel.setText(translate('OpenLP.GeneralTab', 'SongSelect password:'))
self.passwordLabel.setText(
translate('OpenLP.GeneralTab', 'SongSelect password:'))
# Moved from display tab # Moved from display tab
self.overrideRadioButton.setText(translate('OpenLP.GeneralTab', self.overrideRadioButton.setText(translate('OpenLP.GeneralTab',
'Override display position:')) 'Override display position:'))
@ -256,12 +235,9 @@ class GeneralTab(SettingsTab):
self.customYLabel.setText(translate('OpenLP.GeneralTab', 'Y')) self.customYLabel.setText(translate('OpenLP.GeneralTab', 'Y'))
self.customHeightLabel.setText(translate('OpenLP.GeneralTab', 'Height')) self.customHeightLabel.setText(translate('OpenLP.GeneralTab', 'Height'))
self.customWidthLabel.setText(translate('OpenLP.GeneralTab', 'Width')) self.customWidthLabel.setText(translate('OpenLP.GeneralTab', 'Width'))
self.audioGroupBox.setTitle( self.audioGroupBox.setTitle(translate('OpenLP.GeneralTab', 'Background Audio'))
translate('OpenLP.GeneralTab', 'Background Audio')) self.startPausedCheckBox.setText(translate('OpenLP.GeneralTab', 'Start background audio paused'))
self.startPausedCheckBox.setText( self.repeatListCheckBox.setText(translate('OpenLP.GeneralTab', 'Repeat track list'))
translate('OpenLP.GeneralTab', 'Start background audio paused'))
self.repeatListCheckBox.setText(
translate('OpenLP.GeneralTab', 'Repeat track list'))
def load(self): def load(self):
""" """
@ -271,49 +247,34 @@ class GeneralTab(SettingsTab):
settings.beginGroup(self.settingsSection) settings.beginGroup(self.settingsSection)
self.monitorComboBox.clear() self.monitorComboBox.clear()
self.monitorComboBox.addItems(self.screens.get_screen_list()) self.monitorComboBox.addItems(self.screens.get_screen_list())
monitorNumber = settings.value( monitorNumber = settings.value(u'monitor', self.screens.display_count - 1)
u'monitor', self.screens.display_count - 1)
self.monitorComboBox.setCurrentIndex(monitorNumber) self.monitorComboBox.setCurrentIndex(monitorNumber)
self.numberEdit.setText(settings.value(u'ccli number', u'')) self.numberEdit.setText(settings.value(u'ccli number', u''))
self.usernameEdit.setText(settings.value(u'songselect username', u'')) self.usernameEdit.setText(settings.value(u'songselect username', u''))
self.passwordEdit.setText(settings.value(u'songselect password', u'')) self.passwordEdit.setText(settings.value(u'songselect password', u''))
self.saveCheckServiceCheckBox.setChecked(settings.value(u'save prompt', self.saveCheckServiceCheckBox.setChecked(settings.value(u'save prompt', False))
False)) self.autoUnblankCheckBox.setChecked(settings.value(u'auto unblank', False))
self.autoUnblankCheckBox.setChecked(settings.value(u'auto unblank',
False))
self.displayOnMonitorCheck.setChecked(self.screens.display) self.displayOnMonitorCheck.setChecked(self.screens.display)
self.warningCheckBox.setChecked(settings.value(u'blank warning', False)) self.warningCheckBox.setChecked(settings.value(u'blank warning', False))
self.autoOpenCheckBox.setChecked(settings.value(u'auto open', False)) self.autoOpenCheckBox.setChecked(settings.value(u'auto open', False))
self.showSplashCheckBox.setChecked(settings.value(u'show splash', True)) self.showSplashCheckBox.setChecked(settings.value(u'show splash', True))
self.checkForUpdatesCheckBox.setChecked(settings.value(u'update check', self.checkForUpdatesCheckBox.setChecked(settings.value(u'update check', True))
True)) self.autoPreviewCheckBox.setChecked(settings.value(u'auto preview', False))
self.autoPreviewCheckBox.setChecked(settings.value(u'auto preview',
False))
self.timeoutSpinBox.setValue(settings.value(u'loop delay', 5)) self.timeoutSpinBox.setValue(settings.value(u'loop delay', 5))
self.monitorRadioButton.setChecked( self.monitorRadioButton.setChecked(not settings.value(u'override position', False))
not settings.value(u'override position', False)) self.overrideRadioButton.setChecked(settings.value(u'override position', False))
self.overrideRadioButton.setChecked(settings.value(u'override position', self.customXValueEdit.setValue(settings.value(u'x position', self.screens.current[u'size'].x()))
False)) self.customYValueEdit.setValue(settings.value(u'y position', self.screens.current[u'size'].y()))
self.customXValueEdit.setValue(settings.value(u'x position', self.customHeightValueEdit.setValue(settings.value(u'height', self.screens.current[u'size'].height()))
self.screens.current[u'size'].x())) self.customWidthValueEdit.setValue(settings.value(u'width', self.screens.current[u'size'].width()))
self.customYValueEdit.setValue(settings.value(u'y position', self.startPausedCheckBox.setChecked(settings.value(u'audio start paused', True))
self.screens.current[u'size'].y())) self.repeatListCheckBox.setChecked(settings.value(u'audio repeat list', False))
self.customHeightValueEdit.setValue(settings.value(u'height',
self.screens.current[u'size'].height()))
self.customWidthValueEdit.setValue(settings.value(u'width',
self.screens.current[u'size'].width()))
self.startPausedCheckBox.setChecked(settings.value(
u'audio start paused', True))
self.repeatListCheckBox.setChecked(settings.value(
u'audio repeat list', False))
settings.endGroup() settings.endGroup()
self.monitorComboBox.setDisabled(self.overrideRadioButton.isChecked()) self.monitorComboBox.setDisabled(self.overrideRadioButton.isChecked())
self.customXValueEdit.setEnabled(self.overrideRadioButton.isChecked()) self.customXValueEdit.setEnabled(self.overrideRadioButton.isChecked())
self.customYValueEdit.setEnabled(self.overrideRadioButton.isChecked()) self.customYValueEdit.setEnabled(self.overrideRadioButton.isChecked())
self.customHeightValueEdit.setEnabled( self.customHeightValueEdit.setEnabled(self.overrideRadioButton.isChecked())
self.overrideRadioButton.isChecked()) self.customWidthValueEdit.setEnabled(self.overrideRadioButton.isChecked())
self.customWidthValueEdit.setEnabled(
self.overrideRadioButton.isChecked())
self.display_changed = False self.display_changed = False
settings.beginGroup(self.settingsSection) settings.beginGroup(self.settingsSection)
@ -324,33 +285,25 @@ class GeneralTab(SettingsTab):
settings = Settings() settings = Settings()
settings.beginGroup(self.settingsSection) settings.beginGroup(self.settingsSection)
settings.setValue(u'monitor', self.monitorComboBox.currentIndex()) settings.setValue(u'monitor', self.monitorComboBox.currentIndex())
settings.setValue(u'display on monitor', settings.setValue(u'display on monitor', self.displayOnMonitorCheck.isChecked())
self.displayOnMonitorCheck.isChecked())
settings.setValue(u'blank warning', self.warningCheckBox.isChecked()) settings.setValue(u'blank warning', self.warningCheckBox.isChecked())
settings.setValue(u'auto open', self.autoOpenCheckBox.isChecked()) settings.setValue(u'auto open', self.autoOpenCheckBox.isChecked())
settings.setValue(u'show splash', self.showSplashCheckBox.isChecked()) settings.setValue(u'show splash', self.showSplashCheckBox.isChecked())
settings.setValue(u'update check', settings.setValue(u'update check', self.checkForUpdatesCheckBox.isChecked())
self.checkForUpdatesCheckBox.isChecked()) settings.setValue(u'save prompt', self.saveCheckServiceCheckBox.isChecked())
settings.setValue(u'save prompt',
self.saveCheckServiceCheckBox.isChecked())
settings.setValue(u'auto unblank', self.autoUnblankCheckBox.isChecked()) settings.setValue(u'auto unblank', self.autoUnblankCheckBox.isChecked())
settings.setValue(u'auto preview', self.autoPreviewCheckBox.isChecked()) settings.setValue(u'auto preview', self.autoPreviewCheckBox.isChecked())
settings.setValue(u'loop delay', self.timeoutSpinBox.value()) settings.setValue(u'loop delay', self.timeoutSpinBox.value())
settings.setValue(u'ccli number', self.numberEdit.displayText()) settings.setValue(u'ccli number', self.numberEdit.displayText())
settings.setValue(u'songselect username', settings.setValue(u'songselect username', self.usernameEdit.displayText())
self.usernameEdit.displayText()) settings.setValue(u'songselect password', self.passwordEdit.displayText())
settings.setValue(u'songselect password',
self.passwordEdit.displayText())
settings.setValue(u'x position', self.customXValueEdit.value()) settings.setValue(u'x position', self.customXValueEdit.value())
settings.setValue(u'y position', self.customYValueEdit.value()) settings.setValue(u'y position', self.customYValueEdit.value())
settings.setValue(u'height', self.customHeightValueEdit.value()) settings.setValue(u'height', self.customHeightValueEdit.value())
settings.setValue(u'width', self.customWidthValueEdit.value()) settings.setValue(u'width', self.customWidthValueEdit.value())
settings.setValue(u'override position', settings.setValue(u'override position', self.overrideRadioButton.isChecked())
self.overrideRadioButton.isChecked()) settings.setValue(u'audio start paused', self.startPausedCheckBox.isChecked())
settings.setValue(u'audio start paused', settings.setValue(u'audio repeat list', self.repeatListCheckBox.isChecked())
self.startPausedCheckBox.isChecked())
settings.setValue(u'audio repeat list',
self.repeatListCheckBox.isChecked())
settings.endGroup() settings.endGroup()
# On save update the screens as well # On save update the screens as well
self.postSetUp(True) self.postSetUp(True)
@ -360,8 +313,7 @@ class GeneralTab(SettingsTab):
Apply settings after settings tab has loaded and most of the Apply settings after settings tab has loaded and most of the
system so must be delayed system so must be delayed
""" """
Receiver.send_message(u'slidecontroller_live_spin_delay', Receiver.send_message(u'slidecontroller_live_spin_delay', self.timeoutSpinBox.value())
self.timeoutSpinBox.value())
# Do not continue on start up. # Do not continue on start up.
if not postUpdate: if not postUpdate:
return return

View File

@ -1,5 +1,5 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 # vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
@ -38,8 +38,8 @@ import sys
from PyQt4 import QtCore, QtGui, QtWebKit, QtOpenGL from PyQt4 import QtCore, QtGui, QtWebKit, QtOpenGL
from PyQt4.phonon import Phonon from PyQt4.phonon import Phonon
from openlp.core.lib import Receiver, build_html, ServiceItem, image_to_byte, \ from openlp.core.lib import Receiver, build_html, ServiceItem, image_to_byte, translate, PluginManager, expand_tags,\
translate, PluginManager, expand_tags, Settings, ImageSource Settings, ImageSource
from openlp.core.lib.theme import BackgroundType from openlp.core.lib.theme import BackgroundType
from openlp.core.ui import HideMode, ScreenList, AlertLocation from openlp.core.ui import HideMode, ScreenList, AlertLocation
@ -81,10 +81,8 @@ class Display(QtGui.QGraphicsView):
self.setGeometry(self.screen[u'size']) self.setGeometry(self.screen[u'size'])
log.debug(u'Setup webView') log.debug(u'Setup webView')
self.webView = QtWebKit.QWebView(self) self.webView = QtWebKit.QWebView(self)
self.webView.setGeometry(0, 0, self.webView.setGeometry(0, 0, self.screen[u'size'].width(), self.screen[u'size'].height())
self.screen[u'size'].width(), self.screen[u'size'].height()) self.webView.settings().setAttribute(QtWebKit.QWebSettings.PluginsEnabled, True)
self.webView.settings().setAttribute(
QtWebKit.QWebSettings.PluginsEnabled, True)
palette = self.webView.palette() palette = self.webView.palette()
palette.setBrush(QtGui.QPalette.Base, QtCore.Qt.transparent) palette.setBrush(QtGui.QPalette.Base, QtCore.Qt.transparent)
self.webView.page().setPalette(palette) self.webView.page().setPalette(palette)
@ -92,8 +90,7 @@ class Display(QtGui.QGraphicsView):
self.page = self.webView.page() self.page = self.webView.page()
self.frame = self.page.mainFrame() self.frame = self.page.mainFrame()
if self.isLive and log.getEffectiveLevel() == logging.DEBUG: if self.isLive and log.getEffectiveLevel() == logging.DEBUG:
self.webView.settings().setAttribute( self.webView.settings().setAttribute(QtWebKit.QWebSettings.DeveloperExtrasEnabled, True)
QtWebKit.QWebSettings.DeveloperExtrasEnabled, True)
QtCore.QObject.connect(self.webView, QtCore.QObject.connect(self.webView,
QtCore.SIGNAL(u'loadFinished(bool)'), self.isWebLoaded) QtCore.SIGNAL(u'loadFinished(bool)'), self.isWebLoaded)
self.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) self.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
@ -161,14 +158,10 @@ class MainDisplay(Display):
self.setAttribute(QtCore.Qt.WA_DeleteOnClose) self.setAttribute(QtCore.Qt.WA_DeleteOnClose)
self.setTransparency(False) self.setTransparency(False)
if self.isLive: if self.isLive:
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'live_display_hide'), self.hideDisplay)
QtCore.SIGNAL(u'live_display_hide'), self.hideDisplay) QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'live_display_show'), self.showDisplay)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'update_display_css'), self.cssChanged)
QtCore.SIGNAL(u'live_display_show'), self.showDisplay) QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'config_updated'), self.configChanged)
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'update_display_css'), self.cssChanged)
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'config_updated'), self.configChanged)
def setTransparency(self, enabled): def setTransparency(self, enabled):
if enabled: if enabled:
@ -211,12 +204,10 @@ class MainDisplay(Display):
if self.isLive: if self.isLive:
# Build the initial frame. # Build the initial frame.
background_color = QtGui.QColor() background_color = QtGui.QColor()
background_color.setNamedColor(Settings().value( background_color.setNamedColor(Settings().value(u'advanced/default color', u'#ffffff'))
u'advanced/default color', u'#ffffff'))
if not background_color.isValid(): if not background_color.isValid():
background_color = QtCore.Qt.white background_color = QtCore.Qt.white
image_file = Settings().value(u'advanced/default image', image_file = Settings().value(u'advanced/default image', u':/graphics/openlp-splash-screen.png')
u':/graphics/openlp-splash-screen.png')
splash_image = QtGui.QImage(image_file) splash_image = QtGui.QImage(image_file)
self.initialFrame = QtGui.QImage( self.initialFrame = QtGui.QImage(
self.screen[u'size'].width(), self.screen[u'size'].width(),
@ -252,8 +243,7 @@ class MainDisplay(Display):
Receiver.send_message(u'openlp_process_events') Receiver.send_message(u'openlp_process_events')
self.setGeometry(self.screen[u'size']) self.setGeometry(self.screen[u'size'])
if animate: if animate:
self.frame.evaluateJavaScript(u'show_text("%s")' % self.frame.evaluateJavaScript(u'show_text("%s")' % slide.replace(u'\\', u'\\\\').replace(u'\"', u'\\\"'))
slide.replace(u'\\', u'\\\\').replace(u'\"', u'\\\"'))
else: else:
# This exists for https://bugs.launchpad.net/openlp/+bug/1016843 # This exists for https://bugs.launchpad.net/openlp/+bug/1016843
# For unknown reasons if evaluateJavaScript is called # For unknown reasons if evaluateJavaScript is called
@ -274,10 +264,8 @@ class MainDisplay(Display):
log.debug(u'alert to display') log.debug(u'alert to display')
# First we convert <>& marks to html variants, then apply # First we convert <>& marks to html variants, then apply
# formattingtags, finally we double all backslashes for JavaScript. # formattingtags, finally we double all backslashes for JavaScript.
text_prepared = expand_tags( text_prepared = expand_tags(cgi.escape(text)).replace(u'\\', u'\\\\').replace(u'\"', u'\\\"')
cgi.escape(text)).replace(u'\\', u'\\\\').replace(u'\"', u'\\\"') if self.height() != self.screen[u'size'].height() or not self.isVisible():
if self.height() != self.screen[u'size'].height() or not \
self.isVisible():
shrink = True shrink = True
js = u'show_alert("%s", "%s")' % (text_prepared, u'top') js = u'show_alert("%s", "%s")' % (text_prepared, u'top')
else: else:
@ -290,11 +278,9 @@ class MainDisplay(Display):
self.resize(self.width(), alert_height) self.resize(self.width(), alert_height)
self.setVisible(True) self.setVisible(True)
if location == AlertLocation.Middle: if location == AlertLocation.Middle:
self.move(self.screen[u'size'].left(), self.move(self.screen[u'size'].left(), (self.screen[u'size'].height() - alert_height) / 2)
(self.screen[u'size'].height() - alert_height) / 2)
elif location == AlertLocation.Bottom: elif location == AlertLocation.Bottom:
self.move(self.screen[u'size'].left(), self.move(self.screen[u'size'].left(), self.screen[u'size'].height() - alert_height)
self.screen[u'size'].height() - alert_height)
else: else:
self.setVisible(False) self.setVisible(False)
self.setGeometry(self.screen[u'size']) self.setGeometry(self.screen[u'size'])
@ -363,10 +349,8 @@ class MainDisplay(Display):
if self.isLive and hasattr(self, u'serviceItem'): if self.isLive and hasattr(self, u'serviceItem'):
# Wait for the fade to finish before geting the preview. # Wait for the fade to finish before geting the preview.
# Important otherwise preview will have incorrect text if at all! # Important otherwise preview will have incorrect text if at all!
if self.serviceItem.themedata and \ if self.serviceItem.themedata and self.serviceItem.themedata.display_slide_transition:
self.serviceItem.themedata.display_slide_transition: while self.frame.evaluateJavaScript(u'show_text_complete()') == u'false':
while self.frame.evaluateJavaScript(u'show_text_complete()') \
== u'false':
Receiver.send_message(u'openlp_process_events') Receiver.send_message(u'openlp_process_events')
# Wait for the webview to update before getting the preview. # Wait for the webview to update before getting the preview.
# Important otherwise first preview will miss the background ! # Important otherwise first preview will miss the background !
@ -403,27 +387,22 @@ class MainDisplay(Display):
Receiver.send_message(u'video_background_replaced') Receiver.send_message(u'video_background_replaced')
self.override = {} self.override = {}
# We have a different theme. # We have a different theme.
elif self.override[u'theme'] != \ elif self.override[u'theme'] != serviceItem.themedata.background_filename:
serviceItem.themedata.background_filename:
Receiver.send_message(u'live_theme_changed') Receiver.send_message(u'live_theme_changed')
self.override = {} self.override = {}
else: else:
# replace the background # replace the background
background = self.imageManager.getImageBytes( background = self.imageManager.getImageBytes(self.override[u'image'], ImageSource.ImagePlugin)
self.override[u'image'], ImageSource.ImagePlugin)
self.setTransparency(self.serviceItem.themedata.background_type == self.setTransparency(self.serviceItem.themedata.background_type ==
BackgroundType.to_string(BackgroundType.Transparent)) BackgroundType.to_string(BackgroundType.Transparent))
if self.serviceItem.themedata.background_filename: if self.serviceItem.themedata.background_filename:
self.serviceItem.bg_image_bytes = self.imageManager.getImageBytes( self.serviceItem.bg_image_bytes = self.imageManager.getImageBytes(
self.serviceItem.themedata.background_filename, self.serviceItem.themedata.background_filename,ImageSource.Theme)
ImageSource.Theme)
if image_path: if image_path:
image_bytes = self.imageManager.getImageBytes( image_bytes = self.imageManager.getImageBytes(image_path, ImageSource.ImagePlugin)
image_path, ImageSource.ImagePlugin)
else: else:
image_bytes = None image_bytes = None
html = build_html(self.serviceItem, self.screen, self.isLive, html = build_html(self.serviceItem, self.screen, self.isLive, background, image_bytes, self.plugins)
background, image_bytes, self.plugins)
log.debug(u'buildHtml - pre setHtml') log.debug(u'buildHtml - pre setHtml')
self.webView.setHtml(html) self.webView.setHtml(html)
log.debug(u'buildHtml - post setHtml') log.debug(u'buildHtml - post setHtml')
@ -442,8 +421,7 @@ class MainDisplay(Display):
Display the Footer Display the Footer
""" """
log.debug(u'footer') log.debug(u'footer')
js = u'show_footer(\'' + \ js = u'show_footer(\'' + text.replace(u'\\', u'\\\\').replace(u'\'', u'\\\'') + u'\')'
text.replace(u'\\', u'\\\\').replace(u'\'', u'\\\'') + u'\')'
self.frame.evaluateJavaScript(js) self.frame.evaluateJavaScript(js)
def hideDisplay(self, mode=HideMode.Screen): def hideDisplay(self, mode=HideMode.Screen):
@ -523,10 +501,8 @@ class AudioPlayer(QtCore.QObject):
self.mediaObject.setTickInterval(100) self.mediaObject.setTickInterval(100)
self.audioObject = Phonon.AudioOutput(Phonon.VideoCategory) self.audioObject = Phonon.AudioOutput(Phonon.VideoCategory)
Phonon.createPath(self.mediaObject, self.audioObject) Phonon.createPath(self.mediaObject, self.audioObject)
QtCore.QObject.connect(self.mediaObject, QtCore.QObject.connect(self.mediaObject, QtCore.SIGNAL(u'aboutToFinish()'), self.onAboutToFinish)
QtCore.SIGNAL(u'aboutToFinish()'), self.onAboutToFinish) QtCore.QObject.connect(self.mediaObject, QtCore.SIGNAL(u'finished()'), self.onFinished)
QtCore.QObject.connect(self.mediaObject,
QtCore.SIGNAL(u'finished()'), self.onFinished)
def __del__(self): def __del__(self):
""" """
@ -621,5 +597,6 @@ class AudioPlayer(QtCore.QObject):
if isPlaying: if isPlaying:
self.mediaObject.play() self.mediaObject.play()
#@todo is this used?
def connectSlot(self, signal, slot): def connectSlot(self, signal, slot):
QtCore.QObject.connect(self.mediaObject, signal, slot) QtCore.QObject.connect(self.mediaObject, signal, slot)

View File

@ -1,5 +1,5 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 # vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
@ -39,16 +39,15 @@ from datetime import datetime
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from openlp.core.lib import Renderer, build_icon, OpenLPDockWidget, \ from openlp.core.lib import Renderer, build_icon, OpenLPDockWidget, PluginManager, Receiver, translate, ImageManager, \
PluginManager, Receiver, translate, ImageManager, PluginStatus PluginStatus
from openlp.core.lib.ui import UiStrings, create_action from openlp.core.lib.ui import UiStrings, create_action
from openlp.core.lib import SlideLimits, Settings from openlp.core.lib import SlideLimits, Settings
from openlp.core.ui import AboutForm, SettingsForm, ServiceManager, \ from openlp.core.ui import AboutForm, SettingsForm, ServiceManager, ThemeManager, SlideController, PluginForm, \
ThemeManager, SlideController, PluginForm, MediaDockManager, \ MediaDockManager, ShortcutListForm, FormattingTagForm
ShortcutListForm, FormattingTagForm
from openlp.core.ui.media import MediaController from openlp.core.ui.media import MediaController
from openlp.core.utils import AppLocation, add_actions, LanguageManager, \ from openlp.core.utils import AppLocation, add_actions, LanguageManager, get_application_version, \
get_application_version, get_filesystem_encoding get_filesystem_encoding
from openlp.core.utils.actions import ActionList, CategoryOrder from openlp.core.utils.actions import ActionList, CategoryOrder
from openlp.core.ui.firsttimeform import FirstTimeForm from openlp.core.ui.firsttimeform import FirstTimeForm
from openlp.core.ui import ScreenList from openlp.core.ui import ScreenList
@ -150,36 +149,28 @@ class Ui_MainWindow(object):
self.defaultThemeLabel.setObjectName(u'defaultThemeLabel') self.defaultThemeLabel.setObjectName(u'defaultThemeLabel')
self.statusBar.addPermanentWidget(self.defaultThemeLabel) self.statusBar.addPermanentWidget(self.defaultThemeLabel)
# Create the MediaManager # Create the MediaManager
self.mediaManagerDock = OpenLPDockWidget(mainWindow, self.mediaManagerDock = OpenLPDockWidget(mainWindow,u'mediaManagerDock', u':/system/system_mediamanager.png')
u'mediaManagerDock', u':/system/system_mediamanager.png')
self.mediaManagerDock.setStyleSheet(MEDIA_MANAGER_STYLE) self.mediaManagerDock.setStyleSheet(MEDIA_MANAGER_STYLE)
# Create the media toolbox # Create the media toolbox
self.mediaToolBox = QtGui.QToolBox(self.mediaManagerDock) self.mediaToolBox = QtGui.QToolBox(self.mediaManagerDock)
self.mediaToolBox.setObjectName(u'mediaToolBox') self.mediaToolBox.setObjectName(u'mediaToolBox')
self.mediaManagerDock.setWidget(self.mediaToolBox) self.mediaManagerDock.setWidget(self.mediaToolBox)
mainWindow.addDockWidget(QtCore.Qt.LeftDockWidgetArea, mainWindow.addDockWidget(QtCore.Qt.LeftDockWidgetArea, self.mediaManagerDock)
self.mediaManagerDock)
# Create the service manager # Create the service manager
self.serviceManagerDock = OpenLPDockWidget(mainWindow, self.serviceManagerDock = OpenLPDockWidget(mainWindow, u'serviceManagerDock',
u'serviceManagerDock', u':/system/system_servicemanager.png') u':/system/system_servicemanager.png')
self.serviceManagerContents = ServiceManager(mainWindow, self.serviceManagerContents = ServiceManager(mainWindow, self.serviceManagerDock)
self.serviceManagerDock)
self.serviceManagerDock.setWidget(self.serviceManagerContents) self.serviceManagerDock.setWidget(self.serviceManagerContents)
mainWindow.addDockWidget(QtCore.Qt.RightDockWidgetArea, mainWindow.addDockWidget(QtCore.Qt.RightDockWidgetArea, self.serviceManagerDock)
self.serviceManagerDock)
# Create the theme manager # Create the theme manager
self.themeManagerDock = OpenLPDockWidget(mainWindow, self.themeManagerDock = OpenLPDockWidget(mainWindow, u'themeManagerDock', u':/system/system_thememanager.png')
u'themeManagerDock', u':/system/system_thememanager.png') self.themeManagerContents = ThemeManager(mainWindow, self.themeManagerDock)
self.themeManagerContents = ThemeManager(mainWindow,
self.themeManagerDock)
self.themeManagerContents.setObjectName(u'themeManagerContents') self.themeManagerContents.setObjectName(u'themeManagerContents')
self.themeManagerDock.setWidget(self.themeManagerContents) self.themeManagerDock.setWidget(self.themeManagerContents)
mainWindow.addDockWidget(QtCore.Qt.RightDockWidgetArea, mainWindow.addDockWidget(QtCore.Qt.RightDockWidgetArea, self.themeManagerDock)
self.themeManagerDock)
# Create the menu items # Create the menu items
action_list = ActionList.get_instance() action_list = ActionList.get_instance()
action_list.add_category(UiStrings().File, action_list.add_category(UiStrings().File, CategoryOrder.standardMenu)
CategoryOrder.standardMenu)
self.fileNewItem = create_action(mainWindow, u'fileNewItem', self.fileNewItem = create_action(mainWindow, u'fileNewItem',
icon=u':/general/general_new.png', icon=u':/general/general_new.png',
shortcuts=[QtGui.QKeySequence(u'Ctrl+N')], shortcuts=[QtGui.QKeySequence(u'Ctrl+N')],
@ -209,20 +200,13 @@ class Ui_MainWindow(object):
category=UiStrings().File, triggers=mainWindow.close) category=UiStrings().File, triggers=mainWindow.close)
# Give QT Extra Hint that this is the Exit Menu Item # Give QT Extra Hint that this is the Exit Menu Item
self.fileExitItem.setMenuRole(QtGui.QAction.QuitRole) self.fileExitItem.setMenuRole(QtGui.QAction.QuitRole)
action_list.add_category(UiStrings().Import, action_list.add_category(UiStrings().Import, CategoryOrder.standardMenu)
CategoryOrder.standardMenu) self.importThemeItem = create_action(mainWindow, u'importThemeItem', category=UiStrings().Import)
self.importThemeItem = create_action(mainWindow, self.importLanguageItem = create_action(mainWindow, u'importLanguageItem')
u'importThemeItem', category=UiStrings().Import) action_list.add_category(UiStrings().Export, CategoryOrder.standardMenu)
self.importLanguageItem = create_action(mainWindow, self.exportThemeItem = create_action(mainWindow, u'exportThemeItem', category=UiStrings().Export)
u'importLanguageItem')#, category=UiStrings().Import) self.exportLanguageItem = create_action(mainWindow, u'exportLanguageItem')
action_list.add_category(UiStrings().Export, action_list.add_category(UiStrings().View, CategoryOrder.standardMenu)
CategoryOrder.standardMenu)
self.exportThemeItem = create_action(mainWindow,
u'exportThemeItem', category=UiStrings().Export)
self.exportLanguageItem = create_action(mainWindow,
u'exportLanguageItem')#, category=UiStrings().Export)
action_list.add_category(UiStrings().View,
CategoryOrder.standardMenu)
self.viewMediaManagerItem = create_action(mainWindow, self.viewMediaManagerItem = create_action(mainWindow,
u'viewMediaManagerItem', shortcuts=[QtGui.QKeySequence(u'F8')], u'viewMediaManagerItem', shortcuts=[QtGui.QKeySequence(u'F8')],
icon=u':/system/system_mediamanager.png', icon=u':/system/system_mediamanager.png',
@ -248,12 +232,10 @@ class Ui_MainWindow(object):
checked=panelLocked, triggers=self.setLockPanel) checked=panelLocked, triggers=self.setLockPanel)
action_list.add_category(UiStrings().ViewMode, action_list.add_category(UiStrings().ViewMode,
CategoryOrder.standardMenu) CategoryOrder.standardMenu)
self.modeDefaultItem = create_action(mainWindow, u'modeDefaultItem', self.modeDefaultItem = create_action(mainWindow, u'modeDefaultItem', checked=False,
checked=False, category=UiStrings().ViewMode) category=UiStrings().ViewMode)
self.modeSetupItem = create_action(mainWindow, u'modeSetupItem', self.modeSetupItem = create_action(mainWindow, u'modeSetupItem', checked=False, category=UiStrings().ViewMode)
checked=False, category=UiStrings().ViewMode) self.modeLiveItem = create_action(mainWindow, u'modeLiveItem', checked=True, category=UiStrings().ViewMode)
self.modeLiveItem = create_action(mainWindow, u'modeLiveItem',
checked=True, category=UiStrings().ViewMode)
self.modeGroup = QtGui.QActionGroup(mainWindow) self.modeGroup = QtGui.QActionGroup(mainWindow)
self.modeGroup.addAction(self.modeDefaultItem) self.modeGroup.addAction(self.modeDefaultItem)
self.modeGroup.addAction(self.modeSetupItem) self.modeGroup.addAction(self.modeSetupItem)
@ -288,29 +270,21 @@ class Ui_MainWindow(object):
qmList = LanguageManager.get_qm_list() qmList = LanguageManager.get_qm_list()
savedLanguage = LanguageManager.get_language() savedLanguage = LanguageManager.get_language()
for key in sorted(qmList.keys()): for key in sorted(qmList.keys()):
languageItem = create_action(mainWindow, key, languageItem = create_action(mainWindow, key, checked=qmList[key] == savedLanguage)
checked=qmList[key] == savedLanguage)
add_actions(self.languageGroup, [languageItem]) add_actions(self.languageGroup, [languageItem])
self.settingsShortcutsItem = create_action(mainWindow, self.settingsShortcutsItem = create_action(mainWindow, u'settingsShortcutsItem',
u'settingsShortcutsItem', icon=u':/system/system_configure_shortcuts.png', category=UiStrings().Settings)
icon=u':/system/system_configure_shortcuts.png',
category=UiStrings().Settings)
# Formatting Tags were also known as display tags. # Formatting Tags were also known as display tags.
self.formattingTagItem = create_action(mainWindow, self.formattingTagItem = create_action(mainWindow, u'displayTagItem',
u'displayTagItem', icon=u':/system/tag_editor.png', icon=u':/system/tag_editor.png', category=UiStrings().Settings)
category=UiStrings().Settings) self.settingsConfigureItem = create_action(mainWindow, u'settingsConfigureItem',
self.settingsConfigureItem = create_action(mainWindow, icon=u':/system/system_settings.png', category=UiStrings().Settings)
u'settingsConfigureItem', icon=u':/system/system_settings.png',
category=UiStrings().Settings)
# Give QT Extra Hint that this is the Preferences Menu Item # Give QT Extra Hint that this is the Preferences Menu Item
self.settingsConfigureItem.setMenuRole(QtGui.QAction.PreferencesRole) self.settingsConfigureItem.setMenuRole(QtGui.QAction.PreferencesRole)
self.settingsImportItem = create_action(mainWindow, self.settingsImportItem = create_action(mainWindow, u'settingsImportItem', category=UiStrings().Settings)
u'settingsImportItem', category=UiStrings().Settings) self.settingsExportItem = create_action(mainWindow, u'settingsExportItem', category=UiStrings().Settings)
self.settingsExportItem = create_action(mainWindow,
u'settingsExportItem', category=UiStrings().Settings)
action_list.add_category(UiStrings().Help, CategoryOrder.standardMenu) action_list.add_category(UiStrings().Help, CategoryOrder.standardMenu)
self.aboutItem = create_action(mainWindow, u'aboutItem', self.aboutItem = create_action(mainWindow, u'aboutItem', icon=u':/system/system_about.png',
icon=u':/system/system_about.png',
shortcuts=[QtGui.QKeySequence(u'Ctrl+F1')], shortcuts=[QtGui.QKeySequence(u'Ctrl+F1')],
category=UiStrings().Help, triggers=self.onAboutItemClicked) category=UiStrings().Help, triggers=self.onAboutItemClicked)
# Give QT Extra Hint that this is an About Menu Item # Give QT Extra Hint that this is an About Menu Item
@ -326,22 +300,16 @@ class Ui_MainWindow(object):
icon=u':/system/system_online_help.png', icon=u':/system/system_online_help.png',
shortcuts=[QtGui.QKeySequence(u'Alt+F1')], shortcuts=[QtGui.QKeySequence(u'Alt+F1')],
category=UiStrings().Help, triggers=self.onOnlineHelpClicked) category=UiStrings().Help, triggers=self.onOnlineHelpClicked)
self.webSiteItem = create_action(mainWindow, self.webSiteItem = create_action(mainWindow, u'webSiteItem', category=UiStrings().Help)
u'webSiteItem', category=UiStrings().Help) add_actions(self.fileImportMenu, (self.settingsImportItem, None, self.importThemeItem, self.importLanguageItem))
add_actions(self.fileImportMenu, (self.settingsImportItem, None, add_actions(self.fileExportMenu, (self.settingsExportItem, None, self.exportThemeItem, self.exportLanguageItem))
self.importThemeItem, self.importLanguageItem))
add_actions(self.fileExportMenu, (self.settingsExportItem, None,
self.exportThemeItem, self.exportLanguageItem))
add_actions(self.fileMenu, (self.fileNewItem, self.fileOpenItem, add_actions(self.fileMenu, (self.fileNewItem, self.fileOpenItem,
self.fileSaveItem, self.fileSaveAsItem, self.fileSaveItem, self.fileSaveAsItem, self.recentFilesMenu.menuAction(), None,
self.recentFilesMenu.menuAction(), None, self.fileImportMenu.menuAction(), self.fileExportMenu.menuAction(), None, self.printServiceOrderItem,
self.fileImportMenu.menuAction(), self.fileExportMenu.menuAction(), self.fileExitItem))
None, self.printServiceOrderItem, self.fileExitItem)) add_actions(self.viewModeMenu, (self.modeDefaultItem, self.modeSetupItem, self.modeLiveItem))
add_actions(self.viewModeMenu, (self.modeDefaultItem, add_actions(self.viewMenu, (self.viewModeMenu.menuAction(), None, self.viewMediaManagerItem,
self.modeSetupItem, self.modeLiveItem)) self.viewServiceManagerItem, self.viewThemeManagerItem, None, self.viewPreviewPanel,
add_actions(self.viewMenu, (self.viewModeMenu.menuAction(),
None, self.viewMediaManagerItem, self.viewServiceManagerItem,
self.viewThemeManagerItem, None, self.viewPreviewPanel,
self.viewLivePanel, None, self.lockPanel)) self.viewLivePanel, None, self.lockPanel))
# i18n add Language Actions # i18n add Language Actions
add_actions(self.settingsLanguageMenu, (self.autoLanguageItem, None)) add_actions(self.settingsLanguageMenu, (self.autoLanguageItem, None))
@ -349,35 +317,27 @@ class Ui_MainWindow(object):
# Order things differently in OS X so that Preferences menu item in the # Order things differently in OS X so that Preferences menu item in the
# app menu is correct (this gets picked up automatically by Qt). # app menu is correct (this gets picked up automatically by Qt).
if sys.platform == u'darwin': if sys.platform == u'darwin':
add_actions(self.settingsMenu, (self.settingsPluginListItem, add_actions(self.settingsMenu, (self.settingsPluginListItem, self.settingsLanguageMenu.menuAction(), None,
self.settingsLanguageMenu.menuAction(), None, self.settingsConfigureItem, self.settingsShortcutsItem, self.formattingTagItem))
self.settingsConfigureItem, self.settingsShortcutsItem,
self.formattingTagItem))
else: else:
add_actions(self.settingsMenu, (self.settingsPluginListItem, add_actions(self.settingsMenu, (self.settingsPluginListItem, self.settingsLanguageMenu.menuAction(), None,
self.settingsLanguageMenu.menuAction(), None, self.formattingTagItem, self.settingsShortcutsItem, self.settingsConfigureItem))
self.formattingTagItem, self.settingsShortcutsItem,
self.settingsConfigureItem))
add_actions(self.toolsMenu, (self.toolsAddToolItem, None)) add_actions(self.toolsMenu, (self.toolsAddToolItem, None))
add_actions(self.toolsMenu, (self.toolsOpenDataFolder, None)) add_actions(self.toolsMenu, (self.toolsOpenDataFolder, None))
add_actions(self.toolsMenu, (self.toolsFirstTimeWizard, None)) add_actions(self.toolsMenu, (self.toolsFirstTimeWizard, None))
add_actions(self.toolsMenu, [self.updateThemeImages]) add_actions(self.toolsMenu, [self.updateThemeImages])
if os.name == u'nt': if os.name == u'nt':
add_actions(self.helpMenu, (self.offlineHelpItem, add_actions(self.helpMenu, (self.offlineHelpItem, self.onlineHelpItem, None, self.webSiteItem,
self.onlineHelpItem, None, self.webSiteItem, self.aboutItem))
self.aboutItem))
else: else:
add_actions(self.helpMenu, (self.onlineHelpItem, None, add_actions(self.helpMenu, (self.onlineHelpItem, None, self.webSiteItem, self.aboutItem))
self.webSiteItem, self.aboutItem)) add_actions(self.menuBar, (self.fileMenu.menuAction(), self.viewMenu.menuAction(), self.toolsMenu.menuAction(),
add_actions(self.menuBar, (self.fileMenu.menuAction(),
self.viewMenu.menuAction(), self.toolsMenu.menuAction(),
self.settingsMenu.menuAction(), self.helpMenu.menuAction())) self.settingsMenu.menuAction(), self.helpMenu.menuAction()))
# Initialise the translation # Initialise the translation
self.retranslateUi(mainWindow) self.retranslateUi(mainWindow)
self.mediaToolBox.setCurrentIndex(0) self.mediaToolBox.setCurrentIndex(0)
# Connect up some signals and slots # Connect up some signals and slots
QtCore.QObject.connect(self.fileMenu, QtCore.QObject.connect(self.fileMenu, QtCore.SIGNAL(u'aboutToShow()'), self.updateRecentFilesMenu)
QtCore.SIGNAL(u'aboutToShow()'), self.updateRecentFilesMenu)
# Hide the entry, as it does not have any functionality yet. # Hide the entry, as it does not have any functionality yet.
self.toolsAddToolItem.setVisible(False) self.toolsAddToolItem.setVisible(False)
self.importLanguageItem.setVisible(False) self.importLanguageItem.setVisible(False)
@ -394,152 +354,94 @@ class Ui_MainWindow(object):
self.fileMenu.setTitle(translate('OpenLP.MainWindow', '&File')) self.fileMenu.setTitle(translate('OpenLP.MainWindow', '&File'))
self.fileImportMenu.setTitle(translate('OpenLP.MainWindow', '&Import')) self.fileImportMenu.setTitle(translate('OpenLP.MainWindow', '&Import'))
self.fileExportMenu.setTitle(translate('OpenLP.MainWindow', '&Export')) self.fileExportMenu.setTitle(translate('OpenLP.MainWindow', '&Export'))
self.recentFilesMenu.setTitle( self.recentFilesMenu.setTitle(translate('OpenLP.MainWindow', '&Recent Files'))
translate('OpenLP.MainWindow', '&Recent Files'))
self.viewMenu.setTitle(translate('OpenLP.MainWindow', '&View')) self.viewMenu.setTitle(translate('OpenLP.MainWindow', '&View'))
self.viewModeMenu.setTitle(translate('OpenLP.MainWindow', 'M&ode')) self.viewModeMenu.setTitle(translate('OpenLP.MainWindow', 'M&ode'))
self.toolsMenu.setTitle(translate('OpenLP.MainWindow', '&Tools')) self.toolsMenu.setTitle(translate('OpenLP.MainWindow', '&Tools'))
self.settingsMenu.setTitle(translate('OpenLP.MainWindow', '&Settings')) self.settingsMenu.setTitle(translate('OpenLP.MainWindow', '&Settings'))
self.settingsLanguageMenu.setTitle(translate('OpenLP.MainWindow', self.settingsLanguageMenu.setTitle(translate('OpenLP.MainWindow', '&Language'))
'&Language'))
self.helpMenu.setTitle(translate('OpenLP.MainWindow', '&Help')) self.helpMenu.setTitle(translate('OpenLP.MainWindow', '&Help'))
self.mediaManagerDock.setWindowTitle( self.mediaManagerDock.setWindowTitle(translate('OpenLP.MainWindow', 'Media Manager'))
translate('OpenLP.MainWindow', 'Media Manager')) self.serviceManagerDock.setWindowTitle(translate('OpenLP.MainWindow', 'Service Manager'))
self.serviceManagerDock.setWindowTitle( self.themeManagerDock.setWindowTitle(translate('OpenLP.MainWindow', 'Theme Manager'))
translate('OpenLP.MainWindow', 'Service Manager'))
self.themeManagerDock.setWindowTitle(
translate('OpenLP.MainWindow', 'Theme Manager'))
self.fileNewItem.setText(translate('OpenLP.MainWindow', '&New')) self.fileNewItem.setText(translate('OpenLP.MainWindow', '&New'))
self.fileNewItem.setToolTip(UiStrings().NewService) self.fileNewItem.setToolTip(UiStrings().NewService)
self.fileNewItem.setStatusTip(UiStrings().CreateService) self.fileNewItem.setStatusTip(UiStrings().CreateService)
self.fileOpenItem.setText(translate('OpenLP.MainWindow', '&Open')) self.fileOpenItem.setText(translate('OpenLP.MainWindow', '&Open'))
self.fileOpenItem.setToolTip(UiStrings().OpenService) self.fileOpenItem.setToolTip(UiStrings().OpenService)
self.fileOpenItem.setStatusTip( self.fileOpenItem.setStatusTip(translate('OpenLP.MainWindow', 'Open an existing service.'))
translate('OpenLP.MainWindow', 'Open an existing service.'))
self.fileSaveItem.setText(translate('OpenLP.MainWindow', '&Save')) self.fileSaveItem.setText(translate('OpenLP.MainWindow', '&Save'))
self.fileSaveItem.setToolTip(UiStrings().SaveService) self.fileSaveItem.setToolTip(UiStrings().SaveService)
self.fileSaveItem.setStatusTip( self.fileSaveItem.setStatusTip(translate('OpenLP.MainWindow', 'Save the current service to disk.'))
translate('OpenLP.MainWindow', 'Save the current service to disk.')) self.fileSaveAsItem.setText(translate('OpenLP.MainWindow', 'Save &As...'))
self.fileSaveAsItem.setText( self.fileSaveAsItem.setToolTip(translate('OpenLP.MainWindow', 'Save Service As'))
translate('OpenLP.MainWindow', 'Save &As...')) self.fileSaveAsItem.setStatusTip(translate('OpenLP.MainWindow', 'Save the current service under a new name.'))
self.fileSaveAsItem.setToolTip(
translate('OpenLP.MainWindow', 'Save Service As'))
self.fileSaveAsItem.setStatusTip(translate('OpenLP.MainWindow',
'Save the current service under a new name.'))
self.printServiceOrderItem.setText(UiStrings().PrintService) self.printServiceOrderItem.setText(UiStrings().PrintService)
self.printServiceOrderItem.setStatusTip(translate('OpenLP.MainWindow', self.printServiceOrderItem.setStatusTip(translate('OpenLP.MainWindow', 'Print the current service.'))
'Print the current service.')) self.fileExitItem.setText(translate('OpenLP.MainWindow', 'E&xit'))
self.fileExitItem.setText( self.fileExitItem.setStatusTip(translate('OpenLP.MainWindow', 'Quit OpenLP'))
translate('OpenLP.MainWindow', 'E&xit')) self.importThemeItem.setText(translate('OpenLP.MainWindow', '&Theme'))
self.fileExitItem.setStatusTip( self.importLanguageItem.setText(translate('OpenLP.MainWindow', '&Language'))
translate('OpenLP.MainWindow', 'Quit OpenLP')) self.exportThemeItem.setText(translate('OpenLP.MainWindow', '&Theme'))
self.importThemeItem.setText( self.exportLanguageItem.setText(translate('OpenLP.MainWindow', '&Language'))
translate('OpenLP.MainWindow', '&Theme')) self.settingsShortcutsItem.setText(translate('OpenLP.MainWindow', 'Configure &Shortcuts...'))
self.importLanguageItem.setText( self.formattingTagItem.setText(translate('OpenLP.MainWindow', 'Configure &Formatting Tags...'))
translate('OpenLP.MainWindow', '&Language')) self.settingsConfigureItem.setText(translate('OpenLP.MainWindow', '&Configure OpenLP...'))
self.exportThemeItem.setText(
translate('OpenLP.MainWindow', '&Theme'))
self.exportLanguageItem.setText(
translate('OpenLP.MainWindow', '&Language'))
self.settingsShortcutsItem.setText(
translate('OpenLP.MainWindow', 'Configure &Shortcuts...'))
self.formattingTagItem.setText(
translate('OpenLP.MainWindow', 'Configure &Formatting Tags...'))
self.settingsConfigureItem.setText(
translate('OpenLP.MainWindow', '&Configure OpenLP...'))
self.settingsExportItem.setStatusTip(translate('OpenLP.MainWindow', self.settingsExportItem.setStatusTip(translate('OpenLP.MainWindow',
'Export OpenLP settings to a specified *.config file')) 'Export OpenLP settings to a specified *.config file'))
self.settingsExportItem.setText( self.settingsExportItem.setText(translate('OpenLP.MainWindow', 'Settings'))
translate('OpenLP.MainWindow', 'Settings'))
self.settingsImportItem.setStatusTip(translate('OpenLP.MainWindow', self.settingsImportItem.setStatusTip(translate('OpenLP.MainWindow',
'Import OpenLP settings from a specified *.config file previously ' 'Import OpenLP settings from a specified *.config file previously exported on this or another machine'))
'exported on this or another machine')) self.settingsImportItem.setText(translate('OpenLP.MainWindow', 'Settings'))
self.settingsImportItem.setText( self.viewMediaManagerItem.setText(translate('OpenLP.MainWindow', '&Media Manager'))
translate('OpenLP.MainWindow', 'Settings')) self.viewMediaManagerItem.setToolTip(translate('OpenLP.MainWindow', 'Toggle Media Manager'))
self.viewMediaManagerItem.setText(
translate('OpenLP.MainWindow', '&Media Manager'))
self.viewMediaManagerItem.setToolTip(
translate('OpenLP.MainWindow', 'Toggle Media Manager'))
self.viewMediaManagerItem.setStatusTip(translate('OpenLP.MainWindow', self.viewMediaManagerItem.setStatusTip(translate('OpenLP.MainWindow',
'Toggle the visibility of the media manager.')) 'Toggle the visibility of the media manager.'))
self.viewThemeManagerItem.setText( self.viewThemeManagerItem.setText(translate('OpenLP.MainWindow', '&Theme Manager'))
translate('OpenLP.MainWindow', '&Theme Manager')) self.viewThemeManagerItem.setToolTip(translate('OpenLP.MainWindow', 'Toggle Theme Manager'))
self.viewThemeManagerItem.setToolTip(
translate('OpenLP.MainWindow', 'Toggle Theme Manager'))
self.viewThemeManagerItem.setStatusTip(translate('OpenLP.MainWindow', self.viewThemeManagerItem.setStatusTip(translate('OpenLP.MainWindow',
'Toggle the visibility of the theme manager.')) 'Toggle the visibility of the theme manager.'))
self.viewServiceManagerItem.setText( self.viewServiceManagerItem.setText(translate('OpenLP.MainWindow', '&Service Manager'))
translate('OpenLP.MainWindow', '&Service Manager')) self.viewServiceManagerItem.setToolTip(translate('OpenLP.MainWindow', 'Toggle Service Manager'))
self.viewServiceManagerItem.setToolTip(
translate('OpenLP.MainWindow', 'Toggle Service Manager'))
self.viewServiceManagerItem.setStatusTip(translate('OpenLP.MainWindow', self.viewServiceManagerItem.setStatusTip(translate('OpenLP.MainWindow',
'Toggle the visibility of the service manager.')) 'Toggle the visibility of the service manager.'))
self.viewPreviewPanel.setText( self.viewPreviewPanel.setText(translate('OpenLP.MainWindow', '&Preview Panel'))
translate('OpenLP.MainWindow', '&Preview Panel')) self.viewPreviewPanel.setToolTip(translate('OpenLP.MainWindow', 'Toggle Preview Panel'))
self.viewPreviewPanel.setToolTip( self.viewPreviewPanel.setStatusTip(translate('OpenLP.MainWindow', 'Toggle the visibility of the preview panel.'))
translate('OpenLP.MainWindow', 'Toggle Preview Panel')) self.viewLivePanel.setText(translate('OpenLP.MainWindow', '&Live Panel'))
self.viewPreviewPanel.setStatusTip(translate('OpenLP.MainWindow', self.viewLivePanel.setToolTip(translate('OpenLP.MainWindow', 'Toggle Live Panel'))
'Toggle the visibility of the preview panel.')) self.lockPanel.setText(translate('OpenLP.MainWindow', 'L&ock Panels'))
self.viewLivePanel.setText( self.lockPanel.setStatusTip(translate('OpenLP.MainWindow', 'Prevent the panels being moved.'))
translate('OpenLP.MainWindow', '&Live Panel')) self.viewLivePanel.setStatusTip(translate('OpenLP.MainWindow', 'Toggle the visibility of the live panel.'))
self.viewLivePanel.setToolTip( self.settingsPluginListItem.setText(translate('OpenLP.MainWindow', '&Plugin List'))
translate('OpenLP.MainWindow', 'Toggle Live Panel')) self.settingsPluginListItem.setStatusTip(translate('OpenLP.MainWindow', 'List the Plugins'))
self.lockPanel.setText(
translate('OpenLP.MainWindow', 'L&ock Panels'))
self.lockPanel.setStatusTip(
translate('OpenLP.MainWindow', 'Prevent the panels being moved.'))
self.viewLivePanel.setStatusTip(translate('OpenLP.MainWindow',
'Toggle the visibility of the live panel.'))
self.settingsPluginListItem.setText(translate('OpenLP.MainWindow',
'&Plugin List'))
self.settingsPluginListItem.setStatusTip(
translate('OpenLP.MainWindow', 'List the Plugins'))
self.aboutItem.setText(translate('OpenLP.MainWindow', '&About')) self.aboutItem.setText(translate('OpenLP.MainWindow', '&About'))
self.aboutItem.setStatusTip( self.aboutItem.setStatusTip(translate('OpenLP.MainWindow', 'More information about OpenLP'))
translate('OpenLP.MainWindow', 'More information about OpenLP'))
if os.name == u'nt': if os.name == u'nt':
self.offlineHelpItem.setText( self.offlineHelpItem.setText(translate('OpenLP.MainWindow', '&User Guide'))
translate('OpenLP.MainWindow', '&User Guide')) self.onlineHelpItem.setText(translate('OpenLP.MainWindow', '&Online Help'))
self.onlineHelpItem.setText( self.webSiteItem.setText(translate('OpenLP.MainWindow', '&Web Site'))
translate('OpenLP.MainWindow', '&Online Help'))
self.webSiteItem.setText(
translate('OpenLP.MainWindow', '&Web Site'))
for item in self.languageGroup.actions(): for item in self.languageGroup.actions():
item.setText(item.objectName()) item.setText(item.objectName())
item.setStatusTip(translate('OpenLP.MainWindow', item.setStatusTip(translate('OpenLP.MainWindow', 'Set the interface language to %s') % item.objectName())
'Set the interface language to %s') % item.objectName()) self.autoLanguageItem.setText(translate('OpenLP.MainWindow', '&Autodetect'))
self.autoLanguageItem.setText( self.autoLanguageItem.setStatusTip(translate('OpenLP.MainWindow', 'Use the system language, if available.'))
translate('OpenLP.MainWindow', '&Autodetect')) self.toolsAddToolItem.setText(translate('OpenLP.MainWindow', 'Add &Tool...'))
self.autoLanguageItem.setStatusTip(translate('OpenLP.MainWindow', self.toolsAddToolItem.setStatusTip(translate('OpenLP.MainWindow', 'Add an application to the list of tools.'))
'Use the system language, if available.')) self.toolsOpenDataFolder.setText(translate('OpenLP.MainWindow', 'Open &Data Folder...'))
self.toolsAddToolItem.setText(
translate('OpenLP.MainWindow', 'Add &Tool...'))
self.toolsAddToolItem.setStatusTip(translate('OpenLP.MainWindow',
'Add an application to the list of tools.'))
self.toolsOpenDataFolder.setText(
translate('OpenLP.MainWindow', 'Open &Data Folder...'))
self.toolsOpenDataFolder.setStatusTip(translate('OpenLP.MainWindow', self.toolsOpenDataFolder.setStatusTip(translate('OpenLP.MainWindow',
'Open the folder where songs, bibles and other data resides.')) 'Open the folder where songs, bibles and other data resides.'))
self.toolsFirstTimeWizard.setText( self.toolsFirstTimeWizard.setText(translate('OpenLP.MainWindow', 'Re-run First Time Wizard'))
translate('OpenLP.MainWindow', 'Re-run First Time Wizard'))
self.toolsFirstTimeWizard.setStatusTip(translate('OpenLP.MainWindow', self.toolsFirstTimeWizard.setStatusTip(translate('OpenLP.MainWindow',
'Re-run the First Time Wizard, importing songs, Bibles and ' 'Re-run the First Time Wizard, importing songs, Bibles and themes.'))
'themes.')) self.updateThemeImages.setText(translate('OpenLP.MainWindow', 'Update Theme Images'))
self.updateThemeImages.setText( self.updateThemeImages.setStatusTip(translate('OpenLP.MainWindow', 'Update the preview images for all themes.'))
translate('OpenLP.MainWindow', 'Update Theme Images')) self.modeDefaultItem.setText(translate('OpenLP.MainWindow', '&Default'))
self.updateThemeImages.setStatusTip( self.modeDefaultItem.setStatusTip(translate('OpenLP.MainWindow', 'Set the view mode back to the default.'))
translate('OpenLP.MainWindow', 'Update the preview images for all '
'themes.'))
self.modeDefaultItem.setText(
translate('OpenLP.MainWindow', '&Default'))
self.modeDefaultItem.setStatusTip(translate('OpenLP.MainWindow',
'Set the view mode back to the default.'))
self.modeSetupItem.setText(translate('OpenLP.MainWindow', '&Setup')) self.modeSetupItem.setText(translate('OpenLP.MainWindow', '&Setup'))
self.modeSetupItem.setStatusTip( self.modeSetupItem.setStatusTip(translate('OpenLP.MainWindow', 'Set the view mode to Setup.'))
translate('OpenLP.MainWindow', 'Set the view mode to Setup.'))
self.modeLiveItem.setText(translate('OpenLP.MainWindow', '&Live')) self.modeLiveItem.setText(translate('OpenLP.MainWindow', '&Live'))
self.modeLiveItem.setStatusTip( self.modeLiveItem.setStatusTip(translate('OpenLP.MainWindow', 'Set the view mode to Live.'))
translate('OpenLP.MainWindow', 'Set the view mode to Live.'))
class MainWindow(QtGui.QMainWindow, Ui_MainWindow): class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
@ -592,75 +494,50 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
self.newDataPath = u'' self.newDataPath = u''
self.copyData = False self.copyData = False
# Set up signals and slots # Set up signals and slots
QtCore.QObject.connect(self.importThemeItem, QtCore.QObject.connect(self.importThemeItem, QtCore.SIGNAL(u'triggered()'),
QtCore.SIGNAL(u'triggered()'),
self.themeManagerContents.onImportTheme) self.themeManagerContents.onImportTheme)
QtCore.QObject.connect(self.exportThemeItem, QtCore.QObject.connect(self.exportThemeItem, QtCore.SIGNAL(u'triggered()'),
QtCore.SIGNAL(u'triggered()'),
self.themeManagerContents.onExportTheme) self.themeManagerContents.onExportTheme)
QtCore.QObject.connect(self.mediaManagerDock, QtCore.QObject.connect(self.mediaManagerDock, QtCore.SIGNAL(u'visibilityChanged(bool)'),
QtCore.SIGNAL(u'visibilityChanged(bool)'),
self.viewMediaManagerItem.setChecked) self.viewMediaManagerItem.setChecked)
QtCore.QObject.connect(self.serviceManagerDock, QtCore.QObject.connect(self.serviceManagerDock, QtCore.SIGNAL(u'visibilityChanged(bool)'),
QtCore.SIGNAL(u'visibilityChanged(bool)'),
self.viewServiceManagerItem.setChecked) self.viewServiceManagerItem.setChecked)
QtCore.QObject.connect(self.themeManagerDock, QtCore.QObject.connect(self.themeManagerDock, QtCore.SIGNAL(u'visibilityChanged(bool)'),
QtCore.SIGNAL(u'visibilityChanged(bool)'),
self.viewThemeManagerItem.setChecked) self.viewThemeManagerItem.setChecked)
QtCore.QObject.connect(self.webSiteItem, QtCore.QObject.connect(self.webSiteItem, QtCore.SIGNAL(u'triggered()'), self.onHelpWebSiteClicked)
QtCore.SIGNAL(u'triggered()'), self.onHelpWebSiteClicked) QtCore.QObject.connect(self.toolsOpenDataFolder, QtCore.SIGNAL(u'triggered()'),
QtCore.QObject.connect(self.toolsOpenDataFolder, self.onToolsOpenDataFolderClicked)
QtCore.SIGNAL(u'triggered()'), self.onToolsOpenDataFolderClicked) QtCore.QObject.connect(self.toolsFirstTimeWizard, QtCore.SIGNAL(u'triggered()'), self.onFirstTimeWizardClicked)
QtCore.QObject.connect(self.toolsFirstTimeWizard, QtCore.QObject.connect(self.updateThemeImages, QtCore.SIGNAL(u'triggered()'), self.onUpdateThemeImages)
QtCore.SIGNAL(u'triggered()'), self.onFirstTimeWizardClicked) QtCore.QObject.connect(self.formattingTagItem, QtCore.SIGNAL(u'triggered()'), self.onFormattingTagItemClicked)
QtCore.QObject.connect(self.updateThemeImages, QtCore.QObject.connect(self.settingsConfigureItem, QtCore.SIGNAL(u'triggered()'),
QtCore.SIGNAL(u'triggered()'), self.onUpdateThemeImages) self.onSettingsConfigureItemClicked)
QtCore.QObject.connect(self.formattingTagItem, QtCore.QObject.connect(self.settingsShortcutsItem, QtCore.SIGNAL(u'triggered()'),
QtCore.SIGNAL(u'triggered()'), self.onFormattingTagItemClicked) self.onSettingsShortcutsItemClicked)
QtCore.QObject.connect(self.settingsConfigureItem, QtCore.QObject.connect(self.settingsImportItem, QtCore.SIGNAL(u'triggered()'),
QtCore.SIGNAL(u'triggered()'), self.onSettingsConfigureItemClicked) self.onSettingsImportItemClicked)
QtCore.QObject.connect(self.settingsShortcutsItem, QtCore.QObject.connect(self.settingsExportItem,QtCore.SIGNAL(u'triggered()'), self.onSettingsExportItemClicked)
QtCore.SIGNAL(u'triggered()'), self.onSettingsShortcutsItemClicked)
QtCore.QObject.connect(self.settingsImportItem,
QtCore.SIGNAL(u'triggered()'), self.onSettingsImportItemClicked)
QtCore.QObject.connect(self.settingsExportItem,
QtCore.SIGNAL(u'triggered()'), self.onSettingsExportItemClicked)
# i18n set signals for languages # i18n set signals for languages
self.languageGroup.triggered.connect(LanguageManager.set_language) self.languageGroup.triggered.connect(LanguageManager.set_language)
QtCore.QObject.connect(self.modeDefaultItem, QtCore.QObject.connect(self.modeDefaultItem, QtCore.SIGNAL(u'triggered()'), self.onModeDefaultItemClicked)
QtCore.SIGNAL(u'triggered()'), self.onModeDefaultItemClicked) QtCore.QObject.connect(self.modeSetupItem, QtCore.SIGNAL(u'triggered()'), self.onModeSetupItemClicked)
QtCore.QObject.connect(self.modeSetupItem, QtCore.QObject.connect(self.modeLiveItem, QtCore.SIGNAL(u'triggered()'), self.onModeLiveItemClicked)
QtCore.SIGNAL(u'triggered()'), self.onModeSetupItemClicked) QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'theme_update_global'), self.defaultThemeChanged)
QtCore.QObject.connect(self.modeLiveItem, QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'openlp_version_check'), self.versionNotice)
QtCore.SIGNAL(u'triggered()'), self.onModeLiveItemClicked) QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'live_display_blank_check'), self.blankCheck)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'config_screen_changed'), self.screenChanged)
QtCore.SIGNAL(u'theme_update_global'), self.defaultThemeChanged) QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'mainwindow_status_text'), self.showStatusMessage)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'cleanup'), self.cleanUp)
QtCore.SIGNAL(u'openlp_version_check'), self.versionNotice)
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'live_display_blank_check'), self.blankCheck)
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'config_screen_changed'), self.screenChanged)
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'mainwindow_status_text'), self.showStatusMessage)
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'cleanup'), self.cleanUp)
# Media Manager # Media Manager
QtCore.QObject.connect(self.mediaToolBox, QtCore.QObject.connect(self.mediaToolBox, QtCore.SIGNAL(u'currentChanged(int)'), self.onMediaToolBoxChanged)
QtCore.SIGNAL(u'currentChanged(int)'), self.onMediaToolBoxChanged)
Receiver.send_message(u'cursor_busy') Receiver.send_message(u'cursor_busy')
# Simple message boxes # Simple message boxes
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'openlp_error_message'), self.onErrorMessage)
QtCore.SIGNAL(u'openlp_error_message'), self.onErrorMessage) QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'openlp_warning_message'), self.onWarningMessage)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'openlp_information_message'),
QtCore.SIGNAL(u'openlp_warning_message'), self.onWarningMessage)
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'openlp_information_message'),
self.onInformationMessage) self.onInformationMessage)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'set_new_data_path'), self.setNewDataPath)
QtCore.SIGNAL(u'set_new_data_path'), self.setNewDataPath) QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'set_copy_data'), self.setCopyData)
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'set_copy_data'), self.setCopyData)
# warning cyclic dependency # warning cyclic dependency
# renderer needs to call ThemeManager and # renderer needs to call ThemeManager and
# ThemeManager needs to call Renderer # ThemeManager needs to call Renderer
@ -729,13 +606,11 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
Notifies the user that a newer version of OpenLP is available. Notifies the user that a newer version of OpenLP is available.
Triggered by delay thread. Triggered by delay thread.
""" """
version_text = translate('OpenLP.MainWindow', version_text = translate('OpenLP.MainWindow', 'Version %s of OpenLP is now available for download (you are '
'Version %s of OpenLP is now available for download (you are ' 'currently running version %s). \n\nYou can download the latest version from http://openlp.org/.')
'currently running version %s). \n\nYou can download the latest '
'version from http://openlp.org/.')
QtGui.QMessageBox.question(self, QtGui.QMessageBox.question(self,
translate('OpenLP.MainWindow', 'OpenLP Version Updated'), translate('OpenLP.MainWindow', 'OpenLP Version Updated'),
version_text % (version, get_application_version()[u'full'])) version_text % (version, get_application_version()[u'full']))
def show(self): def show(self):
""" """
@ -756,8 +631,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
elif Settings().value( elif Settings().value(
self.generalSettingsSection + u'/auto open', False): self.generalSettingsSection + u'/auto open', False):
self.serviceManagerContents.loadLastFile() self.serviceManagerContents.loadLastFile()
view_mode = Settings().value(u'%s/view mode' % view_mode = Settings().value(u'%s/view mode' % self.generalSettingsSection, u'default')
self.generalSettingsSection, u'default')
if view_mode == u'default': if view_mode == u'default':
self.modeDefaultItem.setChecked(True) self.modeDefaultItem.setChecked(True)
elif view_mode == u'setup': elif view_mode == u'setup':
@ -797,15 +671,12 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
""" """
answer = QtGui.QMessageBox.warning(self, answer = QtGui.QMessageBox.warning(self,
translate('OpenLP.MainWindow', 'Re-run First Time Wizard?'), translate('OpenLP.MainWindow', 'Re-run First Time Wizard?'),
translate('OpenLP.MainWindow', translate('OpenLP.MainWindow', 'Are you sure you want to re-run the First Time Wizard?\n\n'
'Are you sure you want to re-run the First Time Wizard?\n\n' 'Re-running this wizard may make changes to your current '
'Re-running this wizard may make changes to your current ' 'OpenLP configuration and possibly add songs to your '
'OpenLP configuration and possibly add songs to your ' 'existing songs list and change your default theme.'),
'existing songs list and change your default theme.'), QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes | QtGui.QMessageBox.No),
QtGui.QMessageBox.StandardButtons( QtGui.QMessageBox.No)
QtGui.QMessageBox.Yes |
QtGui.QMessageBox.No),
QtGui.QMessageBox.No)
if answer == QtGui.QMessageBox.No: if answer == QtGui.QMessageBox.No:
return return
Receiver.send_message(u'cursor_busy') Receiver.send_message(u'cursor_busy')
@ -827,8 +698,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
self.activePlugin.toggleStatus(PluginStatus.Inactive) self.activePlugin.toggleStatus(PluginStatus.Inactive)
self.themeManagerContents.configUpdated() self.themeManagerContents.configUpdated()
self.themeManagerContents.loadThemes(True) self.themeManagerContents.loadThemes(True)
Receiver.send_message(u'theme_update_global', Receiver.send_message(u'theme_update_global', self.themeManagerContents.global_theme)
self.themeManagerContents.global_theme)
# Check if any Bibles downloaded. If there are, they will be # Check if any Bibles downloaded. If there are, they will be
# processed. # processed.
Receiver.send_message(u'bibles_load_list', True) Receiver.send_message(u'bibles_load_list', True)
@ -843,11 +713,8 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
False): False):
if settings.value(u'%s/blank warning' % self.generalSettingsSection, if settings.value(u'%s/blank warning' % self.generalSettingsSection,
False): False):
QtGui.QMessageBox.question(self, QtGui.QMessageBox.question(self, translate('OpenLP.MainWindow', 'OpenLP Main Display Blanked'),
translate('OpenLP.MainWindow', translate('OpenLP.MainWindow', 'The Main Display has been blanked out'))
'OpenLP Main Display Blanked'),
translate('OpenLP.MainWindow',
'The Main Display has been blanked out'))
def onErrorMessage(self, data): def onErrorMessage(self, data):
Receiver.send_message(u'close_splash') Receiver.send_message(u'close_splash')
@ -937,24 +804,16 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
""" """
Import settings from an export INI file Import settings from an export INI file
""" """
answer = QtGui.QMessageBox.critical(self, answer = QtGui.QMessageBox.critical(self, translate('OpenLP.MainWindow', 'Import settings?'),
translate('OpenLP.MainWindow', 'Import settings?'), translate('OpenLP.MainWindow', 'Are you sure you want to import settings?\n\n'
translate('OpenLP.MainWindow', 'Importing settings will make permanent changes to your current OpenLP configuration.\n\n'
'Are you sure you want to import settings?\n\n' 'Importing incorrect settings may cause erratic behaviour or OpenLP to terminate abnormally.'),
'Importing settings will make permanent changes to your current ' QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes | QtGui.QMessageBox.No),
'OpenLP configuration.\n\n' QtGui.QMessageBox.No)
'Importing incorrect settings may cause erratic behaviour or '
'OpenLP to terminate abnormally.'),
QtGui.QMessageBox.StandardButtons(
QtGui.QMessageBox.Yes |
QtGui.QMessageBox.No),
QtGui.QMessageBox.No)
if answer == QtGui.QMessageBox.No: if answer == QtGui.QMessageBox.No:
return return
import_file_name = QtGui.QFileDialog.getOpenFileName(self, import_file_name = QtGui.QFileDialog.getOpenFileName(self,translate('OpenLP.MainWindow', 'Open File'), '',
translate('OpenLP.MainWindow', 'Open File'), '', translate('OpenLP.MainWindow', 'OpenLP Export Settings Files (*.conf)'))
translate('OpenLP.MainWindow',
'OpenLP Export Settings Files (*.conf)'))
if not import_file_name: if not import_file_name:
return return
setting_sections = [] setting_sections = []
@ -987,16 +846,11 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
section_key = section + "/" + key section_key = section + "/" + key
# Make sure it's a valid section for us. # Make sure it's a valid section for us.
if not section in setting_sections: if not section in setting_sections:
QtGui.QMessageBox.critical(self, QtGui.QMessageBox.critical(self, translate('OpenLP.MainWindow', 'Import settings'),
translate('OpenLP.MainWindow', 'Import settings'), translate('OpenLP.MainWindow', 'The file you selected does appear to be a valid OpenLP '
translate('OpenLP.MainWindow', 'settings file.\n\n Section [%s] is not valid \n\n'
'The file you selected does appear to be a valid OpenLP ' 'Processing has terminated and no changed have been made.').replace('%s', section),
'settings file.\n\n' QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
'Section [%s] is not valid \n\n'
'Processing has terminated and no changed have been made.'
).replace('%s', section),
QtGui.QMessageBox.StandardButtons(
QtGui.QMessageBox.Ok))
return return
# We have a good file, import it. # We have a good file, import it.
for section_key in import_keys: for section_key in import_keys:
@ -1012,13 +866,10 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
# We must do an immediate restart or current configuration will # We must do an immediate restart or current configuration will
# overwrite what was just imported when application terminates # overwrite what was just imported when application terminates
# normally. We need to exit without saving configuration. # normally. We need to exit without saving configuration.
QtGui.QMessageBox.information(self, QtGui.QMessageBox.information(self, translate('OpenLP.MainWindow', 'Import settings'),
translate('OpenLP.MainWindow', 'Import settings'), translate('OpenLP.MainWindow', 'OpenLP will now close. Imported settings will '
translate('OpenLP.MainWindow', 'be applied the next time you start OpenLP.'),
'OpenLP will now close. Imported settings will ' QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
'be applied the next time you start OpenLP.'),
QtGui.QMessageBox.StandardButtons(
QtGui.QMessageBox.Ok))
self.settingsImported = True self.settingsImported = True
self.cleanUp() self.cleanUp()
QtCore.QCoreApplication.exit() QtCore.QCoreApplication.exit()
@ -1029,8 +880,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
""" """
export_file_name = QtGui.QFileDialog.getSaveFileName(self, export_file_name = QtGui.QFileDialog.getSaveFileName(self,
translate('OpenLP.MainWindow', 'Export Settings File'), '', translate('OpenLP.MainWindow', 'Export Settings File'), '',
translate('OpenLP.MainWindow', translate('OpenLP.MainWindow', 'OpenLP Export Settings File (*.conf)'))
'OpenLP Export Settings File (*.conf)'))
if not export_file_name: if not export_file_name:
return return
# Make sure it's a .conf file. # Make sure it's a .conf file.
@ -1120,8 +970,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
""" """
if mode: if mode:
settings = Settings() settings = Settings()
settings.setValue(u'%s/view mode' % self.generalSettingsSection, settings.setValue(u'%s/view mode' % self.generalSettingsSection, mode)
mode)
self.mediaManagerDock.setVisible(media) self.mediaManagerDock.setVisible(media)
self.serviceManagerDock.setVisible(service) self.serviceManagerDock.setVisible(service)
self.themeManagerDock.setVisible(theme) self.themeManagerDock.setVisible(theme)
@ -1171,12 +1020,9 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
event.ignore() event.ignore()
else: else:
if Settings().value(u'advanced/enable exit confirmation', True): if Settings().value(u'advanced/enable exit confirmation', True):
ret = QtGui.QMessageBox.question(self, ret = QtGui.QMessageBox.question(self, translate('OpenLP.MainWindow', 'Close OpenLP'),
translate('OpenLP.MainWindow', 'Close OpenLP'), translate('OpenLP.MainWindow', 'Are you sure you want to close OpenLP?'),
translate('OpenLP.MainWindow', QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes | QtGui.QMessageBox.No),
'Are you sure you want to close OpenLP?'),
QtGui.QMessageBox.StandardButtons(
QtGui.QMessageBox.Yes | QtGui.QMessageBox.No),
QtGui.QMessageBox.Yes) QtGui.QMessageBox.Yes)
if ret == QtGui.QMessageBox.Yes: if ret == QtGui.QMessageBox.Yes:
self.cleanUp() self.cleanUp()
@ -1201,8 +1047,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
self.serviceManagerContents.cleanUp() self.serviceManagerContents.cleanUp()
if save_settings: if save_settings:
if Settings().value(u'advanced/save current plugin', False): if Settings().value(u'advanced/save current plugin', False):
Settings().setValue(u'advanced/current media plugin', Settings().setValue(u'advanced/current media plugin', self.mediaToolBox.currentIndex())
self.mediaToolBox.currentIndex())
# Call the cleanup method to shutdown plugins. # Call the cleanup method to shutdown plugins.
log.info(u'cleanup plugins') log.info(u'cleanup plugins')
self.pluginManager.finalise_plugins() self.pluginManager.finalise_plugins()
@ -1262,15 +1107,13 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
self.statusBar.showMessage(message) self.statusBar.showMessage(message)
def defaultThemeChanged(self, theme): def defaultThemeChanged(self, theme):
self.defaultThemeLabel.setText( self.defaultThemeLabel.setText(translate('OpenLP.MainWindow', 'Default Theme: %s') % theme)
translate('OpenLP.MainWindow', 'Default Theme: %s') % theme)
def toggleMediaManager(self): def toggleMediaManager(self):
self.mediaManagerDock.setVisible(not self.mediaManagerDock.isVisible()) self.mediaManagerDock.setVisible(not self.mediaManagerDock.isVisible())
def toggleServiceManager(self): def toggleServiceManager(self):
self.serviceManagerDock.setVisible( self.serviceManagerDock.setVisible(not self.serviceManagerDock.isVisible())
not self.serviceManagerDock.isVisible())
def toggleThemeManager(self): def toggleThemeManager(self):
self.themeManagerDock.setVisible(not self.themeManagerDock.isVisible()) self.themeManagerDock.setVisible(not self.themeManagerDock.isVisible())
@ -1294,24 +1137,18 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
Sets the ability to stop the toolbars being changed. Sets the ability to stop the toolbars being changed.
""" """
if lock: if lock:
self.themeManagerDock.setFeatures( self.themeManagerDock.setFeatures(QtGui.QDockWidget.NoDockWidgetFeatures)
QtGui.QDockWidget.NoDockWidgetFeatures) self.serviceManagerDock.setFeatures(QtGui.QDockWidget.NoDockWidgetFeatures)
self.serviceManagerDock.setFeatures( self.mediaManagerDock.setFeatures(QtGui.QDockWidget.NoDockWidgetFeatures)
QtGui.QDockWidget.NoDockWidgetFeatures)
self.mediaManagerDock.setFeatures(
QtGui.QDockWidget.NoDockWidgetFeatures)
self.viewMediaManagerItem.setEnabled(False) self.viewMediaManagerItem.setEnabled(False)
self.viewServiceManagerItem.setEnabled(False) self.viewServiceManagerItem.setEnabled(False)
self.viewThemeManagerItem.setEnabled(False) self.viewThemeManagerItem.setEnabled(False)
self.viewPreviewPanel.setEnabled(False) self.viewPreviewPanel.setEnabled(False)
self.viewLivePanel.setEnabled(False) self.viewLivePanel.setEnabled(False)
else: else:
self.themeManagerDock.setFeatures( self.themeManagerDock.setFeatures(QtGui.QDockWidget.AllDockWidgetFeatures)
QtGui.QDockWidget.AllDockWidgetFeatures) self.serviceManagerDock.setFeatures(QtGui.QDockWidget.AllDockWidgetFeatures)
self.serviceManagerDock.setFeatures( self.mediaManagerDock.setFeatures(QtGui.QDockWidget.AllDockWidgetFeatures)
QtGui.QDockWidget.AllDockWidgetFeatures)
self.mediaManagerDock.setFeatures(
QtGui.QDockWidget.AllDockWidgetFeatures)
self.viewMediaManagerItem.setEnabled(True) self.viewMediaManagerItem.setEnabled(True)
self.viewServiceManagerItem.setEnabled(True) self.viewServiceManagerItem.setEnabled(True)
self.viewThemeManagerItem.setEnabled(True) self.viewThemeManagerItem.setEnabled(True)
@ -1339,17 +1176,12 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
""" """
log.debug(u'Loading QSettings') log.debug(u'Loading QSettings')
# Migrate Wrap Settings to Slide Limits Settings # Migrate Wrap Settings to Slide Limits Settings
if Settings().contains(self.generalSettingsSection + if Settings().contains(self.generalSettingsSection + u'/enable slide loop'):
u'/enable slide loop'): if Settings().value(self.generalSettingsSection + u'/enable slide loop', True):
if Settings().value(self.generalSettingsSection + Settings().setValue(self.advancedSettingsSection + u'/slide limits', SlideLimits.Wrap)
u'/enable slide loop', True):
Settings().setValue(self.advancedSettingsSection +
u'/slide limits', SlideLimits.Wrap)
else: else:
Settings().setValue(self.advancedSettingsSection + Settings().setValue(self.advancedSettingsSection + u'/slide limits', SlideLimits.End)
u'/slide limits', SlideLimits.End) Settings().remove(self.generalSettingsSection + u'/enable slide loop')
Settings().remove(self.generalSettingsSection +
u'/enable slide loop')
Receiver.send_message(u'slidecontroller_update_slide_limits') Receiver.send_message(u'slidecontroller_update_slide_limits')
settings = Settings() settings = Settings()
# Remove obsolete entries. # Remove obsolete entries.
@ -1360,16 +1192,11 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
settings.endGroup() settings.endGroup()
settings.beginGroup(self.uiSettingsSection) settings.beginGroup(self.uiSettingsSection)
self.move(settings.value(u'main window position', QtCore.QPoint(0, 0))) self.move(settings.value(u'main window position', QtCore.QPoint(0, 0)))
self.restoreGeometry( self.restoreGeometry(settings.value(u'main window geometry', QtCore.QByteArray()))
settings.value(u'main window geometry', QtCore.QByteArray())) self.restoreState(settings.value(u'main window state', QtCore.QByteArray()))
self.restoreState( self.liveController.splitter.restoreState(settings.value(u'live splitter geometry', QtCore.QByteArray()))
settings.value(u'main window state', QtCore.QByteArray())) self.previewController.splitter.restoreState(settings.value(u'preview splitter geometry', QtCore.QByteArray()))
self.liveController.splitter.restoreState( self.controlSplitter.restoreState(settings.value(u'mainwindow splitter geometry', QtCore.QByteArray()))
settings.value(u'live splitter geometry', QtCore.QByteArray()))
self.previewController.splitter.restoreState(
settings.value(u'preview splitter geometry', QtCore.QByteArray()))
self.controlSplitter.restoreState(settings.value(
u'mainwindow splitter geometry', QtCore.QByteArray()))
settings.endGroup() settings.endGroup()
def saveSettings(self): def saveSettings(self):
@ -1388,12 +1215,9 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
settings.setValue(u'main window position', self.pos()) settings.setValue(u'main window position', self.pos())
settings.setValue(u'main window state', self.saveState()) settings.setValue(u'main window state', self.saveState())
settings.setValue(u'main window geometry', self.saveGeometry()) settings.setValue(u'main window geometry', self.saveGeometry())
settings.setValue(u'live splitter geometry', settings.setValue(u'live splitter geometry', self.liveController.splitter.saveState())
self.liveController.splitter.saveState()) settings.setValue(u'preview splitter geometry', self.previewController.splitter.saveState())
settings.setValue(u'preview splitter geometry', settings.setValue(u'mainwindow splitter geometry', self.controlSplitter.saveState())
self.previewController.splitter.saveState())
settings.setValue(u'mainwindow splitter geometry',
self.controlSplitter.saveState())
settings.endGroup() settings.endGroup()
def updateRecentFilesMenu(self): def updateRecentFilesMenu(self):
@ -1414,10 +1238,8 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
triggers=self.serviceManagerContents.onRecentServiceClicked) triggers=self.serviceManagerContents.onRecentServiceClicked)
self.recentFilesMenu.addAction(action) self.recentFilesMenu.addAction(action)
clearRecentFilesAction = create_action(self, u'', clearRecentFilesAction = create_action(self, u'',
text=translate('OpenLP.MainWindow', 'Clear List', text=translate('OpenLP.MainWindow', 'Clear List', 'Clear List of recent files'),
'Clear List of recent files'), statustip=translate('OpenLP.MainWindow', 'Clear the list of recent files.'),
statustip=translate('OpenLP.MainWindow',
'Clear the list of recent files.'),
enabled=bool(self.recentFiles), enabled=bool(self.recentFiles),
triggers=self.clearRecentFileMenu) triggers=self.clearRecentFileMenu)
add_actions(self.recentFilesMenu, (None, clearRecentFilesAction)) add_actions(self.recentFilesMenu, (None, clearRecentFilesAction))
@ -1500,22 +1322,17 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
Receiver.send_message(u'openlp_process_events') Receiver.send_message(u'openlp_process_events')
Receiver.send_message(u'cursor_busy') Receiver.send_message(u'cursor_busy')
self.showStatusMessage( self.showStatusMessage(
translate('OpenLP.MainWindow', translate('OpenLP.MainWindow', 'Copying OpenLP data to new data directory location - %s '
'Copying OpenLP data to new data directory location - %s ' '- Please wait for copy to finish').replace('%s', self.newDataPath))
'- Please wait for copy to finish'
).replace('%s', self.newDataPath))
dir_util.copy_tree(old_data_path, self.newDataPath) dir_util.copy_tree(old_data_path, self.newDataPath)
log.info(u'Copy sucessful') log.info(u'Copy sucessful')
except (IOError, os.error, DistutilsFileError), why: except (IOError, os.error, DistutilsFileError), why:
Receiver.send_message(u'cursor_normal') Receiver.send_message(u'cursor_normal')
log.exception(u'Data copy failed %s' % unicode(why)) log.exception(u'Data copy failed %s' % unicode(why))
QtGui.QMessageBox.critical(self, QtGui.QMessageBox.critical(self, translate('OpenLP.MainWindow', 'New Data Directory Error'),
translate('OpenLP.MainWindow', 'New Data Directory Error'),
translate('OpenLP.MainWindow', translate('OpenLP.MainWindow',
'OpenLP Data directory copy failed\n\n%s' 'OpenLP Data directory copy failed\n\n%s').replace('%s', unicode(why)),
).replace('%s', unicode(why)), QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
QtGui.QMessageBox.StandardButtons(
QtGui.QMessageBox.Ok))
return False return False
else: else:
log.info(u'No data copy requested') log.info(u'No data copy requested')