mirror of https://gitlab.com/openlp/openlp.git
Merge HEAD
This commit is contained in:
commit
0ca05faa5e
|
@ -97,7 +97,7 @@ class OpenLP(QtGui.QApplication):
|
||||||
self.shared_memory.detach()
|
self.shared_memory.detach()
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def run(self, args, testing=False):
|
def run(self, args):
|
||||||
"""
|
"""
|
||||||
Run the OpenLP application.
|
Run the OpenLP application.
|
||||||
"""
|
"""
|
||||||
|
@ -110,10 +110,6 @@ class OpenLP(QtGui.QApplication):
|
||||||
if 'OpenLP' in args:
|
if 'OpenLP' in args:
|
||||||
args.remove('OpenLP')
|
args.remove('OpenLP')
|
||||||
self.args.extend(args)
|
self.args.extend(args)
|
||||||
# provide a listener for widgets to reqest a screen update.
|
|
||||||
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'openlp_process_events'), self.processEvents)
|
|
||||||
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'cursor_busy'), self.set_busy_cursor)
|
|
||||||
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'cursor_normal'), self.set_normal_cursor)
|
|
||||||
# Decide how many screens we have and their size
|
# Decide how many screens we have and their size
|
||||||
screens = ScreenList.create(self.desktop())
|
screens = ScreenList.create(self.desktop())
|
||||||
# First time checks in settings
|
# First time checks in settings
|
||||||
|
@ -139,7 +135,7 @@ class OpenLP(QtGui.QApplication):
|
||||||
# make sure Qt really display the splash screen
|
# make sure Qt really display the splash screen
|
||||||
self.processEvents()
|
self.processEvents()
|
||||||
# start the main app window
|
# start the main app window
|
||||||
self.main_window = MainWindow(self)
|
self.main_window = MainWindow()
|
||||||
self.main_window.show()
|
self.main_window.show()
|
||||||
if show_splash:
|
if show_splash:
|
||||||
# now kill the splashscreen
|
# now kill the splashscreen
|
||||||
|
@ -156,9 +152,13 @@ class OpenLP(QtGui.QApplication):
|
||||||
VersionThread(self.main_window).start()
|
VersionThread(self.main_window).start()
|
||||||
Receiver.send_message(u'live_display_blank_check')
|
Receiver.send_message(u'live_display_blank_check')
|
||||||
self.main_window.app_startup()
|
self.main_window.app_startup()
|
||||||
# Skip exec_() for gui tests
|
return self.exec_()
|
||||||
if not testing:
|
|
||||||
return self.exec_()
|
def close_splash_screen(self):
|
||||||
|
"""
|
||||||
|
Close the splash screen when requested.
|
||||||
|
"""
|
||||||
|
self.splash.close()
|
||||||
|
|
||||||
def is_already_running(self):
|
def is_already_running(self):
|
||||||
"""
|
"""
|
||||||
|
@ -199,6 +199,12 @@ class OpenLP(QtGui.QApplication):
|
||||||
self.set_normal_cursor()
|
self.set_normal_cursor()
|
||||||
self.exception_form.exec_()
|
self.exception_form.exec_()
|
||||||
|
|
||||||
|
def process_events(self):
|
||||||
|
"""
|
||||||
|
Wrapper to make ProcessEvents visible and named correctly
|
||||||
|
"""
|
||||||
|
self.processEvents()
|
||||||
|
|
||||||
def set_busy_cursor(self):
|
def set_busy_cursor(self):
|
||||||
"""
|
"""
|
||||||
Sets the Busy Cursor for the Application
|
Sets the Busy Cursor for the Application
|
||||||
|
@ -211,6 +217,7 @@ class OpenLP(QtGui.QApplication):
|
||||||
Sets the Normal Cursor for the Application
|
Sets the Normal Cursor for the Application
|
||||||
"""
|
"""
|
||||||
self.restoreOverrideCursor()
|
self.restoreOverrideCursor()
|
||||||
|
self.processEvents()
|
||||||
|
|
||||||
def event(self, event):
|
def event(self, event):
|
||||||
"""
|
"""
|
||||||
|
@ -235,7 +242,7 @@ def set_up_logging(log_path):
|
||||||
logfile.setFormatter(logging.Formatter(u'%(asctime)s %(name)-55s %(levelname)-8s %(message)s'))
|
logfile.setFormatter(logging.Formatter(u'%(asctime)s %(name)-55s %(levelname)-8s %(message)s'))
|
||||||
log.addHandler(logfile)
|
log.addHandler(logfile)
|
||||||
if log.isEnabledFor(logging.DEBUG):
|
if log.isEnabledFor(logging.DEBUG):
|
||||||
print 'Logging to:', filename
|
print('Logging to: %s' % filename)
|
||||||
|
|
||||||
|
|
||||||
def main(args=None):
|
def main(args=None):
|
||||||
|
@ -255,7 +262,6 @@ def main(args=None):
|
||||||
parser.add_option('-d', '--dev-version', dest='dev_version', action='store_true',
|
parser.add_option('-d', '--dev-version', dest='dev_version', action='store_true',
|
||||||
help='Ignore the version file and pull the version directly from Bazaar')
|
help='Ignore the version file and pull the version directly from Bazaar')
|
||||||
parser.add_option('-s', '--style', dest='style', help='Set the Qt4 style (passed directly to Qt4).')
|
parser.add_option('-s', '--style', dest='style', help='Set the Qt4 style (passed directly to Qt4).')
|
||||||
parser.add_option('--testing', dest='testing', action='store_true', help='Run by testing framework')
|
|
||||||
# Parse command line options and deal with them.
|
# Parse command line options and deal with them.
|
||||||
# Use args supplied programatically if possible.
|
# Use args supplied programatically if possible.
|
||||||
(options, args) = parser.parse_args(args) if args else parser.parse_args()
|
(options, args) = parser.parse_args(args) if args else parser.parse_args()
|
||||||
|
@ -276,38 +282,37 @@ def main(args=None):
|
||||||
# Initialise the resources
|
# Initialise the resources
|
||||||
qInitResources()
|
qInitResources()
|
||||||
# Now create and actually run the application.
|
# Now create and actually run the application.
|
||||||
app = OpenLP(qt_args)
|
application = OpenLP(qt_args)
|
||||||
app.setOrganizationName(u'OpenLP')
|
application.setOrganizationName(u'OpenLP')
|
||||||
app.setOrganizationDomain(u'openlp.org')
|
application.setOrganizationDomain(u'openlp.org')
|
||||||
if options.portable:
|
if options.portable:
|
||||||
app.setApplicationName(u'OpenLPPortable')
|
application.setApplicationName(u'OpenLPPortable')
|
||||||
Settings.setDefaultFormat(Settings.IniFormat)
|
Settings.setDefaultFormat(Settings.IniFormat)
|
||||||
# Get location OpenLPPortable.ini
|
# Get location OpenLPPortable.ini
|
||||||
app_path = AppLocation.get_directory(AppLocation.AppDir)
|
application_path = AppLocation.get_directory(AppLocation.AppDir)
|
||||||
set_up_logging(os.path.abspath(os.path.join(app_path, u'..', u'..', u'Other')))
|
set_up_logging(os.path.abspath(os.path.join(application_path, u'..', u'..', u'Other')))
|
||||||
log.info(u'Running portable')
|
log.info(u'Running portable')
|
||||||
portable_settings_file = os.path.abspath(os.path.join(app_path, u'..', u'..', u'Data', u'OpenLP.ini'))
|
portable_settings_file = os.path.abspath(os.path.join(application_path, u'..', u'..', u'Data', u'OpenLP.ini'))
|
||||||
# Make this our settings file
|
# Make this our settings file
|
||||||
log.info(u'INI file: %s', portable_settings_file)
|
log.info(u'INI file: %s', portable_settings_file)
|
||||||
Settings.set_filename(portable_settings_file)
|
Settings.set_filename(portable_settings_file)
|
||||||
portable_settings = Settings()
|
portable_settings = Settings()
|
||||||
# Set our data path
|
# Set our data path
|
||||||
data_path = os.path.abspath(os.path.join(app_path, u'..', u'..', u'Data',))
|
data_path = os.path.abspath(os.path.join(application_path, u'..', u'..', u'Data',))
|
||||||
log.info(u'Data path: %s', data_path)
|
log.info(u'Data path: %s', data_path)
|
||||||
# Point to our data path
|
# Point to our data path
|
||||||
portable_settings.setValue(u'advanced/data path', data_path)
|
portable_settings.setValue(u'advanced/data path', data_path)
|
||||||
portable_settings.setValue(u'advanced/is portable', True)
|
portable_settings.setValue(u'advanced/is portable', True)
|
||||||
portable_settings.sync()
|
portable_settings.sync()
|
||||||
else:
|
else:
|
||||||
app.setApplicationName(u'OpenLP')
|
application.setApplicationName(u'OpenLP')
|
||||||
set_up_logging(AppLocation.get_directory(AppLocation.CacheDir))
|
set_up_logging(AppLocation.get_directory(AppLocation.CacheDir))
|
||||||
Registry.create()
|
Registry.create()
|
||||||
app.setApplicationVersion(get_application_version()[u'version'])
|
Registry().register(u'application', application)
|
||||||
|
application.setApplicationVersion(get_application_version()[u'version'])
|
||||||
# Instance check
|
# Instance check
|
||||||
if not options.testing:
|
if application.is_already_running():
|
||||||
# Instance check
|
sys.exit()
|
||||||
if app.is_already_running():
|
|
||||||
sys.exit()
|
|
||||||
# First time checks in settings
|
# First time checks in settings
|
||||||
if not Settings().value(u'general/has run wizard'):
|
if not Settings().value(u'general/has run wizard'):
|
||||||
if not FirstTimeLanguageForm().exec_():
|
if not FirstTimeLanguageForm().exec_():
|
||||||
|
@ -315,19 +320,14 @@ def main(args=None):
|
||||||
sys.exit()
|
sys.exit()
|
||||||
# i18n Set Language
|
# i18n Set Language
|
||||||
language = LanguageManager.get_language()
|
language = LanguageManager.get_language()
|
||||||
app_translator, default_translator = LanguageManager.get_translator(language)
|
application_translator, default_translator = LanguageManager.get_translator(language)
|
||||||
if not app_translator.isEmpty():
|
if not application_translator.isEmpty():
|
||||||
app.installTranslator(app_translator)
|
application.installTranslator(application_translator)
|
||||||
if not default_translator.isEmpty():
|
if not default_translator.isEmpty():
|
||||||
app.installTranslator(default_translator)
|
application.installTranslator(default_translator)
|
||||||
else:
|
else:
|
||||||
log.debug(u'Could not find default_translator.')
|
log.debug(u'Could not find default_translator.')
|
||||||
if not options.no_error_form:
|
if not options.no_error_form:
|
||||||
sys.excepthook = app.hook_exception
|
sys.excepthook = application.hook_exception
|
||||||
# Do not run method app.exec_() when running gui tests
|
sys.exit(application.run(qt_args))
|
||||||
if options.testing:
|
|
||||||
app.run(qt_args, testing=True)
|
|
||||||
# For gui tests we need access to window instances and their components
|
|
||||||
return app
|
|
||||||
else:
|
|
||||||
sys.exit(app.run(qt_args))
|
|
||||||
|
|
|
@ -61,8 +61,7 @@ def init_db(url, auto_flush=True, auto_commit=False):
|
||||||
"""
|
"""
|
||||||
engine = create_engine(url, poolclass=NullPool)
|
engine = create_engine(url, poolclass=NullPool)
|
||||||
metadata = MetaData(bind=engine)
|
metadata = MetaData(bind=engine)
|
||||||
session = scoped_session(sessionmaker(autoflush=auto_flush,
|
session = scoped_session(sessionmaker(autoflush=auto_flush, autocommit=auto_commit, bind=engine))
|
||||||
autocommit=auto_commit, bind=engine))
|
|
||||||
return session, metadata
|
return session, metadata
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,7 @@ import logging
|
||||||
|
|
||||||
from PyQt4 import QtGui
|
from PyQt4 import QtGui
|
||||||
|
|
||||||
from openlp.core.lib import build_icon, ScreenList
|
from openlp.core.lib import ScreenList, build_icon
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
|
@ -47,24 +47,12 @@ class EventReceiver(QtCore.QObject):
|
||||||
``mainwindow_status_text``
|
``mainwindow_status_text``
|
||||||
Changes the bottom status bar text on the mainwindow.
|
Changes the bottom status bar text on the mainwindow.
|
||||||
|
|
||||||
``openlp_warning_message``
|
|
||||||
Displays a standalone Warning Message.
|
|
||||||
|
|
||||||
``openlp_error_message``
|
``openlp_error_message``
|
||||||
Displays a standalone Error Message.
|
Displays a standalone Error Message.
|
||||||
|
|
||||||
``openlp_information_message``
|
``openlp_information_message``
|
||||||
Displays a standalone Information Message.
|
Displays a standalone Information Message.
|
||||||
|
|
||||||
``cursor_busy``
|
|
||||||
Makes the cursor got to a busy form.
|
|
||||||
|
|
||||||
``cursor_normal``
|
|
||||||
Resets the cursor to default.
|
|
||||||
|
|
||||||
``openlp_process_events``
|
|
||||||
Requests the Application to flush the events queue.
|
|
||||||
|
|
||||||
``openlp_version_check``
|
``openlp_version_check``
|
||||||
Version has changed so pop up window.
|
Version has changed so pop up window.
|
||||||
|
|
||||||
|
@ -121,29 +109,6 @@ class EventReceiver(QtCore.QObject):
|
||||||
``slidecontroller_live_stop_loop``
|
``slidecontroller_live_stop_loop``
|
||||||
Stop the loop on the main display.
|
Stop the loop on the main display.
|
||||||
|
|
||||||
|
|
||||||
**Servicemanager related signals**
|
|
||||||
|
|
||||||
``servicemanager_new_service``
|
|
||||||
A new service is being loaded or created.
|
|
||||||
|
|
||||||
``servicemanager_previous_item``
|
|
||||||
Display the previous item in the service.
|
|
||||||
|
|
||||||
``servicemanager_preview_live``
|
|
||||||
Requests a Preview item from the Service Manager to update live and add
|
|
||||||
a new item to the preview panel.
|
|
||||||
|
|
||||||
``servicemanager_next_item``
|
|
||||||
Display the next item in the service.
|
|
||||||
|
|
||||||
``servicemanager_set_item``
|
|
||||||
Go live on a specific item, by index.
|
|
||||||
|
|
||||||
``service_item_update``
|
|
||||||
Passes back to the service manager the service item after it has been
|
|
||||||
processed by the plugin.
|
|
||||||
|
|
||||||
**Display signals**
|
**Display signals**
|
||||||
|
|
||||||
``update_display_css``
|
``update_display_css``
|
||||||
|
|
|
@ -31,7 +31,7 @@ Provide HTML Tag management and Formatting Tag access class
|
||||||
"""
|
"""
|
||||||
import cPickle
|
import cPickle
|
||||||
|
|
||||||
from openlp.core.lib import translate, Settings
|
from openlp.core.lib import Settings, translate
|
||||||
|
|
||||||
|
|
||||||
class FormattingTags(object):
|
class FormattingTags(object):
|
||||||
|
|
|
@ -39,7 +39,7 @@ import Queue
|
||||||
|
|
||||||
from PyQt4 import QtCore
|
from PyQt4 import QtCore
|
||||||
|
|
||||||
from openlp.core.lib import resize_image, image_to_byte, Receiver, Registry, ScreenList
|
from openlp.core.lib import Receiver, Registry, ScreenList, resize_image, image_to_byte
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
|
@ -332,9 +332,9 @@ class MediaManagerItem(QtGui.QWidget):
|
||||||
Settings().value(self.settingsSection + u'/last directory'), self.onNewFileMasks)
|
Settings().value(self.settingsSection + u'/last directory'), self.onNewFileMasks)
|
||||||
log.info(u'New files(s) %s', files)
|
log.info(u'New files(s) %s', files)
|
||||||
if files:
|
if files:
|
||||||
Receiver.send_message(u'cursor_busy')
|
self.application.set_busy_cursor()
|
||||||
self.validateAndLoad(files)
|
self.validateAndLoad(files)
|
||||||
Receiver.send_message(u'cursor_normal')
|
self.application.set_normal_cursor()
|
||||||
|
|
||||||
def loadFile(self, data):
|
def loadFile(self, data):
|
||||||
"""
|
"""
|
||||||
|
@ -725,3 +725,13 @@ class MediaManagerItem(QtGui.QWidget):
|
||||||
return self._theme_manager
|
return self._theme_manager
|
||||||
|
|
||||||
theme_manager = property(_get_theme_manager)
|
theme_manager = property(_get_theme_manager)
|
||||||
|
|
||||||
|
def _get_application(self):
|
||||||
|
"""
|
||||||
|
Adds the openlp to the class dynamically
|
||||||
|
"""
|
||||||
|
if not hasattr(self, u'_application'):
|
||||||
|
self._application = Registry().get(u'application')
|
||||||
|
return self._application
|
||||||
|
|
||||||
|
application = property(_get_application)
|
||||||
|
|
|
@ -409,6 +409,12 @@ class Plugin(QtCore.QObject):
|
||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def new_service_created(self):
|
||||||
|
"""
|
||||||
|
The plugin's needs to handle a new song creation
|
||||||
|
"""
|
||||||
|
pass
|
||||||
|
|
||||||
def _get_main_window(self):
|
def _get_main_window(self):
|
||||||
"""
|
"""
|
||||||
Adds the main window to the class dynamically
|
Adds the main window to the class dynamically
|
||||||
|
@ -418,3 +424,13 @@ class Plugin(QtCore.QObject):
|
||||||
return self._main_window
|
return self._main_window
|
||||||
|
|
||||||
main_window = property(_get_main_window)
|
main_window = property(_get_main_window)
|
||||||
|
|
||||||
|
def _get_application(self):
|
||||||
|
"""
|
||||||
|
Adds the openlp to the class dynamically
|
||||||
|
"""
|
||||||
|
if not hasattr(self, u'_application'):
|
||||||
|
self._application = Registry().get(u'application')
|
||||||
|
return self._application
|
||||||
|
|
||||||
|
application = property(_get_application)
|
||||||
|
|
|
@ -212,3 +212,13 @@ class PluginManager(object):
|
||||||
if plugin.name == name:
|
if plugin.name == name:
|
||||||
return plugin
|
return plugin
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
def new_service_created(self):
|
||||||
|
"""
|
||||||
|
Loop through all the plugins and give them an opportunity to handle a new service
|
||||||
|
"""
|
||||||
|
log.info(u'plugins - new service created')
|
||||||
|
for plugin in self.plugins:
|
||||||
|
if plugin.isActive():
|
||||||
|
plugin.new_service_created()
|
||||||
|
|
||||||
|
|
|
@ -31,8 +31,8 @@ import logging
|
||||||
|
|
||||||
from PyQt4 import QtGui, QtCore, QtWebKit
|
from PyQt4 import QtGui, QtCore, QtWebKit
|
||||||
|
|
||||||
from openlp.core.lib import ServiceItem, expand_tags, build_lyrics_format_css, build_lyrics_outline_css, Receiver, \
|
from openlp.core.lib import FormattingTags, ImageSource, ItemCapabilities, Receiver, Registry, ScreenList, \
|
||||||
ItemCapabilities, FormattingTags, ImageSource, Registry, ScreenList
|
ServiceItem, expand_tags, build_lyrics_format_css, build_lyrics_outline_css
|
||||||
from openlp.core.lib.theme import ThemeLevel
|
from openlp.core.lib.theme import ThemeLevel
|
||||||
from openlp.core.ui import MainDisplay
|
from openlp.core.ui import MainDisplay
|
||||||
|
|
||||||
|
|
|
@ -139,8 +139,7 @@ class ScreenList(object):
|
||||||
"""
|
"""
|
||||||
screen_list = []
|
screen_list = []
|
||||||
for screen in self.screen_list:
|
for screen in self.screen_list:
|
||||||
screen_name = u'%s %d' % (translate('OpenLP.ScreenList', 'Screen'),
|
screen_name = u'%s %d' % (translate('OpenLP.ScreenList', 'Screen'), screen[u'number'] + 1)
|
||||||
screen[u'number'] + 1)
|
|
||||||
if screen[u'primary']:
|
if screen[u'primary']:
|
||||||
screen_name = u'%s (%s)' % (screen_name, translate('OpenLP.ScreenList', 'primary'))
|
screen_name = u'%s (%s)' % (screen_name, translate('OpenLP.ScreenList', 'primary'))
|
||||||
screen_list.append(screen_name)
|
screen_list.append(screen_name)
|
||||||
|
@ -237,8 +236,7 @@ class ScreenList(object):
|
||||||
y = window.y() + (window.height() / 2)
|
y = window.y() + (window.height() / 2)
|
||||||
for screen in self.screen_list:
|
for screen in self.screen_list:
|
||||||
size = screen[u'size']
|
size = screen[u'size']
|
||||||
if x >= size.x() and x <= (size.x() + size.width()) and \
|
if x >= size.x() and x <= (size.x() + size.width()) and y >= size.y() and y <= (size.y() + size.height()):
|
||||||
y >= size.y() and y <= (size.y() + size.height()):
|
|
||||||
return screen[u'number']
|
return screen[u'number']
|
||||||
|
|
||||||
def load_screen_settings(self):
|
def load_screen_settings(self):
|
||||||
|
|
|
@ -39,7 +39,7 @@ import uuid
|
||||||
|
|
||||||
from PyQt4 import QtGui
|
from PyQt4 import QtGui
|
||||||
|
|
||||||
from openlp.core.lib import build_icon, clean_tags, expand_tags, translate, ImageSource, Settings, Registry
|
from openlp.core.lib import ImageSource, Settings, Registry, build_icon, clean_tags, expand_tags, translate
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
|
@ -74,7 +74,8 @@ class Settings(QtCore.QSettings):
|
||||||
|
|
||||||
The first entry is the *old key*; it will be removed.
|
The first entry is the *old key*; it will be removed.
|
||||||
|
|
||||||
The second entry is the *new key*; we will add it to the config.
|
The second entry is the *new key*; we will add it to the config. If this is just an empty string, we just remove
|
||||||
|
the old key.
|
||||||
|
|
||||||
The last entry is a list containing two-pair tuples. If the list is empty, no conversion is made. Otherwise each
|
The last entry is a list containing two-pair tuples. If the list is empty, no conversion is made. Otherwise each
|
||||||
pair describes how to convert the old setting's value::
|
pair describes how to convert the old setting's value::
|
||||||
|
@ -86,66 +87,68 @@ class Settings(QtCore.QSettings):
|
||||||
So, if the type of the old value is bool, then there must be two rules.
|
So, if the type of the old value is bool, then there must be two rules.
|
||||||
"""
|
"""
|
||||||
__default_settings__ = {
|
__default_settings__ = {
|
||||||
u'advanced/x11 bypass wm': X11_BYPASS_DEFAULT,
|
u'advanced/add page break': False,
|
||||||
u'advanced/alternate rows': not sys.platform.startswith(u'win'),
|
u'advanced/alternate rows': not sys.platform.startswith(u'win'),
|
||||||
u'advanced/default service enabled': True,
|
|
||||||
u'advanced/enable exit confirmation': True,
|
|
||||||
u'advanced/save current plugin': False,
|
|
||||||
u'advanced/single click preview': False,
|
|
||||||
# 7 stands for now, 0 to 6 is Monday to Sunday.
|
|
||||||
u'advanced/default service day': 7,
|
|
||||||
u'advanced/max recent files': 20,
|
|
||||||
u'advanced/is portable': False,
|
|
||||||
u'advanced/hide mouse': True,
|
|
||||||
u'advanced/current media plugin': -1,
|
u'advanced/current media plugin': -1,
|
||||||
u'advanced/double click live': False,
|
|
||||||
u'advanced/data path': u'',
|
u'advanced/data path': u'',
|
||||||
u'advanced/default service hour': 11,
|
|
||||||
u'advanced/default color': u'#ffffff',
|
u'advanced/default color': u'#ffffff',
|
||||||
u'advanced/default image': u':/graphics/openlp-splash-screen.png',
|
u'advanced/default image': u':/graphics/openlp-splash-screen.png',
|
||||||
u'advanced/expand service item': False,
|
# 7 stands for now, 0 to 6 is Monday to Sunday.
|
||||||
u'advanced/recent file count': 4,
|
u'advanced/default service day': 7,
|
||||||
u'advanced/default service name': UiStrings().DefaultServiceName,
|
u'advanced/default service enabled': True,
|
||||||
|
u'advanced/default service hour': 11,
|
||||||
u'advanced/default service minute': 0,
|
u'advanced/default service minute': 0,
|
||||||
u'advanced/slide limits': SlideLimits.End,
|
u'advanced/default service name': UiStrings().DefaultServiceName,
|
||||||
u'advanced/print slide text': False,
|
u'advanced/display size': 0,
|
||||||
u'advanced/add page break': False,
|
u'advanced/double click live': False,
|
||||||
|
u'advanced/enable exit confirmation': True,
|
||||||
|
u'advanced/expand service item': False,
|
||||||
|
u'advanced/hide mouse': True,
|
||||||
|
u'advanced/is portable': False,
|
||||||
|
u'advanced/max recent files': 20,
|
||||||
u'advanced/print file meta data': False,
|
u'advanced/print file meta data': False,
|
||||||
u'advanced/print notes': False,
|
u'advanced/print notes': False,
|
||||||
u'advanced/display size': 0,
|
u'advanced/print slide text': False,
|
||||||
|
u'advanced/recent file count': 4,
|
||||||
|
u'advanced/save current plugin': False,
|
||||||
|
u'advanced/slide limits': SlideLimits.End,
|
||||||
|
u'advanced/single click preview': False,
|
||||||
|
u'advanced/x11 bypass wm': X11_BYPASS_DEFAULT,
|
||||||
u'crashreport/last directory': u'',
|
u'crashreport/last directory': u'',
|
||||||
u'displayTags/html_tags': u'',
|
u'displayTags/html_tags': u'',
|
||||||
|
u'general/audio repeat list': False,
|
||||||
|
u'general/auto open': False,
|
||||||
|
u'general/auto preview': False,
|
||||||
|
u'general/audio start paused': True,
|
||||||
|
u'general/auto unblank': False,
|
||||||
|
u'general/blank warning': False,
|
||||||
u'general/ccli number': u'',
|
u'general/ccli number': u'',
|
||||||
u'general/has run wizard': False,
|
u'general/has run wizard': False,
|
||||||
u'general/update check': True,
|
|
||||||
u'general/language': u'[en]',
|
u'general/language': u'[en]',
|
||||||
u'general/songselect password': u'',
|
|
||||||
u'general/recent files': [],
|
|
||||||
u'general/save prompt': False,
|
|
||||||
u'general/auto preview': False,
|
|
||||||
u'general/view mode': u'default',
|
|
||||||
u'general/auto open': False,
|
|
||||||
u'general/enable slide loop': True,
|
|
||||||
u'general/show splash': True,
|
|
||||||
u'general/screen blank': False,
|
|
||||||
# The other display settings (display position and dimensions) are defined in the ScreenList class due to a
|
|
||||||
# circular dependency.
|
|
||||||
u'general/override position': False,
|
|
||||||
u'general/loop delay': 5,
|
|
||||||
u'general/songselect username': u'',
|
|
||||||
u'general/audio repeat list': False,
|
|
||||||
u'general/auto unblank': False,
|
|
||||||
u'general/display on monitor': True,
|
|
||||||
u'general/audio start paused': True,
|
|
||||||
# This defaults to yesterday in order to force the update check to run when you've never run it before.
|
# This defaults to yesterday in order to force the update check to run when you've never run it before.
|
||||||
u'general/last version test': datetime.datetime.now().date() - datetime.timedelta(days=1),
|
u'general/last version test': datetime.datetime.now().date() - datetime.timedelta(days=1),
|
||||||
u'general/blank warning': False,
|
u'general/loop delay': 5,
|
||||||
|
u'general/recent files': [],
|
||||||
|
u'general/save prompt': False,
|
||||||
|
u'general/screen blank': False,
|
||||||
|
u'general/show splash': True,
|
||||||
|
u'general/songselect password': u'',
|
||||||
|
u'general/songselect username': u'',
|
||||||
|
u'general/update check': True,
|
||||||
|
u'general/view mode': u'default',
|
||||||
|
# The other display settings (display position and dimensions) are defined in the ScreenList class due to a
|
||||||
|
# circular dependency.
|
||||||
|
u'general/display on monitor': True,
|
||||||
|
u'general/override position': False,
|
||||||
|
u'media/players': u'webkit',
|
||||||
|
u'media/override player': QtCore.Qt.Unchecked,
|
||||||
u'players/background color': u'#000000',
|
u'players/background color': u'#000000',
|
||||||
u'servicemanager/service theme': u'',
|
u'servicemanager/last directory': u'',
|
||||||
u'servicemanager/last file': u'',
|
u'servicemanager/last file': u'',
|
||||||
|
u'servicemanager/service theme': u'',
|
||||||
|
u'SettingsImport/file_date_created': datetime.datetime.now().strftime("%Y-%m-%d %H:%M"),
|
||||||
u'SettingsImport/Make_Changes': u'At_Own_RISK',
|
u'SettingsImport/Make_Changes': u'At_Own_RISK',
|
||||||
u'SettingsImport/type': u'OpenLP_settings_export',
|
u'SettingsImport/type': u'OpenLP_settings_export',
|
||||||
u'SettingsImport/file_date_created': datetime.datetime.now().strftime("%Y-%m-%d %H:%M"),
|
|
||||||
u'SettingsImport/version': u'',
|
u'SettingsImport/version': u'',
|
||||||
u'shortcuts/aboutItem': [QtGui.QKeySequence(u'Ctrl+F1')],
|
u'shortcuts/aboutItem': [QtGui.QKeySequence(u'Ctrl+F1')],
|
||||||
u'shortcuts/audioPauseItem': [],
|
u'shortcuts/audioPauseItem': [],
|
||||||
|
@ -213,39 +216,37 @@ class Settings(QtCore.QSettings):
|
||||||
u'shortcuts/viewLivePanel': [QtGui.QKeySequence(u'F12')],
|
u'shortcuts/viewLivePanel': [QtGui.QKeySequence(u'F12')],
|
||||||
u'shortcuts/viewServiceManagerItem': [QtGui.QKeySequence(u'F9')],
|
u'shortcuts/viewServiceManagerItem': [QtGui.QKeySequence(u'F9')],
|
||||||
u'shortcuts/webSiteItem': [],
|
u'shortcuts/webSiteItem': [],
|
||||||
u'themes/theme level': ThemeLevel.Song,
|
|
||||||
u'themes/global theme': u'',
|
u'themes/global theme': u'',
|
||||||
u'themes/last directory': u'',
|
u'themes/last directory': u'',
|
||||||
u'themes/last directory export': u'',
|
u'themes/last directory export': u'',
|
||||||
u'themes/last directory import': u'',
|
u'themes/last directory import': u'',
|
||||||
u'user interface/main window position': QtCore.QPoint(0, 0),
|
u'themes/theme level': ThemeLevel.Song,
|
||||||
u'user interface/preview panel': True,
|
|
||||||
u'user interface/live panel': True,
|
u'user interface/live panel': True,
|
||||||
u'user interface/main window geometry': QtCore.QByteArray(),
|
|
||||||
u'user interface/preview splitter geometry': QtCore.QByteArray(),
|
|
||||||
u'user interface/lock panel': False,
|
|
||||||
u'user interface/mainwindow splitter geometry': QtCore.QByteArray(),
|
|
||||||
u'user interface/live splitter geometry': QtCore.QByteArray(),
|
u'user interface/live splitter geometry': QtCore.QByteArray(),
|
||||||
|
u'user interface/lock panel': False,
|
||||||
|
u'user interface/main window geometry': QtCore.QByteArray(),
|
||||||
|
u'user interface/main window position': QtCore.QPoint(0, 0),
|
||||||
|
u'user interface/main window splitter geometry': QtCore.QByteArray(),
|
||||||
u'user interface/main window state': QtCore.QByteArray(),
|
u'user interface/main window state': QtCore.QByteArray(),
|
||||||
u'media/players': u'webkit',
|
u'user interface/preview panel': True,
|
||||||
u'media/override player': QtCore.Qt.Unchecked,
|
u'user interface/preview splitter geometry': QtCore.QByteArray()
|
||||||
# Old settings (not used anymore). Have to be here, so that old setting.config backups can be imported.
|
|
||||||
u'advanced/stylesheet fix': u'',
|
|
||||||
u'servicemanager/last directory': u''
|
|
||||||
}
|
}
|
||||||
__file_path__ = u''
|
__file_path__ = u''
|
||||||
__obsolete_settings__ = [
|
__obsolete_settings__ = [
|
||||||
|
# Changed during 1.9.x development.
|
||||||
(u'bibles/bookname language', u'bibles/book name language', []),
|
(u'bibles/bookname language', u'bibles/book name language', []),
|
||||||
(u'general/enable slide loop', u'advanced/slide limits', [(SlideLimits.Wrap, True), (SlideLimits.End, False)]),
|
(u'general/enable slide loop', u'advanced/slide limits', [(SlideLimits.Wrap, True), (SlideLimits.End, False)]),
|
||||||
|
(u'songs/ccli number', u'general/ccli number', []),
|
||||||
|
# Changed during 2.1.x development.
|
||||||
|
(u'advanced/stylesheet fix', u'', []),
|
||||||
|
(u'bibles/last directory 1', u'bibles/last directory import', []),
|
||||||
|
(u'media/background color', u'players/background color', []),
|
||||||
(u'themes/last directory', u'themes/last directory import', []),
|
(u'themes/last directory', u'themes/last directory import', []),
|
||||||
(u'themes/last directory 1', u'themes/last directory export', []),
|
(u'themes/last directory 1', u'themes/last directory export', []),
|
||||||
(u'servicemanager/last directory', u'', []),
|
|
||||||
(u'songs/last directory 1', u'songs/last directory import', []),
|
(u'songs/last directory 1', u'songs/last directory import', []),
|
||||||
(u'bibles/last directory 1', u'bibles/last directory import', []),
|
|
||||||
(u'songusage/last directory 1', u'songusage/last directory export', []),
|
(u'songusage/last directory 1', u'songusage/last directory export', []),
|
||||||
(u'shortcuts/makeLive', u'shortcuts/make_live', []),
|
(u'user interface/mainwindow splitter geometry', u'user interface/main window splitter geometry', []),
|
||||||
(u'advanced/stylesheet fix', u'', []),
|
(u'shortcuts/makeLive', u'shortcuts/make_live', [])
|
||||||
(u'media/background color', u'players/background color', [])
|
|
||||||
]
|
]
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
@ -296,6 +297,11 @@ class Settings(QtCore.QSettings):
|
||||||
if new_key:
|
if new_key:
|
||||||
# Get the value of the old_key.
|
# Get the value of the old_key.
|
||||||
old_value = super(Settings, self).value(old_key)
|
old_value = super(Settings, self).value(old_key)
|
||||||
|
# When we want to convert the value, we have to figure out the default value (because we cannot get
|
||||||
|
# the default value from the central settings dict.
|
||||||
|
if rules:
|
||||||
|
default_value = rules[0][1]
|
||||||
|
old_value = self._convert_value(old_value, default_value)
|
||||||
# Iterate over our rules and check what the old_value should be "converted" to.
|
# Iterate over our rules and check what the old_value should be "converted" to.
|
||||||
for new, old in rules:
|
for new, old in rules:
|
||||||
# If the value matches with the condition (rule), then use the provided value. This is used to
|
# If the value matches with the condition (rule), then use the provided value. This is used to
|
||||||
|
@ -311,8 +317,6 @@ class Settings(QtCore.QSettings):
|
||||||
Returns the value for the given ``key``. The returned ``value`` is of the same type as the default value in the
|
Returns the value for the given ``key``. The returned ``value`` is of the same type as the default value in the
|
||||||
*Settings.__default_settings__* dict.
|
*Settings.__default_settings__* dict.
|
||||||
|
|
||||||
**Note**, this method only converts a few types and might need to be extended if a certain type is missing!
|
|
||||||
|
|
||||||
``key``
|
``key``
|
||||||
The key to return the value from.
|
The key to return the value from.
|
||||||
"""
|
"""
|
||||||
|
@ -322,6 +326,21 @@ class Settings(QtCore.QSettings):
|
||||||
else:
|
else:
|
||||||
default_value = Settings.__default_settings__[key]
|
default_value = Settings.__default_settings__[key]
|
||||||
setting = super(Settings, self).value(key, default_value)
|
setting = super(Settings, self).value(key, default_value)
|
||||||
|
return self._convert_value(setting, default_value)
|
||||||
|
|
||||||
|
def _convert_value(self, setting, default_value):
|
||||||
|
"""
|
||||||
|
This converts the given ``setting`` to the type of the given ``default_value``.
|
||||||
|
|
||||||
|
``setting``
|
||||||
|
The setting to convert. This could be ``true`` for example.Settings()
|
||||||
|
|
||||||
|
``default_value``
|
||||||
|
Indication the type the setting should be converted to. For example ``True`` (type is boolean), meaning that
|
||||||
|
we convert the string ``true`` to a python boolean.
|
||||||
|
|
||||||
|
**Note**, this method only converts a few types and might need to be extended if a certain type is missing!
|
||||||
|
"""
|
||||||
# On OS X (and probably on other platforms too) empty value from QSettings is represented as type
|
# On OS X (and probably on other platforms too) empty value from QSettings is represented as type
|
||||||
# PyQt4.QtCore.QPyNullVariant. This type has to be converted to proper 'None' Python type.
|
# PyQt4.QtCore.QPyNullVariant. This type has to be converted to proper 'None' Python type.
|
||||||
if isinstance(setting, QtCore.QPyNullVariant) and setting.isNull():
|
if isinstance(setting, QtCore.QPyNullVariant) and setting.isNull():
|
||||||
|
|
|
@ -33,7 +33,7 @@ import logging
|
||||||
|
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
from openlp.core.lib import build_icon, translate, Receiver, UiStrings
|
from openlp.core.lib import Receiver, UiStrings, build_icon, translate
|
||||||
from openlp.core.utils.actions import ActionList
|
from openlp.core.utils.actions import ActionList
|
||||||
|
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ def add_welcome_page(parent, image):
|
||||||
parent.addPage(parent.welcomePage)
|
parent.addPage(parent.welcomePage)
|
||||||
|
|
||||||
|
|
||||||
def create_button_box(dialog, name, standard_buttons, custom_buttons=[]):
|
def create_button_box(dialog, name, standard_buttons, custom_buttons=None):
|
||||||
"""
|
"""
|
||||||
Creates a QDialogButtonBox with the given buttons. The ``accepted()`` and
|
Creates a QDialogButtonBox with the given buttons. The ``accepted()`` and
|
||||||
``rejected()`` signals of the button box are connected with the dialogs
|
``rejected()`` signals of the button box are connected with the dialogs
|
||||||
|
@ -88,6 +88,8 @@ def create_button_box(dialog, name, standard_buttons, custom_buttons=[]):
|
||||||
QtGui.QAbstractButton it is added with QDialogButtonBox.ActionRole.
|
QtGui.QAbstractButton it is added with QDialogButtonBox.ActionRole.
|
||||||
Otherwhise the item has to be a tuple of a button and a ButtonRole.
|
Otherwhise the item has to be a tuple of a button and a ButtonRole.
|
||||||
"""
|
"""
|
||||||
|
if custom_buttons is None:
|
||||||
|
custom_buttons = []
|
||||||
buttons = QtGui.QDialogButtonBox.NoButton
|
buttons = QtGui.QDialogButtonBox.NoButton
|
||||||
if u'ok' in standard_buttons:
|
if u'ok' in standard_buttons:
|
||||||
buttons |= QtGui.QDialogButtonBox.Ok
|
buttons |= QtGui.QDialogButtonBox.Ok
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
|
|
||||||
from PyQt4 import QtGui
|
from PyQt4 import QtGui
|
||||||
|
|
||||||
from openlp.core.lib import build_icon, translate, UiStrings
|
from openlp.core.lib import UiStrings, build_icon, translate
|
||||||
from openlp.core.lib.ui import create_button, create_button_box
|
from openlp.core.lib.ui import create_button, create_button_box
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@ import sys
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
from openlp.core.lib import SettingsTab, Receiver, Settings, UiStrings, translate, build_icon
|
from openlp.core.lib import SettingsTab, Receiver, Settings, UiStrings, translate, build_icon
|
||||||
from openlp.core.utils import get_images_filter, AppLocation, format_time
|
from openlp.core.utils import AppLocation, format_time, get_images_filter
|
||||||
from openlp.core.lib import SlideLimits
|
from openlp.core.lib import SlideLimits
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
@ -449,7 +449,7 @@ class AdvancedTab(SettingsTab):
|
||||||
settings.setValue(u'enable exit confirmation', self.enable_auto_close_check_box.isChecked())
|
settings.setValue(u'enable exit confirmation', self.enable_auto_close_check_box.isChecked())
|
||||||
settings.setValue(u'hide mouse', self.hide_mouse_check_box.isChecked())
|
settings.setValue(u'hide mouse', self.hide_mouse_check_box.isChecked())
|
||||||
settings.setValue(u'x11 bypass wm', self.x11_bypass_check_box.isChecked())
|
settings.setValue(u'x11 bypass wm', self.x11_bypass_check_box.isChecked())
|
||||||
settings.setValue(u'alternate rows', self.alternate_rows_check_box.isChecked())
|
settings.setValue(u'alternate rows', self.alternate_rows_check_box.isChecked())
|
||||||
settings.setValue(u'default color', self.default_color)
|
settings.setValue(u'default color', self.default_color)
|
||||||
settings.setValue(u'default image', self.default_file_edit.text())
|
settings.setValue(u'default image', self.default_file_edit.text())
|
||||||
settings.setValue(u'slide limits', self.slide_limits)
|
settings.setValue(u'slide limits', self.slide_limits)
|
||||||
|
@ -666,7 +666,7 @@ class AdvancedTab(SettingsTab):
|
||||||
The state of the check box (boolean).
|
The state of the check box (boolean).
|
||||||
"""
|
"""
|
||||||
self.display_changed = True
|
self.display_changed = True
|
||||||
|
|
||||||
def on_alternate_rows_check_box_toggled(self, checked):
|
def on_alternate_rows_check_box_toggled(self, checked):
|
||||||
"""
|
"""
|
||||||
Notify user about required restart.
|
Notify user about required restart.
|
||||||
|
@ -681,17 +681,17 @@ class AdvancedTab(SettingsTab):
|
||||||
def on_end_slide_button_clicked(self):
|
def on_end_slide_button_clicked(self):
|
||||||
"""
|
"""
|
||||||
Stop at the end either top ot bottom
|
Stop at the end either top ot bottom
|
||||||
"""
|
"""
|
||||||
self.slide_limits = SlideLimits.End
|
self.slide_limits = SlideLimits.End
|
||||||
|
|
||||||
def on_wrap_slide_button_clicked(self):
|
def on_wrap_slide_button_clicked(self):
|
||||||
"""
|
"""
|
||||||
Wrap round the service item
|
Wrap round the service item
|
||||||
"""
|
"""
|
||||||
self.slide_limits = SlideLimits.Wrap
|
self.slide_limits = SlideLimits.Wrap
|
||||||
|
|
||||||
def on_next_item_button_clicked(self):
|
def on_next_item_button_clicked(self):
|
||||||
"""
|
"""
|
||||||
Advance to the next service item
|
Advance to the next service item
|
||||||
"""
|
"""
|
||||||
self.slide_limits = SlideLimits.Next
|
self.slide_limits = SlideLimits.Next
|
||||||
|
|
|
@ -88,7 +88,7 @@ except AttributeError:
|
||||||
WEBKIT_VERSION = u'-'
|
WEBKIT_VERSION = u'-'
|
||||||
|
|
||||||
|
|
||||||
from openlp.core.lib import translate, UiStrings, Settings
|
from openlp.core.lib import UiStrings, Settings, translate
|
||||||
from openlp.core.utils import get_application_version
|
from openlp.core.utils import get_application_version
|
||||||
|
|
||||||
from exceptiondialog import Ui_ExceptionDialog
|
from exceptiondialog import Ui_ExceptionDialog
|
||||||
|
@ -141,9 +141,9 @@ class ExceptionForm(QtGui.QDialog, Ui_ExceptionDialog):
|
||||||
u'pyUNO bridge: %s\n' % UNO_VERSION
|
u'pyUNO bridge: %s\n' % UNO_VERSION
|
||||||
if platform.system() == u'Linux':
|
if platform.system() == u'Linux':
|
||||||
if os.environ.get(u'KDE_FULL_SESSION') == u'true':
|
if os.environ.get(u'KDE_FULL_SESSION') == u'true':
|
||||||
system = system + u'Desktop: KDE SC\n'
|
system += u'Desktop: KDE SC\n'
|
||||||
elif os.environ.get(u'GNOME_DESKTOP_SESSION_ID'):
|
elif os.environ.get(u'GNOME_DESKTOP_SESSION_ID'):
|
||||||
system = system + u'Desktop: GNOME\n'
|
system += u'Desktop: GNOME\n'
|
||||||
return (openlp_version, description, traceback, system, libraries)
|
return (openlp_version, description, traceback, system, libraries)
|
||||||
|
|
||||||
def onSaveReportButtonClicked(self):
|
def onSaveReportButtonClicked(self):
|
||||||
|
|
|
@ -41,8 +41,8 @@ from ConfigParser import SafeConfigParser
|
||||||
|
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
from openlp.core.lib import translate, PluginStatus, Receiver, build_icon, check_directory_exists, Settings, Registry
|
from openlp.core.lib import PluginStatus, Receiver, Settings, Registry, build_icon, check_directory_exists, translate
|
||||||
from openlp.core.utils import get_web_page, AppLocation, get_filesystem_encoding
|
from openlp.core.utils import AppLocation, get_web_page, get_filesystem_encoding
|
||||||
from firsttimewizard import Ui_FirstTimeWizard, FirstTimePage
|
from firsttimewizard import Ui_FirstTimeWizard, FirstTimePage
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
@ -61,7 +61,7 @@ class ThemeScreenshotThread(QtCore.QThread):
|
||||||
config = self.parent().config
|
config = self.parent().config
|
||||||
for theme in themes:
|
for theme in themes:
|
||||||
# Stop if the wizard has been cancelled.
|
# Stop if the wizard has been cancelled.
|
||||||
if self.parent().downloadCancelled:
|
if self.parent().was_download_cancelled:
|
||||||
return
|
return
|
||||||
title = config.get(u'theme_%s' % theme, u'title')
|
title = config.get(u'theme_%s' % theme, u'title')
|
||||||
filename = config.get(u'theme_%s' % theme, u'filename')
|
filename = config.get(u'theme_%s' % theme, u'filename')
|
||||||
|
@ -91,9 +91,9 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
|
||||||
# check to see if we have web access
|
# check to see if we have web access
|
||||||
self.web = u'http://openlp.org/files/frw/'
|
self.web = u'http://openlp.org/files/frw/'
|
||||||
self.config = SafeConfigParser()
|
self.config = SafeConfigParser()
|
||||||
self.webAccess = get_web_page(u'%s%s' % (self.web, u'download.cfg'))
|
self.web_access = get_web_page(u'%s%s' % (self.web, u'download.cfg'))
|
||||||
if self.webAccess:
|
if self.web_access:
|
||||||
files = self.webAccess.read()
|
files = self.web_access.read()
|
||||||
self.config.readfp(io.BytesIO(files))
|
self.config.readfp(io.BytesIO(files))
|
||||||
self.updateScreenListCombo()
|
self.updateScreenListCombo()
|
||||||
self.was_download_cancelled = False
|
self.was_download_cancelled = False
|
||||||
|
@ -118,13 +118,12 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
|
||||||
Set up display at start of theme edit.
|
Set up display at start of theme edit.
|
||||||
"""
|
"""
|
||||||
self.restart()
|
self.restart()
|
||||||
check_directory_exists(os.path.join(
|
check_directory_exists(os.path.join(unicode(gettempdir(), get_filesystem_encoding()), u'openlp'))
|
||||||
unicode(gettempdir(), get_filesystem_encoding()), u'openlp'))
|
|
||||||
self.noInternetFinishButton.setVisible(False)
|
self.noInternetFinishButton.setVisible(False)
|
||||||
# Check if this is a re-run of the wizard.
|
# Check if this is a re-run of the wizard.
|
||||||
self.hasRunWizard = Settings().value(u'general/has run wizard')
|
self.hasRunWizard = Settings().value(u'general/has run wizard')
|
||||||
# Sort out internet access for downloads
|
# Sort out internet access for downloads
|
||||||
if self.webAccess:
|
if self.web_access:
|
||||||
songs = self.config.get(u'songs', u'languages')
|
songs = self.config.get(u'songs', u'languages')
|
||||||
songs = songs.split(u',')
|
songs = songs.split(u',')
|
||||||
for song in songs:
|
for song in songs:
|
||||||
|
@ -152,15 +151,15 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
|
||||||
# Download the theme screenshots.
|
# Download the theme screenshots.
|
||||||
self.themeScreenshotThread = ThemeScreenshotThread(self)
|
self.themeScreenshotThread = ThemeScreenshotThread(self)
|
||||||
self.themeScreenshotThread.start()
|
self.themeScreenshotThread.start()
|
||||||
Receiver.send_message(u'cursor_normal')
|
self.application.set_normal_cursor()
|
||||||
|
|
||||||
def nextId(self):
|
def nextId(self):
|
||||||
"""
|
"""
|
||||||
Determine the next page in the Wizard to go to.
|
Determine the next page in the Wizard to go to.
|
||||||
"""
|
"""
|
||||||
Receiver.send_message(u'openlp_process_events')
|
self.application.process_events()
|
||||||
if self.currentId() == FirstTimePage.Plugins:
|
if self.currentId() == FirstTimePage.Plugins:
|
||||||
if not self.webAccess:
|
if not self.web_access:
|
||||||
return FirstTimePage.NoInternet
|
return FirstTimePage.NoInternet
|
||||||
else:
|
else:
|
||||||
return FirstTimePage.Songs
|
return FirstTimePage.Songs
|
||||||
|
@ -169,14 +168,13 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
|
||||||
elif self.currentId() == FirstTimePage.NoInternet:
|
elif self.currentId() == FirstTimePage.NoInternet:
|
||||||
return FirstTimePage.Progress
|
return FirstTimePage.Progress
|
||||||
elif self.currentId() == FirstTimePage.Themes:
|
elif self.currentId() == FirstTimePage.Themes:
|
||||||
Receiver.send_message(u'cursor_busy')
|
self.application.set_busy_cursor()
|
||||||
Receiver.send_message(u'openlp_process_events')
|
|
||||||
while not self.themeScreenshotThread.isFinished():
|
while not self.themeScreenshotThread.isFinished():
|
||||||
time.sleep(0.1)
|
time.sleep(0.1)
|
||||||
Receiver.send_message(u'openlp_process_events')
|
self.application.process_events()
|
||||||
# Build the screenshot icons, as this can not be done in the thread.
|
# Build the screenshot icons, as this can not be done in the thread.
|
||||||
self._buildThemeScreenshots()
|
self._buildThemeScreenshots()
|
||||||
Receiver.send_message(u'cursor_normal')
|
self.application.set_normal_cursor()
|
||||||
return FirstTimePage.Defaults
|
return FirstTimePage.Defaults
|
||||||
else:
|
else:
|
||||||
return self.currentId() + 1
|
return self.currentId() + 1
|
||||||
|
@ -187,7 +185,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
|
||||||
"""
|
"""
|
||||||
# Keep track of the page we are at. Triggering "Cancel" causes pageId
|
# Keep track of the page we are at. Triggering "Cancel" causes pageId
|
||||||
# to be a -1.
|
# to be a -1.
|
||||||
Receiver.send_message(u'openlp_process_events')
|
self.application.process_events()
|
||||||
if pageId != -1:
|
if pageId != -1:
|
||||||
self.lastId = pageId
|
self.lastId = pageId
|
||||||
if pageId == FirstTimePage.Plugins:
|
if pageId == FirstTimePage.Plugins:
|
||||||
|
@ -219,16 +217,15 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
|
||||||
if self.hasRunWizard:
|
if self.hasRunWizard:
|
||||||
self.cancelButton.setVisible(False)
|
self.cancelButton.setVisible(False)
|
||||||
elif pageId == FirstTimePage.Progress:
|
elif pageId == FirstTimePage.Progress:
|
||||||
Receiver.send_message(u'cursor_busy')
|
self.application.set_busy_cursor()
|
||||||
self.repaint()
|
self.repaint()
|
||||||
Receiver.send_message(u'openlp_process_events')
|
self.application.process_events()
|
||||||
# Try to give the wizard a chance to redraw itself
|
# Try to give the wizard a chance to redraw itself
|
||||||
time.sleep(0.2)
|
time.sleep(0.2)
|
||||||
self._preWizard()
|
self._preWizard()
|
||||||
self._performWizard()
|
self._performWizard()
|
||||||
self._postWizard()
|
self._postWizard()
|
||||||
Receiver.send_message(u'cursor_normal')
|
self.application.set_normal_cursor()
|
||||||
Receiver.send_message(u'openlp_process_events')
|
|
||||||
|
|
||||||
def updateScreenListCombo(self):
|
def updateScreenListCombo(self):
|
||||||
"""
|
"""
|
||||||
|
@ -243,23 +240,21 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
|
||||||
"""
|
"""
|
||||||
Process the triggering of the cancel button.
|
Process the triggering of the cancel button.
|
||||||
"""
|
"""
|
||||||
if self.lastId == FirstTimePage.NoInternet or \
|
if self.lastId == FirstTimePage.NoInternet or (self.lastId <= FirstTimePage.Plugins and not self.hasRunWizard):
|
||||||
(self.lastId <= FirstTimePage.Plugins and not self.hasRunWizard):
|
|
||||||
QtCore.QCoreApplication.exit()
|
QtCore.QCoreApplication.exit()
|
||||||
sys.exit()
|
sys.exit()
|
||||||
self.was_download_cancelled = True
|
self.was_download_cancelled = True
|
||||||
while self.themeScreenshotThread.isRunning():
|
while self.themeScreenshotThread.isRunning():
|
||||||
time.sleep(0.1)
|
time.sleep(0.1)
|
||||||
Receiver.send_message(u'cursor_normal')
|
self.application.set_normal_cursor()
|
||||||
|
|
||||||
def onNoInternetFinishButtonClicked(self):
|
def onNoInternetFinishButtonClicked(self):
|
||||||
"""
|
"""
|
||||||
Process the triggering of the "Finish" button on the No Internet page.
|
Process the triggering of the "Finish" button on the No Internet page.
|
||||||
"""
|
"""
|
||||||
Receiver.send_message(u'cursor_busy')
|
self.application.set_busy_cursor()
|
||||||
self._performWizard()
|
self._performWizard()
|
||||||
Receiver.send_message(u'cursor_normal')
|
self.application.set_normal_cursor()
|
||||||
Receiver.send_message(u'openlp_process_events')
|
|
||||||
Settings().setValue(u'general/has run wizard', True)
|
Settings().setValue(u'general/has run wizard', True)
|
||||||
self.close()
|
self.close()
|
||||||
|
|
||||||
|
@ -335,7 +330,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
|
||||||
self.progressLabel.setText(status_text)
|
self.progressLabel.setText(status_text)
|
||||||
if increment > 0:
|
if increment > 0:
|
||||||
self.progressBar.setValue(self.progressBar.value() + increment)
|
self.progressBar.setValue(self.progressBar.value() + increment)
|
||||||
Receiver.send_message(u'openlp_process_events')
|
self.application.process_events()
|
||||||
|
|
||||||
def _preWizard(self):
|
def _preWizard(self):
|
||||||
"""
|
"""
|
||||||
|
@ -343,10 +338,10 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
|
||||||
"""
|
"""
|
||||||
self.max_progress = 0
|
self.max_progress = 0
|
||||||
self.finishButton.setVisible(False)
|
self.finishButton.setVisible(False)
|
||||||
Receiver.send_message(u'openlp_process_events')
|
self.application.process_events()
|
||||||
# Loop through the songs list and increase for each selected item
|
# Loop through the songs list and increase for each selected item
|
||||||
for i in xrange(self.songsListWidget.count()):
|
for i in xrange(self.songsListWidget.count()):
|
||||||
Receiver.send_message(u'openlp_process_events')
|
self.application.process_events()
|
||||||
item = self.songsListWidget.item(i)
|
item = self.songsListWidget.item(i)
|
||||||
if item.checkState() == QtCore.Qt.Checked:
|
if item.checkState() == QtCore.Qt.Checked:
|
||||||
filename = item.data(QtCore.Qt.UserRole)
|
filename = item.data(QtCore.Qt.UserRole)
|
||||||
|
@ -355,7 +350,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
|
||||||
# Loop through the Bibles list and increase for each selected item
|
# Loop through the Bibles list and increase for each selected item
|
||||||
iterator = QtGui.QTreeWidgetItemIterator(self.biblesTreeWidget)
|
iterator = QtGui.QTreeWidgetItemIterator(self.biblesTreeWidget)
|
||||||
while iterator.value():
|
while iterator.value():
|
||||||
Receiver.send_message(u'openlp_process_events')
|
self.application.process_events()
|
||||||
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 = item.data(0, QtCore.Qt.UserRole)
|
filename = item.data(0, QtCore.Qt.UserRole)
|
||||||
|
@ -364,7 +359,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
|
||||||
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
|
||||||
for i in xrange(self.themesListWidget.count()):
|
for i in xrange(self.themesListWidget.count()):
|
||||||
Receiver.send_message(u'openlp_process_events')
|
self.application.process_events()
|
||||||
item = self.themesListWidget.item(i)
|
item = self.themesListWidget.item(i)
|
||||||
if item.checkState() == QtCore.Qt.Checked:
|
if item.checkState() == QtCore.Qt.Checked:
|
||||||
filename = item.data(QtCore.Qt.UserRole)
|
filename = item.data(QtCore.Qt.UserRole)
|
||||||
|
@ -372,7 +367,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
|
||||||
self.max_progress += size
|
self.max_progress += size
|
||||||
if self.max_progress:
|
if self.max_progress:
|
||||||
# Add on 2 for plugins status setting plus a "finished" point.
|
# Add on 2 for plugins status setting plus a "finished" point.
|
||||||
self.max_progress = self.max_progress + 2
|
self.max_progress += 2
|
||||||
self.progressBar.setValue(0)
|
self.progressBar.setValue(0)
|
||||||
self.progressBar.setMinimum(0)
|
self.progressBar.setMinimum(0)
|
||||||
self.progressBar.setMaximum(self.max_progress)
|
self.progressBar.setMaximum(self.max_progress)
|
||||||
|
@ -384,7 +379,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
|
||||||
self.progressPage.setTitle(translate('OpenLP.FirstTimeWizard', 'Setting Up'))
|
self.progressPage.setTitle(translate('OpenLP.FirstTimeWizard', 'Setting Up'))
|
||||||
self.progressPage.setSubTitle(u'Setup complete.')
|
self.progressPage.setSubTitle(u'Setup complete.')
|
||||||
self.repaint()
|
self.repaint()
|
||||||
Receiver.send_message(u'openlp_process_events')
|
self.application.process_events()
|
||||||
# Try to give the wizard a chance to repaint itself
|
# Try to give the wizard a chance to repaint itself
|
||||||
time.sleep(0.1)
|
time.sleep(0.1)
|
||||||
|
|
||||||
|
@ -411,7 +406,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
|
||||||
self.finishButton.setEnabled(True)
|
self.finishButton.setEnabled(True)
|
||||||
self.cancelButton.setVisible(False)
|
self.cancelButton.setVisible(False)
|
||||||
self.nextButton.setVisible(False)
|
self.nextButton.setVisible(False)
|
||||||
Receiver.send_message(u'openlp_process_events')
|
self.application.process_events()
|
||||||
|
|
||||||
def _performWizard(self):
|
def _performWizard(self):
|
||||||
"""
|
"""
|
||||||
|
@ -431,7 +426,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
|
||||||
self._setPluginStatus(self.customCheckBox, u'custom/status')
|
self._setPluginStatus(self.customCheckBox, u'custom/status')
|
||||||
self._setPluginStatus(self.songUsageCheckBox, u'songusage/status')
|
self._setPluginStatus(self.songUsageCheckBox, u'songusage/status')
|
||||||
self._setPluginStatus(self.alertCheckBox, u'alerts/status')
|
self._setPluginStatus(self.alertCheckBox, u'alerts/status')
|
||||||
if self.webAccess:
|
if self.web_access:
|
||||||
# Build directories for downloads
|
# Build directories for downloads
|
||||||
songs_destination = os.path.join(
|
songs_destination = os.path.join(
|
||||||
unicode(gettempdir(), get_filesystem_encoding()), u'openlp')
|
unicode(gettempdir(), get_filesystem_encoding()), u'openlp')
|
||||||
|
@ -489,3 +484,13 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
|
||||||
return self._theme_manager
|
return self._theme_manager
|
||||||
|
|
||||||
theme_manager = property(_get_theme_manager)
|
theme_manager = property(_get_theme_manager)
|
||||||
|
|
||||||
|
def _get_application(self):
|
||||||
|
"""
|
||||||
|
Adds the openlp to the class dynamically
|
||||||
|
"""
|
||||||
|
if not hasattr(self, u'_application'):
|
||||||
|
self._application = Registry().get(u'application')
|
||||||
|
return self._application
|
||||||
|
|
||||||
|
application = property(_get_application)
|
||||||
|
|
|
@ -31,7 +31,7 @@ The UI widgets for the formatting tags window.
|
||||||
"""
|
"""
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
from openlp.core.lib import translate, UiStrings
|
from openlp.core.lib import UiStrings, translate
|
||||||
from openlp.core.lib.ui import create_button_box
|
from openlp.core.lib.ui import create_button_box
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ cannot be changed.
|
||||||
"""
|
"""
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
from openlp.core.lib import translate, FormattingTags
|
from openlp.core.lib import FormattingTags, translate
|
||||||
from openlp.core.lib.ui import critical_error_message_box
|
from openlp.core.lib.ui import critical_error_message_box
|
||||||
from openlp.core.ui.formattingtagdialog import Ui_FormattingTagDialog
|
from openlp.core.ui.formattingtagdialog import Ui_FormattingTagDialog
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ import logging
|
||||||
|
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
from openlp.core.lib import Receiver, Settings, SettingsTab, translate, ScreenList, UiStrings
|
from openlp.core.lib import Receiver, Settings, SettingsTab, ScreenList, UiStrings, translate
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
|
@ -42,8 +42,8 @@ import sys
|
||||||
from PyQt4 import QtCore, QtGui, QtWebKit, QtOpenGL
|
from PyQt4 import QtCore, QtGui, QtWebKit, QtOpenGL
|
||||||
from PyQt4.phonon import Phonon
|
from PyQt4.phonon import Phonon
|
||||||
|
|
||||||
from openlp.core.lib import Receiver, build_html, ServiceItem, image_to_byte, translate, expand_tags,\
|
from openlp.core.lib import Receiver, ServiceItem, Settings, ImageSource, Registry, build_html, expand_tags, \
|
||||||
Settings, ImageSource, Registry
|
image_to_byte, translate
|
||||||
from openlp.core.lib.theme import BackgroundType
|
from openlp.core.lib.theme import BackgroundType
|
||||||
|
|
||||||
from openlp.core.lib import ScreenList
|
from openlp.core.lib import ScreenList
|
||||||
|
@ -243,7 +243,7 @@ class MainDisplay(Display):
|
||||||
log.debug(u'text to display')
|
log.debug(u'text to display')
|
||||||
# Wait for the webview to update before displaying text.
|
# Wait for the webview to update before displaying text.
|
||||||
while not self.webLoaded:
|
while not self.webLoaded:
|
||||||
Receiver.send_message(u'openlp_process_events')
|
self.application.process_events()
|
||||||
self.setGeometry(self.screen[u'size'])
|
self.setGeometry(self.screen[u'size'])
|
||||||
if animate:
|
if animate:
|
||||||
self.frame.evaluateJavaScript(u'show_text("%s")' % slide.replace(u'\\', u'\\\\').replace(u'\"', u'\\\"'))
|
self.frame.evaluateJavaScript(u'show_text("%s")' % slide.replace(u'\\', u'\\\\').replace(u'\"', u'\\\"'))
|
||||||
|
@ -347,18 +347,18 @@ class MainDisplay(Display):
|
||||||
Generates a preview of the image displayed.
|
Generates a preview of the image displayed.
|
||||||
"""
|
"""
|
||||||
log.debug(u'preview for %s', self.isLive)
|
log.debug(u'preview for %s', self.isLive)
|
||||||
Receiver.send_message(u'openlp_process_events')
|
self.application.process_events()
|
||||||
# We must have a service item to preview.
|
# We must have a service item to preview.
|
||||||
if self.isLive and hasattr(self, u'serviceItem'):
|
if self.isLive and hasattr(self, u'serviceItem'):
|
||||||
# Wait for the fade to finish before geting the preview.
|
# Wait for the fade to finish before geting the preview.
|
||||||
# Important otherwise preview will have incorrect text if at all!
|
# Important otherwise preview will have incorrect text if at all!
|
||||||
if self.serviceItem.themedata and self.serviceItem.themedata.display_slide_transition:
|
if self.serviceItem.themedata and self.serviceItem.themedata.display_slide_transition:
|
||||||
while self.frame.evaluateJavaScript(u'show_text_complete()') == u'false':
|
while self.frame.evaluateJavaScript(u'show_text_complete()') == u'false':
|
||||||
Receiver.send_message(u'openlp_process_events')
|
self.application.process_events()
|
||||||
# Wait for the webview to update before getting the preview.
|
# Wait for the webview to update before getting the preview.
|
||||||
# Important otherwise first preview will miss the background !
|
# Important otherwise first preview will miss the background !
|
||||||
while not self.webLoaded:
|
while not self.webLoaded:
|
||||||
Receiver.send_message(u'openlp_process_events')
|
self.application.process_events()
|
||||||
# if was hidden keep it hidden
|
# if was hidden keep it hidden
|
||||||
if self.isLive:
|
if self.isLive:
|
||||||
if self.hideMode:
|
if self.hideMode:
|
||||||
|
@ -503,6 +503,16 @@ class MainDisplay(Display):
|
||||||
|
|
||||||
image_manager = property(_get_image_manager)
|
image_manager = property(_get_image_manager)
|
||||||
|
|
||||||
|
def _get_application(self):
|
||||||
|
"""
|
||||||
|
Adds the openlp to the class dynamically
|
||||||
|
"""
|
||||||
|
if not hasattr(self, u'_application'):
|
||||||
|
self._application = Registry().get(u'application')
|
||||||
|
return self._application
|
||||||
|
|
||||||
|
application = property(_get_application)
|
||||||
|
|
||||||
|
|
||||||
class AudioPlayer(QtCore.QObject):
|
class AudioPlayer(QtCore.QObject):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -41,13 +41,13 @@ from datetime import datetime
|
||||||
|
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
from openlp.core.lib import Renderer, build_icon, OpenLPDockWidget, PluginManager, Receiver, translate, ImageManager, \
|
from openlp.core.lib import Renderer, OpenLPDockWidget, PluginManager, Receiver, ImageManager, PluginStatus, Registry, \
|
||||||
PluginStatus, Registry, Settings, ScreenList
|
Settings, ScreenList, build_icon, check_directory_exists, translate
|
||||||
from openlp.core.lib.ui import UiStrings, create_action
|
from openlp.core.lib.ui import UiStrings, create_action
|
||||||
from openlp.core.ui import AboutForm, SettingsForm, ServiceManager, ThemeManager, SlideController, PluginForm, \
|
from openlp.core.ui import AboutForm, SettingsForm, ServiceManager, ThemeManager, SlideController, PluginForm, \
|
||||||
MediaDockManager, ShortcutListForm, FormattingTagForm
|
MediaDockManager, ShortcutListForm, FormattingTagForm
|
||||||
from openlp.core.ui.media import MediaController
|
from openlp.core.ui.media import MediaController
|
||||||
from openlp.core.utils import AppLocation, add_actions, LanguageManager, get_application_version, \
|
from openlp.core.utils import AppLocation, LanguageManager, add_actions, get_application_version, \
|
||||||
get_filesystem_encoding
|
get_filesystem_encoding
|
||||||
from openlp.core.utils.actions import ActionList, CategoryOrder
|
from openlp.core.utils.actions import ActionList, CategoryOrder
|
||||||
from openlp.core.ui.firsttimeform import FirstTimeForm
|
from openlp.core.ui.firsttimeform import FirstTimeForm
|
||||||
|
@ -455,14 +455,13 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
||||||
"""
|
"""
|
||||||
log.info(u'MainWindow loaded')
|
log.info(u'MainWindow loaded')
|
||||||
|
|
||||||
def __init__(self, application):
|
def __init__(self):
|
||||||
"""
|
"""
|
||||||
This constructor sets up the interface, the various managers, and the
|
This constructor sets up the interface, the various managers, and the
|
||||||
plugins.
|
plugins.
|
||||||
"""
|
"""
|
||||||
QtGui.QMainWindow.__init__(self)
|
QtGui.QMainWindow.__init__(self)
|
||||||
Registry().register(u'main_window', self)
|
Registry().register(u'main_window', self)
|
||||||
self.application = application
|
|
||||||
self.clipboard = self.application.clipboard()
|
self.clipboard = self.application.clipboard()
|
||||||
self.arguments = self.application.args
|
self.arguments = self.application.args
|
||||||
# Set up settings sections for the main application (not for use by plugins).
|
# Set up settings sections for the main application (not for use by plugins).
|
||||||
|
@ -487,7 +486,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
||||||
self.recentFiles = []
|
self.recentFiles = []
|
||||||
# Set up the path with plugins
|
# Set up the path with plugins
|
||||||
plugin_path = AppLocation.get_directory(AppLocation.PluginsDir)
|
plugin_path = AppLocation.get_directory(AppLocation.PluginsDir)
|
||||||
self.pluginManager = PluginManager(plugin_path)
|
self.plugin_manager = PluginManager(plugin_path)
|
||||||
self.imageManager = ImageManager()
|
self.imageManager = ImageManager()
|
||||||
# Set up the interface
|
# Set up the interface
|
||||||
self.setupUi(self)
|
self.setupUi(self)
|
||||||
|
@ -538,10 +537,9 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
||||||
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'cleanup'), self.clean_up)
|
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'cleanup'), self.clean_up)
|
||||||
# Media Manager
|
# Media Manager
|
||||||
QtCore.QObject.connect(self.mediaToolBox, QtCore.SIGNAL(u'currentChanged(int)'), self.onMediaToolBoxChanged)
|
QtCore.QObject.connect(self.mediaToolBox, QtCore.SIGNAL(u'currentChanged(int)'), self.onMediaToolBoxChanged)
|
||||||
Receiver.send_message(u'cursor_busy')
|
self.application.set_busy_cursor()
|
||||||
# Simple message boxes
|
# Simple message boxes
|
||||||
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'openlp_error_message'), self.onErrorMessage)
|
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'openlp_error_message'), self.onErrorMessage)
|
||||||
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'openlp_warning_message'), self.onWarningMessage)
|
|
||||||
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'openlp_information_message'),
|
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'openlp_information_message'),
|
||||||
self.onInformationMessage)
|
self.onInformationMessage)
|
||||||
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'set_new_data_path'), self.setNewDataPath)
|
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'set_new_data_path'), self.setNewDataPath)
|
||||||
|
@ -553,25 +551,25 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
||||||
# Define the media Dock Manager
|
# Define the media Dock Manager
|
||||||
self.mediaDockManager = MediaDockManager(self.mediaToolBox)
|
self.mediaDockManager = MediaDockManager(self.mediaToolBox)
|
||||||
log.info(u'Load Plugins')
|
log.info(u'Load Plugins')
|
||||||
self.pluginManager.find_plugins(plugin_path)
|
self.plugin_manager.find_plugins(plugin_path)
|
||||||
# hook methods have to happen after find_plugins. Find plugins needs
|
# hook methods have to happen after find_plugins. Find plugins needs
|
||||||
# the controllers hence the hooks have moved from setupUI() to here
|
# the controllers hence the hooks have moved from setupUI() to here
|
||||||
# Find and insert settings tabs
|
# Find and insert settings tabs
|
||||||
log.info(u'hook settings')
|
log.info(u'hook settings')
|
||||||
self.pluginManager.hook_settings_tabs(self.settingsForm)
|
self.plugin_manager.hook_settings_tabs(self.settingsForm)
|
||||||
# Find and insert media manager items
|
# Find and insert media manager items
|
||||||
log.info(u'hook media')
|
log.info(u'hook media')
|
||||||
self.pluginManager.hook_media_manager()
|
self.plugin_manager.hook_media_manager()
|
||||||
# Call the hook method to pull in import menus.
|
# Call the hook method to pull in import menus.
|
||||||
log.info(u'hook menus')
|
log.info(u'hook menus')
|
||||||
self.pluginManager.hook_import_menu(self.fileImportMenu)
|
self.plugin_manager.hook_import_menu(self.fileImportMenu)
|
||||||
# Call the hook method to pull in export menus.
|
# Call the hook method to pull in export menus.
|
||||||
self.pluginManager.hook_export_menu(self.fileExportMenu)
|
self.plugin_manager.hook_export_menu(self.fileExportMenu)
|
||||||
# Call the hook method to pull in tools menus.
|
# Call the hook method to pull in tools menus.
|
||||||
self.pluginManager.hook_tools_menu(self.toolsMenu)
|
self.plugin_manager.hook_tools_menu(self.toolsMenu)
|
||||||
# Call the initialise method to setup plugins.
|
# Call the initialise method to setup plugins.
|
||||||
log.info(u'initialise plugins')
|
log.info(u'initialise plugins')
|
||||||
self.pluginManager.initialise_plugins()
|
self.plugin_manager.initialise_plugins()
|
||||||
# Create the displays as all necessary components are loaded.
|
# Create the displays as all necessary components are loaded.
|
||||||
self.previewController.screenSizeChanged()
|
self.previewController.screenSizeChanged()
|
||||||
self.liveController.screenSizeChanged()
|
self.liveController.screenSizeChanged()
|
||||||
|
@ -587,7 +585,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
||||||
# Hide/show the theme combobox on the service manager
|
# Hide/show the theme combobox on the service manager
|
||||||
self.serviceManagerContents.theme_change()
|
self.serviceManagerContents.theme_change()
|
||||||
# Reset the cursor
|
# Reset the cursor
|
||||||
Receiver.send_message(u'cursor_normal')
|
self.application.set_normal_cursor()
|
||||||
|
|
||||||
def setAutoLanguage(self, value):
|
def setAutoLanguage(self, value):
|
||||||
"""
|
"""
|
||||||
|
@ -648,22 +646,22 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
||||||
"""
|
"""
|
||||||
Give all the plugins a chance to perform some tasks at startup
|
Give all the plugins a chance to perform some tasks at startup
|
||||||
"""
|
"""
|
||||||
Receiver.send_message(u'openlp_process_events')
|
self.application.process_events()
|
||||||
for plugin in self.pluginManager.plugins:
|
for plugin in self.plugin_manager.plugins:
|
||||||
if plugin.isActive():
|
if plugin.isActive():
|
||||||
plugin.app_startup()
|
plugin.app_startup()
|
||||||
Receiver.send_message(u'openlp_process_events')
|
self.application.process_events()
|
||||||
|
|
||||||
def first_time(self):
|
def first_time(self):
|
||||||
"""
|
"""
|
||||||
Import themes if first time
|
Import themes if first time
|
||||||
"""
|
"""
|
||||||
Receiver.send_message(u'openlp_process_events')
|
self.application.process_events()
|
||||||
for plugin in self.pluginManager.plugins:
|
for plugin in self.plugin_manager.plugins:
|
||||||
if hasattr(plugin, u'first_time'):
|
if hasattr(plugin, u'first_time'):
|
||||||
Receiver.send_message(u'openlp_process_events')
|
self.application.process_events()
|
||||||
plugin.first_time()
|
plugin.first_time()
|
||||||
Receiver.send_message(u'openlp_process_events')
|
self.application.process_events()
|
||||||
temp_dir = os.path.join(unicode(gettempdir()), u'openlp')
|
temp_dir = os.path.join(unicode(gettempdir()), u'openlp')
|
||||||
shutil.rmtree(temp_dir, True)
|
shutil.rmtree(temp_dir, True)
|
||||||
|
|
||||||
|
@ -684,14 +682,14 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
||||||
QtGui.QMessageBox.No)
|
QtGui.QMessageBox.No)
|
||||||
if answer == QtGui.QMessageBox.No:
|
if answer == QtGui.QMessageBox.No:
|
||||||
return
|
return
|
||||||
Receiver.send_message(u'cursor_busy')
|
|
||||||
screens = ScreenList()
|
screens = ScreenList()
|
||||||
first_run_wizard = FirstTimeForm(screens, self)
|
first_run_wizard = FirstTimeForm(screens, self)
|
||||||
first_run_wizard.exec_()
|
first_run_wizard.exec_()
|
||||||
if first_run_wizard.was_download_cancelled:
|
if first_run_wizard.was_download_cancelled:
|
||||||
return
|
return
|
||||||
|
self.application.set_busy_cursor()
|
||||||
self.first_time()
|
self.first_time()
|
||||||
for plugin in self.pluginManager.plugins:
|
for plugin in self.plugin_manager.plugins:
|
||||||
self.activePlugin = plugin
|
self.activePlugin = plugin
|
||||||
oldStatus = self.activePlugin.status
|
oldStatus = self.activePlugin.status
|
||||||
self.activePlugin.setStatus()
|
self.activePlugin.setStatus()
|
||||||
|
@ -701,12 +699,13 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
||||||
self.activePlugin.app_startup()
|
self.activePlugin.app_startup()
|
||||||
else:
|
else:
|
||||||
self.activePlugin.toggleStatus(PluginStatus.Inactive)
|
self.activePlugin.toggleStatus(PluginStatus.Inactive)
|
||||||
self.themeManagerContents.configUpdated()
|
self.themeManagerContents.config_updated()
|
||||||
self.themeManagerContents.load_themes(True)
|
self.themeManagerContents.load_themes(True)
|
||||||
Receiver.send_message(u'theme_update_global', self.themeManagerContents.global_theme)
|
Receiver.send_message(u'theme_update_global', self.themeManagerContents.global_theme)
|
||||||
# Check if any Bibles downloaded. If there are, they will be
|
# Check if any Bibles downloaded. If there are, they will be
|
||||||
# processed.
|
# processed.
|
||||||
Receiver.send_message(u'bibles_load_list', True)
|
Receiver.send_message(u'bibles_load_list', True)
|
||||||
|
self.application.set_normal_cursor()
|
||||||
|
|
||||||
def blankCheck(self):
|
def blankCheck(self):
|
||||||
"""
|
"""
|
||||||
|
@ -723,21 +722,21 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
||||||
"""
|
"""
|
||||||
Display an error message
|
Display an error message
|
||||||
"""
|
"""
|
||||||
Receiver.send_message(u'close_splash')
|
self.application.close_splash_screen()
|
||||||
QtGui.QMessageBox.critical(self, data[u'title'], data[u'message'])
|
QtGui.QMessageBox.critical(self, data[u'title'], data[u'message'])
|
||||||
|
|
||||||
def onWarningMessage(self, data):
|
def warning_message(self, message):
|
||||||
"""
|
"""
|
||||||
Display a warning message
|
Display a warning message
|
||||||
"""
|
"""
|
||||||
Receiver.send_message(u'close_splash')
|
self.application.close_splash_screen()
|
||||||
QtGui.QMessageBox.warning(self, data[u'title'], data[u'message'])
|
QtGui.QMessageBox.warning(self, message[u'title'], message[u'message'])
|
||||||
|
|
||||||
def onInformationMessage(self, data):
|
def onInformationMessage(self, data):
|
||||||
"""
|
"""
|
||||||
Display an informational message
|
Display an informational message
|
||||||
"""
|
"""
|
||||||
Receiver.send_message(u'close_splash')
|
self.application.close_splash_screen()
|
||||||
QtGui.QMessageBox.information(self, data[u'title'], data[u'message'])
|
QtGui.QMessageBox.information(self, data[u'title'], data[u'message'])
|
||||||
|
|
||||||
def onHelpWebSiteClicked(self):
|
def onHelpWebSiteClicked(self):
|
||||||
|
@ -841,10 +840,17 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
||||||
setting_sections.extend([self.headerSection])
|
setting_sections.extend([self.headerSection])
|
||||||
setting_sections.extend([u'crashreport'])
|
setting_sections.extend([u'crashreport'])
|
||||||
# Add plugin sections.
|
# Add plugin sections.
|
||||||
for plugin in self.pluginManager.plugins:
|
for plugin in self.plugin_manager.plugins:
|
||||||
setting_sections.extend([plugin.name])
|
setting_sections.extend([plugin.name])
|
||||||
|
# Copy the settings file to the tmp dir, because we do not want to change the original one.
|
||||||
|
temp_directory = os.path.join(unicode(gettempdir()), u'openlp')
|
||||||
|
check_directory_exists(temp_directory)
|
||||||
|
temp_config = os.path.join(temp_directory, os.path.basename(import_file_name))
|
||||||
|
shutil.copyfile(import_file_name, temp_config)
|
||||||
settings = Settings()
|
settings = Settings()
|
||||||
import_settings = Settings(import_file_name, Settings.IniFormat)
|
import_settings = Settings(temp_config, Settings.IniFormat)
|
||||||
|
# Remove/rename old settings to prepare the import.
|
||||||
|
import_settings.remove_obsolete_settings()
|
||||||
# Lets do a basic sanity check. If it contains this string we can
|
# Lets do a basic sanity check. If it contains this string we can
|
||||||
# assume it was created by OpenLP and so we'll load what we can
|
# assume it was created by OpenLP and so we'll load what we can
|
||||||
# from it, and just silently ignore anything we don't recognise
|
# from it, and just silently ignore anything we don't recognise
|
||||||
|
@ -904,7 +910,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
||||||
return
|
return
|
||||||
# Make sure it's a .conf file.
|
# Make sure it's a .conf file.
|
||||||
if not export_file_name.endswith(u'conf'):
|
if not export_file_name.endswith(u'conf'):
|
||||||
export_file_name = export_file_name + u'.conf'
|
export_file_name += u'.conf'
|
||||||
temp_file = os.path.join(unicode(gettempdir(),
|
temp_file = os.path.join(unicode(gettempdir(),
|
||||||
get_filesystem_encoding()), u'openlp', u'exportConf.tmp')
|
get_filesystem_encoding()), u'openlp', u'exportConf.tmp')
|
||||||
self.saveSettings()
|
self.saveSettings()
|
||||||
|
@ -918,7 +924,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
||||||
setting_sections.extend([self.themesSettingsSection])
|
setting_sections.extend([self.themesSettingsSection])
|
||||||
setting_sections.extend([self.displayTagsSection])
|
setting_sections.extend([self.displayTagsSection])
|
||||||
# Add plugin sections.
|
# Add plugin sections.
|
||||||
for plugin in self.pluginManager.plugins:
|
for plugin in self.plugin_manager.plugins:
|
||||||
setting_sections.extend([plugin.name])
|
setting_sections.extend([plugin.name])
|
||||||
# Delete old files if found.
|
# Delete old files if found.
|
||||||
if os.path.exists(temp_file):
|
if os.path.exists(temp_file):
|
||||||
|
@ -1003,14 +1009,14 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
||||||
renderer.
|
renderer.
|
||||||
"""
|
"""
|
||||||
log.debug(u'screenChanged')
|
log.debug(u'screenChanged')
|
||||||
Receiver.send_message(u'cursor_busy')
|
self.application.set_busy_cursor()
|
||||||
self.imageManager.update_display()
|
self.imageManager.update_display()
|
||||||
self.renderer.update_display()
|
self.renderer.update_display()
|
||||||
self.previewController.screenSizeChanged()
|
self.previewController.screenSizeChanged()
|
||||||
self.liveController.screenSizeChanged()
|
self.liveController.screenSizeChanged()
|
||||||
self.setFocus()
|
self.setFocus()
|
||||||
self.activateWindow()
|
self.activateWindow()
|
||||||
Receiver.send_message(u'cursor_normal')
|
self.application.set_normal_cursor()
|
||||||
|
|
||||||
def closeEvent(self, event):
|
def closeEvent(self, event):
|
||||||
"""
|
"""
|
||||||
|
@ -1070,7 +1076,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
||||||
Settings().setValue(u'advanced/current media plugin', self.mediaToolBox.currentIndex())
|
Settings().setValue(u'advanced/current media plugin', self.mediaToolBox.currentIndex())
|
||||||
# Call the cleanup method to shutdown plugins.
|
# Call the cleanup method to shutdown plugins.
|
||||||
log.info(u'cleanup plugins')
|
log.info(u'cleanup plugins')
|
||||||
self.pluginManager.finalise_plugins()
|
self.plugin_manager.finalise_plugins()
|
||||||
if save_settings:
|
if save_settings:
|
||||||
# Save settings
|
# Save settings
|
||||||
self.saveSettings()
|
self.saveSettings()
|
||||||
|
@ -1223,7 +1229,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
||||||
self.restoreState(settings.value(u'main window state'))
|
self.restoreState(settings.value(u'main window state'))
|
||||||
self.liveController.splitter.restoreState(settings.value(u'live splitter geometry'))
|
self.liveController.splitter.restoreState(settings.value(u'live splitter geometry'))
|
||||||
self.previewController.splitter.restoreState(settings.value(u'preview splitter geometry'))
|
self.previewController.splitter.restoreState(settings.value(u'preview splitter geometry'))
|
||||||
self.controlSplitter.restoreState(settings.value(u'mainwindow splitter geometry'))
|
self.controlSplitter.restoreState(settings.value(u'main window splitter geometry'))
|
||||||
settings.endGroup()
|
settings.endGroup()
|
||||||
|
|
||||||
def saveSettings(self):
|
def saveSettings(self):
|
||||||
|
@ -1244,7 +1250,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
||||||
settings.setValue(u'main window geometry', self.saveGeometry())
|
settings.setValue(u'main window geometry', self.saveGeometry())
|
||||||
settings.setValue(u'live splitter geometry', self.liveController.splitter.saveState())
|
settings.setValue(u'live splitter geometry', self.liveController.splitter.saveState())
|
||||||
settings.setValue(u'preview splitter geometry', self.previewController.splitter.saveState())
|
settings.setValue(u'preview splitter geometry', self.previewController.splitter.saveState())
|
||||||
settings.setValue(u'mainwindow splitter geometry', self.controlSplitter.saveState())
|
settings.setValue(u'main window splitter geometry', self.controlSplitter.saveState())
|
||||||
settings.endGroup()
|
settings.endGroup()
|
||||||
|
|
||||||
def updateRecentFilesMenu(self):
|
def updateRecentFilesMenu(self):
|
||||||
|
@ -1309,14 +1315,14 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
||||||
self.loadProgressBar.show()
|
self.loadProgressBar.show()
|
||||||
self.loadProgressBar.setMaximum(size)
|
self.loadProgressBar.setMaximum(size)
|
||||||
self.loadProgressBar.setValue(0)
|
self.loadProgressBar.setValue(0)
|
||||||
Receiver.send_message(u'openlp_process_events')
|
self.application.process_events()
|
||||||
|
|
||||||
def incrementProgressBar(self):
|
def incrementProgressBar(self):
|
||||||
"""
|
"""
|
||||||
Increase the Progress Bar value by 1
|
Increase the Progress Bar value by 1
|
||||||
"""
|
"""
|
||||||
self.loadProgressBar.setValue(self.loadProgressBar.value() + 1)
|
self.loadProgressBar.setValue(self.loadProgressBar.value() + 1)
|
||||||
Receiver.send_message(u'openlp_process_events')
|
self.application.process_events()
|
||||||
|
|
||||||
def finishedProgressBar(self):
|
def finishedProgressBar(self):
|
||||||
"""
|
"""
|
||||||
|
@ -1331,7 +1337,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
||||||
if event.timerId() == self.timer_id:
|
if event.timerId() == self.timer_id:
|
||||||
self.timer_id = 0
|
self.timer_id = 0
|
||||||
self.loadProgressBar.hide()
|
self.loadProgressBar.hide()
|
||||||
Receiver.send_message(u'openlp_process_events')
|
self.application.process_events()
|
||||||
|
|
||||||
def setNewDataPath(self, new_data_path):
|
def setNewDataPath(self, new_data_path):
|
||||||
"""
|
"""
|
||||||
|
@ -1352,23 +1358,22 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
||||||
log.info(u'Changing data path to %s' % self.newDataPath)
|
log.info(u'Changing data path to %s' % self.newDataPath)
|
||||||
old_data_path = unicode(AppLocation.get_data_path())
|
old_data_path = unicode(AppLocation.get_data_path())
|
||||||
# Copy OpenLP data to new location if requested.
|
# Copy OpenLP data to new location if requested.
|
||||||
|
self.application.set_busy_cursor()
|
||||||
if self.copyData:
|
if self.copyData:
|
||||||
log.info(u'Copying data to new path')
|
log.info(u'Copying data to new path')
|
||||||
try:
|
try:
|
||||||
Receiver.send_message(u'openlp_process_events')
|
|
||||||
Receiver.send_message(u'cursor_busy')
|
|
||||||
self.showStatusMessage(
|
self.showStatusMessage(
|
||||||
translate('OpenLP.MainWindow', 'Copying OpenLP data to new data directory location - %s '
|
translate('OpenLP.MainWindow', 'Copying OpenLP data to new data directory location - %s '
|
||||||
'- Please wait for copy to finish').replace('%s', self.newDataPath))
|
'- Please wait for copy to finish').replace('%s', self.newDataPath))
|
||||||
dir_util.copy_tree(old_data_path, self.newDataPath)
|
dir_util.copy_tree(old_data_path, self.newDataPath)
|
||||||
log.info(u'Copy sucessful')
|
log.info(u'Copy sucessful')
|
||||||
except (IOError, os.error, DistutilsFileError), why:
|
except (IOError, os.error, DistutilsFileError), why:
|
||||||
Receiver.send_message(u'cursor_normal')
|
self.application.set_normal_cursor()
|
||||||
log.exception(u'Data copy failed %s' % unicode(why))
|
log.exception(u'Data copy failed %s' % unicode(why))
|
||||||
QtGui.QMessageBox.critical(self, translate('OpenLP.MainWindow', 'New Data Directory Error'),
|
QtGui.QMessageBox.critical(self, translate('OpenLP.MainWindow', 'New Data Directory Error'),
|
||||||
translate('OpenLP.MainWindow',
|
translate('OpenLP.MainWindow',
|
||||||
'OpenLP Data directory copy failed\n\n%s').replace('%s', unicode(why)),
|
'OpenLP Data directory copy failed\n\n%s').replace('%s', unicode(why)),
|
||||||
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
|
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
|
||||||
return False
|
return False
|
||||||
else:
|
else:
|
||||||
log.info(u'No data copy requested')
|
log.info(u'No data copy requested')
|
||||||
|
@ -1378,3 +1383,14 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
||||||
# Check if the new data path is our default.
|
# Check if the new data path is our default.
|
||||||
if self.newDataPath == AppLocation.get_directory(AppLocation.DataDir):
|
if self.newDataPath == AppLocation.get_directory(AppLocation.DataDir):
|
||||||
settings.remove(u'advanced/data path')
|
settings.remove(u'advanced/data path')
|
||||||
|
self.application.set_normal_cursor()
|
||||||
|
|
||||||
|
def _get_application(self):
|
||||||
|
"""
|
||||||
|
Adds the openlp to the class dynamically
|
||||||
|
"""
|
||||||
|
if not hasattr(self, u'_application'):
|
||||||
|
self._application = Registry().get(u'application')
|
||||||
|
return self._application
|
||||||
|
|
||||||
|
application = property(_get_application)
|
||||||
|
|
|
@ -35,7 +35,7 @@ import os
|
||||||
import datetime
|
import datetime
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
from openlp.core.lib import OpenLPToolbar, Receiver, translate, Settings, Registry, UiStrings
|
from openlp.core.lib import OpenLPToolbar, Receiver, Settings, Registry, UiStrings, translate
|
||||||
from openlp.core.lib.ui import critical_error_message_box
|
from openlp.core.lib.ui import critical_error_message_box
|
||||||
from openlp.core.ui.media import MediaState, MediaInfo, MediaType, get_media_players, set_media_players
|
from openlp.core.ui.media import MediaState, MediaInfo, MediaType, get_media_players, set_media_players
|
||||||
from openlp.core.ui.media.mediaplayer import MediaPlayer
|
from openlp.core.ui.media.mediaplayer import MediaPlayer
|
||||||
|
@ -750,4 +750,4 @@ class MediaController(object):
|
||||||
self._service_manager = Registry().get(u'service_manager')
|
self._service_manager = Registry().get(u'service_manager')
|
||||||
return self._service_manager
|
return self._service_manager
|
||||||
|
|
||||||
service_manager = property(_get_service_manager)
|
service_manager = property(_get_service_manager)
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
"""
|
"""
|
||||||
The :mod:`~openlp.core.ui.media.mediaplayer` module contains the MediaPlayer class.
|
The :mod:`~openlp.core.ui.media.mediaplayer` module contains the MediaPlayer class.
|
||||||
"""
|
"""
|
||||||
|
from openlp.core.lib import Registry
|
||||||
from openlp.core.ui.media import MediaState
|
from openlp.core.ui.media import MediaState
|
||||||
|
|
||||||
|
|
||||||
|
@ -149,3 +150,13 @@ class MediaPlayer(object):
|
||||||
Returns Information about the player
|
Returns Information about the player
|
||||||
"""
|
"""
|
||||||
return u''
|
return u''
|
||||||
|
|
||||||
|
def _get_application(self):
|
||||||
|
"""
|
||||||
|
Adds the openlp to the class dynamically
|
||||||
|
"""
|
||||||
|
if not hasattr(self, u'_application'):
|
||||||
|
self._application = Registry().get(u'application')
|
||||||
|
return self._application
|
||||||
|
|
||||||
|
application = property(_get_application)
|
|
@ -36,7 +36,7 @@ from datetime import datetime
|
||||||
from PyQt4 import QtGui
|
from PyQt4 import QtGui
|
||||||
from PyQt4.phonon import Phonon
|
from PyQt4.phonon import Phonon
|
||||||
|
|
||||||
from openlp.core.lib import Receiver, translate, Settings
|
from openlp.core.lib import Settings, translate
|
||||||
|
|
||||||
from openlp.core.ui.media import MediaState
|
from openlp.core.ui.media import MediaState
|
||||||
from openlp.core.ui.media.mediaplayer import MediaPlayer
|
from openlp.core.ui.media.mediaplayer import MediaPlayer
|
||||||
|
@ -168,7 +168,7 @@ class PhononPlayer(MediaPlayer):
|
||||||
current_state = display.mediaObject.state()
|
current_state = display.mediaObject.state()
|
||||||
if current_state == Phonon.ErrorState:
|
if current_state == Phonon.ErrorState:
|
||||||
return False
|
return False
|
||||||
Receiver.send_message(u'openlp_process_events')
|
self.application.process_events()
|
||||||
if (datetime.now() - start).seconds > 5:
|
if (datetime.now() - start).seconds > 5:
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
|
@ -31,7 +31,7 @@ The :mod:`~openlp.core.ui.media.playertab` module holds the configuration tab fo
|
||||||
"""
|
"""
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
from openlp.core.lib import SettingsTab, translate, Receiver, Settings, UiStrings
|
from openlp.core.lib import SettingsTab, Receiver, Settings, UiStrings, translate
|
||||||
from openlp.core.lib.ui import create_button
|
from openlp.core.lib.ui import create_button
|
||||||
from openlp.core.ui.media import get_media_players, set_media_players
|
from openlp.core.ui.media import get_media_players, set_media_players
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@ import sys
|
||||||
|
|
||||||
from PyQt4 import QtGui
|
from PyQt4 import QtGui
|
||||||
|
|
||||||
from openlp.core.lib import Receiver, translate, Settings
|
from openlp.core.lib import Settings, translate
|
||||||
from openlp.core.ui.media import MediaState
|
from openlp.core.ui.media import MediaState
|
||||||
from openlp.core.ui.media.mediaplayer import MediaPlayer
|
from openlp.core.ui.media.mediaplayer import MediaPlayer
|
||||||
|
|
||||||
|
@ -187,7 +187,7 @@ class VlcPlayer(MediaPlayer):
|
||||||
while not mediaState == display.vlcMedia.get_state():
|
while not mediaState == display.vlcMedia.get_state():
|
||||||
if display.vlcMedia.get_state() == vlc.State.Error:
|
if display.vlcMedia.get_state() == vlc.State.Error:
|
||||||
return False
|
return False
|
||||||
Receiver.send_message(u'openlp_process_events')
|
self.application.process_events()
|
||||||
if (datetime.now() - start).seconds > 60:
|
if (datetime.now() - start).seconds > 60:
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
|
@ -33,7 +33,7 @@ from PyQt4 import QtGui
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from openlp.core.lib import translate, Settings
|
from openlp.core.lib import Settings, translate
|
||||||
from openlp.core.ui.media import MediaState
|
from openlp.core.ui.media import MediaState
|
||||||
from openlp.core.ui.media.mediaplayer import MediaPlayer
|
from openlp.core.ui.media.mediaplayer import MediaPlayer
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ The UI widgets of the plugin view dialog
|
||||||
#"""
|
#"""
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
from openlp.core.lib import translate, UiStrings
|
from openlp.core.lib import UiStrings, translate
|
||||||
from openlp.core.lib.ui import create_button_box
|
from openlp.core.lib.ui import create_button_box
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ import logging
|
||||||
|
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
from openlp.core.lib import PluginStatus, Receiver, translate
|
from openlp.core.lib import PluginStatus, Registry, translate
|
||||||
from plugindialog import Ui_PluginViewDialog
|
from plugindialog import Ui_PluginViewDialog
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
@ -68,7 +68,7 @@ class PluginForm(QtGui.QDialog, Ui_PluginViewDialog):
|
||||||
self._clearDetails()
|
self._clearDetails()
|
||||||
self.programaticChange = True
|
self.programaticChange = True
|
||||||
pluginListWidth = 0
|
pluginListWidth = 0
|
||||||
for plugin in self.parent().pluginManager.plugins:
|
for plugin in self.plugin_manager.plugins:
|
||||||
item = QtGui.QListWidgetItem(self.pluginListWidget)
|
item = QtGui.QListWidgetItem(self.pluginListWidget)
|
||||||
# We do this just to make 100% sure the status is an integer as
|
# We do this just to make 100% sure the status is an integer as
|
||||||
# sometimes when it's loaded from the config, it isn't cast to int.
|
# sometimes when it's loaded from the config, it isn't cast to int.
|
||||||
|
@ -121,10 +121,9 @@ class PluginForm(QtGui.QDialog, Ui_PluginViewDialog):
|
||||||
if self.pluginListWidget.currentItem() is None:
|
if self.pluginListWidget.currentItem() is None:
|
||||||
self._clearDetails()
|
self._clearDetails()
|
||||||
return
|
return
|
||||||
plugin_name_singular = \
|
plugin_name_singular = self.pluginListWidget.currentItem().text().split(u'(')[0][:-1]
|
||||||
self.pluginListWidget.currentItem().text().split(u'(')[0][:-1]
|
|
||||||
self.activePlugin = None
|
self.activePlugin = None
|
||||||
for plugin in self.parent().pluginManager.plugins:
|
for plugin in self.plugin_manager.plugins:
|
||||||
if plugin.status != PluginStatus.Disabled:
|
if plugin.status != PluginStatus.Disabled:
|
||||||
if plugin.nameStrings[u'singular'] == plugin_name_singular:
|
if plugin.nameStrings[u'singular'] == plugin_name_singular:
|
||||||
self.activePlugin = plugin
|
self.activePlugin = plugin
|
||||||
|
@ -141,9 +140,9 @@ class PluginForm(QtGui.QDialog, Ui_PluginViewDialog):
|
||||||
if self.programaticChange or status == PluginStatus.Disabled:
|
if self.programaticChange or status == PluginStatus.Disabled:
|
||||||
return
|
return
|
||||||
if status == PluginStatus.Inactive:
|
if status == PluginStatus.Inactive:
|
||||||
Receiver.send_message(u'cursor_busy')
|
self.application.set_busy_cursor()
|
||||||
self.activePlugin.toggleStatus(PluginStatus.Active)
|
self.activePlugin.toggleStatus(PluginStatus.Active)
|
||||||
Receiver.send_message(u'cursor_normal')
|
self.application.set_normal_cursor()
|
||||||
self.activePlugin.app_startup()
|
self.activePlugin.app_startup()
|
||||||
else:
|
else:
|
||||||
self.activePlugin.toggleStatus(PluginStatus.Inactive)
|
self.activePlugin.toggleStatus(PluginStatus.Inactive)
|
||||||
|
@ -156,3 +155,23 @@ class PluginForm(QtGui.QDialog, Ui_PluginViewDialog):
|
||||||
status_text = translate('OpenLP.PluginForm', '%s (Disabled)')
|
status_text = translate('OpenLP.PluginForm', '%s (Disabled)')
|
||||||
self.pluginListWidget.currentItem().setText(
|
self.pluginListWidget.currentItem().setText(
|
||||||
status_text % self.activePlugin.nameStrings[u'singular'])
|
status_text % self.activePlugin.nameStrings[u'singular'])
|
||||||
|
|
||||||
|
def _get_plugin_manager(self):
|
||||||
|
"""
|
||||||
|
Adds the plugin manager to the class dynamically
|
||||||
|
"""
|
||||||
|
if not hasattr(self, u'_plugin_manager'):
|
||||||
|
self._plugin_manager = Registry().get(u'plugin_manager')
|
||||||
|
return self._plugin_manager
|
||||||
|
|
||||||
|
plugin_manager = property(_get_plugin_manager)
|
||||||
|
|
||||||
|
def _get_application(self):
|
||||||
|
"""
|
||||||
|
Adds the openlp to the class dynamically
|
||||||
|
"""
|
||||||
|
if not hasattr(self, u'_application'):
|
||||||
|
self._application = Registry().get(u'application')
|
||||||
|
return self._application
|
||||||
|
|
||||||
|
application = property(_get_application)
|
||||||
|
|
|
@ -31,7 +31,7 @@ The UI widgets of the print service dialog.
|
||||||
"""
|
"""
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
from openlp.core.lib import build_icon, translate, SpellTextEdit, UiStrings
|
from openlp.core.lib import SpellTextEdit, UiStrings, build_icon, translate
|
||||||
|
|
||||||
|
|
||||||
class ZoomSize(object):
|
class ZoomSize(object):
|
||||||
|
|
|
@ -36,7 +36,7 @@ import os
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
from lxml import html
|
from lxml import html
|
||||||
|
|
||||||
from openlp.core.lib import translate, get_text_file_string, Receiver, Settings, UiStrings, Registry
|
from openlp.core.lib import Receiver, Settings, UiStrings, Registry, translate, get_text_file_string
|
||||||
from openlp.core.ui.printservicedialog import Ui_PrintServiceDialog, ZoomSize
|
from openlp.core.ui.printservicedialog import Ui_PrintServiceDialog, ZoomSize
|
||||||
from openlp.core.utils import AppLocation
|
from openlp.core.utils import AppLocation
|
||||||
|
|
||||||
|
@ -178,7 +178,7 @@ class PrintServiceForm(QtGui.QDialog, Ui_PrintServiceDialog):
|
||||||
self._addElement(u'body', parent=html_data)
|
self._addElement(u'body', parent=html_data)
|
||||||
self._addElement(u'h1', cgi.escape(self.titleLineEdit.text()),
|
self._addElement(u'h1', cgi.escape(self.titleLineEdit.text()),
|
||||||
html_data.body, classId=u'serviceTitle')
|
html_data.body, classId=u'serviceTitle')
|
||||||
for index, item in enumerate(self.service_manager.serviceItems):
|
for index, item in enumerate(self.service_manager.service_items):
|
||||||
self._addPreviewItem(html_data.body, item[u'service_item'], index)
|
self._addPreviewItem(html_data.body, item[u'service_item'], index)
|
||||||
# Add the custom service notes:
|
# Add the custom service notes:
|
||||||
if self.footerTextEdit.toPlainText():
|
if self.footerTextEdit.toPlainText():
|
||||||
|
@ -428,4 +428,4 @@ class PrintServiceForm(QtGui.QDialog, Ui_PrintServiceDialog):
|
||||||
self._main_window = Registry().get(u'main_window')
|
self._main_window = Registry().get(u'main_window')
|
||||||
return self._main_window
|
return self._main_window
|
||||||
|
|
||||||
main_window = property(_get_main_window)
|
main_window = property(_get_main_window)
|
||||||
|
|
|
@ -42,8 +42,8 @@ log = logging.getLogger(__name__)
|
||||||
|
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
from openlp.core.lib import OpenLPToolbar, ServiceItem, Receiver, build_icon, ItemCapabilities, SettingsManager, \
|
from openlp.core.lib import OpenLPToolbar, ServiceItem, Receiver, ItemCapabilities, Settings, PluginStatus, Registry, \
|
||||||
translate, str_to_bool, check_directory_exists, Settings, PluginStatus, Registry, UiStrings
|
UiStrings, build_icon, translate, str_to_bool, check_directory_exists
|
||||||
from openlp.core.lib.theme import ThemeLevel
|
from openlp.core.lib.theme import ThemeLevel
|
||||||
from openlp.core.lib.ui import critical_error_message_box, create_widget_action, find_and_set_in_combo_box
|
from openlp.core.lib.ui import critical_error_message_box, create_widget_action, find_and_set_in_combo_box
|
||||||
from openlp.core.ui import ServiceNoteForm, ServiceItemEditForm, StartTimeForm
|
from openlp.core.ui import ServiceNoteForm, ServiceItemEditForm, StartTimeForm
|
||||||
|
@ -211,18 +211,10 @@ class ServiceManagerDialog(object):
|
||||||
QtCore.QObject.connect(self.service_manager_list, QtCore.SIGNAL(u'itemExpanded(QTreeWidgetItem*)'),
|
QtCore.QObject.connect(self.service_manager_list, QtCore.SIGNAL(u'itemExpanded(QTreeWidgetItem*)'),
|
||||||
self.expanded)
|
self.expanded)
|
||||||
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'theme_update_list'), self.update_theme_list)
|
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'theme_update_list'), self.update_theme_list)
|
||||||
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'servicemanager_preview_live'),
|
|
||||||
self.preview_live)
|
|
||||||
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'servicemanager_next_item'), self.next_item)
|
|
||||||
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'servicemanager_previous_item'),
|
|
||||||
self.previous_item)
|
|
||||||
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'servicemanager_set_item'), self.on_set_item)
|
|
||||||
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'config_updated'), self.config_updated)
|
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'config_updated'), self.config_updated)
|
||||||
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'config_screen_changed'),
|
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'config_screen_changed'),
|
||||||
self.regenerate_service_Items)
|
self.regenerate_service_Items)
|
||||||
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'theme_update_global'), self.theme_change)
|
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'theme_update_global'), self.theme_change)
|
||||||
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'service_item_update'),
|
|
||||||
self.service_item_update)
|
|
||||||
# Last little bits of setting up
|
# Last little bits of setting up
|
||||||
self.service_theme = Settings().value(self.main_window.serviceManagerSettingsSection + u'/service theme')
|
self.service_theme = Settings().value(self.main_window.serviceManagerSettingsSection + u'/service theme')
|
||||||
self.servicePath = AppLocation.get_section_data_path(u'servicemanager')
|
self.servicePath = AppLocation.get_section_data_path(u'servicemanager')
|
||||||
|
@ -458,7 +450,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
|
||||||
self.service_id += 1
|
self.service_id += 1
|
||||||
self.set_modified(False)
|
self.set_modified(False)
|
||||||
Settings().setValue(u'servicemanager/last file', u'')
|
Settings().setValue(u'servicemanager/last file', u'')
|
||||||
Receiver.send_message(u'servicemanager_new_service')
|
self.plugin_manager.new_service_created()
|
||||||
|
|
||||||
def save_file(self):
|
def save_file(self):
|
||||||
"""
|
"""
|
||||||
|
@ -486,7 +478,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
|
||||||
missing_list = []
|
missing_list = []
|
||||||
audio_files = []
|
audio_files = []
|
||||||
total_size = 0
|
total_size = 0
|
||||||
Receiver.send_message(u'cursor_busy')
|
self.application.set_busy_cursor()
|
||||||
# Number of items + 1 to zip it
|
# Number of items + 1 to zip it
|
||||||
self.main_window.displayProgressBar(len(self.service_items) + 1)
|
self.main_window.displayProgressBar(len(self.service_items) + 1)
|
||||||
# Get list of missing files, and list of files to write
|
# Get list of missing files, and list of files to write
|
||||||
|
@ -502,7 +494,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
|
||||||
else:
|
else:
|
||||||
write_list.append(path_from)
|
write_list.append(path_from)
|
||||||
if missing_list:
|
if missing_list:
|
||||||
Receiver.send_message(u'cursor_normal')
|
self.application.set_normal_cursor()
|
||||||
title = translate('OpenLP.ServiceManager', 'Service File(s) Missing')
|
title = translate('OpenLP.ServiceManager', 'Service File(s) Missing')
|
||||||
message = translate('OpenLP.ServiceManager',
|
message = translate('OpenLP.ServiceManager',
|
||||||
'The following file(s) in the service are missing:\n\t%s\n\n'
|
'The following file(s) in the service are missing:\n\t%s\n\n'
|
||||||
|
@ -512,7 +504,6 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
|
||||||
if answer == QtGui.QMessageBox.Cancel:
|
if answer == QtGui.QMessageBox.Cancel:
|
||||||
self.main_window.finishedProgressBar()
|
self.main_window.finishedProgressBar()
|
||||||
return False
|
return False
|
||||||
Receiver.send_message(u'cursor_busy')
|
|
||||||
# Check if item contains a missing file.
|
# Check if item contains a missing file.
|
||||||
for item in list(self.service_items):
|
for item in list(self.service_items):
|
||||||
self.main_window.incrementProgressBar()
|
self.main_window.incrementProgressBar()
|
||||||
|
@ -573,7 +564,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
|
||||||
if zip_file:
|
if zip_file:
|
||||||
zip_file.close()
|
zip_file.close()
|
||||||
self.main_window.finishedProgressBar()
|
self.main_window.finishedProgressBar()
|
||||||
Receiver.send_message(u'cursor_normal')
|
self.application.set_normal_cursor()
|
||||||
if success:
|
if success:
|
||||||
try:
|
try:
|
||||||
shutil.copy(temp_file_name, path_file_name)
|
shutil.copy(temp_file_name, path_file_name)
|
||||||
|
@ -602,7 +593,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
|
||||||
log.debug(u'ServiceManager.save_file - %s', path_file_name)
|
log.debug(u'ServiceManager.save_file - %s', path_file_name)
|
||||||
Settings().setValue(self.main_window.serviceManagerSettingsSection + u'/last directory', path)
|
Settings().setValue(self.main_window.serviceManagerSettingsSection + u'/last directory', path)
|
||||||
service = []
|
service = []
|
||||||
Receiver.send_message(u'cursor_busy')
|
self.application.set_busy_cursor()
|
||||||
# Number of items + 1 to zip it
|
# Number of items + 1 to zip it
|
||||||
self.main_window.displayProgressBar(len(self.service_items) + 1)
|
self.main_window.displayProgressBar(len(self.service_items) + 1)
|
||||||
for item in self.service_items:
|
for item in self.service_items:
|
||||||
|
@ -631,7 +622,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
|
||||||
if zip_file:
|
if zip_file:
|
||||||
zip_file.close()
|
zip_file.close()
|
||||||
self.main_window.finishedProgressBar()
|
self.main_window.finishedProgressBar()
|
||||||
Receiver.send_message(u'cursor_normal')
|
self.application.set_normal_cursor()
|
||||||
if success:
|
if success:
|
||||||
try:
|
try:
|
||||||
shutil.copy(temp_file_name, path_file_name)
|
shutil.copy(temp_file_name, path_file_name)
|
||||||
|
@ -670,11 +661,11 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
|
||||||
# SaveAs from osz to oszl is not valid as the files will be deleted
|
# SaveAs from osz to oszl is not valid as the files will be deleted
|
||||||
# on exit which is not sensible or usable in the long term.
|
# on exit which is not sensible or usable in the long term.
|
||||||
if self._file_name.endswith(u'oszl') or self.service_has_all_original_files:
|
if self._file_name.endswith(u'oszl') or self.service_has_all_original_files:
|
||||||
file_name = QtGui.QFileDialog.getSavefile_name(self.main_window, UiStrings().SaveService, path,
|
file_name = QtGui.QFileDialog.getSaveFileName(self.main_window, UiStrings().SaveService, path,
|
||||||
translate('OpenLP.ServiceManager',
|
translate('OpenLP.ServiceManager',
|
||||||
'OpenLP Service Files (*.osz);; OpenLP Service Files - lite (*.oszl)'))
|
'OpenLP Service Files (*.osz);; OpenLP Service Files - lite (*.oszl)'))
|
||||||
else:
|
else:
|
||||||
file_name = QtGui.QFileDialog.getSavefile_name(self.main_window, UiStrings().SaveService, path,
|
file_name = QtGui.QFileDialog.getSaveFileName(self.main_window, UiStrings().SaveService, path,
|
||||||
translate('OpenLP.ServiceManager', 'OpenLP Service Files (*.osz);;'))
|
translate('OpenLP.ServiceManager', 'OpenLP Service Files (*.osz);;'))
|
||||||
if not file_name:
|
if not file_name:
|
||||||
return False
|
return False
|
||||||
|
@ -708,6 +699,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
|
||||||
return False
|
return False
|
||||||
zip_file = None
|
zip_file = None
|
||||||
file_to = None
|
file_to = None
|
||||||
|
self.application.set_busy_cursor()
|
||||||
try:
|
try:
|
||||||
zip_file = zipfile.ZipFile(file_name)
|
zip_file = zipfile.ZipFile(file_name)
|
||||||
for zip_info in zip_file.infolist():
|
for zip_info in zip_file.infolist():
|
||||||
|
@ -728,7 +720,6 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
|
||||||
if osfile.endswith(u'osd'):
|
if osfile.endswith(u'osd'):
|
||||||
p_file = os.path.join(self.servicePath, osfile)
|
p_file = os.path.join(self.servicePath, osfile)
|
||||||
if 'p_file' in locals():
|
if 'p_file' in locals():
|
||||||
Receiver.send_message(u'cursor_busy')
|
|
||||||
file_to = open(p_file, u'r')
|
file_to = open(p_file, u'r')
|
||||||
items = cPickle.load(file_to)
|
items = cPickle.load(file_to)
|
||||||
file_to.close()
|
file_to.close()
|
||||||
|
@ -773,6 +764,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
|
||||||
QtGui.QMessageBox.information(self, translate('OpenLP.ServiceManager', 'Corrupt File'),
|
QtGui.QMessageBox.information(self, translate('OpenLP.ServiceManager', 'Corrupt File'),
|
||||||
translate('OpenLP.ServiceManager',
|
translate('OpenLP.ServiceManager',
|
||||||
'This file is either corrupt or it is not an OpenLP 2 service file.'))
|
'This file is either corrupt or it is not an OpenLP 2 service file.'))
|
||||||
|
self.application.set_normal_cursor()
|
||||||
return
|
return
|
||||||
finally:
|
finally:
|
||||||
if file_to:
|
if file_to:
|
||||||
|
@ -780,7 +772,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
|
||||||
if zip_file:
|
if zip_file:
|
||||||
zip_file.close()
|
zip_file.close()
|
||||||
self.main_window.finishedProgressBar()
|
self.main_window.finishedProgressBar()
|
||||||
Receiver.send_message(u'cursor_normal')
|
self.application.set_normal_cursor()
|
||||||
self.repaint_service_list(-1, -1)
|
self.repaint_service_list(-1, -1)
|
||||||
|
|
||||||
def load_Last_file(self):
|
def load_Last_file(self):
|
||||||
|
@ -952,12 +944,20 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
|
||||||
self.add_service_item(self.serviceItemEditForm.get_service_item(),
|
self.add_service_item(self.serviceItemEditForm.get_service_item(),
|
||||||
replace=True, expand=self.service_items[item][u'expanded'])
|
replace=True, expand=self.service_items[item][u'expanded'])
|
||||||
|
|
||||||
def preview_live(self, message):
|
def preview_live(self, unique_identifier, row):
|
||||||
"""
|
"""
|
||||||
Called by the SlideController to request a preview item be made live
|
Called by the SlideController to request a preview item be made live
|
||||||
and allows the next preview to be updated if relevant.
|
and allows the next preview to be updated if relevant.
|
||||||
|
|
||||||
|
|
||||||
|
``unique_identifier``
|
||||||
|
Reference to the service_item
|
||||||
|
|
||||||
|
|
||||||
|
``row``
|
||||||
|
individual row number
|
||||||
|
|
||||||
"""
|
"""
|
||||||
unique_identifier, row = message.split(u':')
|
|
||||||
for sitem in self.service_items:
|
for sitem in self.service_items:
|
||||||
if sitem[u'service_item'].unique_identifier == unique_identifier:
|
if sitem[u'service_item'].unique_identifier == unique_identifier:
|
||||||
item = self.service_manager_list.topLevelItem(sitem[u'order'] - 1)
|
item = self.service_manager_list.topLevelItem(sitem[u'order'] - 1)
|
||||||
|
@ -983,9 +983,13 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
|
||||||
lookFor = 1
|
lookFor = 1
|
||||||
serviceIterator += 1
|
serviceIterator += 1
|
||||||
|
|
||||||
def previous_item(self, message):
|
def previous_item(self, last_slide=False):
|
||||||
"""
|
"""
|
||||||
Called by the SlideController to select the previous service item.
|
Called by the SlideController to select the previous service item.
|
||||||
|
|
||||||
|
``last_slide``
|
||||||
|
Is this the last slide in the service_item
|
||||||
|
|
||||||
"""
|
"""
|
||||||
if not self.service_manager_list.selectedItems():
|
if not self.service_manager_list.selectedItems():
|
||||||
return
|
return
|
||||||
|
@ -995,7 +999,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
|
||||||
serviceIterator = QtGui.QTreeWidgetItemIterator(self.service_manager_list)
|
serviceIterator = QtGui.QTreeWidgetItemIterator(self.service_manager_list)
|
||||||
while serviceIterator.value():
|
while serviceIterator.value():
|
||||||
if serviceIterator.value() == selected:
|
if serviceIterator.value() == selected:
|
||||||
if message == u'last slide' and prevItemLastSlide:
|
if last_slide and prevItemLastSlide:
|
||||||
pos = prevItem.data(0, QtCore.Qt.UserRole)
|
pos = prevItem.data(0, QtCore.Qt.UserRole)
|
||||||
check_expanded = self.service_items[pos - 1][u'expanded']
|
check_expanded = self.service_items[pos - 1][u'expanded']
|
||||||
self.service_manager_list.setCurrentItem(prevItemLastSlide)
|
self.service_manager_list.setCurrentItem(prevItemLastSlide)
|
||||||
|
@ -1254,7 +1258,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
|
||||||
Rebuild the service list as things have changed and a
|
Rebuild the service list as things have changed and a
|
||||||
repaint is the easiest way to do this.
|
repaint is the easiest way to do this.
|
||||||
"""
|
"""
|
||||||
Receiver.send_message(u'cursor_busy')
|
self.application.set_busy_cursor()
|
||||||
log.debug(u'regenerate_service_Items')
|
log.debug(u'regenerate_service_Items')
|
||||||
# force reset of renderer as theme data has changed
|
# force reset of renderer as theme data has changed
|
||||||
self.service_has_all_original_files = True
|
self.service_has_all_original_files = True
|
||||||
|
@ -1286,14 +1290,14 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
|
||||||
self.set_modified()
|
self.set_modified()
|
||||||
# Repaint it once only at the end
|
# Repaint it once only at the end
|
||||||
self.repaint_service_list(-1, -1)
|
self.repaint_service_list(-1, -1)
|
||||||
Receiver.send_message(u'cursor_normal')
|
self.application.set_normal_cursor()
|
||||||
|
|
||||||
def service_item_update(self, message):
|
def service_item_update(self, edit_id, unique_identifier, temporary=False):
|
||||||
"""
|
"""
|
||||||
Triggered from plugins to update service items.
|
Triggered from plugins to update service items.
|
||||||
Save the values as they will be used as part of the service load
|
Save the values as they will be used as part of the service load
|
||||||
"""
|
"""
|
||||||
edit_id, self.load_item_unique_identifier, temporary = message.split(u':')
|
self.load_item_unique_identifier = unique_identifier
|
||||||
self.load_item_edit_id = int(edit_id)
|
self.load_item_edit_id = int(edit_id)
|
||||||
self.load_item_temporary = str_to_bool(temporary)
|
self.load_item_temporary = str_to_bool(temporary)
|
||||||
|
|
||||||
|
@ -1361,7 +1365,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
|
||||||
"""
|
"""
|
||||||
Send the current item to the Preview slide controller
|
Send the current item to the Preview slide controller
|
||||||
"""
|
"""
|
||||||
Receiver.send_message(u'cursor_busy')
|
self.application.set_busy_cursor()
|
||||||
item, child = self.find_service_item()
|
item, child = self.find_service_item()
|
||||||
if self.service_items[item][u'service_item'].is_valid:
|
if self.service_items[item][u'service_item'].is_valid:
|
||||||
self.preview_controller.addServiceManagerItem(self.service_items[item][u'service_item'], child)
|
self.preview_controller.addServiceManagerItem(self.service_items[item][u'service_item'], child)
|
||||||
|
@ -1369,7 +1373,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
|
||||||
critical_error_message_box(translate('OpenLP.ServiceManager', 'Missing Display Handler'),
|
critical_error_message_box(translate('OpenLP.ServiceManager', 'Missing Display Handler'),
|
||||||
translate('OpenLP.ServiceManager',
|
translate('OpenLP.ServiceManager',
|
||||||
'Your item cannot be displayed as there is no handler to display it'))
|
'Your item cannot be displayed as there is no handler to display it'))
|
||||||
Receiver.send_message(u'cursor_normal')
|
self.application.set_normal_cursor()
|
||||||
|
|
||||||
def get_service_item(self):
|
def get_service_item(self):
|
||||||
"""
|
"""
|
||||||
|
@ -1402,7 +1406,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
|
||||||
return
|
return
|
||||||
if row != -1:
|
if row != -1:
|
||||||
child = row
|
child = row
|
||||||
Receiver.send_message(u'cursor_busy')
|
self.application.set_busy_cursor()
|
||||||
if self.service_items[item][u'service_item'].is_valid:
|
if self.service_items[item][u'service_item'].is_valid:
|
||||||
self.live_controller.addServiceManagerItem(self.service_items[item][u'service_item'], child)
|
self.live_controller.addServiceManagerItem(self.service_items[item][u'service_item'], child)
|
||||||
if Settings().value(self.main_window.generalSettingsSection + u'/auto preview'):
|
if Settings().value(self.main_window.generalSettingsSection + u'/auto preview'):
|
||||||
|
@ -1417,7 +1421,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
|
||||||
critical_error_message_box(translate('OpenLP.ServiceManager', 'Missing Display Handler'),
|
critical_error_message_box(translate('OpenLP.ServiceManager', 'Missing Display Handler'),
|
||||||
translate('OpenLP.ServiceManager',
|
translate('OpenLP.ServiceManager',
|
||||||
'Your item cannot be displayed as the plugin required to display it is missing or inactive'))
|
'Your item cannot be displayed as the plugin required to display it is missing or inactive'))
|
||||||
Receiver.send_message(u'cursor_normal')
|
self.application.set_normal_cursor()
|
||||||
|
|
||||||
def remote_edit(self):
|
def remote_edit(self):
|
||||||
"""
|
"""
|
||||||
|
@ -1630,3 +1634,13 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
|
||||||
return self._main_window
|
return self._main_window
|
||||||
|
|
||||||
main_window = property(_get_main_window)
|
main_window = property(_get_main_window)
|
||||||
|
|
||||||
|
def _get_application(self):
|
||||||
|
"""
|
||||||
|
Adds the openlp to the class dynamically
|
||||||
|
"""
|
||||||
|
if not hasattr(self, u'_application'):
|
||||||
|
self._application = Registry().get(u'application')
|
||||||
|
return self._application
|
||||||
|
|
||||||
|
application = property(_get_application)
|
||||||
|
|
|
@ -31,7 +31,7 @@ The :mod:`~openlp.core.ui.servicenoteform` module contains the `ServiceNoteForm`
|
||||||
"""
|
"""
|
||||||
from PyQt4 import QtGui
|
from PyQt4 import QtGui
|
||||||
|
|
||||||
from openlp.core.lib import translate, SpellTextEdit, Registry
|
from openlp.core.lib import SpellTextEdit, Registry, translate
|
||||||
from openlp.core.lib.ui import create_button_box
|
from openlp.core.lib.ui import create_button_box
|
||||||
|
|
||||||
|
|
||||||
|
@ -83,4 +83,4 @@ class ServiceNoteForm(QtGui.QDialog):
|
||||||
self._main_window = Registry().get(u'main_window')
|
self._main_window = Registry().get(u'main_window')
|
||||||
return self._main_window
|
return self._main_window
|
||||||
|
|
||||||
main_window = property(_get_main_window)
|
main_window = property(_get_main_window)
|
||||||
|
|
|
@ -33,7 +33,7 @@ import logging
|
||||||
|
|
||||||
from PyQt4 import QtGui
|
from PyQt4 import QtGui
|
||||||
|
|
||||||
from openlp.core.lib import Receiver, build_icon, PluginStatus, Registry
|
from openlp.core.lib import Receiver, PluginStatus, Registry, build_icon
|
||||||
from openlp.core.ui import AdvancedTab, GeneralTab, ThemesTab
|
from openlp.core.ui import AdvancedTab, GeneralTab, ThemesTab
|
||||||
from openlp.core.ui.media import PlayerTab
|
from openlp.core.ui.media import PlayerTab
|
||||||
from settingsdialog import Ui_SettingsDialog
|
from settingsdialog import Ui_SettingsDialog
|
||||||
|
@ -165,4 +165,4 @@ class SettingsForm(QtGui.QDialog, Ui_SettingsDialog):
|
||||||
self._service_manager = Registry().get(u'service_manager')
|
self._service_manager = Registry().get(u'service_manager')
|
||||||
return self._service_manager
|
return self._service_manager
|
||||||
|
|
||||||
service_manager = property(_get_service_manager)
|
service_manager = property(_get_service_manager)
|
||||||
|
|
|
@ -33,7 +33,7 @@ import re
|
||||||
|
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
from openlp.core.lib import Receiver, Settings
|
from openlp.core.lib import Registry, Settings
|
||||||
from openlp.core.utils import translate
|
from openlp.core.utils import translate
|
||||||
from openlp.core.utils.actions import ActionList
|
from openlp.core.utils.actions import ActionList
|
||||||
from shortcutlistdialog import Ui_ShortcutListDialog
|
from shortcutlistdialog import Ui_ShortcutListDialog
|
||||||
|
@ -438,7 +438,7 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog):
|
||||||
if changing_action.shortcutContext() in [QtCore.Qt.WindowShortcut, QtCore.Qt.ApplicationShortcut]:
|
if changing_action.shortcutContext() in [QtCore.Qt.WindowShortcut, QtCore.Qt.ApplicationShortcut]:
|
||||||
is_valid = False
|
is_valid = False
|
||||||
if not is_valid:
|
if not is_valid:
|
||||||
Receiver.send_message(u'openlp_warning_message', {
|
self.main_window.warning_message( {
|
||||||
u'title': translate('OpenLP.ShortcutListDialog', 'Duplicate Shortcut'),
|
u'title': translate('OpenLP.ShortcutListDialog', 'Duplicate Shortcut'),
|
||||||
u'message': translate('OpenLP.ShortcutListDialog',
|
u'message': translate('OpenLP.ShortcutListDialog',
|
||||||
'The shortcut "%s" is already assigned to another action, '
|
'The shortcut "%s" is already assigned to another action, '
|
||||||
|
@ -478,3 +478,13 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog):
|
||||||
button.setChecked(checked)
|
button.setChecked(checked)
|
||||||
if enabled is not None:
|
if enabled is not None:
|
||||||
button.setEnabled(enabled)
|
button.setEnabled(enabled)
|
||||||
|
|
||||||
|
def _get_main_window(self):
|
||||||
|
"""
|
||||||
|
Adds the main window to the class dynamically
|
||||||
|
"""
|
||||||
|
if not hasattr(self, u'_main_window'):
|
||||||
|
self._main_window = Registry().get(u'main_window')
|
||||||
|
return self._main_window
|
||||||
|
|
||||||
|
main_window = property(_get_main_window)
|
|
@ -36,8 +36,8 @@ from collections import deque
|
||||||
|
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
from openlp.core.lib import OpenLPToolbar, Receiver, ItemCapabilities, translate, build_icon, build_html, \
|
from openlp.core.lib import OpenLPToolbar, Receiver, ItemCapabilities, ServiceItem, ImageSource, SlideLimits, \
|
||||||
ServiceItem, ImageSource, SlideLimits, ServiceItemAction, Settings, Registry, UiStrings, ScreenList
|
ServiceItemAction, Settings, Registry, UiStrings, ScreenList, build_icon, build_html, translate
|
||||||
from openlp.core.ui import HideMode, MainDisplay, Display, DisplayControllerType
|
from openlp.core.ui import HideMode, MainDisplay, Display, DisplayControllerType
|
||||||
from openlp.core.lib.ui import create_action
|
from openlp.core.lib.ui import create_action
|
||||||
from openlp.core.utils.actions import ActionList, CategoryOrder
|
from openlp.core.utils.actions import ActionList, CategoryOrder
|
||||||
|
@ -230,7 +230,7 @@ class SlideController(DisplayController):
|
||||||
self.playSlidesOnce = create_action(self, u'playSlidesOnce', text=UiStrings().PlaySlidesToEnd,
|
self.playSlidesOnce = create_action(self, u'playSlidesOnce', text=UiStrings().PlaySlidesToEnd,
|
||||||
icon=u':/media/media_time.png', checked=False, shortcuts=[],
|
icon=u':/media/media_time.png', checked=False, shortcuts=[],
|
||||||
category=self.category, triggers=self.onPlaySlidesOnce)
|
category=self.category, triggers=self.onPlaySlidesOnce)
|
||||||
if Settings().value(self.parent().generalSettingsSection + u'/enable slide loop'):
|
if Settings().value(self.parent().advancedSettingsSection + u'/slide limits') == SlideLimits.Wrap:
|
||||||
self.playSlidesMenu.setDefaultAction(self.playSlidesLoop)
|
self.playSlidesMenu.setDefaultAction(self.playSlidesLoop)
|
||||||
else:
|
else:
|
||||||
self.playSlidesMenu.setDefaultAction(self.playSlidesOnce)
|
self.playSlidesMenu.setDefaultAction(self.playSlidesOnce)
|
||||||
|
@ -518,12 +518,12 @@ class SlideController(DisplayController):
|
||||||
self.keypress_loop = True
|
self.keypress_loop = True
|
||||||
keypressCommand = self.keypress_queue.popleft()
|
keypressCommand = self.keypress_queue.popleft()
|
||||||
if keypressCommand == ServiceItemAction.Previous:
|
if keypressCommand == ServiceItemAction.Previous:
|
||||||
Receiver.send_message('servicemanager_previous_item')
|
self.service_manager.previous_item()
|
||||||
elif keypressCommand == ServiceItemAction.PreviousLastSlide:
|
elif keypressCommand == ServiceItemAction.PreviousLastSlide:
|
||||||
# Go to the last slide of the previous item
|
# Go to the last slide of the previous item
|
||||||
Receiver.send_message('servicemanager_previous_item', u'last slide')
|
self.service_manager.previous_item(last_slide=True)
|
||||||
else:
|
else:
|
||||||
Receiver.send_message('servicemanager_next_item')
|
self.service_manager.next_item()
|
||||||
self.keypress_loop = False
|
self.keypress_loop = False
|
||||||
|
|
||||||
def screenSizeChanged(self):
|
def screenSizeChanged(self):
|
||||||
|
@ -608,7 +608,7 @@ class SlideController(DisplayController):
|
||||||
elif width < 300 and not self.hideMenu.isVisible():
|
elif width < 300 and not self.hideMenu.isVisible():
|
||||||
self.toolbar.setWidgetVisible(self.wideMenu, False)
|
self.toolbar.setWidgetVisible(self.wideMenu, False)
|
||||||
self.toolbar.setWidgetVisible(self.hideMenuList)
|
self.toolbar.setWidgetVisible(self.hideMenuList)
|
||||||
|
|
||||||
def onSongBarHandler(self):
|
def onSongBarHandler(self):
|
||||||
"""
|
"""
|
||||||
Some song handler
|
Some song handler
|
||||||
|
@ -1271,8 +1271,7 @@ class SlideController(DisplayController):
|
||||||
row = self.previewListWidget.currentRow()
|
row = self.previewListWidget.currentRow()
|
||||||
if -1 < row < self.previewListWidget.rowCount():
|
if -1 < row < self.previewListWidget.rowCount():
|
||||||
if self.serviceItem.from_service:
|
if self.serviceItem.from_service:
|
||||||
Receiver.send_message('servicemanager_preview_live', u'%s:%s' %
|
self.service_manager.preview_live(self.serviceItem.unique_identifier, row)
|
||||||
(self.serviceItem.unique_identifier, row))
|
|
||||||
else:
|
else:
|
||||||
self.live_controller.addServiceManagerItem(self.serviceItem, row)
|
self.live_controller.addServiceManagerItem(self.serviceItem, row)
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,6 @@
|
||||||
"""
|
"""
|
||||||
The splash screen
|
The splash screen
|
||||||
"""
|
"""
|
||||||
from openlp.core.lib import Receiver
|
|
||||||
|
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
|
@ -44,7 +43,6 @@ class SplashScreen(QtGui.QSplashScreen):
|
||||||
"""
|
"""
|
||||||
QtGui.QSplashScreen.__init__(self)
|
QtGui.QSplashScreen.__init__(self)
|
||||||
self.setupUi()
|
self.setupUi()
|
||||||
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'close_splash'), self.close)
|
|
||||||
|
|
||||||
def setupUi(self):
|
def setupUi(self):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -31,7 +31,7 @@ The UI widgets for the time dialog
|
||||||
"""
|
"""
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
from openlp.core.lib import translate, UiStrings
|
from openlp.core.lib import UiStrings, translate
|
||||||
from openlp.core.lib.ui import create_button_box
|
from openlp.core.lib.ui import create_button_box
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ from PyQt4 import QtGui
|
||||||
|
|
||||||
from starttimedialog import Ui_StartTimeDialog
|
from starttimedialog import Ui_StartTimeDialog
|
||||||
|
|
||||||
from openlp.core.lib import translate, UiStrings, Registry
|
from openlp.core.lib import UiStrings, Registry, translate
|
||||||
from openlp.core.lib.ui import critical_error_message_box
|
from openlp.core.lib.ui import critical_error_message_box
|
||||||
|
|
||||||
|
|
||||||
|
@ -105,4 +105,4 @@ class StartTimeForm(QtGui.QDialog, Ui_StartTimeDialog):
|
||||||
self._main_window = Registry().get(u'main_window')
|
self._main_window = Registry().get(u'main_window')
|
||||||
return self._main_window
|
return self._main_window
|
||||||
|
|
||||||
main_window = property(_get_main_window)
|
main_window = property(_get_main_window)
|
||||||
|
|
|
@ -34,7 +34,7 @@ import os
|
||||||
|
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
from openlp.core.lib import Receiver, translate, UiStrings, Registry
|
from openlp.core.lib import Receiver, UiStrings, Registry, translate
|
||||||
from openlp.core.lib.theme import BackgroundType, BackgroundGradientType
|
from openlp.core.lib.theme import BackgroundType, BackgroundGradientType
|
||||||
from openlp.core.lib.ui import critical_error_message_box
|
from openlp.core.lib.ui import critical_error_message_box
|
||||||
from openlp.core.ui import ThemeLayoutForm
|
from openlp.core.ui import ThemeLayoutForm
|
||||||
|
|
|
@ -38,9 +38,9 @@ import re
|
||||||
from xml.etree.ElementTree import ElementTree, XML
|
from xml.etree.ElementTree import ElementTree, XML
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
from openlp.core.lib import OpenLPToolbar, get_text_file_string, build_icon, Receiver, SettingsManager, translate, \
|
from openlp.core.lib import ImageSource, OpenLPToolbar, Receiver, Registry, SettingsManager, Settings, UiStrings, \
|
||||||
check_item_selected, check_directory_exists, create_thumb, validate_thumb, ImageSource, Settings, Registry, \
|
get_text_file_string, build_icon, translate, check_item_selected, check_directory_exists, create_thumb, \
|
||||||
UiStrings
|
validate_thumb
|
||||||
from openlp.core.lib.theme import ThemeXML, BackgroundType, VerticalType, BackgroundGradientType
|
from openlp.core.lib.theme import ThemeXML, BackgroundType, VerticalType, BackgroundGradientType
|
||||||
from openlp.core.lib.ui import critical_error_message_box, create_widget_action
|
from openlp.core.lib.ui import critical_error_message_box, create_widget_action
|
||||||
from openlp.core.theme import Theme
|
from openlp.core.theme import Theme
|
||||||
|
@ -153,13 +153,14 @@ class ThemeManager(QtGui.QWidget):
|
||||||
"""
|
"""
|
||||||
Import new themes downloaded by the first time wizard
|
Import new themes downloaded by the first time wizard
|
||||||
"""
|
"""
|
||||||
Receiver.send_message(u'cursor_busy')
|
self.application.set_busy_cursor()
|
||||||
files = SettingsManager.get_files(self.settingsSection, u'.otz')
|
files = SettingsManager.get_files(self.settingsSection, u'.otz')
|
||||||
for theme_file in files:
|
for theme_file in files:
|
||||||
theme_file = os.path.join(self.path, theme_file)
|
theme_file = os.path.join(self.path, theme_file)
|
||||||
self.unzipTheme(theme_file, self.path)
|
self.unzip_theme(theme_file, self.path)
|
||||||
delete_file(theme_file)
|
delete_file(theme_file)
|
||||||
Receiver.send_message(u'cursor_normal')
|
self.application.set_normal_cursor()
|
||||||
|
|
||||||
|
|
||||||
def config_updated(self):
|
def config_updated(self):
|
||||||
"""
|
"""
|
||||||
|
@ -367,7 +368,7 @@ class ThemeManager(QtGui.QWidget):
|
||||||
path = QtGui.QFileDialog.getExistingDirectory(self,
|
path = QtGui.QFileDialog.getExistingDirectory(self,
|
||||||
translate('OpenLP.ThemeManager', 'Save Theme - (%s)') % theme,
|
translate('OpenLP.ThemeManager', 'Save Theme - (%s)') % theme,
|
||||||
Settings().value(self.settingsSection + u'/last directory export'))
|
Settings().value(self.settingsSection + u'/last directory export'))
|
||||||
Receiver.send_message(u'cursor_busy')
|
self.application.set_busy_cursor()
|
||||||
if path:
|
if path:
|
||||||
Settings().setValue(self.settingsSection + u'/last directory export', path)
|
Settings().setValue(self.settingsSection + u'/last directory export', path)
|
||||||
theme_path = os.path.join(path, theme + u'.otz')
|
theme_path = os.path.join(path, theme + u'.otz')
|
||||||
|
@ -391,7 +392,8 @@ class ThemeManager(QtGui.QWidget):
|
||||||
finally:
|
finally:
|
||||||
if theme_zip:
|
if theme_zip:
|
||||||
theme_zip.close()
|
theme_zip.close()
|
||||||
Receiver.send_message(u'cursor_normal')
|
self.application.set_normal_cursor()
|
||||||
|
|
||||||
|
|
||||||
def on_import_theme(self):
|
def on_import_theme(self):
|
||||||
"""
|
"""
|
||||||
|
@ -406,12 +408,12 @@ class ThemeManager(QtGui.QWidget):
|
||||||
log.info(u'New Themes %s', unicode(files))
|
log.info(u'New Themes %s', unicode(files))
|
||||||
if not files:
|
if not files:
|
||||||
return
|
return
|
||||||
Receiver.send_message(u'cursor_busy')
|
self.application.set_busy_cursor()
|
||||||
for file_name in files:
|
for file_name in files:
|
||||||
Settings().setValue(self.settingsSection + u'/last directory import', unicode(file_name))
|
Settings().setValue(self.settingsSection + u'/last directory import', unicode(file_name))
|
||||||
self.unzip_theme(file_name, self.path)
|
self.unzip_theme(file_name, self.path)
|
||||||
self.load_themes()
|
self.load_themes()
|
||||||
Receiver.send_message(u'cursor_normal')
|
self.application.set_normal_cursor()
|
||||||
|
|
||||||
def load_themes(self, first_time=False):
|
def load_themes(self, first_time=False):
|
||||||
"""
|
"""
|
||||||
|
@ -848,3 +850,13 @@ class ThemeManager(QtGui.QWidget):
|
||||||
return self._main_window
|
return self._main_window
|
||||||
|
|
||||||
main_window = property(_get_main_window)
|
main_window = property(_get_main_window)
|
||||||
|
|
||||||
|
def _get_application(self):
|
||||||
|
"""
|
||||||
|
Adds the openlp to the class dynamically
|
||||||
|
"""
|
||||||
|
if not hasattr(self, u'_application'):
|
||||||
|
self._application = Registry().get(u'application')
|
||||||
|
return self._application
|
||||||
|
|
||||||
|
application = property(_get_application)
|
||||||
|
|
|
@ -31,7 +31,7 @@ The Themes configuration tab
|
||||||
"""
|
"""
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
from openlp.core.lib import Receiver, Settings, SettingsTab, translate, UiStrings
|
from openlp.core.lib import Receiver, Settings, SettingsTab, UiStrings, translate
|
||||||
from openlp.core.lib.theme import ThemeLevel
|
from openlp.core.lib.theme import ThemeLevel
|
||||||
from openlp.core.lib.ui import find_and_set_in_combo_box
|
from openlp.core.lib.ui import find_and_set_in_combo_box
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ The Create/Edit theme wizard
|
||||||
"""
|
"""
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
from openlp.core.lib import translate, build_icon, UiStrings
|
from openlp.core.lib import UiStrings, build_icon, translate
|
||||||
from openlp.core.lib.theme import HorizontalType, BackgroundType, BackgroundGradientType
|
from openlp.core.lib.theme import HorizontalType, BackgroundType, BackgroundGradientType
|
||||||
from openlp.core.lib.ui import add_welcome_page, create_valign_selection_widgets
|
from openlp.core.lib.ui import add_welcome_page, create_valign_selection_widgets
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ import os
|
||||||
|
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
from openlp.core.lib import build_icon, Receiver, Settings, translate, UiStrings
|
from openlp.core.lib import Receiver, Registry, Settings, UiStrings, build_icon, translate
|
||||||
from openlp.core.lib.ui import add_welcome_page
|
from openlp.core.lib.ui import add_welcome_page
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
@ -219,7 +219,7 @@ class OpenLPWizard(QtGui.QWizard):
|
||||||
self.progressLabel.setText(status_text)
|
self.progressLabel.setText(status_text)
|
||||||
if increment > 0:
|
if increment > 0:
|
||||||
self.progressBar.setValue(self.progressBar.value() + increment)
|
self.progressBar.setValue(self.progressBar.value() + increment)
|
||||||
Receiver.send_message(u'openlp_process_events')
|
self.application.process_events()
|
||||||
|
|
||||||
def preWizard(self):
|
def preWizard(self):
|
||||||
"""
|
"""
|
||||||
|
@ -237,7 +237,7 @@ class OpenLPWizard(QtGui.QWizard):
|
||||||
self.progressBar.setValue(self.progressBar.maximum())
|
self.progressBar.setValue(self.progressBar.maximum())
|
||||||
self.finishButton.setVisible(True)
|
self.finishButton.setVisible(True)
|
||||||
self.cancelButton.setVisible(False)
|
self.cancelButton.setVisible(False)
|
||||||
Receiver.send_message(u'openlp_process_events')
|
self.application.process_events()
|
||||||
|
|
||||||
def getFileName(self, title, editbox, setting_name, filters=u''):
|
def getFileName(self, title, editbox, setting_name, filters=u''):
|
||||||
"""
|
"""
|
||||||
|
@ -286,3 +286,13 @@ class OpenLPWizard(QtGui.QWizard):
|
||||||
if folder:
|
if folder:
|
||||||
editbox.setText(folder)
|
editbox.setText(folder)
|
||||||
Settings().setValue(self.plugin.settingsSection + u'/' + setting_name, folder)
|
Settings().setValue(self.plugin.settingsSection + u'/' + setting_name, folder)
|
||||||
|
|
||||||
|
def _get_application(self):
|
||||||
|
"""
|
||||||
|
Adds the openlp to the class dynamically
|
||||||
|
"""
|
||||||
|
if not hasattr(self, u'_application'):
|
||||||
|
self._application = Registry().get(u'application')
|
||||||
|
return self._application
|
||||||
|
|
||||||
|
application = property(_get_application)
|
||||||
|
|
|
@ -39,7 +39,7 @@ from subprocess import Popen, PIPE
|
||||||
import sys
|
import sys
|
||||||
import urllib2
|
import urllib2
|
||||||
|
|
||||||
from openlp.core.lib import Settings
|
from openlp.core.lib import Registry, Settings
|
||||||
|
|
||||||
from PyQt4 import QtGui, QtCore
|
from PyQt4 import QtGui, QtCore
|
||||||
|
|
||||||
|
@ -424,7 +424,7 @@ def get_web_page(url, header=None, update_openlp=False):
|
||||||
if not page:
|
if not page:
|
||||||
return None
|
return None
|
||||||
if update_openlp:
|
if update_openlp:
|
||||||
Receiver.send_message(u'openlp_process_events')
|
Registry().get(u'application').process_events()
|
||||||
log.debug(page)
|
log.debug(page)
|
||||||
return page
|
return page
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ import sys
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
from openlp.core.utils import AppLocation
|
from openlp.core.utils import AppLocation
|
||||||
from openlp.core.lib import translate, Settings
|
from openlp.core.lib import Settings, translate
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
|
@ -29,9 +29,9 @@
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtGui
|
||||||
|
|
||||||
from openlp.core.lib import Plugin, StringContent, build_icon, translate, Settings
|
from openlp.core.lib import Plugin, Settings, StringContent, build_icon, translate
|
||||||
from openlp.core.lib.db import Manager
|
from openlp.core.lib.db import Manager
|
||||||
from openlp.core.lib.ui import create_action, UiStrings
|
from openlp.core.lib.ui import create_action, UiStrings
|
||||||
from openlp.core.lib.theme import VerticalType
|
from openlp.core.lib.theme import VerticalType
|
||||||
|
|
|
@ -29,8 +29,7 @@
|
||||||
|
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
from openlp.core.lib import SettingsTab, translate, Receiver, Settings, UiStrings
|
from openlp.core.lib import SettingsTab, Receiver, Settings, UiStrings, translate
|
||||||
from openlp.core.ui import AlertLocation
|
|
||||||
from openlp.core.lib.ui import create_valign_selection_widgets
|
from openlp.core.lib.ui import create_valign_selection_widgets
|
||||||
|
|
||||||
class AlertsTab(SettingsTab):
|
class AlertsTab(SettingsTab):
|
||||||
|
|
|
@ -31,8 +31,8 @@ import logging
|
||||||
|
|
||||||
from PyQt4 import QtGui
|
from PyQt4 import QtGui
|
||||||
|
|
||||||
from openlp.core.lib import Plugin, StringContent, build_icon, translate, Settings
|
from openlp.core.lib import Plugin, StringContent, build_icon, translate
|
||||||
from openlp.core.lib.ui import create_action, UiStrings
|
from openlp.core.lib.ui import UiStrings, create_action
|
||||||
from openlp.core.utils.actions import ActionList
|
from openlp.core.utils.actions import ActionList
|
||||||
from openlp.plugins.bibles.lib import BibleManager, BiblesTab, BibleMediaItem, LayoutStyle, DisplayStyle, \
|
from openlp.plugins.bibles.lib import BibleManager, BiblesTab, BibleMediaItem, LayoutStyle, DisplayStyle, \
|
||||||
LanguageSelection
|
LanguageSelection
|
||||||
|
|
|
@ -34,7 +34,7 @@ import os
|
||||||
|
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
from openlp.core.lib import Receiver, translate, Settings, UiStrings
|
from openlp.core.lib import Settings, UiStrings, translate
|
||||||
from openlp.core.lib.db import delete_database
|
from openlp.core.lib.db import delete_database
|
||||||
from openlp.core.lib.ui import critical_error_message_box
|
from openlp.core.lib.ui import critical_error_message_box
|
||||||
from openlp.core.ui.wizard import OpenLPWizard, WizardStrings
|
from openlp.core.ui.wizard import OpenLPWizard, WizardStrings
|
||||||
|
@ -578,7 +578,7 @@ class BibleImportForm(OpenLPWizard):
|
||||||
self.progressLabel.setText(translate('BiblesPlugin.ImportWizardForm', 'Registering Bible...'))
|
self.progressLabel.setText(translate('BiblesPlugin.ImportWizardForm', 'Registering Bible...'))
|
||||||
else:
|
else:
|
||||||
self.progressLabel.setText(WizardStrings.StartingImport)
|
self.progressLabel.setText(WizardStrings.StartingImport)
|
||||||
Receiver.send_message(u'openlp_process_events')
|
self.application.process_events()
|
||||||
|
|
||||||
def performWizard(self):
|
def performWizard(self):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -36,7 +36,7 @@ from tempfile import gettempdir
|
||||||
|
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
from openlp.core.lib import Receiver, translate, check_directory_exists, Settings, UiStrings
|
from openlp.core.lib import Receiver, Settings, UiStrings, translate, check_directory_exists
|
||||||
from openlp.core.lib.ui import critical_error_message_box
|
from openlp.core.lib.ui import critical_error_message_box
|
||||||
from openlp.core.ui.wizard import OpenLPWizard, WizardStrings
|
from openlp.core.ui.wizard import OpenLPWizard, WizardStrings
|
||||||
from openlp.core.utils import AppLocation, delete_file, get_filesystem_encoding
|
from openlp.core.utils import AppLocation, delete_file, get_filesystem_encoding
|
||||||
|
@ -335,7 +335,7 @@ class BibleUpgradeForm(OpenLPWizard):
|
||||||
"""
|
"""
|
||||||
OpenLPWizard.preWizard(self)
|
OpenLPWizard.preWizard(self)
|
||||||
self.progressLabel.setText(translate('BiblesPlugin.UpgradeWizardForm', 'Starting upgrade...'))
|
self.progressLabel.setText(translate('BiblesPlugin.UpgradeWizardForm', 'Starting upgrade...'))
|
||||||
Receiver.send_message(u'openlp_process_events')
|
self.application.process_events()
|
||||||
|
|
||||||
def performWizard(self):
|
def performWizard(self):
|
||||||
"""
|
"""
|
||||||
|
@ -465,7 +465,7 @@ class BibleUpgradeForm(OpenLPWizard):
|
||||||
self.newbibles[number].create_verse(db_book.id,
|
self.newbibles[number].create_verse(db_book.id,
|
||||||
int(verse[u'chapter']),
|
int(verse[u'chapter']),
|
||||||
int(verse[u'verse']), unicode(verse[u'text']))
|
int(verse[u'verse']), unicode(verse[u'text']))
|
||||||
Receiver.send_message(u'openlp_process_events')
|
self.application.process_events()
|
||||||
self.newbibles[number].session.commit()
|
self.newbibles[number].session.commit()
|
||||||
else:
|
else:
|
||||||
language_id = self.newbibles[number].get_object(BibleMeta, u'language_id')
|
language_id = self.newbibles[number].get_object(BibleMeta, u'language_id')
|
||||||
|
@ -511,7 +511,7 @@ class BibleUpgradeForm(OpenLPWizard):
|
||||||
self.newbibles[number].create_verse(db_book.id,
|
self.newbibles[number].create_verse(db_book.id,
|
||||||
int(verse[u'chapter']),
|
int(verse[u'chapter']),
|
||||||
int(verse[u'verse']), unicode(verse[u'text']))
|
int(verse[u'verse']), unicode(verse[u'text']))
|
||||||
Receiver.send_message(u'openlp_process_events')
|
self.application.process_events()
|
||||||
self.newbibles[number].session.commit()
|
self.newbibles[number].session.commit()
|
||||||
if not self.success.get(number, True):
|
if not self.success.get(number, True):
|
||||||
self.incrementProgressBar(translate('BiblesPlugin.UpgradeWizardForm',
|
self.incrementProgressBar(translate('BiblesPlugin.UpgradeWizardForm',
|
||||||
|
|
|
@ -32,7 +32,7 @@ import re
|
||||||
|
|
||||||
from PyQt4 import QtGui
|
from PyQt4 import QtGui
|
||||||
|
|
||||||
from openlp.core.lib import Receiver, translate, UiStrings
|
from openlp.core.lib import Registry, UiStrings, translate
|
||||||
from openlp.core.lib.ui import critical_error_message_box
|
from openlp.core.lib.ui import critical_error_message_box
|
||||||
from editbibledialog import Ui_EditBibleDialog
|
from editbibledialog import Ui_EditBibleDialog
|
||||||
from openlp.plugins.bibles.lib import BibleStrings
|
from openlp.plugins.bibles.lib import BibleStrings
|
||||||
|
@ -122,8 +122,7 @@ class EditBibleForm(QtGui.QDialog, Ui_EditBibleDialog):
|
||||||
if book.name != custom_names[abbr]:
|
if book.name != custom_names[abbr]:
|
||||||
if not self.validateBook(custom_names[abbr], abbr):
|
if not self.validateBook(custom_names[abbr], abbr):
|
||||||
return
|
return
|
||||||
Receiver.send_message(u'openlp_process_events')
|
self.application.set_busy_cursor()
|
||||||
Receiver.send_message(u'cursor_busy')
|
|
||||||
self.manager.save_meta_data(self.bible, version, copyright, permissions, book_name_language)
|
self.manager.save_meta_data(self.bible, version, copyright, permissions, book_name_language)
|
||||||
if not self.webbible:
|
if not self.webbible:
|
||||||
for abbr, book in self.books.iteritems():
|
for abbr, book in self.books.iteritems():
|
||||||
|
@ -132,7 +131,7 @@ class EditBibleForm(QtGui.QDialog, Ui_EditBibleDialog):
|
||||||
book.name = custom_names[abbr]
|
book.name = custom_names[abbr]
|
||||||
self.manager.update_book(self.bible, book)
|
self.manager.update_book(self.bible, book)
|
||||||
self.bible = None
|
self.bible = None
|
||||||
Receiver.send_message(u'cursor_normal')
|
self.application.set_normal_cursor()
|
||||||
QtGui.QDialog.accept(self)
|
QtGui.QDialog.accept(self)
|
||||||
|
|
||||||
def validateMeta(self, name, copyright):
|
def validateMeta(self, name, copyright):
|
||||||
|
@ -189,3 +188,13 @@ class EditBibleForm(QtGui.QDialog, Ui_EditBibleDialog):
|
||||||
% new_book_name)
|
% new_book_name)
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
def _get_application(self):
|
||||||
|
"""
|
||||||
|
Adds the openlp to the class dynamically
|
||||||
|
"""
|
||||||
|
if not hasattr(self, u'_application'):
|
||||||
|
self._application = Registry().get(u'application')
|
||||||
|
return self._application
|
||||||
|
|
||||||
|
application = property(_get_application)
|
||||||
|
|
|
@ -33,7 +33,7 @@ plugin.
|
||||||
import logging
|
import logging
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from openlp.core.lib import translate, Settings
|
from openlp.core.lib import Settings, translate
|
||||||
|
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
|
@ -31,7 +31,7 @@ import logging
|
||||||
|
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
from openlp.core.lib import Receiver, SettingsTab, translate, Settings, UiStrings
|
from openlp.core.lib import Receiver, SettingsTab, Settings, UiStrings, translate
|
||||||
from openlp.core.lib.ui import find_and_set_in_combo_box
|
from openlp.core.lib.ui import find_and_set_in_combo_box
|
||||||
from openlp.plugins.bibles.lib import LayoutStyle, DisplayStyle, update_reference_separators, \
|
from openlp.plugins.bibles.lib import LayoutStyle, DisplayStyle, update_reference_separators, \
|
||||||
get_reference_separator, LanguageSelection
|
get_reference_separator, LanguageSelection
|
||||||
|
|
|
@ -62,7 +62,7 @@ import logging
|
||||||
import chardet
|
import chardet
|
||||||
import csv
|
import csv
|
||||||
|
|
||||||
from openlp.core.lib import Receiver, translate
|
from openlp.core.lib import translate
|
||||||
from openlp.plugins.bibles.lib.db import BibleDB, BiblesResourcesDB
|
from openlp.plugins.bibles.lib.db import BibleDB, BiblesResourcesDB
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
@ -118,7 +118,7 @@ class CSVBible(BibleDB):
|
||||||
book_details = BiblesResourcesDB.get_book_by_id(book_ref_id)
|
book_details = BiblesResourcesDB.get_book_by_id(book_ref_id)
|
||||||
self.create_book(unicode(line[2], details['encoding']), book_ref_id, book_details[u'testament_id'])
|
self.create_book(unicode(line[2], details['encoding']), book_ref_id, book_details[u'testament_id'])
|
||||||
book_list[int(line[0])] = unicode(line[2], details['encoding'])
|
book_list[int(line[0])] = unicode(line[2], details['encoding'])
|
||||||
Receiver.send_message(u'openlp_process_events')
|
self.application.process_events()
|
||||||
except (IOError, IndexError):
|
except (IOError, IndexError):
|
||||||
log.exception(u'Loading books from file failed')
|
log.exception(u'Loading books from file failed')
|
||||||
success = False
|
success = False
|
||||||
|
@ -157,7 +157,7 @@ class CSVBible(BibleDB):
|
||||||
verse_text = unicode(line[3], u'cp1252')
|
verse_text = unicode(line[3], u'cp1252')
|
||||||
self.create_verse(book.id, line[1], line[2], verse_text)
|
self.create_verse(book.id, line[1], line[2], verse_text)
|
||||||
self.wizard.incrementProgressBar(translate('BiblesPlugin.CSVBible', 'Importing verses... done.'))
|
self.wizard.incrementProgressBar(translate('BiblesPlugin.CSVBible', 'Importing verses... done.'))
|
||||||
Receiver.send_message(u'openlp_process_events')
|
self.application.process_events()
|
||||||
self.session.commit()
|
self.session.commit()
|
||||||
except IOError:
|
except IOError:
|
||||||
log.exception(u'Loading verses from file failed')
|
log.exception(u'Loading verses from file failed')
|
||||||
|
|
|
@ -34,11 +34,11 @@ import re
|
||||||
import sqlite3
|
import sqlite3
|
||||||
|
|
||||||
from PyQt4 import QtCore
|
from PyQt4 import QtCore
|
||||||
from sqlalchemy import Column, ForeignKey, or_, Table, types, func
|
from sqlalchemy import Column, ForeignKey, Table, or_, types, func
|
||||||
from sqlalchemy.orm import class_mapper, mapper, relation
|
from sqlalchemy.orm import class_mapper, mapper, relation
|
||||||
from sqlalchemy.orm.exc import UnmappedClassError
|
from sqlalchemy.orm.exc import UnmappedClassError
|
||||||
|
|
||||||
from openlp.core.lib import Receiver, translate
|
from openlp.core.lib import Receiver, Registry, translate
|
||||||
from openlp.core.lib.db import BaseModel, init_db, Manager
|
from openlp.core.lib.db import BaseModel, init_db, Manager
|
||||||
from openlp.core.lib.ui import critical_error_message_box
|
from openlp.core.lib.ui import critical_error_message_box
|
||||||
from openlp.core.utils import AppLocation, clean_filename
|
from openlp.core.utils import AppLocation, clean_filename
|
||||||
|
@ -360,7 +360,7 @@ class BibleDB(QtCore.QObject, Manager):
|
||||||
|
|
||||||
``book``
|
``book``
|
||||||
The name of the book, according to the selected language.
|
The name of the book, according to the selected language.
|
||||||
|
|
||||||
``language_selection``
|
``language_selection``
|
||||||
The language selection the user has chosen in the settings
|
The language selection the user has chosen in the settings
|
||||||
section of the Bible.
|
section of the Bible.
|
||||||
|
@ -549,6 +549,16 @@ class BibleDB(QtCore.QObject, Manager):
|
||||||
verses = self.session.query(Verse).all()
|
verses = self.session.query(Verse).all()
|
||||||
log.debug(verses)
|
log.debug(verses)
|
||||||
|
|
||||||
|
def _get_application(self):
|
||||||
|
"""
|
||||||
|
Adds the openlp to the class dynamically
|
||||||
|
"""
|
||||||
|
if not hasattr(self, u'_application'):
|
||||||
|
self._application = Registry().get(u'application')
|
||||||
|
return self._application
|
||||||
|
|
||||||
|
application = property(_get_application)
|
||||||
|
|
||||||
|
|
||||||
class BiblesResourcesDB(QtCore.QObject, Manager):
|
class BiblesResourcesDB(QtCore.QObject, Manager):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -38,7 +38,7 @@ from HTMLParser import HTMLParseError
|
||||||
|
|
||||||
from BeautifulSoup import BeautifulSoup, NavigableString, Tag
|
from BeautifulSoup import BeautifulSoup, NavigableString, Tag
|
||||||
|
|
||||||
from openlp.core.lib import Receiver, translate
|
from openlp.core.lib import Registry, translate
|
||||||
from openlp.core.lib.ui import critical_error_message_box
|
from openlp.core.lib.ui import critical_error_message_box
|
||||||
from openlp.core.utils import get_web_page
|
from openlp.core.utils import get_web_page
|
||||||
from openlp.plugins.bibles.lib import SearchResults
|
from openlp.plugins.bibles.lib import SearchResults
|
||||||
|
@ -164,7 +164,7 @@ class BGExtract(object):
|
||||||
if len(verse_parts) > 1:
|
if len(verse_parts) > 1:
|
||||||
verse = int(verse_parts[0])
|
verse = int(verse_parts[0])
|
||||||
except TypeError:
|
except TypeError:
|
||||||
log.warn(u'Illegal verse number: %s', unicode(raw_verse_num))
|
log.warn(u'Illegal verse number: %s', unicode(verse))
|
||||||
verses.append((verse, text))
|
verses.append((verse, text))
|
||||||
verse_list = {}
|
verse_list = {}
|
||||||
for verse, text in verses[::-1]:
|
for verse, text in verses[::-1]:
|
||||||
|
@ -203,8 +203,7 @@ class BGExtract(object):
|
||||||
if clean_verse_num:
|
if clean_verse_num:
|
||||||
verse_text = raw_verse_num.next
|
verse_text = raw_verse_num.next
|
||||||
part = raw_verse_num.next.next
|
part = raw_verse_num.next.next
|
||||||
while not (isinstance(part, Tag) and
|
while not (isinstance(part, Tag) and part.get(u'class') == u'versenum'):
|
||||||
part.get(u'class') == u'versenum'):
|
|
||||||
# While we are still in the same verse grab all the text.
|
# While we are still in the same verse grab all the text.
|
||||||
if isinstance(part, NavigableString):
|
if isinstance(part, NavigableString):
|
||||||
verse_text += part
|
verse_text += part
|
||||||
|
@ -235,9 +234,10 @@ class BGExtract(object):
|
||||||
soup = get_soup_for_bible_ref(
|
soup = get_soup_for_bible_ref(
|
||||||
u'http://www.biblegateway.com/passage/?%s' % url_params,
|
u'http://www.biblegateway.com/passage/?%s' % url_params,
|
||||||
pre_parse_regex=r'<meta name.*?/>', pre_parse_substitute='', cleaner=cleaner)
|
pre_parse_regex=r'<meta name.*?/>', pre_parse_substitute='', cleaner=cleaner)
|
||||||
|
self.application.process_events()
|
||||||
if not soup:
|
if not soup:
|
||||||
return None
|
return None
|
||||||
Receiver.send_message(u'openlp_process_events')
|
self.application.process_events()
|
||||||
div = soup.find('div', 'result-text-style-normal')
|
div = soup.find('div', 'result-text-style-normal')
|
||||||
self._clean_soup(div)
|
self._clean_soup(div)
|
||||||
span_list = div.findAll('span', 'text')
|
span_list = div.findAll('span', 'text')
|
||||||
|
@ -281,7 +281,7 @@ class BGExtract(object):
|
||||||
if not soup:
|
if not soup:
|
||||||
send_error_message(u'parse')
|
send_error_message(u'parse')
|
||||||
return None
|
return None
|
||||||
Receiver.send_message(u'openlp_process_events')
|
self.application.process_events()
|
||||||
content = soup.find(u'table', u'infotable')
|
content = soup.find(u'table', u'infotable')
|
||||||
if content:
|
if content:
|
||||||
content = content.findAll(u'tr')
|
content = content.findAll(u'tr')
|
||||||
|
@ -319,17 +319,15 @@ class BSExtract(object):
|
||||||
``chapter``
|
``chapter``
|
||||||
Chapter number
|
Chapter number
|
||||||
"""
|
"""
|
||||||
log.debug(u'BSExtract.get_bible_chapter("%s", "%s", "%s")', version,
|
log.debug(u'BSExtract.get_bible_chapter("%s", "%s", "%s")', version, book_name, chapter)
|
||||||
book_name, chapter)
|
|
||||||
url_version = urllib.quote(version.encode("utf-8"))
|
url_version = urllib.quote(version.encode("utf-8"))
|
||||||
url_book_name = urllib.quote(book_name.encode("utf-8"))
|
url_book_name = urllib.quote(book_name.encode("utf-8"))
|
||||||
chapter_url = u'http://m.bibleserver.com/text/%s/%s%d' % \
|
chapter_url = u'http://m.bibleserver.com/text/%s/%s%d' % (url_version, url_book_name, chapter)
|
||||||
(url_version, url_book_name, chapter)
|
|
||||||
header = (u'Accept-Language', u'en')
|
header = (u'Accept-Language', u'en')
|
||||||
soup = get_soup_for_bible_ref(chapter_url, header)
|
soup = get_soup_for_bible_ref(chapter_url, header)
|
||||||
if not soup:
|
if not soup:
|
||||||
return None
|
return None
|
||||||
Receiver.send_message(u'openlp_process_events')
|
self.application.process_events()
|
||||||
content = soup.find(u'div', u'content')
|
content = soup.find(u'div', u'content')
|
||||||
if not content:
|
if not content:
|
||||||
log.error(u'No verses found in the Bibleserver response.')
|
log.error(u'No verses found in the Bibleserver response.')
|
||||||
|
@ -339,7 +337,7 @@ class BSExtract(object):
|
||||||
verse_number = re.compile(r'v(\d{1,2})(\d{3})(\d{3}) verse.*')
|
verse_number = re.compile(r'v(\d{1,2})(\d{3})(\d{3}) verse.*')
|
||||||
verses = {}
|
verses = {}
|
||||||
for verse in content:
|
for verse in content:
|
||||||
Receiver.send_message(u'openlp_process_events')
|
self.application.process_events()
|
||||||
versenumber = int(verse_number.sub(r'\3', verse[u'class']))
|
versenumber = int(verse_number.sub(r'\3', verse[u'class']))
|
||||||
verses[versenumber] = verse.contents[1].rstrip(u'\n')
|
verses[versenumber] = verse.contents[1].rstrip(u'\n')
|
||||||
return SearchResults(book_name, chapter, verses)
|
return SearchResults(book_name, chapter, verses)
|
||||||
|
@ -354,8 +352,7 @@ class BSExtract(object):
|
||||||
"""
|
"""
|
||||||
log.debug(u'BSExtract.get_books_from_http("%s")', version)
|
log.debug(u'BSExtract.get_books_from_http("%s")', version)
|
||||||
urlversion = urllib.quote(version.encode("utf-8"))
|
urlversion = urllib.quote(version.encode("utf-8"))
|
||||||
chapter_url = u'http://m.bibleserver.com/overlay/selectBook?'\
|
chapter_url = u'http://m.bibleserver.com/overlay/selectBook?translation=%s' % (urlversion)
|
||||||
'translation=%s' % (urlversion)
|
|
||||||
soup = get_soup_for_bible_ref(chapter_url)
|
soup = get_soup_for_bible_ref(chapter_url)
|
||||||
if not soup:
|
if not soup:
|
||||||
return None
|
return None
|
||||||
|
@ -365,9 +362,7 @@ class BSExtract(object):
|
||||||
send_error_message(u'parse')
|
send_error_message(u'parse')
|
||||||
return None
|
return None
|
||||||
content = content.findAll(u'li')
|
content = content.findAll(u'li')
|
||||||
return [
|
return [book.contents[0].contents[0] for book in content]
|
||||||
book.contents[0].contents[0] for book in content
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
class CWExtract(object):
|
class CWExtract(object):
|
||||||
|
@ -392,17 +387,15 @@ class CWExtract(object):
|
||||||
``chapter``
|
``chapter``
|
||||||
Chapter number
|
Chapter number
|
||||||
"""
|
"""
|
||||||
log.debug(u'CWExtract.get_bible_chapter("%s", "%s", "%s")', version,
|
log.debug(u'CWExtract.get_bible_chapter("%s", "%s", "%s")', version, book_name, chapter)
|
||||||
book_name, chapter)
|
|
||||||
url_book_name = book_name.replace(u' ', u'-')
|
url_book_name = book_name.replace(u' ', u'-')
|
||||||
url_book_name = url_book_name.lower()
|
url_book_name = url_book_name.lower()
|
||||||
url_book_name = urllib.quote(url_book_name.encode("utf-8"))
|
url_book_name = urllib.quote(url_book_name.encode("utf-8"))
|
||||||
chapter_url = u'http://www.biblestudytools.com/%s/%s/%s.html' % \
|
chapter_url = u'http://www.biblestudytools.com/%s/%s/%s.html' % (version, url_book_name, chapter)
|
||||||
(version, url_book_name, chapter)
|
|
||||||
soup = get_soup_for_bible_ref(chapter_url)
|
soup = get_soup_for_bible_ref(chapter_url)
|
||||||
if not soup:
|
if not soup:
|
||||||
return None
|
return None
|
||||||
Receiver.send_message(u'openlp_process_events')
|
self.application.process_events()
|
||||||
html_verses = soup.findAll(u'span', u'versetext')
|
html_verses = soup.findAll(u'span', u'versetext')
|
||||||
if not html_verses:
|
if not html_verses:
|
||||||
log.error(u'No verses found in the CrossWalk response.')
|
log.error(u'No verses found in the CrossWalk response.')
|
||||||
|
@ -412,27 +405,25 @@ class CWExtract(object):
|
||||||
reduce_spaces = re.compile(r'[ ]{2,}')
|
reduce_spaces = re.compile(r'[ ]{2,}')
|
||||||
fix_punctuation = re.compile(r'[ ]+([.,;])')
|
fix_punctuation = re.compile(r'[ ]+([.,;])')
|
||||||
for verse in html_verses:
|
for verse in html_verses:
|
||||||
Receiver.send_message(u'openlp_process_events')
|
self.application.process_events()
|
||||||
verse_number = int(verse.contents[0].contents[0])
|
verse_number = int(verse.contents[0].contents[0])
|
||||||
verse_text = u''
|
verse_text = u''
|
||||||
for part in verse.contents:
|
for part in verse.contents:
|
||||||
Receiver.send_message(u'openlp_process_events')
|
self.application.process_events()
|
||||||
if isinstance(part, NavigableString):
|
if isinstance(part, NavigableString):
|
||||||
verse_text = verse_text + part
|
verse_text += part
|
||||||
elif part and part.attrMap and \
|
elif part and part.attrMap and \
|
||||||
(part.attrMap[u'class'] == u'WordsOfChrist' or \
|
(part.attrMap[u'class'] == u'WordsOfChrist' or part.attrMap[u'class'] == u'strongs'):
|
||||||
part.attrMap[u'class'] == u'strongs'):
|
|
||||||
for subpart in part.contents:
|
for subpart in part.contents:
|
||||||
Receiver.send_message(u'openlp_process_events')
|
self.application.process_events()
|
||||||
if isinstance(subpart, NavigableString):
|
if isinstance(subpart, NavigableString):
|
||||||
verse_text = verse_text + subpart
|
verse_text += subpart
|
||||||
elif subpart and subpart.attrMap and \
|
elif subpart and subpart.attrMap and subpart.attrMap[u'class'] == u'strongs':
|
||||||
subpart.attrMap[u'class'] == u'strongs':
|
|
||||||
for subsub in subpart.contents:
|
for subsub in subpart.contents:
|
||||||
Receiver.send_message(u'openlp_process_events')
|
self.application.process_events()
|
||||||
if isinstance(subsub, NavigableString):
|
if isinstance(subsub, NavigableString):
|
||||||
verse_text = verse_text + subsub
|
verse_text += subsub
|
||||||
Receiver.send_message(u'openlp_process_events')
|
self.application.process_events()
|
||||||
# Fix up leading and trailing spaces, multiple spaces, and spaces
|
# Fix up leading and trailing spaces, multiple spaces, and spaces
|
||||||
# between text and , and .
|
# between text and , and .
|
||||||
verse_text = verse_text.strip(u'\n\r\t ')
|
verse_text = verse_text.strip(u'\n\r\t ')
|
||||||
|
@ -449,8 +440,7 @@ class CWExtract(object):
|
||||||
The version of the bible like NIV for New International Version
|
The version of the bible like NIV for New International Version
|
||||||
"""
|
"""
|
||||||
log.debug(u'CWExtract.get_books_from_http("%s")', version)
|
log.debug(u'CWExtract.get_books_from_http("%s")', version)
|
||||||
chapter_url = u'http://www.biblestudytools.com/%s/'\
|
chapter_url = u'http://www.biblestudytools.com/%s/' % (version)
|
||||||
% (version)
|
|
||||||
soup = get_soup_for_bible_ref(chapter_url)
|
soup = get_soup_for_bible_ref(chapter_url)
|
||||||
if not soup:
|
if not soup:
|
||||||
return None
|
return None
|
||||||
|
@ -504,9 +494,7 @@ class HTTPBible(BibleDB):
|
||||||
``True`` on success, ``False`` on failure.
|
``True`` on success, ``False`` on failure.
|
||||||
"""
|
"""
|
||||||
self.wizard.progressBar.setMaximum(68)
|
self.wizard.progressBar.setMaximum(68)
|
||||||
self.wizard.incrementProgressBar(translate(
|
self.wizard.incrementProgressBar(translate('BiblesPlugin.HTTPBible', 'Registering Bible and loading books...'))
|
||||||
'BiblesPlugin.HTTPBible',
|
|
||||||
'Registering Bible and loading books...'))
|
|
||||||
self.save_meta(u'download_source', self.download_source)
|
self.save_meta(u'download_source', self.download_source)
|
||||||
self.save_meta(u'download_name', self.download_name)
|
self.save_meta(u'download_name', self.download_name)
|
||||||
if self.proxy_server:
|
if self.proxy_server:
|
||||||
|
@ -528,19 +516,16 @@ class HTTPBible(BibleDB):
|
||||||
log.exception(u'Importing books from %s - download name: "%s" '\
|
log.exception(u'Importing books from %s - download name: "%s" '\
|
||||||
'failed' % (self.download_source, self.download_name))
|
'failed' % (self.download_source, self.download_name))
|
||||||
return False
|
return False
|
||||||
self.wizard.progressBar.setMaximum(len(books)+2)
|
self.wizard.progressBar.setMaximum(len(books) + 2)
|
||||||
self.wizard.incrementProgressBar(translate(
|
self.wizard.incrementProgressBar(translate( 'BiblesPlugin.HTTPBible', 'Registering Language...'))
|
||||||
'BiblesPlugin.HTTPBible', 'Registering Language...'))
|
bible = BiblesResourcesDB.get_webbible(self.download_name, self.download_source.lower())
|
||||||
bible = BiblesResourcesDB.get_webbible(self.download_name,
|
|
||||||
self.download_source.lower())
|
|
||||||
if bible[u'language_id']:
|
if bible[u'language_id']:
|
||||||
language_id = bible[u'language_id']
|
language_id = bible[u'language_id']
|
||||||
self.save_meta(u'language_id', language_id)
|
self.save_meta(u'language_id', language_id)
|
||||||
else:
|
else:
|
||||||
language_id = self.get_language(bible_name)
|
language_id = self.get_language(bible_name)
|
||||||
if not language_id:
|
if not language_id:
|
||||||
log.exception(u'Importing books from %s " '\
|
log.exception(u'Importing books from %s failed' % self.filename)
|
||||||
'failed' % self.filename)
|
|
||||||
return False
|
return False
|
||||||
for book in books:
|
for book in books:
|
||||||
if self.stop_import_flag:
|
if self.stop_import_flag:
|
||||||
|
@ -548,8 +533,7 @@ class HTTPBible(BibleDB):
|
||||||
self.wizard.incrementProgressBar(translate(
|
self.wizard.incrementProgressBar(translate(
|
||||||
'BiblesPlugin.HTTPBible', 'Importing %s...',
|
'BiblesPlugin.HTTPBible', 'Importing %s...',
|
||||||
'Importing <book name>...') % book)
|
'Importing <book name>...') % book)
|
||||||
book_ref_id = self.get_book_ref_id_by_name(book, len(books),
|
book_ref_id = self.get_book_ref_id_by_name(book, len(books), language_id)
|
||||||
language_id)
|
|
||||||
if not book_ref_id:
|
if not book_ref_id:
|
||||||
log.exception(u'Importing books from %s - download name: "%s" '\
|
log.exception(u'Importing books from %s - download name: "%s" '\
|
||||||
'failed' % (self.download_source, self.download_name))
|
'failed' % (self.download_source, self.download_name))
|
||||||
|
@ -598,7 +582,7 @@ class HTTPBible(BibleDB):
|
||||||
return []
|
return []
|
||||||
book = db_book.name
|
book = db_book.name
|
||||||
if BibleDB.get_verse_count(self, book_id, reference[1]) == 0:
|
if BibleDB.get_verse_count(self, book_id, reference[1]) == 0:
|
||||||
Receiver.send_message(u'cursor_busy')
|
self.application.set_busy_cursor()
|
||||||
search_results = self.get_chapter(book, reference[1])
|
search_results = self.get_chapter(book, reference[1])
|
||||||
if search_results and search_results.has_verselist():
|
if search_results and search_results.has_verselist():
|
||||||
## We have found a book of the bible lets check to see
|
## We have found a book of the bible lets check to see
|
||||||
|
@ -606,14 +590,13 @@ class HTTPBible(BibleDB):
|
||||||
## we get a correct book. For example it is possible
|
## we get a correct book. For example it is possible
|
||||||
## to request ac and get Acts back.
|
## to request ac and get Acts back.
|
||||||
book_name = search_results.book
|
book_name = search_results.book
|
||||||
Receiver.send_message(u'openlp_process_events')
|
self.application.process_events()
|
||||||
# Check to see if book/chapter exists.
|
# Check to see if book/chapter exists.
|
||||||
db_book = self.get_book(book_name)
|
db_book = self.get_book(book_name)
|
||||||
self.create_chapter(db_book.id, search_results.chapter,
|
self.create_chapter(db_book.id, search_results.chapter, search_results.verselist)
|
||||||
search_results.verselist)
|
self.application.process_events()
|
||||||
Receiver.send_message(u'openlp_process_events')
|
self.application.set_normal_cursor()
|
||||||
Receiver.send_message(u'cursor_normal')
|
self.application.process_events()
|
||||||
Receiver.send_message(u'openlp_process_events')
|
|
||||||
return BibleDB.get_verses(self, reference_list, show_error)
|
return BibleDB.get_verses(self, reference_list, show_error)
|
||||||
|
|
||||||
def get_chapter(self, book, chapter):
|
def get_chapter(self, book, chapter):
|
||||||
|
@ -660,6 +643,16 @@ class HTTPBible(BibleDB):
|
||||||
log.debug(u'HTTPBible.get_verse_count("%s", %s)', book_id, chapter)
|
log.debug(u'HTTPBible.get_verse_count("%s", %s)', book_id, chapter)
|
||||||
return BiblesResourcesDB.get_verse_count(book_id, chapter)
|
return BiblesResourcesDB.get_verse_count(book_id, chapter)
|
||||||
|
|
||||||
|
def _get_application(self):
|
||||||
|
"""
|
||||||
|
Adds the openlp to the class dynamically
|
||||||
|
"""
|
||||||
|
if not hasattr(self, u'_application'):
|
||||||
|
self._application = Registry().get(u'application')
|
||||||
|
return self._application
|
||||||
|
|
||||||
|
application = property(_get_application)
|
||||||
|
|
||||||
def get_soup_for_bible_ref(reference_url, header=None, pre_parse_regex=None,
|
def get_soup_for_bible_ref(reference_url, header=None, pre_parse_regex=None,
|
||||||
pre_parse_substitute=None, cleaner=None):
|
pre_parse_substitute=None, cleaner=None):
|
||||||
"""
|
"""
|
||||||
|
@ -701,7 +694,7 @@ def get_soup_for_bible_ref(reference_url, header=None, pre_parse_regex=None,
|
||||||
if not soup:
|
if not soup:
|
||||||
send_error_message(u'parse')
|
send_error_message(u'parse')
|
||||||
return None
|
return None
|
||||||
Receiver.send_message(u'openlp_process_events')
|
Registry().get(u'application').process_events()
|
||||||
return soup
|
return soup
|
||||||
|
|
||||||
def send_error_message(error_type):
|
def send_error_message(error_type):
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from openlp.core.lib import Receiver, SettingsManager, translate, Settings
|
from openlp.core.lib import Receiver, SettingsManager, Settings, translate
|
||||||
from openlp.core.utils import AppLocation, delete_file
|
from openlp.core.utils import AppLocation, delete_file
|
||||||
from openlp.plugins.bibles.lib import parse_reference, get_reference_separator, LanguageSelection
|
from openlp.plugins.bibles.lib import parse_reference, get_reference_separator, LanguageSelection
|
||||||
from openlp.plugins.bibles.lib.db import BibleDB, BibleMeta
|
from openlp.plugins.bibles.lib.db import BibleDB, BibleMeta
|
||||||
|
|
|
@ -31,8 +31,8 @@ import logging
|
||||||
|
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
from openlp.core.lib import MediaManagerItem, Receiver, ItemCapabilities, translate, create_separated_list, \
|
from openlp.core.lib import MediaManagerItem, Receiver, ItemCapabilities, ServiceItemContext, Settings, UiStrings, \
|
||||||
ServiceItemContext, Settings, UiStrings
|
create_separated_list, translate
|
||||||
from openlp.core.lib.searchedit import SearchEdit
|
from openlp.core.lib.searchedit import SearchEdit
|
||||||
from openlp.core.lib.ui import set_case_insensitive_completer, create_horizontal_adjusting_combo_box, \
|
from openlp.core.lib.ui import set_case_insensitive_completer, create_horizontal_adjusting_combo_box, \
|
||||||
critical_error_message_box, find_and_set_in_combo_box, build_icon
|
critical_error_message_box, find_and_set_in_combo_box, build_icon
|
||||||
|
@ -614,7 +614,7 @@ class BibleMediaItem(MediaManagerItem):
|
||||||
"""
|
"""
|
||||||
log.debug(u'Advanced Search Button clicked')
|
log.debug(u'Advanced Search Button clicked')
|
||||||
self.advancedSearchButton.setEnabled(False)
|
self.advancedSearchButton.setEnabled(False)
|
||||||
Receiver.send_message(u'openlp_process_events')
|
self.application.process_events()
|
||||||
bible = self.advancedVersionComboBox.currentText()
|
bible = self.advancedVersionComboBox.currentText()
|
||||||
second_bible = self.advancedSecondComboBox.currentText()
|
second_bible = self.advancedSecondComboBox.currentText()
|
||||||
book = self.advancedBookComboBox.currentText()
|
book = self.advancedBookComboBox.currentText()
|
||||||
|
@ -628,7 +628,7 @@ class BibleMediaItem(MediaManagerItem):
|
||||||
verse_range = chapter_from + verse_separator + verse_from + range_separator + chapter_to + \
|
verse_range = chapter_from + verse_separator + verse_from + range_separator + chapter_to + \
|
||||||
verse_separator + verse_to
|
verse_separator + verse_to
|
||||||
versetext = u'%s %s' % (book, verse_range)
|
versetext = u'%s %s' % (book, verse_range)
|
||||||
Receiver.send_message(u'cursor_busy')
|
self.application.set_busy_cursor()
|
||||||
self.search_results = self.plugin.manager.get_verses(bible, versetext, book_ref_id)
|
self.search_results = self.plugin.manager.get_verses(bible, versetext, book_ref_id)
|
||||||
if second_bible:
|
if second_bible:
|
||||||
self.second_search_results = self.plugin.manager.get_verses(second_bible, versetext, book_ref_id)
|
self.second_search_results = self.plugin.manager.get_verses(second_bible, versetext, book_ref_id)
|
||||||
|
@ -640,8 +640,7 @@ class BibleMediaItem(MediaManagerItem):
|
||||||
self.displayResults(bible, second_bible)
|
self.displayResults(bible, second_bible)
|
||||||
self.advancedSearchButton.setEnabled(True)
|
self.advancedSearchButton.setEnabled(True)
|
||||||
self.checkSearchResult()
|
self.checkSearchResult()
|
||||||
Receiver.send_message(u'cursor_normal')
|
self.application.set_normal_cursor()
|
||||||
Receiver.send_message(u'openlp_process_events')
|
|
||||||
|
|
||||||
def onQuickSearchButton(self):
|
def onQuickSearchButton(self):
|
||||||
"""
|
"""
|
||||||
|
@ -650,7 +649,7 @@ class BibleMediaItem(MediaManagerItem):
|
||||||
"""
|
"""
|
||||||
log.debug(u'Quick Search Button clicked')
|
log.debug(u'Quick Search Button clicked')
|
||||||
self.quickSearchButton.setEnabled(False)
|
self.quickSearchButton.setEnabled(False)
|
||||||
Receiver.send_message(u'openlp_process_events')
|
self.application.process_events()
|
||||||
bible = self.quickVersionComboBox.currentText()
|
bible = self.quickVersionComboBox.currentText()
|
||||||
second_bible = self.quickSecondComboBox.currentText()
|
second_bible = self.quickSecondComboBox.currentText()
|
||||||
text = self.quickSearchEdit.text()
|
text = self.quickSearchEdit.text()
|
||||||
|
@ -662,7 +661,7 @@ class BibleMediaItem(MediaManagerItem):
|
||||||
self.search_results[0].book.book_reference_id)
|
self.search_results[0].book.book_reference_id)
|
||||||
else:
|
else:
|
||||||
# We are doing a 'Text Search'.
|
# We are doing a 'Text Search'.
|
||||||
Receiver.send_message(u'cursor_busy')
|
self.application.set_busy_cursor()
|
||||||
bibles = self.plugin.manager.get_bibles()
|
bibles = self.plugin.manager.get_bibles()
|
||||||
self.search_results = self.plugin.manager.verse_search(bible, second_bible, text)
|
self.search_results = self.plugin.manager.verse_search(bible, second_bible, text)
|
||||||
if second_bible and self.search_results:
|
if second_bible and self.search_results:
|
||||||
|
@ -697,8 +696,7 @@ class BibleMediaItem(MediaManagerItem):
|
||||||
self.displayResults(bible, second_bible)
|
self.displayResults(bible, second_bible)
|
||||||
self.quickSearchButton.setEnabled(True)
|
self.quickSearchButton.setEnabled(True)
|
||||||
self.checkSearchResult()
|
self.checkSearchResult()
|
||||||
Receiver.send_message(u'cursor_normal')
|
self.application.set_normal_cursor()
|
||||||
Receiver.send_message(u'openlp_process_events')
|
|
||||||
|
|
||||||
def displayResults(self, bible, second_bible=u''):
|
def displayResults(self, bible, second_bible=u''):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -31,7 +31,6 @@ import logging
|
||||||
import sqlite
|
import sqlite
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from openlp.core.lib import Receiver
|
|
||||||
from openlp.core.ui.wizard import WizardStrings
|
from openlp.core.ui.wizard import WizardStrings
|
||||||
from openlp.plugins.bibles.lib.db import BibleDB, BiblesResourcesDB
|
from openlp.plugins.bibles.lib.db import BibleDB, BiblesResourcesDB
|
||||||
|
|
||||||
|
@ -108,7 +107,7 @@ class OpenLP1Bible(BibleDB):
|
||||||
verse_number = int(verse[1])
|
verse_number = int(verse[1])
|
||||||
text = unicode(verse[2], u'cp1252')
|
text = unicode(verse[2], u'cp1252')
|
||||||
self.create_verse(db_book.id, chapter, verse_number, text)
|
self.create_verse(db_book.id, chapter, verse_number, text)
|
||||||
Receiver.send_message(u'openlp_process_events')
|
self.application.process_events()
|
||||||
self.session.commit()
|
self.session.commit()
|
||||||
connection.close()
|
connection.close()
|
||||||
return True
|
return True
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
import logging
|
import logging
|
||||||
from lxml import etree, objectify
|
from lxml import etree, objectify
|
||||||
|
|
||||||
from openlp.core.lib import Receiver, translate
|
from openlp.core.lib import translate
|
||||||
from openlp.core.lib.ui import critical_error_message_box
|
from openlp.core.lib.ui import critical_error_message_box
|
||||||
from openlp.plugins.bibles.lib.db import BibleDB, BiblesResourcesDB
|
from openlp.plugins.bibles.lib.db import BibleDB, BiblesResourcesDB
|
||||||
|
|
||||||
|
@ -129,7 +129,7 @@ class OpenSongBible(BibleDB):
|
||||||
self.wizard.incrementProgressBar(translate('BiblesPlugin.Opensong', 'Importing %s %s...',
|
self.wizard.incrementProgressBar(translate('BiblesPlugin.Opensong', 'Importing %s %s...',
|
||||||
'Importing <book name> <chapter>...')) % (db_book.name, chapter_number)
|
'Importing <book name> <chapter>...')) % (db_book.name, chapter_number)
|
||||||
self.session.commit()
|
self.session.commit()
|
||||||
Receiver.send_message(u'openlp_process_events')
|
self.application.process_events()
|
||||||
except etree.XMLSyntaxError as inst:
|
except etree.XMLSyntaxError as inst:
|
||||||
critical_error_message_box(message=translate('BiblesPlugin.OpenSongImport',
|
critical_error_message_box(message=translate('BiblesPlugin.OpenSongImport',
|
||||||
'Incorrect Bible file type supplied. OpenSong Bibles may be '
|
'Incorrect Bible file type supplied. OpenSong Bibles may be '
|
||||||
|
|
|
@ -33,7 +33,7 @@ import chardet
|
||||||
import codecs
|
import codecs
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from openlp.core.lib import Receiver, translate
|
from openlp.core.lib import translate
|
||||||
from openlp.core.utils import AppLocation
|
from openlp.core.utils import AppLocation
|
||||||
from openlp.plugins.bibles.lib.db import BibleDB, BiblesResourcesDB
|
from openlp.plugins.bibles.lib.db import BibleDB, BiblesResourcesDB
|
||||||
|
|
||||||
|
@ -182,7 +182,7 @@ class OSISBible(BibleDB):
|
||||||
.replace(u'</div>', u'').replace(u'</w>', u'')
|
.replace(u'</div>', u'').replace(u'</w>', u'')
|
||||||
verse_text = self.spaces_regex.sub(u' ', verse_text)
|
verse_text = self.spaces_regex.sub(u' ', verse_text)
|
||||||
self.create_verse(db_book.id, chapter, verse, verse_text)
|
self.create_verse(db_book.id, chapter, verse, verse_text)
|
||||||
Receiver.send_message(u'openlp_process_events')
|
self.application.process_events()
|
||||||
self.session.commit()
|
self.session.commit()
|
||||||
if match_count == 0:
|
if match_count == 0:
|
||||||
success = False
|
success = False
|
||||||
|
|
|
@ -72,12 +72,12 @@ class VerseReferenceList(object):
|
||||||
prev = index - 1
|
prev = index - 1
|
||||||
if self.verse_list[prev][u'version'] != verse[u'version']:
|
if self.verse_list[prev][u'version'] != verse[u'version']:
|
||||||
result = u'%s (%s)' % (result, self.verse_list[prev][u'version'])
|
result = u'%s (%s)' % (result, self.verse_list[prev][u'version'])
|
||||||
result = result + u', '
|
result += u', '
|
||||||
if self.verse_list[prev][u'book'] != verse[u'book']:
|
if self.verse_list[prev][u'book'] != verse[u'book']:
|
||||||
result = u'%s%s %s:' % (result, verse[u'book'], verse[u'chapter'])
|
result = u'%s%s %s:' % (result, verse[u'book'], verse[u'chapter'])
|
||||||
elif self.verse_list[prev][u'chapter'] != verse[u'chapter']:
|
elif self.verse_list[prev][u'chapter'] != verse[u'chapter']:
|
||||||
result = u'%s%s:' % (result, verse[u'chapter'])
|
result = u'%s%s:' % (result, verse[u'chapter'])
|
||||||
result = result + str(verse[u'start'])
|
result += str(verse[u'start'])
|
||||||
if verse[u'start'] != verse[u'end']:
|
if verse[u'start'] != verse[u'end']:
|
||||||
result = u'%s-%s' % (result, verse[u'end'])
|
result = u'%s-%s' % (result, verse[u'end'])
|
||||||
if len(self.version_list) > 1:
|
if len(self.version_list) > 1:
|
||||||
|
@ -89,8 +89,8 @@ class VerseReferenceList(object):
|
||||||
for index, version in enumerate(self.version_list):
|
for index, version in enumerate(self.version_list):
|
||||||
if index > 0:
|
if index > 0:
|
||||||
if result[-1] not in [u';', u',', u'.']:
|
if result[-1] not in [u';', u',', u'.']:
|
||||||
result = result + u';'
|
result += u';'
|
||||||
result = result + u' '
|
result += u' '
|
||||||
result = u'%s%s, %s' % (result, version[u'version'], version[u'copyright'])
|
result = u'%s%s, %s' % (result, version[u'version'], version[u'copyright'])
|
||||||
if version[u'permission'].strip():
|
if version[u'permission'].strip():
|
||||||
result = result + u', ' + version[u'permission']
|
result = result + u', ' + version[u'permission']
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
|
|
||||||
from PyQt4 import QtGui
|
from PyQt4 import QtGui
|
||||||
|
|
||||||
from openlp.core.lib import build_icon, translate, UiStrings
|
from openlp.core.lib import UiStrings, build_icon, translate
|
||||||
from openlp.core.lib.ui import create_button_box, create_button
|
from openlp.core.lib.ui import create_button_box, create_button
|
||||||
|
|
||||||
class Ui_CustomEditDialog(object):
|
class Ui_CustomEditDialog(object):
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
|
|
||||||
from PyQt4 import QtGui
|
from PyQt4 import QtGui
|
||||||
|
|
||||||
from openlp.core.lib import translate, SpellTextEdit, build_icon, UiStrings
|
from openlp.core.lib import SpellTextEdit, UiStrings, translate
|
||||||
from openlp.core.lib.ui import create_button, create_button_box
|
from openlp.core.lib.ui import create_button, create_button_box
|
||||||
|
|
||||||
class Ui_CustomSlideEditDialog(object):
|
class Ui_CustomSlideEditDialog(object):
|
||||||
|
|
|
@ -33,7 +33,7 @@ for the Custom Slides plugin, which is inserted into the configuration dialog.
|
||||||
|
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
from openlp.core.lib import SettingsTab, translate, Settings
|
from openlp.core.lib import SettingsTab, Settings, translate
|
||||||
|
|
||||||
class CustomTab(SettingsTab):
|
class CustomTab(SettingsTab):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -32,8 +32,8 @@ import logging
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
from sqlalchemy.sql import or_, func, and_
|
from sqlalchemy.sql import or_, func, and_
|
||||||
|
|
||||||
from openlp.core.lib import MediaManagerItem, Receiver, ItemCapabilities, check_item_selected, translate, \
|
from openlp.core.lib import MediaManagerItem, Receiver, ItemCapabilities, ServiceItemContext, Settings, PluginStatus, \
|
||||||
ServiceItemContext, Settings, PluginStatus, UiStrings
|
UiStrings, check_item_selected, translate
|
||||||
from openlp.plugins.custom.forms import EditCustomForm
|
from openlp.plugins.custom.forms import EditCustomForm
|
||||||
from openlp.plugins.custom.lib import CustomXMLParser, CustomXMLBuilder
|
from openlp.plugins.custom.lib import CustomXMLParser, CustomXMLBuilder
|
||||||
from openlp.plugins.custom.lib.db import CustomSlide
|
from openlp.plugins.custom.lib.db import CustomSlide
|
||||||
|
@ -250,7 +250,7 @@ class CustomMediaItem(MediaManagerItem):
|
||||||
and_(CustomSlide.title == item.title, CustomSlide.theme_name == item.theme,
|
and_(CustomSlide.title == item.title, CustomSlide.theme_name == item.theme,
|
||||||
CustomSlide.credits == item.raw_footer[0][len(item.title) + 1:]))
|
CustomSlide.credits == item.raw_footer[0][len(item.title) + 1:]))
|
||||||
if custom:
|
if custom:
|
||||||
Receiver.send_message(u'service_item_update', u'%s:%s:%s' % (custom.id, item.unique_identifier, False))
|
self.service_manager.service_item_update(custom.id, item.unique_identifier)
|
||||||
else:
|
else:
|
||||||
if self.add_custom_from_service:
|
if self.add_custom_from_service:
|
||||||
self.create_from_service_item(item)
|
self.create_from_service_item(item)
|
||||||
|
|
|
@ -31,7 +31,7 @@ from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from openlp.core.lib import Plugin, StringContent, build_icon, translate, Receiver, ImageSource, Settings
|
from openlp.core.lib import Plugin, StringContent, Receiver, ImageSource, Settings, build_icon, translate
|
||||||
from openlp.core.lib.db import Manager
|
from openlp.core.lib.db import Manager
|
||||||
from openlp.plugins.images.lib import ImageMediaItem, ImageTab
|
from openlp.plugins.images.lib import ImageMediaItem, ImageTab
|
||||||
from openlp.plugins.images.lib.db import init_schema
|
from openlp.plugins.images.lib.db import init_schema
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
|
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
from openlp.core.lib import SettingsTab, translate, Receiver, Settings, UiStrings
|
from openlp.core.lib import SettingsTab, Receiver, Settings, UiStrings, translate
|
||||||
|
|
||||||
|
|
||||||
class ImageTab(SettingsTab):
|
class ImageTab(SettingsTab):
|
||||||
|
|
|
@ -32,9 +32,9 @@ import os
|
||||||
|
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
from openlp.core.lib import MediaManagerItem, build_icon, ItemCapabilities, SettingsManager, translate, \
|
from openlp.core.lib import ItemCapabilities, MediaManagerItem, Receiver, ServiceItemContext, Settings, \
|
||||||
check_item_selected, check_directory_exists, Receiver, create_thumb, validate_thumb, ServiceItemContext, Settings, \
|
SettingsManager, StringContent, TreeWidgetWithDnD, UiStrings, build_icon, check_directory_exists, \
|
||||||
StringContent, TreeWidgetWithDnD, UiStrings
|
check_item_selected, create_thumb, translate, validate_thumb
|
||||||
from openlp.core.lib.ui import create_widget_action, critical_error_message_box
|
from openlp.core.lib.ui import create_widget_action, critical_error_message_box
|
||||||
from openlp.core.utils import AppLocation, delete_file, locale_compare, get_images_filter
|
from openlp.core.utils import AppLocation, delete_file, locale_compare, get_images_filter
|
||||||
from openlp.plugins.images.forms import AddGroupForm, ChooseGroupForm
|
from openlp.plugins.images.forms import AddGroupForm, ChooseGroupForm
|
||||||
|
@ -197,7 +197,7 @@ class ImageMediaItem(MediaManagerItem):
|
||||||
if check_item_selected(self.listView, translate('ImagePlugin.MediaItem',
|
if check_item_selected(self.listView, translate('ImagePlugin.MediaItem',
|
||||||
'You must select an image or group to delete.')):
|
'You must select an image or group to delete.')):
|
||||||
item_list = self.listView.selectedItems()
|
item_list = self.listView.selectedItems()
|
||||||
Receiver.send_message(u'cursor_busy')
|
self.application.set_busy_cursor()
|
||||||
self.main_window.displayProgressBar(len(item_list))
|
self.main_window.displayProgressBar(len(item_list))
|
||||||
for row_item in item_list:
|
for row_item in item_list:
|
||||||
if row_item:
|
if row_item:
|
||||||
|
@ -226,7 +226,7 @@ class ImageMediaItem(MediaManagerItem):
|
||||||
self.fill_groups_combobox(self.add_group_form.parent_group_combobox)
|
self.fill_groups_combobox(self.add_group_form.parent_group_combobox)
|
||||||
self.main_window.incrementProgressBar()
|
self.main_window.incrementProgressBar()
|
||||||
self.main_window.finishedProgressBar()
|
self.main_window.finishedProgressBar()
|
||||||
Receiver.send_message(u'cursor_normal')
|
self.application.set_normal_cursor()
|
||||||
self.listView.blockSignals(False)
|
self.listView.blockSignals(False)
|
||||||
|
|
||||||
def add_sub_groups(self, group_list, parent_group_id):
|
def add_sub_groups(self, group_list, parent_group_id):
|
||||||
|
@ -280,7 +280,7 @@ class ImageMediaItem(MediaManagerItem):
|
||||||
Replace the list of images and groups in the interface.
|
Replace the list of images and groups in the interface.
|
||||||
"""
|
"""
|
||||||
if not initial_load:
|
if not initial_load:
|
||||||
Receiver.send_message(u'cursor_busy')
|
self.application.set_busy_cursor()
|
||||||
self.main_window.displayProgressBar(len(images))
|
self.main_window.displayProgressBar(len(images))
|
||||||
self.listView.clear()
|
self.listView.clear()
|
||||||
# Load the list of groups and add them to the treeView
|
# Load the list of groups and add them to the treeView
|
||||||
|
@ -315,7 +315,7 @@ class ImageMediaItem(MediaManagerItem):
|
||||||
self.main_window.incrementProgressBar()
|
self.main_window.incrementProgressBar()
|
||||||
if not initial_load:
|
if not initial_load:
|
||||||
self.main_window.finishedProgressBar()
|
self.main_window.finishedProgressBar()
|
||||||
Receiver.send_message(u'cursor_normal')
|
self.application.set_normal_cursor()
|
||||||
|
|
||||||
def validateAndLoad(self, files, target_group=None):
|
def validateAndLoad(self, files, target_group=None):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -32,9 +32,8 @@ import os
|
||||||
|
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
from openlp.core.lib import MediaManagerItem, build_icon, ItemCapabilities, SettingsManager, translate, \
|
from openlp.core.lib import ItemCapabilities, MediaManagerItem,MediaType, Receiver, ServiceItem, ServiceItemContext, \
|
||||||
check_item_selected, Receiver, MediaType, ServiceItem, ServiceItemContext, Settings, UiStrings, \
|
Settings, UiStrings, build_icon, check_item_selected, check_directory_exists, translate
|
||||||
check_directory_exists
|
|
||||||
from openlp.core.lib.ui import critical_error_message_box, create_horizontal_adjusting_combo_box
|
from openlp.core.lib.ui import critical_error_message_box, create_horizontal_adjusting_combo_box
|
||||||
from openlp.core.ui import DisplayController, Display, DisplayControllerType
|
from openlp.core.ui import DisplayController, Display, DisplayControllerType
|
||||||
from openlp.core.ui.media import get_media_players, set_media_players
|
from openlp.core.ui.media import get_media_players, set_media_players
|
||||||
|
|
|
@ -27,11 +27,9 @@
|
||||||
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtGui
|
||||||
|
|
||||||
from openlp.core.lib import Receiver, Settings, SettingsTab, translate, UiStrings
|
from openlp.core.lib import Receiver, Settings, SettingsTab, UiStrings, translate
|
||||||
from openlp.core.lib.ui import create_button
|
|
||||||
from openlp.core.ui.media import get_media_players, set_media_players
|
|
||||||
|
|
||||||
class MediaQCheckBox(QtGui.QCheckBox):
|
class MediaQCheckBox(QtGui.QCheckBox):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -31,7 +31,7 @@ import logging
|
||||||
|
|
||||||
from PyQt4 import QtCore
|
from PyQt4 import QtCore
|
||||||
|
|
||||||
from openlp.core.lib import Plugin, StringContent, build_icon, translate, Settings, Registry
|
from openlp.core.lib import Plugin, Registry, StringContent, Settings, build_icon, translate
|
||||||
from openlp.plugins.media.lib import MediaMediaItem, MediaTab
|
from openlp.plugins.media.lib import MediaMediaItem, MediaTab
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
|
@ -189,7 +189,7 @@ class ImpressController(PresentationController):
|
||||||
while list.hasMoreElements():
|
while list.hasMoreElements():
|
||||||
doc = list.nextElement()
|
doc = list.nextElement()
|
||||||
if doc.getImplementationName() != u'com.sun.star.comp.framework.BackingComp':
|
if doc.getImplementationName() != u'com.sun.star.comp.framework.BackingComp':
|
||||||
cnt = cnt + 1
|
cnt += 1
|
||||||
if cnt > 0:
|
if cnt > 0:
|
||||||
log.debug(u'OpenOffice not terminated as docs are still open')
|
log.debug(u'OpenOffice not terminated as docs are still open')
|
||||||
else:
|
else:
|
||||||
|
@ -399,7 +399,7 @@ class ImpressDocument(PresentationDocument):
|
||||||
i = 1
|
i = 1
|
||||||
while not self.control and i < 150:
|
while not self.control and i < 150:
|
||||||
time.sleep(0.1)
|
time.sleep(0.1)
|
||||||
i = i + 1
|
i += 1
|
||||||
self.control = self.presentation.getController()
|
self.control = self.presentation.getController()
|
||||||
else:
|
else:
|
||||||
self.control.activate()
|
self.control.activate()
|
||||||
|
|
|
@ -32,8 +32,8 @@ import os
|
||||||
|
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
from openlp.core.lib import MediaManagerItem, build_icon, SettingsManager, translate, check_item_selected, Receiver, \
|
from openlp.core.lib import MediaManagerItem, Receiver, ItemCapabilities, ServiceItemContext, Settings, UiStrings, \
|
||||||
ItemCapabilities, create_thumb, validate_thumb, ServiceItemContext, Settings, UiStrings
|
build_icon, check_item_selected, create_thumb, translate, validate_thumb
|
||||||
from openlp.core.lib.ui import critical_error_message_box, create_horizontal_adjusting_combo_box
|
from openlp.core.lib.ui import critical_error_message_box, create_horizontal_adjusting_combo_box
|
||||||
from openlp.core.utils import locale_compare
|
from openlp.core.utils import locale_compare
|
||||||
from openlp.plugins.presentations.lib import MessageListener
|
from openlp.plugins.presentations.lib import MessageListener
|
||||||
|
@ -150,9 +150,8 @@ class PresentationMediaItem(MediaManagerItem):
|
||||||
"""
|
"""
|
||||||
currlist = self.getFileList()
|
currlist = self.getFileList()
|
||||||
titles = [os.path.split(file)[1] for file in currlist]
|
titles = [os.path.split(file)[1] for file in currlist]
|
||||||
Receiver.send_message(u'cursor_busy')
|
self.application.set_busy_cursor()
|
||||||
if not initialLoad:
|
if not initialLoad:
|
||||||
Receiver.send_message(u'cursor_busy')
|
|
||||||
self.main_window.displayProgressBar(len(files))
|
self.main_window.displayProgressBar(len(files))
|
||||||
# Sort the presentations by its filename considering language specific characters.
|
# Sort the presentations by its filename considering language specific characters.
|
||||||
files.sort(cmp=locale_compare,
|
files.sort(cmp=locale_compare,
|
||||||
|
@ -206,10 +205,9 @@ class PresentationMediaItem(MediaManagerItem):
|
||||||
item_name.setIcon(icon)
|
item_name.setIcon(icon)
|
||||||
item_name.setToolTip(file)
|
item_name.setToolTip(file)
|
||||||
self.listView.addItem(item_name)
|
self.listView.addItem(item_name)
|
||||||
Receiver.send_message(u'cursor_normal')
|
|
||||||
if not initialLoad:
|
if not initialLoad:
|
||||||
self.main_window.finishedProgressBar()
|
self.main_window.finishedProgressBar()
|
||||||
Receiver.send_message(u'cursor_normal')
|
self.application.set_normal_cursor()
|
||||||
|
|
||||||
def onDeleteClick(self):
|
def onDeleteClick(self):
|
||||||
"""
|
"""
|
||||||
|
@ -219,7 +217,7 @@ class PresentationMediaItem(MediaManagerItem):
|
||||||
items = self.listView.selectedIndexes()
|
items = self.listView.selectedIndexes()
|
||||||
row_list = [item.row() for item in items]
|
row_list = [item.row() for item in items]
|
||||||
row_list.sort(reverse=True)
|
row_list.sort(reverse=True)
|
||||||
Receiver.send_message(u'cursor_busy')
|
self.application.set_busy_cursor()
|
||||||
self.main_window.displayProgressBar(len(row_list))
|
self.main_window.displayProgressBar(len(row_list))
|
||||||
for item in items:
|
for item in items:
|
||||||
filepath = unicode(item.data(QtCore.Qt.UserRole))
|
filepath = unicode(item.data(QtCore.Qt.UserRole))
|
||||||
|
@ -229,7 +227,7 @@ class PresentationMediaItem(MediaManagerItem):
|
||||||
doc.close_presentation()
|
doc.close_presentation()
|
||||||
self.main_window.incrementProgressBar()
|
self.main_window.incrementProgressBar()
|
||||||
self.main_window.finishedProgressBar()
|
self.main_window.finishedProgressBar()
|
||||||
Receiver.send_message(u'cursor_normal')
|
self.application.set_busy_cursor()
|
||||||
for row in row_list:
|
for row in row_list:
|
||||||
self.listView.takeItem(row)
|
self.listView.takeItem(row)
|
||||||
Settings().setValue(self.settingsSection + u'/presentations files', self.getFileList())
|
Settings().setValue(self.settingsSection + u'/presentations files', self.getFileList())
|
||||||
|
@ -271,7 +269,7 @@ class PresentationMediaItem(MediaManagerItem):
|
||||||
if img:
|
if img:
|
||||||
while img:
|
while img:
|
||||||
service_item.add_from_command(path, name, img)
|
service_item.add_from_command(path, name, img)
|
||||||
i = i + 1
|
i += 1
|
||||||
img = doc.get_thumbnail_path(i, True)
|
img = doc.get_thumbnail_path(i, True)
|
||||||
doc.close_presentation()
|
doc.close_presentation()
|
||||||
return True
|
return True
|
||||||
|
|
|
@ -177,7 +177,7 @@ class Controller(object):
|
||||||
if not self.doc.is_active():
|
if not self.doc.is_active():
|
||||||
return
|
return
|
||||||
if self.doc.slidenumber < self.doc.get_slide_count():
|
if self.doc.slidenumber < self.doc.get_slide_count():
|
||||||
self.doc.slidenumber = self.doc.slidenumber + 1
|
self.doc.slidenumber += 1
|
||||||
self.poll()
|
self.poll()
|
||||||
return
|
return
|
||||||
if not self.activate():
|
if not self.activate():
|
||||||
|
@ -203,7 +203,7 @@ class Controller(object):
|
||||||
if not self.doc.is_active():
|
if not self.doc.is_active():
|
||||||
return
|
return
|
||||||
if self.doc.slidenumber > 1:
|
if self.doc.slidenumber > 1:
|
||||||
self.doc.slidenumber = self.doc.slidenumber - 1
|
self.doc.slidenumber -= 1
|
||||||
self.poll()
|
self.poll()
|
||||||
return
|
return
|
||||||
if not self.activate():
|
if not self.activate():
|
||||||
|
|
|
@ -71,35 +71,35 @@ class PPTViewer(QtGui.QWidget):
|
||||||
row = 0
|
row = 0
|
||||||
grid.addWidget(folder_label, 0, 0)
|
grid.addWidget(folder_label, 0, 0)
|
||||||
grid.addWidget(self.folderEdit, 0, 1)
|
grid.addWidget(self.folderEdit, 0, 1)
|
||||||
row = row + 1
|
row += 1
|
||||||
grid.addWidget(x_label, row, 0)
|
grid.addWidget(x_label, row, 0)
|
||||||
grid.addWidget(self.xEdit, row, 1)
|
grid.addWidget(self.xEdit, row, 1)
|
||||||
grid.addWidget(y_label, row, 2)
|
grid.addWidget(y_label, row, 2)
|
||||||
grid.addWidget(self.yEdit, row, 3)
|
grid.addWidget(self.yEdit, row, 3)
|
||||||
row = row + 1
|
row += 1
|
||||||
grid.addWidget(width_label, row, 0)
|
grid.addWidget(width_label, row, 0)
|
||||||
grid.addWidget(self.widthEdit, row, 1)
|
grid.addWidget(self.widthEdit, row, 1)
|
||||||
grid.addWidget(height_label, row, 2)
|
grid.addWidget(height_label, row, 2)
|
||||||
grid.addWidget(self.heightEdit, row, 3)
|
grid.addWidget(self.heightEdit, row, 3)
|
||||||
row = row + 1
|
row += 1
|
||||||
grid.addWidget(ppt_label, row, 0)
|
grid.addWidget(ppt_label, row, 0)
|
||||||
grid.addWidget(self.pptEdit, row, 1)
|
grid.addWidget(self.pptEdit, row, 1)
|
||||||
grid.addWidget(ppt_dlg_btn, row, 2)
|
grid.addWidget(ppt_dlg_btn, row, 2)
|
||||||
grid.addWidget(ppt_btn, row, 3)
|
grid.addWidget(ppt_btn, row, 3)
|
||||||
row = row + 1
|
row += 1
|
||||||
grid.addWidget(slide_label, row, 0)
|
grid.addWidget(slide_label, row, 0)
|
||||||
grid.addWidget(self.slideEdit, row, 1)
|
grid.addWidget(self.slideEdit, row, 1)
|
||||||
grid.addWidget(slide_btn, row, 2)
|
grid.addWidget(slide_btn, row, 2)
|
||||||
row = row + 1
|
row += 1
|
||||||
grid.addWidget(prev, row, 0)
|
grid.addWidget(prev, row, 0)
|
||||||
grid.addWidget(next, row, 1)
|
grid.addWidget(next, row, 1)
|
||||||
row = row + 1
|
row += 1
|
||||||
grid.addWidget(blank, row, 0)
|
grid.addWidget(blank, row, 0)
|
||||||
grid.addWidget(unblank, row, 1)
|
grid.addWidget(unblank, row, 1)
|
||||||
row = row + 1
|
row += 1
|
||||||
grid.addWidget(restart, row, 0)
|
grid.addWidget(restart, row, 0)
|
||||||
grid.addWidget(close, row, 1)
|
grid.addWidget(close, row, 1)
|
||||||
row = row + 1
|
row += 1
|
||||||
grid.addWidget(stop, row, 0)
|
grid.addWidget(stop, row, 0)
|
||||||
grid.addWidget(resume, row, 1)
|
grid.addWidget(resume, row, 1)
|
||||||
self.connect(ppt_btn, QtCore.SIGNAL(u'clicked()'), self.openClick)
|
self.connect(ppt_btn, QtCore.SIGNAL(u'clicked()'), self.openClick)
|
||||||
|
|
|
@ -33,7 +33,7 @@ import shutil
|
||||||
|
|
||||||
from PyQt4 import QtCore
|
from PyQt4 import QtCore
|
||||||
|
|
||||||
from openlp.core.lib import Receiver, Registry, check_directory_exists, create_thumb, validate_thumb, Settings
|
from openlp.core.lib import Receiver, Registry, Settings, check_directory_exists, create_thumb, validate_thumb
|
||||||
from openlp.core.utils import AppLocation
|
from openlp.core.utils import AppLocation
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
|
@ -27,9 +27,9 @@
|
||||||
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtGui
|
||||||
|
|
||||||
from openlp.core.lib import Receiver, Settings, SettingsTab, translate, UiStrings
|
from openlp.core.lib import Receiver, Settings, SettingsTab, UiStrings, translate
|
||||||
|
|
||||||
class PresentationTab(SettingsTab):
|
class PresentationTab(SettingsTab):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -138,7 +138,9 @@ class HttpResponse(object):
|
||||||
'Content-Type': 'text/html; charset="utf-8"\r\n'
|
'Content-Type': 'text/html; charset="utf-8"\r\n'
|
||||||
}
|
}
|
||||||
|
|
||||||
def __init__(self, content='', headers={}, code=None):
|
def __init__(self, content='', headers=None, code=None):
|
||||||
|
if headers is None:
|
||||||
|
headers = {}
|
||||||
self.content = content
|
self.content = content
|
||||||
for key, value in headers.iteritems():
|
for key, value in headers.iteritems():
|
||||||
self.headers[key] = value
|
self.headers[key] = value
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
|
|
||||||
from PyQt4 import QtCore, QtGui, QtNetwork
|
from PyQt4 import QtCore, QtGui, QtNetwork
|
||||||
|
|
||||||
from openlp.core.lib import Settings, SettingsTab, translate, Receiver
|
from openlp.core.lib import Settings, SettingsTab, Receiver, translate
|
||||||
|
|
||||||
|
|
||||||
ZERO_URL = u'0.0.0.0'
|
ZERO_URL = u'0.0.0.0'
|
||||||
|
@ -133,7 +133,7 @@ class RemoteTab(SettingsTab):
|
||||||
ipAddress = self.addressEdit.text()
|
ipAddress = self.addressEdit.text()
|
||||||
url = u'http://%s:%s/' % (ipAddress, self.portSpinBox.value())
|
url = u'http://%s:%s/' % (ipAddress, self.portSpinBox.value())
|
||||||
self.remoteUrl.setText(u'<a href="%s">%s</a>' % (url, url))
|
self.remoteUrl.setText(u'<a href="%s">%s</a>' % (url, url))
|
||||||
url = url + u'stage'
|
url += u'stage'
|
||||||
self.stageUrl.setText(u'<a href="%s">%s</a>' % (url, url))
|
self.stageUrl.setText(u'<a href="%s">%s</a>' % (url, url))
|
||||||
|
|
||||||
def load(self):
|
def load(self):
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
|
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
from openlp.core.lib import build_icon, translate, UiStrings
|
from openlp.core.lib import UiStrings, build_icon, translate
|
||||||
from openlp.core.lib.ui import create_button_box, create_button
|
from openlp.core.lib.ui import create_button_box, create_button
|
||||||
from openlp.plugins.songs.lib.ui import SongStrings
|
from openlp.plugins.songs.lib.ui import SongStrings
|
||||||
|
|
||||||
|
|
|
@ -38,9 +38,9 @@ import shutil
|
||||||
|
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
from openlp.core.lib import PluginStatus, Receiver, MediaType, translate, create_separated_list, \
|
from openlp.core.lib import PluginStatus, Receiver, MediaType, Registry, UiStrings, translate, create_separated_list, \
|
||||||
check_directory_exists, Registry, UiStrings
|
check_directory_exists
|
||||||
from openlp.core.lib.ui import UiStrings, set_case_insensitive_completer, critical_error_message_box, \
|
from openlp.core.lib.ui import set_case_insensitive_completer, critical_error_message_box, \
|
||||||
find_and_set_in_combo_box
|
find_and_set_in_combo_box
|
||||||
from openlp.core.utils import AppLocation
|
from openlp.core.utils import AppLocation
|
||||||
from openlp.plugins.songs.forms import EditVerseForm, MediaFilesForm
|
from openlp.plugins.songs.forms import EditVerseForm, MediaFilesForm
|
||||||
|
@ -184,7 +184,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
||||||
Load the media files into a combobox.
|
Load the media files into a combobox.
|
||||||
"""
|
"""
|
||||||
self.audioAddFromMediaButton.setVisible(False)
|
self.audioAddFromMediaButton.setVisible(False)
|
||||||
for plugin in self.parent().pluginManager.plugins:
|
for plugin in self.plugin_manager.plugins:
|
||||||
if plugin.name == u'media' and plugin.status == PluginStatus.Active:
|
if plugin.name == u'media' and plugin.status == PluginStatus.Active:
|
||||||
self.audioAddFromMediaButton.setVisible(True)
|
self.audioAddFromMediaButton.setVisible(True)
|
||||||
self.mediaForm.populateFiles(plugin.mediaItem.getList(MediaType.Audio))
|
self.mediaForm.populateFiles(plugin.mediaItem.getList(MediaType.Audio))
|
||||||
|
@ -907,6 +907,16 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
||||||
except:
|
except:
|
||||||
log.exception(u'Problem processing song Lyrics \n%s', sxml.dump_xml())
|
log.exception(u'Problem processing song Lyrics \n%s', sxml.dump_xml())
|
||||||
|
|
||||||
|
def _get_plugin_manager(self):
|
||||||
|
"""
|
||||||
|
Adds the plugin manager to the class dynamically
|
||||||
|
"""
|
||||||
|
if not hasattr(self, u'_plugin_manager'):
|
||||||
|
self._plugin_manager = Registry().get(u'plugin_manager')
|
||||||
|
return self._plugin_manager
|
||||||
|
|
||||||
|
plugin_manager = property(_get_plugin_manager)
|
||||||
|
|
||||||
def _get_theme_manager(self):
|
def _get_theme_manager(self):
|
||||||
"""
|
"""
|
||||||
Adds the theme manager to the class dynamically
|
Adds the theme manager to the class dynamically
|
||||||
|
@ -915,4 +925,5 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
||||||
self._theme_manager = Registry().get(u'theme_manager')
|
self._theme_manager = Registry().get(u'theme_manager')
|
||||||
return self._theme_manager
|
return self._theme_manager
|
||||||
|
|
||||||
theme_manager = property(_get_theme_manager)
|
theme_manager = property(_get_theme_manager)
|
||||||
|
|
||||||
|
|
|
@ -29,8 +29,8 @@
|
||||||
|
|
||||||
from PyQt4 import QtGui
|
from PyQt4 import QtGui
|
||||||
|
|
||||||
from openlp.core.lib import build_icon, translate, SpellTextEdit
|
from openlp.core.lib import SpellTextEdit, build_icon, translate
|
||||||
from openlp.core.lib.ui import create_button_box, UiStrings
|
from openlp.core.lib.ui import UiStrings, create_button_box
|
||||||
from openlp.plugins.songs.lib import VerseType
|
from openlp.plugins.songs.lib import VerseType
|
||||||
|
|
||||||
class Ui_EditVerseDialog(object):
|
class Ui_EditVerseDialog(object):
|
||||||
|
|
|
@ -32,8 +32,7 @@ import logging
|
||||||
|
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
from openlp.core.lib.ui import critical_error_message_box
|
from openlp.plugins.songs.lib import VerseType
|
||||||
from openlp.plugins.songs.lib import VerseType, translate
|
|
||||||
|
|
||||||
from editversedialog import Ui_EditVerseDialog
|
from editversedialog import Ui_EditVerseDialog
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ import logging
|
||||||
|
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
from openlp.core.lib import build_icon, Receiver, translate, create_separated_list, UiStrings
|
from openlp.core.lib import Receiver, UiStrings, create_separated_list, build_icon, translate
|
||||||
from openlp.core.lib.ui import critical_error_message_box
|
from openlp.core.lib.ui import critical_error_message_box
|
||||||
from openlp.core.ui.wizard import OpenLPWizard, WizardStrings
|
from openlp.core.ui.wizard import OpenLPWizard, WizardStrings
|
||||||
from openlp.plugins.songs.lib import natcmp
|
from openlp.plugins.songs.lib import natcmp
|
||||||
|
@ -226,7 +226,7 @@ class SongExportForm(OpenLPWizard):
|
||||||
self.directoryLineEdit.clear()
|
self.directoryLineEdit.clear()
|
||||||
self.searchLineEdit.clear()
|
self.searchLineEdit.clear()
|
||||||
# Load the list of songs.
|
# Load the list of songs.
|
||||||
Receiver.send_message(u'cursor_busy')
|
self.application.set_busy_cursor()
|
||||||
songs = self.plugin.manager.get_all_objects(Song)
|
songs = self.plugin.manager.get_all_objects(Song)
|
||||||
songs.sort(cmp=natcmp, key=lambda song: song.sort_key)
|
songs.sort(cmp=natcmp, key=lambda song: song.sort_key)
|
||||||
for song in songs:
|
for song in songs:
|
||||||
|
@ -240,7 +240,7 @@ class SongExportForm(OpenLPWizard):
|
||||||
item.setFlags(QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsUserCheckable | QtCore.Qt.ItemIsEnabled)
|
item.setFlags(QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsUserCheckable | QtCore.Qt.ItemIsEnabled)
|
||||||
item.setCheckState(QtCore.Qt.Unchecked)
|
item.setCheckState(QtCore.Qt.Unchecked)
|
||||||
self.availableListWidget.addItem(item)
|
self.availableListWidget.addItem(item)
|
||||||
Receiver.send_message(u'cursor_normal')
|
self.application.set_normal_cursor()
|
||||||
|
|
||||||
def preWizard(self):
|
def preWizard(self):
|
||||||
"""
|
"""
|
||||||
|
@ -248,7 +248,7 @@ class SongExportForm(OpenLPWizard):
|
||||||
"""
|
"""
|
||||||
OpenLPWizard.preWizard(self)
|
OpenLPWizard.preWizard(self)
|
||||||
self.progressLabel.setText(translate('SongsPlugin.ExportWizardForm', 'Starting export...'))
|
self.progressLabel.setText(translate('SongsPlugin.ExportWizardForm', 'Starting export...'))
|
||||||
Receiver.send_message(u'openlp_process_events')
|
self.application.process_events()
|
||||||
|
|
||||||
def performWizard(self):
|
def performWizard(self):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -35,7 +35,7 @@ import os
|
||||||
|
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
from openlp.core.lib import Receiver, Settings, UiStrings, translate
|
from openlp.core.lib import Settings, UiStrings, translate
|
||||||
from openlp.core.lib.ui import critical_error_message_box
|
from openlp.core.lib.ui import critical_error_message_box
|
||||||
from openlp.core.ui.wizard import OpenLPWizard, WizardStrings
|
from openlp.core.ui.wizard import OpenLPWizard, WizardStrings
|
||||||
from openlp.plugins.songs.lib.importer import SongFormat, SongFormatSelect
|
from openlp.plugins.songs.lib.importer import SongFormat, SongFormatSelect
|
||||||
|
@ -339,7 +339,7 @@ class SongImportForm(OpenLPWizard):
|
||||||
"""
|
"""
|
||||||
OpenLPWizard.preWizard(self)
|
OpenLPWizard.preWizard(self)
|
||||||
self.progressLabel.setText(WizardStrings.StartingImport)
|
self.progressLabel.setText(WizardStrings.StartingImport)
|
||||||
Receiver.send_message(u'openlp_process_events')
|
self.application.process_events()
|
||||||
|
|
||||||
def performWizard(self):
|
def performWizard(self):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
|
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
from openlp.core.lib import build_icon, UiStrings
|
from openlp.core.lib import UiStrings, build_icon
|
||||||
from openlp.core.lib.ui import create_button_box
|
from openlp.core.lib.ui import create_button_box
|
||||||
from openlp.plugins.songs.lib.ui import SongStrings
|
from openlp.plugins.songs.lib.ui import SongStrings
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ import logging
|
||||||
from PyQt4 import QtGui, QtCore
|
from PyQt4 import QtGui, QtCore
|
||||||
from sqlalchemy.sql import and_
|
from sqlalchemy.sql import and_
|
||||||
|
|
||||||
from openlp.core.lib import Receiver, translate, UiStrings
|
from openlp.core.lib import Receiver, UiStrings, translate
|
||||||
from openlp.core.lib.ui import critical_error_message_box
|
from openlp.core.lib.ui import critical_error_message_box
|
||||||
from openlp.plugins.songs.forms import AuthorsForm, TopicsForm, SongBookForm
|
from openlp.plugins.songs.forms import AuthorsForm, TopicsForm, SongBookForm
|
||||||
from openlp.plugins.songs.lib.db import Author, Book, Topic, Song
|
from openlp.plugins.songs.lib.db import Author, Book, Topic, Song
|
||||||
|
@ -374,12 +374,12 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
|
||||||
"""
|
"""
|
||||||
Utility method to merge two objects to leave one in the database.
|
Utility method to merge two objects to leave one in the database.
|
||||||
"""
|
"""
|
||||||
Receiver.send_message(u'cursor_busy')
|
self.application.set_busy_cursor()
|
||||||
merge(dbObject)
|
merge(dbObject)
|
||||||
reset()
|
reset()
|
||||||
if not self.fromSongEdit:
|
if not self.fromSongEdit:
|
||||||
Receiver.send_message(u'songs_load_list')
|
Receiver.send_message(u'songs_load_list')
|
||||||
Receiver.send_message(u'cursor_normal')
|
self.application.set_normal_cursor()
|
||||||
|
|
||||||
def mergeAuthors(self, oldAuthor):
|
def mergeAuthors(self, oldAuthor):
|
||||||
"""
|
"""
|
||||||
|
@ -509,3 +509,12 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
|
||||||
deleteButton.setEnabled(True)
|
deleteButton.setEnabled(True)
|
||||||
editButton.setEnabled(True)
|
editButton.setEnabled(True)
|
||||||
|
|
||||||
|
def _get_application(self):
|
||||||
|
"""
|
||||||
|
Adds the openlp to the class dynamically
|
||||||
|
"""
|
||||||
|
if not hasattr(self, u'_application'):
|
||||||
|
self._application = Registry().get(u'application')
|
||||||
|
return self._application
|
||||||
|
|
||||||
|
application = property(_get_application)
|
||||||
|
|
|
@ -571,6 +571,8 @@ def strip_rtf(text, default_encoding=None):
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
encoding, default_encoding = get_encoding(font, font_table, default_encoding, failed=failed)
|
encoding, default_encoding = get_encoding(font, font_table, default_encoding, failed=failed)
|
||||||
|
if not encoding:
|
||||||
|
return None
|
||||||
out.append(chr(charcode).decode(encoding))
|
out.append(chr(charcode).decode(encoding))
|
||||||
except UnicodeDecodeError:
|
except UnicodeDecodeError:
|
||||||
failed = True
|
failed = True
|
||||||
|
|
|
@ -162,7 +162,7 @@ class EasySlidesImport(SongImport):
|
||||||
region = self._extractRegion(line)
|
region = self._extractRegion(line)
|
||||||
regionlines[region] = 1 + regionlines.get(region, 0)
|
regionlines[region] = 1 + regionlines.get(region, 0)
|
||||||
elif line[0] == u'[':
|
elif line[0] == u'[':
|
||||||
separatorlines = separatorlines + 1
|
separatorlines += 1
|
||||||
# if the song has separators
|
# if the song has separators
|
||||||
separators = (separatorlines > 0)
|
separators = (separatorlines > 0)
|
||||||
# the number of different regions in song - 1
|
# the number of different regions in song - 1
|
||||||
|
@ -200,7 +200,7 @@ class EasySlidesImport(SongImport):
|
||||||
# separators are used, so empty line means slide break
|
# separators are used, so empty line means slide break
|
||||||
# inside verse
|
# inside verse
|
||||||
if self._listHas(verses, [reg, vt, vn, inst]):
|
if self._listHas(verses, [reg, vt, vn, inst]):
|
||||||
inst = inst + 1
|
inst += 1
|
||||||
else:
|
else:
|
||||||
# separators are not used, so empty line starts a new verse
|
# separators are not used, so empty line starts a new verse
|
||||||
vt = u'V'
|
vt = u'V'
|
||||||
|
|
|
@ -174,7 +174,10 @@ class EasyWorshipSongImport(SongImport):
|
||||||
self.addAuthor(author_name.strip())
|
self.addAuthor(author_name.strip())
|
||||||
if words:
|
if words:
|
||||||
# Format the lyrics
|
# Format the lyrics
|
||||||
words, self.encoding = strip_rtf(words, self.encoding)
|
result = strip_rtf(words, self.encoding)
|
||||||
|
if result is None:
|
||||||
|
return
|
||||||
|
words, self.encoding = result
|
||||||
verse_type = VerseType.Tags[VerseType.Verse]
|
verse_type = VerseType.Tags[VerseType.Verse]
|
||||||
for verse in SLIDE_BREAK_REGEX.split(words):
|
for verse in SLIDE_BREAK_REGEX.split(words):
|
||||||
verse = verse.strip()
|
verse = verse.strip()
|
||||||
|
|
|
@ -35,8 +35,8 @@ import shutil
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
from sqlalchemy.sql import or_
|
from sqlalchemy.sql import or_
|
||||||
|
|
||||||
from openlp.core.lib import MediaManagerItem, Receiver, ItemCapabilities, translate, check_item_selected, \
|
from openlp.core.lib import MediaManagerItem, Receiver, ItemCapabilities, PluginStatus, ServiceItemContext, Settings, \
|
||||||
PluginStatus, create_separated_list, check_directory_exists, ServiceItemContext, Settings, UiStrings
|
UiStrings, translate, check_item_selected, create_separated_list, check_directory_exists
|
||||||
from openlp.core.lib.ui import create_widget_action
|
from openlp.core.lib.ui import create_widget_action
|
||||||
from openlp.core.utils import AppLocation
|
from openlp.core.utils import AppLocation
|
||||||
from openlp.plugins.songs.forms import EditSongForm, SongMaintenanceForm, SongImportForm, SongExportForm
|
from openlp.plugins.songs.forms import EditSongForm, SongMaintenanceForm, SongImportForm, SongExportForm
|
||||||
|
@ -361,7 +361,7 @@ class SongMediaItem(MediaManagerItem):
|
||||||
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes | QtGui.QMessageBox.No),
|
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes | QtGui.QMessageBox.No),
|
||||||
QtGui.QMessageBox.Yes) == QtGui.QMessageBox.No:
|
QtGui.QMessageBox.Yes) == QtGui.QMessageBox.No:
|
||||||
return
|
return
|
||||||
Receiver.send_message(u'cursor_busy')
|
self.application.set_busy_cursor()
|
||||||
self.main_window.displayProgressBar(len(items))
|
self.main_window.displayProgressBar(len(items))
|
||||||
for item in items:
|
for item in items:
|
||||||
item_id = item.data(QtCore.Qt.UserRole)
|
item_id = item.data(QtCore.Qt.UserRole)
|
||||||
|
@ -380,7 +380,7 @@ class SongMediaItem(MediaManagerItem):
|
||||||
self.plugin.manager.delete_object(Song, item_id)
|
self.plugin.manager.delete_object(Song, item_id)
|
||||||
self.main_window.incrementProgressBar()
|
self.main_window.incrementProgressBar()
|
||||||
self.main_window.finishedProgressBar()
|
self.main_window.finishedProgressBar()
|
||||||
Receiver.send_message(u'cursor_normal')
|
self.application.set_normal_cursor()
|
||||||
self.onSearchTextButtonClicked()
|
self.onSearchTextButtonClicked()
|
||||||
|
|
||||||
def onCloneClick(self):
|
def onCloneClick(self):
|
||||||
|
@ -526,7 +526,7 @@ class SongMediaItem(MediaManagerItem):
|
||||||
temporary = True
|
temporary = True
|
||||||
# Update service with correct song id.
|
# Update service with correct song id.
|
||||||
if editId:
|
if editId:
|
||||||
Receiver.send_message(u'service_item_update%s:%s:%s' % (editId, item.unique_identifier, temporary))
|
self.service_manager.service_item_update(editId, item.unique_identifier, temporary)
|
||||||
|
|
||||||
def search(self, string, showError):
|
def search(self, string, showError):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -35,7 +35,7 @@ import os
|
||||||
|
|
||||||
from lxml import etree
|
from lxml import etree
|
||||||
|
|
||||||
from openlp.core.lib import check_directory_exists, Receiver, translate
|
from openlp.core.lib import Registry, check_directory_exists, translate
|
||||||
from openlp.core.utils import clean_filename
|
from openlp.core.utils import clean_filename
|
||||||
from openlp.plugins.songs.lib import OpenLyrics
|
from openlp.plugins.songs.lib import OpenLyrics
|
||||||
|
|
||||||
|
@ -64,7 +64,7 @@ class OpenLyricsExport(object):
|
||||||
openLyrics = OpenLyrics(self.manager)
|
openLyrics = OpenLyrics(self.manager)
|
||||||
self.parent.progressBar.setMaximum(len(self.songs))
|
self.parent.progressBar.setMaximum(len(self.songs))
|
||||||
for song in self.songs:
|
for song in self.songs:
|
||||||
Receiver.send_message(u'openlp_process_events')
|
self.application.process_events()
|
||||||
if self.parent.stop_export_flag:
|
if self.parent.stop_export_flag:
|
||||||
return False
|
return False
|
||||||
self.parent.incrementProgressBar(translate('SongsPlugin.OpenLyricsExport', 'Exporting "%s"...') %
|
self.parent.incrementProgressBar(translate('SongsPlugin.OpenLyricsExport', 'Exporting "%s"...') %
|
||||||
|
@ -80,3 +80,13 @@ class OpenLyricsExport(object):
|
||||||
tree.write(open(os.path.join(self.save_path, filename), u'w'),
|
tree.write(open(os.path.join(self.save_path, filename), u'w'),
|
||||||
encoding=u'utf-8', xml_declaration=True, pretty_print=True)
|
encoding=u'utf-8', xml_declaration=True, pretty_print=True)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
def _get_application(self):
|
||||||
|
"""
|
||||||
|
Adds the openlp to the class dynamically
|
||||||
|
"""
|
||||||
|
if not hasattr(self, u'_application'):
|
||||||
|
self._application = Registry().get(u'application')
|
||||||
|
return self._application
|
||||||
|
|
||||||
|
application = property(_get_application)
|
||||||
|
|
|
@ -107,7 +107,10 @@ class SongProImport(SongImport):
|
||||||
self.finish()
|
self.finish()
|
||||||
return
|
return
|
||||||
if u'rtf1' in text:
|
if u'rtf1' in text:
|
||||||
text, self.encoding = strip_rtf(text, self.encoding)
|
result = strip_rtf(text, self.encoding)
|
||||||
|
if result is None:
|
||||||
|
return
|
||||||
|
text, self.encoding = result
|
||||||
text = text.rstrip()
|
text = text.rstrip()
|
||||||
if not text:
|
if not text:
|
||||||
return
|
return
|
||||||
|
|
|
@ -203,7 +203,7 @@ class SongShowPlusImport(SongImport):
|
||||||
if verse_name not in self.otherList:
|
if verse_name not in self.otherList:
|
||||||
if ignore_unique:
|
if ignore_unique:
|
||||||
return None
|
return None
|
||||||
self.otherCount = self.otherCount + 1
|
self.otherCount += 1
|
||||||
self.otherList[verse_name] = str(self.otherCount)
|
self.otherList[verse_name] = str(self.otherCount)
|
||||||
verse_tag = VerseType.Tags[VerseType.Other]
|
verse_tag = VerseType.Tags[VerseType.Other]
|
||||||
verse_number = self.otherList[verse_name]
|
verse_number = self.otherList[verse_name]
|
||||||
|
|
|
@ -121,7 +121,7 @@ class SundayPlusImport(SongImport):
|
||||||
end = data.find(')', i) + 1
|
end = data.find(')', i) + 1
|
||||||
value = data[i:end]
|
value = data[i:end]
|
||||||
# If we are in the main group.
|
# If we are in the main group.
|
||||||
if cell == False:
|
if not cell:
|
||||||
if name == 'title':
|
if name == 'title':
|
||||||
self.title = self.decode(self.unescape(value))
|
self.title = self.decode(self.unescape(value))
|
||||||
elif name == 'Author':
|
elif name == 'Author':
|
||||||
|
@ -148,7 +148,10 @@ class SundayPlusImport(SongImport):
|
||||||
verse_type = HOTKEY_TO_VERSE_TYPE[value]
|
verse_type = HOTKEY_TO_VERSE_TYPE[value]
|
||||||
if name == 'rtf':
|
if name == 'rtf':
|
||||||
value = self.unescape(value)
|
value = self.unescape(value)
|
||||||
verse, self.encoding = strip_rtf(value, self.encoding)
|
result = strip_rtf(value, self.encoding)
|
||||||
|
if result is None:
|
||||||
|
return
|
||||||
|
verse, self.encoding = result
|
||||||
lines = verse.strip().split('\n')
|
lines = verse.strip().split('\n')
|
||||||
# If any line inside any verse contains CCLI or
|
# If any line inside any verse contains CCLI or
|
||||||
# only Public Domain, we treat this as special data:
|
# only Public Domain, we treat this as special data:
|
||||||
|
|
|
@ -36,7 +36,7 @@ import logging
|
||||||
LOG_FILENAME = 'test_import_file.log'
|
LOG_FILENAME = 'test_import_file.log'
|
||||||
logging.basicConfig(filename=LOG_FILENAME,level=logging.INFO)
|
logging.basicConfig(filename=LOG_FILENAME,level=logging.INFO)
|
||||||
|
|
||||||
from test_opensongimport import wizard_stub, progbar_stub
|
from test_opensongimport import wizard_stub
|
||||||
|
|
||||||
def test(filenames):
|
def test(filenames):
|
||||||
manager = Manager(u'songs', init_schema)
|
manager = Manager(u'songs', init_schema)
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue