forked from openlp/openlp
Fix up Receiver code changes
This commit is contained in:
parent
27cd63ebcd
commit
123f460f7e
@ -96,7 +96,7 @@ class OpenLP(QtGui.QApplication):
|
||||
QtGui.QApplication.exec_()
|
||||
self.sharedMemory.detach()
|
||||
|
||||
def run(self, args, testing=False):
|
||||
def run(self, args):
|
||||
"""
|
||||
Run the OpenLP application.
|
||||
"""
|
||||
@ -150,9 +150,7 @@ class OpenLP(QtGui.QApplication):
|
||||
if update_check:
|
||||
VersionThread(self.mainWindow).start()
|
||||
Receiver.send_message(u'live_display_blank_check')
|
||||
self.mainWindow.appStartup()
|
||||
# Skip exec_() for gui tests
|
||||
if not testing:
|
||||
self.mainWindow.app_startup()
|
||||
return self.exec_()
|
||||
|
||||
def isAlreadyRunning(self):
|
||||
@ -244,7 +242,6 @@ def main(args=None):
|
||||
parser.add_option('-d', '--dev-version', dest='dev_version', action='store_true',
|
||||
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('--testing', dest='testing', action='store_true', help='Run by testing framework')
|
||||
# Parse command line options and deal with them.
|
||||
# Use args supplied programatically if possible.
|
||||
(options, args) = parser.parse_args(args) if args else parser.parse_args()
|
||||
@ -293,8 +290,6 @@ def main(args=None):
|
||||
registry = Registry.create()
|
||||
Registry().register(u'openlp_core', app)
|
||||
app.setApplicationVersion(get_application_version()[u'version'])
|
||||
# Instance check
|
||||
if not options.testing:
|
||||
# Instance check
|
||||
if app.isAlreadyRunning():
|
||||
sys.exit()
|
||||
@ -314,10 +309,4 @@ def main(args=None):
|
||||
log.debug(u'Could not find default_translator.')
|
||||
if not options.no_error_form:
|
||||
sys.excepthook = app.hookException
|
||||
# Do not run method app.exec_() when running gui tests
|
||||
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))
|
||||
|
@ -481,7 +481,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
||||
self.recentFiles = []
|
||||
# Set up the path with plugins
|
||||
plugin_path = AppLocation.get_directory(AppLocation.PluginsDir)
|
||||
self.pluginManager = PluginManager(plugin_path)
|
||||
self.plugin_manager = PluginManager(plugin_path)
|
||||
self.imageManager = ImageManager()
|
||||
# Set up the interface
|
||||
self.setupUi(self)
|
||||
@ -546,25 +546,25 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
||||
# Define the media Dock Manager
|
||||
self.mediaDockManager = MediaDockManager(self.mediaToolBox)
|
||||
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
|
||||
# the controllers hence the hooks have moved from setupUI() to here
|
||||
# Find and insert settings tabs
|
||||
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
|
||||
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.
|
||||
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.
|
||||
self.pluginManager.hook_export_menu(self.fileExportMenu)
|
||||
self.plugin_manager.hook_export_menu(self.fileExportMenu)
|
||||
# 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.
|
||||
log.info(u'initialise plugins')
|
||||
self.pluginManager.initialise_plugins()
|
||||
self.plugin_manager.initialise_plugins()
|
||||
# Create the displays as all necessary components are loaded.
|
||||
self.previewController.screenSizeChanged()
|
||||
self.liveController.screenSizeChanged()
|
||||
@ -580,7 +580,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_busy_cursor()
|
||||
self.openlp_core.set_normal_cursor()
|
||||
|
||||
def setAutoLanguage(self, value):
|
||||
self.languageGroup.setDisabled(value)
|
||||
@ -631,12 +631,12 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
||||
self.setViewMode(False, True, False, False, True)
|
||||
self.modeLiveItem.setChecked(True)
|
||||
|
||||
def appStartup(self):
|
||||
def app_startup(self):
|
||||
"""
|
||||
Give all the plugins a chance to perform some tasks at startup
|
||||
"""
|
||||
self.openlp_core.process_events()
|
||||
for plugin in self.pluginManager.plugins:
|
||||
for plugin in self.plugin_manager.plugins:
|
||||
if plugin.isActive():
|
||||
plugin.appStartup()
|
||||
self.openlp_core.process_events()
|
||||
@ -644,7 +644,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
||||
def firstTime(self):
|
||||
# Import themes if first time
|
||||
self.openlp_core.process_events()
|
||||
for plugin in self.pluginManager.plugins:
|
||||
for plugin in self.plugin_manager.plugins:
|
||||
if hasattr(plugin, u'firstTime'):
|
||||
self.openlp_core.process_events()
|
||||
plugin.firstTime()
|
||||
@ -669,14 +669,14 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
||||
QtGui.QMessageBox.No)
|
||||
if answer == QtGui.QMessageBox.No:
|
||||
return
|
||||
self.openlp_core.set_busy_cursor()
|
||||
screens = ScreenList()
|
||||
firstTime = FirstTimeForm(screens, self)
|
||||
firstTime.exec_()
|
||||
if firstTime.downloadCancelled:
|
||||
first_time = FirstTimeForm(screens, self)
|
||||
first_time.exec_()
|
||||
if first_time.downloadCancelled:
|
||||
return
|
||||
self.firstTime()
|
||||
for plugin in self.pluginManager.plugins:
|
||||
self.openlp_core.set_busy_cursor()
|
||||
self.first_time()
|
||||
for plugin in self.plugin_manager.plugins:
|
||||
self.activePlugin = plugin
|
||||
oldStatus = self.activePlugin.status
|
||||
self.activePlugin.setStatus()
|
||||
@ -692,6 +692,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()
|
||||
|
||||
def blankCheck(self):
|
||||
"""
|
||||
@ -817,7 +818,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
||||
setting_sections.extend([self.headerSection])
|
||||
setting_sections.extend([u'crashreport'])
|
||||
# Add plugin sections.
|
||||
for plugin in self.pluginManager.plugins:
|
||||
for plugin in self.plugin_manager.plugins:
|
||||
setting_sections.extend([plugin.name])
|
||||
settings = Settings()
|
||||
import_settings = Settings(import_file_name, Settings.IniFormat)
|
||||
@ -894,7 +895,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
||||
setting_sections.extend([self.themesSettingsSection])
|
||||
setting_sections.extend([self.displayTagsSection])
|
||||
# Add plugin sections.
|
||||
for plugin in self.pluginManager.plugins:
|
||||
for plugin in self.plugin_manager.plugins:
|
||||
setting_sections.extend([plugin.name])
|
||||
# Delete old files if found.
|
||||
if os.path.exists(temp_file):
|
||||
@ -986,7 +987,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
||||
self.liveController.screenSizeChanged()
|
||||
self.setFocus()
|
||||
self.activateWindow()
|
||||
self.openlp_core.set_busy_cursor()
|
||||
self.openlp_core.set_normal_cursor()
|
||||
|
||||
def closeEvent(self, event):
|
||||
"""
|
||||
@ -1046,7 +1047,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
||||
Settings().setValue(u'advanced/current media plugin', self.mediaToolBox.currentIndex())
|
||||
# Call the cleanup method to shutdown plugins.
|
||||
log.info(u'cleanup plugins')
|
||||
self.pluginManager.finalise_plugins()
|
||||
self.plugin_manager.finalise_plugins()
|
||||
if save_settings:
|
||||
# Save settings
|
||||
self.saveSettings()
|
||||
@ -1304,16 +1305,17 @@ 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()
|
||||
if self.copyData:
|
||||
log.info(u'Copying data to new path')
|
||||
try:
|
||||
self.openlp_core.set_busy_cursor()
|
||||
self.showStatusMessage(
|
||||
translate('OpenLP.MainWindow', 'Copying OpenLP data to new data directory location - %s '
|
||||
'- Please wait for copy to finish').replace('%s', self.newDataPath))
|
||||
dir_util.copy_tree(old_data_path, self.newDataPath)
|
||||
log.info(u'Copy sucessful')
|
||||
except (IOError, os.error, DistutilsFileError), why:
|
||||
print "A5"
|
||||
self.openlp_core.set_normal_cursor()
|
||||
log.exception(u'Data copy failed %s' % unicode(why))
|
||||
QtGui.QMessageBox.critical(self, translate('OpenLP.MainWindow', 'New Data Directory Error'),
|
||||
@ -1329,6 +1331,7 @@ 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()
|
||||
|
||||
def _get_openlp_core(self):
|
||||
"""
|
||||
|
@ -401,9 +401,9 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
|
||||
elif result == QtGui.QMessageBox.Save:
|
||||
self.decide_save_method()
|
||||
if not load_file:
|
||||
file_name = QtGui.QFileDialog.getOpenfile_name(self.main_window,
|
||||
file_name = QtGui.QFileDialog.getOpenFileName(self.main_window,
|
||||
translate('OpenLP.ServiceManager', 'Open File'),
|
||||
SettingsManager.get_last_dir(self.main_window.serviceManagerSettingsSection),
|
||||
Settings().value(self.main_window.serviceManagerSettingsSection + u'/last directory'),
|
||||
translate('OpenLP.ServiceManager', 'OpenLP Service Files (*.osz *.oszl)'))
|
||||
if not file_name:
|
||||
return False
|
||||
@ -494,7 +494,6 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
|
||||
if answer == QtGui.QMessageBox.Cancel:
|
||||
self.main_window.finishedProgressBar()
|
||||
return False
|
||||
self.openlp_core.set_busy_cursor()
|
||||
# Check if item contains a missing file.
|
||||
for item in list(self.service_items):
|
||||
self.main_window.incrementProgressBar()
|
||||
@ -690,6 +689,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
|
||||
return False
|
||||
zip_file = None
|
||||
file_to = None
|
||||
self.openlp_core.set_busy_cursor()
|
||||
try:
|
||||
zip_file = zipfile.ZipFile(file_name)
|
||||
for zip_info in zip_file.infolist():
|
||||
@ -710,7 +710,6 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
|
||||
if osfile.endswith(u'osd'):
|
||||
p_file = os.path.join(self.servicePath, osfile)
|
||||
if 'p_file' in locals():
|
||||
self.openlp_core.set_busy_cursor()
|
||||
file_to = open(p_file, u'r')
|
||||
items = cPickle.load(file_to)
|
||||
file_to.close()
|
||||
@ -940,7 +939,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
|
||||
def preview_live(self, unique_identifier, row):
|
||||
"""
|
||||
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``
|
||||
|
@ -707,10 +707,10 @@ def get_soup_for_bible_ref(reference_url, header=None, pre_parse_regex=None,
|
||||
soup = BeautifulSoup(page_source)
|
||||
except HTMLParseError:
|
||||
log.exception(u'BeautifulSoup could not parse the bible page.')
|
||||
Registry().get(u'openlp_core').process_events()
|
||||
if not soup:
|
||||
send_error_message(u'parse')
|
||||
return None
|
||||
Registry().get(u'openlp_core').process_events()
|
||||
return soup
|
||||
|
||||
def send_error_message(error_type):
|
||||
|
@ -138,7 +138,7 @@ class ImageMediaItem(MediaManagerItem):
|
||||
self.main_window.incrementProgressBar()
|
||||
if not initialLoad:
|
||||
self.main_window.finishedProgressBar()
|
||||
self.openlp_core.set_busy_cursor()
|
||||
self.openlp_core.set_normal_cursor()
|
||||
|
||||
def generateSlideData(self, service_item, item=None, xmlVersion=False,
|
||||
remote=False, context=ServiceItemContext.Service):
|
||||
|
@ -207,7 +207,7 @@ class PresentationMediaItem(MediaManagerItem):
|
||||
self.listView.addItem(item_name)
|
||||
if not initialLoad:
|
||||
self.main_window.finishedProgressBar()
|
||||
self.openlp_core.set_busy_cursor()
|
||||
self.openlp_core.set_normal_cursor()
|
||||
|
||||
def onDeleteClick(self):
|
||||
"""
|
||||
|
Loading…
Reference in New Issue
Block a user