diff --git a/openlp/core/__init__.py b/openlp/core/__init__.py index 4bb0f0d28..fb367913b 100644 --- a/openlp/core/__init__.py +++ b/openlp/core/__init__.py @@ -43,8 +43,8 @@ from traceback import format_exception from PyQt4 import QtCore, QtGui -from openlp.core.common import AppLocation, Settings, UiStrings, check_directory_exists -from openlp.core.lib import ScreenList, Registry +from openlp.core.common import Registry, AppLocation, Settings, UiStrings, check_directory_exists +from openlp.core.lib import ScreenList from openlp.core.resources import qInitResources from openlp.core.ui.mainwindow import MainWindow from openlp.core.ui.firsttimelanguageform import FirstTimeLanguageForm diff --git a/openlp/core/common/__init__.py b/openlp/core/common/__init__.py index 42fde7065..e1ad4c9e6 100644 --- a/openlp/core/common/__init__.py +++ b/openlp/core/common/__init__.py @@ -103,6 +103,7 @@ class SlideLimits(object): Wrap = 2 Next = 3 +from .registry import Registry from .uistrings import UiStrings from .settings import Settings from .applocation import AppLocation diff --git a/openlp/core/lib/__init__.py b/openlp/core/lib/__init__.py index a46e25249..4b0875515 100644 --- a/openlp/core/lib/__init__.py +++ b/openlp/core/lib/__init__.py @@ -329,7 +329,6 @@ def create_separated_list(string_list): return translate('OpenLP.core.lib', '%s, %s', 'Locale list separator: start') % (string_list[0], merged) -from .registry import Registry from .filedialog import FileDialog from .screen import ScreenList from .listwidgetwithdnd import ListWidgetWithDnD diff --git a/openlp/core/lib/imagemanager.py b/openlp/core/lib/imagemanager.py index e85f38d64..0a0219d74 100644 --- a/openlp/core/lib/imagemanager.py +++ b/openlp/core/lib/imagemanager.py @@ -39,7 +39,8 @@ import queue from PyQt4 import QtCore -from openlp.core.lib import Registry, ScreenList, resize_image, image_to_byte +from openlp.core.common import Registry +from openlp.core.lib import ScreenList, resize_image, image_to_byte log = logging.getLogger(__name__) diff --git a/openlp/core/lib/listwidgetwithdnd.py b/openlp/core/lib/listwidgetwithdnd.py index 964974f3a..c70b6d735 100644 --- a/openlp/core/lib/listwidgetwithdnd.py +++ b/openlp/core/lib/listwidgetwithdnd.py @@ -33,7 +33,7 @@ import os from PyQt4 import QtCore, QtGui -from openlp.core.lib import Registry +from openlp.core.common import Registry class ListWidgetWithDnD(QtGui.QListWidget): diff --git a/openlp/core/lib/mediamanageritem.py b/openlp/core/lib/mediamanageritem.py index 22f03355f..e8f617bea 100644 --- a/openlp/core/lib/mediamanageritem.py +++ b/openlp/core/lib/mediamanageritem.py @@ -35,9 +35,9 @@ import re from PyQt4 import QtCore, QtGui -from openlp.core.common import Settings, UiStrings, translate +from openlp.core.common import Registry, Settings, UiStrings, translate from openlp.core.lib import FileDialog, OpenLPToolbar, ServiceItem, StringContent, ListWidgetWithDnD, \ - ServiceItemContext, Registry + ServiceItemContext from openlp.core.lib.searchedit import SearchEdit from openlp.core.lib.ui import create_widget_action, critical_error_message_box diff --git a/openlp/core/lib/plugin.py b/openlp/core/lib/plugin.py index 2e6f42c6b..45359f01b 100644 --- a/openlp/core/lib/plugin.py +++ b/openlp/core/lib/plugin.py @@ -34,8 +34,7 @@ import os from PyQt4 import QtCore -from openlp.core.common import Settings, UiStrings -from openlp.core.lib import Registry +from openlp.core.common import Registry, Settings, UiStrings from openlp.core.utils import get_application_version log = logging.getLogger(__name__) diff --git a/openlp/core/lib/pluginmanager.py b/openlp/core/lib/pluginmanager.py index af7126535..3f7143faf 100644 --- a/openlp/core/lib/pluginmanager.py +++ b/openlp/core/lib/pluginmanager.py @@ -34,8 +34,8 @@ import sys import logging import imp -from openlp.core.lib import Plugin, PluginStatus, Registry -from openlp.core.common import AppLocation +from openlp.core.lib import Plugin, PluginStatus +from openlp.core.common import AppLocation, Registry log = logging.getLogger(__name__) diff --git a/openlp/core/lib/registry.py b/openlp/core/lib/registry.py deleted file mode 100644 index 7a5f224cb..000000000 --- a/openlp/core/lib/registry.py +++ /dev/null @@ -1,167 +0,0 @@ -# -*- coding: utf-8 -*- -# vim: autoindent shiftwidth=4 expandtab textwidth=120 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 # -############################################################################### -""" -Provide Registry Services -""" -import logging -import sys - -log = logging.getLogger(__name__) - - -class Registry(object): - """ - This is the Component Registry. It is a singleton object and is used to provide a look up service for common - objects. - """ - log.info('Registry loaded') - __instance__ = None - - def __new__(cls): - """ - Re-implement the __new__ method to make sure we create a true singleton. - """ - if not cls.__instance__: - cls.__instance__ = object.__new__(cls) - return cls.__instance__ - - @classmethod - def create(cls): - """ - The constructor for the component registry providing a single registry of objects. - """ - log.info('Registry Initialising') - registry = cls() - registry.service_list = {} - registry.functions_list = {} - registry.running_under_test = False - # Allow the tests to remove Registry entries but not the live system - if 'nose' in sys.argv[0]: - registry.running_under_test = True - return registry - - def get(self, key): - """ - Extracts the registry value from the list based on the key passed in - - ``key`` - The service to be retrieved. - """ - if key in self.service_list: - return self.service_list[key] - else: - log.error('Service %s not found in list' % key) - raise KeyError('Service %s not found in list' % key) - - def register(self, key, reference): - """ - Registers a component against a key. - - ``key`` - The service to be created this is usually a major class like "renderer" or "main_window" . - - ``reference`` - The service address to be saved. - """ - if key in self.service_list: - log.error('Duplicate service exception %s' % key) - raise KeyError('Duplicate service exception %s' % key) - else: - self.service_list[key] = reference - - def remove(self, key): - """ - Removes the registry value from the list based on the key passed in (Only valid and active for testing - framework). - - ``key`` - The service to be deleted. - """ - if key in self.service_list: - del self.service_list[key] - - def register_function(self, event, function): - """ - Register an event and associated function to be called - - ``event`` - The function description like "live_display_hide" where a number of places in the code - will/may need to respond to a single action and the caller does not need to understand or know about the - recipients. - - ``function`` - The function to be called when the event happens. - """ - if event in self.functions_list: - self.functions_list[event].append(function) - else: - self.functions_list[event] = [function] - - def remove_function(self, event, function): - """ - Remove an event and associated handler - - ``event`` - The function description.. - - ``function`` - The function to be called when the event happens. - """ - if self.running_under_test is False: - log.error('Invalid Method call for key %s' % event) - raise KeyError('Invalid Method call for key %s' % event) - if event in self.functions_list: - self.functions_list[event].remove(function) - - def execute(self, event, *args, **kwargs): - """ - Execute all the handlers associated with the event and return an array of results. - - ``event`` - The function to be processed - - ``*args`` - Parameters to be passed to the function. - - ``*kwargs`` - Parameters to be passed to the function. - """ - results = [] - if event in self.functions_list: - for function in self.functions_list[event]: - try: - result = function(*args, **kwargs) - if result: - results.append(result) - except TypeError: - # Who has called me can help in debugging - import inspect - log.debug(inspect.currentframe().f_back.f_locals) - log.exception('Exception for function %s', function) - return results diff --git a/openlp/core/lib/renderer.py b/openlp/core/lib/renderer.py index b743f3962..3d98b21d1 100644 --- a/openlp/core/lib/renderer.py +++ b/openlp/core/lib/renderer.py @@ -31,9 +31,9 @@ import logging from PyQt4 import QtGui, QtCore, QtWebKit -from openlp.core.common import Settings -from openlp.core.lib import FormattingTags, ImageSource, ItemCapabilities, Registry, ScreenList, \ - ServiceItem, expand_tags, build_lyrics_format_css, build_lyrics_outline_css +from openlp.core.common import Registry, Settings +from openlp.core.lib import FormattingTags, ImageSource, ItemCapabilities, ScreenList, ServiceItem, expand_tags, \ + build_lyrics_format_css, build_lyrics_outline_css from openlp.core.common import ThemeLevel from openlp.core.ui import MainDisplay diff --git a/openlp/core/lib/screen.py b/openlp/core/lib/screen.py index ddae9fba1..43a35abbe 100644 --- a/openlp/core/lib/screen.py +++ b/openlp/core/lib/screen.py @@ -36,8 +36,7 @@ import copy from PyQt4 import QtCore -from openlp.core.common import Settings, translate -from openlp.core.lib import Registry +from openlp.core.common import Registry, Settings, translate log = logging.getLogger(__name__) diff --git a/openlp/core/lib/serviceitem.py b/openlp/core/lib/serviceitem.py index 789854c78..bfd759f42 100644 --- a/openlp/core/lib/serviceitem.py +++ b/openlp/core/lib/serviceitem.py @@ -39,8 +39,8 @@ import uuid from PyQt4 import QtGui -from openlp.core.common import Settings, translate -from openlp.core.lib import ImageSource, Registry, build_icon, clean_tags, expand_tags +from openlp.core.common import Registry, Settings, translate +from openlp.core.lib import ImageSource, build_icon, clean_tags, expand_tags log = logging.getLogger(__name__) diff --git a/openlp/core/lib/settingstab.py b/openlp/core/lib/settingstab.py index f65788cec..ab42ab1b5 100644 --- a/openlp/core/lib/settingstab.py +++ b/openlp/core/lib/settingstab.py @@ -35,7 +35,7 @@ own tab to the settings dialog. from PyQt4 import QtGui -from openlp.core.lib import Registry +from openlp.core.common import Registry class SettingsTab(QtGui.QWidget): diff --git a/openlp/core/lib/treewidgetwithdnd.py b/openlp/core/lib/treewidgetwithdnd.py index d2dead852..120353010 100644 --- a/openlp/core/lib/treewidgetwithdnd.py +++ b/openlp/core/lib/treewidgetwithdnd.py @@ -33,7 +33,7 @@ import os from PyQt4 import QtCore, QtGui -from openlp.core.lib import Registry +from openlp.core.common import Registry class TreeWidgetWithDnD(QtGui.QTreeWidget): diff --git a/openlp/core/lib/ui.py b/openlp/core/lib/ui.py index 631187505..c7b427602 100644 --- a/openlp/core/lib/ui.py +++ b/openlp/core/lib/ui.py @@ -33,8 +33,8 @@ import logging from PyQt4 import QtCore, QtGui -from openlp.core.common import UiStrings, translate -from openlp.core.lib import Registry, build_icon +from openlp.core.common import Registry, UiStrings, translate +from openlp.core.lib import build_icon from openlp.core.utils.actions import ActionList diff --git a/openlp/core/ui/exceptionform.py b/openlp/core/ui/exceptionform.py index f1e57a545..4a5141460 100644 --- a/openlp/core/ui/exceptionform.py +++ b/openlp/core/ui/exceptionform.py @@ -38,7 +38,7 @@ import bs4 import sqlalchemy from lxml import etree -from openlp.core.lib import Registry +from openlp.core.common import Registry from PyQt4 import Qt, QtCore, QtGui, QtWebKit diff --git a/openlp/core/ui/filerenameform.py b/openlp/core/ui/filerenameform.py index 90fb8c648..3df986dbc 100644 --- a/openlp/core/ui/filerenameform.py +++ b/openlp/core/ui/filerenameform.py @@ -34,8 +34,7 @@ from PyQt4 import QtGui from .filerenamedialog import Ui_FileRenameDialog -from openlp.core.common import translate -from openlp.core.lib import Registry +from openlp.core.common import Registry, translate class FileRenameForm(QtGui.QDialog, Ui_FileRenameDialog): diff --git a/openlp/core/ui/firsttimeform.py b/openlp/core/ui/firsttimeform.py index e48395000..33d4c60c2 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.common import AppLocation, Settings, check_directory_exists, translate -from openlp.core.lib import PluginStatus, Registry, build_icon +from openlp.core.common import Registry, AppLocation, Settings, check_directory_exists, translate +from openlp.core.lib import PluginStatus, build_icon from openlp.core.utils import get_web_page from .firsttimewizard import Ui_FirstTimeWizard, FirstTimePage diff --git a/openlp/core/ui/generaltab.py b/openlp/core/ui/generaltab.py index 2e758ed34..0167fdb15 100644 --- a/openlp/core/ui/generaltab.py +++ b/openlp/core/ui/generaltab.py @@ -33,8 +33,8 @@ import logging from PyQt4 import QtCore, QtGui -from openlp.core.common import Settings, UiStrings, translate -from openlp.core.lib import Registry, SettingsTab, ScreenList +from openlp.core.common import Registry, Settings, UiStrings, translate +from openlp.core.lib import SettingsTab, ScreenList log = logging.getLogger(__name__) diff --git a/openlp/core/ui/listpreviewwidget.py b/openlp/core/ui/listpreviewwidget.py index 5a9b6d119..fd9cc95f2 100644 --- a/openlp/core/ui/listpreviewwidget.py +++ b/openlp/core/ui/listpreviewwidget.py @@ -33,7 +33,8 @@ It is based on a QTableWidget but represents its contents in list form. from PyQt4 import QtCore, QtGui -from openlp.core.lib import ImageSource, Registry, ServiceItem +from openlp.core.common import Registry +from openlp.core.lib import ImageSource, ServiceItem class ListPreviewWidget(QtGui.QTableWidget): diff --git a/openlp/core/ui/maindisplay.py b/openlp/core/ui/maindisplay.py index af9e38f15..0e6b27454 100644 --- a/openlp/core/ui/maindisplay.py +++ b/openlp/core/ui/maindisplay.py @@ -44,8 +44,8 @@ import sys from PyQt4 import QtCore, QtGui, QtWebKit, QtOpenGL from PyQt4.phonon import Phonon -from openlp.core.common import Settings, translate -from openlp.core.lib import ServiceItem, ImageSource, Registry, build_html, expand_tags, image_to_byte +from openlp.core.common import Registry, Settings, translate +from openlp.core.lib import ServiceItem, ImageSource, build_html, expand_tags, image_to_byte 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 3382d281d..a7cc27a21 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -41,8 +41,9 @@ from datetime import datetime from PyQt4 import QtCore, QtGui -from openlp.core.lib import Renderer, OpenLPDockWidget, PluginManager, ImageManager, PluginStatus, Registry, \ - ScreenList, build_icon +from openlp.core.common import Registry +from openlp.core.lib import Renderer, OpenLPDockWidget, PluginManager, ImageManager, PluginStatus, ScreenList, \ + build_icon from openlp.core.lib.ui import UiStrings, create_action from openlp.core.ui import AboutForm, SettingsForm, ServiceManager, ThemeManager, SlideController, PluginForm, \ MediaDockManager, ShortcutListForm, FormattingTagForm diff --git a/openlp/core/ui/media/mediacontroller.py b/openlp/core/ui/media/mediacontroller.py index eb2d932ee..bedabc422 100644 --- a/openlp/core/ui/media/mediacontroller.py +++ b/openlp/core/ui/media/mediacontroller.py @@ -35,8 +35,8 @@ import os import datetime from PyQt4 import QtCore, QtGui -from openlp.core.common import Settings, UiStrings, translate -from openlp.core.lib import OpenLPToolbar, Registry +from openlp.core.common import Registry, Settings, UiStrings, translate +from openlp.core.lib import OpenLPToolbar 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 diff --git a/openlp/core/ui/media/mediaplayer.py b/openlp/core/ui/media/mediaplayer.py index f87091038..d186d17dd 100644 --- a/openlp/core/ui/media/mediaplayer.py +++ b/openlp/core/ui/media/mediaplayer.py @@ -31,7 +31,7 @@ The :mod:`~openlp.core.ui.media.mediaplayer` module contains the MediaPlayer cla """ import os -from openlp.core.lib import Registry +from openlp.core.common import Registry from openlp.core.ui.media import MediaState diff --git a/openlp/core/ui/media/playertab.py b/openlp/core/ui/media/playertab.py index 4aa9feb0f..ac1e65260 100644 --- a/openlp/core/ui/media/playertab.py +++ b/openlp/core/ui/media/playertab.py @@ -31,8 +31,8 @@ The :mod:`~openlp.core.ui.media.playertab` module holds the configuration tab fo """ from PyQt4 import QtCore, QtGui -from openlp.core.common import Settings, UiStrings, translate -from openlp.core.lib import Registry, SettingsTab +from openlp.core.common import Registry, Settings, UiStrings, translate +from openlp.core.lib import SettingsTab 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/pluginform.py b/openlp/core/ui/pluginform.py index 504f04d59..9fb37f683 100644 --- a/openlp/core/ui/pluginform.py +++ b/openlp/core/ui/pluginform.py @@ -34,8 +34,8 @@ import os from PyQt4 import QtGui -from openlp.core.common import translate -from openlp.core.lib import PluginStatus, Registry +from openlp.core.common import Registry, translate +from openlp.core.lib import PluginStatus from .plugindialog import Ui_PluginViewDialog log = logging.getLogger(__name__) diff --git a/openlp/core/ui/printserviceform.py b/openlp/core/ui/printserviceform.py index 6c2dab2be..9a91535fc 100644 --- a/openlp/core/ui/printserviceform.py +++ b/openlp/core/ui/printserviceform.py @@ -36,8 +36,8 @@ import os from PyQt4 import QtCore, QtGui from lxml import html -from openlp.core.common import Settings, UiStrings, translate -from openlp.core.lib import Registry, get_text_file_string +from openlp.core.common import Registry, Settings, UiStrings, translate +from openlp.core.lib import get_text_file_string from openlp.core.ui.printservicedialog import Ui_PrintServiceDialog, ZoomSize from openlp.core.common import AppLocation diff --git a/openlp/core/ui/serviceitemeditform.py b/openlp/core/ui/serviceitemeditform.py index 3e4b053cc..dc032110a 100644 --- a/openlp/core/ui/serviceitemeditform.py +++ b/openlp/core/ui/serviceitemeditform.py @@ -30,7 +30,7 @@ The service item edit dialog """ from PyQt4 import QtGui -from openlp.core.lib import Registry +from openlp.core.common import Registry from .serviceitemeditdialog import Ui_ServiceItemEditDialog diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index 58904fd98..eecee87e7 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.common import AppLocation, Settings, ThemeLevel, check_directory_exists, UiStrings, translate -from openlp.core.lib import OpenLPToolbar, ServiceItem, ItemCapabilities, PluginStatus, Registry, build_icon +from openlp.core.common import Registry, AppLocation, Settings, ThemeLevel, check_directory_exists, UiStrings, translate +from openlp.core.lib import OpenLPToolbar, ServiceItem, ItemCapabilities, PluginStatus, build_icon from openlp.core.lib.ui import critical_error_message_box, create_widget_action, find_and_set_in_combo_box from openlp.core.ui import ServiceNoteForm, ServiceItemEditForm, StartTimeForm from openlp.core.ui.printserviceform import PrintServiceForm diff --git a/openlp/core/ui/servicenoteform.py b/openlp/core/ui/servicenoteform.py index 18998c78d..40683c7bc 100644 --- a/openlp/core/ui/servicenoteform.py +++ b/openlp/core/ui/servicenoteform.py @@ -31,8 +31,8 @@ The :mod:`~openlp.core.ui.servicenoteform` module contains the `ServiceNoteForm` """ from PyQt4 import QtGui -from openlp.core.common import translate -from openlp.core.lib import SpellTextEdit, Registry +from openlp.core.common import Registry, translate +from openlp.core.lib import SpellTextEdit from openlp.core.lib.ui import create_button_box diff --git a/openlp/core/ui/settingsform.py b/openlp/core/ui/settingsform.py index 2e4d918dd..a695e4ff2 100644 --- a/openlp/core/ui/settingsform.py +++ b/openlp/core/ui/settingsform.py @@ -33,7 +33,8 @@ import logging from PyQt4 import QtGui -from openlp.core.lib import PluginStatus, Registry, build_icon +from openlp.core.common import Registry +from openlp.core.lib import PluginStatus, build_icon from openlp.core.ui import AdvancedTab, GeneralTab, ThemesTab from openlp.core.ui.media import PlayerTab from .settingsdialog import Ui_SettingsDialog diff --git a/openlp/core/ui/shortcutlistform.py b/openlp/core/ui/shortcutlistform.py index fb459824d..fa23cfaf5 100644 --- a/openlp/core/ui/shortcutlistform.py +++ b/openlp/core/ui/shortcutlistform.py @@ -33,8 +33,7 @@ import re from PyQt4 import QtCore, QtGui -from openlp.core.lib import Registry -from openlp.core.common import Settings, translate +from openlp.core.common import Registry, Settings, translate from openlp.core.utils.actions import ActionList from .shortcutlistdialog import Ui_ShortcutListDialog diff --git a/openlp/core/ui/slidecontroller.py b/openlp/core/ui/slidecontroller.py index 043838f36..9e442bd3d 100644 --- a/openlp/core/ui/slidecontroller.py +++ b/openlp/core/ui/slidecontroller.py @@ -37,8 +37,8 @@ from collections import deque from PyQt4 import QtCore, QtGui -from openlp.core.common import Settings, SlideLimits, UiStrings, translate -from openlp.core.lib import OpenLPToolbar, ItemCapabilities, ServiceItem, ImageSource, ServiceItemAction, Registry, \ +from openlp.core.common import Registry, Settings, SlideLimits, UiStrings, translate +from openlp.core.lib import OpenLPToolbar, ItemCapabilities, ServiceItem, ImageSource, ServiceItemAction, \ ScreenList, build_icon, build_html from openlp.core.ui import HideMode, MainDisplay, Display, DisplayControllerType from openlp.core.lib.ui import create_action diff --git a/openlp/core/ui/starttimeform.py b/openlp/core/ui/starttimeform.py index 308453978..da64100b9 100644 --- a/openlp/core/ui/starttimeform.py +++ b/openlp/core/ui/starttimeform.py @@ -33,8 +33,7 @@ from PyQt4 import QtGui from .starttimedialog import Ui_StartTimeDialog -from openlp.core.common import UiStrings, translate -from openlp.core.lib import Registry +from openlp.core.common import Registry, UiStrings, translate from openlp.core.lib.ui import critical_error_message_box diff --git a/openlp/core/ui/themeform.py b/openlp/core/ui/themeform.py index 46f632827..e924ebf56 100644 --- a/openlp/core/ui/themeform.py +++ b/openlp/core/ui/themeform.py @@ -34,8 +34,7 @@ import os from PyQt4 import QtCore, QtGui -from openlp.core.common import UiStrings, translate -from openlp.core.lib import Registry +from openlp.core.common import Registry, UiStrings, 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 68f5acceb..a5ae59f81 100644 --- a/openlp/core/ui/thememanager.py +++ b/openlp/core/ui/thememanager.py @@ -37,8 +37,8 @@ import logging from xml.etree.ElementTree import ElementTree, XML from PyQt4 import QtCore, QtGui -from openlp.core.common import AppLocation, Settings, check_directory_exists, UiStrings, translate -from openlp.core.lib import FileDialog, ImageSource, OpenLPToolbar, Registry, get_text_file_string, build_icon, \ +from openlp.core.common import Registry, AppLocation, Settings, check_directory_exists, UiStrings, translate +from openlp.core.lib import FileDialog, ImageSource, OpenLPToolbar, get_text_file_string, build_icon, \ check_item_selected, create_thumb, validate_thumb from openlp.core.lib.theme import ThemeXML, BackgroundType from openlp.core.lib.ui import critical_error_message_box, create_widget_action diff --git a/openlp/core/ui/themestab.py b/openlp/core/ui/themestab.py index be06f6ffc..85715664d 100644 --- a/openlp/core/ui/themestab.py +++ b/openlp/core/ui/themestab.py @@ -33,8 +33,8 @@ The Themes configuration tab from PyQt4 import QtCore, QtGui -from openlp.core.common import Settings, ThemeLevel, UiStrings, translate -from openlp.core.lib import Registry, SettingsTab +from openlp.core.common import Registry, Settings, ThemeLevel, UiStrings, translate +from openlp.core.lib import SettingsTab from openlp.core.lib.ui import find_and_set_in_combo_box diff --git a/openlp/core/ui/wizard.py b/openlp/core/ui/wizard.py index 255695a65..8dfe6acb9 100644 --- a/openlp/core/ui/wizard.py +++ b/openlp/core/ui/wizard.py @@ -34,8 +34,8 @@ import os from PyQt4 import QtGui -from openlp.core.common import Settings, UiStrings, translate -from openlp.core.lib import Registry, build_icon +from openlp.core.common import Registry, Settings, UiStrings, translate +from openlp.core.lib import build_icon from openlp.core.lib.ui import add_welcome_page log = logging.getLogger(__name__) diff --git a/openlp/core/utils/__init__.py b/openlp/core/utils/__init__.py index 6ceb592f4..b74367ff2 100644 --- a/openlp/core/utils/__init__.py +++ b/openlp/core/utils/__init__.py @@ -43,8 +43,7 @@ import urllib.parse from PyQt4 import QtGui, QtCore -from openlp.core.common import AppLocation, Settings -from openlp.core.lib import Registry +from openlp.core.common import Registry, AppLocation, Settings if sys.platform != 'win32' and sys.platform != 'darwin': diff --git a/openlp/plugins/alerts/lib/alertsmanager.py b/openlp/plugins/alerts/lib/alertsmanager.py index 88341b77a..c1b6a93bc 100644 --- a/openlp/plugins/alerts/lib/alertsmanager.py +++ b/openlp/plugins/alerts/lib/alertsmanager.py @@ -35,8 +35,7 @@ import logging from PyQt4 import QtCore -from openlp.core.common import translate -from openlp.core.lib import Registry +from openlp.core.common import Registry, translate log = logging.getLogger(__name__) diff --git a/openlp/plugins/bibles/forms/bibleupgradeform.py b/openlp/plugins/bibles/forms/bibleupgradeform.py index cc164363b..296ce2bcd 100644 --- a/openlp/plugins/bibles/forms/bibleupgradeform.py +++ b/openlp/plugins/bibles/forms/bibleupgradeform.py @@ -36,8 +36,7 @@ from tempfile import gettempdir from PyQt4 import QtCore, QtGui -from openlp.core.common import AppLocation, UiStrings, Settings, check_directory_exists, translate -from openlp.core.lib import Registry +from openlp.core.common import Registry, AppLocation, UiStrings, Settings, check_directory_exists, translate from openlp.core.lib.ui import critical_error_message_box from openlp.core.ui.wizard import OpenLPWizard, WizardStrings from openlp.core.utils import delete_file diff --git a/openlp/plugins/bibles/forms/editbibleform.py b/openlp/plugins/bibles/forms/editbibleform.py index 5e2c94f79..c4ba9d558 100644 --- a/openlp/plugins/bibles/forms/editbibleform.py +++ b/openlp/plugins/bibles/forms/editbibleform.py @@ -33,8 +33,7 @@ import re from PyQt4 import QtGui -from openlp.core.common import UiStrings, translate -from openlp.core.lib import Registry +from openlp.core.common 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/biblestab.py b/openlp/plugins/bibles/lib/biblestab.py index 807cb2195..5523672ef 100644 --- a/openlp/plugins/bibles/lib/biblestab.py +++ b/openlp/plugins/bibles/lib/biblestab.py @@ -31,8 +31,8 @@ import logging from PyQt4 import QtCore, QtGui -from openlp.core.common import Settings, UiStrings, translate -from openlp.core.lib import Registry, SettingsTab +from openlp.core.common import Registry, Settings, UiStrings, translate +from openlp.core.lib import SettingsTab 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 8aefcfa8b..0ed1333d0 100644 --- a/openlp/plugins/bibles/lib/db.py +++ b/openlp/plugins/bibles/lib/db.py @@ -38,8 +38,7 @@ from sqlalchemy import Column, ForeignKey, Table, or_, types, func from sqlalchemy.orm import class_mapper, mapper, relation from sqlalchemy.orm.exc import UnmappedClassError -from openlp.core.common import AppLocation, translate -from openlp.core.lib import Registry +from openlp.core.common import Registry, AppLocation, 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 clean_filename diff --git a/openlp/plugins/bibles/lib/http.py b/openlp/plugins/bibles/lib/http.py index 7c9c9808f..06d2e5060 100644 --- a/openlp/plugins/bibles/lib/http.py +++ b/openlp/plugins/bibles/lib/http.py @@ -38,8 +38,7 @@ from html.parser import HTMLParseError from bs4 import BeautifulSoup, NavigableString, Tag -from openlp.core.common import translate -from openlp.core.lib import Registry +from openlp.core.common 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/manager.py b/openlp/plugins/bibles/lib/manager.py index f2feb238f..ad111cc3f 100644 --- a/openlp/plugins/bibles/lib/manager.py +++ b/openlp/plugins/bibles/lib/manager.py @@ -30,8 +30,7 @@ import logging import os -from openlp.core.common import AppLocation, Settings, translate -from openlp.core.lib import Registry +from openlp.core.common import Registry, AppLocation, Settings, translate from openlp.core.utils import 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 d0414d49c..8541fb40c 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.common import Settings, UiStrings, translate -from openlp.core.lib import Registry, MediaManagerItem, ItemCapabilities, ServiceItemContext, create_separated_list +from openlp.core.common import Registry, Settings, UiStrings, translate +from openlp.core.lib import MediaManagerItem, ItemCapabilities, ServiceItemContext, create_separated_list 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/editcustomform.py b/openlp/plugins/custom/forms/editcustomform.py index f4d8eac14..a0498bc6d 100644 --- a/openlp/plugins/custom/forms/editcustomform.py +++ b/openlp/plugins/custom/forms/editcustomform.py @@ -31,7 +31,7 @@ import logging from PyQt4 import QtGui -from openlp.core.lib import Registry, translate +from openlp.core.common import Registry, translate from openlp.core.lib.ui import critical_error_message_box, find_and_set_in_combo_box from openlp.plugins.custom.lib import CustomXMLBuilder, CustomXMLParser from openlp.plugins.custom.lib.db import CustomSlide diff --git a/openlp/plugins/custom/lib/mediaitem.py b/openlp/plugins/custom/lib/mediaitem.py index 386045b40..9ddb8f5cc 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.common import Settings, UiStrings, translate -from openlp.core.lib import Registry, MediaManagerItem, ItemCapabilities, ServiceItemContext, PluginStatus,\ +from openlp.core.common import Registry, Settings, UiStrings, translate +from openlp.core.lib import MediaManagerItem, ItemCapabilities, ServiceItemContext, PluginStatus,\ check_item_selected from openlp.plugins.custom.forms.editcustomform import EditCustomForm from openlp.plugins.custom.lib import CustomXMLParser, CustomXMLBuilder diff --git a/openlp/plugins/images/imageplugin.py b/openlp/plugins/images/imageplugin.py index 137610c1f..db94a4a90 100644 --- a/openlp/plugins/images/imageplugin.py +++ b/openlp/plugins/images/imageplugin.py @@ -31,8 +31,8 @@ from PyQt4 import QtGui import logging -from openlp.core.common import Settings, translate -from openlp.core.lib import Plugin, StringContent, Registry, ImageSource, build_icon +from openlp.core.common import Registry, Settings, translate +from openlp.core.lib import Plugin, StringContent, ImageSource, build_icon from openlp.core.lib.db import Manager from openlp.plugins.images.lib import ImageMediaItem, ImageTab from openlp.plugins.images.lib.db import init_schema diff --git a/openlp/plugins/images/lib/mediaitem.py b/openlp/plugins/images/lib/mediaitem.py index f1e0bfdb4..b39a0e559 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.common import AppLocation, Settings, UiStrings, check_directory_exists, translate -from openlp.core.lib import ItemCapabilities, MediaManagerItem, Registry, ServiceItemContext, \ - StringContent, TreeWidgetWithDnD, build_icon, check_item_selected, create_thumb, validate_thumb +from openlp.core.common import Registry, AppLocation, Settings, UiStrings, check_directory_exists, translate +from openlp.core.lib import ItemCapabilities, MediaManagerItem, ServiceItemContext, StringContent, TreeWidgetWithDnD,\ + build_icon, check_item_selected, create_thumb, validate_thumb from openlp.core.lib.ui import create_widget_action, critical_error_message_box from openlp.core.utils import delete_file, get_locale_key, get_images_filter from openlp.plugins.images.forms import AddGroupForm, ChooseGroupForm diff --git a/openlp/plugins/media/lib/mediaitem.py b/openlp/plugins/media/lib/mediaitem.py index 3d2d5b26e..5744ee069 100644 --- a/openlp/plugins/media/lib/mediaitem.py +++ b/openlp/plugins/media/lib/mediaitem.py @@ -32,8 +32,8 @@ import os from PyQt4 import QtCore, QtGui -from openlp.core.common import AppLocation, Settings, check_directory_exists, UiStrings, translate -from openlp.core.lib import ItemCapabilities, MediaManagerItem,MediaType, Registry, ServiceItem, ServiceItemContext, \ +from openlp.core.common import Registry, AppLocation, Settings, check_directory_exists, UiStrings, translate +from openlp.core.lib import ItemCapabilities, MediaManagerItem,MediaType, ServiceItem, ServiceItemContext, \ build_icon, check_item_selected from openlp.core.lib.ui import critical_error_message_box, create_horizontal_adjusting_combo_box from openlp.core.ui import DisplayController, Display, DisplayControllerType diff --git a/openlp/plugins/media/mediaplugin.py b/openlp/plugins/media/mediaplugin.py index d6a943832..558127b1e 100644 --- a/openlp/plugins/media/mediaplugin.py +++ b/openlp/plugins/media/mediaplugin.py @@ -31,8 +31,8 @@ import logging from PyQt4 import QtCore -from openlp.core.common import translate -from openlp.core.lib import Plugin, Registry, StringContent, build_icon +from openlp.core.common import Registry, translate +from openlp.core.lib import Plugin, StringContent, build_icon from openlp.plugins.media.lib import MediaMediaItem, MediaTab diff --git a/openlp/plugins/presentations/lib/mediaitem.py b/openlp/plugins/presentations/lib/mediaitem.py index e5aea43c5..28f2a70cc 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.common import Settings, UiStrings, translate -from openlp.core.lib import MediaManagerItem, Registry, ItemCapabilities, ServiceItemContext,\ +from openlp.core.common import Registry, Settings, UiStrings, translate +from openlp.core.lib import MediaManagerItem, ItemCapabilities, ServiceItemContext,\ build_icon, check_item_selected, create_thumb, validate_thumb from openlp.core.lib.ui import critical_error_message_box, create_horizontal_adjusting_combo_box from openlp.core.utils import get_locale_key diff --git a/openlp/plugins/presentations/lib/messagelistener.py b/openlp/plugins/presentations/lib/messagelistener.py index 259e65281..dcc43103b 100644 --- a/openlp/plugins/presentations/lib/messagelistener.py +++ b/openlp/plugins/presentations/lib/messagelistener.py @@ -31,7 +31,7 @@ import logging from PyQt4 import QtCore -from openlp.core.lib import Registry +from openlp.core.common import Registry from openlp.core.ui import HideMode log = logging.getLogger(__name__) diff --git a/openlp/plugins/presentations/lib/presentationcontroller.py b/openlp/plugins/presentations/lib/presentationcontroller.py index 9990d3f66..3c593bb5e 100644 --- a/openlp/plugins/presentations/lib/presentationcontroller.py +++ b/openlp/plugins/presentations/lib/presentationcontroller.py @@ -33,8 +33,8 @@ import shutil from PyQt4 import QtCore -from openlp.core.common import AppLocation, Settings, check_directory_exists -from openlp.core.lib import Registry, create_thumb, validate_thumb +from openlp.core.common import Registry, AppLocation, Settings, check_directory_exists +from openlp.core.lib import create_thumb, validate_thumb log = logging.getLogger(__name__) diff --git a/openlp/plugins/remotes/lib/httprouter.py b/openlp/plugins/remotes/lib/httprouter.py index deba92c10..2758f9c27 100644 --- a/openlp/plugins/remotes/lib/httprouter.py +++ b/openlp/plugins/remotes/lib/httprouter.py @@ -124,8 +124,8 @@ from urllib.parse import urlparse, parse_qs from mako.template import Template from PyQt4 import QtCore -from openlp.core.common import AppLocation, Settings, translate -from openlp.core.lib import Registry, PluginStatus, StringContent, image_to_byte +from openlp.core.common import Registry, AppLocation, Settings, translate +from openlp.core.lib import PluginStatus, StringContent, image_to_byte log = logging.getLogger(__name__) FILE_TYPES = { diff --git a/openlp/plugins/songs/forms/duplicatesongremovalform.py b/openlp/plugins/songs/forms/duplicatesongremovalform.py index f4121c85a..5e4af38bf 100644 --- a/openlp/plugins/songs/forms/duplicatesongremovalform.py +++ b/openlp/plugins/songs/forms/duplicatesongremovalform.py @@ -35,7 +35,7 @@ import os from PyQt4 import QtCore, QtGui -from openlp.core.lib import Registry, translate +from openlp.core.common import Registry, translate from openlp.core.ui.wizard import OpenLPWizard, WizardStrings from openlp.plugins.songs.lib import delete_song from openlp.plugins.songs.lib.db import Song, MediaFile diff --git a/openlp/plugins/songs/forms/editsongform.py b/openlp/plugins/songs/forms/editsongform.py index e14652765..bc8ee0351 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.common import AppLocation, UiStrings, check_directory_exists, translate -from openlp.core.lib import FileDialog, Registry, PluginStatus, MediaType, create_separated_list +from openlp.core.common import Registry, AppLocation, UiStrings, check_directory_exists, translate +from openlp.core.lib import FileDialog, PluginStatus, MediaType, create_separated_list from openlp.core.lib.ui import set_case_insensitive_completer, critical_error_message_box, find_and_set_in_combo_box from openlp.plugins.songs.lib import VerseType, clean_song from openlp.plugins.songs.lib.db import Book, Song, Author, Topic, MediaFile diff --git a/openlp/plugins/songs/forms/songexportform.py b/openlp/plugins/songs/forms/songexportform.py index f0b9262a7..abeb55f43 100644 --- a/openlp/plugins/songs/forms/songexportform.py +++ b/openlp/plugins/songs/forms/songexportform.py @@ -34,8 +34,8 @@ import logging from PyQt4 import QtCore, QtGui -from openlp.core.common import UiStrings, translate -from openlp.core.lib import Registry, create_separated_list, build_icon +from openlp.core.common import Registry, UiStrings, translate +from openlp.core.lib import create_separated_list, build_icon from openlp.core.lib.ui import critical_error_message_box from openlp.core.ui.wizard import OpenLPWizard, WizardStrings from openlp.plugins.songs.lib.db import Song diff --git a/openlp/plugins/songs/forms/songimportform.py b/openlp/plugins/songs/forms/songimportform.py index 5976b41bc..4c39538ce 100644 --- a/openlp/plugins/songs/forms/songimportform.py +++ b/openlp/plugins/songs/forms/songimportform.py @@ -35,9 +35,8 @@ import os from PyQt4 import QtCore, QtGui -from openlp.core.common import UiStrings, translate -from openlp.core.common import Settings -from openlp.core.lib import FileDialog, Registry +from openlp.core.common import Registry, Settings, UiStrings, translate +from openlp.core.lib import FileDialog 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/songmaintenanceform.py b/openlp/plugins/songs/forms/songmaintenanceform.py index 142cca1e7..aded07c28 100644 --- a/openlp/plugins/songs/forms/songmaintenanceform.py +++ b/openlp/plugins/songs/forms/songmaintenanceform.py @@ -32,8 +32,7 @@ import os from PyQt4 import QtGui, QtCore from sqlalchemy.sql import and_ -from openlp.core.common import UiStrings, translate -from openlp.core.lib import Registry +from openlp.core.common import Registry, UiStrings, translate from openlp.core.lib.ui import critical_error_message_box from openlp.plugins.songs.forms.authorsform import AuthorsForm from openlp.plugins.songs.forms.topicsform import TopicsForm diff --git a/openlp/plugins/songs/lib/mediaitem.py b/openlp/plugins/songs/lib/mediaitem.py index b8b1b5dcd..ef6cc0d2b 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.common import AppLocation, Settings, check_directory_exists, UiStrings, translate -from openlp.core.lib import Registry, MediaManagerItem, ItemCapabilities, PluginStatus, ServiceItemContext, \ +from openlp.core.common import Registry, AppLocation, Settings, check_directory_exists, UiStrings, translate +from openlp.core.lib import MediaManagerItem, ItemCapabilities, PluginStatus, ServiceItemContext, \ check_item_selected, create_separated_list from openlp.core.lib.ui import create_widget_action from openlp.plugins.songs.forms.editsongform import EditSongForm diff --git a/openlp/plugins/songs/lib/openlyricsexport.py b/openlp/plugins/songs/lib/openlyricsexport.py index 8f927dd8c..c08a0f366 100644 --- a/openlp/plugins/songs/lib/openlyricsexport.py +++ b/openlp/plugins/songs/lib/openlyricsexport.py @@ -35,8 +35,7 @@ import os from lxml import etree -from openlp.core.common import check_directory_exists, translate -from openlp.core.lib import Registry +from openlp.core.common import Registry, check_directory_exists, translate from openlp.core.utils import clean_filename from openlp.plugins.songs.lib.xml import OpenLyrics diff --git a/openlp/plugins/songs/lib/songimport.py b/openlp/plugins/songs/lib/songimport.py index ead897e0e..b4ad7bb01 100644 --- a/openlp/plugins/songs/lib/songimport.py +++ b/openlp/plugins/songs/lib/songimport.py @@ -34,8 +34,7 @@ import os from PyQt4 import QtCore -from openlp.core.common import AppLocation, check_directory_exists, translate -from openlp.core.lib import Registry +from openlp.core.common import Registry, AppLocation, check_directory_exists, translate from openlp.core.ui.wizard import WizardStrings from openlp.plugins.songs.lib import clean_song, VerseType from openlp.plugins.songs.lib.db import Song, Author, Topic, Book, MediaFile diff --git a/openlp/plugins/songusage/forms/songusagedeleteform.py b/openlp/plugins/songusage/forms/songusagedeleteform.py index babd9d178..451c5f9bc 100644 --- a/openlp/plugins/songusage/forms/songusagedeleteform.py +++ b/openlp/plugins/songusage/forms/songusagedeleteform.py @@ -29,8 +29,7 @@ from PyQt4 import QtGui -from openlp.core.common import translate -from openlp.core.lib import Registry +from openlp.core.common import Registry, translate from openlp.plugins.songusage.lib.db import SongUsageItem from .songusagedeletedialog import Ui_SongUsageDeleteDialog diff --git a/openlp/plugins/songusage/forms/songusagedetailform.py b/openlp/plugins/songusage/forms/songusagedetailform.py index 6ff73b068..928510b98 100644 --- a/openlp/plugins/songusage/forms/songusagedetailform.py +++ b/openlp/plugins/songusage/forms/songusagedetailform.py @@ -33,8 +33,7 @@ import os from PyQt4 import QtGui from sqlalchemy.sql import and_ -from openlp.core.common import Settings, check_directory_exists, translate -from openlp.core.lib import Registry +from openlp.core.common import Registry, Settings, check_directory_exists, translate from openlp.plugins.songusage.lib.db import SongUsageItem from .songusagedetaildialog import Ui_SongUsageDetailDialog diff --git a/openlp/plugins/songusage/songusageplugin.py b/openlp/plugins/songusage/songusageplugin.py index 077b81155..79e4e9505 100644 --- a/openlp/plugins/songusage/songusageplugin.py +++ b/openlp/plugins/songusage/songusageplugin.py @@ -32,8 +32,8 @@ from datetime import datetime from PyQt4 import QtCore, QtGui -from openlp.core.common import Settings, translate -from openlp.core.lib import Plugin, Registry, StringContent, build_icon +from openlp.core.common import Registry, Settings, translate +from openlp.core.lib import Plugin, StringContent, build_icon from openlp.core.lib.db import Manager from openlp.core.lib.ui import create_action from openlp.core.utils.actions import ActionList diff --git a/tests/functional/openlp_core_lib/test_image_manager.py b/tests/functional/openlp_core_lib/test_image_manager.py index 472011884..657e5f0de 100644 --- a/tests/functional/openlp_core_lib/test_image_manager.py +++ b/tests/functional/openlp_core_lib/test_image_manager.py @@ -34,7 +34,8 @@ import os from unittest import TestCase from PyQt4 import QtGui -from openlp.core.lib import Registry, ImageManager, ScreenList +from openlp.core.common import Registry +from openlp.core.lib import ImageManager, ScreenList TEST_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', 'resources')) diff --git a/tests/functional/openlp_core_lib/test_pluginmanager.py b/tests/functional/openlp_core_lib/test_pluginmanager.py index 725efd29e..f0a75dcc9 100644 --- a/tests/functional/openlp_core_lib/test_pluginmanager.py +++ b/tests/functional/openlp_core_lib/test_pluginmanager.py @@ -31,9 +31,9 @@ Package to test the openlp.core.lib.pluginmanager package. """ from unittest import TestCase -from openlp.core.common import Settings +from openlp.core.common import Registry, Settings from openlp.core.lib.pluginmanager import PluginManager -from openlp.core.lib import Registry, PluginStatus +from openlp.core.lib import PluginStatus from tests.functional import MagicMock diff --git a/tests/functional/openlp_core_lib/test_registry.py b/tests/functional/openlp_core_lib/test_registry.py deleted file mode 100644 index 06307630b..000000000 --- a/tests/functional/openlp_core_lib/test_registry.py +++ /dev/null @@ -1,112 +0,0 @@ -# -*- coding: utf-8 -*- -# vim: autoindent shiftwidth=4 expandtab textwidth=120 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 # -############################################################################### -""" -Package to test the openlp.core.lib package. -""" -import os -from unittest import TestCase - -from openlp.core.lib import Registry -from tests.functional import MagicMock - -TEST_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', 'resources')) - - -class TestRegistry(TestCase): - - def registry_service_test(self): - """ - Test the registry creation and its usage - """ - # GIVEN: A new registry - Registry.create() - - # WHEN: I add a component it should save it - mock_1 = MagicMock() - Registry().register('test1', mock_1) - - # THEN: we should be able retrieve the saved component - assert Registry().get('test1') == mock_1, 'The saved service can be retrieved and matches' - - # WHEN: I add a component for the second time I am mad. - # THEN and I will get an exception - with self.assertRaises(KeyError) as context: - Registry().register('test1', mock_1) - self.assertEqual(context.exception.args[0], 'Duplicate service exception test1', - 'KeyError exception should have been thrown for duplicate service') - - # WHEN I try to get back a non existent component - # THEN I will get an exception - with self.assertRaises(KeyError) as context: - temp = Registry().get('test2') - self.assertEqual(context.exception.args[0], 'Service test2 not found in list', - 'KeyError exception should have been thrown for missing service') - - # WHEN I try to replace a component I should be allowed (testing only) - Registry().remove('test1') - # THEN I will get an exception - with self.assertRaises(KeyError) as context: - temp = Registry().get('test1') - self.assertEqual(context.exception.args[0], 'Service test1 not found in list', - 'KeyError exception should have been thrown for deleted service') - - def registry_function_test(self): - """ - Test the registry function creation and their usages - """ - # GIVEN: An existing registry register a function - Registry.create() - Registry().register_function('test1', self.dummy_function_1) - - # WHEN: I execute the function - return_value = Registry().execute('test1') - - # THEN: I expect then function to have been called and a return given - self.assertEqual(return_value[0], 'function_1', 'A return value is provided and matches') - - # WHEN: I execute the a function with the same reference and execute the function - Registry().register_function('test1', self.dummy_function_1) - return_value = Registry().execute('test1') - - # THEN: I expect then function to have been called and a return given - self.assertEqual(return_value, ['function_1', 'function_1'], 'A return value list is provided and matches') - - # WHEN: I execute the a 2nd function with the different reference and execute the function - Registry().register_function('test2', self.dummy_function_2) - return_value = Registry().execute('test2') - - # THEN: I expect then function to have been called and a return given - self.assertEqual(return_value[0], 'function_2', 'A return value is provided and matches') - - def dummy_function_1(self): - return "function_1" - - def dummy_function_2(self): - return "function_2" - diff --git a/tests/functional/openlp_core_lib/test_screen.py b/tests/functional/openlp_core_lib/test_screen.py index ba635ce83..dc55645c8 100644 --- a/tests/functional/openlp_core_lib/test_screen.py +++ b/tests/functional/openlp_core_lib/test_screen.py @@ -33,7 +33,8 @@ from unittest import TestCase from PyQt4 import QtGui, QtCore -from openlp.core.lib import Registry, ScreenList +from openlp.core.common import Registry +from openlp.core.lib import ScreenList from tests.functional import MagicMock SCREEN = { diff --git a/tests/functional/openlp_core_lib/test_serviceitem.py b/tests/functional/openlp_core_lib/test_serviceitem.py index 6893b8ca3..7b671086f 100644 --- a/tests/functional/openlp_core_lib/test_serviceitem.py +++ b/tests/functional/openlp_core_lib/test_serviceitem.py @@ -36,7 +36,8 @@ from unittest import TestCase from tests.functional import MagicMock, patch from tests.utils import assert_length, convert_file_service_item -from openlp.core.lib import ItemCapabilities, ServiceItem, Registry +from openlp.core.common import Registry +from openlp.core.lib import ItemCapabilities, ServiceItem VERSE = 'The Lord said to {r}Noah{/r}: \n'\ diff --git a/tests/functional/openlp_plugins/images/test_lib.py b/tests/functional/openlp_plugins/images/test_lib.py index f4d0dc30d..0cb6567e5 100644 --- a/tests/functional/openlp_plugins/images/test_lib.py +++ b/tests/functional/openlp_plugins/images/test_lib.py @@ -31,7 +31,7 @@ This module contains tests for the lib submodule of the Images plugin. """ from unittest import TestCase -from openlp.core.lib import Registry +from openlp.core.common import Registry from openlp.plugins.images.lib.db import ImageFilenames, ImageGroups from openlp.plugins.images.lib.mediaitem import ImageMediaItem from tests.functional import MagicMock, patch diff --git a/tests/functional/openlp_plugins/presentations/test_mediaitem.py b/tests/functional/openlp_plugins/presentations/test_mediaitem.py index 5b5c99e78..435741fa0 100644 --- a/tests/functional/openlp_plugins/presentations/test_mediaitem.py +++ b/tests/functional/openlp_plugins/presentations/test_mediaitem.py @@ -33,7 +33,7 @@ from unittest import TestCase from PyQt4 import QtGui -from openlp.core.lib import Registry +from openlp.core.common import Registry from openlp.plugins.presentations.lib.mediaitem import PresentationMediaItem from tests.functional import patch, MagicMock diff --git a/tests/functional/openlp_plugins/songs/test_mediaitem.py b/tests/functional/openlp_plugins/songs/test_mediaitem.py index 45c62469c..a823c230e 100644 --- a/tests/functional/openlp_plugins/songs/test_mediaitem.py +++ b/tests/functional/openlp_plugins/songs/test_mediaitem.py @@ -7,8 +7,8 @@ from unittest import TestCase from PyQt4 import QtCore, QtGui -from openlp.core.common import Settings -from openlp.core.lib import Registry, ServiceItem +from openlp.core.common import Registry, Settings +from openlp.core.lib import ServiceItem from openlp.plugins.songs.lib.mediaitem import SongMediaItem from tests.functional import patch, MagicMock diff --git a/tests/interfaces/openlp_core_lib/test_pluginmanager.py b/tests/interfaces/openlp_core_lib/test_pluginmanager.py index e0ee8bfec..9e8dc534b 100644 --- a/tests/interfaces/openlp_core_lib/test_pluginmanager.py +++ b/tests/interfaces/openlp_core_lib/test_pluginmanager.py @@ -9,9 +9,8 @@ from unittest import TestCase from PyQt4 import QtGui -from openlp.core.common import Settings +from openlp.core.common import Registry, Settings from openlp.core.lib.pluginmanager import PluginManager -from openlp.core.lib import Registry from tests.interfaces import MagicMock diff --git a/tests/interfaces/openlp_core_ui/test_filerenamedialog.py b/tests/interfaces/openlp_core_ui/test_filerenamedialog.py index 5e151da77..fabefc427 100644 --- a/tests/interfaces/openlp_core_ui/test_filerenamedialog.py +++ b/tests/interfaces/openlp_core_ui/test_filerenamedialog.py @@ -5,7 +5,7 @@ from unittest import TestCase from PyQt4 import QtGui, QtTest -from openlp.core.lib import Registry +from openlp.core.common import Registry from openlp.core.ui import filerenameform from tests.interfaces import MagicMock, patch diff --git a/tests/interfaces/openlp_core_ui/test_listpreviewwidget.py b/tests/interfaces/openlp_core_ui/test_listpreviewwidget.py index 49d376797..f11ad6939 100644 --- a/tests/interfaces/openlp_core_ui/test_listpreviewwidget.py +++ b/tests/interfaces/openlp_core_ui/test_listpreviewwidget.py @@ -6,7 +6,8 @@ from unittest import TestCase from PyQt4 import QtGui -from openlp.core.lib import Registry, ServiceItem +from openlp.core.common import Registry +from openlp.core.lib import ServiceItem from openlp.core.ui import listpreviewwidget from tests.interfaces import MagicMock, patch from tests.utils.osdinteraction import read_service_from_file diff --git a/tests/interfaces/openlp_core_ui/test_mainwindow.py b/tests/interfaces/openlp_core_ui/test_mainwindow.py index 0a5c77361..b073b2219 100644 --- a/tests/interfaces/openlp_core_ui/test_mainwindow.py +++ b/tests/interfaces/openlp_core_ui/test_mainwindow.py @@ -5,7 +5,7 @@ from unittest import TestCase from PyQt4 import QtGui -from openlp.core.lib import Registry +from openlp.core.common import Registry from openlp.core.ui.mainwindow import MainWindow from tests.interfaces import MagicMock, patch diff --git a/tests/interfaces/openlp_core_ui/test_servicemanager.py b/tests/interfaces/openlp_core_ui/test_servicemanager.py index e8b6df94f..391c90b3e 100644 --- a/tests/interfaces/openlp_core_ui/test_servicemanager.py +++ b/tests/interfaces/openlp_core_ui/test_servicemanager.py @@ -6,7 +6,8 @@ from unittest import TestCase from PyQt4 import QtGui -from openlp.core.lib import Registry, ScreenList, ServiceItem +from openlp.core.common import Registry +from openlp.core.lib import ScreenList, ServiceItem from openlp.core.ui.mainwindow import MainWindow from tests.interfaces import MagicMock, patch diff --git a/tests/interfaces/openlp_core_ui/test_servicenotedialog.py b/tests/interfaces/openlp_core_ui/test_servicenotedialog.py index 336c94655..e8aa70ede 100644 --- a/tests/interfaces/openlp_core_ui/test_servicenotedialog.py +++ b/tests/interfaces/openlp_core_ui/test_servicenotedialog.py @@ -5,7 +5,7 @@ from unittest import TestCase from PyQt4 import QtCore, QtGui, QtTest -from openlp.core.lib import Registry +from openlp.core.common import Registry from openlp.core.ui import servicenoteform from tests.interfaces import patch diff --git a/tests/interfaces/openlp_core_ui/test_settings_form.py b/tests/interfaces/openlp_core_ui/test_settings_form.py index b9f032182..c475df994 100644 --- a/tests/interfaces/openlp_core_ui/test_settings_form.py +++ b/tests/interfaces/openlp_core_ui/test_settings_form.py @@ -5,8 +5,9 @@ from unittest import TestCase from PyQt4 import QtCore, QtTest, QtGui +from openlp.core.common import Registry from openlp.core.ui import settingsform -from openlp.core.lib import Registry, ScreenList +from openlp.core.lib import ScreenList from tests.interfaces import MagicMock, patch diff --git a/tests/interfaces/openlp_core_ui/test_starttimedialog.py b/tests/interfaces/openlp_core_ui/test_starttimedialog.py index de3d87910..211bd2219 100644 --- a/tests/interfaces/openlp_core_ui/test_starttimedialog.py +++ b/tests/interfaces/openlp_core_ui/test_starttimedialog.py @@ -5,7 +5,7 @@ from unittest import TestCase from PyQt4 import QtCore, QtGui, QtTest -from openlp.core.lib import Registry +from openlp.core.common import Registry from openlp.core.ui import starttimeform from tests.interfaces import MagicMock, patch diff --git a/tests/interfaces/openlp_plugins/bibles/test_lib_http.py b/tests/interfaces/openlp_plugins/bibles/test_lib_http.py index 54ad3bec1..386900a9b 100644 --- a/tests/interfaces/openlp_plugins/bibles/test_lib_http.py +++ b/tests/interfaces/openlp_plugins/bibles/test_lib_http.py @@ -3,7 +3,7 @@ """ from unittest import TestCase -from openlp.core.lib import Registry +from openlp.core.common import Registry from openlp.plugins.bibles.lib.http import BGExtract, CWExtract from tests.interfaces import MagicMock diff --git a/tests/interfaces/openlp_plugins/custom/forms/test_customform.py b/tests/interfaces/openlp_plugins/custom/forms/test_customform.py index ffa3ec884..e933bb17d 100644 --- a/tests/interfaces/openlp_plugins/custom/forms/test_customform.py +++ b/tests/interfaces/openlp_plugins/custom/forms/test_customform.py @@ -5,7 +5,7 @@ from unittest import TestCase from PyQt4 import QtGui, QtTest, QtCore -from openlp.core.lib import Registry +from openlp.core.common import Registry # Import needed due to import problems. from openlp.plugins.custom.lib.mediaitem import CustomMediaItem from openlp.plugins.custom.forms.editcustomform import EditCustomForm diff --git a/tests/interfaces/openlp_plugins/custom/forms/test_customslideform.py b/tests/interfaces/openlp_plugins/custom/forms/test_customslideform.py index 406b7e8a4..f98ae376e 100644 --- a/tests/interfaces/openlp_plugins/custom/forms/test_customslideform.py +++ b/tests/interfaces/openlp_plugins/custom/forms/test_customslideform.py @@ -5,7 +5,7 @@ from unittest import TestCase from PyQt4 import QtGui -from openlp.core.lib import Registry +from openlp.core.common import Registry from openlp.plugins.custom.forms.editcustomslideform import EditCustomSlideForm from tests.interfaces import MagicMock, patch diff --git a/tests/interfaces/openlp_plugins/songs/forms/test_authorsform.py b/tests/interfaces/openlp_plugins/songs/forms/test_authorsform.py index 62c058cd0..f4dc5c228 100644 --- a/tests/interfaces/openlp_plugins/songs/forms/test_authorsform.py +++ b/tests/interfaces/openlp_plugins/songs/forms/test_authorsform.py @@ -5,7 +5,7 @@ from unittest import TestCase from PyQt4 import QtGui -from openlp.core.lib import Registry +from openlp.core.common import Registry from openlp.plugins.songs.forms.authorsform import AuthorsForm diff --git a/tests/interfaces/openlp_plugins/songs/forms/test_editsongform.py b/tests/interfaces/openlp_plugins/songs/forms/test_editsongform.py index 75907e3c8..6804858a4 100644 --- a/tests/interfaces/openlp_plugins/songs/forms/test_editsongform.py +++ b/tests/interfaces/openlp_plugins/songs/forms/test_editsongform.py @@ -5,7 +5,7 @@ from unittest import TestCase from PyQt4 import QtGui -from openlp.core.lib import Registry +from openlp.core.common import Registry from openlp.plugins.songs.forms.editsongform import EditSongForm from tests.interfaces import MagicMock diff --git a/tests/interfaces/openlp_plugins/songs/forms/test_editverseform.py b/tests/interfaces/openlp_plugins/songs/forms/test_editverseform.py index 38a3b87bd..f047903bc 100644 --- a/tests/interfaces/openlp_plugins/songs/forms/test_editverseform.py +++ b/tests/interfaces/openlp_plugins/songs/forms/test_editverseform.py @@ -5,7 +5,7 @@ from unittest import TestCase from PyQt4 import QtCore, QtGui, QtTest -from openlp.core.lib import Registry +from openlp.core.common import Registry from openlp.plugins.songs.forms.editverseform import EditVerseForm diff --git a/tests/interfaces/openlp_plugins/songs/forms/test_topicsform.py b/tests/interfaces/openlp_plugins/songs/forms/test_topicsform.py index bc273d951..c8057c4ea 100644 --- a/tests/interfaces/openlp_plugins/songs/forms/test_topicsform.py +++ b/tests/interfaces/openlp_plugins/songs/forms/test_topicsform.py @@ -5,7 +5,7 @@ from unittest import TestCase from PyQt4 import QtGui -from openlp.core.lib import Registry +from openlp.core.common import Registry from openlp.plugins.songs.forms.topicsform import TopicsForm