Fix name and other bugs

This commit is contained in:
Tim Bentley 2013-02-03 19:23:12 +00:00
parent 28aeed815f
commit a9a4c7938e
33 changed files with 208 additions and 209 deletions

View File

@ -135,7 +135,7 @@ class OpenLP(QtGui.QApplication):
# make sure Qt really display the splash screen
self.processEvents()
# start the main app window
self.main_window = MainWindow(self)
self.main_window = MainWindow()
self.main_window.show()
if show_splash:
# now kill the splashscreen
@ -308,7 +308,7 @@ def main(args=None):
application.setApplicationName(u'OpenLP')
set_up_logging(AppLocation.get_directory(AppLocation.CacheDir))
Registry.create()
Registry().register(u'openlp_core', application)
Registry().register(u'application', application)
application.setApplicationVersion(get_application_version()[u'version'])
# Instance check
if application.is_already_running():

View File

@ -332,9 +332,9 @@ class MediaManagerItem(QtGui.QWidget):
Settings().value(self.settingsSection + u'/last directory'), self.onNewFileMasks)
log.info(u'New files(s) %s', files)
if files:
self.openlp_core.set_busy_cursor()
self.application.set_busy_cursor()
self.validateAndLoad(files)
self.openlp_core.set_normal_cursor()
self.application.set_normal_cursor()
def loadFile(self, files):
"""
@ -719,12 +719,12 @@ class MediaManagerItem(QtGui.QWidget):
theme_manager = property(_get_theme_manager)
def _get_openlp_core(self):
def _get_application(self):
"""
Adds the openlp to the class dynamically
"""
if not hasattr(self, u'_openlp_core'):
self._openlp_core = Registry().get(u'openlp_core')
return self._openlp_core
if not hasattr(self, u'_application'):
self._application = Registry().get(u'application')
return self._application
openlp_core = property(_get_openlp_core)
application = property(_get_application)

View File

@ -425,12 +425,12 @@ class Plugin(QtCore.QObject):
main_window = property(_get_main_window)
def _get_openlp_core(self):
def _get_application(self):
"""
Adds the openlp to the class dynamically
"""
if not hasattr(self, u'_openlp_core'):
self._openlp_core = Registry().get(u'openlp_core')
return self._openlp_core
if not hasattr(self, u'_application'):
self._application = Registry().get(u'application')
return self._application
openlp_core = property(_get_openlp_core)
application = property(_get_application)

View File

@ -152,13 +152,13 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
# Download the theme screenshots.
self.themeScreenshotThread = ThemeScreenshotThread(self)
self.themeScreenshotThread.start()
self.openlp_core.set_normal_cursor()
self.application.set_normal_cursor()
def nextId(self):
"""
Determine the next page in the Wizard to go to.
"""
self.openlp_core.process_events()
self.application.process_events()
if self.currentId() == FirstTimePage.Plugins:
if not self.webAccess:
return FirstTimePage.NoInternet
@ -169,13 +169,13 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
elif self.currentId() == FirstTimePage.NoInternet:
return FirstTimePage.Progress
elif self.currentId() == FirstTimePage.Themes:
self.openlp_core.set_busy_cursor()
self.application.set_busy_cursor()
while not self.themeScreenshotThread.isFinished():
time.sleep(0.1)
self.openlp_core.process_events()
self.application.process_events()
# Build the screenshot icons, as this can not be done in the thread.
self._buildThemeScreenshots()
self.openlp_core.set_normal_cursor()
self.application.set_normal_cursor()
return FirstTimePage.Defaults
else:
return self.currentId() + 1
@ -186,7 +186,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
"""
# Keep track of the page we are at. Triggering "Cancel" causes pageId
# to be a -1.
self.openlp_core.process_events()
self.application.process_events()
if pageId != -1:
self.lastId = pageId
if pageId == FirstTimePage.Plugins:
@ -218,15 +218,15 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
if self.hasRunWizard:
self.cancelButton.setVisible(False)
elif pageId == FirstTimePage.Progress:
self.openlp_core.set_busy_cursor()
self.application.set_busy_cursor()
self.repaint()
self.openlp_core.process_events()
self.application.process_events()
# Try to give the wizard a chance to redraw itself
time.sleep(0.2)
self._preWizard()
self._performWizard()
self._postWizard()
self.openlp_core.set_normal_cursor()
self.application.set_normal_cursor()
def updateScreenListCombo(self):
"""
@ -248,15 +248,15 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
self.was_download_cancelled = True
while self.themeScreenshotThread.isRunning():
time.sleep(0.1)
self.openlp_core.set_normal_cursor()
self.application.set_normal_cursor()
def onNoInternetFinishButtonClicked(self):
"""
Process the triggering of the "Finish" button on the No Internet page.
"""
self.openlp_core.set_busy_cursor()
self.application.set_busy_cursor()
self._performWizard()
self.openlp_core.set_normal_cursor()
self.application.set_normal_cursor()
Settings().setValue(u'general/has run wizard', True)
self.close()
@ -332,7 +332,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
self.progressLabel.setText(status_text)
if increment > 0:
self.progressBar.setValue(self.progressBar.value() + increment)
self.openlp_core.process_events()
self.application.process_events()
def _preWizard(self):
"""
@ -340,10 +340,10 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
"""
self.max_progress = 0
self.finishButton.setVisible(False)
self.openlp_core.process_events()
self.application.process_events()
# Loop through the songs list and increase for each selected item
for i in xrange(self.songsListWidget.count()):
self.openlp_core.process_events()
self.application.process_events()
item = self.songsListWidget.item(i)
if item.checkState() == QtCore.Qt.Checked:
filename = item.data(QtCore.Qt.UserRole)
@ -352,7 +352,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
# Loop through the Bibles list and increase for each selected item
iterator = QtGui.QTreeWidgetItemIterator(self.biblesTreeWidget)
while iterator.value():
self.openlp_core.process_events()
self.application.process_events()
item = iterator.value()
if item.parent() and item.checkState(0) == QtCore.Qt.Checked:
filename = item.data(0, QtCore.Qt.UserRole)
@ -361,7 +361,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
iterator += 1
# Loop through the themes list and increase for each selected item
for i in xrange(self.themesListWidget.count()):
self.openlp_core.process_events()
self.application.process_events()
item = self.themesListWidget.item(i)
if item.checkState() == QtCore.Qt.Checked:
filename = item.data(QtCore.Qt.UserRole)
@ -381,7 +381,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
self.progressPage.setTitle(translate('OpenLP.FirstTimeWizard', 'Setting Up'))
self.progressPage.setSubTitle(u'Setup complete.')
self.repaint()
self.openlp_core.process_events()
self.application.process_events()
# Try to give the wizard a chance to repaint itself
time.sleep(0.1)
@ -408,7 +408,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
self.finishButton.setEnabled(True)
self.cancelButton.setVisible(False)
self.nextButton.setVisible(False)
self.openlp_core.process_events()
self.application.process_events()
def _performWizard(self):
"""
@ -487,12 +487,12 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
theme_manager = property(_get_theme_manager)
def _get_openlp_core(self):
def _get_application(self):
"""
Adds the openlp to the class dynamically
"""
if not hasattr(self, u'_openlp_core'):
self._openlp_core = Registry().get(u'openlp_core')
return self._openlp_core
if not hasattr(self, u'_application'):
self._application = Registry().get(u'application')
return self._application
openlp_core = property(_get_openlp_core)
application = property(_get_application)

View File

@ -243,7 +243,7 @@ class MainDisplay(Display):
log.debug(u'text to display')
# Wait for the webview to update before displaying text.
while not self.webLoaded:
self.openlp_core.process_events()
self.application.process_events()
self.setGeometry(self.screen[u'size'])
if animate:
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.
"""
log.debug(u'preview for %s', self.isLive)
self.openlp_core.process_events()
self.application.process_events()
# We must have a service item to preview.
if self.isLive and hasattr(self, u'serviceItem'):
# Wait for the fade to finish before geting the preview.
# Important otherwise preview will have incorrect text if at all!
if self.serviceItem.themedata and self.serviceItem.themedata.display_slide_transition:
while self.frame.evaluateJavaScript(u'show_text_complete()') == u'false':
self.openlp_core.process_events()
self.application.process_events()
# Wait for the webview to update before getting the preview.
# Important otherwise first preview will miss the background !
while not self.webLoaded:
self.openlp_core.process_events()
self.application.process_events()
# if was hidden keep it hidden
if self.isLive:
if self.hideMode:
@ -503,15 +503,15 @@ class MainDisplay(Display):
image_manager = property(_get_image_manager)
def _get_openlp_core(self):
def _get_application(self):
"""
Adds the openlp to the class dynamically
"""
if not hasattr(self, u'_openlp_core'):
self._openlp_core = Registry().get(u'openlp_core')
return self._openlp_core
if not hasattr(self, u'_application'):
self._application = Registry().get(u'application')
return self._application
openlp_core = property(_get_openlp_core)
application = property(_get_application)
class AudioPlayer(QtCore.QObject):

View File

@ -455,14 +455,13 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
"""
log.info(u'MainWindow loaded')
def __init__(self, application):
def __init__(self):
"""
This constructor sets up the interface, the various managers, and the
plugins.
"""
QtGui.QMainWindow.__init__(self)
Registry().register(u'main_window', self)
self.application = application
self.clipboard = self.application.clipboard()
self.arguments = self.application.args
# Set up settings sections for the main application (not for use by plugins).
@ -538,7 +537,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'cleanup'), self.clean_up)
# Media Manager
QtCore.QObject.connect(self.mediaToolBox, QtCore.SIGNAL(u'currentChanged(int)'), self.onMediaToolBoxChanged)
self.openlp_core.set_busy_cursor()
self.application.set_busy_cursor()
# 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_information_message'),
@ -586,7 +585,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
# Hide/show the theme combobox on the service manager
self.serviceManagerContents.theme_change()
# Reset the cursor
self.openlp_core.set_normal_cursor()
self.application.set_normal_cursor()
def setAutoLanguage(self, value):
"""
@ -647,22 +646,22 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
"""
Give all the plugins a chance to perform some tasks at startup
"""
self.openlp_core.process_events()
self.application.process_events()
for plugin in self.plugin_manager.plugins:
if plugin.isActive():
plugin.app_startup()
self.openlp_core.process_events()
self.application.process_events()
def first_time(self):
"""
Import themes if first time
"""
self.openlp_core.process_events()
self.application.process_events()
for plugin in self.plugin_manager.plugins:
if hasattr(plugin, u'first_time'):
self.openlp_core.process_events()
self.application.process_events()
plugin.first_time()
self.openlp_core.process_events()
self.application.process_events()
temp_dir = os.path.join(unicode(gettempdir()), u'openlp')
shutil.rmtree(temp_dir, True)
@ -688,7 +687,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
first_run_wizard.exec_()
if first_run_wizard.was_download_cancelled:
return
self.openlp_core.set_busy_cursor()
self.application.set_busy_cursor()
self.first_time()
for plugin in self.plugin_manager.plugins:
self.activePlugin = plugin
@ -706,7 +705,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
# Check if any Bibles downloaded. If there are, they will be
# processed.
Receiver.send_message(u'bibles_load_list', True)
self.openlp_core.set_normal_cursor()
self.application.set_normal_cursor()
def blankCheck(self):
"""
@ -723,21 +722,21 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
"""
Display an error message
"""
self.openlp_core.close_splash_screen()
self.application.close_splash_screen()
QtGui.QMessageBox.critical(self, data[u'title'], data[u'message'])
def warning_message(self, message):
"""
Display a warning message
"""
self.openlp_core.close_splash_screen()
self.application.close_splash_screen()
QtGui.QMessageBox.warning(self, message[u'title'], message[u'message'])
def onInformationMessage(self, data):
"""
Display an informational message
"""
self.openlp_core.close_splash_screen()
self.application.close_splash_screen()
QtGui.QMessageBox.information(self, data[u'title'], data[u'message'])
def onHelpWebSiteClicked(self):
@ -1003,14 +1002,14 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
renderer.
"""
log.debug(u'screenChanged')
self.openlp_core.set_busy_cursor()
self.application.set_busy_cursor()
self.imageManager.update_display()
self.renderer.update_display()
self.previewController.screenSizeChanged()
self.liveController.screenSizeChanged()
self.setFocus()
self.activateWindow()
self.openlp_core.set_normal_cursor()
self.application.set_normal_cursor()
def closeEvent(self, event):
"""
@ -1309,14 +1308,14 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
self.loadProgressBar.show()
self.loadProgressBar.setMaximum(size)
self.loadProgressBar.setValue(0)
self.openlp_core.process_events()
self.application.process_events()
def incrementProgressBar(self):
"""
Increase the Progress Bar value by 1
"""
self.loadProgressBar.setValue(self.loadProgressBar.value() + 1)
self.openlp_core.process_events()
self.application.process_events()
def finishedProgressBar(self):
"""
@ -1331,7 +1330,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
if event.timerId() == self.timer_id:
self.timer_id = 0
self.loadProgressBar.hide()
self.openlp_core.process_events()
self.application.process_events()
def setNewDataPath(self, new_data_path):
"""
@ -1352,7 +1351,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
log.info(u'Changing data path to %s' % self.newDataPath)
old_data_path = unicode(AppLocation.get_data_path())
# Copy OpenLP data to new location if requested.
self.openlp_core.set_busy_cursor()
self.application.set_busy_cursor()
if self.copyData:
log.info(u'Copying data to new path')
try:
@ -1362,7 +1361,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
dir_util.copy_tree(old_data_path, self.newDataPath)
log.info(u'Copy sucessful')
except (IOError, os.error, DistutilsFileError), why:
self.openlp_core.set_normal_cursor()
self.application.set_normal_cursor()
log.exception(u'Data copy failed %s' % unicode(why))
QtGui.QMessageBox.critical(self, translate('OpenLP.MainWindow', 'New Data Directory Error'),
translate('OpenLP.MainWindow',
@ -1377,14 +1376,14 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
# Check if the new data path is our default.
if self.newDataPath == AppLocation.get_directory(AppLocation.DataDir):
settings.remove(u'advanced/data path')
self.openlp_core.set_normal_cursor()
self.application.set_normal_cursor()
def _get_openlp_core(self):
def _get_application(self):
"""
Adds the openlp to the class dynamically
"""
if not hasattr(self, u'_openlp_core'):
self._openlp_core = Registry().get(u'openlp_core')
return self._openlp_core
if not hasattr(self, u'_application'):
self._application = Registry().get(u'application')
return self._application
openlp_core = property(_get_openlp_core)
application = property(_get_application)

View File

@ -151,12 +151,12 @@ class MediaPlayer(object):
"""
return u''
def _get_openlp_core(self):
def _get_application(self):
"""
Adds the openlp to the class dynamically
"""
if not hasattr(self, u'_openlp_core'):
self._openlp_core = Registry().get(u'openlp_core')
return self._openlp_core
if not hasattr(self, u'_application'):
self._application = Registry().get(u'application')
return self._application
openlp_core = property(_get_openlp_core)
application = property(_get_application)

View File

@ -168,7 +168,7 @@ class PhononPlayer(MediaPlayer):
current_state = display.mediaObject.state()
if current_state == Phonon.ErrorState:
return False
self.openlp_core.process_events()
self.application.process_events()
if (datetime.now() - start).seconds > 5:
return False
return True

View File

@ -187,7 +187,7 @@ class VlcPlayer(MediaPlayer):
while not mediaState == display.vlcMedia.get_state():
if display.vlcMedia.get_state() == vlc.State.Error:
return False
self.openlp_core.process_events()
self.application.process_events()
if (datetime.now() - start).seconds > 60:
return False
return True

View File

@ -140,9 +140,9 @@ class PluginForm(QtGui.QDialog, Ui_PluginViewDialog):
if self.programaticChange or status == PluginStatus.Disabled:
return
if status == PluginStatus.Inactive:
self.openlp_core.set_busy_cursor()
self.application.set_busy_cursor()
self.activePlugin.toggleStatus(PluginStatus.Active)
self.openlp_core.set_normal_cursor()
self.application.set_normal_cursor()
self.activePlugin.app_startup()
else:
self.activePlugin.toggleStatus(PluginStatus.Inactive)
@ -166,12 +166,12 @@ class PluginForm(QtGui.QDialog, Ui_PluginViewDialog):
plugin_manager = property(_get_plugin_manager)
def _get_openlp_core(self):
def _get_application(self):
"""
Adds the openlp to the class dynamically
"""
if not hasattr(self, u'_openlp_core'):
self._openlp_core = Registry().get(u'openlp_core')
return self._openlp_core
if not hasattr(self, u'_application'):
self._application = Registry().get(u'application')
return self._application
openlp_core = property(_get_openlp_core)
application = property(_get_application)

View File

@ -178,7 +178,7 @@ class PrintServiceForm(QtGui.QDialog, Ui_PrintServiceDialog):
self._addElement(u'body', parent=html_data)
self._addElement(u'h1', cgi.escape(self.titleLineEdit.text()),
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)
# Add the custom service notes:
if self.footerTextEdit.toPlainText():

View File

@ -478,7 +478,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
missing_list = []
audio_files = []
total_size = 0
self.openlp_core.set_busy_cursor()
self.application.set_busy_cursor()
# Number of items + 1 to zip it
self.main_window.displayProgressBar(len(self.service_items) + 1)
# Get list of missing files, and list of files to write
@ -494,7 +494,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
else:
write_list.append(path_from)
if missing_list:
self.openlp_core.set_normal_cursor()
self.application.set_normal_cursor()
title = translate('OpenLP.ServiceManager', 'Service File(s) Missing')
message = translate('OpenLP.ServiceManager',
'The following file(s) in the service are missing:\n\t%s\n\n'
@ -564,7 +564,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
if zip_file:
zip_file.close()
self.main_window.finishedProgressBar()
self.openlp_core.set_normal_cursor()
self.application.set_normal_cursor()
if success:
try:
shutil.copy(temp_file_name, path_file_name)
@ -593,7 +593,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
log.debug(u'ServiceManager.save_file - %s', path_file_name)
Settings().setValue(self.main_window.serviceManagerSettingsSection + u'/last directory', path)
service = []
self.openlp_core.set_busy_cursor()
self.application.set_busy_cursor()
# Number of items + 1 to zip it
self.main_window.displayProgressBar(len(self.service_items) + 1)
for item in self.service_items:
@ -622,7 +622,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
if zip_file:
zip_file.close()
self.main_window.finishedProgressBar()
self.openlp_core.set_normal_cursor()
self.application.set_normal_cursor()
if success:
try:
shutil.copy(temp_file_name, path_file_name)
@ -699,7 +699,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
return False
zip_file = None
file_to = None
self.openlp_core.set_busy_cursor()
self.application.set_busy_cursor()
try:
zip_file = zipfile.ZipFile(file_name)
for zip_info in zip_file.infolist():
@ -764,7 +764,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
QtGui.QMessageBox.information(self, translate('OpenLP.ServiceManager', 'Corrupt File'),
translate('OpenLP.ServiceManager',
'This file is either corrupt or it is not an OpenLP 2 service file.'))
self.openlp_core.set_normal_cursor()
self.application.set_normal_cursor()
return
finally:
if file_to:
@ -772,7 +772,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
if zip_file:
zip_file.close()
self.main_window.finishedProgressBar()
self.openlp_core.set_normal_cursor()
self.application.set_normal_cursor()
self.repaint_service_list(-1, -1)
def load_Last_file(self):
@ -1258,7 +1258,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
Rebuild the service list as things have changed and a
repaint is the easiest way to do this.
"""
self.openlp_core.set_busy_cursor()
self.application.set_busy_cursor()
log.debug(u'regenerate_service_Items')
# force reset of renderer as theme data has changed
self.service_has_all_original_files = True
@ -1290,7 +1290,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
self.set_modified()
# Repaint it once only at the end
self.repaint_service_list(-1, -1)
self.openlp_core.set_normal_cursor()
self.application.set_normal_cursor()
def service_item_update(self, edit_id, unique_identifier, temporary=False):
"""
@ -1365,7 +1365,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
"""
Send the current item to the Preview slide controller
"""
self.openlp_core.set_busy_cursor()
self.application.set_busy_cursor()
item, child = self.find_service_item()
if self.service_items[item][u'service_item'].is_valid:
self.preview_controller.addServiceManagerItem(self.service_items[item][u'service_item'], child)
@ -1373,7 +1373,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
critical_error_message_box(translate('OpenLP.ServiceManager', 'Missing Display Handler'),
translate('OpenLP.ServiceManager',
'Your item cannot be displayed as there is no handler to display it'))
self.openlp_core.set_normal_cursor()
self.application.set_normal_cursor()
def get_service_item(self):
"""
@ -1406,7 +1406,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
return
if row != -1:
child = row
self.openlp_core.set_busy_cursor()
self.application.set_busy_cursor()
if self.service_items[item][u'service_item'].is_valid:
self.live_controller.addServiceManagerItem(self.service_items[item][u'service_item'], child)
if Settings().value(self.main_window.generalSettingsSection + u'/auto preview'):
@ -1421,7 +1421,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
critical_error_message_box(translate('OpenLP.ServiceManager', 'Missing Display Handler'),
translate('OpenLP.ServiceManager',
'Your item cannot be displayed as the plugin required to display it is missing or inactive'))
self.openlp_core.set_normal_cursor()
self.application.set_normal_cursor()
def remote_edit(self):
"""
@ -1635,12 +1635,12 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
main_window = property(_get_main_window)
def _get_openlp_core(self):
def _get_application(self):
"""
Adds the openlp to the class dynamically
"""
if not hasattr(self, u'_openlp_core'):
self._openlp_core = Registry().get(u'openlp_core')
return self._openlp_core
if not hasattr(self, u'_application'):
self._application = Registry().get(u'application')
return self._application
openlp_core = property(_get_openlp_core)
application = property(_get_application)

View File

@ -153,13 +153,13 @@ class ThemeManager(QtGui.QWidget):
"""
Import new themes downloaded by the first time wizard
"""
self.openlp_core.set_busy_cursor()
self.application.set_busy_cursor()
files = SettingsManager.get_files(self.settingsSection, u'.otz')
for theme_file in files:
theme_file = os.path.join(self.path, theme_file)
self.unzipTheme(theme_file, self.path)
delete_file(theme_file)
self.openlp_core.set_normal_cursor()
self.application.set_normal_cursor()
def config_updated(self):
@ -368,7 +368,7 @@ class ThemeManager(QtGui.QWidget):
path = QtGui.QFileDialog.getExistingDirectory(self,
translate('OpenLP.ThemeManager', 'Save Theme - (%s)') % theme,
Settings().value(self.settingsSection + u'/last directory export'))
self.openlp_core.set_busy_cursor()
self.application.set_busy_cursor()
if path:
Settings().setValue(self.settingsSection + u'/last directory export', path)
theme_path = os.path.join(path, theme + u'.otz')
@ -392,7 +392,7 @@ class ThemeManager(QtGui.QWidget):
finally:
if theme_zip:
theme_zip.close()
self.openlp_core.set_normal_cursor()
self.application.set_normal_cursor()
def on_import_theme(self):
@ -408,12 +408,12 @@ class ThemeManager(QtGui.QWidget):
log.info(u'New Themes %s', unicode(files))
if not files:
return
self.openlp_core.set_busy_cursor()
self.application.set_busy_cursor()
for file_name in files:
Settings().setValue(self.settingsSection + u'/last directory import', unicode(file_name))
self.unzip_theme(file_name, self.path)
self.load_themes()
self.openlp_core.set_normal_cursor()
self.application.set_normal_cursor()
def load_themes(self, first_time=False):
"""
@ -851,12 +851,12 @@ class ThemeManager(QtGui.QWidget):
main_window = property(_get_main_window)
def _get_openlp_core(self):
def _get_application(self):
"""
Adds the openlp to the class dynamically
"""
if not hasattr(self, u'_openlp_core'):
self._openlp_core = Registry().get(u'openlp_core')
return self._openlp_core
if not hasattr(self, u'_application'):
self._application = Registry().get(u'application')
return self._application
openlp_core = property(_get_openlp_core)
application = property(_get_application)

View File

@ -219,7 +219,7 @@ class OpenLPWizard(QtGui.QWizard):
self.progressLabel.setText(status_text)
if increment > 0:
self.progressBar.setValue(self.progressBar.value() + increment)
self.openlp_core.process_events()
self.application.process_events()
def preWizard(self):
"""
@ -237,7 +237,7 @@ class OpenLPWizard(QtGui.QWizard):
self.progressBar.setValue(self.progressBar.maximum())
self.finishButton.setVisible(True)
self.cancelButton.setVisible(False)
self.openlp_core.process_events()
self.application.process_events()
def getFileName(self, title, editbox, setting_name, filters=u''):
"""
@ -287,12 +287,12 @@ class OpenLPWizard(QtGui.QWizard):
editbox.setText(folder)
Settings().setValue(self.plugin.settingsSection + u'/' + setting_name, folder)
def _get_openlp_core(self):
def _get_application(self):
"""
Adds the openlp to the class dynamically
"""
if not hasattr(self, u'_openlp_core'):
self._openlp_core = Registry().get(u'openlp_core')
return self._openlp_core
if not hasattr(self, u'_application'):
self._application = Registry().get(u'application')
return self._application
openlp_core = property(_get_openlp_core)
application = property(_get_application)

View File

@ -424,7 +424,7 @@ def get_web_page(url, header=None, update_openlp=False):
if not page:
return None
if update_openlp:
Registry().get(u'openlp_core').process_events()
Registry().get(u'application').process_events()
log.debug(page)
return page

View File

@ -578,7 +578,7 @@ class BibleImportForm(OpenLPWizard):
self.progressLabel.setText(translate('BiblesPlugin.ImportWizardForm', 'Registering Bible...'))
else:
self.progressLabel.setText(WizardStrings.StartingImport)
self.openlp_core.process_events()
self.application.process_events()
def performWizard(self):
"""

View File

@ -335,7 +335,7 @@ class BibleUpgradeForm(OpenLPWizard):
"""
OpenLPWizard.preWizard(self)
self.progressLabel.setText(translate('BiblesPlugin.UpgradeWizardForm', 'Starting upgrade...'))
self.openlp_core.process_events()
self.application.process_events()
def performWizard(self):
"""
@ -465,7 +465,7 @@ class BibleUpgradeForm(OpenLPWizard):
self.newbibles[number].create_verse(db_book.id,
int(verse[u'chapter']),
int(verse[u'verse']), unicode(verse[u'text']))
self.openlp_core.process_events()
self.application.process_events()
self.newbibles[number].session.commit()
else:
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,
int(verse[u'chapter']),
int(verse[u'verse']), unicode(verse[u'text']))
self.openlp_core.process_events()
self.application.process_events()
self.newbibles[number].session.commit()
if not self.success.get(number, True):
self.incrementProgressBar(translate('BiblesPlugin.UpgradeWizardForm',

View File

@ -122,7 +122,7 @@ class EditBibleForm(QtGui.QDialog, Ui_EditBibleDialog):
if book.name != custom_names[abbr]:
if not self.validateBook(custom_names[abbr], abbr):
return
self.openlp_core.set_busy_cursor()
self.application.set_busy_cursor()
self.manager.save_meta_data(self.bible, version, copyright, permissions, book_name_language)
if not self.webbible:
for abbr, book in self.books.iteritems():
@ -131,7 +131,7 @@ class EditBibleForm(QtGui.QDialog, Ui_EditBibleDialog):
book.name = custom_names[abbr]
self.manager.update_book(self.bible, book)
self.bible = None
self.openlp_core.set_normal_cursor()
self.application.set_normal_cursor()
QtGui.QDialog.accept(self)
def validateMeta(self, name, copyright):
@ -189,12 +189,12 @@ class EditBibleForm(QtGui.QDialog, Ui_EditBibleDialog):
return False
return True
def _get_openlp_core(self):
def _get_application(self):
"""
Adds the openlp to the class dynamically
"""
if not hasattr(self, u'_openlp_core'):
self._openlp_core = Registry().get(u'openlp_core')
return self._openlp_core
if not hasattr(self, u'_application'):
self._application = Registry().get(u'application')
return self._application
openlp_core = property(_get_openlp_core)
application = property(_get_application)

View File

@ -118,7 +118,7 @@ class CSVBible(BibleDB):
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'])
book_list[int(line[0])] = unicode(line[2], details['encoding'])
self.openlp_core.process_events()
self.application.process_events()
except (IOError, IndexError):
log.exception(u'Loading books from file failed')
success = False
@ -157,7 +157,7 @@ class CSVBible(BibleDB):
verse_text = unicode(line[3], u'cp1252')
self.create_verse(book.id, line[1], line[2], verse_text)
self.wizard.incrementProgressBar(translate('BiblesPlugin.CSVBible', 'Importing verses... done.'))
self.openlp_core.process_events()
self.application.process_events()
self.session.commit()
except IOError:
log.exception(u'Loading verses from file failed')

View File

@ -549,15 +549,15 @@ class BibleDB(QtCore.QObject, Manager):
verses = self.session.query(Verse).all()
log.debug(verses)
def _get_openlp_core(self):
def _get_application(self):
"""
Adds the openlp to the class dynamically
"""
if not hasattr(self, u'_openlp_core'):
self._openlp_core = Registry().get(u'openlp_core')
return self._openlp_core
if not hasattr(self, u'_application'):
self._application = Registry().get(u'application')
return self._application
openlp_core = property(_get_openlp_core)
application = property(_get_application)
class BiblesResourcesDB(QtCore.QObject, Manager):

View File

@ -235,10 +235,10 @@ class BGExtract(object):
soup = get_soup_for_bible_ref(
u'http://www.biblegateway.com/passage/?%s' % url_params,
pre_parse_regex=r'<meta name.*?/>', pre_parse_substitute='', cleaner=cleaner)
self.openlp_core.process_events()
self.application.process_events()
if not soup:
return None
self.openlp_core.process_events()
self.application.process_events()
div = soup.find('div', 'result-text-style-normal')
self._clean_soup(div)
span_list = div.findAll('span', 'text')
@ -282,7 +282,7 @@ class BGExtract(object):
if not soup:
send_error_message(u'parse')
return None
self.openlp_core.process_events()
self.application.process_events()
content = soup.find(u'table', u'infotable')
if content:
content = content.findAll(u'tr')
@ -330,7 +330,7 @@ class BSExtract(object):
soup = get_soup_for_bible_ref(chapter_url, header)
if not soup:
return None
self.openlp_core.process_events()
self.application.process_events()
content = soup.find(u'div', u'content')
if not content:
log.error(u'No verses found in the Bibleserver response.')
@ -340,7 +340,7 @@ class BSExtract(object):
verse_number = re.compile(r'v(\d{1,2})(\d{3})(\d{3}) verse.*')
verses = {}
for verse in content:
self.openlp_core.process_events()
self.application.process_events()
versenumber = int(verse_number.sub(r'\3', verse[u'class']))
verses[versenumber] = verse.contents[1].rstrip(u'\n')
return SearchResults(book_name, chapter, verses)
@ -403,7 +403,7 @@ class CWExtract(object):
soup = get_soup_for_bible_ref(chapter_url)
if not soup:
return None
self.openlp_core.process_events()
self.application.process_events()
html_verses = soup.findAll(u'span', u'versetext')
if not html_verses:
log.error(u'No verses found in the CrossWalk response.')
@ -413,25 +413,25 @@ class CWExtract(object):
reduce_spaces = re.compile(r'[ ]{2,}')
fix_punctuation = re.compile(r'[ ]+([.,;])')
for verse in html_verses:
self.openlp_core.process_events()
self.application.process_events()
verse_number = int(verse.contents[0].contents[0])
verse_text = u''
for part in verse.contents:
self.openlp_core.process_events()
self.application.process_events()
if isinstance(part, NavigableString):
verse_text = verse_text + part
elif part and part.attrMap and \
(part.attrMap[u'class'] == u'WordsOfChrist' or part.attrMap[u'class'] == u'strongs'):
for subpart in part.contents:
self.openlp_core.process_events()
self.application.process_events()
if isinstance(subpart, NavigableString):
verse_text = verse_text + subpart
elif subpart and subpart.attrMap and subpart.attrMap[u'class'] == u'strongs':
for subsub in subpart.contents:
self.openlp_core.process_events()
self.application.process_events()
if isinstance(subsub, NavigableString):
verse_text = verse_text + subsub
self.openlp_core.process_events()
self.application.process_events()
# Fix up leading and trailing spaces, multiple spaces, and spaces
# between text and , and .
verse_text = verse_text.strip(u'\n\r\t ')
@ -597,7 +597,7 @@ class HTTPBible(BibleDB):
return []
book = db_book.name
if BibleDB.get_verse_count(self, book_id, reference[1]) == 0:
self.openlp_core.set_busy_cursor()
self.application.set_busy_cursor()
search_results = self.get_chapter(book, reference[1])
if search_results and search_results.has_verselist():
## We have found a book of the bible lets check to see
@ -605,14 +605,14 @@ class HTTPBible(BibleDB):
## we get a correct book. For example it is possible
## to request ac and get Acts back.
book_name = search_results.book
self.openlp_core.process_events()
self.application.process_events()
# Check to see if book/chapter exists.
db_book = self.get_book(book_name)
self.create_chapter(db_book.id, search_results.chapter,
search_results.verselist)
self.openlp_core.process_events()
self.openlp_core.set_normal_cursor()
self.openlp_core.process_events()
self.application.process_events()
self.application.set_normal_cursor()
self.application.process_events()
return BibleDB.get_verses(self, reference_list, show_error)
def get_chapter(self, book, chapter):
@ -659,15 +659,15 @@ class HTTPBible(BibleDB):
log.debug(u'HTTPBible.get_verse_count("%s", %s)', book_id, chapter)
return BiblesResourcesDB.get_verse_count(book_id, chapter)
def _get_openlp_core(self):
def _get_application(self):
"""
Adds the openlp to the class dynamically
"""
if not hasattr(self, u'_openlp_core'):
self._openlp_core = Registry().get(u'openlp_core')
return self._openlp_core
if not hasattr(self, u'_application'):
self._application = Registry().get(u'application')
return self._application
openlp_core = property(_get_openlp_core)
application = property(_get_application)
def get_soup_for_bible_ref(reference_url, header=None, pre_parse_regex=None,
pre_parse_substitute=None, cleaner=None):
@ -710,7 +710,7 @@ def get_soup_for_bible_ref(reference_url, header=None, pre_parse_regex=None,
if not soup:
send_error_message(u'parse')
return None
Registry().get(u'openlp_core').process_events()
Registry().get(u'application').process_events()
return soup
def send_error_message(error_type):

View File

@ -614,7 +614,7 @@ class BibleMediaItem(MediaManagerItem):
"""
log.debug(u'Advanced Search Button clicked')
self.advancedSearchButton.setEnabled(False)
self.openlp_core.process_events()
self.application.process_events()
bible = self.advancedVersionComboBox.currentText()
second_bible = self.advancedSecondComboBox.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_separator + verse_to
versetext = u'%s %s' % (book, verse_range)
self.openlp_core.set_busy_cursor()
self.application.set_busy_cursor()
self.search_results = self.plugin.manager.get_verses(bible, versetext, book_ref_id)
if second_bible:
self.second_search_results = self.plugin.manager.get_verses(second_bible, versetext, book_ref_id)
@ -640,7 +640,7 @@ class BibleMediaItem(MediaManagerItem):
self.displayResults(bible, second_bible)
self.advancedSearchButton.setEnabled(True)
self.checkSearchResult()
self.openlp_core.set_normal_cursor()
self.application.set_normal_cursor()
def onQuickSearchButton(self):
"""
@ -649,7 +649,7 @@ class BibleMediaItem(MediaManagerItem):
"""
log.debug(u'Quick Search Button clicked')
self.quickSearchButton.setEnabled(False)
self.openlp_core.process_events()
self.application.process_events()
bible = self.quickVersionComboBox.currentText()
second_bible = self.quickSecondComboBox.currentText()
text = self.quickSearchEdit.text()
@ -661,7 +661,7 @@ class BibleMediaItem(MediaManagerItem):
self.search_results[0].book.book_reference_id)
else:
# We are doing a 'Text Search'.
self.openlp_core.set_busy_cursor()
self.application.set_busy_cursor()
bibles = self.plugin.manager.get_bibles()
self.search_results = self.plugin.manager.verse_search(bible, second_bible, text)
if second_bible and self.search_results:
@ -696,7 +696,7 @@ class BibleMediaItem(MediaManagerItem):
self.displayResults(bible, second_bible)
self.quickSearchButton.setEnabled(True)
self.checkSearchResult()
self.openlp_core.set_normal_cursor()
self.application.set_normal_cursor()
def displayResults(self, bible, second_bible=u''):
"""

View File

@ -108,7 +108,7 @@ class OpenLP1Bible(BibleDB):
verse_number = int(verse[1])
text = unicode(verse[2], u'cp1252')
self.create_verse(db_book.id, chapter, verse_number, text)
self.openlp_core.process_events()
self.application.process_events()
self.session.commit()
connection.close()
return True

View File

@ -129,7 +129,7 @@ class OpenSongBible(BibleDB):
self.wizard.incrementProgressBar(translate('BiblesPlugin.Opensong', 'Importing %s %s...',
'Importing <book name> <chapter>...')) % (db_book.name, chapter_number)
self.session.commit()
self.openlp_core.process_events()
self.application.process_events()
except etree.XMLSyntaxError as inst:
critical_error_message_box(message=translate('BiblesPlugin.OpenSongImport',
'Incorrect Bible file type supplied. OpenSong Bibles may be '

View File

@ -182,7 +182,7 @@ class OSISBible(BibleDB):
.replace(u'</div>', u'').replace(u'</w>', u'')
verse_text = self.spaces_regex.sub(u' ', verse_text)
self.create_verse(db_book.id, chapter, verse, verse_text)
self.openlp_core.process_events()
self.application.process_events()
self.session.commit()
if match_count == 0:
success = False

View File

@ -99,7 +99,7 @@ class ImageMediaItem(MediaManagerItem):
if check_item_selected(self.listView, translate('ImagePlugin.MediaItem','You must select an image to delete.')):
row_list = [item.row() for item in self.listView.selectedIndexes()]
row_list.sort(reverse=True)
self.openlp_core.set_busy_cursor()
self.application.set_busy_cursor()
self.main_window.displayProgressBar(len(row_list))
for row in row_list:
text = self.listView.item(row)
@ -109,11 +109,11 @@ class ImageMediaItem(MediaManagerItem):
self.main_window.incrementProgressBar()
SettingsManager.setValue(self.settingsSection + u'/images files', self.getFileList())
self.main_window.finishedProgressBar()
self.openlp_core.set_normal_cursor()
self.application.set_normal_cursor()
self.listView.blockSignals(False)
def loadList(self, images, initialLoad=False):
self.openlp_core.set_busy_cursor()
self.application.set_busy_cursor()
if not initialLoad:
self.main_window.displayProgressBar(len(images))
# Sort the images by its filename considering language specific
@ -138,7 +138,7 @@ class ImageMediaItem(MediaManagerItem):
self.main_window.incrementProgressBar()
if not initialLoad:
self.main_window.finishedProgressBar()
self.openlp_core.set_normal_cursor()
self.application.set_normal_cursor()
def generateSlideData(self, service_item, item=None, xmlVersion=False,
remote=False, context=ServiceItemContext.Service):

View File

@ -150,7 +150,7 @@ class PresentationMediaItem(MediaManagerItem):
"""
currlist = self.getFileList()
titles = [os.path.split(file)[1] for file in currlist]
self.openlp_core.set_busy_cursor()
self.application.set_busy_cursor()
if not initialLoad:
self.main_window.displayProgressBar(len(files))
# Sort the presentations by its filename considering language specific characters.
@ -207,7 +207,7 @@ class PresentationMediaItem(MediaManagerItem):
self.listView.addItem(item_name)
if not initialLoad:
self.main_window.finishedProgressBar()
self.openlp_core.set_normal_cursor()
self.application.set_normal_cursor()
def onDeleteClick(self):
"""
@ -217,7 +217,7 @@ class PresentationMediaItem(MediaManagerItem):
items = self.listView.selectedIndexes()
row_list = [item.row() for item in items]
row_list.sort(reverse=True)
self.openlp_core.set_busy_cursor()
self.application.set_busy_cursor()
self.main_window.displayProgressBar(len(row_list))
for item in items:
filepath = unicode(item.data(QtCore.Qt.UserRole))
@ -227,7 +227,7 @@ class PresentationMediaItem(MediaManagerItem):
doc.close_presentation()
self.main_window.incrementProgressBar()
self.main_window.finishedProgressBar()
self.openlp_core.set_busy_cursor()
self.application.set_busy_cursor()
for row in row_list:
self.listView.takeItem(row)
Settings().setValue(self.settingsSection + u'/presentations files', self.getFileList())

View File

@ -226,7 +226,7 @@ class SongExportForm(OpenLPWizard):
self.directoryLineEdit.clear()
self.searchLineEdit.clear()
# Load the list of songs.
self.openlp_core.set_busy_cursor()
self.application.set_busy_cursor()
songs = self.plugin.manager.get_all_objects(Song)
songs.sort(cmp=natcmp, key=lambda song: song.sort_key)
for song in songs:
@ -240,7 +240,7 @@ class SongExportForm(OpenLPWizard):
item.setFlags(QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsUserCheckable | QtCore.Qt.ItemIsEnabled)
item.setCheckState(QtCore.Qt.Unchecked)
self.availableListWidget.addItem(item)
self.openlp_core.set_normal_cursor()
self.application.set_normal_cursor()
def preWizard(self):
"""
@ -248,7 +248,7 @@ class SongExportForm(OpenLPWizard):
"""
OpenLPWizard.preWizard(self)
self.progressLabel.setText(translate('SongsPlugin.ExportWizardForm', 'Starting export...'))
self.openlp_core.process_events()
self.application.process_events()
def performWizard(self):
"""

View File

@ -339,7 +339,7 @@ class SongImportForm(OpenLPWizard):
"""
OpenLPWizard.preWizard(self)
self.progressLabel.setText(WizardStrings.StartingImport)
self.openlp_core.process_events()
self.application.process_events()
def performWizard(self):
"""

View File

@ -374,12 +374,12 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
"""
Utility method to merge two objects to leave one in the database.
"""
self.openlp_core.set_busy_cursor()
self.application.set_busy_cursor()
merge(dbObject)
reset()
if not self.fromSongEdit:
Receiver.send_message(u'songs_load_list')
self.openlp_core.set_normal_cursor()
self.application.set_normal_cursor()
def mergeAuthors(self, oldAuthor):
"""
@ -509,12 +509,12 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
deleteButton.setEnabled(True)
editButton.setEnabled(True)
def _get_openlp_core(self):
def _get_application(self):
"""
Adds the openlp to the class dynamically
"""
if not hasattr(self, u'_openlp_core'):
self._openlp_core = Registry().get(u'openlp_core')
return self._openlp_core
if not hasattr(self, u'_application'):
self._application = Registry().get(u'application')
return self._application
openlp_core = property(_get_openlp_core)
application = property(_get_application)

View File

@ -361,7 +361,7 @@ class SongMediaItem(MediaManagerItem):
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes | QtGui.QMessageBox.No),
QtGui.QMessageBox.Yes) == QtGui.QMessageBox.No:
return
self.openlp_core.set_busy_cursor()
self.application.set_busy_cursor()
self.main_window.displayProgressBar(len(items))
for item in items:
item_id = item.data(QtCore.Qt.UserRole)
@ -380,7 +380,7 @@ class SongMediaItem(MediaManagerItem):
self.plugin.manager.delete_object(Song, item_id)
self.main_window.incrementProgressBar()
self.main_window.finishedProgressBar()
self.openlp_core.set_normal_cursor()
self.application.set_normal_cursor()
self.onSearchTextButtonClicked()
def onCloneClick(self):

View File

@ -64,7 +64,7 @@ class OpenLyricsExport(object):
openLyrics = OpenLyrics(self.manager)
self.parent.progressBar.setMaximum(len(self.songs))
for song in self.songs:
self.openlp_core.process_events()
self.application.process_events()
if self.parent.stop_export_flag:
return False
self.parent.incrementProgressBar(translate('SongsPlugin.OpenLyricsExport', 'Exporting "%s"...') %
@ -81,12 +81,12 @@ class OpenLyricsExport(object):
encoding=u'utf-8', xml_declaration=True, pretty_print=True)
return True
def _get_openlp_core(self):
def _get_application(self):
"""
Adds the openlp to the class dynamically
"""
if not hasattr(self, u'_openlp_core'):
self._openlp_core = Registry().get(u'openlp_core')
return self._openlp_core
if not hasattr(self, u'_application'):
self._application = Registry().get(u'application')
return self._application
openlp_core = property(_get_openlp_core)
application = property(_get_application)

View File

@ -241,9 +241,9 @@ class SongsPlugin(Plugin):
If the first time wizard has run, this function is run to import all the
new songs into the database.
"""
self.openlp_core.process_events()
self.application.process_events()
self.onToolsReindexItemTriggered()
self.openlp_core.process_events()
self.application.process_events()
db_dir = unicode(os.path.join(unicode(gettempdir(), get_filesystem_encoding()), u'openlp'))
if not os.path.exists(db_dir):
return
@ -251,12 +251,12 @@ class SongsPlugin(Plugin):
song_count = 0
for sfile in os.listdir(db_dir):
if sfile.startswith(u'songs_') and sfile.endswith(u'.sqlite'):
self.openlp_core.process_events()
self.application.process_events()
song_dbs.append(os.path.join(db_dir, sfile))
song_count += self._countSongs(os.path.join(db_dir, sfile))
if not song_dbs:
return
self.openlp_core.process_events()
self.application.process_events()
progress = QtGui.QProgressDialog(self.main_window)
progress.setWindowModality(QtCore.Qt.WindowModal)
progress.setWindowTitle(translate('OpenLP.Ui', 'Importing Songs'))
@ -265,11 +265,11 @@ class SongsPlugin(Plugin):
progress.setRange(0, song_count)
progress.setMinimumDuration(0)
progress.forceShow()
self.openlp_core.process_events()
self.application.process_events()
for db in song_dbs:
importer = OpenLPSongImport(self.manager, filename=db)
importer.doImport(progress)
self.openlp_core.process_events()
self.application.process_events()
progress.setValue(song_count)
self.mediaItem.onSearchTextButtonClicked()