forked from openlp/openlp
head + conflicts
This commit is contained in:
commit
cd69d2f930
@ -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 #
|
||||||
@ -112,12 +112,9 @@ class OpenLP(QtGui.QApplication):
|
|||||||
args.remove('OpenLP')
|
args.remove('OpenLP')
|
||||||
self.args.extend(args)
|
self.args.extend(args)
|
||||||
# provide a listener for widgets to reqest a screen update.
|
# provide a listener for widgets to reqest a screen update.
|
||||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'openlp_process_events'), self.processEvents)
|
||||||
QtCore.SIGNAL(u'openlp_process_events'), self.processEvents)
|
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'cursor_busy'), self.setBusyCursor)
|
||||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'cursor_normal'), self.setNormalCursor)
|
||||||
QtCore.SIGNAL(u'cursor_busy'), self.setBusyCursor)
|
|
||||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
|
||||||
QtCore.SIGNAL(u'cursor_normal'), self.setNormalCursor)
|
|
||||||
# Decide how many screens we have and their size
|
# Decide how many screens we have and their size
|
||||||
screens = ScreenList.create(self.desktop())
|
screens = ScreenList.create(self.desktop())
|
||||||
# First time checks in settings
|
# First time checks in settings
|
||||||
@ -127,11 +124,8 @@ class OpenLP(QtGui.QApplication):
|
|||||||
Settings().setValue(u'general/has run wizard', True)
|
Settings().setValue(u'general/has run wizard', True)
|
||||||
# Correct stylesheet bugs
|
# Correct stylesheet bugs
|
||||||
if os.name == u'nt':
|
if os.name == u'nt':
|
||||||
base_color = self.palette().color(QtGui.QPalette.Active,
|
base_color = self.palette().color(QtGui.QPalette.Active, QtGui.QPalette.Base)
|
||||||
QtGui.QPalette.Base)
|
application_stylesheet = u'* {alternate-background-color: ' + base_color.name() + ';}\n'
|
||||||
application_stylesheet = \
|
|
||||||
u'* {alternate-background-color: ' + \
|
|
||||||
base_color.name() + ';}\n'
|
|
||||||
application_stylesheet += nt_repair_stylesheet
|
application_stylesheet += nt_repair_stylesheet
|
||||||
self.setStyleSheet(application_stylesheet)
|
self.setStyleSheet(application_stylesheet)
|
||||||
show_splash = Settings().value(u'general/show splash', True)
|
show_splash = Settings().value(u'general/show splash', True)
|
||||||
@ -169,10 +163,8 @@ class OpenLP(QtGui.QApplication):
|
|||||||
"""
|
"""
|
||||||
self.sharedMemory = QtCore.QSharedMemory('OpenLP')
|
self.sharedMemory = QtCore.QSharedMemory('OpenLP')
|
||||||
if self.sharedMemory.attach():
|
if self.sharedMemory.attach():
|
||||||
status = QtGui.QMessageBox.critical(None,
|
status = QtGui.QMessageBox.critical(None, UiStrings().Error, UiStrings().OpenLPStart,
|
||||||
UiStrings().Error, UiStrings().OpenLPStart,
|
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes | QtGui.QMessageBox.No))
|
||||||
QtGui.QMessageBox.StandardButtons(
|
|
||||||
QtGui.QMessageBox.Yes | QtGui.QMessageBox.No))
|
|
||||||
if status == QtGui.QMessageBox.No:
|
if status == QtGui.QMessageBox.No:
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
@ -186,8 +178,7 @@ class OpenLP(QtGui.QApplication):
|
|||||||
return
|
return
|
||||||
if not hasattr(self, u'exceptionForm'):
|
if not hasattr(self, u'exceptionForm'):
|
||||||
self.exceptionForm = ExceptionForm(self.mainWindow)
|
self.exceptionForm = ExceptionForm(self.mainWindow)
|
||||||
self.exceptionForm.exceptionTextEdit.setPlainText(
|
self.exceptionForm.exceptionTextEdit.setPlainText(''.join(format_exception(exctype, value, traceback)))
|
||||||
''.join(format_exception(exctype, value, traceback)))
|
|
||||||
self.setNormalCursor()
|
self.setNormalCursor()
|
||||||
self.exceptionForm.exec_()
|
self.exceptionForm.exec_()
|
||||||
|
|
||||||
@ -224,8 +215,7 @@ def set_up_logging(log_path):
|
|||||||
check_directory_exists(log_path)
|
check_directory_exists(log_path)
|
||||||
filename = os.path.join(log_path, u'openlp.log')
|
filename = os.path.join(log_path, u'openlp.log')
|
||||||
logfile = logging.FileHandler(filename, u'w')
|
logfile = logging.FileHandler(filename, u'w')
|
||||||
logfile.setFormatter(logging.Formatter(
|
logfile.setFormatter(logging.Formatter(u'%(asctime)s %(name)-55s %(levelname)-8s %(message)s'))
|
||||||
u'%(asctime)s %(name)-55s %(levelname)-8s %(message)s'))
|
|
||||||
log.addHandler(logfile)
|
log.addHandler(logfile)
|
||||||
if log.isEnabledFor(logging.DEBUG):
|
if log.isEnabledFor(logging.DEBUG):
|
||||||
print 'Logging to:', filename
|
print 'Logging to:', filename
|
||||||
@ -239,28 +229,22 @@ def main(args=None):
|
|||||||
# Set up command line options.
|
# Set up command line options.
|
||||||
usage = 'Usage: %prog [options] [qt-options]'
|
usage = 'Usage: %prog [options] [qt-options]'
|
||||||
parser = OptionParser(usage=usage)
|
parser = OptionParser(usage=usage)
|
||||||
parser.add_option('-e', '--no-error-form', dest='no_error_form',
|
parser.add_option('-e', '--no-error-form', dest='no_error_form', action='store_true',
|
||||||
action='store_true', help='Disable the error notification form.')
|
help='Disable the error notification form.')
|
||||||
parser.add_option('-l', '--log-level', dest='loglevel',
|
parser.add_option('-l', '--log-level', dest='loglevel', default='warning', metavar='LEVEL',
|
||||||
default='warning', metavar='LEVEL', help='Set logging to LEVEL '
|
help='Set logging to LEVEL level. Valid values are "debug", "info", "warning".')
|
||||||
'level. Valid values are "debug", "info", "warning".')
|
parser.add_option('-p', '--portable', dest='portable', action='store_true',
|
||||||
parser.add_option('-p', '--portable', dest='portable',
|
help='Specify if this should be run as a portable app, off a USB flash drive (not implemented).')
|
||||||
action='store_true', help='Specify if this should be run as a '
|
parser.add_option('-d', '--dev-version', dest='dev_version', action='store_true',
|
||||||
'portable app, off a USB flash drive (not implemented).')
|
help='Ignore the version file and pull the version directly from Bazaar')
|
||||||
parser.add_option('-d', '--dev-version', dest='dev_version',
|
parser.add_option('-s', '--style', dest='style', help='Set the Qt4 style (passed directly to Qt4).')
|
||||||
action='store_true', help='Ignore the version file and pull the '
|
parser.add_option('--testing', dest='testing', action='store_true', help='Run by testing framework')
|
||||||
'version directly from Bazaar')
|
|
||||||
parser.add_option('-s', '--style', dest='style',
|
|
||||||
help='Set the Qt4 style (passed directly to Qt4).')
|
|
||||||
parser.add_option('--testing', dest='testing',
|
|
||||||
action='store_true', help='Run by testing framework')
|
|
||||||
# Parse command line options and deal with them.
|
# Parse command line options and deal with them.
|
||||||
# Use args supplied programatically if possible.
|
# Use args supplied programatically if possible.
|
||||||
(options, args) = parser.parse_args(args) if args else parser.parse_args()
|
(options, args) = parser.parse_args(args) if args else parser.parse_args()
|
||||||
if options.portable:
|
if options.portable:
|
||||||
app_path = AppLocation.get_directory(AppLocation.AppDir)
|
app_path = AppLocation.get_directory(AppLocation.AppDir)
|
||||||
set_up_logging(os.path.abspath(os.path.join(app_path, u'..',
|
set_up_logging(os.path.abspath(os.path.join(app_path, u'..', u'..', u'Other')))
|
||||||
u'..', u'Other')))
|
|
||||||
log.info(u'Running portable')
|
log.info(u'Running portable')
|
||||||
else:
|
else:
|
||||||
set_up_logging(AppLocation.get_directory(AppLocation.CacheDir))
|
set_up_logging(AppLocation.get_directory(AppLocation.CacheDir))
|
||||||
@ -288,8 +272,7 @@ def main(args=None):
|
|||||||
app.setApplicationName(u'OpenLPPortable')
|
app.setApplicationName(u'OpenLPPortable')
|
||||||
Settings.setDefaultFormat(Settings.IniFormat)
|
Settings.setDefaultFormat(Settings.IniFormat)
|
||||||
# Get location OpenLPPortable.ini
|
# Get location OpenLPPortable.ini
|
||||||
portable_settings_file = os.path.abspath(os.path.join(app_path, u'..',
|
portable_settings_file = os.path.abspath(os.path.join(app_path, u'..', u'..', u'Data', u'OpenLP.ini'))
|
||||||
u'..', u'Data', u'OpenLP.ini'))
|
|
||||||
# Make this our settings file
|
# Make this our settings file
|
||||||
log.info(u'INI file: %s', portable_settings_file)
|
log.info(u'INI file: %s', portable_settings_file)
|
||||||
Settings.setFilename(portable_settings_file)
|
Settings.setFilename(portable_settings_file)
|
||||||
@ -317,8 +300,7 @@ def main(args=None):
|
|||||||
sys.exit()
|
sys.exit()
|
||||||
# i18n Set Language
|
# i18n Set Language
|
||||||
language = LanguageManager.get_language()
|
language = LanguageManager.get_language()
|
||||||
app_translator, default_translator = \
|
app_translator, default_translator = LanguageManager.get_translator(language)
|
||||||
LanguageManager.get_translator(language)
|
|
||||||
if not app_translator.isEmpty():
|
if not app_translator.isEmpty():
|
||||||
app.installTranslator(app_translator)
|
app.installTranslator(app_translator)
|
||||||
if not default_translator.isEmpty():
|
if not default_translator.isEmpty():
|
||||||
@ -330,7 +312,7 @@ def main(args=None):
|
|||||||
# Do not run method app.exec_() when running gui tests
|
# Do not run method app.exec_() when running gui tests
|
||||||
if options.testing:
|
if options.testing:
|
||||||
app.run(qt_args, testing=True)
|
app.run(qt_args, testing=True)
|
||||||
# For gui tests we need access to window intances and their components
|
# For gui tests we need access to window instances and their components
|
||||||
return app
|
return app
|
||||||
else:
|
else:
|
||||||
sys.exit(app.run(qt_args))
|
sys.exit(app.run(qt_args))
|
||||||
|
@ -465,9 +465,8 @@ def create_valign_selection_widgets(parent):
|
|||||||
label = QtGui.QLabel(parent)
|
label = QtGui.QLabel(parent)
|
||||||
label.setText(translate('OpenLP.Ui', '&Vertical Align:'))
|
label.setText(translate('OpenLP.Ui', '&Vertical Align:'))
|
||||||
combo_box = QtGui.QComboBox(parent)
|
combo_box = QtGui.QComboBox(parent)
|
||||||
combo_box.addItem(UiStrings().Top)
|
combo_box.addItems(
|
||||||
combo_box.addItem(UiStrings().Middle)
|
[UiStrings().Top, UiStrings().Middle, UiStrings().Bottom])
|
||||||
combo_box.addItem(UiStrings().Bottom)
|
|
||||||
label.setBuddy(combo_box)
|
label.setBuddy(combo_box)
|
||||||
return label, combo_box
|
return label, combo_box
|
||||||
|
|
||||||
@ -482,8 +481,7 @@ def find_and_set_in_combo_box(combo_box, value_to_find):
|
|||||||
``value_to_find``
|
``value_to_find``
|
||||||
The value to find
|
The value to find
|
||||||
"""
|
"""
|
||||||
index = combo_box.findText(value_to_find,
|
index = combo_box.findText(value_to_find, QtCore.Qt.MatchExactly)
|
||||||
QtCore.Qt.MatchExactly)
|
|
||||||
if index == -1:
|
if index == -1:
|
||||||
# Not Found.
|
# Not Found.
|
||||||
index = 0
|
index = 0
|
||||||
|
@ -104,28 +104,22 @@ class AdvancedTab(SettingsTab):
|
|||||||
u'expandServiceItemCheckBox')
|
u'expandServiceItemCheckBox')
|
||||||
self.uiLayout.addRow(self.expandServiceItemCheckBox)
|
self.uiLayout.addRow(self.expandServiceItemCheckBox)
|
||||||
self.enableAutoCloseCheckBox = QtGui.QCheckBox(self.uiGroupBox)
|
self.enableAutoCloseCheckBox = QtGui.QCheckBox(self.uiGroupBox)
|
||||||
self.enableAutoCloseCheckBox.setObjectName(
|
self.enableAutoCloseCheckBox.setObjectName(u'enableAutoCloseCheckBox')
|
||||||
u'enableAutoCloseCheckBox')
|
|
||||||
self.uiLayout.addRow(self.enableAutoCloseCheckBox)
|
self.uiLayout.addRow(self.enableAutoCloseCheckBox)
|
||||||
self.leftLayout.addWidget(self.uiGroupBox)
|
self.leftLayout.addWidget(self.uiGroupBox)
|
||||||
# Default service name
|
# Default service name
|
||||||
self.serviceNameGroupBox = QtGui.QGroupBox(self.leftColumn)
|
self.serviceNameGroupBox = QtGui.QGroupBox(self.leftColumn)
|
||||||
self.serviceNameGroupBox.setObjectName(u'serviceNameGroupBox')
|
self.serviceNameGroupBox.setObjectName(u'serviceNameGroupBox')
|
||||||
self.serviceNameLayout = QtGui.QFormLayout(
|
self.serviceNameLayout = QtGui.QFormLayout(self.serviceNameGroupBox)
|
||||||
self.serviceNameGroupBox)
|
self.serviceNameCheckBox = QtGui.QCheckBox(self.serviceNameGroupBox)
|
||||||
self.serviceNameCheckBox = QtGui.QCheckBox(
|
|
||||||
self.serviceNameGroupBox)
|
|
||||||
self.serviceNameCheckBox.setObjectName(u'serviceNameCheckBox')
|
self.serviceNameCheckBox.setObjectName(u'serviceNameCheckBox')
|
||||||
self.serviceNameLayout.setObjectName(u'serviceNameLayout')
|
self.serviceNameLayout.setObjectName(u'serviceNameLayout')
|
||||||
self.serviceNameLayout.addRow(self.serviceNameCheckBox)
|
self.serviceNameLayout.addRow(self.serviceNameCheckBox)
|
||||||
self.serviceNameTimeLabel = QtGui.QLabel(self.serviceNameGroupBox)
|
self.serviceNameTimeLabel = QtGui.QLabel(self.serviceNameGroupBox)
|
||||||
self.serviceNameTimeLabel.setObjectName(u'serviceNameTimeLabel')
|
self.serviceNameTimeLabel.setObjectName(u'serviceNameTimeLabel')
|
||||||
self.serviceNameDay = QtGui.QComboBox(
|
self.serviceNameDay = QtGui.QComboBox(self.serviceNameGroupBox)
|
||||||
self.serviceNameGroupBox)
|
self.serviceNameDay.addItems([u'', u'', u'', u'', u'', u'', u'', u''])
|
||||||
self.serviceNameDay.addItems(
|
self.serviceNameDay.setObjectName(u'serviceNameDay')
|
||||||
[u'', u'', u'', u'', u'', u'', u'', u''])
|
|
||||||
self.serviceNameDay.setObjectName(
|
|
||||||
u'serviceNameDay')
|
|
||||||
self.serviceNameTime = QtGui.QTimeEdit(self.serviceNameGroupBox)
|
self.serviceNameTime = QtGui.QTimeEdit(self.serviceNameGroupBox)
|
||||||
self.serviceNameTime.setObjectName(u'serviceNameTime')
|
self.serviceNameTime.setObjectName(u'serviceNameTime')
|
||||||
self.serviceNameTimeHBox = QtGui.QHBoxLayout()
|
self.serviceNameTimeHBox = QtGui.QHBoxLayout()
|
||||||
@ -152,8 +146,7 @@ class AdvancedTab(SettingsTab):
|
|||||||
self.serviceNameHBox.addWidget(self.serviceNameRevertButton)
|
self.serviceNameHBox.addWidget(self.serviceNameRevertButton)
|
||||||
self.serviceNameLayout.addRow(self.serviceNameLabel,
|
self.serviceNameLayout.addRow(self.serviceNameLabel,
|
||||||
self.serviceNameHBox)
|
self.serviceNameHBox)
|
||||||
self.serviceNameExampleLabel = QtGui.QLabel(
|
self.serviceNameExampleLabel = QtGui.QLabel(self.serviceNameGroupBox)
|
||||||
self.serviceNameGroupBox)
|
|
||||||
self.serviceNameExampleLabel.setObjectName(
|
self.serviceNameExampleLabel.setObjectName(
|
||||||
u'serviceNameExampleLabel')
|
u'serviceNameExampleLabel')
|
||||||
self.serviceNameExample = QtGui.QLabel(self.serviceNameGroupBox)
|
self.serviceNameExample = QtGui.QLabel(self.serviceNameGroupBox)
|
||||||
@ -203,8 +196,7 @@ class AdvancedTab(SettingsTab):
|
|||||||
self.newDataDirectoryLabelHBox.setObjectName(
|
self.newDataDirectoryLabelHBox.setObjectName(
|
||||||
u'newDataDirectoryLabelHBox')
|
u'newDataDirectoryLabelHBox')
|
||||||
self.newDataDirectoryLabelHBox.addWidget(self.newDataDirectoryEdit)
|
self.newDataDirectoryLabelHBox.addWidget(self.newDataDirectoryEdit)
|
||||||
self.newDataDirectoryLabelHBox.addWidget(
|
self.newDataDirectoryLabelHBox.addWidget(self.dataDirectoryBrowseButton)
|
||||||
self.dataDirectoryBrowseButton)
|
|
||||||
self.newDataDirectoryLabelHBox.addWidget(
|
self.newDataDirectoryLabelHBox.addWidget(
|
||||||
self.dataDirectoryDefaultButton)
|
self.dataDirectoryDefaultButton)
|
||||||
self.dataDirectoryCopyCheckHBox = QtGui.QHBoxLayout()
|
self.dataDirectoryCopyCheckHBox = QtGui.QHBoxLayout()
|
||||||
@ -341,8 +333,7 @@ class AdvancedTab(SettingsTab):
|
|||||||
Setup the interface translation strings.
|
Setup the interface translation strings.
|
||||||
"""
|
"""
|
||||||
self.tabTitleVisible = UiStrings().Advanced
|
self.tabTitleVisible = UiStrings().Advanced
|
||||||
self.uiGroupBox.setTitle(
|
self.uiGroupBox.setTitle(translate('OpenLP.AdvancedTab', 'UI Settings'))
|
||||||
translate('OpenLP.AdvancedTab', 'UI Settings'))
|
|
||||||
self.dataDirectoryGroupBox.setTitle(
|
self.dataDirectoryGroupBox.setTitle(
|
||||||
translate('OpenLP.AdvancedTab', 'Data Location'))
|
translate('OpenLP.AdvancedTab', 'Data Location'))
|
||||||
self.recentLabel.setText(
|
self.recentLabel.setText(
|
||||||
@ -470,7 +461,7 @@ class AdvancedTab(SettingsTab):
|
|||||||
settings.value(u'expand service item', False))
|
settings.value(u'expand service item', False))
|
||||||
self.enableAutoCloseCheckBox.setChecked(
|
self.enableAutoCloseCheckBox.setChecked(
|
||||||
settings.value(u'enable exit confirmation', True))
|
settings.value(u'enable exit confirmation', True))
|
||||||
self.hideMouseCheckBox.setChecked(settings.value(u'hide mouse', False))
|
self.hideMouseCheckBox.setChecked(settings.value(u'hide mouse', True))
|
||||||
self.serviceNameDay.setCurrentIndex(
|
self.serviceNameDay.setCurrentIndex(
|
||||||
settings.value(u'default service day', self.defaultServiceDay))
|
settings.value(u'default service day', self.defaultServiceDay))
|
||||||
self.serviceNameTime.setTime(QtCore.QTime(
|
self.serviceNameTime.setTime(QtCore.QTime(
|
||||||
@ -535,8 +526,7 @@ class AdvancedTab(SettingsTab):
|
|||||||
self.currentDataPath = AppLocation.get_data_path()
|
self.currentDataPath = AppLocation.get_data_path()
|
||||||
log.warning(u'User requested data path set to default %s'
|
log.warning(u'User requested data path set to default %s'
|
||||||
% self.currentDataPath)
|
% self.currentDataPath)
|
||||||
self.dataDirectoryLabel.setText(os.path.abspath(
|
self.dataDirectoryLabel.setText(os.path.abspath(self.currentDataPath))
|
||||||
self.currentDataPath))
|
|
||||||
self.defaultColorButton.setStyleSheet(
|
self.defaultColorButton.setStyleSheet(
|
||||||
u'background-color: %s' % self.defaultColor)
|
u'background-color: %s' % self.defaultColor)
|
||||||
# Don't allow data directory move if running portable.
|
# Don't allow data directory move if running portable.
|
||||||
@ -646,8 +636,7 @@ class AdvancedTab(SettingsTab):
|
|||||||
file_filters = u'%s;;%s (*.*) (*)' % (get_images_filter(),
|
file_filters = u'%s;;%s (*.*) (*)' % (get_images_filter(),
|
||||||
UiStrings().AllFiles)
|
UiStrings().AllFiles)
|
||||||
filename = QtGui.QFileDialog.getOpenFileName(self,
|
filename = QtGui.QFileDialog.getOpenFileName(self,
|
||||||
translate('OpenLP.AdvancedTab', 'Open File'), '',
|
translate('OpenLP.AdvancedTab', 'Open File'), '', file_filters)
|
||||||
file_filters)
|
|
||||||
if filename:
|
if filename:
|
||||||
self.defaultFileEdit.setText(filename)
|
self.defaultFileEdit.setText(filename)
|
||||||
self.defaultFileEdit.setFocus()
|
self.defaultFileEdit.setFocus()
|
||||||
@ -697,7 +686,8 @@ class AdvancedTab(SettingsTab):
|
|||||||
"""
|
"""
|
||||||
new_data_path = AppLocation.get_directory(AppLocation.DataDir)
|
new_data_path = AppLocation.get_directory(AppLocation.DataDir)
|
||||||
if self.currentDataPath.lower() != new_data_path.lower():
|
if self.currentDataPath.lower() != new_data_path.lower():
|
||||||
# Make sure they want to change the data location back to the default.
|
# Make sure they want to change the data location back to the
|
||||||
|
# default.
|
||||||
answer = QtGui.QMessageBox.question(self,
|
answer = QtGui.QMessageBox.question(self,
|
||||||
translate('OpenLP.AdvancedTab', 'Reset Data Directory'),
|
translate('OpenLP.AdvancedTab', 'Reset Data Directory'),
|
||||||
translate('OpenLP.AdvancedTab',
|
translate('OpenLP.AdvancedTab',
|
||||||
|
@ -104,7 +104,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
|
|||||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||||
QtCore.SIGNAL(u'config_screen_changed'), self.updateScreenListCombo)
|
QtCore.SIGNAL(u'config_screen_changed'), self.updateScreenListCombo)
|
||||||
|
|
||||||
def exec_(self, edit=False):
|
def exec_(self):
|
||||||
"""
|
"""
|
||||||
Run the wizard.
|
Run the wizard.
|
||||||
"""
|
"""
|
||||||
@ -276,7 +276,6 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
|
|||||||
block_count = 0
|
block_count = 0
|
||||||
block_size = 4096
|
block_size = 4096
|
||||||
urlfile = urllib2.urlopen(url)
|
urlfile = urllib2.urlopen(url)
|
||||||
filesize = urlfile.headers["Content-Length"]
|
|
||||||
filename = open(fpath, "wb")
|
filename = open(fpath, "wb")
|
||||||
# Download until finished or canceled.
|
# Download until finished or canceled.
|
||||||
while not self.downloadCancelled:
|
while not self.downloadCancelled:
|
||||||
@ -285,7 +284,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
|
|||||||
break
|
break
|
||||||
filename.write(data)
|
filename.write(data)
|
||||||
block_count += 1
|
block_count += 1
|
||||||
self._downloadProgress(block_count, block_size, filesize)
|
self._downloadProgress(block_count, block_size)
|
||||||
filename.close()
|
filename.close()
|
||||||
# Delete file if cancelled, it may be a partial file.
|
# Delete file if cancelled, it may be a partial file.
|
||||||
if self.downloadCancelled:
|
if self.downloadCancelled:
|
||||||
@ -313,7 +312,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
|
|||||||
meta = site.info()
|
meta = site.info()
|
||||||
return int(meta.getheaders("Content-Length")[0])
|
return int(meta.getheaders("Content-Length")[0])
|
||||||
|
|
||||||
def _downloadProgress(self, count, block_size, total_size):
|
def _downloadProgress(self, count, block_size):
|
||||||
increment = (count * block_size) - self.previous_size
|
increment = (count * block_size) - self.previous_size
|
||||||
self._incrementProgressBar(None, increment)
|
self._incrementProgressBar(None, increment)
|
||||||
self.previous_size = count * block_size
|
self.previous_size = count * block_size
|
||||||
|
@ -489,7 +489,7 @@ class MainDisplay(Display):
|
|||||||
"""
|
"""
|
||||||
Hide mouse cursor when moved over display.
|
Hide mouse cursor when moved over display.
|
||||||
"""
|
"""
|
||||||
if Settings().value(u'advanced/hide mouse', False):
|
if Settings().value(u'advanced/hide mouse', True):
|
||||||
self.setCursor(QtCore.Qt.BlankCursor)
|
self.setCursor(QtCore.Qt.BlankCursor)
|
||||||
self.frame.evaluateJavaScript('document.body.style.cursor = "none"')
|
self.frame.evaluateJavaScript('document.body.style.cursor = "none"')
|
||||||
else:
|
else:
|
||||||
|
@ -113,7 +113,7 @@ class VlcPlayer(MediaPlayer):
|
|||||||
command_line_options = u'--no-video-title-show'
|
command_line_options = u'--no-video-title-show'
|
||||||
if not display.hasAudio:
|
if not display.hasAudio:
|
||||||
command_line_options += u' --no-audio --no-video-title-show'
|
command_line_options += u' --no-audio --no-video-title-show'
|
||||||
if Settings().value(u'advanced/hide mouse', False) and \
|
if Settings().value(u'advanced/hide mouse', True) and \
|
||||||
display.controller.isLive:
|
display.controller.isLive:
|
||||||
command_line_options += u' --mouse-hide-timeout=0'
|
command_line_options += u' --mouse-hide-timeout=0'
|
||||||
display.vlcInstance = vlc.Instance(command_line_options)
|
display.vlcInstance = vlc.Instance(command_line_options)
|
||||||
@ -159,7 +159,7 @@ class VlcPlayer(MediaPlayer):
|
|||||||
# We need to set media_info.length during load because we want
|
# We need to set media_info.length during load because we want
|
||||||
# to avoid start and stop the video twice. Once for real playback
|
# to avoid start and stop the video twice. Once for real playback
|
||||||
# and once to just get media length.
|
# and once to just get media length.
|
||||||
#
|
#
|
||||||
# Media plugin depends on knowing media length before playback.
|
# Media plugin depends on knowing media length before playback.
|
||||||
controller.media_info.length = \
|
controller.media_info.length = \
|
||||||
int(display.vlcMediaPlayer.get_media().get_duration() / 1000)
|
int(display.vlcMediaPlayer.get_media().get_duration() / 1000)
|
||||||
|
@ -221,10 +221,10 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog):
|
|||||||
self.alternatePushButton.setChecked(column not in [0, 1])
|
self.alternatePushButton.setChecked(column not in [0, 1])
|
||||||
if column in [0, 1]:
|
if column in [0, 1]:
|
||||||
self.primaryPushButton.setText(u'')
|
self.primaryPushButton.setText(u'')
|
||||||
self.primaryPushButton.setFocus(QtCore.Qt.OtherFocusReason)
|
self.primaryPushButton.setFocus()
|
||||||
else:
|
else:
|
||||||
self.alternatePushButton.setText(u'')
|
self.alternatePushButton.setText(u'')
|
||||||
self.alternatePushButton.setFocus(QtCore.Qt.OtherFocusReason)
|
self.alternatePushButton.setFocus()
|
||||||
|
|
||||||
def onCurrentItemChanged(self, item=None, previousItem=None):
|
def onCurrentItemChanged(self, item=None, previousItem=None):
|
||||||
"""
|
"""
|
||||||
|
@ -43,14 +43,6 @@ from openlp.core.utils.actions import ActionList, CategoryOrder
|
|||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
class SlideList(QtGui.QTableWidget):
|
|
||||||
"""
|
|
||||||
Customised version of QTableWidget which can respond to keyboard
|
|
||||||
events.
|
|
||||||
"""
|
|
||||||
def __init__(self, parent=None):
|
|
||||||
QtGui.QTableWidget.__init__(self, parent.controller)
|
|
||||||
|
|
||||||
|
|
||||||
class Controller(QtGui.QWidget):
|
class Controller(QtGui.QWidget):
|
||||||
"""
|
"""
|
||||||
@ -149,7 +141,7 @@ class SlideController(Controller):
|
|||||||
self.controllerLayout.setSpacing(0)
|
self.controllerLayout.setSpacing(0)
|
||||||
self.controllerLayout.setMargin(0)
|
self.controllerLayout.setMargin(0)
|
||||||
# Controller list view
|
# Controller list view
|
||||||
self.previewListWidget = SlideList(self)
|
self.previewListWidget = QtGui.QTableWidget(self.controller)
|
||||||
self.previewListWidget.setColumnCount(1)
|
self.previewListWidget.setColumnCount(1)
|
||||||
self.previewListWidget.horizontalHeader().setVisible(False)
|
self.previewListWidget.horizontalHeader().setVisible(False)
|
||||||
self.previewListWidget.setColumnWidth(0, self.controller.width())
|
self.previewListWidget.setColumnWidth(0, self.controller.width())
|
||||||
|
@ -451,7 +451,7 @@ class ThemeManager(QtGui.QWidget):
|
|||||||
self.settingsSection + u'/global theme', theme.theme_name)
|
self.settingsSection + u'/global theme', theme.theme_name)
|
||||||
self.configUpdated()
|
self.configUpdated()
|
||||||
files = SettingsManager.get_files(self.settingsSection, u'.png')
|
files = SettingsManager.get_files(self.settingsSection, u'.png')
|
||||||
# Sort the themes by its name considering language specific characters.
|
# Sort the themes by its name considering language specific
|
||||||
files.sort(key=lambda file_name: unicode(file_name),
|
files.sort(key=lambda file_name: unicode(file_name),
|
||||||
cmp=locale_compare)
|
cmp=locale_compare)
|
||||||
# now process the file list of png files
|
# now process the file list of png files
|
||||||
|
@ -524,8 +524,7 @@ class BiblesTab(SettingsTab):
|
|||||||
"""
|
"""
|
||||||
self.bibleThemeComboBox.clear()
|
self.bibleThemeComboBox.clear()
|
||||||
self.bibleThemeComboBox.addItem(u'')
|
self.bibleThemeComboBox.addItem(u'')
|
||||||
for theme in theme_list:
|
self.bibleThemeComboBox.addItems(theme_list)
|
||||||
self.bibleThemeComboBox.addItem(theme)
|
|
||||||
find_and_set_in_combo_box(self.bibleThemeComboBox, self.bible_theme)
|
find_and_set_in_combo_box(self.bibleThemeComboBox, self.bible_theme)
|
||||||
|
|
||||||
def getGreyTextPalette(self, greyed):
|
def getGreyTextPalette(self, greyed):
|
||||||
|
@ -76,8 +76,7 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog):
|
|||||||
def loadThemes(self, themelist):
|
def loadThemes(self, themelist):
|
||||||
self.themeComboBox.clear()
|
self.themeComboBox.clear()
|
||||||
self.themeComboBox.addItem(u'')
|
self.themeComboBox.addItem(u'')
|
||||||
for themename in themelist:
|
self.themeComboBox.addItems(themelist)
|
||||||
self.themeComboBox.addItem(themename)
|
|
||||||
|
|
||||||
def loadCustom(self, id, preview=False):
|
def loadCustom(self, id, preview=False):
|
||||||
"""
|
"""
|
||||||
@ -106,7 +105,7 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog):
|
|||||||
self.slideListView.addItem(slide[1])
|
self.slideListView.addItem(slide[1])
|
||||||
theme = self.customSlide.theme_name
|
theme = self.customSlide.theme_name
|
||||||
find_and_set_in_combo_box(self.themeComboBox, theme)
|
find_and_set_in_combo_box(self.themeComboBox, theme)
|
||||||
self.titleEdit.setFocus(QtCore.Qt.OtherFocusReason)
|
self.titleEdit.setFocus()
|
||||||
# If not preview hide the preview button.
|
# If not preview hide the preview button.
|
||||||
self.previewButton.setVisible(preview)
|
self.previewButton.setVisible(preview)
|
||||||
|
|
||||||
@ -128,11 +127,9 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog):
|
|||||||
sxml = CustomXMLBuilder()
|
sxml = CustomXMLBuilder()
|
||||||
sxml.new_document()
|
sxml.new_document()
|
||||||
sxml.add_lyrics_to_song()
|
sxml.add_lyrics_to_song()
|
||||||
count = 1
|
for count in range(self.slideListView.count()):
|
||||||
for i in range(self.slideListView.count()):
|
sxml.add_verse_to_lyrics(u'custom', unicode(count + 1),
|
||||||
sxml.add_verse_to_lyrics(u'custom', unicode(count),
|
self.slideListView.item(count).text())
|
||||||
self.slideListView.item(i).text())
|
|
||||||
count += 1
|
|
||||||
self.customSlide.title = self.titleEdit.text()
|
self.customSlide.title = self.titleEdit.text()
|
||||||
self.customSlide.text = unicode(sxml.extract_xml(), u'utf-8')
|
self.customSlide.text = unicode(sxml.extract_xml(), u'utf-8')
|
||||||
self.customSlide.credits = self.creditEdit.text()
|
self.customSlide.credits = self.creditEdit.text()
|
||||||
@ -159,8 +156,7 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog):
|
|||||||
def onAddButtonClicked(self):
|
def onAddButtonClicked(self):
|
||||||
self.editSlideForm.setText(u'')
|
self.editSlideForm.setText(u'')
|
||||||
if self.editSlideForm.exec_():
|
if self.editSlideForm.exec_():
|
||||||
for slide in self.editSlideForm.getText():
|
self.slideListView.addItems(self.editSlideForm.getText())
|
||||||
self.slideListView.addItem(slide)
|
|
||||||
|
|
||||||
def onEditButtonClicked(self):
|
def onEditButtonClicked(self):
|
||||||
self.editSlideForm.setText(self.slideListView.currentItem().text())
|
self.editSlideForm.setText(self.slideListView.currentItem().text())
|
||||||
@ -171,13 +167,13 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog):
|
|||||||
"""
|
"""
|
||||||
Edits all slides.
|
Edits all slides.
|
||||||
"""
|
"""
|
||||||
slide_list = u''
|
slide_text = u''
|
||||||
for row in range(self.slideListView.count()):
|
for row in range(self.slideListView.count()):
|
||||||
item = self.slideListView.item(row)
|
item = self.slideListView.item(row)
|
||||||
slide_list += item.text()
|
slide_text += item.text()
|
||||||
if row != self.slideListView.count() - 1:
|
if row != self.slideListView.count() - 1:
|
||||||
slide_list += u'\n[===]\n'
|
slide_text += u'\n[===]\n'
|
||||||
self.editSlideForm.setText(slide_list)
|
self.editSlideForm.setText(slide_text)
|
||||||
if self.editSlideForm.exec_():
|
if self.editSlideForm.exec_():
|
||||||
self.updateSlideList(self.editSlideForm.getText(), True)
|
self.updateSlideList(self.editSlideForm.getText(), True)
|
||||||
|
|
||||||
@ -201,21 +197,19 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog):
|
|||||||
"""
|
"""
|
||||||
if edit_all:
|
if edit_all:
|
||||||
self.slideListView.clear()
|
self.slideListView.clear()
|
||||||
for slide in slides:
|
self.slideListView.addItems(slides)
|
||||||
self.slideListView.addItem(slide)
|
|
||||||
else:
|
else:
|
||||||
old_slides = []
|
old_slides = []
|
||||||
old_row = self.slideListView.currentRow()
|
old_row = self.slideListView.currentRow()
|
||||||
# Create a list with all (old/unedited) slides.
|
# Create a list with all (old/unedited) slides.
|
||||||
old_slides = [self.slideListView.item(row).text() for row in \
|
old_slides = [self.slideListView.item(row).text() for row in
|
||||||
range(self.slideListView.count())]
|
range(self.slideListView.count())]
|
||||||
self.slideListView.clear()
|
self.slideListView.clear()
|
||||||
old_slides.pop(old_row)
|
old_slides.pop(old_row)
|
||||||
# Insert all slides to make the old_slides list complete.
|
# Insert all slides to make the old_slides list complete.
|
||||||
for slide in slides:
|
for slide in slides:
|
||||||
old_slides.insert(old_row, slide)
|
old_slides.insert(old_row, slide)
|
||||||
for slide in old_slides:
|
self.slideListView.addItems(old_slides)
|
||||||
self.slideListView.addItem(slide)
|
|
||||||
self.slideListView.repaint()
|
self.slideListView.repaint()
|
||||||
|
|
||||||
def onDeleteButtonClicked(self):
|
def onDeleteButtonClicked(self):
|
||||||
@ -242,14 +236,8 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog):
|
|||||||
self.deleteButton.setEnabled(True)
|
self.deleteButton.setEnabled(True)
|
||||||
self.editButton.setEnabled(True)
|
self.editButton.setEnabled(True)
|
||||||
# Decide if the up/down buttons should be enabled or not.
|
# Decide if the up/down buttons should be enabled or not.
|
||||||
if self.slideListView.count() - 1 == row:
|
self.downButton.setEnabled(self.slideListView.count() - 1 != row)
|
||||||
self.downButton.setEnabled(False)
|
self.upButton.setEnabled(row != 0)
|
||||||
else:
|
|
||||||
self.downButton.setEnabled(True)
|
|
||||||
if row == 0:
|
|
||||||
self.upButton.setEnabled(False)
|
|
||||||
else:
|
|
||||||
self.upButton.setEnabled(True)
|
|
||||||
|
|
||||||
def _validate(self):
|
def _validate(self):
|
||||||
"""
|
"""
|
||||||
|
@ -202,7 +202,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
|||||||
self.authorsListView.clear()
|
self.authorsListView.clear()
|
||||||
self.topicsListView.clear()
|
self.topicsListView.clear()
|
||||||
self.audioListWidget.clear()
|
self.audioListWidget.clear()
|
||||||
self.titleEdit.setFocus(QtCore.Qt.OtherFocusReason)
|
self.titleEdit.setFocus()
|
||||||
self.songBookNumberEdit.clear()
|
self.songBookNumberEdit.clear()
|
||||||
self.loadAuthors()
|
self.loadAuthors()
|
||||||
self.loadTopics()
|
self.loadTopics()
|
||||||
@ -324,7 +324,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
|||||||
os.path.split(media.file_name)[1])
|
os.path.split(media.file_name)[1])
|
||||||
media_file.setData(QtCore.Qt.UserRole, media.file_name)
|
media_file.setData(QtCore.Qt.UserRole, media.file_name)
|
||||||
self.audioListWidget.addItem(media_file)
|
self.audioListWidget.addItem(media_file)
|
||||||
self.titleEdit.setFocus(QtCore.Qt.OtherFocusReason)
|
self.titleEdit.setFocus()
|
||||||
# Hide or show the preview button.
|
# Hide or show the preview button.
|
||||||
self.previewButton.setVisible(preview)
|
self.previewButton.setVisible(preview)
|
||||||
|
|
||||||
|
@ -172,7 +172,7 @@ class EditVerseForm(QtGui.QDialog, Ui_EditVerseDialog):
|
|||||||
self.verseNumberBox.setValue(1)
|
self.verseNumberBox.setValue(1)
|
||||||
self.insertButton.setVisible(True)
|
self.insertButton.setVisible(True)
|
||||||
self.verseTextEdit.setPlainText(text)
|
self.verseTextEdit.setPlainText(text)
|
||||||
self.verseTextEdit.setFocus(QtCore.Qt.OtherFocusReason)
|
self.verseTextEdit.setFocus()
|
||||||
self.verseTextEdit.moveCursor(QtGui.QTextCursor.End)
|
self.verseTextEdit.moveCursor(QtGui.QTextCursor.End)
|
||||||
|
|
||||||
def getVerse(self):
|
def getVerse(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user