Update to trunk.

This commit is contained in:
Gary Talent 2017-03-29 16:40:54 -05:00
commit 5209daab45
563 changed files with 119222 additions and 80935 deletions

12
CHANGELOG.rst Normal file
View File

@ -0,0 +1,12 @@
OpenLP 2.5.1
============
* Fixed a bug where the author type upgrade was being ignore because it was looking at the wrong table
* Fixed a bug where the songs_songbooks table was not being created because the if expression was the wrong way round
* Changed the songs_songbooks migration SQL slightly to take into account a bug that has (hopefully) been fixed
* Sometimes the timer goes off as OpenLP is shutting down, and the application has already been deleted (reported via support system)
* Fix opening the data folder (KDE thought the old way was an SMB share)
* Fix a problem with the new QMediaPlayer not controlling the playlist anymore
* Added importing of author types to the OpenLP 2 song importer
* Refactored the merge script and gave it some options
* Fix a problem with loading Qt's translation files, bug #1676163

View File

@ -4,7 +4,7 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2016 OpenLP Developers # # Copyright (c) 2008-2017 OpenLP Developers #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free # # under the terms of the GNU General Public License as published by the Free #

View File

@ -5,7 +5,7 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2016 OpenLP Developers # # Copyright (c) 2008-2017 OpenLP Developers #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free # # under the terms of the GNU General Public License as published by the Free #

View File

@ -1 +1 @@
2.4 2.5.0

View File

@ -4,7 +4,7 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2016 OpenLP Developers # # Copyright (c) 2008-2017 OpenLP Developers #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free # # under the terms of the GNU General Public License as published by the Free #

View File

@ -4,7 +4,7 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2016 OpenLP Developers # # Copyright (c) 2008-2017 OpenLP Developers #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free # # under the terms of the GNU General Public License as published by the Free #
@ -129,21 +129,21 @@ class OpenLP(OpenLPMixin, QtWidgets.QApplication):
application_stylesheet += WIN_REPAIR_STYLESHEET application_stylesheet += WIN_REPAIR_STYLESHEET
if application_stylesheet: if application_stylesheet:
self.setStyleSheet(application_stylesheet) self.setStyleSheet(application_stylesheet)
show_splash = Settings().value('core/show splash') can_show_splash = Settings().value('core/show splash')
if show_splash: if can_show_splash:
self.splash = SplashScreen() self.splash = SplashScreen()
self.splash.show() self.splash.show()
# make sure Qt really display the splash screen # make sure Qt really display the splash screen
self.processEvents() self.processEvents()
# Check if OpenLP has been upgrade and if a backup of data should be created # Check if OpenLP has been upgrade and if a backup of data should be created
self.backup_on_upgrade(has_run_wizard) self.backup_on_upgrade(has_run_wizard, can_show_splash)
# start the main app window # start the main app window
self.main_window = MainWindow() self.main_window = MainWindow()
Registry().execute('bootstrap_initialise') Registry().execute('bootstrap_initialise')
Registry().execute('bootstrap_post_set_up') Registry().execute('bootstrap_post_set_up')
Registry().initialise = False Registry().initialise = False
self.main_window.show() self.main_window.show()
if show_splash: if can_show_splash:
# now kill the splashscreen # now kill the splashscreen
self.splash.finish(self.main_window) self.splash.finish(self.main_window)
log.debug('Splashscreen closed') log.debug('Splashscreen closed')
@ -177,6 +177,38 @@ class OpenLP(OpenLPMixin, QtWidgets.QApplication):
self.shared_memory.create(1) self.shared_memory.create(1)
return False return False
def is_data_path_missing(self):
"""
Check if the data folder path exists.
"""
data_folder_path = AppLocation.get_data_path()
if not os.path.exists(data_folder_path):
log.critical('Database was not found in: ' + data_folder_path)
status = QtWidgets.QMessageBox.critical(None, translate('OpenLP', 'Data Directory Error'),
translate('OpenLP', 'OpenLP data folder was not found in:\n\n{path}'
'\n\nThe location of the data folder was '
'previously changed from the OpenLP\'s '
'default location. If the data was stored on '
'removable device, that device needs to be '
'made available.\n\nYou may reset the data '
'location back to the default location, '
'or you can try to make the current location '
'available.\n\nDo you want to reset to the '
'default data location? If not, OpenLP will be '
'closed so you can try to fix the the problem.')
.format(path=data_folder_path),
QtWidgets.QMessageBox.StandardButtons(QtWidgets.QMessageBox.Yes |
QtWidgets.QMessageBox.No),
QtWidgets.QMessageBox.No)
if status == QtWidgets.QMessageBox.No:
# If answer was "No", return "True", it will shutdown OpenLP in def main
log.info('User requested termination')
return True
# If answer was "Yes", remove the custom data path thus resetting the default location.
Settings().remove('advanced/data path')
log.info('Database location has been reset to the default settings.')
return False
def hook_exception(self, exc_type, value, traceback): def hook_exception(self, exc_type, value, traceback):
""" """
Add an exception hook so that any uncaught exceptions are displayed in this window rather than somewhere where Add an exception hook so that any uncaught exceptions are displayed in this window rather than somewhere where
@ -192,13 +224,20 @@ class OpenLP(OpenLPMixin, QtWidgets.QApplication):
self.exception_form = ExceptionForm() self.exception_form = ExceptionForm()
self.exception_form.exception_text_edit.setPlainText(''.join(format_exception(exc_type, value, traceback))) self.exception_form.exception_text_edit.setPlainText(''.join(format_exception(exc_type, value, traceback)))
self.set_normal_cursor() self.set_normal_cursor()
is_splash_visible = False
if hasattr(self, 'splash') and self.splash.isVisible():
is_splash_visible = True
self.splash.hide()
self.exception_form.exec() self.exception_form.exec()
if is_splash_visible:
self.splash.show()
def backup_on_upgrade(self, has_run_wizard): def backup_on_upgrade(self, has_run_wizard, can_show_splash):
""" """
Check if OpenLP has been upgraded, and ask if a backup of data should be made Check if OpenLP has been upgraded, and ask if a backup of data should be made
:param has_run_wizard: OpenLP has been run before :param has_run_wizard: OpenLP has been run before
:param can_show_splash: Should OpenLP show the splash screen
""" """
data_version = Settings().value('core/application version') data_version = Settings().value('core/application version')
openlp_version = get_application_version()['version'] openlp_version = get_application_version()['version']
@ -207,9 +246,11 @@ class OpenLP(OpenLPMixin, QtWidgets.QApplication):
Settings().setValue('core/application version', openlp_version) Settings().setValue('core/application version', openlp_version)
# If data_version is different from the current version ask if we should backup the data folder # If data_version is different from the current version ask if we should backup the data folder
elif data_version != openlp_version: elif data_version != openlp_version:
if self.splash.isVisible():
self.splash.hide()
if QtWidgets.QMessageBox.question(None, translate('OpenLP', 'Backup'), if QtWidgets.QMessageBox.question(None, translate('OpenLP', 'Backup'),
translate('OpenLP', 'OpenLP has been upgraded, do you want to create ' translate('OpenLP', 'OpenLP has been upgraded, do you want to create\n'
'a backup of OpenLPs data folder?'), 'a backup of the old data folder?'),
QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No, QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No,
QtWidgets.QMessageBox.Yes) == QtWidgets.QMessageBox.Yes: QtWidgets.QMessageBox.Yes) == QtWidgets.QMessageBox.Yes:
# Create copy of data folder # Create copy of data folder
@ -223,12 +264,14 @@ class OpenLP(OpenLPMixin, QtWidgets.QApplication):
translate('OpenLP', 'Backup of the data folder failed!')) translate('OpenLP', 'Backup of the data folder failed!'))
return return
message = translate('OpenLP', message = translate('OpenLP',
'A backup of the data folder has been created' 'A backup of the data folder has been created at:\n\n'
'at {text}').format(text=data_folder_backup_path) '{text}').format(text=data_folder_backup_path)
QtWidgets.QMessageBox.information(None, translate('OpenLP', 'Backup'), message) QtWidgets.QMessageBox.information(None, translate('OpenLP', 'Backup'), message)
# Update the version in the settings # Update the version in the settings
Settings().setValue('core/application version', openlp_version) Settings().setValue('core/application version', openlp_version)
if can_show_splash:
self.splash.show()
def process_events(self): def process_events(self):
""" """
@ -276,7 +319,7 @@ class OpenLP(OpenLPMixin, QtWidgets.QApplication):
return QtWidgets.QApplication.event(self, event) return QtWidgets.QApplication.event(self, event)
def parse_options(args): def parse_options(args=None):
""" """
Parse the command line arguments Parse the command line arguments
@ -343,6 +386,7 @@ def main(args=None):
application.setOrganizationName('OpenLP') application.setOrganizationName('OpenLP')
application.setOrganizationDomain('openlp.org') application.setOrganizationDomain('openlp.org')
application.setAttribute(QtCore.Qt.AA_UseHighDpiPixmaps, True) application.setAttribute(QtCore.Qt.AA_UseHighDpiPixmaps, True)
application.setAttribute(QtCore.Qt.AA_DontCreateNativeWidgetSiblings, True)
if args and args.portable: if args and args.portable:
application.setApplicationName('OpenLPPortable') application.setApplicationName('OpenLPPortable')
Settings.setDefaultFormat(Settings.IniFormat) Settings.setDefaultFormat(Settings.IniFormat)
@ -368,9 +412,13 @@ def main(args=None):
Registry.create() Registry.create()
Registry().register('application', application) Registry().register('application', application)
application.setApplicationVersion(get_application_version()['version']) application.setApplicationVersion(get_application_version()['version'])
# Instance check # Check if an instance of OpenLP is already running. Quit if there is a running instance and the user only wants one
if application.is_already_running(): if application.is_already_running():
sys.exit() sys.exit()
# If the custom data path is missing and the user wants to restore the data path, quit OpenLP.
if application.is_data_path_missing():
application.shared_memory.detach()
sys.exit()
# Remove/convert obsolete settings. # Remove/convert obsolete settings.
Settings().remove_obsolete_settings() Settings().remove_obsolete_settings()
# First time checks in settings # First time checks in settings
@ -380,13 +428,12 @@ def main(args=None):
sys.exit() sys.exit()
# i18n Set Language # i18n Set Language
language = LanguageManager.get_language() language = LanguageManager.get_language()
application_translator, default_translator = LanguageManager.get_translator(language) translators = LanguageManager.get_translators(language)
if not application_translator.isEmpty(): for translator in translators:
application.installTranslator(application_translator) if not translator.isEmpty():
if not default_translator.isEmpty(): application.installTranslator(translator)
application.installTranslator(default_translator) if not translators:
else: log.debug('Could not find translators.')
log.debug('Could not find default_translator.')
if args and not args.no_error_form: if args and not args.no_error_form:
sys.excepthook = application.hook_exception sys.excepthook = application.hook_exception
sys.exit(application.run(qt_args)) sys.exit(application.run(qt_args))

View File

@ -4,7 +4,7 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2016 OpenLP Developers # # Copyright (c) 2008-2017 OpenLP Developers #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free # # under the terms of the GNU General Public License as published by the Free #

View File

@ -4,7 +4,7 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2016 OpenLP Developers # # Copyright (c) 2008-2017 OpenLP Developers #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free # # under the terms of the GNU General Public License as published by the Free #

View File

@ -4,7 +4,7 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2016 OpenLP Developers # # Copyright (c) 2008-2017 OpenLP Developers #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free # # under the terms of the GNU General Public License as published by the Free #

View File

@ -4,7 +4,7 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2016 OpenLP Developers # # Copyright (c) 2008-2017 OpenLP Developers #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free # # under the terms of the GNU General Public License as published by the Free #

View File

@ -4,7 +4,7 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2016 OpenLP Developers # # Copyright (c) 2008-2017 OpenLP Developers #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free # # under the terms of the GNU General Public License as published by the Free #
@ -22,7 +22,9 @@
""" """
The :mod:`openlp.core.utils` module provides the utility libraries for OpenLP. The :mod:`openlp.core.utils` module provides the utility libraries for OpenLP.
""" """
import hashlib
import logging import logging
import os
import socket import socket
import sys import sys
import time import time
@ -32,7 +34,7 @@ import urllib.request
from http.client import HTTPException from http.client import HTTPException
from random import randint from random import randint
from openlp.core.common import Registry from openlp.core.common import Registry, trace_error_handler
log = logging.getLogger(__name__ + '.__init__') log = logging.getLogger(__name__ + '.__init__')
@ -92,7 +94,7 @@ class HTTPRedirectHandlerFixed(urllib.request.HTTPRedirectHandler):
return super(HTTPRedirectHandlerFixed, self).redirect_request(req, fp, code, msg, headers, fixed_url) return super(HTTPRedirectHandlerFixed, self).redirect_request(req, fp, code, msg, headers, fixed_url)
def _get_user_agent(): def get_user_agent():
""" """
Return a user agent customised for the platform the user is on. Return a user agent customised for the platform the user is on.
""" """
@ -122,7 +124,7 @@ def get_web_page(url, header=None, update_openlp=False):
urllib.request.install_opener(opener) urllib.request.install_opener(opener)
req = urllib.request.Request(url) req = urllib.request.Request(url)
if not header or header[0].lower() != 'user-agent': if not header or header[0].lower() != 'user-agent':
user_agent = _get_user_agent() user_agent = get_user_agent()
req.add_header('User-Agent', user_agent) req.add_header('User-Agent', user_agent)
if header: if header:
req.add_header(header[0], header[1]) req.add_header(header[0], header[1])
@ -179,4 +181,75 @@ def get_web_page(url, header=None, update_openlp=False):
return page return page
def get_url_file_size(url):
"""
Get the size of a file.
:param url: The URL of the file we want to download.
"""
retries = 0
while True:
try:
site = urllib.request.urlopen(url, timeout=CONNECTION_TIMEOUT)
meta = site.info()
return int(meta.get("Content-Length"))
except urllib.error.URLError:
if retries > CONNECTION_RETRIES:
raise
else:
retries += 1
time.sleep(0.1)
continue
def url_get_file(callback, url, f_path, sha256=None):
""""
Download a file given a URL. The file is retrieved in chunks, giving the ability to cancel the download at any
point. Returns False on download error.
:param callback: the class which needs to be updated
:param url: URL to download
:param f_path: Destination file
:param sha256: The check sum value to be checked against the download value
"""
block_count = 0
block_size = 4096
retries = 0
while True:
try:
filename = open(f_path, "wb")
url_file = urllib.request.urlopen(url, timeout=CONNECTION_TIMEOUT)
if sha256:
hasher = hashlib.sha256()
# Download until finished or canceled.
while not callback.was_cancelled:
data = url_file.read(block_size)
if not data:
break
filename.write(data)
if sha256:
hasher.update(data)
block_count += 1
callback._download_progress(block_count, block_size)
filename.close()
if sha256 and hasher.hexdigest() != sha256:
log.error('sha256 sums did not match for file: {file}'.format(file=f_path))
os.remove(f_path)
return False
except (urllib.error.URLError, socket.timeout) as err:
trace_error_handler(log)
filename.close()
os.remove(f_path)
if retries > CONNECTION_RETRIES:
return False
else:
retries += 1
time.sleep(0.1)
continue
break
# Delete file if cancelled, it may be a partial file.
if callback.was_cancelled:
os.remove(f_path)
return True
__all__ = ['get_web_page'] __all__ = ['get_web_page']

View File

@ -4,7 +4,7 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2016 OpenLP Developers # # Copyright (c) 2008-2017 OpenLP Developers #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free # # under the terms of the GNU General Public License as published by the Free #
@ -45,7 +45,7 @@ class LanguageManager(object):
auto_language = False auto_language = False
@staticmethod @staticmethod
def get_translator(language): def get_translators(language):
""" """
Set up a translator to use in this instance of OpenLP Set up a translator to use in this instance of OpenLP
@ -59,9 +59,12 @@ class LanguageManager(object):
# A translator for buttons and other default strings provided by Qt. # A translator for buttons and other default strings provided by Qt.
if not is_win() and not is_macosx(): if not is_win() and not is_macosx():
lang_path = QtCore.QLibraryInfo.location(QtCore.QLibraryInfo.TranslationsPath) lang_path = QtCore.QLibraryInfo.location(QtCore.QLibraryInfo.TranslationsPath)
# As of Qt5, the core translations come in 2 files per language
default_translator = QtCore.QTranslator() default_translator = QtCore.QTranslator()
default_translator.load('qt_%s' % language, lang_path) default_translator.load('qt_%s' % language, lang_path)
return app_translator, default_translator base_translator = QtCore.QTranslator()
base_translator.load('qtbase_%s' % language, lang_path)
return app_translator, default_translator, base_translator
@staticmethod @staticmethod
def find_qm_files(): def find_qm_files():
@ -71,8 +74,8 @@ class LanguageManager(object):
log.debug('Translation files: {files}'.format(files=AppLocation.get_directory(AppLocation.LanguageDir))) log.debug('Translation files: {files}'.format(files=AppLocation.get_directory(AppLocation.LanguageDir)))
trans_dir = QtCore.QDir(AppLocation.get_directory(AppLocation.LanguageDir)) trans_dir = QtCore.QDir(AppLocation.get_directory(AppLocation.LanguageDir))
file_names = trans_dir.entryList(['*.qm'], QtCore.QDir.Files, QtCore.QDir.Name) file_names = trans_dir.entryList(['*.qm'], QtCore.QDir.Files, QtCore.QDir.Name)
# Remove qm files from the list which start with "qt_". # Remove qm files from the list which start with "qt".
file_names = [file_ for file_ in file_names if not file_.startswith('qt_')] file_names = [file_ for file_ in file_names if not file_.startswith('qt')]
return list(map(trans_dir.filePath, file_names)) return list(map(trans_dir.filePath, file_names))
@staticmethod @staticmethod

View File

@ -4,7 +4,7 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2016 OpenLP Developers # # Copyright (c) 2008-2017 OpenLP Developers #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free # # under the terms of the GNU General Public License as published by the Free #

View File

@ -4,7 +4,7 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2016 OpenLP Developers # # Copyright (c) 2008-2017 OpenLP Developers #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free # # under the terms of the GNU General Public License as published by the Free #
@ -71,6 +71,12 @@ class OpenLPMixin(object):
""" """
self.logger.info(message) self.logger.info(message)
def log_warning(self, message):
"""
Common log warning handler
"""
self.logger.warning(message)
def log_error(self, message): def log_error(self, message):
""" """
Common log error handler which prints the calling path Common log error handler which prints the calling path

View File

@ -4,7 +4,7 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2016 OpenLP Developers # # Copyright (c) 2008-2017 OpenLP Developers #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free # # under the terms of the GNU General Public License as published by the Free #

View File

@ -4,7 +4,7 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2016 OpenLP Developers # # Copyright (c) 2008-2017 OpenLP Developers #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free # # under the terms of the GNU General Public License as published by the Free #

View File

@ -4,7 +4,7 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2016 OpenLP Developers # # Copyright (c) 2008-2017 OpenLP Developers #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free # # under the terms of the GNU General Public License as published by the Free #

View File

@ -4,7 +4,7 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2016 OpenLP Developers # # Copyright (c) 2008-2017 OpenLP Developers #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free # # under the terms of the GNU General Public License as published by the Free #
@ -214,7 +214,12 @@ class Settings(QtCore.QSettings):
('media/players', 'media/players_temp', [(media_players_conv, None)]), # Convert phonon to system ('media/players', 'media/players_temp', [(media_players_conv, None)]), # Convert phonon to system
('media/players_temp', 'media/players', []), # Move temp setting from above to correct setting ('media/players_temp', 'media/players', []), # Move temp setting from above to correct setting
('advanced/default color', 'core/logo background color', []), # Default image renamed + moved to general > 2.4. ('advanced/default color', 'core/logo background color', []), # Default image renamed + moved to general > 2.4.
('advanced/default image', '/core/logo file', []) # Default image renamed + moved to general after 2.4. ('advanced/default image', 'core/logo file', []), # Default image renamed + moved to general after 2.4.
('shortcuts/escapeItem', 'shortcuts/desktopScreenEnable', []), # Escape item was removed in 2.6.
('shortcuts/offlineHelpItem', 'shortcuts/userManualItem', []), # Online and Offline help were combined in 2.6.
('shortcuts/onlineHelpItem', 'shortcuts/userManualItem', []), # Online and Offline help were combined in 2.6.
('bibles/advanced bible', '', []), # Common bible search widgets combined in 2.6
('bibles/quick bible', 'bibles/primary bible', []) # Common bible search widgets combined in 2.6
] ]
@staticmethod @staticmethod
@ -261,10 +266,10 @@ class Settings(QtCore.QSettings):
'shortcuts/blankScreen': [QtGui.QKeySequence(QtCore.Qt.Key_Period)], 'shortcuts/blankScreen': [QtGui.QKeySequence(QtCore.Qt.Key_Period)],
'shortcuts/collapse': [QtGui.QKeySequence(QtCore.Qt.Key_Minus)], 'shortcuts/collapse': [QtGui.QKeySequence(QtCore.Qt.Key_Minus)],
'shortcuts/desktopScreen': [QtGui.QKeySequence(QtCore.Qt.Key_D)], 'shortcuts/desktopScreen': [QtGui.QKeySequence(QtCore.Qt.Key_D)],
'shortcuts/desktopScreenEnable': [QtGui.QKeySequence(QtCore.Qt.Key_Escape)],
'shortcuts/delete': [QtGui.QKeySequence(QtGui.QKeySequence.Delete)], 'shortcuts/delete': [QtGui.QKeySequence(QtGui.QKeySequence.Delete)],
'shortcuts/down': [QtGui.QKeySequence(QtCore.Qt.Key_Down)], 'shortcuts/down': [QtGui.QKeySequence(QtCore.Qt.Key_Down)],
'shortcuts/editSong': [], 'shortcuts/editSong': [],
'shortcuts/escapeItem': [QtGui.QKeySequence(QtCore.Qt.Key_Escape)],
'shortcuts/expand': [QtGui.QKeySequence(QtCore.Qt.Key_Plus)], 'shortcuts/expand': [QtGui.QKeySequence(QtCore.Qt.Key_Plus)],
'shortcuts/exportThemeItem': [], 'shortcuts/exportThemeItem': [],
'shortcuts/fileNewItem': [QtGui.QKeySequence(QtGui.QKeySequence.New)], 'shortcuts/fileNewItem': [QtGui.QKeySequence(QtGui.QKeySequence.New)],
@ -273,6 +278,7 @@ class Settings(QtCore.QSettings):
'shortcuts/fileSaveItem': [QtGui.QKeySequence(QtGui.QKeySequence.Save)], 'shortcuts/fileSaveItem': [QtGui.QKeySequence(QtGui.QKeySequence.Save)],
'shortcuts/fileOpenItem': [QtGui.QKeySequence(QtGui.QKeySequence.Open)], 'shortcuts/fileOpenItem': [QtGui.QKeySequence(QtGui.QKeySequence.Open)],
'shortcuts/goLive': [], 'shortcuts/goLive': [],
'shortcuts/userManualItem': [QtGui.QKeySequence(QtGui.QKeySequence.HelpContents)],
'shortcuts/importThemeItem': [], 'shortcuts/importThemeItem': [],
'shortcuts/importBibleItem': [], 'shortcuts/importBibleItem': [],
'shortcuts/listViewBiblesDeleteItem': [QtGui.QKeySequence(QtGui.QKeySequence.Delete)], 'shortcuts/listViewBiblesDeleteItem': [QtGui.QKeySequence(QtGui.QKeySequence.Delete)],
@ -333,8 +339,6 @@ class Settings(QtCore.QSettings):
QtGui.QKeySequence(QtCore.Qt.Key_PageDown)], QtGui.QKeySequence(QtCore.Qt.Key_PageDown)],
'shortcuts/nextService': [QtGui.QKeySequence(QtCore.Qt.Key_Right)], 'shortcuts/nextService': [QtGui.QKeySequence(QtCore.Qt.Key_Right)],
'shortcuts/newService': [], 'shortcuts/newService': [],
'shortcuts/offlineHelpItem': [QtGui.QKeySequence(QtGui.QKeySequence.HelpContents)],
'shortcuts/onlineHelpItem': [QtGui.QKeySequence(QtGui.QKeySequence.HelpContents)],
'shortcuts/openService': [], 'shortcuts/openService': [],
'shortcuts/saveService': [], 'shortcuts/saveService': [],
'shortcuts/previousItem_live': [QtGui.QKeySequence(QtCore.Qt.Key_Up), 'shortcuts/previousItem_live': [QtGui.QKeySequence(QtCore.Qt.Key_Up),
@ -379,6 +383,7 @@ class Settings(QtCore.QSettings):
'shortcuts/themeScreen': [QtGui.QKeySequence(QtCore.Qt.Key_T)], 'shortcuts/themeScreen': [QtGui.QKeySequence(QtCore.Qt.Key_T)],
'shortcuts/toolsReindexItem': [], 'shortcuts/toolsReindexItem': [],
'shortcuts/toolsFindDuplicates': [], 'shortcuts/toolsFindDuplicates': [],
'shortcuts/toolsSongListReport': [],
'shortcuts/toolsAlertItem': [QtGui.QKeySequence(QtCore.Qt.Key_F7)], 'shortcuts/toolsAlertItem': [QtGui.QKeySequence(QtCore.Qt.Key_F7)],
'shortcuts/toolsFirstTimeWizard': [], 'shortcuts/toolsFirstTimeWizard': [],
'shortcuts/toolsOpenDataFolder': [], 'shortcuts/toolsOpenDataFolder': [],

View File

@ -4,7 +4,7 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2016 OpenLP Developers # # Copyright (c) 2008-2017 OpenLP Developers #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free # # under the terms of the GNU General Public License as published by the Free #
@ -59,6 +59,13 @@ class UiStrings(object):
self.Automatic = translate('OpenLP.Ui', 'Automatic') self.Automatic = translate('OpenLP.Ui', 'Automatic')
self.BackgroundColor = translate('OpenLP.Ui', 'Background Color') self.BackgroundColor = translate('OpenLP.Ui', 'Background Color')
self.BackgroundColorColon = translate('OpenLP.Ui', 'Background color:') self.BackgroundColorColon = translate('OpenLP.Ui', 'Background color:')
self.BibleShortSearchTitle = translate('OpenLP.Ui', 'Search is Empty or too Short')
self.BibleShortSearch = translate('OpenLP.Ui', '<strong>The search you have entered is empty or shorter '
'than 3 characters long.</strong><br><br>Please try again with '
'a longer search.')
self.BibleNoBiblesTitle = translate('OpenLP.Ui', 'No Bibles Available')
self.BibleNoBibles = translate('OpenLP.Ui', '<strong>There are no Bibles currently installed.</strong><br><br>'
'Please use the Import Wizard to install one or more Bibles.')
self.Bottom = translate('OpenLP.Ui', 'Bottom') self.Bottom = translate('OpenLP.Ui', 'Bottom')
self.Browse = translate('OpenLP.Ui', 'Browse...') self.Browse = translate('OpenLP.Ui', 'Browse...')
self.Cancel = translate('OpenLP.Ui', 'Cancel') self.Cancel = translate('OpenLP.Ui', 'Cancel')
@ -112,11 +119,14 @@ class UiStrings(object):
self.NFSp = translate('OpenLP.Ui', 'No Files Selected', 'Plural') self.NFSp = translate('OpenLP.Ui', 'No Files Selected', 'Plural')
self.NISs = translate('OpenLP.Ui', 'No Item Selected', 'Singular') self.NISs = translate('OpenLP.Ui', 'No Item Selected', 'Singular')
self.NISp = translate('OpenLP.Ui', 'No Items Selected', 'Plural') self.NISp = translate('OpenLP.Ui', 'No Items Selected', 'Plural')
self.NoResults = translate('OpenLP.Ui', 'No Search Results')
self.OLP = translate('OpenLP.Ui', 'OpenLP') self.OLP = translate('OpenLP.Ui', 'OpenLP')
self.OLPV2 = "{name} {version}".format(name=self.OLP, version="2") self.OLPV2 = "{name} {version}".format(name=self.OLP, version="2")
self.OLPV2x = "{name} {version}".format(name=self.OLP, version="2.4") self.OLPV2x = "{name} {version}".format(name=self.OLP, version="2.4")
self.OpenLPStart = translate('OpenLP.Ui', 'OpenLP is already running. Do you wish to continue?') self.OpenLPStart = translate('OpenLP.Ui', 'OpenLP is already running. Do you wish to continue?')
self.OpenService = translate('OpenLP.Ui', 'Open service.') self.OpenService = translate('OpenLP.Ui', 'Open service.')
self.OptionalShowInFooter = translate('OpenLP.Ui', 'Optional, this will be displayed in footer.')
self.OptionalHideInFooter = translate('OpenLP.Ui', 'Optional, this won\'t be displayed in footer.')
self.PlaySlidesInLoop = translate('OpenLP.Ui', 'Play Slides in Loop') self.PlaySlidesInLoop = translate('OpenLP.Ui', 'Play Slides in Loop')
self.PlaySlidesToEnd = translate('OpenLP.Ui', 'Play Slides to End') self.PlaySlidesToEnd = translate('OpenLP.Ui', 'Play Slides to End')
self.Preview = translate('OpenLP.Ui', 'Preview') self.Preview = translate('OpenLP.Ui', 'Preview')
@ -130,6 +140,7 @@ class UiStrings(object):
'player is disabled.') 'player is disabled.')
self.ResetBG = translate('OpenLP.Ui', 'Reset Background') self.ResetBG = translate('OpenLP.Ui', 'Reset Background')
self.ResetLiveBG = translate('OpenLP.Ui', 'Reset live background.') self.ResetLiveBG = translate('OpenLP.Ui', 'Reset live background.')
self.RequiredShowInFooter = translate('OpenLP.Ui', 'Required, this will be displayed in footer.')
self.Seconds = translate('OpenLP.Ui', 's', 'The abbreviated unit for seconds') self.Seconds = translate('OpenLP.Ui', 's', 'The abbreviated unit for seconds')
self.SaveAndPreview = translate('OpenLP.Ui', 'Save && Preview') self.SaveAndPreview = translate('OpenLP.Ui', 'Save && Preview')
self.Search = translate('OpenLP.Ui', 'Search') self.Search = translate('OpenLP.Ui', 'Search')
@ -139,6 +150,7 @@ class UiStrings(object):
self.Settings = translate('OpenLP.Ui', 'Settings') self.Settings = translate('OpenLP.Ui', 'Settings')
self.SaveService = translate('OpenLP.Ui', 'Save Service') self.SaveService = translate('OpenLP.Ui', 'Save Service')
self.Service = translate('OpenLP.Ui', 'Service') self.Service = translate('OpenLP.Ui', 'Service')
self.ShortResults = translate('OpenLP.Ui', 'Please type more text to use \'Search As You Type\'')
self.Split = translate('OpenLP.Ui', 'Optional &Split') self.Split = translate('OpenLP.Ui', 'Optional &Split')
self.SplitToolTip = translate('OpenLP.Ui', self.SplitToolTip = translate('OpenLP.Ui',
'Split a slide into two only if it does not fit on the screen as one slide.') 'Split a slide into two only if it does not fit on the screen as one slide.')
@ -157,13 +169,6 @@ class UiStrings(object):
self.View = translate('OpenLP.Ui', 'View') self.View = translate('OpenLP.Ui', 'View')
self.ViewMode = translate('OpenLP.Ui', 'View Mode') self.ViewMode = translate('OpenLP.Ui', 'View Mode')
self.Video = translate('OpenLP.Ui', 'Video') self.Video = translate('OpenLP.Ui', 'Video')
self.BibleShortSearchTitle = translate('OpenLP.Ui', 'Search is Empty or too Short')
self.BibleShortSearch = translate('OpenLP.Ui', '<strong>The search you have entered is empty or shorter '
'than 3 characters long.</strong><br><br>Please try again with '
'a longer search.')
self.BibleNoBiblesTitle = translate('OpenLP.Ui', 'No Bibles Available')
self.BibleNoBibles = translate('OpenLP.Ui', '<strong>There are no Bibles currently installed.</strong><br><br>'
'Please use the Import Wizard to install one or more Bibles.')
book_chapter = translate('OpenLP.Ui', 'Book Chapter') book_chapter = translate('OpenLP.Ui', 'Book Chapter')
chapter = translate('OpenLP.Ui', 'Chapter') chapter = translate('OpenLP.Ui', 'Chapter')
verse = translate('OpenLP.Ui', 'Verse') verse = translate('OpenLP.Ui', 'Verse')

View File

@ -4,7 +4,7 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2016 OpenLP Developers # # Copyright (c) 2008-2017 OpenLP Developers #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free # # under the terms of the GNU General Public License as published by the Free #
@ -129,16 +129,16 @@ def build_icon(icon):
location like ``/path/to/file.png``. However, the **recommended** way is to specify a resource string. location like ``/path/to/file.png``. However, the **recommended** way is to specify a resource string.
:return: The build icon. :return: The build icon.
""" """
button_icon = QtGui.QIcon()
if isinstance(icon, QtGui.QIcon): if isinstance(icon, QtGui.QIcon):
button_icon = icon return icon
elif isinstance(icon, str): pix_map = None
if icon.startswith(':/'): button_icon = QtGui.QIcon()
button_icon.addPixmap(QtGui.QPixmap(icon), QtGui.QIcon.Normal, QtGui.QIcon.Off) if isinstance(icon, str):
else: pix_map = QtGui.QPixmap(icon)
button_icon.addPixmap(QtGui.QPixmap.fromImage(QtGui.QImage(icon)), QtGui.QIcon.Normal, QtGui.QIcon.Off)
elif isinstance(icon, QtGui.QImage): elif isinstance(icon, QtGui.QImage):
button_icon.addPixmap(QtGui.QPixmap.fromImage(icon), QtGui.QIcon.Normal, QtGui.QIcon.Off) pix_map = QtGui.QPixmap.fromImage(icon)
if pix_map:
button_icon.addPixmap(pix_map, QtGui.QIcon.Normal, QtGui.QIcon.Off)
return button_icon return button_icon
@ -310,30 +310,23 @@ def expand_tags(text):
def create_separated_list(string_list): def create_separated_list(string_list):
""" """
Returns a string that represents a join of a list of strings with a localized separator. This function corresponds Returns a string that represents a join of a list of strings with a localized separator.
Localized separation will be done via the translate() function by the translators.
to QLocale::createSeparatedList which was introduced in Qt 4.8 and implements the algorithm from :param string_list: List of unicode strings
http://www.unicode.org/reports/tr35/#ListPatterns :return: Formatted string
:param string_list: List of unicode strings
""" """
if LooseVersion(Qt.PYQT_VERSION_STR) >= LooseVersion('4.9') and LooseVersion(Qt.qVersion()) >= LooseVersion('4.8'): list_length = len(string_list)
return QtCore.QLocale().createSeparatedList(string_list) if list_length == 1:
if not string_list: list_to_string = string_list[0]
return '' elif list_length == 2:
elif len(string_list) == 1: list_to_string = translate('OpenLP.core.lib', '{one} and {two}').format(one=string_list[0], two=string_list[1])
return string_list[0] elif list_length > 2:
# TODO: Verify mocking of translate() test before conversion list_to_string = translate('OpenLP.core.lib', '{first} and {last}').format(first=', '.join(string_list[:-1]),
elif len(string_list) == 2: last=string_list[-1])
return translate('OpenLP.core.lib', '%s and %s',
'Locale list separator: 2 items') % (string_list[0], string_list[1])
else: else:
merged = translate('OpenLP.core.lib', '%s, and %s', list_to_string = ''
'Locale list separator: end') % (string_list[-2], string_list[-1]) return list_to_string
for index in reversed(list(range(1, len(string_list) - 2))):
merged = translate('OpenLP.core.lib', '%s, %s',
'Locale list separator: middle') % (string_list[index], merged)
return translate('OpenLP.core.lib', '%s, %s', 'Locale list separator: start') % (string_list[0], merged)
from .exceptions import ValidationError from .exceptions import ValidationError

View File

@ -4,7 +4,7 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2016 OpenLP Developers # # Copyright (c) 2008-2017 OpenLP Developers #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free # # under the terms of the GNU General Public License as published by the Free #

View File

@ -4,7 +4,7 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2016 OpenLP Developers # # Copyright (c) 2008-2017 OpenLP Developers #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free # # under the terms of the GNU General Public License as published by the Free #

View File

@ -4,7 +4,7 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2016 OpenLP Developers # # Copyright (c) 2008-2017 OpenLP Developers #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free # # under the terms of the GNU General Public License as published by the Free #

View File

@ -4,7 +4,7 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2016 OpenLP Developers # # Copyright (c) 2008-2017 OpenLP Developers #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free # # under the terms of the GNU General Public License as published by the Free #

View File

@ -4,7 +4,7 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2016 OpenLP Developers # # Copyright (c) 2008-2017 OpenLP Developers #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free # # under the terms of the GNU General Public License as published by the Free #

View File

@ -4,7 +4,7 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2016 OpenLP Developers # # Copyright (c) 2008-2017 OpenLP Developers #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free # # under the terms of the GNU General Public License as published by the Free #

View File

@ -4,7 +4,7 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2016 OpenLP Developers # # Copyright (c) 2008-2017 OpenLP Developers #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free # # under the terms of the GNU General Public License as published by the Free #
@ -197,14 +197,9 @@ class MediaManagerItem(QtWidgets.QWidget, RegistryProperties):
""" """
# Add the List widget # Add the List widget
self.list_view = ListWidgetWithDnD(self, self.plugin.name) self.list_view = ListWidgetWithDnD(self, self.plugin.name)
self.list_view.setSpacing(1)
self.list_view.setSelectionMode(QtWidgets.QAbstractItemView.ExtendedSelection)
self.list_view.setAlternatingRowColors(True)
self.list_view.setObjectName('{name}ListView'.format(name=self.plugin.name)) self.list_view.setObjectName('{name}ListView'.format(name=self.plugin.name))
# Add to page_layout # Add to page_layout
self.page_layout.addWidget(self.list_view) self.page_layout.addWidget(self.list_view)
# define and add the context menu
self.list_view.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
if self.has_edit_icon: if self.has_edit_icon:
create_widget_action(self.list_view, create_widget_action(self.list_view,
text=self.plugin.get_string(StringContent.Edit)['title'], text=self.plugin.get_string(StringContent.Edit)['title'],
@ -266,7 +261,7 @@ class MediaManagerItem(QtWidgets.QWidget, RegistryProperties):
self.search_text_layout.setObjectName('search_text_layout') self.search_text_layout.setObjectName('search_text_layout')
self.search_text_label = QtWidgets.QLabel(self.search_widget) self.search_text_label = QtWidgets.QLabel(self.search_widget)
self.search_text_label.setObjectName('search_text_label') self.search_text_label.setObjectName('search_text_label')
self.search_text_edit = SearchEdit(self.search_widget) self.search_text_edit = SearchEdit(self.search_widget, self.settings_section)
self.search_text_edit.setObjectName('search_text_edit') self.search_text_edit.setObjectName('search_text_edit')
self.search_text_label.setBuddy(self.search_text_edit) self.search_text_label.setBuddy(self.search_text_edit)
self.search_text_layout.addRow(self.search_text_label, self.search_text_edit) self.search_text_layout.addRow(self.search_text_label, self.search_text_edit)
@ -397,8 +392,6 @@ class MediaManagerItem(QtWidgets.QWidget, RegistryProperties):
# Decide if we have to show the context menu or not. # Decide if we have to show the context menu or not.
if item is None: if item is None:
return return
if not item.flags() & QtCore.Qt.ItemIsSelectable:
return
self.menu.exec(self.list_view.mapToGlobal(point)) self.menu.exec(self.list_view.mapToGlobal(point))
def get_file_list(self): def get_file_list(self):
@ -638,34 +631,6 @@ class MediaManagerItem(QtWidgets.QWidget, RegistryProperties):
""" """
return item return item
def check_search_result(self):
"""
Checks if the list_view is empty and adds a "No Search Results" item.
"""
if self.list_view.count():
return
message = translate('OpenLP.MediaManagerItem', 'No Search Results')
item = QtWidgets.QListWidgetItem(message)
item.setFlags(QtCore.Qt.NoItemFlags)
font = QtGui.QFont()
font.setItalic(True)
item.setFont(font)
self.list_view.addItem(item)
def check_search_result_search_while_typing_short(self):
"""
This is used in Bible "Search while typing" if the search is shorter than the min required len.
"""
if self.list_view.count():
return
message = translate('OpenLP.MediaManagerItem', 'Search is too short to be used in: "Search while typing"')
item = QtWidgets.QListWidgetItem(message)
item.setFlags(QtCore.Qt.NoItemFlags)
font = QtGui.QFont()
font.setItalic(True)
item.setFont(font)
self.list_view.addItem(item)
def _get_id_of_item_to_generate(self, item, remote_item): def _get_id_of_item_to_generate(self, item, remote_item):
""" """
Utility method to check items being submitted for slide generation. Utility method to check items being submitted for slide generation.

View File

@ -4,7 +4,7 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2016 OpenLP Developers # # Copyright (c) 2008-2017 OpenLP Developers #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free # # under the terms of the GNU General Public License as published by the Free #

View File

@ -4,7 +4,7 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2016 OpenLP Developers # # Copyright (c) 2008-2017 OpenLP Developers #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free # # under the terms of the GNU General Public License as published by the Free #

View File

@ -4,7 +4,7 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2016 OpenLP Developers # # Copyright (c) 2008-2017 OpenLP Developers #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free # # under the terms of the GNU General Public License as published by the Free #

View File

@ -4,7 +4,7 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2016 OpenLP Developers # # Copyright (c) 2008-2017 OpenLP Developers #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free # # under the terms of the GNU General Public License as published by the Free #

View File

@ -4,7 +4,7 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2016 OpenLP Developers # # Copyright (c) 2008-2017 OpenLP Developers #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free # # under the terms of the GNU General Public License as published by the Free #

View File

@ -4,7 +4,7 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2016 OpenLP Developers # # Copyright (c) 2008-2017 OpenLP Developers #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free # # under the terms of the GNU General Public License as published by the Free #

View File

@ -4,7 +4,7 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2016 OpenLP Developers # # Copyright (c) 2008-2017 OpenLP Developers #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free # # under the terms of the GNU General Public License as published by the Free #

View File

@ -4,7 +4,7 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2016 OpenLP Developers # # Copyright (c) 2008-2017 OpenLP Developers #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free # # under the terms of the GNU General Public License as published by the Free #

View File

@ -4,7 +4,7 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2016 OpenLP Developers # # Copyright (c) 2008-2017 OpenLP Developers #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free # # under the terms of the GNU General Public License as published by the Free #
@ -26,6 +26,7 @@ from PyQt5 import QtCore, QtWidgets
from openlp.core.lib import build_icon from openlp.core.lib import build_icon
from openlp.core.lib.ui import create_widget_action from openlp.core.lib.ui import create_widget_action
from openlp.core.common import Settings
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
@ -37,11 +38,12 @@ class SearchEdit(QtWidgets.QLineEdit):
searchTypeChanged = QtCore.pyqtSignal(QtCore.QVariant) searchTypeChanged = QtCore.pyqtSignal(QtCore.QVariant)
cleared = QtCore.pyqtSignal() cleared = QtCore.pyqtSignal()
def __init__(self, parent): def __init__(self, parent, settings_section):
""" """
Constructor. Constructor.
""" """
super(SearchEdit, self).__init__(parent) super().__init__(parent)
self.settings_section = settings_section
self._current_search_type = -1 self._current_search_type = -1
self.clear_button = QtWidgets.QToolButton(self) self.clear_button = QtWidgets.QToolButton(self)
self.clear_button.setIcon(build_icon(':/system/clear_shortcut.png')) self.clear_button.setIcon(build_icon(':/system/clear_shortcut.png'))
@ -100,14 +102,10 @@ class SearchEdit(QtWidgets.QLineEdit):
menu = self.menu_button.menu() menu = self.menu_button.menu()
for action in menu.actions(): for action in menu.actions():
if identifier == action.data(): if identifier == action.data():
# setPlaceholderText has been implemented in Qt 4.7 and in at least PyQt 4.9 (I am not sure, if it was self.setPlaceholderText(action.placeholder_text)
# implemented in PyQt 4.8).
try:
self.setPlaceholderText(action.placeholder_text)
except AttributeError:
pass
self.menu_button.setDefaultAction(action) self.menu_button.setDefaultAction(action)
self._current_search_type = identifier self._current_search_type = identifier
Settings().setValue('{section}/last search type'.format(section=self.settings_section), identifier)
self.searchTypeChanged.emit(identifier) self.searchTypeChanged.emit(identifier)
return True return True
@ -130,14 +128,10 @@ class SearchEdit(QtWidgets.QLineEdit):
(2, ":/songs/authors.png", "Authors", "Search Authors...") (2, ":/songs/authors.png", "Authors", "Search Authors...")
""" """
menu = QtWidgets.QMenu(self) menu = QtWidgets.QMenu(self)
first = None
for identifier, icon, title, placeholder in items: for identifier, icon, title, placeholder in items:
action = create_widget_action( action = create_widget_action(
menu, text=title, icon=icon, data=identifier, triggers=self._on_menu_action_triggered) menu, text=title, icon=icon, data=identifier, triggers=self._on_menu_action_triggered)
action.placeholder_text = placeholder action.placeholder_text = placeholder
if first is None:
first = action
self._current_search_type = identifier
if not hasattr(self, 'menu_button'): if not hasattr(self, 'menu_button'):
self.menu_button = QtWidgets.QToolButton(self) self.menu_button = QtWidgets.QToolButton(self)
self.menu_button.setIcon(build_icon(':/system/clear_shortcut.png')) self.menu_button.setIcon(build_icon(':/system/clear_shortcut.png'))
@ -146,7 +140,8 @@ class SearchEdit(QtWidgets.QLineEdit):
self.menu_button.setStyleSheet('QToolButton { border: none; padding: 0px 10px 0px 0px; }') self.menu_button.setStyleSheet('QToolButton { border: none; padding: 0px 10px 0px 0px; }')
self.menu_button.resize(QtCore.QSize(28, 18)) self.menu_button.resize(QtCore.QSize(28, 18))
self.menu_button.setMenu(menu) self.menu_button.setMenu(menu)
self.menu_button.setDefaultAction(first) self.set_current_search_type(
Settings().value('{section}/last search type'.format(section=self.settings_section)))
self.menu_button.show() self.menu_button.show()
self._update_style_sheet() self._update_style_sheet()

View File

@ -4,7 +4,7 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2016 OpenLP Developers # # Copyright (c) 2008-2017 OpenLP Developers #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free # # under the terms of the GNU General Public License as published by the Free #

View File

@ -4,7 +4,7 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2016 OpenLP Developers # # Copyright (c) 2008-2017 OpenLP Developers #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free # # under the terms of the GNU General Public License as published by the Free #

View File

@ -4,7 +4,7 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2016 OpenLP Developers # # Copyright (c) 2008-2017 OpenLP Developers #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free # # under the terms of the GNU General Public License as published by the Free #

View File

@ -4,7 +4,7 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2016 OpenLP Developers # # Copyright (c) 2008-2017 OpenLP Developers #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free # # under the terms of the GNU General Public License as published by the Free #

View File

@ -4,7 +4,7 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2016 OpenLP Developers # # Copyright (c) 2008-2017 OpenLP Developers #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free # # under the terms of the GNU General Public License as published by the Free #

View File

@ -4,7 +4,7 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2016 OpenLP Developers # # Copyright (c) 2008-2017 OpenLP Developers #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free # # under the terms of the GNU General Public License as published by the Free #
@ -19,6 +19,7 @@
# with this program; if not, write to the Free Software Foundation, Inc., 59 # # with this program; if not, write to the Free Software Foundation, Inc., 59 #
# Temple Place, Suite 330, Boston, MA 02111-1307 USA # # Temple Place, Suite 330, Boston, MA 02111-1307 USA #
############################################################################### ###############################################################################
import datetime
from PyQt5 import QtGui, QtWidgets from PyQt5 import QtGui, QtWidgets
@ -41,6 +42,7 @@ class UiAboutDialog(object):
about_dialog.setObjectName('about_dialog') about_dialog.setObjectName('about_dialog')
about_dialog.setWindowIcon(build_icon(':/icon/openlp-logo.svg')) about_dialog.setWindowIcon(build_icon(':/icon/openlp-logo.svg'))
self.about_dialog_layout = QtWidgets.QVBoxLayout(about_dialog) self.about_dialog_layout = QtWidgets.QVBoxLayout(about_dialog)
self.about_dialog_layout.setContentsMargins(8, 8, 8, 8)
self.about_dialog_layout.setObjectName('about_dialog_layout') self.about_dialog_layout.setObjectName('about_dialog_layout')
self.logo_label = QtWidgets.QLabel(about_dialog) self.logo_label = QtWidgets.QLabel(about_dialog)
self.logo_label.setPixmap(QtGui.QPixmap(':/graphics/openlp-about-logo.png')) self.logo_label.setPixmap(QtGui.QPixmap(':/graphics/openlp-about-logo.png'))
@ -111,9 +113,12 @@ class UiAboutDialog(object):
'Jonathan "springermac" Springer', 'Philip "Phill" Ridout'] 'Jonathan "springermac" Springer', 'Philip "Phill" Ridout']
contributors = ['Stuart "sibecker" Becker', 'Gerald "jerryb" Britton', 'Jonathan "gushie" Corwin', contributors = ['Stuart "sibecker" Becker', 'Gerald "jerryb" Britton', 'Jonathan "gushie" Corwin',
'Samuel "MrGamgee" Findlay', 'Michael "cocooncrash" Gorven', 'Scott "sguerrieri" Guerrieri', 'Samuel "MrGamgee" Findlay', 'Michael "cocooncrash" Gorven', 'Scott "sguerrieri" Guerrieri',
'Matthias "matthub" Hub', 'Meinert "m2j" Jordan', 'Armin "orangeshirt" K\xf6hler', 'Simon Hanna', 'Chris Hill',
'Rafael "rafaellerm" Lerm', 'Erik "luen" Lundin', 'Edwin "edwinlunando" Lunando', 'Matthias "matthub" Hub', 'Meinert "m2j" Jordan', 'Ian Knightly'
'Armin "orangeshirt" K\xf6hler',
'Rafael "rafaellerm" Lerm', 'Gabriel loo', 'Erik "luen" Lundin', 'Edwin "edwinlunando" Lunando',
'Dmitriy Marmyshev', 'Brian "brianmeyer" Meyer', 'Joshua "milleja46" Miller', 'Dmitriy Marmyshev', 'Brian "brianmeyer" Meyer', 'Joshua "milleja46" Miller',
'Suutari "Azaziah" Olli',
'Stevan "ElderP" Pettit', 'Mattias "mahfiaz" P\xf5ldaru', 'Felipe Polo-Wood', 'Stevan "ElderP" Pettit', 'Mattias "mahfiaz" P\xf5ldaru', 'Felipe Polo-Wood',
'Christian "crichter" Richter', 'Arjan "arjans" Schrijver', 'Simon "samscudder" Scudder', 'Christian "crichter" Richter', 'Arjan "arjans" Schrijver', 'Simon "samscudder" Scudder',
'Jeffrey "whydoubt" Smith', 'Stefan Strasser', 'Maikel Stuivenberg', 'Martin "mijiti" Thompson', 'Jeffrey "whydoubt" Smith', 'Stefan Strasser', 'Maikel Stuivenberg', 'Martin "mijiti" Thompson',
@ -188,7 +193,8 @@ class UiAboutDialog(object):
' Qt5: http://qt.io\n' ' Qt5: http://qt.io\n'
' PyQt5: http://www.riverbankcomputing.co.uk/software/pyqt/intro\n' ' PyQt5: http://www.riverbankcomputing.co.uk/software/pyqt/intro\n'
' Oxygen Icons: http://techbase.kde.org/Projects/Oxygen/\n' ' Oxygen Icons: http://techbase.kde.org/Projects/Oxygen/\n'
' MuPDF: http://www.mupdf.com/\n') ' MuPDF: http://www.mupdf.com/\n'
' MediaInfo: https://mediaarea.net/en/MediaInfo\n')
final_credit = translate('OpenLP.AboutForm', 'Final Credit\n' final_credit = translate('OpenLP.AboutForm', 'Final Credit\n'
' "For God so loved the world that He gave\n' ' "For God so loved the world that He gave\n'
' His one and only Son, so that whoever\n' ' His one and only Son, so that whoever\n'
@ -298,17 +304,19 @@ class UiAboutDialog(object):
self.about_notebook.setTabText(self.about_notebook.indexOf(self.credits_tab), self.about_notebook.setTabText(self.about_notebook.indexOf(self.credits_tab),
translate('OpenLP.AboutForm', 'Credits')) translate('OpenLP.AboutForm', 'Credits'))
cr_others = ('Tim Bentley, Gerald Britton, Jonathan Corwin, Samuel Findlay, ' cr_others = ('Tim Bentley, Gerald Britton, Jonathan Corwin, Samuel Findlay, '
'Michael Gorven, Scott Guerrieri, Matthias Hub, Meinert Jordan, ' 'Michael Gorven, Scott Guerrieri, Simon Hanna, Chris, Hill Matthias Hub, Meinert Jordan, '
'Armin K\xf6hler, Erik Lundin, Edwin Lunando, Joshua Miller, ' 'Ian Knightley, Armin K\xf6hler, Gabriel Loo, Erik Lundin, Edwin Lunando, Joshua Miller, '
'Brian T. Meyer, Stevan Pettit, Andreas Preikschat, ' 'Brian T. Meyer, Suutari Olli, Stevan Pettit, Andreas Preikschat, '
'Mattias P\xf5ldaru, Christian Richter, Philip Ridout, ' 'Mattias P\xf5ldaru, Christian Richter, Philip Ridout, '
'Ken Roberts, Simon Scudder, Jeffrey Smith, Maikel Stuivenberg, ' 'Ken Roberts, Simon Scudder, Jeffrey Smith, Maikel Stuivenberg, '
'Martin Thompson, Jon Tibble, Dave Warnock, Frode Woldsund, ' 'Martin Thompson, Jon Tibble, Dave Warnock, Frode Woldsund, '
'Martin Zibricky, Patrick Zimmermann') 'Martin Zibricky, Patrick Zimmermann')
copyright_note = translate('OpenLP.AboutForm', copyright_note = translate('OpenLP.AboutForm',
'Copyright \xa9 2004-2016 {cr}\n\n' 'Copyright {crs} 2004-{yr} {cr}\n\n'
'Portions copyright \xa9 2004-2016 {others}').format(cr='Raoul Snyman', 'Portions copyright {crs} 2004-{yr} {others}').format(cr='Raoul Snyman',
others=cr_others) yr=datetime.date.today().year,
others=cr_others,
crs='\xa9')
licence = translate('OpenLP.AboutForm', licence = translate('OpenLP.AboutForm',
'This program is free software; you can redistribute it and/or ' 'This program is free software; you can redistribute it and/or '
'modify it under the terms of the GNU General Public License as ' 'modify it under the terms of the GNU General Public License as '

View File

@ -4,7 +4,7 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2016 OpenLP Developers # # Copyright (c) 2008-2017 OpenLP Developers #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free # # under the terms of the GNU General Public License as published by the Free #

View File

@ -4,7 +4,7 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2016 OpenLP Developers # # Copyright (c) 2008-2017 OpenLP Developers #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free # # under the terms of the GNU General Public License as published by the Free #
@ -397,27 +397,6 @@ class AdvancedTab(SettingsTab):
self.data_directory_cancel_button.hide() self.data_directory_cancel_button.hide()
# Since data location can be changed, make sure the path is present. # Since data location can be changed, make sure the path is present.
self.current_data_path = AppLocation.get_data_path() self.current_data_path = AppLocation.get_data_path()
if not os.path.exists(self.current_data_path):
log.error('Data path not found {path}'.format(path=self.current_data_path))
answer = QtWidgets.QMessageBox.critical(
self, translate('OpenLP.AdvancedTab', 'Data Directory Error'),
translate('OpenLP.AdvancedTab', 'OpenLP data directory was not found\n\n{path}\n\n'
'This data directory was previously changed from the OpenLP '
'default location. If the new location was on removable '
'media, that media needs to be made available.\n\n'
'Click "No" to stop loading OpenLP. allowing you to fix the the problem.\n\n'
'Click "Yes" to reset the data directory to the default '
'location.').format(path=self.current_data_path),
QtWidgets.QMessageBox.StandardButtons(QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No),
QtWidgets.QMessageBox.No)
if answer == QtWidgets.QMessageBox.No:
log.info('User requested termination')
self.main_window.clean_up()
sys.exit()
# Set data location to default.
settings.remove('advanced/data path')
self.current_data_path = AppLocation.get_data_path()
log.warning('User requested data path set to default {path}'.format(path=self.current_data_path))
self.data_directory_label.setText(os.path.abspath(self.current_data_path)) self.data_directory_label.setText(os.path.abspath(self.current_data_path))
# Don't allow data directory move if running portable. # Don't allow data directory move if running portable.
if settings.value('advanced/is portable'): if settings.value('advanced/is portable'):

View File

@ -4,7 +4,7 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2016 OpenLP Developers # # Copyright (c) 2008-2017 OpenLP Developers #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free # # under the terms of the GNU General Public License as published by the Free #
@ -38,7 +38,7 @@ class Ui_ExceptionDialog(object):
Set up the UI. Set up the UI.
""" """
exception_dialog.setObjectName('exception_dialog') exception_dialog.setObjectName('exception_dialog')
exception_dialog.setWindowIcon(build_icon(u':/icon/openlp-logo.svg')) exception_dialog.setWindowIcon(build_icon(':/icon/openlp-logo.svg'))
self.exception_layout = QtWidgets.QVBoxLayout(exception_dialog) self.exception_layout = QtWidgets.QVBoxLayout(exception_dialog)
self.exception_layout.setObjectName('exception_layout') self.exception_layout.setObjectName('exception_layout')
self.message_layout = QtWidgets.QHBoxLayout() self.message_layout = QtWidgets.QHBoxLayout()
@ -97,9 +97,9 @@ class Ui_ExceptionDialog(object):
translate('OpenLP.ExceptionDialog', '<strong>Please describe what you were trying to do.</strong> ' translate('OpenLP.ExceptionDialog', '<strong>Please describe what you were trying to do.</strong> '
'&nbsp;If possible, write in English.')) '&nbsp;If possible, write in English.'))
exception_part1 = (translate('OpenLP.ExceptionDialog', exception_part1 = (translate('OpenLP.ExceptionDialog',
'<strong>Oops, OpenLP hit a problem and couldn\'t recover!</strong> <br><br>' '<strong>Oops, OpenLP hit a problem and couldn\'t recover!<br><br>'
'<strong>You can help </strong> the OpenLP developers to <strong>fix this</strong>' 'You can help </strong> the OpenLP developers to <strong>fix this</strong>'
' by<br> sending them a <strong>bug report</strong> to {email}{newlines}' ' by<br> sending them a <strong>bug report to {email}</strong>{newlines}'
).format(email='<a href = "mailto:bugs@openlp.org" > bugs@openlp.org</a>', ).format(email='<a href = "mailto:bugs@openlp.org" > bugs@openlp.org</a>',
newlines='<br><br>')) newlines='<br><br>'))
self.message_label.setText( self.message_label.setText(
@ -107,7 +107,7 @@ class Ui_ExceptionDialog(object):
'<strong>No email app? </strong> You can <strong>save</strong> this ' '<strong>No email app? </strong> You can <strong>save</strong> this '
'information to a <strong>file</strong> and<br>' 'information to a <strong>file</strong> and<br>'
'send it from your <strong>mail on browser</strong> via an <strong>attachment.</strong><br><br>' 'send it from your <strong>mail on browser</strong> via an <strong>attachment.</strong><br><br>'
'<strong>Thank you<strong> for being part of making OpenLP better!<br>' '<strong>Thank you</strong> for being part of making OpenLP better!<br>'
).format(first_part=exception_part1)) ).format(first_part=exception_part1))
self.send_report_button.setText(translate('OpenLP.ExceptionDialog', 'Send E-Mail')) self.send_report_button.setText(translate('OpenLP.ExceptionDialog', 'Send E-Mail'))
self.save_report_button.setText(translate('OpenLP.ExceptionDialog', 'Save to File')) self.save_report_button.setText(translate('OpenLP.ExceptionDialog', 'Save to File'))

View File

@ -4,7 +4,7 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2016 OpenLP Developers # # Copyright (c) 2008-2017 OpenLP Developers #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free # # under the terms of the GNU General Public License as published by the Free #
@ -208,7 +208,7 @@ class ExceptionForm(QtWidgets.QDialog, Ui_ExceptionDialog, RegistryProperties):
self.__button_state(False) self.__button_state(False)
self.description_word_count.setText( self.description_word_count.setText(
translate('OpenLP.ExceptionDialog', '<strong>Please enter a more detailed description of the situation' translate('OpenLP.ExceptionDialog', '<strong>Please enter a more detailed description of the situation'
)) '</strong>'))
def on_attach_file_button_clicked(self): def on_attach_file_button_clicked(self):
""" """

View File

@ -4,7 +4,7 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2016 OpenLP Developers # # Copyright (c) 2008-2017 OpenLP Developers #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free # # under the terms of the GNU General Public License as published by the Free #
@ -37,7 +37,7 @@ class Ui_FileRenameDialog(object):
Set up the UI Set up the UI
""" """
file_rename_dialog.setObjectName('file_rename_dialog') file_rename_dialog.setObjectName('file_rename_dialog')
file_rename_dialog.setWindowIcon(build_icon(u':/icon/openlp-logo.svg')) file_rename_dialog.setWindowIcon(build_icon(':/icon/openlp-logo.svg'))
file_rename_dialog.resize(300, 10) file_rename_dialog.resize(300, 10)
self.dialog_layout = QtWidgets.QGridLayout(file_rename_dialog) self.dialog_layout = QtWidgets.QGridLayout(file_rename_dialog)
self.dialog_layout.setObjectName('dialog_layout') self.dialog_layout.setObjectName('dialog_layout')

View File

@ -4,7 +4,7 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2016 OpenLP Developers # # Copyright (c) 2008-2017 OpenLP Developers #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free # # under the terms of the GNU General Public License as published by the Free #

View File

@ -4,7 +4,7 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2016 OpenLP Developers # # Copyright (c) 2008-2017 OpenLP Developers #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free # # under the terms of the GNU General Public License as published by the Free #
@ -22,7 +22,6 @@
""" """
This module contains the first time wizard. This module contains the first time wizard.
""" """
import hashlib
import logging import logging
import os import os
import socket import socket
@ -39,7 +38,7 @@ from openlp.core.common import Registry, RegistryProperties, AppLocation, Settin
translate, clean_button_text, trace_error_handler translate, clean_button_text, trace_error_handler
from openlp.core.lib import PluginStatus, build_icon from openlp.core.lib import PluginStatus, build_icon
from openlp.core.lib.ui import critical_error_message_box from openlp.core.lib.ui import critical_error_message_box
from openlp.core.lib.webpagereader import get_web_page, CONNECTION_RETRIES, CONNECTION_TIMEOUT from openlp.core.common.httputils import get_web_page, get_url_file_size, url_get_file, CONNECTION_TIMEOUT
from .firsttimewizard import UiFirstTimeWizard, FirstTimePage from .firsttimewizard import UiFirstTimeWizard, FirstTimePage
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
@ -395,54 +394,6 @@ class FirstTimeForm(QtWidgets.QWizard, UiFirstTimeWizard, RegistryProperties):
self.was_cancelled = True self.was_cancelled = True
self.close() self.close()
def url_get_file(self, url, f_path, sha256=None):
""""
Download a file given a URL. The file is retrieved in chunks, giving the ability to cancel the download at any
point. Returns False on download error.
:param url: URL to download
:param f_path: Destination file
"""
block_count = 0
block_size = 4096
retries = 0
while True:
try:
filename = open(f_path, "wb")
url_file = urllib.request.urlopen(url, timeout=CONNECTION_TIMEOUT)
if sha256:
hasher = hashlib.sha256()
# Download until finished or canceled.
while not self.was_cancelled:
data = url_file.read(block_size)
if not data:
break
filename.write(data)
if sha256:
hasher.update(data)
block_count += 1
self._download_progress(block_count, block_size)
filename.close()
if sha256 and hasher.hexdigest() != sha256:
log.error('sha256 sums did not match for file: {file}'.format(file=f_path))
os.remove(f_path)
return False
except (urllib.error.URLError, socket.timeout) as err:
trace_error_handler(log)
filename.close()
os.remove(f_path)
if retries > CONNECTION_RETRIES:
return False
else:
retries += 1
time.sleep(0.1)
continue
break
# Delete file if cancelled, it may be a partial file.
if self.was_cancelled:
os.remove(f_path)
return True
def _build_theme_screenshots(self): def _build_theme_screenshots(self):
""" """
This method builds the theme screenshots' icons for all items in the ``self.themes_list_widget``. This method builds the theme screenshots' icons for all items in the ``self.themes_list_widget``.
@ -455,26 +406,6 @@ class FirstTimeForm(QtWidgets.QWizard, UiFirstTimeWizard, RegistryProperties):
if item: if item:
item.setIcon(build_icon(os.path.join(gettempdir(), 'openlp', screenshot))) item.setIcon(build_icon(os.path.join(gettempdir(), 'openlp', screenshot)))
def _get_file_size(self, url):
"""
Get the size of a file.
:param url: The URL of the file we want to download.
"""
retries = 0
while True:
try:
site = urllib.request.urlopen(url, timeout=CONNECTION_TIMEOUT)
meta = site.info()
return int(meta.get("Content-Length"))
except urllib.error.URLError:
if retries > CONNECTION_RETRIES:
raise
else:
retries += 1
time.sleep(0.1)
continue
def _download_progress(self, count, block_size): def _download_progress(self, count, block_size):
""" """
Calculate and display the download progress. Calculate and display the download progress.
@ -510,7 +441,7 @@ class FirstTimeForm(QtWidgets.QWizard, UiFirstTimeWizard, RegistryProperties):
item = self.songs_list_widget.item(i) item = self.songs_list_widget.item(i)
if item.checkState() == QtCore.Qt.Checked: if item.checkState() == QtCore.Qt.Checked:
filename, sha256 = item.data(QtCore.Qt.UserRole) filename, sha256 = item.data(QtCore.Qt.UserRole)
size = self._get_file_size('{path}{name}'.format(path=self.songs_url, name=filename)) size = get_url_file_size('{path}{name}'.format(path=self.songs_url, name=filename))
self.max_progress += size self.max_progress += size
# Loop through the Bibles list and increase for each selected item # Loop through the Bibles list and increase for each selected item
iterator = QtWidgets.QTreeWidgetItemIterator(self.bibles_tree_widget) iterator = QtWidgets.QTreeWidgetItemIterator(self.bibles_tree_widget)
@ -519,7 +450,7 @@ class FirstTimeForm(QtWidgets.QWizard, UiFirstTimeWizard, RegistryProperties):
item = iterator.value() item = iterator.value()
if item.parent() and item.checkState(0) == QtCore.Qt.Checked: if item.parent() and item.checkState(0) == QtCore.Qt.Checked:
filename, sha256 = item.data(0, QtCore.Qt.UserRole) filename, sha256 = item.data(0, QtCore.Qt.UserRole)
size = self._get_file_size('{path}{name}'.format(path=self.bibles_url, name=filename)) size = get_url_file_size('{path}{name}'.format(path=self.bibles_url, name=filename))
self.max_progress += size self.max_progress += size
iterator += 1 iterator += 1
# Loop through the themes list and increase for each selected item # Loop through the themes list and increase for each selected item
@ -528,7 +459,7 @@ class FirstTimeForm(QtWidgets.QWizard, UiFirstTimeWizard, RegistryProperties):
item = self.themes_list_widget.item(i) item = self.themes_list_widget.item(i)
if item.checkState() == QtCore.Qt.Checked: if item.checkState() == QtCore.Qt.Checked:
filename, sha256 = item.data(QtCore.Qt.UserRole) filename, sha256 = item.data(QtCore.Qt.UserRole)
size = self._get_file_size('{path}{name}'.format(path=self.themes_url, name=filename)) size = get_url_file_size('{path}{name}'.format(path=self.themes_url, name=filename))
self.max_progress += size self.max_progress += size
except urllib.error.URLError: except urllib.error.URLError:
trace_error_handler(log) trace_error_handler(log)
@ -636,8 +567,8 @@ class FirstTimeForm(QtWidgets.QWizard, UiFirstTimeWizard, RegistryProperties):
self._increment_progress_bar(self.downloading.format(name=filename), 0) self._increment_progress_bar(self.downloading.format(name=filename), 0)
self.previous_size = 0 self.previous_size = 0
destination = os.path.join(songs_destination, str(filename)) destination = os.path.join(songs_destination, str(filename))
if not self.url_get_file('{path}{name}'.format(path=self.songs_url, name=filename), if not url_get_file(self, '{path}{name}'.format(path=self.songs_url, name=filename),
destination, sha256): destination, sha256):
missed_files.append('Song: {name}'.format(name=filename)) missed_files.append('Song: {name}'.format(name=filename))
# Download Bibles # Download Bibles
bibles_iterator = QtWidgets.QTreeWidgetItemIterator(self.bibles_tree_widget) bibles_iterator = QtWidgets.QTreeWidgetItemIterator(self.bibles_tree_widget)
@ -648,9 +579,9 @@ class FirstTimeForm(QtWidgets.QWizard, UiFirstTimeWizard, RegistryProperties):
# TODO: Tested at home # TODO: Tested at home
self._increment_progress_bar(self.downloading.format(name=bible), 0) self._increment_progress_bar(self.downloading.format(name=bible), 0)
self.previous_size = 0 self.previous_size = 0
if not self.url_get_file('{path}{name}'.format(path=self.bibles_url, name=bible), if not url_get_file(self, '{path}{name}'.format(path=self.bibles_url, name=bible),
os.path.join(bibles_destination, bible), os.path.join(bibles_destination, bible),
sha256): sha256):
missed_files.append('Bible: {name}'.format(name=bible)) missed_files.append('Bible: {name}'.format(name=bible))
bibles_iterator += 1 bibles_iterator += 1
# Download themes # Download themes
@ -661,9 +592,9 @@ class FirstTimeForm(QtWidgets.QWizard, UiFirstTimeWizard, RegistryProperties):
# TODO: Tested at home # TODO: Tested at home
self._increment_progress_bar(self.downloading.format(name=theme), 0) self._increment_progress_bar(self.downloading.format(name=theme), 0)
self.previous_size = 0 self.previous_size = 0
if not self.url_get_file('{path}{name}'.format(path=self.themes_url, name=theme), if not url_get_file(self, '{path}{name}'.format(path=self.themes_url, name=theme),
os.path.join(themes_destination, theme), os.path.join(themes_destination, theme),
sha256): sha256):
missed_files.append('Theme: {name}'.format(name=theme)) missed_files.append('Theme: {name}'.format(name=theme))
if missed_files: if missed_files:
file_list = '' file_list = ''

View File

@ -4,7 +4,7 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2016 OpenLP Developers # # Copyright (c) 2008-2017 OpenLP Developers #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free # # under the terms of the GNU General Public License as published by the Free #
@ -38,7 +38,7 @@ class Ui_FirstTimeLanguageDialog(object):
Set up the UI. Set up the UI.
""" """
language_dialog.setObjectName('language_dialog') language_dialog.setObjectName('language_dialog')
language_dialog.setWindowIcon(build_icon(u':/icon/openlp-logo.svg')) language_dialog.setWindowIcon(build_icon(':/icon/openlp-logo.svg'))
language_dialog.resize(300, 50) language_dialog.resize(300, 50)
self.dialog_layout = QtWidgets.QVBoxLayout(language_dialog) self.dialog_layout = QtWidgets.QVBoxLayout(language_dialog)
self.dialog_layout.setContentsMargins(8, 8, 8, 8) self.dialog_layout.setContentsMargins(8, 8, 8, 8)

View File

@ -4,7 +4,7 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2016 OpenLP Developers # # Copyright (c) 2008-2017 OpenLP Developers #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free # # under the terms of the GNU General Public License as published by the Free #

View File

@ -4,7 +4,7 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2016 OpenLP Developers # # Copyright (c) 2008-2017 OpenLP Developers #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free # # under the terms of the GNU General Public License as published by the Free #
@ -55,7 +55,7 @@ class UiFirstTimeWizard(object):
:param first_time_wizard: The wizard form :param first_time_wizard: The wizard form
""" """
first_time_wizard.setObjectName('first_time_wizard') first_time_wizard.setObjectName('first_time_wizard')
first_time_wizard.setWindowIcon(build_icon(u':/icon/openlp-logo.svg')) first_time_wizard.setWindowIcon(build_icon(':/icon/openlp-logo.svg'))
first_time_wizard.resize(550, 386) first_time_wizard.resize(550, 386)
first_time_wizard.setModal(True) first_time_wizard.setModal(True)
first_time_wizard.setOptions(QtWidgets.QWizard.IndependentPages | QtWidgets.QWizard.NoBackButtonOnStartPage | first_time_wizard.setOptions(QtWidgets.QWizard.IndependentPages | QtWidgets.QWizard.NoBackButtonOnStartPage |

View File

@ -4,7 +4,7 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2016 OpenLP Developers # # Copyright (c) 2008-2017 OpenLP Developers #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free # # under the terms of the GNU General Public License as published by the Free #

View File

@ -4,7 +4,7 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2016 OpenLP Developers # # Copyright (c) 2008-2017 OpenLP Developers #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free # # under the terms of the GNU General Public License as published by the Free #
@ -38,7 +38,7 @@ class Ui_FormattingTagDialog(object):
Set up the UI Set up the UI
""" """
formatting_tag_dialog.setObjectName('formatting_tag_dialog') formatting_tag_dialog.setObjectName('formatting_tag_dialog')
formatting_tag_dialog.setWindowIcon(build_icon(u':/icon/openlp-logo.svg')) formatting_tag_dialog.setWindowIcon(build_icon(':/icon/openlp-logo.svg'))
formatting_tag_dialog.resize(725, 548) formatting_tag_dialog.resize(725, 548)
self.list_data_grid_layout = QtWidgets.QVBoxLayout(formatting_tag_dialog) self.list_data_grid_layout = QtWidgets.QVBoxLayout(formatting_tag_dialog)
self.list_data_grid_layout.setContentsMargins(8, 8, 8, 8) self.list_data_grid_layout.setContentsMargins(8, 8, 8, 8)

View File

@ -4,7 +4,7 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2016 OpenLP Developers # # Copyright (c) 2008-2017 OpenLP Developers #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free # # under the terms of the GNU General Public License as published by the Free #

View File

@ -4,7 +4,7 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2016 OpenLP Developers # # Copyright (c) 2008-2017 OpenLP Developers #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free # # under the terms of the GNU General Public License as published by the Free #
@ -44,7 +44,7 @@ class GeneralTab(SettingsTab):
self.logo_file = ':/graphics/openlp-splash-screen.png' self.logo_file = ':/graphics/openlp-splash-screen.png'
self.logo_background_color = '#ffffff' self.logo_background_color = '#ffffff'
self.screens = ScreenList() self.screens = ScreenList()
self.icon_path = ':/icon/openlp-logo-16x16.png' self.icon_path = ':/icon/openlp-logo.svg'
general_translated = translate('OpenLP.GeneralTab', 'General') general_translated = translate('OpenLP.GeneralTab', 'General')
super(GeneralTab, self).__init__(parent, 'Core', general_translated) super(GeneralTab, self).__init__(parent, 'Core', general_translated)

View File

@ -4,7 +4,7 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2016 OpenLP Developers # # Copyright (c) 2008-2017 OpenLP Developers #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free # # under the terms of the GNU General Public License as published by the Free #

View File

@ -4,7 +4,7 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2016 OpenLP Developers # # Copyright (c) 2008-2017 OpenLP Developers #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free # # under the terms of the GNU General Public License as published by the Free #

View File

@ -4,7 +4,7 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2016 OpenLP Developers # # Copyright (c) 2008-2017 OpenLP Developers #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free # # under the terms of the GNU General Public License as published by the Free #

View File

@ -4,7 +4,7 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2016 OpenLP Developers # # Copyright (c) 2008-2017 OpenLP Developers #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free # # under the terms of the GNU General Public License as published by the Free #

View File

@ -4,7 +4,7 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2016 OpenLP Developers # # Copyright (c) 2008-2017 OpenLP Developers #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free # # under the terms of the GNU General Public License as published by the Free #

View File

@ -4,7 +4,7 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2016 OpenLP Developers # # Copyright (c) 2008-2017 OpenLP Developers #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free # # under the terms of the GNU General Public License as published by the Free #
@ -26,7 +26,7 @@ import os
from PyQt5 import QtCore, QtGui, QtWidgets from PyQt5 import QtCore, QtGui, QtWidgets
from openlp.core.common import Registry from openlp.core.common import Registry, UiStrings
class ListWidgetWithDnD(QtWidgets.QListWidget): class ListWidgetWithDnD(QtWidgets.QListWidget):
@ -37,8 +37,14 @@ class ListWidgetWithDnD(QtWidgets.QListWidget):
""" """
Initialise the list widget Initialise the list widget
""" """
super(ListWidgetWithDnD, self).__init__(parent) super().__init__(parent)
self.mime_data_text = name self.mime_data_text = name
self.no_results_text = UiStrings().NoResults
self.setSpacing(1)
self.setSelectionMode(QtWidgets.QAbstractItemView.ExtendedSelection)
self.setAlternatingRowColors(True)
self.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
self.locked = False
def activateDnD(self): def activateDnD(self):
""" """
@ -48,6 +54,21 @@ class ListWidgetWithDnD(QtWidgets.QListWidget):
self.setDragDropMode(QtWidgets.QAbstractItemView.DragDrop) self.setDragDropMode(QtWidgets.QAbstractItemView.DragDrop)
Registry().register_function(('%s_dnd' % self.mime_data_text), self.parent().load_file) Registry().register_function(('%s_dnd' % self.mime_data_text), self.parent().load_file)
def clear(self, search_while_typing=False, override_lock=False):
"""
Re-implement clear, so that we can customise feedback when using 'Search as you type'
:param search_while_typing: True if we want to display the customised message
:return: None
"""
if self.locked and not override_lock:
return
if search_while_typing:
self.no_results_text = UiStrings().ShortResults
else:
self.no_results_text = UiStrings().NoResults
super().clear()
def mouseMoveEvent(self, event): def mouseMoveEvent(self, event):
""" """
Drag and drop event does not care what data is selected as the recipient will use events to request the data Drag and drop event does not care what data is selected as the recipient will use events to request the data
@ -102,6 +123,24 @@ class ListWidgetWithDnD(QtWidgets.QListWidget):
listing = os.listdir(local_file) listing = os.listdir(local_file)
for file in listing: for file in listing:
files.append(os.path.join(local_file, file)) files.append(os.path.join(local_file, file))
Registry().execute('%s_dnd' % self.mime_data_text, {'files': files, 'target': self.itemAt(event.pos())}) Registry().execute('{mime_data}_dnd'.format(mime_data=self.mime_data_text),
{'files': files, 'target': self.itemAt(event.pos())})
else: else:
event.ignore() event.ignore()
def paintEvent(self, event):
"""
Re-implement paintEvent so that we can add 'No Results' text when the listWidget is empty.
:param event: A QPaintEvent
:return: None
"""
super().paintEvent(event)
if not self.count():
viewport = self.viewport()
painter = QtGui.QPainter(viewport)
font = QtGui.QFont()
font.setItalic(True)
painter.setFont(font)
painter.drawText(QtCore.QRect(0, 0, viewport.width(), viewport.height()),
(QtCore.Qt.AlignHCenter | QtCore.Qt.TextWordWrap), self.no_results_text)

View File

@ -4,7 +4,7 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2016 OpenLP Developers # # Copyright (c) 2008-2017 OpenLP Developers #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free # # under the terms of the GNU General Public License as published by the Free #
@ -54,7 +54,7 @@ class MediaDockManager(object):
match = True match = True
break break
if not match: if not match:
self.media_dock.addItem(media_item, visible_title['title']) self.media_dock.addItem(media_item, media_item.plugin.icon, visible_title['title'])
def remove_dock(self, media_item): def remove_dock(self, media_item):
""" """

View File

@ -4,7 +4,7 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2016 OpenLP Developers # # Copyright (c) 2008-2017 OpenLP Developers #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free # # under the terms of the GNU General Public License as published by the Free #

View File

@ -4,7 +4,7 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2016 OpenLP Developers # # Copyright (c) 2008-2017 OpenLP Developers #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free # # under the terms of the GNU General Public License as published by the Free #

View File

@ -4,7 +4,7 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2016 OpenLP Developers # # Copyright (c) 2008-2017 OpenLP Developers #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free # # under the terms of the GNU General Public License as published by the Free #
@ -26,7 +26,7 @@ import os
from PyQt5 import QtCore, QtGui, QtWidgets from PyQt5 import QtCore, QtGui, QtWidgets
from openlp.core.common import Registry from openlp.core.common import Registry, is_win
class TreeWidgetWithDnD(QtWidgets.QTreeWidget): class TreeWidgetWithDnD(QtWidgets.QTreeWidget):
@ -108,6 +108,11 @@ class TreeWidgetWithDnD(QtWidgets.QTreeWidget):
:param event: Handle of the event pint passed :param event: Handle of the event pint passed
""" """
# If we are on Windows, OpenLP window will not be set on top. For example, user can drag images to Library and
# the folder stays on top of the group creation box. This piece of code fixes this issue.
if is_win():
self.setWindowState(self.windowState() & ~QtCore.Qt.WindowMinimized | QtCore.Qt.WindowActive)
self.setWindowState(QtCore.Qt.WindowNoState)
if event.mimeData().hasUrls(): if event.mimeData().hasUrls():
event.setDropAction(QtCore.Qt.CopyAction) event.setDropAction(QtCore.Qt.CopyAction)
event.accept() event.accept()

View File

@ -4,7 +4,7 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2016 OpenLP Developers # # Copyright (c) 2008-2017 OpenLP Developers #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free # # under the terms of the GNU General Public License as published by the Free #
@ -46,6 +46,7 @@ class WizardStrings(object):
OSIS = 'OSIS' OSIS = 'OSIS'
ZEF = 'Zefania' ZEF = 'Zefania'
SWORD = 'Sword' SWORD = 'Sword'
WordProject = 'WordProject'
# These strings should need a good reason to be retranslated elsewhere. # These strings should need a good reason to be retranslated elsewhere.
FinishedImport = translate('OpenLP.Ui', 'Finished import.') FinishedImport = translate('OpenLP.Ui', 'Finished import.')
FormatLabel = translate('OpenLP.Ui', 'Format:') FormatLabel = translate('OpenLP.Ui', 'Format:')
@ -95,6 +96,7 @@ class OpenLPWizard(QtWidgets.QWizard, RegistryProperties):
super(OpenLPWizard, self).__init__(parent) super(OpenLPWizard, self).__init__(parent)
self.plugin = plugin self.plugin = plugin
self.with_progress_page = add_progress_page self.with_progress_page = add_progress_page
self.setFixedWidth(640)
self.setObjectName(name) self.setObjectName(name)
self.open_icon = build_icon(':/general/general_open.png') self.open_icon = build_icon(':/general/general_open.png')
self.delete_icon = build_icon(':/general/general_delete.png') self.delete_icon = build_icon(':/general/general_delete.png')

View File

@ -4,7 +4,7 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2016 OpenLP Developers # # Copyright (c) 2008-2017 OpenLP Developers #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free # # under the terms of the GNU General Public License as published by the Free #
@ -689,7 +689,7 @@ class AudioPlayer(OpenLPMixin, QtCore.QObject):
""" """
Skip forward to the next track in the list Skip forward to the next track in the list
""" """
self.player.next() self.playerlist.next()
def go_to(self, index): def go_to(self, index):
""" """

View File

@ -4,7 +4,7 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2016 OpenLP Developers # # Copyright (c) 2008-2017 OpenLP Developers #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free # # under the terms of the GNU General Public License as published by the Free #
@ -52,21 +52,17 @@ from openlp.core.ui.lib.mediadockmanager import MediaDockManager
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
MEDIA_MANAGER_STYLE = """ MEDIA_MANAGER_STYLE = """
QToolBox { ::tab#media_tool_box {
padding-bottom: 2px;
}
QToolBox::tab {
background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
stop: 0 palette(button), stop: 1.0 palette(mid)); stop: 0 palette(button), stop: 1.0 palette(mid));
border: 1px solid palette(mid); border: 0;
border-radius: 3px; border-radius: 2px;
} margin-top: 0;
QToolBox::tab:selected { margin-bottom: 0;
background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, text-align: left;
stop: 0 palette(light), stop: 1.0 palette(button));
border: 1px solid palette(mid);
font-weight: bold;
} }
/* This is here to make the tabs on KDE with the Breeze theme work */
::tab:selected {}
""" """
PROGRESSBAR_STYLE = """ PROGRESSBAR_STYLE = """
@ -180,6 +176,7 @@ class Ui_MainWindow(object):
self.projector_manager_contents = ProjectorManager(self.projector_manager_dock) self.projector_manager_contents = ProjectorManager(self.projector_manager_dock)
self.projector_manager_contents.setObjectName('projector_manager_contents') self.projector_manager_contents.setObjectName('projector_manager_contents')
self.projector_manager_dock.setWidget(self.projector_manager_contents) self.projector_manager_dock.setWidget(self.projector_manager_contents)
self.projector_manager_dock.setVisible(False)
main_window.addDockWidget(QtCore.Qt.RightDockWidgetArea, self.projector_manager_dock) main_window.addDockWidget(QtCore.Qt.RightDockWidgetArea, self.projector_manager_dock)
# Create the menu items # Create the menu items
action_list = ActionList.get_instance() action_list = ActionList.get_instance()
@ -309,21 +306,12 @@ class Ui_MainWindow(object):
self.about_item.setMenuRole(QtWidgets.QAction.AboutRole) self.about_item.setMenuRole(QtWidgets.QAction.AboutRole)
if is_win(): if is_win():
self.local_help_file = os.path.join(AppLocation.get_directory(AppLocation.AppDir), 'OpenLP.chm') self.local_help_file = os.path.join(AppLocation.get_directory(AppLocation.AppDir), 'OpenLP.chm')
self.offline_help_item = create_action(main_window, 'offlineHelpItem',
icon=':/system/system_help_contents.png',
can_shortcuts=True,
category=UiStrings().Help, triggers=self.on_offline_help_clicked)
elif is_macosx(): elif is_macosx():
self.local_help_file = os.path.join(AppLocation.get_directory(AppLocation.AppDir), self.local_help_file = os.path.join(AppLocation.get_directory(AppLocation.AppDir),
'..', 'Resources', 'OpenLP.help') '..', 'Resources', 'OpenLP.help')
self.offline_help_item = create_action(main_window, 'offlineHelpItem', self.user_manual_item = create_action(main_window, 'userManualItem', icon=':/system/system_help_contents.png',
icon=':/system/system_help_contents.png', can_shortcuts=True, category=UiStrings().Help,
can_shortcuts=True, triggers=self.on_help_clicked)
category=UiStrings().Help, triggers=self.on_offline_help_clicked)
self.on_line_help_item = create_action(main_window, 'onlineHelpItem',
icon=':/system/system_online_help.png',
can_shortcuts=True,
category=UiStrings().Help, triggers=self.on_online_help_clicked)
self.web_site_item = create_action(main_window, 'webSiteItem', can_shortcuts=True, category=UiStrings().Help) self.web_site_item = create_action(main_window, 'webSiteItem', can_shortcuts=True, category=UiStrings().Help)
# Shortcuts not connected to buttons or menu entries. # Shortcuts not connected to buttons or menu entries.
self.search_shortcut_action = create_action(main_window, self.search_shortcut_action = create_action(main_window,
@ -362,11 +350,7 @@ class Ui_MainWindow(object):
add_actions(self.tools_menu, (self.tools_open_data_folder, None)) add_actions(self.tools_menu, (self.tools_open_data_folder, None))
add_actions(self.tools_menu, (self.tools_first_time_wizard, None)) add_actions(self.tools_menu, (self.tools_first_time_wizard, None))
add_actions(self.tools_menu, [self.update_theme_images]) add_actions(self.tools_menu, [self.update_theme_images])
if (is_win() or is_macosx()) and (hasattr(sys, 'frozen') and sys.frozen == 1): add_actions(self.help_menu, (self.user_manual_item, None, self.web_site_item, self.about_item))
add_actions(self.help_menu, (self.offline_help_item, self.on_line_help_item, None, self.web_site_item,
self.about_item))
else:
add_actions(self.help_menu, (self.on_line_help_item, None, self.web_site_item, self.about_item))
add_actions(self.menu_bar, (self.file_menu.menuAction(), self.view_menu.menuAction(), add_actions(self.menu_bar, (self.file_menu.menuAction(), self.view_menu.menuAction(),
self.tools_menu.menuAction(), self.settings_menu.menuAction(), self.help_menu.menuAction())) self.tools_menu.menuAction(), self.settings_menu.menuAction(), self.help_menu.menuAction()))
add_actions(self, [self.search_shortcut_action]) add_actions(self, [self.search_shortcut_action])
@ -462,9 +446,7 @@ class Ui_MainWindow(object):
'from here.')) 'from here.'))
self.about_item.setText(translate('OpenLP.MainWindow', '&About')) self.about_item.setText(translate('OpenLP.MainWindow', '&About'))
self.about_item.setStatusTip(translate('OpenLP.MainWindow', 'More information about OpenLP.')) self.about_item.setStatusTip(translate('OpenLP.MainWindow', 'More information about OpenLP.'))
if is_win() or is_macosx(): self.user_manual_item.setText(translate('OpenLP.MainWindow', '&User Manual'))
self.offline_help_item.setText(translate('OpenLP.MainWindow', '&User Guide'))
self.on_line_help_item.setText(translate('OpenLP.MainWindow', '&Online Help'))
self.search_shortcut_action.setText(UiStrings().Search) self.search_shortcut_action.setText(UiStrings().Search)
self.search_shortcut_action.setToolTip( self.search_shortcut_action.setToolTip(
translate('OpenLP.MainWindow', 'Jump to the search box of the current active plugin.')) translate('OpenLP.MainWindow', 'Jump to the search box of the current active plugin.'))
@ -778,18 +760,16 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow, RegistryProperties):
import webbrowser import webbrowser
webbrowser.open_new('http://openlp.org/') webbrowser.open_new('http://openlp.org/')
def on_offline_help_clicked(self): def on_help_clicked(self):
""" """
Load the local OpenLP help file If is_macosx or is_win, open the local OpenLP help file.
Use the Online manual in other cases. (Linux)
""" """
QtGui.QDesktopServices.openUrl(QtCore.QUrl("file:///" + self.local_help_file)) if is_macosx() or is_win():
QtGui.QDesktopServices.openUrl(QtCore.QUrl.fromLocalFile(self.local_help_file))
def on_online_help_clicked(self): else:
""" import webbrowser
Load the online OpenLP manual webbrowser.open_new('http://manual.openlp.org/')
"""
import webbrowser
webbrowser.open_new('http://manual.openlp.org/')
def on_about_item_clicked(self): def on_about_item_clicked(self):
""" """
@ -809,7 +789,7 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow, RegistryProperties):
Open data folder Open data folder
""" """
path = AppLocation.get_data_path() path = AppLocation.get_data_path()
QtGui.QDesktopServices.openUrl(QtCore.QUrl("file:///" + path)) QtGui.QDesktopServices.openUrl(QtCore.QUrl.fromLocalFile(path))
def on_update_theme_images(self): def on_update_theme_images(self):
""" """
@ -1413,7 +1393,9 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow, RegistryProperties):
if event.timerId() == self.timer_id: if event.timerId() == self.timer_id:
self.timer_id = 0 self.timer_id = 0
self.load_progress_bar.hide() self.load_progress_bar.hide()
self.application.process_events() # Sometimes the timer goes off as OpenLP is shutting down, and the application has already been deleted
if self.application:
self.application.process_events()
def set_new_data_path(self, new_data_path): def set_new_data_path(self, new_data_path):
""" """

View File

@ -4,7 +4,7 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2016 OpenLP Developers # # Copyright (c) 2008-2017 OpenLP Developers #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free # # under the terms of the GNU General Public License as published by the Free #

View File

@ -4,7 +4,7 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2016 OpenLP Developers # # Copyright (c) 2008-2017 OpenLP Developers #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free # # under the terms of the GNU General Public License as published by the Free #

View File

@ -4,7 +4,7 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2016 OpenLP Developers # # Copyright (c) 2008-2017 OpenLP Developers #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free # # under the terms of the GNU General Public License as published by the Free #

View File

@ -4,7 +4,7 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2016 OpenLP Developers # # Copyright (c) 2008-2017 OpenLP Developers #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free # # under the terms of the GNU General Public License as published by the Free #

View File

@ -4,7 +4,7 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2016 OpenLP Developers # # Copyright (c) 2008-2017 OpenLP Developers #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free # # under the terms of the GNU General Public License as published by the Free #

View File

@ -4,7 +4,7 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2016 OpenLP Developers # # Copyright (c) 2008-2017 OpenLP Developers #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free # # under the terms of the GNU General Public License as published by the Free #

View File

@ -4,7 +4,7 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2016 OpenLP Developers # # Copyright (c) 2008-2017 OpenLP Developers #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free # # under the terms of the GNU General Public License as published by the Free #

View File

@ -4,7 +4,7 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2016 OpenLP Developers # # Copyright (c) 2008-2017 OpenLP Developers #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free # # under the terms of the GNU General Public License as published by the Free #

View File

@ -4,7 +4,7 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2016 OpenLP Developers # # Copyright (c) 2008-2017 OpenLP Developers #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free # # under the terms of the GNU General Public License as published by the Free #

View File

@ -4,7 +4,7 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2016 OpenLP Developers # # Copyright (c) 2008-2017 OpenLP Developers #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free # # under the terms of the GNU General Public License as published by the Free #
@ -38,7 +38,7 @@ class Ui_PluginViewDialog(object):
Set up the UI Set up the UI
""" """
plugin_view_dialog.setObjectName('plugin_view_dialog') plugin_view_dialog.setObjectName('plugin_view_dialog')
plugin_view_dialog.setWindowIcon(build_icon(u':/icon/openlp-logo.svg')) plugin_view_dialog.setWindowIcon(build_icon(':/icon/openlp-logo.svg'))
plugin_view_dialog.setWindowModality(QtCore.Qt.ApplicationModal) plugin_view_dialog.setWindowModality(QtCore.Qt.ApplicationModal)
self.plugin_layout = QtWidgets.QVBoxLayout(plugin_view_dialog) self.plugin_layout = QtWidgets.QVBoxLayout(plugin_view_dialog)
self.plugin_layout.setObjectName('plugin_layout') self.plugin_layout.setObjectName('plugin_layout')

View File

@ -4,7 +4,7 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2016 OpenLP Developers # # Copyright (c) 2008-2017 OpenLP Developers #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free # # under the terms of the GNU General Public License as published by the Free #

View File

@ -4,7 +4,7 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2016 OpenLP Developers # # Copyright (c) 2008-2017 OpenLP Developers #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free # # under the terms of the GNU General Public License as published by the Free #
@ -50,7 +50,7 @@ class Ui_PrintServiceDialog(object):
Set up the UI Set up the UI
""" """
print_service_dialog.setObjectName('print_service_dialog') print_service_dialog.setObjectName('print_service_dialog')
print_service_dialog.setWindowIcon(build_icon(u':/icon/openlp-logo.svg')) print_service_dialog.setWindowIcon(build_icon(':/icon/openlp-logo.svg'))
print_service_dialog.resize(664, 594) print_service_dialog.resize(664, 594)
self.main_layout = QtWidgets.QVBoxLayout(print_service_dialog) self.main_layout = QtWidgets.QVBoxLayout(print_service_dialog)
self.main_layout.setSpacing(0) self.main_layout.setSpacing(0)

View File

@ -4,7 +4,7 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2016 OpenLP Developers # # Copyright (c) 2008-2017 OpenLP Developers #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free # # under the terms of the GNU General Public License as published by the Free #

View File

@ -4,7 +4,7 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2016 OpenLP Developers # # Copyright (c) 2008-2017 OpenLP Developers #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free # # under the terms of the GNU General Public License as published by the Free #

View File

@ -4,7 +4,7 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2016 OpenLP Developers # # Copyright (c) 2008-2017 OpenLP Developers #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free # # under the terms of the GNU General Public License as published by the Free #
@ -47,7 +47,7 @@ class Ui_ProjectorEditForm(object):
Create the interface layout. Create the interface layout.
""" """
edit_projector_dialog.setObjectName('edit_projector_dialog') edit_projector_dialog.setObjectName('edit_projector_dialog')
edit_projector_dialog.setWindowIcon(build_icon(u':/icon/openlp-logo-32x32.png')) edit_projector_dialog.setWindowIcon(build_icon(':/icon/openlp-logo.svg'))
edit_projector_dialog.setMinimumWidth(400) edit_projector_dialog.setMinimumWidth(400)
edit_projector_dialog.setModal(True) edit_projector_dialog.setModal(True)
# Define the basic layout # Define the basic layout

View File

@ -4,7 +4,7 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2016 OpenLP Developers # # Copyright (c) 2008-2017 OpenLP Developers #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free # # under the terms of the GNU General Public License as published by the Free #

View File

@ -4,7 +4,7 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2016 OpenLP Developers # # Copyright (c) 2008-2017 OpenLP Developers #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free # # under the terms of the GNU General Public License as published by the Free #
@ -243,7 +243,7 @@ class SourceSelectTabs(QtWidgets.QDialog):
title = translate('OpenLP.SourceSelectForm', 'Select Projector Source') title = translate('OpenLP.SourceSelectForm', 'Select Projector Source')
self.setWindowTitle(title) self.setWindowTitle(title)
self.setObjectName('source_select_tabs') self.setObjectName('source_select_tabs')
self.setWindowIcon(build_icon(':/icon/openlp-log-32x32.png')) self.setWindowIcon(build_icon(':/icon/openlp-log.svg'))
self.setModal(True) self.setModal(True)
self.layout = QtWidgets.QVBoxLayout() self.layout = QtWidgets.QVBoxLayout()
self.layout.setObjectName('source_select_tabs_layout') self.layout.setObjectName('source_select_tabs_layout')
@ -395,7 +395,7 @@ class SourceSelectSingle(QtWidgets.QDialog):
else: else:
title = translate('OpenLP.SourceSelectForm', 'Select Projector Source') title = translate('OpenLP.SourceSelectForm', 'Select Projector Source')
self.setObjectName('source_select_single') self.setObjectName('source_select_single')
self.setWindowIcon(build_icon(':/icon/openlp-log-32x32.png')) self.setWindowIcon(build_icon(':/icon/openlp-log.svg'))
self.setModal(True) self.setModal(True)
self.edit = edit self.edit = edit

View File

@ -4,7 +4,7 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2016 OpenLP Developers # # Copyright (c) 2008-2017 OpenLP Developers #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free # # under the terms of the GNU General Public License as published by the Free #

View File

@ -4,7 +4,7 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2016 OpenLP Developers # # Copyright (c) 2008-2017 OpenLP Developers #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free # # under the terms of the GNU General Public License as published by the Free #
@ -38,7 +38,7 @@ class Ui_ServiceItemEditDialog(object):
Set up the UI Set up the UI
""" """
serviceItemEditDialog.setObjectName('serviceItemEditDialog') serviceItemEditDialog.setObjectName('serviceItemEditDialog')
serviceItemEditDialog.setWindowIcon(build_icon(u':/icon/openlp-logo.svg')) serviceItemEditDialog.setWindowIcon(build_icon(':/icon/openlp-logo.svg'))
self.dialog_layout = QtWidgets.QGridLayout(serviceItemEditDialog) self.dialog_layout = QtWidgets.QGridLayout(serviceItemEditDialog)
self.dialog_layout.setContentsMargins(8, 8, 8, 8) self.dialog_layout.setContentsMargins(8, 8, 8, 8)
self.dialog_layout.setSpacing(8) self.dialog_layout.setSpacing(8)

View File

@ -4,7 +4,7 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2016 OpenLP Developers # # Copyright (c) 2008-2017 OpenLP Developers #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free # # under the terms of the GNU General Public License as published by the Free #

View File

@ -4,7 +4,7 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2016 OpenLP Developers # # Copyright (c) 2008-2017 OpenLP Developers #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free # # under the terms of the GNU General Public License as published by the Free #

View File

@ -4,7 +4,7 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2016 OpenLP Developers # # Copyright (c) 2008-2017 OpenLP Developers #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free # # under the terms of the GNU General Public License as published by the Free #

View File

@ -4,7 +4,7 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2016 OpenLP Developers # # Copyright (c) 2008-2017 OpenLP Developers #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free # # under the terms of the GNU General Public License as published by the Free #
@ -38,8 +38,8 @@ class Ui_SettingsDialog(object):
Set up the UI Set up the UI
""" """
settings_dialog.setObjectName('settings_dialog') settings_dialog.setObjectName('settings_dialog')
settings_dialog.setWindowIcon(build_icon(u':/icon/openlp-logo.svg')) settings_dialog.setWindowIcon(build_icon(':/icon/openlp-logo.svg'))
settings_dialog.resize(800, 700) settings_dialog.resize(920, 625)
self.dialog_layout = QtWidgets.QGridLayout(settings_dialog) self.dialog_layout = QtWidgets.QGridLayout(settings_dialog)
self.dialog_layout.setObjectName('dialog_layout') self.dialog_layout.setObjectName('dialog_layout')
self.dialog_layout.setContentsMargins(8, 8, 8, 8) self.dialog_layout.setContentsMargins(8, 8, 8, 8)

View File

@ -4,7 +4,7 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2016 OpenLP Developers # # Copyright (c) 2008-2017 OpenLP Developers #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free # # under the terms of the GNU General Public License as published by the Free #

View File

@ -4,7 +4,7 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2016 OpenLP Developers # # Copyright (c) 2008-2017 OpenLP Developers #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free # # under the terms of the GNU General Public License as published by the Free #
@ -72,7 +72,7 @@ class Ui_ShortcutListDialog(object):
Set up the UI Set up the UI
""" """
shortcutListDialog.setObjectName('shortcutListDialog') shortcutListDialog.setObjectName('shortcutListDialog')
shortcutListDialog.setWindowIcon(build_icon(u':/icon/openlp-logo.svg')) shortcutListDialog.setWindowIcon(build_icon(':/icon/openlp-logo.svg'))
shortcutListDialog.resize(500, 438) shortcutListDialog.resize(500, 438)
self.shortcut_list_layout = QtWidgets.QVBoxLayout(shortcutListDialog) self.shortcut_list_layout = QtWidgets.QVBoxLayout(shortcutListDialog)
self.shortcut_list_layout.setObjectName('shortcut_list_layout') self.shortcut_list_layout.setObjectName('shortcut_list_layout')

View File

@ -4,7 +4,7 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2016 OpenLP Developers # # Copyright (c) 2008-2017 OpenLP Developers #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free # # under the terms of the GNU General Public License as published by the Free #
@ -426,11 +426,11 @@ class ShortcutListForm(QtWidgets.QDialog, Ui_ShortcutListDialog, RegistryPropert
is_valid = False is_valid = False
if not is_valid: if not is_valid:
text = translate('OpenLP.ShortcutListDialog', text = translate('OpenLP.ShortcutListDialog',
'The shortcut "{key}" is already assigned to another action, please' 'The shortcut "{key}" is already assigned to another action,\n'
' use a different shortcut.' 'please use a different shortcut.'
).format(key=self.get_shortcut_string(key_sequence)) ).format(key=self.get_shortcut_string(key_sequence))
self.main_window.warning_message(translate('OpenLP.ShortcutListDialog', 'Duplicate Shortcut'), self.main_window.warning_message(translate('OpenLP.ShortcutListDialog', 'Duplicate Shortcut'),
text, for_display=True) text)
self.dialog_was_shown = True self.dialog_was_shown = True
return is_valid return is_valid

View File

@ -4,7 +4,7 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2016 OpenLP Developers # # Copyright (c) 2008-2017 OpenLP Developers #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free # # under the terms of the GNU General Public License as published by the Free #
@ -234,25 +234,32 @@ class SlideController(DisplayController, RegistryProperties):
self.hide_menu.setPopupMode(QtWidgets.QToolButton.MenuButtonPopup) self.hide_menu.setPopupMode(QtWidgets.QToolButton.MenuButtonPopup)
self.hide_menu.setMenu(QtWidgets.QMenu(translate('OpenLP.SlideController', 'Hide'), self.toolbar)) self.hide_menu.setMenu(QtWidgets.QMenu(translate('OpenLP.SlideController', 'Hide'), self.toolbar))
self.toolbar.add_toolbar_widget(self.hide_menu) self.toolbar.add_toolbar_widget(self.hide_menu)
self.blank_screen = create_action(self, 'blankScreen', # The order of the blank to modes in Shortcuts list comes from here.
text=translate('OpenLP.SlideController', 'Blank Screen'), self.desktop_screen_enable = create_action(self, 'desktopScreenEnable',
icon=':/slides/slide_blank.png', text=translate('OpenLP.SlideController', 'Show Desktop'),
checked=False, can_shortcuts=True, category=self.category, icon=':/slides/slide_desktop.png', can_shortcuts=True,
triggers=self.on_blank_display) context=QtCore.Qt.WidgetWithChildrenShortcut,
self.theme_screen = create_action(self, 'themeScreen', category=self.category, triggers=self.on_hide_display_enable)
text=translate('OpenLP.SlideController', 'Blank to Theme'),
icon=':/slides/slide_theme.png',
checked=False, can_shortcuts=True, category=self.category,
triggers=self.on_theme_display)
self.desktop_screen = create_action(self, 'desktopScreen', self.desktop_screen = create_action(self, 'desktopScreen',
text=translate('OpenLP.SlideController', 'Show Desktop'), text=translate('OpenLP.SlideController', 'Toggle Desktop'),
icon=':/slides/slide_desktop.png', icon=':/slides/slide_desktop.png',
checked=False, can_shortcuts=True, category=self.category, checked=False, can_shortcuts=True, category=self.category,
triggers=self.on_hide_display) triggers=self.on_hide_display)
self.theme_screen = create_action(self, 'themeScreen',
text=translate('OpenLP.SlideController', 'Toggle Blank to Theme'),
icon=':/slides/slide_theme.png',
checked=False, can_shortcuts=True, category=self.category,
triggers=self.on_theme_display)
self.blank_screen = create_action(self, 'blankScreen',
text=translate('OpenLP.SlideController', 'Toggle Blank Screen'),
icon=':/slides/slide_blank.png',
checked=False, can_shortcuts=True, category=self.category,
triggers=self.on_blank_display)
self.hide_menu.setDefaultAction(self.blank_screen) self.hide_menu.setDefaultAction(self.blank_screen)
self.hide_menu.menu().addAction(self.blank_screen) self.hide_menu.menu().addAction(self.blank_screen)
self.hide_menu.menu().addAction(self.theme_screen) self.hide_menu.menu().addAction(self.theme_screen)
self.hide_menu.menu().addAction(self.desktop_screen) self.hide_menu.menu().addAction(self.desktop_screen)
self.hide_menu.menu().addAction(self.desktop_screen_enable)
# Wide menu of display control buttons. # Wide menu of display control buttons.
self.blank_screen_button = QtWidgets.QToolButton(self.toolbar) self.blank_screen_button = QtWidgets.QToolButton(self.toolbar)
self.blank_screen_button.setObjectName('blank_screen_button') self.blank_screen_button.setObjectName('blank_screen_button')
@ -512,23 +519,6 @@ class SlideController(DisplayController, RegistryProperties):
can_shortcuts=True, context=QtCore.Qt.WidgetWithChildrenShortcut, can_shortcuts=True, context=QtCore.Qt.WidgetWithChildrenShortcut,
category=self.category, category=self.category,
triggers=self.service_next) triggers=self.service_next)
self.escape_item = create_action(parent, 'escapeItem',
text=translate('OpenLP.SlideController', 'Escape Item'),
can_shortcuts=True, context=QtCore.Qt.WidgetWithChildrenShortcut,
category=self.category,
triggers=self.live_escape)
def live_escape(self, field=None):
"""
If you press ESC on the live screen it should close the display temporarily.
"""
self.display.setVisible(False)
self.media_controller.media_stop(self)
# Stop looping if active
if self.play_slides_loop.isChecked():
self.on_play_slides_loop(False)
elif self.play_slides_once.isChecked():
self.on_play_slides_once(False)
def toggle_display(self, action): def toggle_display(self, action):
""" """
@ -622,7 +612,7 @@ class SlideController(DisplayController, RegistryProperties):
widget.addActions([ widget.addActions([
self.previous_item, self.next_item, self.previous_item, self.next_item,
self.previous_service, self.next_service, self.previous_service, self.next_service,
self.escape_item, self.desktop_screen_enable,
self.desktop_screen, self.desktop_screen,
self.theme_screen, self.theme_screen,
self.blank_screen]) self.blank_screen])
@ -732,8 +722,10 @@ class SlideController(DisplayController, RegistryProperties):
# Reset the button # Reset the button
self.play_slides_once.setChecked(False) self.play_slides_once.setChecked(False)
self.play_slides_once.setIcon(build_icon(':/media/media_time.png')) self.play_slides_once.setIcon(build_icon(':/media/media_time.png'))
self.play_slides_once.setText(UiStrings().PlaySlidesToEnd)
self.play_slides_loop.setChecked(False) self.play_slides_loop.setChecked(False)
self.play_slides_loop.setIcon(build_icon(':/media/media_time.png')) self.play_slides_loop.setIcon(build_icon(':/media/media_time.png'))
self.play_slides_loop.setText(UiStrings().PlaySlidesInLoop)
if item.is_text(): if item.is_text():
if (Settings().value(self.main_window.songs_settings_section + '/display songbar') and if (Settings().value(self.main_window.songs_settings_section + '/display songbar') and
not self.song_menu.menu().isEmpty()): not self.song_menu.menu().isEmpty()):
@ -929,7 +921,8 @@ class SlideController(DisplayController, RegistryProperties):
Registry().execute('{name}_stop'.format(name=old_item.name.lower()), [old_item, self.is_live]) Registry().execute('{name}_stop'.format(name=old_item.name.lower()), [old_item, self.is_live])
if old_item.is_media() and not self.service_item.is_media(): if old_item.is_media() and not self.service_item.is_media():
self.on_media_close() self.on_media_close()
Registry().execute('slidecontroller_{item}_started'.format(item=self.type_prefix), [self.service_item]) if self.is_live:
Registry().execute('slidecontroller_{item}_started'.format(item=self.type_prefix), [self.service_item])
def on_slide_selected_index(self, message): def on_slide_selected_index(self, message):
""" """
@ -965,7 +958,7 @@ class SlideController(DisplayController, RegistryProperties):
else: else:
Registry().execute('live_display_show') Registry().execute('live_display_show')
else: else:
self.live_escape() self.on_hide_display_enable()
def on_slide_blank(self): def on_slide_blank(self):
""" """
@ -1025,6 +1018,7 @@ class SlideController(DisplayController, RegistryProperties):
def on_hide_display(self, checked=None): def on_hide_display(self, checked=None):
""" """
Handle the Hide screen button Handle the Hide screen button
This toggles the desktop screen.
:param checked: the new state of the of the widget :param checked: the new state of the of the widget
""" """
@ -1043,6 +1037,20 @@ class SlideController(DisplayController, RegistryProperties):
self.update_preview() self.update_preview()
self.on_toggle_loop() self.on_toggle_loop()
def on_hide_display_enable(self, checked=None):
"""
Handle the on_hide_display_enable
This only enables the desktop screen.
:param checked: the new state of the of the widget
"""
self.blank_screen.setChecked(False)
self.theme_screen.setChecked(False)
Registry().execute('live_display_hide', HideMode.Screen)
self.desktop_screen.setChecked(True)
self.update_preview()
self.on_toggle_loop()
def blank_plugin(self): def blank_plugin(self):
""" """
Blank/Hide the display screen within a plugin if required. Blank/Hide the display screen within a plugin if required.

View File

@ -4,7 +4,7 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2016 OpenLP Developers # # Copyright (c) 2008-2017 OpenLP Developers #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free # # under the terms of the GNU General Public License as published by the Free #

View File

@ -4,7 +4,7 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2016 OpenLP Developers # # Copyright (c) 2008-2017 OpenLP Developers #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free # # under the terms of the GNU General Public License as published by the Free #
@ -38,7 +38,7 @@ class Ui_StartTimeDialog(object):
Set up the UI Set up the UI
""" """
StartTimeDialog.setObjectName('StartTimeDialog') StartTimeDialog.setObjectName('StartTimeDialog')
StartTimeDialog.setWindowIcon(build_icon(u':/icon/openlp-logo.svg')) StartTimeDialog.setWindowIcon(build_icon(':/icon/openlp-logo.svg'))
StartTimeDialog.resize(350, 10) StartTimeDialog.resize(350, 10)
self.dialog_layout = QtWidgets.QGridLayout(StartTimeDialog) self.dialog_layout = QtWidgets.QGridLayout(StartTimeDialog)
self.dialog_layout.setObjectName('dialog_layout') self.dialog_layout.setObjectName('dialog_layout')

View File

@ -4,7 +4,7 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2016 OpenLP Developers # # Copyright (c) 2008-2017 OpenLP Developers #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free # # under the terms of the GNU General Public License as published by the Free #

View File

@ -4,7 +4,7 @@
############################################################################### ###############################################################################
# OpenLP - Open Source Lyrics Projection # # OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# Copyright (c) 2008-2016 OpenLP Developers # # Copyright (c) 2008-2017 OpenLP Developers #
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it # # This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free # # under the terms of the GNU General Public License as published by the Free #

Some files were not shown because too many files have changed in this diff Show More