From cc5776c7d3fa73d682ec8ea4706046e354e66c16 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Wed, 30 Jan 2013 21:29:33 +0100 Subject: [PATCH 01/26] fixed 'song/ccli number' setting; do not change setting.ini when IMPORTING --- openlp/core/lib/settings.py | 8 +++----- openlp/core/ui/mainwindow.py | 11 +++++++++-- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/openlp/core/lib/settings.py b/openlp/core/lib/settings.py index ba1e63fb9..116aac442 100644 --- a/openlp/core/lib/settings.py +++ b/openlp/core/lib/settings.py @@ -227,10 +227,7 @@ class Settings(QtCore.QSettings): u'user interface/live splitter geometry': QtCore.QByteArray(), u'user interface/main window state': QtCore.QByteArray(), u'media/players': u'webkit', - u'media/override player': QtCore.Qt.Unchecked, - # 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'' + u'media/override player': QtCore.Qt.Unchecked } __file_path__ = u'' __obsolete_settings__ = [ @@ -243,7 +240,8 @@ class Settings(QtCore.QSettings): (u'bibles/last directory 1', u'bibles/last directory import', []), (u'songusage/last directory 1', u'songusage/last directory export', []), (u'advanced/stylesheet fix', u'', []), - (u'media/background color', u'players/background color', []) + (u'media/background color', u'players/background color', []), + (u'songs/ccli number', u'general/ccli number', []) ] @staticmethod diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index 6ab3f7f0a..0fb171c04 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -40,7 +40,7 @@ from datetime import datetime from PyQt4 import QtCore, QtGui from openlp.core.lib import Renderer, build_icon, OpenLPDockWidget, PluginManager, Receiver, translate, ImageManager, \ - PluginStatus, Registry, Settings, ScreenList + PluginStatus, Registry, Settings, ScreenList, check_directory_exists from openlp.core.lib.ui import UiStrings, create_action from openlp.core.ui import AboutForm, SettingsForm, ServiceManager, ThemeManager, SlideController, PluginForm, \ MediaDockManager, ShortcutListForm, FormattingTagForm @@ -819,8 +819,15 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): # Add plugin sections. for plugin in self.pluginManager.plugins: setting_sections.extend([plugin.name]) + # Copy the settings file to the tmp dir, because we do not want to overwrite 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() - 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 # 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 d7472876c79736e9dfe77d0f042511172895bfd3 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Wed, 30 Jan 2013 21:34:54 +0100 Subject: [PATCH 02/26] change wording --- openlp/core/ui/mainwindow.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index 0fb171c04..7443f176f 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -819,7 +819,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): # Add plugin sections. for plugin in self.pluginManager.plugins: setting_sections.extend([plugin.name]) - # Copy the settings file to the tmp dir, because we do not want to overwrite the original one. + # 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)) From 16ba742d1dc1a5ec62a2696011dd46a8ddbb7184 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Thu, 31 Jan 2013 08:56:34 +0100 Subject: [PATCH 03/26] sorted default dict a bit; fixed settings conversion; renamed a setting; removed old setting --- openlp/core/lib/settings.py | 145 ++++++++++++++++++------------ openlp/core/ui/mainwindow.py | 4 +- openlp/core/ui/slidecontroller.py | 2 +- 3 files changed, 89 insertions(+), 62 deletions(-) diff --git a/openlp/core/lib/settings.py b/openlp/core/lib/settings.py index 116aac442..002ac885b 100644 --- a/openlp/core/lib/settings.py +++ b/openlp/core/lib/settings.py @@ -74,7 +74,8 @@ class Settings(QtCore.QSettings): 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 pair describes how to convert the old setting's value:: @@ -86,65 +87,67 @@ class Settings(QtCore.QSettings): So, if the type of the old value is bool, then there must be two rules. """ __default_settings__ = { - u'advanced/x11 bypass wm': X11_BYPASS_DEFAULT, - 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/add page break': False, u'advanced/current media plugin': -1, - u'advanced/double click live': False, u'advanced/data path': u'', - u'advanced/default service hour': 11, u'advanced/default color': u'#ffffff', u'advanced/default image': u':/graphics/openlp-splash-screen.png', - u'advanced/expand service item': False, - u'advanced/recent file count': 4, - u'advanced/default service name': UiStrings().DefaultServiceName, + # 7 stands for now, 0 to 6 is Monday to Sunday. + u'advanced/default service day': 7, + u'advanced/default service enabled': True, + u'advanced/default service hour': 11, u'advanced/default service minute': 0, - u'advanced/slide limits': SlideLimits.End, - u'advanced/print slide text': False, - u'advanced/add page break': False, + u'advanced/default service name': UiStrings().DefaultServiceName, + u'advanced/display size': 0, + 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 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'displayTags/html_tags': u'', - u'general/ccli number': u'', - u'general/has run wizard': False, - u'general/update check': True, - 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 oder display settings (display position and dimensions) are defined in the ScreenList class due to crycle - # 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/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/enable slide loop': True, + u'general/has run wizard': False, + u'general/language': u'[en]', # 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/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 oder display settings (display position and dimensions) are defined in the ScreenList class due to crycle + # 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'servicemanager/service theme': 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/type': u'OpenLP_settings_export', - u'SettingsImport/file_date_created': datetime.datetime.now().strftime("%Y-%m-%d %H:%M"), u'SettingsImport/version': u'', u'shortcuts/aboutItem': [QtGui.QKeySequence(u'Ctrl+F1')], u'shortcuts/audioPauseItem': [], @@ -212,36 +215,37 @@ class Settings(QtCore.QSettings): u'shortcuts/viewLivePanel': [QtGui.QKeySequence(u'F12')], u'shortcuts/viewServiceManagerItem': [QtGui.QKeySequence(u'F9')], u'shortcuts/webSiteItem': [], - u'themes/theme level': ThemeLevel.Song, u'themes/global theme': u'', u'themes/last directory': u'', u'themes/last directory export': u'', u'themes/last directory import': u'', - u'user interface/main window position': QtCore.QPoint(0, 0), - u'user interface/preview panel': True, + u'themes/theme level': ThemeLevel.Song, 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/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'media/players': u'webkit', - u'media/override player': QtCore.Qt.Unchecked + u'user interface/preview panel': True, + u'user interface/preview splitter geometry': QtCore.QByteArray() } __file_path__ = u'' __obsolete_settings__ = [ + # Changed during 1.9.x development. (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'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 1', u'themes/last directory export', []), (u'servicemanager/last directory', u'', []), (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'advanced/stylesheet fix', u'', []), - (u'media/background color', u'players/background color', []), - (u'songs/ccli number', u'general/ccli number', []) + (u'user interface/mainwindow splitter geometry', u'user interface/main window splitter geometry', []) ] @staticmethod @@ -273,6 +277,12 @@ class Settings(QtCore.QSettings): Settings.__default_settings__[u'advanced/default service name'] = UiStrings().DefaultServiceName def __init__(self, *args): + """ + Constructor + + ``args`` + Passed to Qt. But not passed in all cases. + """ if not args and Settings.__file_path__ and Settings.defaultFormat() == Settings.IniFormat: QtCore.QSettings.__init__(self, Settings.__file_path__, Settings.IniFormat) else: @@ -289,6 +299,11 @@ class Settings(QtCore.QSettings): if new_key: # Get the value of the 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. for new, old in rules: # If the value matches with the condition (rule), then use the provided value. This is used to @@ -304,8 +319,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 *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`` The key to return the value from. """ @@ -315,6 +328,21 @@ class Settings(QtCore.QSettings): else: default_value = Settings.__default_settings__[key] 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 # PyQt4.QtCore.QPyNullVariant. This type has to be converted to proper 'None' Python type. if isinstance(setting, QtCore.QPyNullVariant) and setting.isNull(): @@ -337,4 +365,3 @@ class Settings(QtCore.QSettings): if isinstance(default_value, int): return int(setting) return setting - diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index 7443f176f..998f7541e 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -1191,7 +1191,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): self.restoreState(settings.value(u'main window state')) self.liveController.splitter.restoreState(settings.value(u'live 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() def saveSettings(self): @@ -1212,7 +1212,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): settings.setValue(u'main window geometry', self.saveGeometry()) settings.setValue(u'live splitter geometry', self.liveController.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() def updateRecentFilesMenu(self): diff --git a/openlp/core/ui/slidecontroller.py b/openlp/core/ui/slidecontroller.py index 05151b20e..377d14c76 100644 --- a/openlp/core/ui/slidecontroller.py +++ b/openlp/core/ui/slidecontroller.py @@ -207,7 +207,7 @@ class SlideController(DisplayController): self.playSlidesOnce = create_action(self, u'playSlidesOnce', text=UiStrings().PlaySlidesToEnd, icon=u':/media/media_time.png', checked=False, shortcuts=[], 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) else: self.playSlidesMenu.setDefaultAction(self.playSlidesOnce) From c7aa0cd0f10e6b185a254e4a5693b71ca42a2105 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Thu, 31 Jan 2013 19:46:19 +0100 Subject: [PATCH 04/26] removed commented line --- openlp/core/lib/settings.py | 1 - 1 file changed, 1 deletion(-) diff --git a/openlp/core/lib/settings.py b/openlp/core/lib/settings.py index 002ac885b..9582b4241 100644 --- a/openlp/core/lib/settings.py +++ b/openlp/core/lib/settings.py @@ -122,7 +122,6 @@ class Settings(QtCore.QSettings): u'general/auto unblank': False, u'general/blank warning': False, u'general/ccli number': u'', - #u'general/enable slide loop': True, u'general/has run wizard': False, u'general/language': u'[en]', # This defaults to yesterday in order to force the update check to run when you've never run it before. From 27cd63ebcdc292b40b193ab1c57fbe55e719a6bf Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sun, 3 Feb 2013 09:07:31 +0000 Subject: [PATCH 05/26] Remove events and move to Registry --- openlp/core/__init__.py | 18 +++-- openlp/core/lib/eventreceiver.py | 32 -------- openlp/core/lib/mediamanageritem.py | 14 +++- openlp/core/lib/plugin.py | 17 ++++ openlp/core/lib/pluginmanager.py | 10 +++ openlp/core/ui/firsttimeform.py | 51 ++++++------ openlp/core/ui/maindisplay.py | 18 ++++- openlp/core/ui/mainwindow.py | 42 ++++++---- openlp/core/ui/media/mediaplayer.py | 11 +++ openlp/core/ui/media/phononplayer.py | 4 +- openlp/core/ui/media/vlcplayer.py | 4 +- openlp/core/ui/pluginform.py | 33 ++++++-- openlp/core/ui/servicemanager.py | 77 +++++++++++-------- openlp/core/ui/slidecontroller.py | 9 +-- openlp/core/ui/thememanager.py | 22 ++++-- openlp/core/ui/wizard.py | 16 +++- openlp/core/utils/__init__.py | 4 +- .../plugins/bibles/forms/bibleimportform.py | 4 +- .../plugins/bibles/forms/bibleupgradeform.py | 6 +- openlp/plugins/bibles/forms/editbibleform.py | 17 +++- openlp/plugins/bibles/lib/csvbible.py | 4 +- openlp/plugins/bibles/lib/db.py | 12 ++- openlp/plugins/bibles/lib/http.py | 53 +++++++------ openlp/plugins/bibles/lib/mediaitem.py | 14 ++-- openlp/plugins/bibles/lib/openlp1.py | 2 +- openlp/plugins/bibles/lib/opensong.py | 4 +- openlp/plugins/bibles/lib/osis.py | 4 +- openlp/plugins/custom/lib/mediaitem.py | 2 +- openlp/plugins/images/lib/mediaitem.py | 8 +- openlp/plugins/presentations/lib/mediaitem.py | 10 +-- openlp/plugins/songs/forms/songexportform.py | 6 +- openlp/plugins/songs/forms/songimportform.py | 4 +- .../songs/forms/songmaintenanceform.py | 13 +++- openlp/plugins/songs/lib/mediaitem.py | 6 +- openlp/plugins/songs/lib/openlyricsexport.py | 14 +++- openlp/plugins/songs/songsplugin.py | 28 +++---- 36 files changed, 368 insertions(+), 225 deletions(-) diff --git a/openlp/core/__init__.py b/openlp/core/__init__.py index e31ff0c5d..211a02fef 100644 --- a/openlp/core/__init__.py +++ b/openlp/core/__init__.py @@ -109,10 +109,6 @@ class OpenLP(QtGui.QApplication): if 'OpenLP' in args: args.remove('OpenLP') 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.setBusyCursor) - QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'cursor_normal'), self.setNormalCursor) # Decide how many screens we have and their size screens = ScreenList.create(self.desktop()) # First time checks in settings @@ -182,21 +178,28 @@ class OpenLP(QtGui.QApplication): if not hasattr(self, u'exceptionForm'): self.exceptionForm = ExceptionForm(self.mainWindow) self.exceptionForm.exceptionTextEdit.setPlainText(''.join(format_exception(exctype, value, traceback))) - self.setNormalCursor() + self.set_normal_cursor() self.exceptionForm.exec_() - def setBusyCursor(self): + def process_events(self): + """ + Wrapper to make ProcessEvents visible and named correctly + """ + self.processEvents() + + def set_busy_cursor(self): """ Sets the Busy Cursor for the Application """ self.setOverrideCursor(QtCore.Qt.BusyCursor) self.processEvents() - def setNormalCursor(self): + def set_normal_cursor(self): """ Sets the Normal Cursor for the Application """ self.restoreOverrideCursor() + self.processEvents() def event(self, event): """ @@ -288,6 +291,7 @@ def main(args=None): app.setApplicationName(u'OpenLP') set_up_logging(AppLocation.get_directory(AppLocation.CacheDir)) registry = Registry.create() + Registry().register(u'openlp_core', app) app.setApplicationVersion(get_application_version()[u'version']) # Instance check if not options.testing: diff --git a/openlp/core/lib/eventreceiver.py b/openlp/core/lib/eventreceiver.py index d29652c35..29c8e75a3 100644 --- a/openlp/core/lib/eventreceiver.py +++ b/openlp/core/lib/eventreceiver.py @@ -55,15 +55,6 @@ class EventReceiver(QtCore.QObject): ``openlp_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`` Version has changed so pop up window. @@ -120,29 +111,6 @@ class EventReceiver(QtCore.QObject): ``slidecontroller_live_stop_loop`` 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** ``update_display_css`` diff --git a/openlp/core/lib/mediamanageritem.py b/openlp/core/lib/mediamanageritem.py index 4f559837c..53a61c788 100644 --- a/openlp/core/lib/mediamanageritem.py +++ b/openlp/core/lib/mediamanageritem.py @@ -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: - Receiver.send_message(u'cursor_busy') + self.openlp_core.set_busy_cursor() self.validateAndLoad(files) - Receiver.send_message(u'cursor_normal') + self.openlp_core.set_normal_cursor() def loadFile(self, files): """ @@ -698,3 +698,13 @@ class MediaManagerItem(QtGui.QWidget): theme_manager = property(_get_theme_manager) + def _get_openlp_core(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 + + openlp_core = property(_get_openlp_core) + diff --git a/openlp/core/lib/plugin.py b/openlp/core/lib/plugin.py index 49a08e32a..390614bad 100644 --- a/openlp/core/lib/plugin.py +++ b/openlp/core/lib/plugin.py @@ -409,6 +409,12 @@ class Plugin(QtCore.QObject): """ pass + def new_service_created(self): + """ + The plugin's needs to handle a new song creation + """ + pass + def _get_main_window(self): """ Adds the main window to the class dynamically @@ -419,3 +425,14 @@ class Plugin(QtCore.QObject): main_window = property(_get_main_window) + def _get_openlp_core(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 + + openlp_core = property(_get_openlp_core) + + diff --git a/openlp/core/lib/pluginmanager.py b/openlp/core/lib/pluginmanager.py index ae1d9f984..6cba7104c 100644 --- a/openlp/core/lib/pluginmanager.py +++ b/openlp/core/lib/pluginmanager.py @@ -211,3 +211,13 @@ class PluginManager(object): if plugin.name == name: return plugin 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() + diff --git a/openlp/core/ui/firsttimeform.py b/openlp/core/ui/firsttimeform.py index 6ba8a8df9..b15d3a94f 100644 --- a/openlp/core/ui/firsttimeform.py +++ b/openlp/core/ui/firsttimeform.py @@ -146,13 +146,13 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): # Download the theme screenshots. self.themeScreenshotThread = ThemeScreenshotThread(self) self.themeScreenshotThread.start() - Receiver.send_message(u'cursor_normal') + self.openlp_core.set_normal_cursor() def nextId(self): """ Determine the next page in the Wizard to go to. """ - Receiver.send_message(u'openlp_process_events') + self.openlp_core.process_events() if self.currentId() == FirstTimePage.Plugins: if not self.webAccess: return FirstTimePage.NoInternet @@ -163,14 +163,13 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): elif self.currentId() == FirstTimePage.NoInternet: return FirstTimePage.Progress elif self.currentId() == FirstTimePage.Themes: - Receiver.send_message(u'cursor_busy') - Receiver.send_message(u'openlp_process_events') + self.openlp_core.set_busy_cursor() while not self.themeScreenshotThread.isFinished(): time.sleep(0.1) - Receiver.send_message(u'openlp_process_events') + self.openlp_core.process_events() # Build the screenshot icons, as this can not be done in the thread. self._buildThemeScreenshots() - Receiver.send_message(u'cursor_normal') + self.openlp_core.set_normal_cursor() return FirstTimePage.Defaults else: return self.currentId() + 1 @@ -181,7 +180,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): """ # Keep track of the page we are at. Triggering "Cancel" causes pageId # to be a -1. - Receiver.send_message(u'openlp_process_events') + self.openlp_core.process_events() if pageId != -1: self.lastId = pageId if pageId == FirstTimePage.Plugins: @@ -213,16 +212,15 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): if self.hasRunWizard: self.cancelButton.setVisible(False) elif pageId == FirstTimePage.Progress: - Receiver.send_message(u'cursor_busy') + self.openlp_core.set_busy_cursor() self.repaint() - Receiver.send_message(u'openlp_process_events') + self.openlp_core.process_events() # Try to give the wizard a chance to redraw itself time.sleep(0.2) self._preWizard() self._performWizard() self._postWizard() - Receiver.send_message(u'cursor_normal') - Receiver.send_message(u'openlp_process_events') + self.openlp_core.set_normal_cursor() def updateScreenListCombo(self): """ @@ -244,16 +242,15 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): self.downloadCancelled = True while self.themeScreenshotThread.isRunning(): time.sleep(0.1) - Receiver.send_message(u'cursor_normal') + self.openlp_core.set_normal_cursor() def onNoInternetFinishButtonClicked(self): """ Process the triggering of the "Finish" button on the No Internet page. """ - Receiver.send_message(u'cursor_busy') + self.openlp_core.set_busy_cursor() self._performWizard() - Receiver.send_message(u'cursor_normal') - Receiver.send_message(u'openlp_process_events') + self.openlp_core.set_normal_cursor() Settings().setValue(u'general/has run wizard', True) self.close() @@ -320,7 +317,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): self.progressLabel.setText(status_text) if increment > 0: self.progressBar.setValue(self.progressBar.value() + increment) - Receiver.send_message(u'openlp_process_events') + self.openlp_core.process_events() def _preWizard(self): """ @@ -328,10 +325,10 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): """ self.max_progress = 0 self.finishButton.setVisible(False) - Receiver.send_message(u'openlp_process_events') + self.openlp_core.process_events() # Loop through the songs list and increase for each selected item for i in xrange(self.songsListWidget.count()): - Receiver.send_message(u'openlp_process_events') + self.openlp_core.process_events() item = self.songsListWidget.item(i) if item.checkState() == QtCore.Qt.Checked: filename = item.data(QtCore.Qt.UserRole) @@ -340,7 +337,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(): - Receiver.send_message(u'openlp_process_events') + self.openlp_core.process_events() item = iterator.value() if item.parent() and item.checkState(0) == QtCore.Qt.Checked: filename = item.data(0, QtCore.Qt.UserRole) @@ -349,7 +346,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()): - Receiver.send_message(u'openlp_process_events') + self.openlp_core.process_events() item = self.themesListWidget.item(i) if item.checkState() == QtCore.Qt.Checked: filename = item.data(QtCore.Qt.UserRole) @@ -369,7 +366,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): self.progressPage.setTitle(translate('OpenLP.FirstTimeWizard', 'Setting Up')) self.progressPage.setSubTitle(u'Setup complete.') self.repaint() - Receiver.send_message(u'openlp_process_events') + self.openlp_core.process_events() # Try to give the wizard a chance to repaint itself time.sleep(0.1) @@ -396,7 +393,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): self.finishButton.setEnabled(True) self.cancelButton.setVisible(False) self.nextButton.setVisible(False) - Receiver.send_message(u'openlp_process_events') + self.openlp_core.process_events() def _performWizard(self): """ @@ -471,3 +468,13 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): return self._theme_manager theme_manager = property(_get_theme_manager) + + def _get_openlp_core(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 + + openlp_core = property(_get_openlp_core) diff --git a/openlp/core/ui/maindisplay.py b/openlp/core/ui/maindisplay.py index 3fed96ec4..a8e22db22 100644 --- a/openlp/core/ui/maindisplay.py +++ b/openlp/core/ui/maindisplay.py @@ -229,7 +229,7 @@ class MainDisplay(Display): log.debug(u'text to display') # Wait for the webview to update before displaying text. while not self.webLoaded: - Receiver.send_message(u'openlp_process_events') + self.openlp_core.process_events() self.setGeometry(self.screen[u'size']) if animate: self.frame.evaluateJavaScript(u'show_text("%s")' % slide.replace(u'\\', u'\\\\').replace(u'\"', u'\\\"')) @@ -333,18 +333,18 @@ class MainDisplay(Display): Generates a preview of the image displayed. """ log.debug(u'preview for %s', self.isLive) - Receiver.send_message(u'openlp_process_events') + self.openlp_core.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': - Receiver.send_message(u'openlp_process_events') + self.openlp_core.process_events() # Wait for the webview to update before getting the preview. # Important otherwise first preview will miss the background ! while not self.webLoaded: - Receiver.send_message(u'openlp_process_events') + self.openlp_core.process_events() # if was hidden keep it hidden if self.isLive: if self.hideMode: @@ -486,6 +486,16 @@ class MainDisplay(Display): return self._image_manager image_manager = property(_get_image_manager) + + def _get_openlp_core(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 + + openlp_core = property(_get_openlp_core) class AudioPlayer(QtCore.QObject): diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index 1af37bac1..564542db7 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -531,7 +531,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) - Receiver.send_message(u'cursor_busy') + self.openlp_core.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_warning_message'), self.onWarningMessage) @@ -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 - Receiver.send_message(u'cursor_normal') + self.openlp_core.set_busy_cursor() def setAutoLanguage(self, value): self.languageGroup.setDisabled(value) @@ -635,20 +635,20 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): """ Give all the plugins a chance to perform some tasks at startup """ - Receiver.send_message(u'openlp_process_events') + self.openlp_core.process_events() for plugin in self.pluginManager.plugins: if plugin.isActive(): plugin.appStartup() - Receiver.send_message(u'openlp_process_events') + self.openlp_core.process_events() def firstTime(self): # Import themes if first time - Receiver.send_message(u'openlp_process_events') + self.openlp_core.process_events() for plugin in self.pluginManager.plugins: if hasattr(plugin, u'firstTime'): - Receiver.send_message(u'openlp_process_events') + self.openlp_core.process_events() plugin.firstTime() - Receiver.send_message(u'openlp_process_events') + self.openlp_core.process_events() temp_dir = os.path.join(unicode(gettempdir()), u'openlp') shutil.rmtree(temp_dir, True) @@ -669,7 +669,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): QtGui.QMessageBox.No) if answer == QtGui.QMessageBox.No: return - Receiver.send_message(u'cursor_busy') + self.openlp_core.set_busy_cursor() screens = ScreenList() firstTime = FirstTimeForm(screens, self) firstTime.exec_() @@ -979,14 +979,14 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): renderer. """ log.debug(u'screenChanged') - Receiver.send_message(u'cursor_busy') + self.openlp_core.set_busy_cursor() self.imageManager.updateDisplay() self.renderer.update_display() self.previewController.screenSizeChanged() self.liveController.screenSizeChanged() self.setFocus() self.activateWindow() - Receiver.send_message(u'cursor_normal') + self.openlp_core.set_busy_cursor() def closeEvent(self, event): """ @@ -1270,14 +1270,14 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): self.loadProgressBar.show() self.loadProgressBar.setMaximum(size) self.loadProgressBar.setValue(0) - Receiver.send_message(u'openlp_process_events') + self.openlp_core.process_events() def incrementProgressBar(self): """ Increase the Progress Bar value by 1 """ self.loadProgressBar.setValue(self.loadProgressBar.value() + 1) - Receiver.send_message(u'openlp_process_events') + self.openlp_core.process_events() def finishedProgressBar(self): """ @@ -1292,7 +1292,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): if event.timerId() == self.timer_id: self.timer_id = 0 self.loadProgressBar.hide() - Receiver.send_message(u'openlp_process_events') + self.openlp_core.process_events() def setNewDataPath(self, new_data_path): self.newDataPath = new_data_path @@ -1307,20 +1307,19 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): if self.copyData: log.info(u'Copying data to new path') try: - Receiver.send_message(u'openlp_process_events') - Receiver.send_message(u'cursor_busy') + 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: - Receiver.send_message(u'cursor_normal') + 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'), translate('OpenLP.MainWindow', '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 else: log.info(u'No data copy requested') @@ -1331,3 +1330,12 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): if self.newDataPath == AppLocation.get_directory(AppLocation.DataDir): settings.remove(u'advanced/data path') + def _get_openlp_core(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 + + openlp_core = property(_get_openlp_core) \ No newline at end of file diff --git a/openlp/core/ui/media/mediaplayer.py b/openlp/core/ui/media/mediaplayer.py index 9d09cda6e..f907ef872 100644 --- a/openlp/core/ui/media/mediaplayer.py +++ b/openlp/core/ui/media/mediaplayer.py @@ -27,6 +27,7 @@ # Temple Place, Suite 330, Boston, MA 02111-1307 USA # ############################################################################### +from openlp.core.lib import Registry from openlp.core.ui.media import MediaState class MediaPlayer(object): @@ -143,3 +144,13 @@ class MediaPlayer(object): Returns Information about the player """ return u'' + + def _get_openlp_core(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 + + openlp_core = property(_get_openlp_core) \ No newline at end of file diff --git a/openlp/core/ui/media/phononplayer.py b/openlp/core/ui/media/phononplayer.py index da2d19857..6cb09bdf5 100644 --- a/openlp/core/ui/media/phononplayer.py +++ b/openlp/core/ui/media/phononplayer.py @@ -34,7 +34,7 @@ from datetime import datetime from PyQt4 import QtGui from PyQt4.phonon import Phonon -from openlp.core.lib import Receiver, translate, Settings +from openlp.core.lib import translate, Settings from openlp.core.ui.media import MediaState from openlp.core.ui.media.mediaplayer import MediaPlayer @@ -150,7 +150,7 @@ class PhononPlayer(MediaPlayer): current_state = display.mediaObject.state() if current_state == Phonon.ErrorState: return False - Receiver.send_message(u'openlp_process_events') + self.openlp_core.process_events() if (datetime.now() - start).seconds > 5: return False return True diff --git a/openlp/core/ui/media/vlcplayer.py b/openlp/core/ui/media/vlcplayer.py index 6f3e3d0e7..e09f043af 100644 --- a/openlp/core/ui/media/vlcplayer.py +++ b/openlp/core/ui/media/vlcplayer.py @@ -35,7 +35,7 @@ import sys from PyQt4 import QtGui -from openlp.core.lib import Receiver, translate, Settings +from openlp.core.lib import translate, Settings from openlp.core.ui.media import MediaState from openlp.core.ui.media.mediaplayer import MediaPlayer @@ -173,7 +173,7 @@ class VlcPlayer(MediaPlayer): while not mediaState == display.vlcMedia.get_state(): if display.vlcMedia.get_state() == vlc.State.Error: return False - Receiver.send_message(u'openlp_process_events') + self.openlp_core.process_events() if (datetime.now() - start).seconds > 60: return False return True diff --git a/openlp/core/ui/pluginform.py b/openlp/core/ui/pluginform.py index 37cae9a0a..d11606366 100644 --- a/openlp/core/ui/pluginform.py +++ b/openlp/core/ui/pluginform.py @@ -31,7 +31,7 @@ import logging 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 log = logging.getLogger(__name__) @@ -62,7 +62,7 @@ class PluginForm(QtGui.QDialog, Ui_PluginViewDialog): self._clearDetails() self.programaticChange = True pluginListWidth = 0 - for plugin in self.parent().pluginManager.plugins: + for plugin in self.plugin_manager.plugins: item = QtGui.QListWidgetItem(self.pluginListWidget) # 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. @@ -106,10 +106,9 @@ class PluginForm(QtGui.QDialog, Ui_PluginViewDialog): if self.pluginListWidget.currentItem() is None: self._clearDetails() return - plugin_name_singular = \ - self.pluginListWidget.currentItem().text().split(u'(')[0][:-1] + plugin_name_singular = self.pluginListWidget.currentItem().text().split(u'(')[0][:-1] self.activePlugin = None - for plugin in self.parent().pluginManager.plugins: + for plugin in self.plugin_manager.plugins: if plugin.status != PluginStatus.Disabled: if plugin.nameStrings[u'singular'] == plugin_name_singular: self.activePlugin = plugin @@ -123,9 +122,9 @@ class PluginForm(QtGui.QDialog, Ui_PluginViewDialog): if self.programaticChange or status == PluginStatus.Disabled: return if status == PluginStatus.Inactive: - Receiver.send_message(u'cursor_busy') + self.openlp_core.set_busy_cursor() self.activePlugin.toggleStatus(PluginStatus.Active) - Receiver.send_message(u'cursor_normal') + self.openlp_core.set_normal_cursor() self.activePlugin.appStartup() else: self.activePlugin.toggleStatus(PluginStatus.Inactive) @@ -138,3 +137,23 @@ class PluginForm(QtGui.QDialog, Ui_PluginViewDialog): status_text = translate('OpenLP.PluginForm', '%s (Disabled)') self.pluginListWidget.currentItem().setText( 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_openlp_core(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 + + openlp_core = property(_get_openlp_core) diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index ff3d0721e..eb354a9c5 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -203,18 +203,10 @@ class ServiceManagerDialog(object): QtCore.QObject.connect(self.service_manager_list, QtCore.SIGNAL(u'itemExpanded(QTreeWidgetItem*)'), 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'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_screen_changed'), 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'service_item_update'), - self.service_item_update) # Last little bits of setting up self.service_theme = Settings().value(self.main_window.serviceManagerSettingsSection + u'/service theme') self.servicePath = AppLocation.get_section_data_path(u'servicemanager') @@ -448,7 +440,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog): self.service_id += 1 self.set_modified(False) Settings().setValue(u'servicemanager/last file', u'') - Receiver.send_message(u'servicemanager_new_service') + self.plugin_manager.new_service_created() def save_file(self): """ @@ -476,7 +468,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog): missing_list = [] audio_files = [] total_size = 0 - Receiver.send_message(u'cursor_busy') + self.openlp_core.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 @@ -492,7 +484,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog): else: write_list.append(path_from) if missing_list: - Receiver.send_message(u'cursor_normal') + self.openlp_core.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' @@ -502,7 +494,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog): if answer == QtGui.QMessageBox.Cancel: self.main_window.finishedProgressBar() return False - Receiver.send_message(u'cursor_busy') + self.openlp_core.set_busy_cursor() # Check if item contains a missing file. for item in list(self.service_items): self.main_window.incrementProgressBar() @@ -563,7 +555,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog): if zip_file: zip_file.close() self.main_window.finishedProgressBar() - Receiver.send_message(u'cursor_normal') + self.openlp_core.set_normal_cursor() if success: try: shutil.copy(temp_file_name, path_file_name) @@ -592,7 +584,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 = [] - Receiver.send_message(u'cursor_busy') + self.openlp_core.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: @@ -621,7 +613,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog): if zip_file: zip_file.close() self.main_window.finishedProgressBar() - Receiver.send_message(u'cursor_normal') + self.openlp_core.set_normal_cursor() if success: try: shutil.copy(temp_file_name, path_file_name) @@ -718,7 +710,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog): if osfile.endswith(u'osd'): p_file = os.path.join(self.servicePath, osfile) if 'p_file' in locals(): - Receiver.send_message(u'cursor_busy') + self.openlp_core.set_busy_cursor() file_to = open(p_file, u'r') items = cPickle.load(file_to) file_to.close() @@ -763,6 +755,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() return finally: if file_to: @@ -770,7 +763,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog): if zip_file: zip_file.close() self.main_window.finishedProgressBar() - Receiver.send_message(u'cursor_normal') + self.openlp_core.set_normal_cursor() self.repaint_service_list(-1, -1) def load_Last_file(self): @@ -944,12 +937,20 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog): self.add_service_item(self.serviceItemEditForm.get_service_item(), 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 - 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: if sitem[u'service_item'].unique_identifier == unique_identifier: item = self.service_manager_list.topLevelItem(sitem[u'order'] - 1) @@ -975,9 +976,13 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog): lookFor = 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. + + ``last_slide`` + Is this the last slide in the service_item + """ if not self.service_manager_list.selectedItems(): return @@ -987,7 +992,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog): serviceIterator = QtGui.QTreeWidgetItemIterator(self.service_manager_list) while serviceIterator.value(): if serviceIterator.value() == selected: - if message == u'last slide' and prevItemLastSlide: + if last_slide and prevItemLastSlide: pos = prevItem.data(0, QtCore.Qt.UserRole) check_expanded = self.service_items[pos - 1][u'expanded'] self.service_manager_list.setCurrentItem(prevItemLastSlide) @@ -1246,7 +1251,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog): Rebuild the service list as things have changed and a repaint is the easiest way to do this. """ - Receiver.send_message(u'cursor_busy') + self.openlp_core.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 @@ -1278,14 +1283,14 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog): self.set_modified() # Repaint it once only at the end self.repaint_service_list(-1, -1) - Receiver.send_message(u'cursor_normal') + self.openlp_core.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. 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_temporary = str_to_bool(temporary) @@ -1353,7 +1358,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog): """ Send the current item to the Preview slide controller """ - Receiver.send_message(u'cursor_busy') + self.openlp_core.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) @@ -1361,7 +1366,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')) - Receiver.send_message(u'cursor_normal') + self.openlp_core.set_normal_cursor() def get_service_item(self): """ @@ -1394,7 +1399,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog): return if row != -1: child = row - Receiver.send_message(u'cursor_busy') + self.openlp_core.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'): @@ -1409,7 +1414,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')) - Receiver.send_message(u'cursor_normal') + self.openlp_core.set_normal_cursor() def remote_edit(self): """ @@ -1621,4 +1626,14 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog): self._main_window = Registry().get(u'main_window') return self._main_window - main_window = property(_get_main_window) \ No newline at end of file + main_window = property(_get_main_window) + + def _get_openlp_core(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 + + openlp_core = property(_get_openlp_core) diff --git a/openlp/core/ui/slidecontroller.py b/openlp/core/ui/slidecontroller.py index c2216da58..002c1e49d 100644 --- a/openlp/core/ui/slidecontroller.py +++ b/openlp/core/ui/slidecontroller.py @@ -510,12 +510,12 @@ class SlideController(DisplayController): self.keypress_loop = True keypressCommand = self.keypress_queue.popleft() if keypressCommand == ServiceItemAction.Previous: - Receiver.send_message('servicemanager_previous_item') + self.service_manager.previous_item() elif keypressCommand == ServiceItemAction.PreviousLastSlide: # 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: - Receiver.send_message('servicemanager_next_item') + self.service_manager.next_item() self.keypress_loop = False def screenSizeChanged(self): @@ -1248,8 +1248,7 @@ class SlideController(DisplayController): row = self.previewListWidget.currentRow() if -1 < row < self.previewListWidget.rowCount(): if self.serviceItem.from_service: - Receiver.send_message('servicemanager_preview_live', u'%s:%s' % - (self.serviceItem.unique_identifier, row)) + self.service_manager.preview_live(self.serviceItem.unique_identifier, row) else: self.live_controller.addServiceManagerItem(self.serviceItem, row) diff --git a/openlp/core/ui/thememanager.py b/openlp/core/ui/thememanager.py index ac1d8b02c..ba2602277 100644 --- a/openlp/core/ui/thememanager.py +++ b/openlp/core/ui/thememanager.py @@ -147,13 +147,13 @@ class ThemeManager(QtGui.QWidget): """ Import new themes downloaded by the first time wizard """ - Receiver.send_message(u'cursor_busy') + self.openlp_core.set_busy_cursor() files = SettingsManager.get_files(self.settingsSection, u'.otz') for file_name in files: file_name = os.path.join(self.path, file_name) self.unzip_theme(file_name, self.path) delete_file(file) - Receiver.send_message(u'cursor_normal') + self.openlp_core.set_normal_cursor() def config_updated(self): """ @@ -361,7 +361,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')) - Receiver.send_message(u'cursor_busy') + self.openlp_core.set_busy_cursor() if path: Settings().setValue(self.settingsSection + u'/last directory export', path) theme_path = os.path.join(path, theme + u'.otz') @@ -383,7 +383,7 @@ class ThemeManager(QtGui.QWidget): finally: if zip_file: zip_file.close() - Receiver.send_message(u'cursor_normal') + self.openlp_core.set_normal_cursor() def on_import_theme(self): """ @@ -398,12 +398,12 @@ class ThemeManager(QtGui.QWidget): log.info(u'New Themes %s', unicode(files)) if not files: return - Receiver.send_message(u'cursor_busy') + self.openlp_core.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() - Receiver.send_message(u'cursor_normal') + self.openlp_core.set_normal_cursor() def load_themes(self, first_time=False): """ @@ -841,3 +841,13 @@ class ThemeManager(QtGui.QWidget): return self._main_window main_window = property(_get_main_window) + + def _get_openlp_core(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 + + openlp_core = property(_get_openlp_core) \ No newline at end of file diff --git a/openlp/core/ui/wizard.py b/openlp/core/ui/wizard.py index bf7dff269..f5dc26101 100644 --- a/openlp/core/ui/wizard.py +++ b/openlp/core/ui/wizard.py @@ -34,7 +34,7 @@ import os from PyQt4 import QtCore, QtGui -from openlp.core.lib import build_icon, Receiver, Settings, translate, UiStrings +from openlp.core.lib import build_icon, Receiver, Registry, Settings, translate, UiStrings from openlp.core.lib.ui import add_welcome_page log = logging.getLogger(__name__) @@ -215,7 +215,7 @@ class OpenLPWizard(QtGui.QWizard): self.progressLabel.setText(status_text) if increment > 0: self.progressBar.setValue(self.progressBar.value() + increment) - Receiver.send_message(u'openlp_process_events') + self.openlp_core.process_events() def preWizard(self): """ @@ -233,7 +233,7 @@ class OpenLPWizard(QtGui.QWizard): self.progressBar.setValue(self.progressBar.maximum()) self.finishButton.setVisible(True) self.cancelButton.setVisible(False) - Receiver.send_message(u'openlp_process_events') + self.openlp_core.process_events() def getFileName(self, title, editbox, setting_name, filters=u''): """ @@ -282,3 +282,13 @@ class OpenLPWizard(QtGui.QWizard): if folder: editbox.setText(folder) Settings().setValue(self.plugin.settingsSection + u'/' + setting_name, folder) + + def _get_openlp_core(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 + + openlp_core = property(_get_openlp_core) \ No newline at end of file diff --git a/openlp/core/utils/__init__.py b/openlp/core/utils/__init__.py index ba5e08c7f..d8bf1e7e8 100644 --- a/openlp/core/utils/__init__.py +++ b/openlp/core/utils/__init__.py @@ -39,7 +39,7 @@ from subprocess import Popen, PIPE import sys import urllib2 -from openlp.core.lib import Settings +from openlp.core.lib import Registry, Settings from PyQt4 import QtGui, QtCore @@ -425,7 +425,7 @@ def get_web_page(url, header=None, update_openlp=False): if not page: return None if update_openlp: - Receiver.send_message(u'openlp_process_events') + Registry().get(u'openlp_core').process_events() log.debug(page) return page diff --git a/openlp/plugins/bibles/forms/bibleimportform.py b/openlp/plugins/bibles/forms/bibleimportform.py index 05469eae9..93ee35154 100644 --- a/openlp/plugins/bibles/forms/bibleimportform.py +++ b/openlp/plugins/bibles/forms/bibleimportform.py @@ -34,7 +34,7 @@ import os from PyQt4 import QtCore, QtGui -from openlp.core.lib import Receiver, translate, Settings, UiStrings +from openlp.core.lib import translate, Settings, UiStrings from openlp.core.lib.db import delete_database from openlp.core.lib.ui import critical_error_message_box from openlp.core.ui.wizard import OpenLPWizard, WizardStrings @@ -578,7 +578,7 @@ class BibleImportForm(OpenLPWizard): self.progressLabel.setText(translate('BiblesPlugin.ImportWizardForm', 'Registering Bible...')) else: self.progressLabel.setText(WizardStrings.StartingImport) - Receiver.send_message(u'openlp_process_events') + self.openlp_core.process_events() def performWizard(self): """ diff --git a/openlp/plugins/bibles/forms/bibleupgradeform.py b/openlp/plugins/bibles/forms/bibleupgradeform.py index 0b2f214f7..d46af6e36 100644 --- a/openlp/plugins/bibles/forms/bibleupgradeform.py +++ b/openlp/plugins/bibles/forms/bibleupgradeform.py @@ -335,7 +335,7 @@ class BibleUpgradeForm(OpenLPWizard): """ OpenLPWizard.preWizard(self) self.progressLabel.setText(translate('BiblesPlugin.UpgradeWizardForm', 'Starting upgrade...')) - Receiver.send_message(u'openlp_process_events') + self.openlp_core.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'])) - Receiver.send_message(u'openlp_process_events') + self.openlp_core.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'])) - Receiver.send_message(u'openlp_process_events') + self.openlp_core.process_events() self.newbibles[number].session.commit() if not self.success.get(number, True): self.incrementProgressBar(translate('BiblesPlugin.UpgradeWizardForm', diff --git a/openlp/plugins/bibles/forms/editbibleform.py b/openlp/plugins/bibles/forms/editbibleform.py index 26a58d14b..52093dffc 100644 --- a/openlp/plugins/bibles/forms/editbibleform.py +++ b/openlp/plugins/bibles/forms/editbibleform.py @@ -32,7 +32,7 @@ import re from PyQt4 import QtGui -from openlp.core.lib import Receiver, translate, UiStrings +from openlp.core.lib import Registry, translate, UiStrings from openlp.core.lib.ui import critical_error_message_box from editbibledialog import Ui_EditBibleDialog from openlp.plugins.bibles.lib import BibleStrings @@ -122,8 +122,7 @@ class EditBibleForm(QtGui.QDialog, Ui_EditBibleDialog): if book.name != custom_names[abbr]: if not self.validateBook(custom_names[abbr], abbr): return - Receiver.send_message(u'openlp_process_events') - Receiver.send_message(u'cursor_busy') + self.openlp_core.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(): @@ -132,7 +131,7 @@ class EditBibleForm(QtGui.QDialog, Ui_EditBibleDialog): book.name = custom_names[abbr] self.manager.update_book(self.bible, book) self.bible = None - Receiver.send_message(u'cursor_normal') + self.openlp_core.set_normal_cursor() QtGui.QDialog.accept(self) def validateMeta(self, name, copyright): @@ -189,3 +188,13 @@ class EditBibleForm(QtGui.QDialog, Ui_EditBibleDialog): % new_book_name) return False return True + + def _get_openlp_core(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 + + openlp_core = property(_get_openlp_core) diff --git a/openlp/plugins/bibles/lib/csvbible.py b/openlp/plugins/bibles/lib/csvbible.py index c09461721..20c92ffd6 100644 --- a/openlp/plugins/bibles/lib/csvbible.py +++ b/openlp/plugins/bibles/lib/csvbible.py @@ -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']) - Receiver.send_message(u'openlp_process_events') + self.openlp_core.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.')) - Receiver.send_message(u'openlp_process_events') + self.openlp_core.process_events() self.session.commit() except IOError: log.exception(u'Loading verses from file failed') diff --git a/openlp/plugins/bibles/lib/db.py b/openlp/plugins/bibles/lib/db.py index 11bdd09e7..5b492d10e 100644 --- a/openlp/plugins/bibles/lib/db.py +++ b/openlp/plugins/bibles/lib/db.py @@ -38,7 +38,7 @@ from sqlalchemy import Column, ForeignKey, or_, Table, types, func from sqlalchemy.orm import class_mapper, mapper, relation 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.ui import critical_error_message_box from openlp.core.utils import AppLocation, clean_filename @@ -549,6 +549,16 @@ class BibleDB(QtCore.QObject, Manager): verses = self.session.query(Verse).all() log.debug(verses) + def _get_openlp_core(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 + + openlp_core = property(_get_openlp_core) + class BiblesResourcesDB(QtCore.QObject, Manager): """ diff --git a/openlp/plugins/bibles/lib/http.py b/openlp/plugins/bibles/lib/http.py index 327f03565..522dd08c3 100644 --- a/openlp/plugins/bibles/lib/http.py +++ b/openlp/plugins/bibles/lib/http.py @@ -38,7 +38,7 @@ from HTMLParser import HTMLParseError from BeautifulSoup import BeautifulSoup, NavigableString, Tag -from openlp.core.lib import Receiver, translate +from openlp.core.lib import Receiver, Registry,translate from openlp.core.lib.ui import critical_error_message_box from openlp.core.utils import get_web_page from openlp.plugins.bibles.lib import SearchResults @@ -164,7 +164,7 @@ class BGExtract(object): if len(verse_parts) > 1: verse = int(verse_parts[0]) 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)) verse_list = {} for verse, text in verses[::-1]: @@ -235,9 +235,10 @@ class BGExtract(object): soup = get_soup_for_bible_ref( u'http://www.biblegateway.com/passage/?%s' % url_params, pre_parse_regex=r'', pre_parse_substitute='', cleaner=cleaner) + self.openlp_core.process_events() if not soup: return None - Receiver.send_message(u'openlp_process_events') + self.openlp_core.process_events() div = soup.find('div', 'result-text-style-normal') self._clean_soup(div) span_list = div.findAll('span', 'text') @@ -281,7 +282,7 @@ class BGExtract(object): if not soup: send_error_message(u'parse') return None - Receiver.send_message(u'openlp_process_events') + self.openlp_core.process_events() content = soup.find(u'table', u'infotable') if content: content = content.findAll(u'tr') @@ -329,7 +330,7 @@ class BSExtract(object): soup = get_soup_for_bible_ref(chapter_url, header) if not soup: return None - Receiver.send_message(u'openlp_process_events') + self.openlp_core.process_events() content = soup.find(u'div', u'content') if not content: log.error(u'No verses found in the Bibleserver response.') @@ -339,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: - Receiver.send_message(u'openlp_process_events') + self.openlp_core.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) @@ -402,7 +403,7 @@ class CWExtract(object): soup = get_soup_for_bible_ref(chapter_url) if not soup: return None - Receiver.send_message(u'openlp_process_events') + self.openlp_core.process_events() html_verses = soup.findAll(u'span', u'versetext') if not html_verses: log.error(u'No verses found in the CrossWalk response.') @@ -412,27 +413,25 @@ class CWExtract(object): reduce_spaces = re.compile(r'[ ]{2,}') fix_punctuation = re.compile(r'[ ]+([.,;])') for verse in html_verses: - Receiver.send_message(u'openlp_process_events') + self.openlp_core.process_events() verse_number = int(verse.contents[0].contents[0]) verse_text = u'' for part in verse.contents: - Receiver.send_message(u'openlp_process_events') + self.openlp_core.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'): + (part.attrMap[u'class'] == u'WordsOfChrist' or part.attrMap[u'class'] == u'strongs'): for subpart in part.contents: - Receiver.send_message(u'openlp_process_events') + self.openlp_core.process_events() if isinstance(subpart, NavigableString): verse_text = verse_text + subpart - elif subpart and subpart.attrMap and \ - subpart.attrMap[u'class'] == u'strongs': + elif subpart and subpart.attrMap and subpart.attrMap[u'class'] == u'strongs': for subsub in subpart.contents: - Receiver.send_message(u'openlp_process_events') + self.openlp_core.process_events() if isinstance(subsub, NavigableString): verse_text = verse_text + subsub - Receiver.send_message(u'openlp_process_events') + self.openlp_core.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 ') @@ -598,7 +597,7 @@ class HTTPBible(BibleDB): return [] book = db_book.name if BibleDB.get_verse_count(self, book_id, reference[1]) == 0: - Receiver.send_message(u'cursor_busy') + self.openlp_core.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 @@ -606,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 - Receiver.send_message(u'openlp_process_events') + self.openlp_core.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) - Receiver.send_message(u'openlp_process_events') - Receiver.send_message(u'cursor_normal') - Receiver.send_message(u'openlp_process_events') + self.openlp_core.process_events() + self.openlp_core.set_normal_cursor() + self.openlp_core.process_events() return BibleDB.get_verses(self, reference_list, show_error) def get_chapter(self, book, chapter): @@ -660,6 +659,16 @@ 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): + """ + 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 + + openlp_core = property(_get_openlp_core) + def get_soup_for_bible_ref(reference_url, header=None, pre_parse_regex=None, pre_parse_substitute=None, cleaner=None): """ @@ -698,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 - Receiver.send_message(u'openlp_process_events') return soup def send_error_message(error_type): diff --git a/openlp/plugins/bibles/lib/mediaitem.py b/openlp/plugins/bibles/lib/mediaitem.py index fd1109221..02fe135e3 100644 --- a/openlp/plugins/bibles/lib/mediaitem.py +++ b/openlp/plugins/bibles/lib/mediaitem.py @@ -614,7 +614,7 @@ class BibleMediaItem(MediaManagerItem): """ log.debug(u'Advanced Search Button clicked') self.advancedSearchButton.setEnabled(False) - Receiver.send_message(u'openlp_process_events') + self.openlp_core.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) - Receiver.send_message(u'cursor_busy') + self.openlp_core.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,8 +640,7 @@ class BibleMediaItem(MediaManagerItem): self.displayResults(bible, second_bible) self.advancedSearchButton.setEnabled(True) self.checkSearchResult() - Receiver.send_message(u'cursor_normal') - Receiver.send_message(u'openlp_process_events') + self.openlp_core.set_normal_cursor() def onQuickSearchButton(self): """ @@ -650,7 +649,7 @@ class BibleMediaItem(MediaManagerItem): """ log.debug(u'Quick Search Button clicked') self.quickSearchButton.setEnabled(False) - Receiver.send_message(u'openlp_process_events') + self.openlp_core.process_events() bible = self.quickVersionComboBox.currentText() second_bible = self.quickSecondComboBox.currentText() text = self.quickSearchEdit.text() @@ -662,7 +661,7 @@ class BibleMediaItem(MediaManagerItem): self.search_results[0].book.book_reference_id) else: # We are doing a 'Text Search'. - Receiver.send_message(u'cursor_busy') + self.openlp_core.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: @@ -697,8 +696,7 @@ class BibleMediaItem(MediaManagerItem): self.displayResults(bible, second_bible) self.quickSearchButton.setEnabled(True) self.checkSearchResult() - Receiver.send_message(u'cursor_normal') - Receiver.send_message(u'openlp_process_events') + self.openlp_core.set_normal_cursor() def displayResults(self, bible, second_bible=u''): """ diff --git a/openlp/plugins/bibles/lib/openlp1.py b/openlp/plugins/bibles/lib/openlp1.py index 732fdc23b..ab049625d 100644 --- a/openlp/plugins/bibles/lib/openlp1.py +++ b/openlp/plugins/bibles/lib/openlp1.py @@ -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) - Receiver.send_message(u'openlp_process_events') + self.openlp_core.process_events() self.session.commit() connection.close() return True diff --git a/openlp/plugins/bibles/lib/opensong.py b/openlp/plugins/bibles/lib/opensong.py index 271af883a..00d7c1318 100644 --- a/openlp/plugins/bibles/lib/opensong.py +++ b/openlp/plugins/bibles/lib/opensong.py @@ -30,7 +30,7 @@ import logging 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.plugins.bibles.lib.db import BibleDB, BiblesResourcesDB @@ -129,7 +129,7 @@ class OpenSongBible(BibleDB): self.wizard.incrementProgressBar(translate('BiblesPlugin.Opensong', 'Importing %s %s...', 'Importing ...')) % (db_book.name, chapter_number) self.session.commit() - Receiver.send_message(u'openlp_process_events') + self.openlp_core.process_events() except etree.XMLSyntaxError as inst: critical_error_message_box(message=translate('BiblesPlugin.OpenSongImport', 'Incorrect Bible file type supplied. OpenSong Bibles may be ' diff --git a/openlp/plugins/bibles/lib/osis.py b/openlp/plugins/bibles/lib/osis.py index 3fddd7a4b..5996448ad 100644 --- a/openlp/plugins/bibles/lib/osis.py +++ b/openlp/plugins/bibles/lib/osis.py @@ -33,7 +33,7 @@ import chardet import codecs import re -from openlp.core.lib import Receiver, translate +from openlp.core.lib import translate from openlp.core.utils import AppLocation from openlp.plugins.bibles.lib.db import BibleDB, BiblesResourcesDB @@ -182,7 +182,7 @@ class OSISBible(BibleDB): .replace(u'', u'').replace(u'', u'') verse_text = self.spaces_regex.sub(u' ', verse_text) self.create_verse(db_book.id, chapter, verse, verse_text) - Receiver.send_message(u'openlp_process_events') + self.openlp_core.process_events() self.session.commit() if match_count == 0: success = False diff --git a/openlp/plugins/custom/lib/mediaitem.py b/openlp/plugins/custom/lib/mediaitem.py index e434f516a..7b87dbef5 100644 --- a/openlp/plugins/custom/lib/mediaitem.py +++ b/openlp/plugins/custom/lib/mediaitem.py @@ -250,7 +250,7 @@ class CustomMediaItem(MediaManagerItem): and_(CustomSlide.title == item.title, CustomSlide.theme_name == item.theme, CustomSlide.credits == item.raw_footer[0][len(item.title) + 1:])) 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: if self.add_custom_from_service: self.create_from_service_item(item) diff --git a/openlp/plugins/images/lib/mediaitem.py b/openlp/plugins/images/lib/mediaitem.py index 85024229a..7af23b0ec 100644 --- a/openlp/plugins/images/lib/mediaitem.py +++ b/openlp/plugins/images/lib/mediaitem.py @@ -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) - Receiver.send_message(u'cursor_busy') + self.openlp_core.set_busy_cursor() self.main_window.displayProgressBar(len(row_list)) for row in row_list: text = self.listView.item(row) @@ -109,12 +109,12 @@ class ImageMediaItem(MediaManagerItem): self.main_window.incrementProgressBar() SettingsManager.setValue(self.settingsSection + u'/images files', self.getFileList()) self.main_window.finishedProgressBar() - Receiver.send_message(u'cursor_normal') + self.openlp_core.set_normal_cursor() self.listView.blockSignals(False) def loadList(self, images, initialLoad=False): + self.openlp_core.set_busy_cursor() if not initialLoad: - Receiver.send_message(u'cursor_busy') self.main_window.displayProgressBar(len(images)) # Sort the images by its filename considering language specific # characters. @@ -138,7 +138,7 @@ class ImageMediaItem(MediaManagerItem): self.main_window.incrementProgressBar() if not initialLoad: self.main_window.finishedProgressBar() - Receiver.send_message(u'cursor_normal') + self.openlp_core.set_busy_cursor() def generateSlideData(self, service_item, item=None, xmlVersion=False, remote=False, context=ServiceItemContext.Service): diff --git a/openlp/plugins/presentations/lib/mediaitem.py b/openlp/plugins/presentations/lib/mediaitem.py index eee1c5801..ab7659a2b 100644 --- a/openlp/plugins/presentations/lib/mediaitem.py +++ b/openlp/plugins/presentations/lib/mediaitem.py @@ -150,9 +150,8 @@ class PresentationMediaItem(MediaManagerItem): """ currlist = self.getFileList() titles = [os.path.split(file)[1] for file in currlist] - Receiver.send_message(u'cursor_busy') + self.openlp_core.set_busy_cursor() if not initialLoad: - Receiver.send_message(u'cursor_busy') self.main_window.displayProgressBar(len(files)) # Sort the presentations by its filename considering language specific characters. files.sort(cmp=locale_compare, @@ -206,10 +205,9 @@ class PresentationMediaItem(MediaManagerItem): item_name.setIcon(icon) item_name.setToolTip(file) self.listView.addItem(item_name) - Receiver.send_message(u'cursor_normal') if not initialLoad: self.main_window.finishedProgressBar() - Receiver.send_message(u'cursor_normal') + self.openlp_core.set_busy_cursor() def onDeleteClick(self): """ @@ -219,7 +217,7 @@ class PresentationMediaItem(MediaManagerItem): items = self.listView.selectedIndexes() row_list = [item.row() for item in items] row_list.sort(reverse=True) - Receiver.send_message(u'cursor_busy') + self.openlp_core.set_busy_cursor() self.main_window.displayProgressBar(len(row_list)) for item in items: filepath = unicode(item.data(QtCore.Qt.UserRole)) @@ -229,7 +227,7 @@ class PresentationMediaItem(MediaManagerItem): doc.close_presentation() self.main_window.incrementProgressBar() self.main_window.finishedProgressBar() - Receiver.send_message(u'cursor_normal') + self.openlp_core.set_busy_cursor() for row in row_list: self.listView.takeItem(row) Settings().setValue(self.settingsSection + u'/presentations files', self.getFileList()) diff --git a/openlp/plugins/songs/forms/songexportform.py b/openlp/plugins/songs/forms/songexportform.py index 29d4b8609..d0444913e 100644 --- a/openlp/plugins/songs/forms/songexportform.py +++ b/openlp/plugins/songs/forms/songexportform.py @@ -226,7 +226,7 @@ class SongExportForm(OpenLPWizard): self.directoryLineEdit.clear() self.searchLineEdit.clear() # Load the list of songs. - Receiver.send_message(u'cursor_busy') + self.openlp_core.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) - Receiver.send_message(u'cursor_normal') + self.openlp_core.set_normal_cursor() def preWizard(self): """ @@ -248,7 +248,7 @@ class SongExportForm(OpenLPWizard): """ OpenLPWizard.preWizard(self) self.progressLabel.setText(translate('SongsPlugin.ExportWizardForm', 'Starting export...')) - Receiver.send_message(u'openlp_process_events') + self.openlp_core.process_events() def performWizard(self): """ diff --git a/openlp/plugins/songs/forms/songimportform.py b/openlp/plugins/songs/forms/songimportform.py index efadd6b61..68b23a2a6 100644 --- a/openlp/plugins/songs/forms/songimportform.py +++ b/openlp/plugins/songs/forms/songimportform.py @@ -35,7 +35,7 @@ import os from PyQt4 import QtCore, QtGui -from openlp.core.lib import Receiver, Settings, SettingsManager, translate, UiStrings +from openlp.core.lib import Settings, SettingsManager, translate, UiStrings from openlp.core.lib.ui import critical_error_message_box from openlp.core.ui.wizard import OpenLPWizard, WizardStrings from openlp.plugins.songs.lib.importer import SongFormat, SongFormatSelect @@ -328,7 +328,7 @@ class SongImportForm(OpenLPWizard): """ OpenLPWizard.preWizard(self) self.progressLabel.setText(WizardStrings.StartingImport) - Receiver.send_message(u'openlp_process_events') + self.openlp_core.process_events() def performWizard(self): """ diff --git a/openlp/plugins/songs/forms/songmaintenanceform.py b/openlp/plugins/songs/forms/songmaintenanceform.py index 474e68040..175d3e503 100644 --- a/openlp/plugins/songs/forms/songmaintenanceform.py +++ b/openlp/plugins/songs/forms/songmaintenanceform.py @@ -346,12 +346,12 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog): """ Utility method to merge two objects to leave one in the database. """ - Receiver.send_message(u'cursor_busy') + self.openlp_core.set_busy_cursor() merge(dbObject) reset() if not self.fromSongEdit: Receiver.send_message(u'songs_load_list') - Receiver.send_message(u'cursor_normal') + self.openlp_core.set_normal_cursor() def mergeAuthors(self, oldAuthor): """ @@ -481,3 +481,12 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog): deleteButton.setEnabled(True) editButton.setEnabled(True) + def _get_openlp_core(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 + + openlp_core = property(_get_openlp_core) \ No newline at end of file diff --git a/openlp/plugins/songs/lib/mediaitem.py b/openlp/plugins/songs/lib/mediaitem.py index de1ad22ff..a8af9f407 100644 --- a/openlp/plugins/songs/lib/mediaitem.py +++ b/openlp/plugins/songs/lib/mediaitem.py @@ -361,7 +361,7 @@ class SongMediaItem(MediaManagerItem): QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes | QtGui.QMessageBox.No), QtGui.QMessageBox.Yes) == QtGui.QMessageBox.No: return - Receiver.send_message(u'cursor_busy') + self.openlp_core.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() - Receiver.send_message(u'cursor_normal') + self.openlp_core.set_normal_cursor() self.onSearchTextButtonClicked() def onCloneClick(self): @@ -526,7 +526,7 @@ class SongMediaItem(MediaManagerItem): temporary = True # Update service with correct song id. 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): """ diff --git a/openlp/plugins/songs/lib/openlyricsexport.py b/openlp/plugins/songs/lib/openlyricsexport.py index 7db466dfc..9c1ee3513 100644 --- a/openlp/plugins/songs/lib/openlyricsexport.py +++ b/openlp/plugins/songs/lib/openlyricsexport.py @@ -35,7 +35,7 @@ import os 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.plugins.songs.lib import OpenLyrics @@ -64,7 +64,7 @@ class OpenLyricsExport(object): openLyrics = OpenLyrics(self.manager) self.parent.progressBar.setMaximum(len(self.songs)) for song in self.songs: - Receiver.send_message(u'openlp_process_events') + self.openlp_core.process_events() if self.parent.stop_export_flag: return False 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'), encoding=u'utf-8', xml_declaration=True, pretty_print=True) return True + + def _get_openlp_core(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 + + openlp_core = property(_get_openlp_core) diff --git a/openlp/plugins/songs/songsplugin.py b/openlp/plugins/songs/songsplugin.py index 4f57d3e21..8818746b7 100644 --- a/openlp/plugins/songs/songsplugin.py +++ b/openlp/plugins/songs/songsplugin.py @@ -38,7 +38,7 @@ import sqlite3 from PyQt4 import QtCore, QtGui -from openlp.core.lib import Plugin, StringContent, build_icon, translate, Receiver, UiStrings +from openlp.core.lib import Plugin, StringContent, build_icon, translate, UiStrings from openlp.core.lib.db import Manager from openlp.core.lib.ui import create_action from openlp.core.utils import get_filesystem_encoding @@ -96,9 +96,6 @@ class SongsPlugin(Plugin): action_list.add_action(self.songImportItem, UiStrings().Import) action_list.add_action(self.songExportItem, UiStrings().Export) action_list.add_action(self.toolsReindexItem, UiStrings().Tools) - QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'servicemanager_new_service'), - self.clearTemporarySongs) - def addImportMenuItem(self, import_menu): """ @@ -244,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. """ - Receiver.send_message(u'openlp_process_events') + self.openlp_core.process_events() self.onToolsReindexItemTriggered() - Receiver.send_message(u'openlp_process_events') + self.openlp_core.process_events() db_dir = unicode(os.path.join(unicode(gettempdir(), get_filesystem_encoding()), u'openlp')) if not os.path.exists(db_dir): return @@ -254,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'): - Receiver.send_message(u'openlp_process_events') + self.openlp_core.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 - Receiver.send_message(u'openlp_process_events') + self.openlp_core.process_events() progress = QtGui.QProgressDialog(self.main_window) progress.setWindowModality(QtCore.Qt.WindowModal) progress.setWindowTitle(translate('OpenLP.Ui', 'Importing Songs')) @@ -268,11 +265,11 @@ class SongsPlugin(Plugin): progress.setRange(0, song_count) progress.setMinimumDuration(0) progress.forceShow() - Receiver.send_message(u'openlp_process_events') + self.openlp_core.process_events() for db in song_dbs: importer = OpenLPSongImport(self.manager, filename=db) importer.doImport(progress) - Receiver.send_message(u'openlp_process_events') + self.openlp_core.process_events() progress.setValue(song_count) self.mediaItem.onSearchTextButtonClicked() @@ -281,7 +278,7 @@ class SongsPlugin(Plugin): Time to tidy up on exit """ log.info(u'Songs Finalising') - self.clearTemporarySongs() + self.new_service_created() # Clean up files and connections self.manager.finalise() self.songImportItem.setVisible(False) @@ -293,13 +290,18 @@ class SongsPlugin(Plugin): action_list.remove_action(self.toolsReindexItem, UiStrings().Tools) Plugin.finalise(self) - def clearTemporarySongs(self): - # Remove temporary songs + def new_service_created(self): + """ + Remove temporary songs from the database + """ songs = self.manager.get_all_objects(Song, Song.temporary == True) for song in songs: self.manager.delete_object(Song, song.id) def _countSongs(self, db_file): + """ + Provide a count of the songs in the database + """ connection = sqlite3.connect(db_file) cursor = connection.cursor() cursor.execute(u'SELECT COUNT(id) AS song_count FROM songs') From 123f460f7ee7d7062da4255d92bcf5b61af8025c Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sun, 3 Feb 2013 15:06:17 +0000 Subject: [PATCH 06/26] Fix up Receiver code changes --- openlp/core/__init__.py | 23 +++------ openlp/core/ui/maindisplay.py | 2 +- openlp/core/ui/mainwindow.py | 49 ++++++++++--------- openlp/core/ui/servicemanager.py | 9 ++-- openlp/plugins/bibles/lib/http.py | 4 +- openlp/plugins/images/lib/mediaitem.py | 2 +- openlp/plugins/presentations/lib/mediaitem.py | 2 +- 7 files changed, 41 insertions(+), 50 deletions(-) diff --git a/openlp/core/__init__.py b/openlp/core/__init__.py index 211a02fef..d9f99ad7c 100644 --- a/openlp/core/__init__.py +++ b/openlp/core/__init__.py @@ -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,10 +150,8 @@ 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: - return self.exec_() + 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() @@ -294,10 +291,8 @@ def main(args=None): 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() + if app.isAlreadyRunning(): + sys.exit() # First time checks in settings if not Settings().value(u'general/has run wizard'): if not FirstTimeLanguageForm().exec_(): @@ -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)) + sys.exit(app.run(qt_args)) diff --git a/openlp/core/ui/maindisplay.py b/openlp/core/ui/maindisplay.py index a8e22db22..b33e96fe4 100644 --- a/openlp/core/ui/maindisplay.py +++ b/openlp/core/ui/maindisplay.py @@ -486,7 +486,7 @@ class MainDisplay(Display): return self._image_manager image_manager = property(_get_image_manager) - + def _get_openlp_core(self): """ Adds the openlp to the class dynamically diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index 564542db7..a0da951fa 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -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): """ diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index eb354a9c5..edf1cd902 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -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`` diff --git a/openlp/plugins/bibles/lib/http.py b/openlp/plugins/bibles/lib/http.py index 522dd08c3..f26b74b14 100644 --- a/openlp/plugins/bibles/lib/http.py +++ b/openlp/plugins/bibles/lib/http.py @@ -611,7 +611,7 @@ class HTTPBible(BibleDB): 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.set_normal_cursor() self.openlp_core.process_events() return BibleDB.get_verses(self, reference_list, show_error) @@ -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): diff --git a/openlp/plugins/images/lib/mediaitem.py b/openlp/plugins/images/lib/mediaitem.py index 7af23b0ec..bc93bf80f 100644 --- a/openlp/plugins/images/lib/mediaitem.py +++ b/openlp/plugins/images/lib/mediaitem.py @@ -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): diff --git a/openlp/plugins/presentations/lib/mediaitem.py b/openlp/plugins/presentations/lib/mediaitem.py index ab7659a2b..df772ce5b 100644 --- a/openlp/plugins/presentations/lib/mediaitem.py +++ b/openlp/plugins/presentations/lib/mediaitem.py @@ -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): """ From 084da9c1bd5b27d29fbdfcb1483eff18ca611855 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sun, 3 Feb 2013 16:44:03 +0000 Subject: [PATCH 07/26] Minor fixes --- openlp/core/__init__.py | 4 ++-- openlp/core/ui/media/mediaplayer.py | 6 +----- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/openlp/core/__init__.py b/openlp/core/__init__.py index a750feb1f..18c5c6648 100644 --- a/openlp/core/__init__.py +++ b/openlp/core/__init__.py @@ -305,7 +305,7 @@ def main(args=None): Registry().register(u'openlp_core', app) app.setApplicationVersion(get_application_version()[u'version']) # Instance check - if app.isAlreadyRunning(): + if app.is_already_running(): sys.exit() # First time checks in settings if not Settings().value(u'general/has run wizard'): @@ -322,6 +322,6 @@ def main(args=None): else: log.debug(u'Could not find default_translator.') if not options.no_error_form: - sys.excepthook = app.hookException + sys.excepthook = app.hook_exception sys.exit(app.run(qt_args)) diff --git a/openlp/core/ui/media/mediaplayer.py b/openlp/core/ui/media/mediaplayer.py index 08909c013..61550acfc 100644 --- a/openlp/core/ui/media/mediaplayer.py +++ b/openlp/core/ui/media/mediaplayer.py @@ -26,14 +26,10 @@ # with this program; if not, write to the Free Software Foundation, Inc., 59 # # Temple Place, Suite 330, Boston, MA 02111-1307 USA # ############################################################################### -<<<<<<< TREE - -from openlp.core.lib import Registry -======= """ The :mod:`~openlp.core.ui.media.mediaplayer` module contains the MediaPlayer class. """ ->>>>>>> MERGE-SOURCE +from openlp.core.lib import Registry from openlp.core.ui.media import MediaState From ad438ba4b2056a96e5d6c078e0385868e45cd1c5 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sun, 3 Feb 2013 16:56:19 +0000 Subject: [PATCH 08/26] Remove rogue print --- openlp/core/ui/mainwindow.py | 1 - 1 file changed, 1 deletion(-) diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index 9fe81b01f..9a5429d9d 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -1363,7 +1363,6 @@ 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: - 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'), From 28aeed815fc3d9974d50b047040fbde5848ce46a Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sun, 3 Feb 2013 17:42:31 +0000 Subject: [PATCH 09/26] Minor fixes --- openlp/core/__init__.py | 42 +++++++++++++++++------------- openlp/core/lib/eventreceiver.py | 3 --- openlp/core/ui/mainwindow.py | 11 ++++---- openlp/core/ui/shortcutlistform.py | 14 ++++++++-- openlp/core/ui/splashscreen.py | 1 - 5 files changed, 41 insertions(+), 30 deletions(-) diff --git a/openlp/core/__init__.py b/openlp/core/__init__.py index 18c5c6648..fb35803d1 100644 --- a/openlp/core/__init__.py +++ b/openlp/core/__init__.py @@ -154,6 +154,12 @@ class OpenLP(QtGui.QApplication): self.main_window.app_startup() return self.exec_() + def close_splash_screen(self): + """ + Close the splash screen when requested. + """ + self.splash.close() + def is_already_running(self): """ Look to see if OpenLP is already running and ask if a 2nd copy @@ -276,36 +282,36 @@ def main(args=None): # Initialise the resources qInitResources() # Now create and actually run the application. - app = OpenLP(qt_args) - app.setOrganizationName(u'OpenLP') - app.setOrganizationDomain(u'openlp.org') + application = OpenLP(qt_args) + application.setOrganizationName(u'OpenLP') + application.setOrganizationDomain(u'openlp.org') if options.portable: - app.setApplicationName(u'OpenLPPortable') + application.setApplicationName(u'OpenLPPortable') Settings.setDefaultFormat(Settings.IniFormat) # Get location OpenLPPortable.ini - app_path = AppLocation.get_directory(AppLocation.AppDir) - set_up_logging(os.path.abspath(os.path.join(app_path, u'..', u'..', u'Other'))) + application_path = AppLocation.get_directory(AppLocation.AppDir) + set_up_logging(os.path.abspath(os.path.join(application_path, u'..', u'..', u'Other'))) 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 log.info(u'INI file: %s', portable_settings_file) Settings.set_filename(portable_settings_file) portable_settings = Settings() # 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) # Point to our data path portable_settings.setValue(u'advanced/data path', data_path) portable_settings.setValue(u'advanced/is portable', True) portable_settings.sync() else: - app.setApplicationName(u'OpenLP') + application.setApplicationName(u'OpenLP') set_up_logging(AppLocation.get_directory(AppLocation.CacheDir)) Registry.create() - Registry().register(u'openlp_core', app) - app.setApplicationVersion(get_application_version()[u'version']) + Registry().register(u'openlp_core', application) + application.setApplicationVersion(get_application_version()[u'version']) # Instance check - if app.is_already_running(): + if application.is_already_running(): sys.exit() # First time checks in settings if not Settings().value(u'general/has run wizard'): @@ -314,14 +320,14 @@ def main(args=None): sys.exit() # i18n Set Language language = LanguageManager.get_language() - app_translator, default_translator = LanguageManager.get_translator(language) - if not app_translator.isEmpty(): - app.installTranslator(app_translator) + application_translator, default_translator = LanguageManager.get_translator(language) + if not application_translator.isEmpty(): + application.installTranslator(application_translator) if not default_translator.isEmpty(): - app.installTranslator(default_translator) + application.installTranslator(default_translator) else: log.debug(u'Could not find default_translator.') if not options.no_error_form: - sys.excepthook = app.hook_exception - sys.exit(app.run(qt_args)) + sys.excepthook = application.hook_exception + sys.exit(application.run(qt_args)) diff --git a/openlp/core/lib/eventreceiver.py b/openlp/core/lib/eventreceiver.py index a1b123530..df24694b0 100644 --- a/openlp/core/lib/eventreceiver.py +++ b/openlp/core/lib/eventreceiver.py @@ -47,9 +47,6 @@ class EventReceiver(QtCore.QObject): ``mainwindow_status_text`` Changes the bottom status bar text on the mainwindow. - ``openlp_warning_message`` - Displays a standalone Warning Message. - ``openlp_error_message`` Displays a standalone Error Message. diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index 9a5429d9d..f8bd6b6ed 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -541,7 +541,6 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): self.openlp_core.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_warning_message'), self.onWarningMessage) QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'openlp_information_message'), self.onInformationMessage) QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'set_new_data_path'), self.setNewDataPath) @@ -724,21 +723,21 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): """ Display an error message """ - Receiver.send_message(u'close_splash') + self.openlp_core.close_splash_screen() QtGui.QMessageBox.critical(self, data[u'title'], data[u'message']) - def onWarningMessage(self, data): + def warning_message(self, message): """ Display a warning message """ - Receiver.send_message(u'close_splash') - QtGui.QMessageBox.warning(self, data[u'title'], data[u'message']) + self.openlp_core.close_splash_screen() + QtGui.QMessageBox.warning(self, message[u'title'], message[u'message']) def onInformationMessage(self, data): """ Display an informational message """ - Receiver.send_message(u'close_splash') + self.openlp_core.close_splash_screen() QtGui.QMessageBox.information(self, data[u'title'], data[u'message']) def onHelpWebSiteClicked(self): diff --git a/openlp/core/ui/shortcutlistform.py b/openlp/core/ui/shortcutlistform.py index ff07c6242..b628156b8 100644 --- a/openlp/core/ui/shortcutlistform.py +++ b/openlp/core/ui/shortcutlistform.py @@ -33,7 +33,7 @@ import re 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.actions import ActionList 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]: is_valid = False if not is_valid: - Receiver.send_message(u'openlp_warning_message', { + self.main_window.warning_message( { u'title': translate('OpenLP.ShortcutListDialog', 'Duplicate Shortcut'), u'message': translate('OpenLP.ShortcutListDialog', 'The shortcut "%s" is already assigned to another action, ' @@ -478,3 +478,13 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog): button.setChecked(checked) if enabled is not None: 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) \ No newline at end of file diff --git a/openlp/core/ui/splashscreen.py b/openlp/core/ui/splashscreen.py index 39ac8e8d9..d2b41d067 100644 --- a/openlp/core/ui/splashscreen.py +++ b/openlp/core/ui/splashscreen.py @@ -44,7 +44,6 @@ class SplashScreen(QtGui.QSplashScreen): """ QtGui.QSplashScreen.__init__(self) self.setupUi() - QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'close_splash'), self.close) def setupUi(self): """ From a9a4c7938ef509c41280bdc9e30a36f6be6902cd Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sun, 3 Feb 2013 19:23:12 +0000 Subject: [PATCH 10/26] Fix name and other bugs --- openlp/core/__init__.py | 4 +- openlp/core/lib/mediamanageritem.py | 14 ++--- openlp/core/lib/plugin.py | 10 ++-- openlp/core/ui/firsttimeform.py | 48 ++++++++--------- openlp/core/ui/maindisplay.py | 18 +++---- openlp/core/ui/mainwindow.py | 53 +++++++++---------- openlp/core/ui/media/mediaplayer.py | 10 ++-- openlp/core/ui/media/phononplayer.py | 2 +- openlp/core/ui/media/vlcplayer.py | 2 +- openlp/core/ui/pluginform.py | 14 ++--- openlp/core/ui/printserviceform.py | 2 +- openlp/core/ui/servicemanager.py | 38 ++++++------- openlp/core/ui/thememanager.py | 22 ++++---- openlp/core/ui/wizard.py | 14 ++--- openlp/core/utils/__init__.py | 2 +- .../plugins/bibles/forms/bibleimportform.py | 2 +- .../plugins/bibles/forms/bibleupgradeform.py | 6 +-- openlp/plugins/bibles/forms/editbibleform.py | 14 ++--- openlp/plugins/bibles/lib/csvbible.py | 4 +- openlp/plugins/bibles/lib/db.py | 10 ++-- openlp/plugins/bibles/lib/http.py | 44 +++++++-------- openlp/plugins/bibles/lib/mediaitem.py | 12 ++--- openlp/plugins/bibles/lib/openlp1.py | 2 +- openlp/plugins/bibles/lib/opensong.py | 2 +- openlp/plugins/bibles/lib/osis.py | 2 +- openlp/plugins/images/lib/mediaitem.py | 8 +-- openlp/plugins/presentations/lib/mediaitem.py | 8 +-- openlp/plugins/songs/forms/songexportform.py | 6 +-- openlp/plugins/songs/forms/songimportform.py | 2 +- .../songs/forms/songmaintenanceform.py | 14 ++--- openlp/plugins/songs/lib/mediaitem.py | 4 +- openlp/plugins/songs/lib/openlyricsexport.py | 12 ++--- openlp/plugins/songs/songsplugin.py | 12 ++--- 33 files changed, 208 insertions(+), 209 deletions(-) diff --git a/openlp/core/__init__.py b/openlp/core/__init__.py index fb35803d1..33eb916be 100644 --- a/openlp/core/__init__.py +++ b/openlp/core/__init__.py @@ -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(): diff --git a/openlp/core/lib/mediamanageritem.py b/openlp/core/lib/mediamanageritem.py index b235efe06..bb8ee2f70 100644 --- a/openlp/core/lib/mediamanageritem.py +++ b/openlp/core/lib/mediamanageritem.py @@ -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) diff --git a/openlp/core/lib/plugin.py b/openlp/core/lib/plugin.py index 195759e94..bad7defb8 100644 --- a/openlp/core/lib/plugin.py +++ b/openlp/core/lib/plugin.py @@ -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) diff --git a/openlp/core/ui/firsttimeform.py b/openlp/core/ui/firsttimeform.py index 5f7608f55..29e2cd97a 100644 --- a/openlp/core/ui/firsttimeform.py +++ b/openlp/core/ui/firsttimeform.py @@ -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) diff --git a/openlp/core/ui/maindisplay.py b/openlp/core/ui/maindisplay.py index 9ec3e8265..9cae5dfac 100644 --- a/openlp/core/ui/maindisplay.py +++ b/openlp/core/ui/maindisplay.py @@ -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): diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index f8bd6b6ed..e1cba9762 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -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) diff --git a/openlp/core/ui/media/mediaplayer.py b/openlp/core/ui/media/mediaplayer.py index 61550acfc..df9254706 100644 --- a/openlp/core/ui/media/mediaplayer.py +++ b/openlp/core/ui/media/mediaplayer.py @@ -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) \ No newline at end of file + application = property(_get_application) \ No newline at end of file diff --git a/openlp/core/ui/media/phononplayer.py b/openlp/core/ui/media/phononplayer.py index 9b218bbc8..ede7b2169 100644 --- a/openlp/core/ui/media/phononplayer.py +++ b/openlp/core/ui/media/phononplayer.py @@ -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 diff --git a/openlp/core/ui/media/vlcplayer.py b/openlp/core/ui/media/vlcplayer.py index 05cc734fa..948577aac 100644 --- a/openlp/core/ui/media/vlcplayer.py +++ b/openlp/core/ui/media/vlcplayer.py @@ -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 diff --git a/openlp/core/ui/pluginform.py b/openlp/core/ui/pluginform.py index 1cbf91824..c371bc689 100644 --- a/openlp/core/ui/pluginform.py +++ b/openlp/core/ui/pluginform.py @@ -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) diff --git a/openlp/core/ui/printserviceform.py b/openlp/core/ui/printserviceform.py index 101ee9acb..689323cd5 100644 --- a/openlp/core/ui/printserviceform.py +++ b/openlp/core/ui/printserviceform.py @@ -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(): diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index 5c16ae8af..b45794556 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -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) diff --git a/openlp/core/ui/thememanager.py b/openlp/core/ui/thememanager.py index 78765fc1a..a482a3c44 100644 --- a/openlp/core/ui/thememanager.py +++ b/openlp/core/ui/thememanager.py @@ -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) \ No newline at end of file + application = property(_get_application) \ No newline at end of file diff --git a/openlp/core/ui/wizard.py b/openlp/core/ui/wizard.py index cc7f16a8d..46ef55fd1 100644 --- a/openlp/core/ui/wizard.py +++ b/openlp/core/ui/wizard.py @@ -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) \ No newline at end of file + application = property(_get_application) \ No newline at end of file diff --git a/openlp/core/utils/__init__.py b/openlp/core/utils/__init__.py index daa858219..f1c05e668 100644 --- a/openlp/core/utils/__init__.py +++ b/openlp/core/utils/__init__.py @@ -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 diff --git a/openlp/plugins/bibles/forms/bibleimportform.py b/openlp/plugins/bibles/forms/bibleimportform.py index 93ee35154..10d50a9af 100644 --- a/openlp/plugins/bibles/forms/bibleimportform.py +++ b/openlp/plugins/bibles/forms/bibleimportform.py @@ -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): """ diff --git a/openlp/plugins/bibles/forms/bibleupgradeform.py b/openlp/plugins/bibles/forms/bibleupgradeform.py index d46af6e36..10589cbee 100644 --- a/openlp/plugins/bibles/forms/bibleupgradeform.py +++ b/openlp/plugins/bibles/forms/bibleupgradeform.py @@ -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', diff --git a/openlp/plugins/bibles/forms/editbibleform.py b/openlp/plugins/bibles/forms/editbibleform.py index 52093dffc..a6e9e6d6b 100644 --- a/openlp/plugins/bibles/forms/editbibleform.py +++ b/openlp/plugins/bibles/forms/editbibleform.py @@ -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) diff --git a/openlp/plugins/bibles/lib/csvbible.py b/openlp/plugins/bibles/lib/csvbible.py index 20c92ffd6..492702fe7 100644 --- a/openlp/plugins/bibles/lib/csvbible.py +++ b/openlp/plugins/bibles/lib/csvbible.py @@ -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') diff --git a/openlp/plugins/bibles/lib/db.py b/openlp/plugins/bibles/lib/db.py index 5b492d10e..c728aee6a 100644 --- a/openlp/plugins/bibles/lib/db.py +++ b/openlp/plugins/bibles/lib/db.py @@ -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): diff --git a/openlp/plugins/bibles/lib/http.py b/openlp/plugins/bibles/lib/http.py index f26b74b14..799c11129 100644 --- a/openlp/plugins/bibles/lib/http.py +++ b/openlp/plugins/bibles/lib/http.py @@ -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'', 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): diff --git a/openlp/plugins/bibles/lib/mediaitem.py b/openlp/plugins/bibles/lib/mediaitem.py index 89689d841..13d770909 100644 --- a/openlp/plugins/bibles/lib/mediaitem.py +++ b/openlp/plugins/bibles/lib/mediaitem.py @@ -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''): """ diff --git a/openlp/plugins/bibles/lib/openlp1.py b/openlp/plugins/bibles/lib/openlp1.py index ab049625d..0088c80bd 100644 --- a/openlp/plugins/bibles/lib/openlp1.py +++ b/openlp/plugins/bibles/lib/openlp1.py @@ -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 diff --git a/openlp/plugins/bibles/lib/opensong.py b/openlp/plugins/bibles/lib/opensong.py index 00d7c1318..5c8d7803c 100644 --- a/openlp/plugins/bibles/lib/opensong.py +++ b/openlp/plugins/bibles/lib/opensong.py @@ -129,7 +129,7 @@ class OpenSongBible(BibleDB): self.wizard.incrementProgressBar(translate('BiblesPlugin.Opensong', 'Importing %s %s...', 'Importing ...')) % (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 ' diff --git a/openlp/plugins/bibles/lib/osis.py b/openlp/plugins/bibles/lib/osis.py index 5996448ad..fe095ab02 100644 --- a/openlp/plugins/bibles/lib/osis.py +++ b/openlp/plugins/bibles/lib/osis.py @@ -182,7 +182,7 @@ class OSISBible(BibleDB): .replace(u'', u'').replace(u'', 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 diff --git a/openlp/plugins/images/lib/mediaitem.py b/openlp/plugins/images/lib/mediaitem.py index bc93bf80f..64ba220c0 100644 --- a/openlp/plugins/images/lib/mediaitem.py +++ b/openlp/plugins/images/lib/mediaitem.py @@ -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): diff --git a/openlp/plugins/presentations/lib/mediaitem.py b/openlp/plugins/presentations/lib/mediaitem.py index df772ce5b..ad48a4d8c 100644 --- a/openlp/plugins/presentations/lib/mediaitem.py +++ b/openlp/plugins/presentations/lib/mediaitem.py @@ -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()) diff --git a/openlp/plugins/songs/forms/songexportform.py b/openlp/plugins/songs/forms/songexportform.py index d0444913e..2a1564f8b 100644 --- a/openlp/plugins/songs/forms/songexportform.py +++ b/openlp/plugins/songs/forms/songexportform.py @@ -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): """ diff --git a/openlp/plugins/songs/forms/songimportform.py b/openlp/plugins/songs/forms/songimportform.py index e6f86de16..9a842f401 100644 --- a/openlp/plugins/songs/forms/songimportform.py +++ b/openlp/plugins/songs/forms/songimportform.py @@ -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): """ diff --git a/openlp/plugins/songs/forms/songmaintenanceform.py b/openlp/plugins/songs/forms/songmaintenanceform.py index e0fc0c6d0..9d0c0c306 100644 --- a/openlp/plugins/songs/forms/songmaintenanceform.py +++ b/openlp/plugins/songs/forms/songmaintenanceform.py @@ -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) \ No newline at end of file + application = property(_get_application) \ No newline at end of file diff --git a/openlp/plugins/songs/lib/mediaitem.py b/openlp/plugins/songs/lib/mediaitem.py index a8af9f407..883865bb8 100644 --- a/openlp/plugins/songs/lib/mediaitem.py +++ b/openlp/plugins/songs/lib/mediaitem.py @@ -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): diff --git a/openlp/plugins/songs/lib/openlyricsexport.py b/openlp/plugins/songs/lib/openlyricsexport.py index 9c1ee3513..b1698418a 100644 --- a/openlp/plugins/songs/lib/openlyricsexport.py +++ b/openlp/plugins/songs/lib/openlyricsexport.py @@ -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) diff --git a/openlp/plugins/songs/songsplugin.py b/openlp/plugins/songs/songsplugin.py index 31f38dbf4..937e5b374 100644 --- a/openlp/plugins/songs/songsplugin.py +++ b/openlp/plugins/songs/songsplugin.py @@ -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() From 17252dafd2f83ad3188a2458640f2b2dc29c0530 Mon Sep 17 00:00:00 2001 From: phill-ridout Date: Mon, 4 Feb 2013 17:47:02 +0000 Subject: [PATCH 11/26] fixes bug 1098075 trunk version --- openlp/plugins/songs/lib/__init__.py | 2 ++ openlp/plugins/songs/lib/ewimport.py | 5 ++++- openlp/plugins/songs/lib/songproimport.py | 5 ++++- openlp/plugins/songs/lib/sundayplusimport.py | 5 ++++- 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/openlp/plugins/songs/lib/__init__.py b/openlp/plugins/songs/lib/__init__.py index 39ecb0ae2..c7c24533b 100644 --- a/openlp/plugins/songs/lib/__init__.py +++ b/openlp/plugins/songs/lib/__init__.py @@ -571,6 +571,8 @@ def strip_rtf(text, default_encoding=None): while True: try: encoding, default_encoding = get_encoding(font, font_table, default_encoding, failed=failed) + if not encoding: + return None out.append(chr(charcode).decode(encoding)) except UnicodeDecodeError: failed = True diff --git a/openlp/plugins/songs/lib/ewimport.py b/openlp/plugins/songs/lib/ewimport.py index 3289c0e7f..86fba0562 100644 --- a/openlp/plugins/songs/lib/ewimport.py +++ b/openlp/plugins/songs/lib/ewimport.py @@ -174,7 +174,10 @@ class EasyWorshipSongImport(SongImport): self.addAuthor(author_name.strip()) if words: # 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] for verse in SLIDE_BREAK_REGEX.split(words): verse = verse.strip() diff --git a/openlp/plugins/songs/lib/songproimport.py b/openlp/plugins/songs/lib/songproimport.py index 7556454d8..0e6b5ee97 100644 --- a/openlp/plugins/songs/lib/songproimport.py +++ b/openlp/plugins/songs/lib/songproimport.py @@ -107,7 +107,10 @@ class SongProImport(SongImport): self.finish() return 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() if not text: return diff --git a/openlp/plugins/songs/lib/sundayplusimport.py b/openlp/plugins/songs/lib/sundayplusimport.py index 14bac8526..30a33c034 100644 --- a/openlp/plugins/songs/lib/sundayplusimport.py +++ b/openlp/plugins/songs/lib/sundayplusimport.py @@ -148,7 +148,10 @@ class SundayPlusImport(SongImport): verse_type = HOTKEY_TO_VERSE_TYPE[value] if name == 'rtf': 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') # If any line inside any verse contains CCLI or # only Public Domain, we treat this as special data: From 86912ec2c3560eaf12dfbc11c460bf2283e06e8f Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Mon, 4 Feb 2013 22:22:12 +0100 Subject: [PATCH 12/26] removed not needed imports; removed not needed script --- openlp/core/ui/splashscreen.py | 1 - openlp/plugins/alerts/alertsplugin.py | 2 +- openlp/plugins/alerts/lib/alertstab.py | 1 - openlp/plugins/bibles/bibleplugin.py | 2 +- openlp/plugins/bibles/lib/csvbible.py | 2 +- openlp/plugins/bibles/lib/http.py | 2 +- openlp/plugins/bibles/lib/openlp1.py | 1 - openlp/plugins/custom/forms/editcustomslidedialog.py | 2 +- openlp/plugins/media/lib/mediaitem.py | 2 +- openlp/plugins/media/lib/mediatab.py | 4 +--- openlp/plugins/presentations/lib/mediaitem.py | 2 +- openlp/plugins/presentations/lib/presentationtab.py | 2 +- openlp/plugins/songs/forms/editsongform.py | 2 +- openlp/plugins/songs/forms/editverseform.py | 3 +-- openlp/plugins/songs/lib/test/test_import_file.py | 2 +- openlp/plugins/songs/lib/test/test_importing_lots.py | 6 +----- scripts/translation_utils.py | 3 --- tests/interfaces/openlp_core_ui/test_starttimedialog.py | 1 - 18 files changed, 13 insertions(+), 27 deletions(-) diff --git a/openlp/core/ui/splashscreen.py b/openlp/core/ui/splashscreen.py index d2b41d067..c6f259499 100644 --- a/openlp/core/ui/splashscreen.py +++ b/openlp/core/ui/splashscreen.py @@ -29,7 +29,6 @@ """ The splash screen """ -from openlp.core.lib import Receiver from PyQt4 import QtCore, QtGui diff --git a/openlp/plugins/alerts/alertsplugin.py b/openlp/plugins/alerts/alertsplugin.py index 29727b79d..7366664ac 100644 --- a/openlp/plugins/alerts/alertsplugin.py +++ b/openlp/plugins/alerts/alertsplugin.py @@ -29,7 +29,7 @@ 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.db import Manager diff --git a/openlp/plugins/alerts/lib/alertstab.py b/openlp/plugins/alerts/lib/alertstab.py index 60451f20c..126c64766 100644 --- a/openlp/plugins/alerts/lib/alertstab.py +++ b/openlp/plugins/alerts/lib/alertstab.py @@ -30,7 +30,6 @@ from PyQt4 import QtCore, QtGui from openlp.core.lib import SettingsTab, translate, Receiver, Settings, UiStrings -from openlp.core.ui import AlertLocation from openlp.core.lib.ui import create_valign_selection_widgets class AlertsTab(SettingsTab): diff --git a/openlp/plugins/bibles/bibleplugin.py b/openlp/plugins/bibles/bibleplugin.py index 9a584dc63..bf5a056eb 100644 --- a/openlp/plugins/bibles/bibleplugin.py +++ b/openlp/plugins/bibles/bibleplugin.py @@ -31,7 +31,7 @@ import logging 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.utils.actions import ActionList from openlp.plugins.bibles.lib import BibleManager, BiblesTab, BibleMediaItem, LayoutStyle, DisplayStyle, \ diff --git a/openlp/plugins/bibles/lib/csvbible.py b/openlp/plugins/bibles/lib/csvbible.py index 492702fe7..bbf8bd937 100644 --- a/openlp/plugins/bibles/lib/csvbible.py +++ b/openlp/plugins/bibles/lib/csvbible.py @@ -62,7 +62,7 @@ import logging import chardet import csv -from openlp.core.lib import Receiver, translate +from openlp.core.lib import translate from openlp.plugins.bibles.lib.db import BibleDB, BiblesResourcesDB log = logging.getLogger(__name__) diff --git a/openlp/plugins/bibles/lib/http.py b/openlp/plugins/bibles/lib/http.py index 799c11129..8a7b6e03e 100644 --- a/openlp/plugins/bibles/lib/http.py +++ b/openlp/plugins/bibles/lib/http.py @@ -38,7 +38,7 @@ from HTMLParser import HTMLParseError from BeautifulSoup import BeautifulSoup, NavigableString, Tag -from openlp.core.lib import Receiver, Registry,translate +from openlp.core.lib import Registry,translate from openlp.core.lib.ui import critical_error_message_box from openlp.core.utils import get_web_page from openlp.plugins.bibles.lib import SearchResults diff --git a/openlp/plugins/bibles/lib/openlp1.py b/openlp/plugins/bibles/lib/openlp1.py index 0088c80bd..5100a732f 100644 --- a/openlp/plugins/bibles/lib/openlp1.py +++ b/openlp/plugins/bibles/lib/openlp1.py @@ -31,7 +31,6 @@ import logging import sqlite import sys -from openlp.core.lib import Receiver from openlp.core.ui.wizard import WizardStrings from openlp.plugins.bibles.lib.db import BibleDB, BiblesResourcesDB diff --git a/openlp/plugins/custom/forms/editcustomslidedialog.py b/openlp/plugins/custom/forms/editcustomslidedialog.py index ee47ba52b..5dfb79adc 100644 --- a/openlp/plugins/custom/forms/editcustomslidedialog.py +++ b/openlp/plugins/custom/forms/editcustomslidedialog.py @@ -29,7 +29,7 @@ from PyQt4 import QtGui -from openlp.core.lib import translate, SpellTextEdit, build_icon, UiStrings +from openlp.core.lib import translate, SpellTextEdit, UiStrings from openlp.core.lib.ui import create_button, create_button_box class Ui_CustomSlideEditDialog(object): diff --git a/openlp/plugins/media/lib/mediaitem.py b/openlp/plugins/media/lib/mediaitem.py index deca81f77..1645164ae 100644 --- a/openlp/plugins/media/lib/mediaitem.py +++ b/openlp/plugins/media/lib/mediaitem.py @@ -32,7 +32,7 @@ import os from PyQt4 import QtCore, QtGui -from openlp.core.lib import MediaManagerItem, build_icon, ItemCapabilities, SettingsManager, translate, \ +from openlp.core.lib import MediaManagerItem, build_icon, ItemCapabilities, translate, \ check_item_selected, Receiver, MediaType, ServiceItem, ServiceItemContext, Settings, UiStrings, \ check_directory_exists from openlp.core.lib.ui import critical_error_message_box, create_horizontal_adjusting_combo_box diff --git a/openlp/plugins/media/lib/mediatab.py b/openlp/plugins/media/lib/mediatab.py index 87a56f238..60796d823 100644 --- a/openlp/plugins/media/lib/mediatab.py +++ b/openlp/plugins/media/lib/mediatab.py @@ -27,11 +27,9 @@ # 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.ui import create_button -from openlp.core.ui.media import get_media_players, set_media_players class MediaQCheckBox(QtGui.QCheckBox): """ diff --git a/openlp/plugins/presentations/lib/mediaitem.py b/openlp/plugins/presentations/lib/mediaitem.py index ad48a4d8c..1eb463bdc 100644 --- a/openlp/plugins/presentations/lib/mediaitem.py +++ b/openlp/plugins/presentations/lib/mediaitem.py @@ -32,7 +32,7 @@ import os 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, build_icon, translate, check_item_selected, Receiver, \ ItemCapabilities, create_thumb, validate_thumb, ServiceItemContext, Settings, UiStrings from openlp.core.lib.ui import critical_error_message_box, create_horizontal_adjusting_combo_box from openlp.core.utils import locale_compare diff --git a/openlp/plugins/presentations/lib/presentationtab.py b/openlp/plugins/presentations/lib/presentationtab.py index c72676860..9e886e5fa 100644 --- a/openlp/plugins/presentations/lib/presentationtab.py +++ b/openlp/plugins/presentations/lib/presentationtab.py @@ -27,7 +27,7 @@ # 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 diff --git a/openlp/plugins/songs/forms/editsongform.py b/openlp/plugins/songs/forms/editsongform.py index 0c0e5c196..0693a3443 100644 --- a/openlp/plugins/songs/forms/editsongform.py +++ b/openlp/plugins/songs/forms/editsongform.py @@ -40,7 +40,7 @@ from PyQt4 import QtCore, QtGui from openlp.core.lib import PluginStatus, Receiver, MediaType, translate, create_separated_list, \ check_directory_exists, Registry, UiStrings -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 from openlp.core.utils import AppLocation from openlp.plugins.songs.forms import EditVerseForm, MediaFilesForm diff --git a/openlp/plugins/songs/forms/editverseform.py b/openlp/plugins/songs/forms/editverseform.py index d39f84de2..6e5c0127e 100644 --- a/openlp/plugins/songs/forms/editverseform.py +++ b/openlp/plugins/songs/forms/editverseform.py @@ -32,8 +32,7 @@ import logging from PyQt4 import QtCore, QtGui -from openlp.core.lib.ui import critical_error_message_box -from openlp.plugins.songs.lib import VerseType, translate +from openlp.plugins.songs.lib import VerseType from editversedialog import Ui_EditVerseDialog diff --git a/openlp/plugins/songs/lib/test/test_import_file.py b/openlp/plugins/songs/lib/test/test_import_file.py index 231ca1a21..06d1af38f 100644 --- a/openlp/plugins/songs/lib/test/test_import_file.py +++ b/openlp/plugins/songs/lib/test/test_import_file.py @@ -36,7 +36,7 @@ import logging LOG_FILENAME = 'test_import_file.log' 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): manager = Manager(u'songs', init_schema) diff --git a/openlp/plugins/songs/lib/test/test_importing_lots.py b/openlp/plugins/songs/lib/test/test_importing_lots.py index b0e0b34dc..f6bac243b 100644 --- a/openlp/plugins/songs/lib/test/test_importing_lots.py +++ b/openlp/plugins/songs/lib/test/test_importing_lots.py @@ -30,18 +30,14 @@ from openlp.plugins.songs.lib.opensongimport import OpenSongImport from openlp.plugins.songs.lib.db import init_schema from openlp.core.lib.db import Manager -from glob import glob -from zipfile import ZipFile import os -from traceback import print_exc -import sys import codecs import logging LOG_FILENAME = 'import.log' logging.basicConfig(filename=LOG_FILENAME,level=logging.INFO) -from test_opensongimport import wizard_stub, progbar_stub +from test_opensongimport import wizard_stub # Useful test function for importing a variety of different files # Uncomment below depending on what problem trying to make occur! diff --git a/scripts/translation_utils.py b/scripts/translation_utils.py index dc1d47189..e8ad6d64b 100755 --- a/scripts/translation_utils.py +++ b/scripts/translation_utils.py @@ -53,8 +53,6 @@ This is done easily via the ``-d``, ``-p`` and ``-u`` options:: """ import os import urllib2 -import re -from shutil import copy from getpass import getpass import base64 import json @@ -62,7 +60,6 @@ import webbrowser from optparse import OptionParser from PyQt4 import QtCore -from BeautifulSoup import BeautifulSoup SERVER_URL = u'http://www.transifex.net/api/2/project/openlp/' IGNORED_PATHS = [u'scripts'] diff --git a/tests/interfaces/openlp_core_ui/test_starttimedialog.py b/tests/interfaces/openlp_core_ui/test_starttimedialog.py index 918c6637c..990f753ba 100644 --- a/tests/interfaces/openlp_core_ui/test_starttimedialog.py +++ b/tests/interfaces/openlp_core_ui/test_starttimedialog.py @@ -1,7 +1,6 @@ """ Package to test the openlp.core.ui package. """ -import sys from unittest import TestCase from mock import MagicMock, patch From 3df730db09a0098b0d3194e06cad2b2e8ef0a2e4 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Mon, 4 Feb 2013 22:26:27 +0100 Subject: [PATCH 13/26] used += instead --- openlp/core/ui/exceptionform.py | 4 ++-- openlp/core/ui/firsttimeform.py | 2 +- openlp/core/ui/mainwindow.py | 2 +- openlp/plugins/bibles/lib/http.py | 6 +++--- openlp/plugins/bibles/lib/versereferencelist.py | 8 ++++---- .../presentations/lib/impresscontroller.py | 4 ++-- openlp/plugins/presentations/lib/mediaitem.py | 2 +- .../plugins/presentations/lib/messagelistener.py | 4 ++-- .../presentations/lib/pptviewlib/ppttest.py | 16 ++++++++-------- openlp/plugins/remotes/lib/remotetab.py | 2 +- openlp/plugins/songs/lib/easyslidesimport.py | 4 ++-- openlp/plugins/songs/lib/songshowplusimport.py | 2 +- 12 files changed, 28 insertions(+), 28 deletions(-) diff --git a/openlp/core/ui/exceptionform.py b/openlp/core/ui/exceptionform.py index 580e5ae71..2fc0be053 100644 --- a/openlp/core/ui/exceptionform.py +++ b/openlp/core/ui/exceptionform.py @@ -141,9 +141,9 @@ class ExceptionForm(QtGui.QDialog, Ui_ExceptionDialog): u'pyUNO bridge: %s\n' % UNO_VERSION if platform.system() == u'Linux': 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'): - system = system + u'Desktop: GNOME\n' + system += u'Desktop: GNOME\n' return (openlp_version, description, traceback, system, libraries) def onSaveReportButtonClicked(self): diff --git a/openlp/core/ui/firsttimeform.py b/openlp/core/ui/firsttimeform.py index 29e2cd97a..441d840fa 100644 --- a/openlp/core/ui/firsttimeform.py +++ b/openlp/core/ui/firsttimeform.py @@ -369,7 +369,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): self.max_progress += size if self.max_progress: # 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.setMinimum(0) self.progressBar.setMaximum(self.max_progress) diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index e1cba9762..532430fad 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -903,7 +903,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): return # Make sure it's a .conf file. 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(), get_filesystem_encoding()), u'openlp', u'exportConf.tmp') self.saveSettings() diff --git a/openlp/plugins/bibles/lib/http.py b/openlp/plugins/bibles/lib/http.py index 8a7b6e03e..affe7a2b6 100644 --- a/openlp/plugins/bibles/lib/http.py +++ b/openlp/plugins/bibles/lib/http.py @@ -419,18 +419,18 @@ class CWExtract(object): for part in verse.contents: self.application.process_events() if isinstance(part, NavigableString): - verse_text = verse_text + part + 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.application.process_events() if isinstance(subpart, NavigableString): - verse_text = verse_text + subpart + verse_text += subpart elif subpart and subpart.attrMap and subpart.attrMap[u'class'] == u'strongs': for subsub in subpart.contents: self.application.process_events() if isinstance(subsub, NavigableString): - verse_text = verse_text + subsub + verse_text += subsub self.application.process_events() # Fix up leading and trailing spaces, multiple spaces, and spaces # between text and , and . diff --git a/openlp/plugins/bibles/lib/versereferencelist.py b/openlp/plugins/bibles/lib/versereferencelist.py index 7b936fdc8..1cb76ffff 100644 --- a/openlp/plugins/bibles/lib/versereferencelist.py +++ b/openlp/plugins/bibles/lib/versereferencelist.py @@ -72,12 +72,12 @@ class VerseReferenceList(object): prev = index - 1 if self.verse_list[prev][u'version'] != verse[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']: result = u'%s%s %s:' % (result, verse[u'book'], verse[u'chapter']) elif self.verse_list[prev][u'chapter'] != 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']: result = u'%s-%s' % (result, verse[u'end']) if len(self.version_list) > 1: @@ -89,8 +89,8 @@ class VerseReferenceList(object): for index, version in enumerate(self.version_list): if index > 0: if result[-1] not in [u';', u',', u'.']: - result = result + u';' - result = result + u' ' + result += u';' + result += u' ' result = u'%s%s, %s' % (result, version[u'version'], version[u'copyright']) if version[u'permission'].strip(): result = result + u', ' + version[u'permission'] diff --git a/openlp/plugins/presentations/lib/impresscontroller.py b/openlp/plugins/presentations/lib/impresscontroller.py index c19653b78..5a8106f7d 100644 --- a/openlp/plugins/presentations/lib/impresscontroller.py +++ b/openlp/plugins/presentations/lib/impresscontroller.py @@ -189,7 +189,7 @@ class ImpressController(PresentationController): while list.hasMoreElements(): doc = list.nextElement() if doc.getImplementationName() != u'com.sun.star.comp.framework.BackingComp': - cnt = cnt + 1 + cnt += 1 if cnt > 0: log.debug(u'OpenOffice not terminated as docs are still open') else: @@ -399,7 +399,7 @@ class ImpressDocument(PresentationDocument): i = 1 while not self.control and i < 150: time.sleep(0.1) - i = i + 1 + i += 1 self.control = self.presentation.getController() else: self.control.activate() diff --git a/openlp/plugins/presentations/lib/mediaitem.py b/openlp/plugins/presentations/lib/mediaitem.py index 1eb463bdc..85a21781a 100644 --- a/openlp/plugins/presentations/lib/mediaitem.py +++ b/openlp/plugins/presentations/lib/mediaitem.py @@ -269,7 +269,7 @@ class PresentationMediaItem(MediaManagerItem): if img: while img: service_item.add_from_command(path, name, img) - i = i + 1 + i += 1 img = doc.get_thumbnail_path(i, True) doc.close_presentation() return True diff --git a/openlp/plugins/presentations/lib/messagelistener.py b/openlp/plugins/presentations/lib/messagelistener.py index 3063bfa7b..cde59209a 100644 --- a/openlp/plugins/presentations/lib/messagelistener.py +++ b/openlp/plugins/presentations/lib/messagelistener.py @@ -177,7 +177,7 @@ class Controller(object): if not self.doc.is_active(): return if self.doc.slidenumber < self.doc.get_slide_count(): - self.doc.slidenumber = self.doc.slidenumber + 1 + self.doc.slidenumber += 1 self.poll() return if not self.activate(): @@ -203,7 +203,7 @@ class Controller(object): if not self.doc.is_active(): return if self.doc.slidenumber > 1: - self.doc.slidenumber = self.doc.slidenumber - 1 + self.doc.slidenumber -= 1 self.poll() return if not self.activate(): diff --git a/openlp/plugins/presentations/lib/pptviewlib/ppttest.py b/openlp/plugins/presentations/lib/pptviewlib/ppttest.py index 5ec629840..c8573c807 100644 --- a/openlp/plugins/presentations/lib/pptviewlib/ppttest.py +++ b/openlp/plugins/presentations/lib/pptviewlib/ppttest.py @@ -71,35 +71,35 @@ class PPTViewer(QtGui.QWidget): row = 0 grid.addWidget(folder_label, 0, 0) grid.addWidget(self.folderEdit, 0, 1) - row = row + 1 + row += 1 grid.addWidget(x_label, row, 0) grid.addWidget(self.xEdit, row, 1) grid.addWidget(y_label, row, 2) grid.addWidget(self.yEdit, row, 3) - row = row + 1 + row += 1 grid.addWidget(width_label, row, 0) grid.addWidget(self.widthEdit, row, 1) grid.addWidget(height_label, row, 2) grid.addWidget(self.heightEdit, row, 3) - row = row + 1 + row += 1 grid.addWidget(ppt_label, row, 0) grid.addWidget(self.pptEdit, row, 1) grid.addWidget(ppt_dlg_btn, row, 2) grid.addWidget(ppt_btn, row, 3) - row = row + 1 + row += 1 grid.addWidget(slide_label, row, 0) grid.addWidget(self.slideEdit, row, 1) grid.addWidget(slide_btn, row, 2) - row = row + 1 + row += 1 grid.addWidget(prev, row, 0) grid.addWidget(next, row, 1) - row = row + 1 + row += 1 grid.addWidget(blank, row, 0) grid.addWidget(unblank, row, 1) - row = row + 1 + row += 1 grid.addWidget(restart, row, 0) grid.addWidget(close, row, 1) - row = row + 1 + row += 1 grid.addWidget(stop, row, 0) grid.addWidget(resume, row, 1) self.connect(ppt_btn, QtCore.SIGNAL(u'clicked()'), self.openClick) diff --git a/openlp/plugins/remotes/lib/remotetab.py b/openlp/plugins/remotes/lib/remotetab.py index 1d28355c4..c3ccd46c5 100644 --- a/openlp/plugins/remotes/lib/remotetab.py +++ b/openlp/plugins/remotes/lib/remotetab.py @@ -133,7 +133,7 @@ class RemoteTab(SettingsTab): ipAddress = self.addressEdit.text() url = u'http://%s:%s/' % (ipAddress, self.portSpinBox.value()) self.remoteUrl.setText(u'%s' % (url, url)) - url = url + u'stage' + url += u'stage' self.stageUrl.setText(u'%s' % (url, url)) def load(self): diff --git a/openlp/plugins/songs/lib/easyslidesimport.py b/openlp/plugins/songs/lib/easyslidesimport.py index 207628b9f..7f9143b70 100644 --- a/openlp/plugins/songs/lib/easyslidesimport.py +++ b/openlp/plugins/songs/lib/easyslidesimport.py @@ -162,7 +162,7 @@ class EasySlidesImport(SongImport): region = self._extractRegion(line) regionlines[region] = 1 + regionlines.get(region, 0) elif line[0] == u'[': - separatorlines = separatorlines + 1 + separatorlines += 1 # if the song has separators separators = (separatorlines > 0) # the number of different regions in song - 1 @@ -200,7 +200,7 @@ class EasySlidesImport(SongImport): # separators are used, so empty line means slide break # inside verse if self._listHas(verses, [reg, vt, vn, inst]): - inst = inst + 1 + inst += 1 else: # separators are not used, so empty line starts a new verse vt = u'V' diff --git a/openlp/plugins/songs/lib/songshowplusimport.py b/openlp/plugins/songs/lib/songshowplusimport.py index ae7e403f7..8677c82c2 100644 --- a/openlp/plugins/songs/lib/songshowplusimport.py +++ b/openlp/plugins/songs/lib/songshowplusimport.py @@ -203,7 +203,7 @@ class SongShowPlusImport(SongImport): if verse_name not in self.otherList: if ignore_unique: return None - self.otherCount = self.otherCount + 1 + self.otherCount += 1 self.otherList[verse_name] = str(self.otherCount) verse_tag = VerseType.Tags[VerseType.Other] verse_number = self.otherList[verse_name] From a72b4283bf9d72e3e8b9d9ba262e85f6dc87e3c2 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Mon, 4 Feb 2013 22:27:50 +0100 Subject: [PATCH 14/26] removed mutable as parameters --- openlp/core/lib/ui.py | 4 +++- openlp/plugins/remotes/lib/httpserver.py | 4 +++- openlp/plugins/songs/lib/sundayplusimport.py | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/openlp/core/lib/ui.py b/openlp/core/lib/ui.py index 0d869d724..c6860d7cd 100644 --- a/openlp/core/lib/ui.py +++ b/openlp/core/lib/ui.py @@ -67,7 +67,7 @@ def add_welcome_page(parent, image): 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 ``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. 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 if u'ok' in standard_buttons: buttons |= QtGui.QDialogButtonBox.Ok diff --git a/openlp/plugins/remotes/lib/httpserver.py b/openlp/plugins/remotes/lib/httpserver.py index af12cc9c4..d444fc1c4 100644 --- a/openlp/plugins/remotes/lib/httpserver.py +++ b/openlp/plugins/remotes/lib/httpserver.py @@ -138,7 +138,9 @@ class HttpResponse(object): '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 for key, value in headers.iteritems(): self.headers[key] = value diff --git a/openlp/plugins/songs/lib/sundayplusimport.py b/openlp/plugins/songs/lib/sundayplusimport.py index 14bac8526..bfa03b24e 100644 --- a/openlp/plugins/songs/lib/sundayplusimport.py +++ b/openlp/plugins/songs/lib/sundayplusimport.py @@ -121,7 +121,7 @@ class SundayPlusImport(SongImport): end = data.find(')', i) + 1 value = data[i:end] # If we are in the main group. - if cell == False: + if not cell: if name == 'title': self.title = self.decode(self.unescape(value)) elif name == 'Author': From 8f5fe64d3e442875e5ccc9f50a80838e49063f8f Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Mon, 4 Feb 2013 22:39:44 +0100 Subject: [PATCH 15/26] fixed short lines --- openlp/core/lib/db.py | 3 +- openlp/core/lib/screen.py | 6 ++-- openlp/plugins/bibles/lib/http.py | 46 ++++++++++--------------------- 3 files changed, 18 insertions(+), 37 deletions(-) diff --git a/openlp/core/lib/db.py b/openlp/core/lib/db.py index 5601fa530..398e8c29c 100644 --- a/openlp/core/lib/db.py +++ b/openlp/core/lib/db.py @@ -61,8 +61,7 @@ def init_db(url, auto_flush=True, auto_commit=False): """ engine = create_engine(url, poolclass=NullPool) metadata = MetaData(bind=engine) - session = scoped_session(sessionmaker(autoflush=auto_flush, - autocommit=auto_commit, bind=engine)) + session = scoped_session(sessionmaker(autoflush=auto_flush, autocommit=auto_commit, bind=engine)) return session, metadata diff --git a/openlp/core/lib/screen.py b/openlp/core/lib/screen.py index 9c118de99..c0272ff81 100644 --- a/openlp/core/lib/screen.py +++ b/openlp/core/lib/screen.py @@ -139,8 +139,7 @@ class ScreenList(object): """ screen_list = [] for screen in self.screen_list: - screen_name = u'%s %d' % (translate('OpenLP.ScreenList', 'Screen'), - screen[u'number'] + 1) + screen_name = u'%s %d' % (translate('OpenLP.ScreenList', 'Screen'), screen[u'number'] + 1) if screen[u'primary']: screen_name = u'%s (%s)' % (screen_name, translate('OpenLP.ScreenList', 'primary')) screen_list.append(screen_name) @@ -237,8 +236,7 @@ class ScreenList(object): y = window.y() + (window.height() / 2) for screen in self.screen_list: size = screen[u'size'] - if x >= size.x() and x <= (size.x() + size.width()) and \ - y >= size.y() and y <= (size.y() + size.height()): + if x >= size.x() and x <= (size.x() + size.width()) and y >= size.y() and y <= (size.y() + size.height()): return screen[u'number'] def load_screen_settings(self): diff --git a/openlp/plugins/bibles/lib/http.py b/openlp/plugins/bibles/lib/http.py index affe7a2b6..13906375d 100644 --- a/openlp/plugins/bibles/lib/http.py +++ b/openlp/plugins/bibles/lib/http.py @@ -203,8 +203,7 @@ class BGExtract(object): if clean_verse_num: verse_text = raw_verse_num.next part = raw_verse_num.next.next - while not (isinstance(part, Tag) and - part.get(u'class') == u'versenum'): + while not (isinstance(part, Tag) and part.get(u'class') == u'versenum'): # While we are still in the same verse grab all the text. if isinstance(part, NavigableString): verse_text += part @@ -320,12 +319,10 @@ class BSExtract(object): ``chapter`` Chapter number """ - log.debug(u'BSExtract.get_bible_chapter("%s", "%s", "%s")', version, - book_name, chapter) + log.debug(u'BSExtract.get_bible_chapter("%s", "%s", "%s")', version, book_name, chapter) url_version = urllib.quote(version.encode("utf-8")) url_book_name = urllib.quote(book_name.encode("utf-8")) - chapter_url = u'http://m.bibleserver.com/text/%s/%s%d' % \ - (url_version, url_book_name, chapter) + chapter_url = u'http://m.bibleserver.com/text/%s/%s%d' % (url_version, url_book_name, chapter) header = (u'Accept-Language', u'en') soup = get_soup_for_bible_ref(chapter_url, header) if not soup: @@ -355,8 +352,7 @@ class BSExtract(object): """ log.debug(u'BSExtract.get_books_from_http("%s")', version) urlversion = urllib.quote(version.encode("utf-8")) - chapter_url = u'http://m.bibleserver.com/overlay/selectBook?'\ - 'translation=%s' % (urlversion) + chapter_url = u'http://m.bibleserver.com/overlay/selectBook?translation=%s' % (urlversion) soup = get_soup_for_bible_ref(chapter_url) if not soup: return None @@ -366,9 +362,7 @@ class BSExtract(object): send_error_message(u'parse') return None content = content.findAll(u'li') - return [ - book.contents[0].contents[0] for book in content - ] + return [book.contents[0].contents[0] for book in content] class CWExtract(object): @@ -393,13 +387,11 @@ class CWExtract(object): ``chapter`` Chapter number """ - log.debug(u'CWExtract.get_bible_chapter("%s", "%s", "%s")', version, - book_name, chapter) + log.debug(u'CWExtract.get_bible_chapter("%s", "%s", "%s")', version, book_name, chapter) url_book_name = book_name.replace(u' ', u'-') url_book_name = url_book_name.lower() url_book_name = urllib.quote(url_book_name.encode("utf-8")) - chapter_url = u'http://www.biblestudytools.com/%s/%s/%s.html' % \ - (version, url_book_name, chapter) + chapter_url = u'http://www.biblestudytools.com/%s/%s/%s.html' % (version, url_book_name, chapter) soup = get_soup_for_bible_ref(chapter_url) if not soup: return None @@ -448,8 +440,7 @@ class CWExtract(object): The version of the bible like NIV for New International Version """ log.debug(u'CWExtract.get_books_from_http("%s")', version) - chapter_url = u'http://www.biblestudytools.com/%s/'\ - % (version) + chapter_url = u'http://www.biblestudytools.com/%s/' % (version) soup = get_soup_for_bible_ref(chapter_url) if not soup: return None @@ -503,9 +494,7 @@ class HTTPBible(BibleDB): ``True`` on success, ``False`` on failure. """ self.wizard.progressBar.setMaximum(68) - self.wizard.incrementProgressBar(translate( - 'BiblesPlugin.HTTPBible', - 'Registering Bible and loading books...')) + self.wizard.incrementProgressBar(translate('BiblesPlugin.HTTPBible', 'Registering Bible and loading books...')) self.save_meta(u'download_source', self.download_source) self.save_meta(u'download_name', self.download_name) if self.proxy_server: @@ -527,19 +516,16 @@ class HTTPBible(BibleDB): log.exception(u'Importing books from %s - download name: "%s" '\ 'failed' % (self.download_source, self.download_name)) return False - self.wizard.progressBar.setMaximum(len(books)+2) - self.wizard.incrementProgressBar(translate( - 'BiblesPlugin.HTTPBible', 'Registering Language...')) - bible = BiblesResourcesDB.get_webbible(self.download_name, - self.download_source.lower()) + self.wizard.progressBar.setMaximum(len(books) + 2) + self.wizard.incrementProgressBar(translate( 'BiblesPlugin.HTTPBible', 'Registering Language...')) + bible = BiblesResourcesDB.get_webbible(self.download_name, self.download_source.lower()) if bible[u'language_id']: language_id = bible[u'language_id'] self.save_meta(u'language_id', language_id) else: language_id = self.get_language(bible_name) if not language_id: - log.exception(u'Importing books from %s " '\ - 'failed' % self.filename) + log.exception(u'Importing books from %s failed' % self.filename) return False for book in books: if self.stop_import_flag: @@ -547,8 +533,7 @@ class HTTPBible(BibleDB): self.wizard.incrementProgressBar(translate( 'BiblesPlugin.HTTPBible', 'Importing %s...', 'Importing ...') % book) - book_ref_id = self.get_book_ref_id_by_name(book, len(books), - language_id) + book_ref_id = self.get_book_ref_id_by_name(book, len(books), language_id) if not book_ref_id: log.exception(u'Importing books from %s - download name: "%s" '\ 'failed' % (self.download_source, self.download_name)) @@ -608,8 +593,7 @@ class HTTPBible(BibleDB): 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.create_chapter(db_book.id, search_results.chapter, search_results.verselist) self.application.process_events() self.application.set_normal_cursor() self.application.process_events() From 8a36430659c255952205360124e2039c0cb31d62 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Mon, 4 Feb 2013 22:42:31 +0100 Subject: [PATCH 16/26] removed not needed script --- scripts/openlp-remoteclient.py | 70 ---------------------------------- 1 file changed, 70 deletions(-) delete mode 100644 scripts/openlp-remoteclient.py diff --git a/scripts/openlp-remoteclient.py b/scripts/openlp-remoteclient.py deleted file mode 100644 index d29ddd501..000000000 --- a/scripts/openlp-remoteclient.py +++ /dev/null @@ -1,70 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 - -############################################################################### -# OpenLP - Open Source Lyrics Projection # -# --------------------------------------------------------------------------- # -# Copyright (c) 2008-2013 Raoul Snyman # -# Portions copyright (c) 2008-2013 Tim Bentley, Gerald Britton, Jonathan # -# Corwin, Samuel Findlay, Michael Gorven, Scott Guerrieri, Matthias Hub, # -# Meinert Jordan, Armin Köhler, Erik Lundin, Edwin Lunando, Brian T. Meyer. # -# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, # -# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, # -# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, # -# Frode Woldsund, Martin Zibricky, Patrick Zimmermann # -# --------------------------------------------------------------------------- # -# This program is free software; you can redistribute it and/or modify it # -# under the terms of the GNU General Public License as published by the Free # -# Software Foundation; version 2 of the License. # -# # -# This program is distributed in the hope that it will be useful, but WITHOUT # -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for # -# more details. # -# # -# You should have received a copy of the GNU General Public License along # -# with this program; if not, write to the Free Software Foundation, Inc., 59 # -# Temple Place, Suite 330, Boston, MA 02111-1307 USA # -############################################################################### - -import urllib -import sys -from optparse import OptionParser - -def sendData(options): - addr = 'http://%s:%s/send/%s?q=%s' % (options.address, options.port, - options.event, options.message) - try: - urllib.urlopen(addr) - print u'Message sent ', addr - except: - print u'Error thrown ', sys.exc_info()[1] - -def main(): - usage = "usage: %prog [-a address] [-p port] [-e event] [-m message]" - parser = OptionParser(usage=usage) - parser.add_option("-p", "--port", default=4316, - help="IP Port number %default ") - parser.add_option("-a", "--address", - help="Recipient address ", - default="localhost") - parser.add_option("-e", "--event", - help="Action to be performed", - default="alerts_text") - parser.add_option("-m", "--message", - help="Message to be passed for the action", - default="") - - (options, args) = parser.parse_args() - if args: - parser.print_help() - parser.error("incorrect number of arguments") - elif options.address is None: - parser.print_help() - parser.error("IP address missing") - else: - sendData(options) - -if __name__ == u'__main__': - main() From 7cf10df7e88ce634c06be53ae414bb1025d4d68f Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Mon, 4 Feb 2013 23:05:19 +0100 Subject: [PATCH 17/26] converted print statements --- openlp/core/__init__.py | 2 +- scripts/translation_utils.py | 13 +++++-------- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/openlp/core/__init__.py b/openlp/core/__init__.py index 33eb916be..f6ce8bb06 100644 --- a/openlp/core/__init__.py +++ b/openlp/core/__init__.py @@ -242,7 +242,7 @@ def set_up_logging(log_path): logfile.setFormatter(logging.Formatter(u'%(asctime)s %(name)-55s %(levelname)-8s %(message)s')) log.addHandler(logfile) if log.isEnabledFor(logging.DEBUG): - print 'Logging to:', filename + print('Logging to: %s' % filename) def main(args=None): diff --git a/scripts/translation_utils.py b/scripts/translation_utils.py index e8ad6d64b..40000946d 100755 --- a/scripts/translation_utils.py +++ b/scripts/translation_utils.py @@ -159,7 +159,7 @@ def print_verbose(text): """ global verbose_mode, quiet_mode if not quiet_mode and verbose_mode: - print u' %s' % text + print(u' %s' % text) def run(command): """ @@ -266,8 +266,7 @@ def prepare_project(): def update_translations(): print_quiet(u'Update the translation files') if not os.path.exists(os.path.join(os.path.abspath(u'..'), u'openlp.pro')): - print u'You have not generated a project file yet, please run this ' + \ - u'script with the -p option.' + print(u'You have not generated a project file yet, please run this script with the -p option.') return else: os.chdir(os.path.abspath(u'..')) @@ -277,10 +276,8 @@ def update_translations(): def generate_binaries(): print_quiet(u'Generate the related *.qm files') if not os.path.exists(os.path.join(os.path.abspath(u'..'), u'openlp.pro')): - print u'You have not generated a project file yet, please run this ' + \ - u'script with the -p option. It is also recommended that you ' + \ - u'this script with the -u option to update the translation ' + \ - u'files as well.' + print(u'You have not generated a project file yet, please run this script with the -p option. It is also ' + + u'recommended that you this script with the -u option to update the translation files as well.') return else: os.chdir(os.path.abspath(u'..')) @@ -380,6 +377,6 @@ def main(): if __name__ == u'__main__': if os.path.split(os.path.abspath(u'.'))[1] != u'scripts': - print u'You need to run this script from the scripts directory.' + print(u'You need to run this script from the scripts directory.') else: main() From f94da5c22c5ae7e2be974adc62d01beb260aad6e Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Tue, 5 Feb 2013 07:47:03 +0100 Subject: [PATCH 18/26] fixed spaces --- openlp/plugins/alerts/alertsplugin.py | 2 +- openlp/plugins/bibles/lib/csvbible.py | 2 +- openlp/plugins/bibles/lib/http.py | 2 +- openlp/plugins/media/lib/mediatab.py | 2 +- openlp/plugins/presentations/lib/presentationtab.py | 2 +- openlp/plugins/songs/forms/editsongform.py | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/openlp/plugins/alerts/alertsplugin.py b/openlp/plugins/alerts/alertsplugin.py index 7366664ac..1c9203348 100644 --- a/openlp/plugins/alerts/alertsplugin.py +++ b/openlp/plugins/alerts/alertsplugin.py @@ -29,7 +29,7 @@ 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.db import Manager diff --git a/openlp/plugins/bibles/lib/csvbible.py b/openlp/plugins/bibles/lib/csvbible.py index bbf8bd937..4f491c5cc 100644 --- a/openlp/plugins/bibles/lib/csvbible.py +++ b/openlp/plugins/bibles/lib/csvbible.py @@ -62,7 +62,7 @@ import logging import chardet import csv -from openlp.core.lib import translate +from openlp.core.lib import translate from openlp.plugins.bibles.lib.db import BibleDB, BiblesResourcesDB log = logging.getLogger(__name__) diff --git a/openlp/plugins/bibles/lib/http.py b/openlp/plugins/bibles/lib/http.py index 13906375d..20ab70ade 100644 --- a/openlp/plugins/bibles/lib/http.py +++ b/openlp/plugins/bibles/lib/http.py @@ -38,7 +38,7 @@ from HTMLParser import HTMLParseError from BeautifulSoup import BeautifulSoup, NavigableString, Tag -from openlp.core.lib import Registry,translate +from openlp.core.lib import Registrytranslate from openlp.core.lib.ui import critical_error_message_box from openlp.core.utils import get_web_page from openlp.plugins.bibles.lib import SearchResults diff --git a/openlp/plugins/media/lib/mediatab.py b/openlp/plugins/media/lib/mediatab.py index 60796d823..d874686a6 100644 --- a/openlp/plugins/media/lib/mediatab.py +++ b/openlp/plugins/media/lib/mediatab.py @@ -27,7 +27,7 @@ # Temple Place, Suite 330, Boston, MA 02111-1307 USA # ############################################################################### -from PyQt4 import QtGui +from PyQt4 import QtGui from openlp.core.lib import Receiver, Settings, SettingsTab, translate, UiStrings diff --git a/openlp/plugins/presentations/lib/presentationtab.py b/openlp/plugins/presentations/lib/presentationtab.py index 9e886e5fa..06cd84568 100644 --- a/openlp/plugins/presentations/lib/presentationtab.py +++ b/openlp/plugins/presentations/lib/presentationtab.py @@ -27,7 +27,7 @@ # Temple Place, Suite 330, Boston, MA 02111-1307 USA # ############################################################################### -from PyQt4 import QtGui +from PyQt4 import QtGui from openlp.core.lib import Receiver, Settings, SettingsTab, translate, UiStrings diff --git a/openlp/plugins/songs/forms/editsongform.py b/openlp/plugins/songs/forms/editsongform.py index 0693a3443..f31b487e1 100644 --- a/openlp/plugins/songs/forms/editsongform.py +++ b/openlp/plugins/songs/forms/editsongform.py @@ -40,7 +40,7 @@ from PyQt4 import QtCore, QtGui from openlp.core.lib import PluginStatus, Receiver, MediaType, translate, create_separated_list, \ check_directory_exists, Registry, UiStrings -from openlp.core.lib.ui import 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 from openlp.core.utils import AppLocation from openlp.plugins.songs.forms import EditVerseForm, MediaFilesForm From 682460132c988f282bd4cd68cc2130430d1ef498 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Tue, 5 Feb 2013 07:54:55 +0100 Subject: [PATCH 19/26] search and replace does evil things --- openlp/plugins/bibles/lib/http.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlp/plugins/bibles/lib/http.py b/openlp/plugins/bibles/lib/http.py index 20ab70ade..17791cef3 100644 --- a/openlp/plugins/bibles/lib/http.py +++ b/openlp/plugins/bibles/lib/http.py @@ -38,7 +38,7 @@ from HTMLParser import HTMLParseError from BeautifulSoup import BeautifulSoup, NavigableString, Tag -from openlp.core.lib import Registrytranslate +from openlp.core.lib import Registry, translate from openlp.core.lib.ui import critical_error_message_box from openlp.core.utils import get_web_page from openlp.plugins.bibles.lib import SearchResults From f94ae4d7c248880fb26238780e72182b1ff7c22c Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Tue, 5 Feb 2013 09:05:28 +0100 Subject: [PATCH 20/26] reordered imports --- openlp/core/lib/dockwidget.py | 2 +- openlp/core/lib/formattingtags.py | 2 +- openlp/core/lib/imagemanager.py | 2 +- openlp/core/lib/renderer.py | 4 ++-- openlp/core/lib/serviceitem.py | 2 +- openlp/core/lib/ui.py | 2 +- openlp/core/ui/aboutdialog.py | 2 +- openlp/core/ui/advancedtab.py | 14 +++++++------- openlp/core/ui/exceptionform.py | 2 +- openlp/core/ui/firsttimeform.py | 4 ++-- openlp/core/ui/formattingtagdialog.py | 2 +- openlp/core/ui/formattingtagform.py | 2 +- openlp/core/ui/generaltab.py | 2 +- openlp/core/ui/maindisplay.py | 4 ++-- openlp/core/ui/mainwindow.py | 6 +++--- openlp/core/ui/media/mediacontroller.py | 4 ++-- openlp/core/ui/media/phononplayer.py | 2 +- openlp/core/ui/media/playertab.py | 2 +- openlp/core/ui/media/vlcplayer.py | 2 +- openlp/core/ui/media/webkitplayer.py | 2 +- openlp/core/ui/plugindialog.py | 2 +- openlp/core/ui/printservicedialog.py | 2 +- openlp/core/ui/printserviceform.py | 4 ++-- openlp/core/ui/servicemanager.py | 4 ++-- openlp/core/ui/servicenoteform.py | 4 ++-- openlp/core/ui/settingsform.py | 4 ++-- openlp/core/ui/slidecontroller.py | 6 +++--- openlp/core/ui/starttimedialog.py | 2 +- openlp/core/ui/starttimeform.py | 4 ++-- openlp/core/ui/themeform.py | 2 +- openlp/core/ui/thememanager.py | 8 ++++---- openlp/core/ui/themestab.py | 2 +- openlp/core/ui/themewizard.py | 2 +- openlp/core/ui/wizard.py | 4 ++-- openlp/core/utils/languagemanager.py | 2 +- openlp/plugins/alerts/alertsplugin.py | 2 +- openlp/plugins/alerts/lib/alertstab.py | 2 +- openlp/plugins/bibles/bibleplugin.py | 2 +- openlp/plugins/bibles/forms/bibleimportform.py | 2 +- openlp/plugins/bibles/forms/bibleupgradeform.py | 2 +- openlp/plugins/bibles/forms/editbibleform.py | 2 +- openlp/plugins/bibles/lib/__init__.py | 2 +- openlp/plugins/bibles/lib/biblestab.py | 2 +- openlp/plugins/bibles/lib/db.py | 4 ++-- openlp/plugins/bibles/lib/manager.py | 2 +- openlp/plugins/bibles/lib/mediaitem.py | 4 ++-- openlp/plugins/custom/forms/editcustomdialog.py | 2 +- .../plugins/custom/forms/editcustomslidedialog.py | 2 +- openlp/plugins/custom/lib/customtab.py | 2 +- openlp/plugins/custom/lib/mediaitem.py | 4 ++-- openlp/plugins/images/imageplugin.py | 2 +- openlp/plugins/images/lib/imagetab.py | 2 +- openlp/plugins/images/lib/mediaitem.py | 6 +++--- openlp/plugins/media/lib/mediaitem.py | 5 ++--- openlp/plugins/media/lib/mediatab.py | 2 +- openlp/plugins/media/mediaplugin.py | 2 +- openlp/plugins/presentations/lib/mediaitem.py | 4 ++-- .../presentations/lib/presentationcontroller.py | 2 +- .../plugins/presentations/lib/presentationtab.py | 2 +- openlp/plugins/remotes/lib/remotetab.py | 2 +- openlp/plugins/songs/forms/editsongdialog.py | 2 +- openlp/plugins/songs/forms/editsongform.py | 6 +++--- openlp/plugins/songs/forms/editversedialog.py | 4 ++-- openlp/plugins/songs/forms/songexportform.py | 2 +- openlp/plugins/songs/forms/songimportform.py | 2 +- .../plugins/songs/forms/songmaintenancedialog.py | 2 +- openlp/plugins/songs/forms/songmaintenanceform.py | 4 ++-- openlp/plugins/songs/lib/mediaitem.py | 4 ++-- openlp/plugins/songs/lib/xml.py | 2 +- openlp/plugins/songs/songsplugin.py | 2 +- .../plugins/songusage/forms/songusagedeleteform.py | 2 +- openlp/plugins/songusage/songusageplugin.py | 2 +- 72 files changed, 107 insertions(+), 108 deletions(-) diff --git a/openlp/core/lib/dockwidget.py b/openlp/core/lib/dockwidget.py index 743607dd6..c7fa0e6eb 100644 --- a/openlp/core/lib/dockwidget.py +++ b/openlp/core/lib/dockwidget.py @@ -35,7 +35,7 @@ import logging from PyQt4 import QtGui -from openlp.core.lib import build_icon, ScreenList +from openlp.core.lib import ScreenList, build_icon log = logging.getLogger(__name__) diff --git a/openlp/core/lib/formattingtags.py b/openlp/core/lib/formattingtags.py index abbc18f16..b7bbd7322 100644 --- a/openlp/core/lib/formattingtags.py +++ b/openlp/core/lib/formattingtags.py @@ -31,7 +31,7 @@ Provide HTML Tag management and Formatting Tag access class """ import cPickle -from openlp.core.lib import translate, Settings +from openlp.core.lib import Settings, translate class FormattingTags(object): diff --git a/openlp/core/lib/imagemanager.py b/openlp/core/lib/imagemanager.py index 9726079f7..7d738a664 100644 --- a/openlp/core/lib/imagemanager.py +++ b/openlp/core/lib/imagemanager.py @@ -39,7 +39,7 @@ import Queue 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__) diff --git a/openlp/core/lib/renderer.py b/openlp/core/lib/renderer.py index 7b7027efd..ca2a3b073 100644 --- a/openlp/core/lib/renderer.py +++ b/openlp/core/lib/renderer.py @@ -31,8 +31,8 @@ import logging from PyQt4 import QtGui, QtCore, QtWebKit -from openlp.core.lib import ServiceItem, expand_tags, build_lyrics_format_css, build_lyrics_outline_css, Receiver, \ - ItemCapabilities, FormattingTags, ImageSource, Registry, ScreenList +from openlp.core.lib import FormattingTags, ImageSource, ItemCapabilities, Receiver, Registry, ScreenList, \ + ServiceItem, expand_tags, build_lyrics_format_css, build_lyrics_outline_css from openlp.core.lib.theme import ThemeLevel from openlp.core.ui import MainDisplay diff --git a/openlp/core/lib/serviceitem.py b/openlp/core/lib/serviceitem.py index 743f6b00a..47c9852a8 100644 --- a/openlp/core/lib/serviceitem.py +++ b/openlp/core/lib/serviceitem.py @@ -39,7 +39,7 @@ import uuid 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__) diff --git a/openlp/core/lib/ui.py b/openlp/core/lib/ui.py index c6860d7cd..4f4aa0596 100644 --- a/openlp/core/lib/ui.py +++ b/openlp/core/lib/ui.py @@ -33,7 +33,7 @@ import logging 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 diff --git a/openlp/core/ui/aboutdialog.py b/openlp/core/ui/aboutdialog.py index cf04f4927..0115d8af2 100644 --- a/openlp/core/ui/aboutdialog.py +++ b/openlp/core/ui/aboutdialog.py @@ -29,7 +29,7 @@ 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 diff --git a/openlp/core/ui/advancedtab.py b/openlp/core/ui/advancedtab.py index 08a98d918..7cd89c252 100644 --- a/openlp/core/ui/advancedtab.py +++ b/openlp/core/ui/advancedtab.py @@ -37,7 +37,7 @@ import sys from PyQt4 import QtCore, QtGui 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 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'hide mouse', self.hide_mouse_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 image', self.default_file_edit.text()) settings.setValue(u'slide limits', self.slide_limits) @@ -666,7 +666,7 @@ class AdvancedTab(SettingsTab): The state of the check box (boolean). """ self.display_changed = True - + def on_alternate_rows_check_box_toggled(self, checked): """ Notify user about required restart. @@ -681,17 +681,17 @@ class AdvancedTab(SettingsTab): def on_end_slide_button_clicked(self): """ Stop at the end either top ot bottom - """ + """ self.slide_limits = SlideLimits.End def on_wrap_slide_button_clicked(self): """ - Wrap round the service item - """ + Wrap round the service item + """ self.slide_limits = SlideLimits.Wrap def on_next_item_button_clicked(self): """ Advance to the next service item - """ + """ self.slide_limits = SlideLimits.Next diff --git a/openlp/core/ui/exceptionform.py b/openlp/core/ui/exceptionform.py index 2fc0be053..0d8a7c74f 100644 --- a/openlp/core/ui/exceptionform.py +++ b/openlp/core/ui/exceptionform.py @@ -88,7 +88,7 @@ except AttributeError: 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 exceptiondialog import Ui_ExceptionDialog diff --git a/openlp/core/ui/firsttimeform.py b/openlp/core/ui/firsttimeform.py index 441d840fa..daedbb94e 100644 --- a/openlp/core/ui/firsttimeform.py +++ b/openlp/core/ui/firsttimeform.py @@ -41,8 +41,8 @@ from ConfigParser import SafeConfigParser from PyQt4 import QtCore, QtGui -from openlp.core.lib import translate, PluginStatus, Receiver, build_icon, check_directory_exists, Settings, Registry -from openlp.core.utils import get_web_page, AppLocation, get_filesystem_encoding +from openlp.core.lib import PluginStatus, Receiver, Settings, Registry, build_icon, check_directory_exists, translate +from openlp.core.utils import AppLocation, get_web_page, get_filesystem_encoding from firsttimewizard import Ui_FirstTimeWizard, FirstTimePage log = logging.getLogger(__name__) diff --git a/openlp/core/ui/formattingtagdialog.py b/openlp/core/ui/formattingtagdialog.py index fbf5707ed..8c72a9120 100644 --- a/openlp/core/ui/formattingtagdialog.py +++ b/openlp/core/ui/formattingtagdialog.py @@ -31,7 +31,7 @@ The UI widgets for the formatting tags window. """ 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 diff --git a/openlp/core/ui/formattingtagform.py b/openlp/core/ui/formattingtagform.py index 1085afbcd..b3611b1d7 100644 --- a/openlp/core/ui/formattingtagform.py +++ b/openlp/core/ui/formattingtagform.py @@ -33,7 +33,7 @@ cannot be changed. """ 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.ui.formattingtagdialog import Ui_FormattingTagDialog diff --git a/openlp/core/ui/generaltab.py b/openlp/core/ui/generaltab.py index 4626d36d2..e88ae2b15 100644 --- a/openlp/core/ui/generaltab.py +++ b/openlp/core/ui/generaltab.py @@ -33,7 +33,7 @@ import logging 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__) diff --git a/openlp/core/ui/maindisplay.py b/openlp/core/ui/maindisplay.py index 9cae5dfac..badf55548 100644 --- a/openlp/core/ui/maindisplay.py +++ b/openlp/core/ui/maindisplay.py @@ -42,8 +42,8 @@ import sys from PyQt4 import QtCore, QtGui, QtWebKit, QtOpenGL from PyQt4.phonon import Phonon -from openlp.core.lib import Receiver, build_html, ServiceItem, image_to_byte, translate, expand_tags,\ - Settings, ImageSource, Registry +from openlp.core.lib import Receiver, ServiceItem, Settings, ImageSource, Registry, build_html, expand_tags, \ + image_to_byte, translate from openlp.core.lib.theme import BackgroundType from openlp.core.lib import ScreenList diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index 532430fad..404103d58 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -41,13 +41,13 @@ from datetime import datetime from PyQt4 import QtCore, QtGui -from openlp.core.lib import Renderer, build_icon, OpenLPDockWidget, PluginManager, Receiver, translate, ImageManager, \ - PluginStatus, Registry, Settings, ScreenList +from openlp.core.lib import Renderer, OpenLPDockWidget, PluginManager, Receiver, ImageManager, PluginStatus, Registry, \ + Settings, ScreenList, build_icon, translate from openlp.core.lib.ui import UiStrings, create_action from openlp.core.ui import AboutForm, SettingsForm, ServiceManager, ThemeManager, SlideController, PluginForm, \ MediaDockManager, ShortcutListForm, FormattingTagForm 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 from openlp.core.utils.actions import ActionList, CategoryOrder from openlp.core.ui.firsttimeform import FirstTimeForm diff --git a/openlp/core/ui/media/mediacontroller.py b/openlp/core/ui/media/mediacontroller.py index 6d0c002de..73cd5b263 100644 --- a/openlp/core/ui/media/mediacontroller.py +++ b/openlp/core/ui/media/mediacontroller.py @@ -35,7 +35,7 @@ import os import datetime 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.ui.media import MediaState, MediaInfo, MediaType, get_media_players, set_media_players from openlp.core.ui.media.mediaplayer import MediaPlayer @@ -750,4 +750,4 @@ class MediaController(object): self._service_manager = Registry().get(u'service_manager') return self._service_manager - service_manager = property(_get_service_manager) \ No newline at end of file + service_manager = property(_get_service_manager) diff --git a/openlp/core/ui/media/phononplayer.py b/openlp/core/ui/media/phononplayer.py index ede7b2169..267466a98 100644 --- a/openlp/core/ui/media/phononplayer.py +++ b/openlp/core/ui/media/phononplayer.py @@ -36,7 +36,7 @@ from datetime import datetime from PyQt4 import QtGui from PyQt4.phonon import Phonon -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.mediaplayer import MediaPlayer diff --git a/openlp/core/ui/media/playertab.py b/openlp/core/ui/media/playertab.py index cfa274d0c..c2224369a 100644 --- a/openlp/core/ui/media/playertab.py +++ b/openlp/core/ui/media/playertab.py @@ -31,7 +31,7 @@ The :mod:`~openlp.core.ui.media.playertab` module holds the configuration tab fo """ 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.ui.media import get_media_players, set_media_players diff --git a/openlp/core/ui/media/vlcplayer.py b/openlp/core/ui/media/vlcplayer.py index 948577aac..6d5a45549 100644 --- a/openlp/core/ui/media/vlcplayer.py +++ b/openlp/core/ui/media/vlcplayer.py @@ -37,7 +37,7 @@ import sys from PyQt4 import QtGui -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.mediaplayer import MediaPlayer diff --git a/openlp/core/ui/media/webkitplayer.py b/openlp/core/ui/media/webkitplayer.py index 0a768fe37..963e4e6f7 100644 --- a/openlp/core/ui/media/webkitplayer.py +++ b/openlp/core/ui/media/webkitplayer.py @@ -33,7 +33,7 @@ from PyQt4 import QtGui 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.mediaplayer import MediaPlayer diff --git a/openlp/core/ui/plugindialog.py b/openlp/core/ui/plugindialog.py index 83f8b21a7..77fcf66c7 100644 --- a/openlp/core/ui/plugindialog.py +++ b/openlp/core/ui/plugindialog.py @@ -31,7 +31,7 @@ The UI widgets of the plugin view dialog #""" 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 diff --git a/openlp/core/ui/printservicedialog.py b/openlp/core/ui/printservicedialog.py index 7f7abcf27..03ad043d2 100644 --- a/openlp/core/ui/printservicedialog.py +++ b/openlp/core/ui/printservicedialog.py @@ -31,7 +31,7 @@ The UI widgets of the print service dialog. """ 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): diff --git a/openlp/core/ui/printserviceform.py b/openlp/core/ui/printserviceform.py index 689323cd5..d9fa54f36 100644 --- a/openlp/core/ui/printserviceform.py +++ b/openlp/core/ui/printserviceform.py @@ -36,7 +36,7 @@ import os from PyQt4 import QtCore, QtGui 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.utils import AppLocation @@ -428,4 +428,4 @@ class PrintServiceForm(QtGui.QDialog, Ui_PrintServiceDialog): self._main_window = Registry().get(u'main_window') return self._main_window - main_window = property(_get_main_window) \ No newline at end of file + main_window = property(_get_main_window) diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index b45794556..778f8d8cb 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -42,8 +42,8 @@ log = logging.getLogger(__name__) from PyQt4 import QtCore, QtGui -from openlp.core.lib import OpenLPToolbar, ServiceItem, Receiver, build_icon, ItemCapabilities, \ - translate, str_to_bool, check_directory_exists, Settings, PluginStatus, Registry, UiStrings +from openlp.core.lib import OpenLPToolbar, ServiceItem, Receiver, ItemCapabilities, Settings, PluginStatus, Registry, \ + UiStrings, build_icon, translate, str_to_bool, check_directory_exists 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.ui import ServiceNoteForm, ServiceItemEditForm, StartTimeForm diff --git a/openlp/core/ui/servicenoteform.py b/openlp/core/ui/servicenoteform.py index 7d624ab8c..c62349104 100644 --- a/openlp/core/ui/servicenoteform.py +++ b/openlp/core/ui/servicenoteform.py @@ -31,7 +31,7 @@ The :mod:`~openlp.core.ui.servicenoteform` module contains the `ServiceNoteForm` """ 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 @@ -83,4 +83,4 @@ class ServiceNoteForm(QtGui.QDialog): self._main_window = Registry().get(u'main_window') return self._main_window - main_window = property(_get_main_window) \ No newline at end of file + main_window = property(_get_main_window) diff --git a/openlp/core/ui/settingsform.py b/openlp/core/ui/settingsform.py index 0543f1087..438898048 100644 --- a/openlp/core/ui/settingsform.py +++ b/openlp/core/ui/settingsform.py @@ -33,7 +33,7 @@ import logging 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.media import PlayerTab from settingsdialog import Ui_SettingsDialog @@ -165,4 +165,4 @@ class SettingsForm(QtGui.QDialog, Ui_SettingsDialog): self._service_manager = Registry().get(u'service_manager') return self._service_manager - service_manager = property(_get_service_manager) \ No newline at end of file + service_manager = property(_get_service_manager) diff --git a/openlp/core/ui/slidecontroller.py b/openlp/core/ui/slidecontroller.py index 4b0651930..37a77eaa1 100644 --- a/openlp/core/ui/slidecontroller.py +++ b/openlp/core/ui/slidecontroller.py @@ -36,8 +36,8 @@ from collections import deque from PyQt4 import QtCore, QtGui -from openlp.core.lib import OpenLPToolbar, Receiver, ItemCapabilities, translate, build_icon, build_html, \ - ServiceItem, ImageSource, SlideLimits, ServiceItemAction, Settings, Registry, UiStrings, ScreenList +from openlp.core.lib import OpenLPToolbar, Receiver, ItemCapabilities, ServiceItem, ImageSource, SlideLimits, \ + ServiceItemAction, Settings, Registry, UiStrings, ScreenList, build_icon, build_html, translate from openlp.core.ui import HideMode, MainDisplay, Display, DisplayControllerType from openlp.core.lib.ui import create_action from openlp.core.utils.actions import ActionList, CategoryOrder @@ -608,7 +608,7 @@ class SlideController(DisplayController): elif width < 300 and not self.hideMenu.isVisible(): self.toolbar.setWidgetVisible(self.wideMenu, False) self.toolbar.setWidgetVisible(self.hideMenuList) - + def onSongBarHandler(self): """ Some song handler diff --git a/openlp/core/ui/starttimedialog.py b/openlp/core/ui/starttimedialog.py index e13c86430..7e370abbc 100644 --- a/openlp/core/ui/starttimedialog.py +++ b/openlp/core/ui/starttimedialog.py @@ -31,7 +31,7 @@ The UI widgets for the time dialog """ 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 diff --git a/openlp/core/ui/starttimeform.py b/openlp/core/ui/starttimeform.py index 7c9e694f0..2ab918b6f 100644 --- a/openlp/core/ui/starttimeform.py +++ b/openlp/core/ui/starttimeform.py @@ -33,7 +33,7 @@ from PyQt4 import QtGui 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 @@ -105,4 +105,4 @@ class StartTimeForm(QtGui.QDialog, Ui_StartTimeDialog): self._main_window = Registry().get(u'main_window') return self._main_window - main_window = property(_get_main_window) \ No newline at end of file + main_window = property(_get_main_window) diff --git a/openlp/core/ui/themeform.py b/openlp/core/ui/themeform.py index f1a7a3010..a23e08207 100644 --- a/openlp/core/ui/themeform.py +++ b/openlp/core/ui/themeform.py @@ -34,7 +34,7 @@ import os 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.ui import critical_error_message_box from openlp.core.ui import ThemeLayoutForm diff --git a/openlp/core/ui/thememanager.py b/openlp/core/ui/thememanager.py index a482a3c44..08746b884 100644 --- a/openlp/core/ui/thememanager.py +++ b/openlp/core/ui/thememanager.py @@ -38,9 +38,9 @@ import re from xml.etree.ElementTree import ElementTree, XML from PyQt4 import QtCore, QtGui -from openlp.core.lib import OpenLPToolbar, get_text_file_string, build_icon, Receiver, SettingsManager, translate, \ - check_item_selected, check_directory_exists, create_thumb, validate_thumb, ImageSource, Settings, Registry, \ - UiStrings +from openlp.core.lib import ImageSource, OpenLPToolbar, Receiver, Registry, SettingsManager, Settings, UiStrings, \ + get_text_file_string, build_icon, translate, check_item_selected, check_directory_exists, create_thumb, \ + validate_thumb 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.theme import Theme @@ -859,4 +859,4 @@ class ThemeManager(QtGui.QWidget): self._application = Registry().get(u'application') return self._application - application = property(_get_application) \ No newline at end of file + application = property(_get_application) diff --git a/openlp/core/ui/themestab.py b/openlp/core/ui/themestab.py index b502d11e0..0cf491e72 100644 --- a/openlp/core/ui/themestab.py +++ b/openlp/core/ui/themestab.py @@ -31,7 +31,7 @@ The Themes configuration tab """ 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.ui import find_and_set_in_combo_box diff --git a/openlp/core/ui/themewizard.py b/openlp/core/ui/themewizard.py index 7a434e998..fb23a2ac6 100644 --- a/openlp/core/ui/themewizard.py +++ b/openlp/core/ui/themewizard.py @@ -31,7 +31,7 @@ The Create/Edit theme wizard """ 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.ui import add_welcome_page, create_valign_selection_widgets diff --git a/openlp/core/ui/wizard.py b/openlp/core/ui/wizard.py index 46ef55fd1..744dd8087 100644 --- a/openlp/core/ui/wizard.py +++ b/openlp/core/ui/wizard.py @@ -34,7 +34,7 @@ import os from PyQt4 import QtCore, QtGui -from openlp.core.lib import build_icon, Receiver, Registry, Settings, translate, UiStrings +from openlp.core.lib import Receiver, Registry, Settings, UiStrings, build_icon, translate from openlp.core.lib.ui import add_welcome_page log = logging.getLogger(__name__) @@ -295,4 +295,4 @@ class OpenLPWizard(QtGui.QWizard): self._application = Registry().get(u'application') return self._application - application = property(_get_application) \ No newline at end of file + application = property(_get_application) diff --git a/openlp/core/utils/languagemanager.py b/openlp/core/utils/languagemanager.py index f69bb40c6..00a0d0079 100644 --- a/openlp/core/utils/languagemanager.py +++ b/openlp/core/utils/languagemanager.py @@ -36,7 +36,7 @@ import sys from PyQt4 import QtCore, QtGui from openlp.core.utils import AppLocation -from openlp.core.lib import translate, Settings +from openlp.core.lib import Settings, translate log = logging.getLogger(__name__) diff --git a/openlp/plugins/alerts/alertsplugin.py b/openlp/plugins/alerts/alertsplugin.py index 1c9203348..de2c92f7e 100644 --- a/openlp/plugins/alerts/alertsplugin.py +++ b/openlp/plugins/alerts/alertsplugin.py @@ -31,7 +31,7 @@ import logging 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.ui import create_action, UiStrings from openlp.core.lib.theme import VerticalType diff --git a/openlp/plugins/alerts/lib/alertstab.py b/openlp/plugins/alerts/lib/alertstab.py index 126c64766..05aff7fd6 100644 --- a/openlp/plugins/alerts/lib/alertstab.py +++ b/openlp/plugins/alerts/lib/alertstab.py @@ -29,7 +29,7 @@ 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_valign_selection_widgets class AlertsTab(SettingsTab): diff --git a/openlp/plugins/bibles/bibleplugin.py b/openlp/plugins/bibles/bibleplugin.py index bf5a056eb..8fcbaebc1 100644 --- a/openlp/plugins/bibles/bibleplugin.py +++ b/openlp/plugins/bibles/bibleplugin.py @@ -32,7 +32,7 @@ import logging from PyQt4 import QtGui 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.plugins.bibles.lib import BibleManager, BiblesTab, BibleMediaItem, LayoutStyle, DisplayStyle, \ LanguageSelection diff --git a/openlp/plugins/bibles/forms/bibleimportform.py b/openlp/plugins/bibles/forms/bibleimportform.py index 10d50a9af..3b1455f68 100644 --- a/openlp/plugins/bibles/forms/bibleimportform.py +++ b/openlp/plugins/bibles/forms/bibleimportform.py @@ -34,7 +34,7 @@ import os from PyQt4 import QtCore, QtGui -from openlp.core.lib import translate, Settings, UiStrings +from openlp.core.lib import Settings, UiStrings, translate from openlp.core.lib.db import delete_database from openlp.core.lib.ui import critical_error_message_box from openlp.core.ui.wizard import OpenLPWizard, WizardStrings diff --git a/openlp/plugins/bibles/forms/bibleupgradeform.py b/openlp/plugins/bibles/forms/bibleupgradeform.py index 10589cbee..f7f16aace 100644 --- a/openlp/plugins/bibles/forms/bibleupgradeform.py +++ b/openlp/plugins/bibles/forms/bibleupgradeform.py @@ -36,7 +36,7 @@ from tempfile import gettempdir 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.ui.wizard import OpenLPWizard, WizardStrings from openlp.core.utils import AppLocation, delete_file, get_filesystem_encoding diff --git a/openlp/plugins/bibles/forms/editbibleform.py b/openlp/plugins/bibles/forms/editbibleform.py index a6e9e6d6b..939cd8383 100644 --- a/openlp/plugins/bibles/forms/editbibleform.py +++ b/openlp/plugins/bibles/forms/editbibleform.py @@ -32,7 +32,7 @@ import re from PyQt4 import QtGui -from openlp.core.lib import Registry, translate, UiStrings +from openlp.core.lib import Registry, UiStrings, translate from openlp.core.lib.ui import critical_error_message_box from editbibledialog import Ui_EditBibleDialog from openlp.plugins.bibles.lib import BibleStrings diff --git a/openlp/plugins/bibles/lib/__init__.py b/openlp/plugins/bibles/lib/__init__.py index 2ba2ff590..219b91f90 100644 --- a/openlp/plugins/bibles/lib/__init__.py +++ b/openlp/plugins/bibles/lib/__init__.py @@ -33,7 +33,7 @@ plugin. import logging import re -from openlp.core.lib import translate, Settings +from openlp.core.lib import Settings, translate log = logging.getLogger(__name__) diff --git a/openlp/plugins/bibles/lib/biblestab.py b/openlp/plugins/bibles/lib/biblestab.py index 291930a4b..0ac667697 100644 --- a/openlp/plugins/bibles/lib/biblestab.py +++ b/openlp/plugins/bibles/lib/biblestab.py @@ -31,7 +31,7 @@ import logging 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.plugins.bibles.lib import LayoutStyle, DisplayStyle, update_reference_separators, \ get_reference_separator, LanguageSelection diff --git a/openlp/plugins/bibles/lib/db.py b/openlp/plugins/bibles/lib/db.py index c728aee6a..7b6c94353 100644 --- a/openlp/plugins/bibles/lib/db.py +++ b/openlp/plugins/bibles/lib/db.py @@ -34,7 +34,7 @@ import re import sqlite3 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.exc import UnmappedClassError @@ -360,7 +360,7 @@ class BibleDB(QtCore.QObject, Manager): ``book`` The name of the book, according to the selected language. - + ``language_selection`` The language selection the user has chosen in the settings section of the Bible. diff --git a/openlp/plugins/bibles/lib/manager.py b/openlp/plugins/bibles/lib/manager.py index aaf91d2c0..83428c35b 100644 --- a/openlp/plugins/bibles/lib/manager.py +++ b/openlp/plugins/bibles/lib/manager.py @@ -30,7 +30,7 @@ import logging 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.plugins.bibles.lib import parse_reference, get_reference_separator, LanguageSelection from openlp.plugins.bibles.lib.db import BibleDB, BibleMeta diff --git a/openlp/plugins/bibles/lib/mediaitem.py b/openlp/plugins/bibles/lib/mediaitem.py index 13d770909..2df57e626 100644 --- a/openlp/plugins/bibles/lib/mediaitem.py +++ b/openlp/plugins/bibles/lib/mediaitem.py @@ -31,8 +31,8 @@ import logging from PyQt4 import QtCore, QtGui -from openlp.core.lib import MediaManagerItem, Receiver, ItemCapabilities, translate, create_separated_list, \ - ServiceItemContext, Settings, UiStrings +from openlp.core.lib import MediaManagerItem, Receiver, ItemCapabilities, ServiceItemContext, Settings, UiStrings, \ + create_separated_list, translate from openlp.core.lib.searchedit import SearchEdit 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 diff --git a/openlp/plugins/custom/forms/editcustomdialog.py b/openlp/plugins/custom/forms/editcustomdialog.py index 5792e7aae..1972228d2 100644 --- a/openlp/plugins/custom/forms/editcustomdialog.py +++ b/openlp/plugins/custom/forms/editcustomdialog.py @@ -29,7 +29,7 @@ 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 class Ui_CustomEditDialog(object): diff --git a/openlp/plugins/custom/forms/editcustomslidedialog.py b/openlp/plugins/custom/forms/editcustomslidedialog.py index 5dfb79adc..972759e7c 100644 --- a/openlp/plugins/custom/forms/editcustomslidedialog.py +++ b/openlp/plugins/custom/forms/editcustomslidedialog.py @@ -29,7 +29,7 @@ from PyQt4 import QtGui -from openlp.core.lib import translate, SpellTextEdit, UiStrings +from openlp.core.lib import SpellTextEdit, UiStrings, translate from openlp.core.lib.ui import create_button, create_button_box class Ui_CustomSlideEditDialog(object): diff --git a/openlp/plugins/custom/lib/customtab.py b/openlp/plugins/custom/lib/customtab.py index 5b0b7f11f..ba57a6fc2 100644 --- a/openlp/plugins/custom/lib/customtab.py +++ b/openlp/plugins/custom/lib/customtab.py @@ -33,7 +33,7 @@ for the Custom Slides plugin, which is inserted into the configuration dialog. from PyQt4 import QtCore, QtGui -from openlp.core.lib import SettingsTab, translate, Settings +from openlp.core.lib import SettingsTab, Settings, translate class CustomTab(SettingsTab): """ diff --git a/openlp/plugins/custom/lib/mediaitem.py b/openlp/plugins/custom/lib/mediaitem.py index 7b87dbef5..369d3e419 100644 --- a/openlp/plugins/custom/lib/mediaitem.py +++ b/openlp/plugins/custom/lib/mediaitem.py @@ -32,8 +32,8 @@ import logging from PyQt4 import QtCore, QtGui from sqlalchemy.sql import or_, func, and_ -from openlp.core.lib import MediaManagerItem, Receiver, ItemCapabilities, check_item_selected, translate, \ - ServiceItemContext, Settings, PluginStatus, UiStrings +from openlp.core.lib import MediaManagerItem, Receiver, ItemCapabilities, ServiceItemContext, Settings, PluginStatus, \ + UiStrings, check_item_selected, translate from openlp.plugins.custom.forms import EditCustomForm from openlp.plugins.custom.lib import CustomXMLParser, CustomXMLBuilder from openlp.plugins.custom.lib.db import CustomSlide diff --git a/openlp/plugins/images/imageplugin.py b/openlp/plugins/images/imageplugin.py index 0827e645c..0f2829dbc 100644 --- a/openlp/plugins/images/imageplugin.py +++ b/openlp/plugins/images/imageplugin.py @@ -31,7 +31,7 @@ from PyQt4 import QtCore, QtGui 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.plugins.images.lib import ImageMediaItem, ImageTab log = logging.getLogger(__name__) diff --git a/openlp/plugins/images/lib/imagetab.py b/openlp/plugins/images/lib/imagetab.py index 8e3f1c657..ce3e9b957 100644 --- a/openlp/plugins/images/lib/imagetab.py +++ b/openlp/plugins/images/lib/imagetab.py @@ -29,7 +29,7 @@ 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): """ diff --git a/openlp/plugins/images/lib/mediaitem.py b/openlp/plugins/images/lib/mediaitem.py index 64ba220c0..0ab73aa46 100644 --- a/openlp/plugins/images/lib/mediaitem.py +++ b/openlp/plugins/images/lib/mediaitem.py @@ -32,9 +32,9 @@ import os from PyQt4 import QtCore, QtGui -from openlp.core.lib import MediaManagerItem, build_icon, ItemCapabilities, SettingsManager, translate, \ - check_item_selected, check_directory_exists, Receiver, create_thumb, validate_thumb, ServiceItemContext, Settings, \ - UiStrings +from openlp.core.lib import MediaManagerItem, ItemCapabilities, Receiver, SettingsManager, ServiceItemContext, \ + Settings, UiStrings, build_icon, check_item_selected, check_directory_exists, create_thumb, translate, \ + validate_thumb from openlp.core.lib.ui import critical_error_message_box from openlp.core.utils import AppLocation, delete_file, locale_compare, get_images_filter diff --git a/openlp/plugins/media/lib/mediaitem.py b/openlp/plugins/media/lib/mediaitem.py index 1645164ae..02d624c1e 100644 --- a/openlp/plugins/media/lib/mediaitem.py +++ b/openlp/plugins/media/lib/mediaitem.py @@ -32,9 +32,8 @@ import os from PyQt4 import QtCore, QtGui -from openlp.core.lib import MediaManagerItem, build_icon, ItemCapabilities, translate, \ - check_item_selected, Receiver, MediaType, ServiceItem, ServiceItemContext, Settings, UiStrings, \ - check_directory_exists +from openlp.core.lib import ItemCapabilities, MediaManagerItem,MediaType, Receiver, ServiceItem, ServiceItemContext, \ + Settings, UiStrings, build_icon, check_item_selected, check_directory_exists, translate 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.media import get_media_players, set_media_players diff --git a/openlp/plugins/media/lib/mediatab.py b/openlp/plugins/media/lib/mediatab.py index d874686a6..69a21d0a4 100644 --- a/openlp/plugins/media/lib/mediatab.py +++ b/openlp/plugins/media/lib/mediatab.py @@ -29,7 +29,7 @@ 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 MediaQCheckBox(QtGui.QCheckBox): """ diff --git a/openlp/plugins/media/mediaplugin.py b/openlp/plugins/media/mediaplugin.py index 2a1fcf112..bb463b857 100644 --- a/openlp/plugins/media/mediaplugin.py +++ b/openlp/plugins/media/mediaplugin.py @@ -31,7 +31,7 @@ import logging 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 log = logging.getLogger(__name__) diff --git a/openlp/plugins/presentations/lib/mediaitem.py b/openlp/plugins/presentations/lib/mediaitem.py index 85a21781a..1875ca66c 100644 --- a/openlp/plugins/presentations/lib/mediaitem.py +++ b/openlp/plugins/presentations/lib/mediaitem.py @@ -32,8 +32,8 @@ import os from PyQt4 import QtCore, QtGui -from openlp.core.lib import MediaManagerItem, build_icon, translate, check_item_selected, Receiver, \ - ItemCapabilities, create_thumb, validate_thumb, ServiceItemContext, Settings, UiStrings +from openlp.core.lib import MediaManagerItem, Receiver, ItemCapabilities, 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.utils import locale_compare from openlp.plugins.presentations.lib import MessageListener diff --git a/openlp/plugins/presentations/lib/presentationcontroller.py b/openlp/plugins/presentations/lib/presentationcontroller.py index 8f468de63..fad88d7cd 100644 --- a/openlp/plugins/presentations/lib/presentationcontroller.py +++ b/openlp/plugins/presentations/lib/presentationcontroller.py @@ -33,7 +33,7 @@ import shutil 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 log = logging.getLogger(__name__) diff --git a/openlp/plugins/presentations/lib/presentationtab.py b/openlp/plugins/presentations/lib/presentationtab.py index 06cd84568..15b3b2590 100644 --- a/openlp/plugins/presentations/lib/presentationtab.py +++ b/openlp/plugins/presentations/lib/presentationtab.py @@ -29,7 +29,7 @@ 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): """ diff --git a/openlp/plugins/remotes/lib/remotetab.py b/openlp/plugins/remotes/lib/remotetab.py index c3ccd46c5..2e42a2b1e 100644 --- a/openlp/plugins/remotes/lib/remotetab.py +++ b/openlp/plugins/remotes/lib/remotetab.py @@ -29,7 +29,7 @@ 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' diff --git a/openlp/plugins/songs/forms/editsongdialog.py b/openlp/plugins/songs/forms/editsongdialog.py index 3f6e1e61a..76f190931 100644 --- a/openlp/plugins/songs/forms/editsongdialog.py +++ b/openlp/plugins/songs/forms/editsongdialog.py @@ -29,7 +29,7 @@ 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.plugins.songs.lib.ui import SongStrings diff --git a/openlp/plugins/songs/forms/editsongform.py b/openlp/plugins/songs/forms/editsongform.py index f31b487e1..9da5adc6e 100644 --- a/openlp/plugins/songs/forms/editsongform.py +++ b/openlp/plugins/songs/forms/editsongform.py @@ -38,8 +38,8 @@ import shutil from PyQt4 import QtCore, QtGui -from openlp.core.lib import PluginStatus, Receiver, MediaType, translate, create_separated_list, \ - check_directory_exists, Registry, UiStrings +from openlp.core.lib import PluginStatus, Receiver, MediaType, Registry, UiStrings, translate, create_separated_list, \ + check_directory_exists from openlp.core.lib.ui import set_case_insensitive_completer, critical_error_message_box, \ find_and_set_in_combo_box from openlp.core.utils import AppLocation @@ -915,4 +915,4 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog): self._theme_manager = Registry().get(u'theme_manager') return self._theme_manager - theme_manager = property(_get_theme_manager) \ No newline at end of file + theme_manager = property(_get_theme_manager) diff --git a/openlp/plugins/songs/forms/editversedialog.py b/openlp/plugins/songs/forms/editversedialog.py index 603af2180..e97a898f7 100644 --- a/openlp/plugins/songs/forms/editversedialog.py +++ b/openlp/plugins/songs/forms/editversedialog.py @@ -29,8 +29,8 @@ from PyQt4 import QtGui -from openlp.core.lib import build_icon, translate, SpellTextEdit -from openlp.core.lib.ui import create_button_box, UiStrings +from openlp.core.lib import SpellTextEdit, build_icon, translate +from openlp.core.lib.ui import UiStrings, create_button_box from openlp.plugins.songs.lib import VerseType class Ui_EditVerseDialog(object): diff --git a/openlp/plugins/songs/forms/songexportform.py b/openlp/plugins/songs/forms/songexportform.py index 2a1564f8b..f4773b3da 100644 --- a/openlp/plugins/songs/forms/songexportform.py +++ b/openlp/plugins/songs/forms/songexportform.py @@ -34,7 +34,7 @@ import logging 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.ui.wizard import OpenLPWizard, WizardStrings from openlp.plugins.songs.lib import natcmp diff --git a/openlp/plugins/songs/forms/songimportform.py b/openlp/plugins/songs/forms/songimportform.py index 9a842f401..b635b309b 100644 --- a/openlp/plugins/songs/forms/songimportform.py +++ b/openlp/plugins/songs/forms/songimportform.py @@ -35,7 +35,7 @@ import os from PyQt4 import QtCore, QtGui -from openlp.core.lib import Settings, translate, UiStrings +from openlp.core.lib import Settings, UiStrings, translate from openlp.core.lib.ui import critical_error_message_box from openlp.core.ui.wizard import OpenLPWizard, WizardStrings from openlp.plugins.songs.lib.importer import SongFormat, SongFormatSelect diff --git a/openlp/plugins/songs/forms/songmaintenancedialog.py b/openlp/plugins/songs/forms/songmaintenancedialog.py index 389579284..2f7ad7915 100644 --- a/openlp/plugins/songs/forms/songmaintenancedialog.py +++ b/openlp/plugins/songs/forms/songmaintenancedialog.py @@ -29,7 +29,7 @@ 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.plugins.songs.lib.ui import SongStrings diff --git a/openlp/plugins/songs/forms/songmaintenanceform.py b/openlp/plugins/songs/forms/songmaintenanceform.py index 9d0c0c306..546791778 100644 --- a/openlp/plugins/songs/forms/songmaintenanceform.py +++ b/openlp/plugins/songs/forms/songmaintenanceform.py @@ -31,7 +31,7 @@ import logging from PyQt4 import QtGui, QtCore 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.plugins.songs.forms import AuthorsForm, TopicsForm, SongBookForm from openlp.plugins.songs.lib.db import Author, Book, Topic, Song @@ -517,4 +517,4 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog): self._application = Registry().get(u'application') return self._application - application = property(_get_application) \ No newline at end of file + application = property(_get_application) diff --git a/openlp/plugins/songs/lib/mediaitem.py b/openlp/plugins/songs/lib/mediaitem.py index 883865bb8..6c38c84da 100644 --- a/openlp/plugins/songs/lib/mediaitem.py +++ b/openlp/plugins/songs/lib/mediaitem.py @@ -35,8 +35,8 @@ import shutil from PyQt4 import QtCore, QtGui from sqlalchemy.sql import or_ -from openlp.core.lib import MediaManagerItem, Receiver, ItemCapabilities, translate, check_item_selected, \ - PluginStatus, create_separated_list, check_directory_exists, ServiceItemContext, Settings, UiStrings +from openlp.core.lib import MediaManagerItem, Receiver, ItemCapabilities, PluginStatus, ServiceItemContext, Settings, \ + UiStrings, translate, check_item_selected, create_separated_list, check_directory_exists from openlp.core.lib.ui import create_widget_action from openlp.core.utils import AppLocation from openlp.plugins.songs.forms import EditSongForm, SongMaintenanceForm, SongImportForm, SongExportForm diff --git a/openlp/plugins/songs/lib/xml.py b/openlp/plugins/songs/lib/xml.py index 859bef075..22a4d803f 100644 --- a/openlp/plugins/songs/lib/xml.py +++ b/openlp/plugins/songs/lib/xml.py @@ -69,7 +69,7 @@ import re from lxml import etree, objectify from openlp.core.lib import FormattingTags, translate -from openlp.plugins.songs.lib import clean_song, VerseType +from openlp.plugins.songs.lib import VerseType, clean_song from openlp.plugins.songs.lib.db import Author, Book, Song, Topic from openlp.core.utils import get_application_version diff --git a/openlp/plugins/songs/songsplugin.py b/openlp/plugins/songs/songsplugin.py index 937e5b374..74a5ce216 100644 --- a/openlp/plugins/songs/songsplugin.py +++ b/openlp/plugins/songs/songsplugin.py @@ -38,7 +38,7 @@ import sqlite3 from PyQt4 import QtCore, QtGui -from openlp.core.lib import Plugin, StringContent, build_icon, translate, UiStrings +from openlp.core.lib import Plugin, StringContent, UiStrings, build_icon, translate from openlp.core.lib.db import Manager from openlp.core.lib.ui import create_action from openlp.core.utils import get_filesystem_encoding diff --git a/openlp/plugins/songusage/forms/songusagedeleteform.py b/openlp/plugins/songusage/forms/songusagedeleteform.py index 8174060bd..b13be8ad2 100644 --- a/openlp/plugins/songusage/forms/songusagedeleteform.py +++ b/openlp/plugins/songusage/forms/songusagedeleteform.py @@ -29,7 +29,7 @@ from PyQt4 import QtCore, QtGui -from openlp.core.lib import translate, Receiver +from openlp.core.lib import Receiver, translate from openlp.plugins.songusage.lib.db import SongUsageItem from songusagedeletedialog import Ui_SongUsageDeleteDialog diff --git a/openlp/plugins/songusage/songusageplugin.py b/openlp/plugins/songusage/songusageplugin.py index 398997715..3b3611f0e 100644 --- a/openlp/plugins/songusage/songusageplugin.py +++ b/openlp/plugins/songusage/songusageplugin.py @@ -32,7 +32,7 @@ from datetime import datetime from PyQt4 import QtCore, QtGui -from openlp.core.lib import build_icon, Plugin, Receiver, Settings, StringContent, translate +from openlp.core.lib import Plugin, Receiver, Settings, StringContent, build_icon, translate from openlp.core.lib.db import Manager from openlp.core.lib.ui import create_action from openlp.core.utils.actions import ActionList From f1e8f9812c118631fe9ebc8467172bdd48a87b47 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Tue, 5 Feb 2013 18:47:57 +0100 Subject: [PATCH 21/26] fixed rename error --- openlp/plugins/songs/forms/editsongform.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/openlp/plugins/songs/forms/editsongform.py b/openlp/plugins/songs/forms/editsongform.py index 0c0e5c196..0758b18f7 100644 --- a/openlp/plugins/songs/forms/editsongform.py +++ b/openlp/plugins/songs/forms/editsongform.py @@ -184,7 +184,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog): Load the media files into a combobox. """ self.audioAddFromMediaButton.setVisible(False) - for plugin in self.parent().pluginManager.plugins: + for plugin in self.parent().plugin_manager.plugins: if plugin.name == u'media' and plugin.status == PluginStatus.Active: self.audioAddFromMediaButton.setVisible(True) self.mediaForm.populateFiles(plugin.mediaItem.getList(MediaType.Audio)) @@ -915,4 +915,5 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog): self._theme_manager = Registry().get(u'theme_manager') return self._theme_manager - theme_manager = property(_get_theme_manager) \ No newline at end of file + theme_manager = property(_get_theme_manager) + From ea3e24096c38aceb629aace25de76790a48ac913 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Tue, 5 Feb 2013 20:29:31 +0100 Subject: [PATCH 22/26] use registry --- openlp/plugins/songs/forms/editsongform.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/openlp/plugins/songs/forms/editsongform.py b/openlp/plugins/songs/forms/editsongform.py index 0758b18f7..253225411 100644 --- a/openlp/plugins/songs/forms/editsongform.py +++ b/openlp/plugins/songs/forms/editsongform.py @@ -184,7 +184,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog): Load the media files into a combobox. """ self.audioAddFromMediaButton.setVisible(False) - for plugin in self.parent().plugin_manager.plugins: + for plugin in self.plugin_manager.plugins: if plugin.name == u'media' and plugin.status == PluginStatus.Active: self.audioAddFromMediaButton.setVisible(True) self.mediaForm.populateFiles(plugin.mediaItem.getList(MediaType.Audio)) @@ -907,6 +907,16 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog): except: 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): """ Adds the theme manager to the class dynamically From 28ea251866c06749750a676df170a4710ac93b9d Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Thu, 7 Feb 2013 19:00:40 +0100 Subject: [PATCH 23/26] fixed servicemanager bugs preventing saving/opening a service --- openlp/core/lib/settings.py | 2 +- openlp/core/ui/servicemanager.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/openlp/core/lib/settings.py b/openlp/core/lib/settings.py index 78e8004c4..7e72c6d4c 100644 --- a/openlp/core/lib/settings.py +++ b/openlp/core/lib/settings.py @@ -143,6 +143,7 @@ class Settings(QtCore.QSettings): u'media/players': u'webkit', u'media/override player': QtCore.Qt.Unchecked, u'players/background color': u'#000000', + u'servicemanager/last directory': 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"), @@ -242,7 +243,6 @@ class Settings(QtCore.QSettings): (u'media/background color', u'players/background color', []), (u'themes/last directory', u'themes/last directory import', []), (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'songusage/last directory 1', u'songusage/last directory export', []), (u'user interface/mainwindow splitter geometry', u'user interface/main window splitter geometry', []), diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index 778f8d8cb..cfa0d4707 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -661,11 +661,11 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog): # 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. 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', 'OpenLP Service Files (*.osz);; OpenLP Service Files - lite (*.oszl)')) 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);;')) if not file_name: return False From d6128a4f0694d176e6279150c1d268dcf70aa2ac Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sat, 9 Feb 2013 15:13:38 +0100 Subject: [PATCH 24/26] fixed first time wizard --- openlp/core/ui/firsttimeform.py | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/openlp/core/ui/firsttimeform.py b/openlp/core/ui/firsttimeform.py index daedbb94e..efeac2d25 100644 --- a/openlp/core/ui/firsttimeform.py +++ b/openlp/core/ui/firsttimeform.py @@ -61,7 +61,7 @@ class ThemeScreenshotThread(QtCore.QThread): config = self.parent().config for theme in themes: # Stop if the wizard has been cancelled. - if self.parent().downloadCancelled: + if self.parent().was_download_cancelled: return title = config.get(u'theme_%s' % theme, u'title') 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 self.web = u'http://openlp.org/files/frw/' self.config = SafeConfigParser() - self.webAccess = get_web_page(u'%s%s' % (self.web, u'download.cfg')) - if self.webAccess: - files = self.webAccess.read() + self.web_access = get_web_page(u'%s%s' % (self.web, u'download.cfg')) + if self.web_access: + files = self.web_access.read() self.config.readfp(io.BytesIO(files)) self.updateScreenListCombo() self.was_download_cancelled = False @@ -118,13 +118,12 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): Set up display at start of theme edit. """ self.restart() - check_directory_exists(os.path.join( - unicode(gettempdir(), get_filesystem_encoding()), u'openlp')) + check_directory_exists(os.path.join(unicode(gettempdir(), get_filesystem_encoding()), u'openlp')) self.noInternetFinishButton.setVisible(False) # Check if this is a re-run of the wizard. self.hasRunWizard = Settings().value(u'general/has run wizard') # Sort out internet access for downloads - if self.webAccess: + if self.web_access: songs = self.config.get(u'songs', u'languages') songs = songs.split(u',') for song in songs: @@ -160,7 +159,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): """ self.application.process_events() if self.currentId() == FirstTimePage.Plugins: - if not self.webAccess: + if not self.web_access: return FirstTimePage.NoInternet else: return FirstTimePage.Songs @@ -169,6 +168,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): elif self.currentId() == FirstTimePage.NoInternet: return FirstTimePage.Progress elif self.currentId() == FirstTimePage.Themes: + self.application.process_events() self.application.set_busy_cursor() while not self.themeScreenshotThread.isFinished(): time.sleep(0.1) @@ -241,8 +241,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): """ Process the triggering of the cancel button. """ - if self.lastId == FirstTimePage.NoInternet or \ - (self.lastId <= FirstTimePage.Plugins and not self.hasRunWizard): + if self.lastId == FirstTimePage.NoInternet or (self.lastId <= FirstTimePage.Plugins and not self.hasRunWizard): QtCore.QCoreApplication.exit() sys.exit() self.was_download_cancelled = True @@ -428,7 +427,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): self._setPluginStatus(self.customCheckBox, u'custom/status') self._setPluginStatus(self.songUsageCheckBox, u'songusage/status') self._setPluginStatus(self.alertCheckBox, u'alerts/status') - if self.webAccess: + if self.web_access: # Build directories for downloads songs_destination = os.path.join( unicode(gettempdir(), get_filesystem_encoding()), u'openlp') From b0065d808cc113132f42bc237baf9f9300cb7f54 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sat, 9 Feb 2013 15:45:07 +0100 Subject: [PATCH 25/26] removed not needed call --- openlp/core/ui/firsttimeform.py | 1 - 1 file changed, 1 deletion(-) diff --git a/openlp/core/ui/firsttimeform.py b/openlp/core/ui/firsttimeform.py index efeac2d25..16f39b85e 100644 --- a/openlp/core/ui/firsttimeform.py +++ b/openlp/core/ui/firsttimeform.py @@ -168,7 +168,6 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): elif self.currentId() == FirstTimePage.NoInternet: return FirstTimePage.Progress elif self.currentId() == FirstTimePage.Themes: - self.application.process_events() self.application.set_busy_cursor() while not self.themeScreenshotThread.isFinished(): time.sleep(0.1) From 5739536d8cd469ef383533af450ca4547734d067 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sat, 9 Feb 2013 16:27:35 +0100 Subject: [PATCH 26/26] fixed more regression --- openlp/core/ui/mainwindow.py | 2 +- openlp/core/ui/thememanager.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index 5e21a6c28..cb94a0914 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -699,7 +699,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): self.activePlugin.app_startup() else: self.activePlugin.toggleStatus(PluginStatus.Inactive) - self.themeManagerContents.configUpdated() + self.themeManagerContents.config_updated() self.themeManagerContents.load_themes(True) Receiver.send_message(u'theme_update_global', self.themeManagerContents.global_theme) # Check if any Bibles downloaded. If there are, they will be diff --git a/openlp/core/ui/thememanager.py b/openlp/core/ui/thememanager.py index 08746b884..a60244257 100644 --- a/openlp/core/ui/thememanager.py +++ b/openlp/core/ui/thememanager.py @@ -157,7 +157,7 @@ class ThemeManager(QtGui.QWidget): 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) + self.unzip_theme(theme_file, self.path) delete_file(theme_file) self.application.set_normal_cursor()