From 3693cf331dfc909408ede690bbcd955a7b8045e8 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Thu, 31 Mar 2016 17:14:28 +0100 Subject: [PATCH 1/6] fix string in natural sort and move db --- openlp/core/{utils => common}/db.py | 0 openlp/core/utils/__init__.py | 4 +++- openlp/plugins/songs/lib/upgrade.py | 2 +- tests/functional/openlp_core/__init__.py | 0 .../{openlp_core_utils => openlp_core}/test_db.py | 10 +++++----- 5 files changed, 9 insertions(+), 7 deletions(-) rename openlp/core/{utils => common}/db.py (100%) create mode 100644 tests/functional/openlp_core/__init__.py rename tests/functional/{openlp_core_utils => openlp_core}/test_db.py (98%) diff --git a/openlp/core/utils/db.py b/openlp/core/common/db.py similarity index 100% rename from openlp/core/utils/db.py rename to openlp/core/common/db.py diff --git a/openlp/core/utils/__init__.py b/openlp/core/utils/__init__.py index 086c69c79..a29e0693c 100644 --- a/openlp/core/utils/__init__.py +++ b/openlp/core/utils/__init__.py @@ -523,13 +523,15 @@ def get_locale_key(string): def get_natural_key(string): """ Generate a key for locale aware natural string sorting. + + :param string: string to be sorted by Returns a list of string compare keys and integers. """ key = DIGITS_OR_NONDIGITS.findall(string) key = [int(part) if part.isdigit() else get_locale_key(part) for part in key] # Python 3 does not support comparison of different types anymore. So make sure, that we do not compare str # and int. - if string[0].isdigit(): + if string and string[0].isdigit(): return [b''] + key return key diff --git a/openlp/plugins/songs/lib/upgrade.py b/openlp/plugins/songs/lib/upgrade.py index 09f7ce92a..19a67caa4 100644 --- a/openlp/plugins/songs/lib/upgrade.py +++ b/openlp/plugins/songs/lib/upgrade.py @@ -28,8 +28,8 @@ import logging from sqlalchemy import Table, Column, ForeignKey, types from sqlalchemy.sql.expression import func, false, null, text +from openlp.core.common.db import drop_columns from openlp.core.lib.db import get_upgrade_op -from openlp.core.utils.db import drop_columns log = logging.getLogger(__name__) __version__ = 5 diff --git a/tests/functional/openlp_core/__init__.py b/tests/functional/openlp_core/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/tests/functional/openlp_core_utils/test_db.py b/tests/functional/openlp_core/test_db.py similarity index 98% rename from tests/functional/openlp_core_utils/test_db.py rename to tests/functional/openlp_core/test_db.py index f2c3d264a..4eb6959c2 100644 --- a/tests/functional/openlp_core_utils/test_db.py +++ b/tests/functional/openlp_core/test_db.py @@ -22,17 +22,17 @@ """ Package to test the openlp.core.utils.db package. """ -from tempfile import mkdtemp -from unittest import TestCase import gc import os import shutil -import sqlalchemy import time +from tempfile import mkdtemp +from unittest import TestCase -from openlp.core.utils.db import drop_column, drop_columns +import sqlalchemy + +from openlp.core.common.db import drop_column, drop_columns from openlp.core.lib.db import init_db, get_upgrade_op - from tests.utils.constants import TEST_RESOURCES_PATH From 946d9ee3d52b278666c4ace64bc615617fe26a59 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Thu, 31 Mar 2016 17:24:44 +0100 Subject: [PATCH 2/6] fix tests --- tests/functional/openlp_core/test_init.py | 24 +++++-------------- .../test_db.py | 2 +- 2 files changed, 7 insertions(+), 19 deletions(-) rename tests/functional/{openlp_core => openlp_core_common}/test_db.py (98%) diff --git a/tests/functional/openlp_core/test_init.py b/tests/functional/openlp_core/test_init.py index 703122c18..86f2c1515 100644 --- a/tests/functional/openlp_core/test_init.py +++ b/tests/functional/openlp_core/test_init.py @@ -37,7 +37,7 @@ class TestInitFunctions(TestMixin, TestCase): # GIVEN: a a set of system arguments. sys.argv[1:] = [] # WHEN: We we parse them to expand to options - args = parse_options() + args = parse_options(None) # THEN: the following fields will have been extracted. self.assertFalse(args.dev_version, 'The dev_version flag should be False') self.assertEquals(args.loglevel, 'warning', 'The log level should be set to warning') @@ -54,7 +54,7 @@ class TestInitFunctions(TestMixin, TestCase): # GIVEN: a a set of system arguments. sys.argv[1:] = ['-l debug'] # WHEN: We we parse them to expand to options - args = parse_options() + args = parse_options(None) # THEN: the following fields will have been extracted. self.assertFalse(args.dev_version, 'The dev_version flag should be False') self.assertEquals(args.loglevel, ' debug', 'The log level should be set to debug') @@ -71,7 +71,7 @@ class TestInitFunctions(TestMixin, TestCase): # GIVEN: a a set of system arguments. sys.argv[1:] = ['--portable'] # WHEN: We we parse them to expand to options - args = parse_options() + args = parse_options(None) # THEN: the following fields will have been extracted. self.assertFalse(args.dev_version, 'The dev_version flag should be False') self.assertEquals(args.loglevel, 'warning', 'The log level should be set to warning') @@ -88,7 +88,7 @@ class TestInitFunctions(TestMixin, TestCase): # GIVEN: a a set of system arguments. sys.argv[1:] = ['-l debug', '-d'] # WHEN: We we parse them to expand to options - args = parse_options() + args = parse_options(None) # THEN: the following fields will have been extracted. self.assertTrue(args.dev_version, 'The dev_version flag should be True') self.assertEquals(args.loglevel, ' debug', 'The log level should be set to debug') @@ -105,7 +105,7 @@ class TestInitFunctions(TestMixin, TestCase): # GIVEN: a a set of system arguments. sys.argv[1:] = ['dummy_temp'] # WHEN: We we parse them to expand to options - args = parse_options() + args = parse_options(None) # THEN: the following fields will have been extracted. self.assertFalse(args.dev_version, 'The dev_version flag should be False') self.assertEquals(args.loglevel, 'warning', 'The log level should be set to warning') @@ -122,7 +122,7 @@ class TestInitFunctions(TestMixin, TestCase): # GIVEN: a a set of system arguments. sys.argv[1:] = ['-l debug', 'dummy_temp'] # WHEN: We we parse them to expand to options - args = parse_options() + args = parse_options(None) # THEN: the following fields will have been extracted. self.assertFalse(args.dev_version, 'The dev_version flag should be False') self.assertEquals(args.loglevel, ' debug', 'The log level should be set to debug') @@ -130,15 +130,3 @@ class TestInitFunctions(TestMixin, TestCase): self.assertFalse(args.portable, 'The portable flag should be set to false') self.assertEquals(args.style, None, 'There are no style flags to be processed') self.assertEquals(args.rargs, 'dummy_temp', 'The service file should not be blank') - - def parse_options_two_files_test(self): - """ - Test the parse options process works with a file - - """ - # GIVEN: a a set of system arguments. - sys.argv[1:] = ['dummy_temp', 'dummy_temp2'] - # WHEN: We we parse them to expand to options - args = parse_options() - # THEN: the following fields will have been extracted. - self.assertEquals(args, None, 'The args should be None') diff --git a/tests/functional/openlp_core/test_db.py b/tests/functional/openlp_core_common/test_db.py similarity index 98% rename from tests/functional/openlp_core/test_db.py rename to tests/functional/openlp_core_common/test_db.py index 4eb6959c2..029efadc3 100644 --- a/tests/functional/openlp_core/test_db.py +++ b/tests/functional/openlp_core_common/test_db.py @@ -20,7 +20,7 @@ # Temple Place, Suite 330, Boston, MA 02111-1307 USA # ############################################################################### """ -Package to test the openlp.core.utils.db package. +Package to test the openlp.core.common.db package. """ import gc import os From ba6d66497caf9a4e6ce50610dc3a248b778e192d Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Thu, 31 Mar 2016 17:34:22 +0100 Subject: [PATCH 3/6] actions --- openlp/core/common/__init__.py | 1 + openlp/core/{utils => common}/actions.py | 0 openlp/core/lib/ui.py | 2 +- openlp/core/ui/mainwindow.py | 15 +++++++------- openlp/core/ui/servicemanager.py | 7 +++---- openlp/core/ui/shortcutlistform.py | 2 +- openlp/core/ui/slidecontroller.py | 8 ++++---- openlp/core/utils/__init__.py | 20 +++++++++---------- openlp/plugins/alerts/alertsplugin.py | 7 +++---- openlp/plugins/bibles/bibleplugin.py | 4 ++-- openlp/plugins/songs/songsplugin.py | 7 +++---- openlp/plugins/songusage/songusageplugin.py | 2 +- .../test_actions.py | 5 ++--- 13 files changed, 37 insertions(+), 43 deletions(-) rename openlp/core/{utils => common}/actions.py (100%) rename tests/functional/{openlp_core_utils => openlp_core_common}/test_actions.py (98%) diff --git a/openlp/core/common/__init__.py b/openlp/core/common/__init__.py index b0926dccd..33a1129c5 100644 --- a/openlp/core/common/__init__.py +++ b/openlp/core/common/__init__.py @@ -242,3 +242,4 @@ from .uistrings import UiStrings from .settings import Settings from .applocation import AppLocation from .historycombobox import HistoryComboBox +from .actions import ActionList diff --git a/openlp/core/utils/actions.py b/openlp/core/common/actions.py similarity index 100% rename from openlp/core/utils/actions.py rename to openlp/core/common/actions.py diff --git a/openlp/core/lib/ui.py b/openlp/core/lib/ui.py index 402e4ad34..ab47a65e1 100644 --- a/openlp/core/lib/ui.py +++ b/openlp/core/lib/ui.py @@ -27,8 +27,8 @@ import logging from PyQt5 import QtCore, QtGui, QtWidgets from openlp.core.common import Registry, UiStrings, translate, is_macosx +from openlp.core.common.actions import ActionList from openlp.core.lib import build_icon -from openlp.core.utils.actions import ActionList log = logging.getLogger(__name__) diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index 4427de655..3ca4137e1 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -24,30 +24,29 @@ This is the main window, where all the action happens. """ import logging import os -import sys import shutil +import sys +import time +from datetime import datetime from distutils import dir_util from distutils.errors import DistutilsFileError from tempfile import gettempdir -import time -from datetime import datetime from PyQt5 import QtCore, QtGui, QtWidgets from openlp.core.common import Registry, RegistryProperties, AppLocation, Settings, check_directory_exists, translate, \ is_win, is_macosx +from openlp.core.common.actions import ActionList, CategoryOrder 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, LiveController, PluginForm, \ MediaDockManager, ShortcutListForm, FormattingTagForm, PreviewController - -from openlp.core.ui.media import MediaController -from openlp.core.utils import LanguageManager, add_actions, get_application_version -from openlp.core.utils.actions import ActionList, CategoryOrder from openlp.core.ui.firsttimeform import FirstTimeForm -from openlp.core.ui.projector.manager import ProjectorManager +from openlp.core.ui.media import MediaController from openlp.core.ui.printserviceform import PrintServiceForm +from openlp.core.ui.projector.manager import ProjectorManager +from openlp.core.utils import LanguageManager, add_actions, get_application_version log = logging.getLogger(__name__) diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index fdae5c069..6db34022b 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -23,23 +23,22 @@ The service manager sets up, loads, saves and manages services. """ import html +import json import os import shutil import zipfile -import json -from tempfile import mkstemp from datetime import datetime, timedelta +from tempfile import mkstemp from PyQt5 import QtCore, QtGui, QtWidgets from openlp.core.common import Registry, RegistryProperties, AppLocation, Settings, ThemeLevel, OpenLPMixin, \ RegistryMixin, check_directory_exists, UiStrings, translate +from openlp.core.common.actions import ActionList, CategoryOrder 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 from openlp.core.utils import delete_file, split_filename, format_time -from openlp.core.utils.actions import ActionList, CategoryOrder class ServiceManagerList(QtWidgets.QTreeWidget): diff --git a/openlp/core/ui/shortcutlistform.py b/openlp/core/ui/shortcutlistform.py index 574392a7a..e0d72d9e1 100644 --- a/openlp/core/ui/shortcutlistform.py +++ b/openlp/core/ui/shortcutlistform.py @@ -27,7 +27,7 @@ import re from PyQt5 import QtCore, QtGui, QtWidgets from openlp.core.common import RegistryProperties, Settings, translate -from openlp.core.utils.actions import ActionList +from openlp.core.common.actions import ActionList from .shortcutlistdialog import Ui_ShortcutListDialog REMOVE_AMPERSAND = re.compile(r'&{1}') diff --git a/openlp/core/ui/slidecontroller.py b/openlp/core/ui/slidecontroller.py index d2e2fe4ae..fd88e67ee 100644 --- a/openlp/core/ui/slidecontroller.py +++ b/openlp/core/ui/slidecontroller.py @@ -23,20 +23,20 @@ The :mod:`slidecontroller` module contains the most important part of OpenLP - the slide controller """ -import os import copy +import os from collections import deque from threading import Lock from PyQt5 import QtCore, QtGui, QtWidgets from openlp.core.common import Registry, RegistryProperties, Settings, SlideLimits, UiStrings, translate, \ - RegistryMixin, OpenLPMixin, is_win + RegistryMixin, OpenLPMixin +from openlp.core.common.actions import ActionList, CategoryOrder 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 -from openlp.core.utils.actions import ActionList, CategoryOrder +from openlp.core.ui import HideMode, MainDisplay, Display, DisplayControllerType from openlp.core.ui.listpreviewwidget import ListPreviewWidget # Threshold which has to be trespassed to toggle. diff --git a/openlp/core/utils/__init__.py b/openlp/core/utils/__init__.py index a29e0693c..a8c65eb2a 100644 --- a/openlp/core/utils/__init__.py +++ b/openlp/core/utils/__init__.py @@ -22,29 +22,28 @@ """ The :mod:`openlp.core.utils` module provides the utility libraries for OpenLP. """ -from datetime import datetime -from distutils.version import LooseVersion -from http.client import HTTPException -import logging import locale +import logging import os import platform import re import socket -import time -from shutil import which -from subprocess import Popen, PIPE import sys -import urllib.request +import time import urllib.error import urllib.parse +import urllib.request +from datetime import datetime +from distutils.version import LooseVersion +from http.client import HTTPException from random import randint +from shutil import which +from subprocess import Popen, PIPE from PyQt5 import QtGui, QtCore from openlp.core.common import Registry, AppLocation, Settings, is_win, is_macosx - if not is_win() and not is_macosx(): try: from xdg import BaseDirectory @@ -537,9 +536,8 @@ def get_natural_key(string): from .languagemanager import LanguageManager -from .actions import ActionList -__all__ = ['ActionList', 'LanguageManager', 'get_application_version', 'check_latest_version', +__all__ = ['LanguageManager', 'get_application_version', 'check_latest_version', 'add_actions', 'get_filesystem_encoding', 'get_web_page', 'get_uno_command', 'get_uno_instance', 'delete_file', 'clean_filename', 'format_time', 'get_locale_key', 'get_natural_key'] diff --git a/openlp/plugins/alerts/alertsplugin.py b/openlp/plugins/alerts/alertsplugin.py index 14b1f7805..61640262b 100644 --- a/openlp/plugins/alerts/alertsplugin.py +++ b/openlp/plugins/alerts/alertsplugin.py @@ -24,17 +24,16 @@ import logging from PyQt5 import QtGui - from openlp.core.common import Settings, translate +from openlp.core.common.actions import ActionList from openlp.core.lib import Plugin, StringContent, build_icon from openlp.core.lib.db import Manager -from openlp.core.lib.ui import create_action, UiStrings from openlp.core.lib.theme import VerticalType +from openlp.core.lib.ui import create_action, UiStrings from openlp.core.ui import AlertLocation -from openlp.core.utils.actions import ActionList +from openlp.plugins.alerts.forms import AlertForm from openlp.plugins.alerts.lib import AlertsManager, AlertsTab from openlp.plugins.alerts.lib.db import init_schema -from openlp.plugins.alerts.forms import AlertForm log = logging.getLogger(__name__) diff --git a/openlp/plugins/bibles/bibleplugin.py b/openlp/plugins/bibles/bibleplugin.py index 289f8cc32..ccc61ba56 100644 --- a/openlp/plugins/bibles/bibleplugin.py +++ b/openlp/plugins/bibles/bibleplugin.py @@ -24,13 +24,13 @@ import logging from PyQt5 import QtWidgets +from openlp.core.common.actions import ActionList from openlp.core.lib import Plugin, StringContent, build_icon, translate from openlp.core.lib.ui import UiStrings, create_action -from openlp.core.utils.actions import ActionList +from openlp.plugins.bibles.forms import BibleUpgradeForm from openlp.plugins.bibles.lib import BibleManager, BiblesTab, BibleMediaItem, LayoutStyle, DisplayStyle, \ LanguageSelection from openlp.plugins.bibles.lib.mediaitem import BibleSearch -from openlp.plugins.bibles.forms import BibleUpgradeForm log = logging.getLogger(__name__) diff --git a/openlp/plugins/songs/songsplugin.py b/openlp/plugins/songs/songsplugin.py index b7f6a36bb..b2218f701 100644 --- a/openlp/plugins/songs/songsplugin.py +++ b/openlp/plugins/songs/songsplugin.py @@ -26,27 +26,26 @@ for the Songs plugin. import logging import os -from tempfile import gettempdir import sqlite3 +from tempfile import gettempdir from PyQt5 import QtCore, QtWidgets from openlp.core.common import UiStrings, Registry, translate +from openlp.core.common.actions import ActionList 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 from openlp.plugins.songs.forms.duplicatesongremovalform import DuplicateSongRemovalForm from openlp.plugins.songs.forms.songselectform import SongSelectForm from openlp.plugins.songs.lib import clean_song, upgrade from openlp.plugins.songs.lib.db import init_schema, Song -from openlp.plugins.songs.lib.mediaitem import SongSearch from openlp.plugins.songs.lib.importer import SongFormat from openlp.plugins.songs.lib.importers.openlp import OpenLPSongImport from openlp.plugins.songs.lib.mediaitem import SongMediaItem +from openlp.plugins.songs.lib.mediaitem import SongSearch from openlp.plugins.songs.lib.songstab import SongsTab - log = logging.getLogger(__name__) __default_settings__ = { 'songs/db type': 'sqlite', diff --git a/openlp/plugins/songusage/songusageplugin.py b/openlp/plugins/songusage/songusageplugin.py index 4cb3153cf..9fca21b75 100644 --- a/openlp/plugins/songusage/songusageplugin.py +++ b/openlp/plugins/songusage/songusageplugin.py @@ -26,10 +26,10 @@ from datetime import datetime from PyQt5 import QtCore, QtWidgets from openlp.core.common import Registry, Settings, translate +from openlp.core.common.actions import ActionList 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 from openlp.plugins.songusage.forms import SongUsageDetailForm, SongUsageDeleteForm from openlp.plugins.songusage.lib import upgrade from openlp.plugins.songusage.lib.db import init_schema, SongUsageItem diff --git a/tests/functional/openlp_core_utils/test_actions.py b/tests/functional/openlp_core_common/test_actions.py similarity index 98% rename from tests/functional/openlp_core_utils/test_actions.py rename to tests/functional/openlp_core_common/test_actions.py index 1fdb01aec..2b2d735bb 100644 --- a/tests/functional/openlp_core_utils/test_actions.py +++ b/tests/functional/openlp_core_common/test_actions.py @@ -20,15 +20,14 @@ # Temple Place, Suite 330, Boston, MA 02111-1307 USA # ############################################################################### """ -Package to test the openlp.core.utils.actions package. +Package to test the openlp.core.common.actions package. """ from unittest import TestCase from PyQt5 import QtGui, QtCore, QtWidgets from openlp.core.common import Settings -from openlp.core.utils import ActionList -from openlp.core.utils.actions import CategoryActionList +from openlp.core.common.actions import CategoryActionList, ActionList from tests.functional import MagicMock from tests.helpers.testmixin import TestMixin From 4362ff63f89b1ccdce3ce2b11736ee3fc9d5304c Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Thu, 31 Mar 2016 17:42:42 +0100 Subject: [PATCH 4/6] language manager --- openlp/core/common/__init__.py | 1 + openlp/core/{utils => common}/languagemanager.py | 0 openlp/core/utils/__init__.py | 8 ++------ 3 files changed, 3 insertions(+), 6 deletions(-) rename openlp/core/{utils => common}/languagemanager.py (100%) diff --git a/openlp/core/common/__init__.py b/openlp/core/common/__init__.py index 33a1129c5..fcb96e5ac 100644 --- a/openlp/core/common/__init__.py +++ b/openlp/core/common/__init__.py @@ -243,3 +243,4 @@ from .settings import Settings from .applocation import AppLocation from .historycombobox import HistoryComboBox from .actions import ActionList +from .languagemanager import LanguageManager diff --git a/openlp/core/utils/languagemanager.py b/openlp/core/common/languagemanager.py similarity index 100% rename from openlp/core/utils/languagemanager.py rename to openlp/core/common/languagemanager.py diff --git a/openlp/core/utils/__init__.py b/openlp/core/utils/__init__.py index a8c65eb2a..6829383de 100644 --- a/openlp/core/utils/__init__.py +++ b/openlp/core/utils/__init__.py @@ -510,7 +510,7 @@ def get_locale_key(string): try: if ICU_COLLATOR is None: import icu - from .languagemanager import LanguageManager + from openlp.core.common.languagemanager import LanguageManager language = LanguageManager.get_language() icu_locale = icu.Locale(language) ICU_COLLATOR = icu.Collator.createInstance(icu_locale) @@ -534,10 +534,6 @@ def get_natural_key(string): return [b''] + key return key - -from .languagemanager import LanguageManager - - -__all__ = ['LanguageManager', 'get_application_version', 'check_latest_version', +__all__ = ['get_application_version', 'check_latest_version', 'add_actions', 'get_filesystem_encoding', 'get_web_page', 'get_uno_command', 'get_uno_instance', 'delete_file', 'clean_filename', 'format_time', 'get_locale_key', 'get_natural_key'] From cd239fe80292d274a1e6a8ad67f95a6f46eca66c Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Thu, 31 Mar 2016 17:47:42 +0100 Subject: [PATCH 5/6] fixes --- openlp/core/__init__.py | 6 +++--- openlp/core/ui/firsttimelanguageform.py | 2 +- openlp/core/ui/mainwindow.py | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/openlp/core/__init__.py b/openlp/core/__init__.py index 50a1ab9b6..b663fc55b 100644 --- a/openlp/core/__init__.py +++ b/openlp/core/__init__.py @@ -36,8 +36,8 @@ import shutil import time from PyQt5 import QtCore, QtGui, QtWidgets -from openlp.core.common import Registry, OpenLPMixin, AppLocation, Settings, UiStrings, check_directory_exists, \ - is_macosx, is_win, translate +from openlp.core.common import Registry, OpenLPMixin, AppLocation, LanguageManager, Settings, UiStrings, \ + check_directory_exists, is_macosx, is_win, translate from openlp.core.lib import ScreenList from openlp.core.resources import qInitResources from openlp.core.ui.mainwindow import MainWindow @@ -45,7 +45,7 @@ from openlp.core.ui.firsttimelanguageform import FirstTimeLanguageForm from openlp.core.ui.firsttimeform import FirstTimeForm from openlp.core.ui.exceptionform import ExceptionForm from openlp.core.ui import SplashScreen -from openlp.core.utils import LanguageManager, VersionThread, get_application_version +from openlp.core.utils import VersionThread, get_application_version __all__ = ['OpenLP', 'main'] diff --git a/openlp/core/ui/firsttimelanguageform.py b/openlp/core/ui/firsttimelanguageform.py index a55713bf0..4058612fb 100644 --- a/openlp/core/ui/firsttimelanguageform.py +++ b/openlp/core/ui/firsttimelanguageform.py @@ -25,7 +25,7 @@ The language selection dialog. from PyQt5 import QtCore, QtWidgets from openlp.core.lib.ui import create_action -from openlp.core.utils import LanguageManager +from openlp.core.common import LanguageManager from .firsttimelanguagedialog import Ui_FirstTimeLanguageDialog diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index 3ca4137e1..3fd154c14 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -34,8 +34,8 @@ from tempfile import gettempdir from PyQt5 import QtCore, QtGui, QtWidgets -from openlp.core.common import Registry, RegistryProperties, AppLocation, Settings, check_directory_exists, translate, \ - is_win, is_macosx +from openlp.core.common import Registry, RegistryProperties, AppLocation, LanguageManager, Settings, \ + check_directory_exists, translate, is_win, is_macosx from openlp.core.common.actions import ActionList, CategoryOrder from openlp.core.lib import Renderer, OpenLPDockWidget, PluginManager, ImageManager, PluginStatus, ScreenList, \ build_icon @@ -46,7 +46,7 @@ from openlp.core.ui.firsttimeform import FirstTimeForm from openlp.core.ui.media import MediaController from openlp.core.ui.printserviceform import PrintServiceForm from openlp.core.ui.projector.manager import ProjectorManager -from openlp.core.utils import LanguageManager, add_actions, get_application_version +from openlp.core.utils import get_application_version, add_actions log = logging.getLogger(__name__) From 2e58e45068253d42b433bd9e54c17b5ac6f302ce Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Thu, 31 Mar 2016 17:56:32 +0100 Subject: [PATCH 6/6] fixes more --- tests/functional/openlp_core_utils/test_utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/functional/openlp_core_utils/test_utils.py b/tests/functional/openlp_core_utils/test_utils.py index d63d11771..a9e402369 100644 --- a/tests/functional/openlp_core_utils/test_utils.py +++ b/tests/functional/openlp_core_utils/test_utils.py @@ -241,7 +241,7 @@ class TestUtils(TestCase): """ Test the get_locale_key(string) function """ - with patch('openlp.core.utils.languagemanager.LanguageManager.get_language') as mocked_get_language: + with patch('openlp.core.common.languagemanager.LanguageManager.get_language') as mocked_get_language: # GIVEN: The language is German # 0x00C3 (A with diaresis) should be sorted as "A". 0x00DF (sharp s) should be sorted as "ss". mocked_get_language.return_value = 'de' @@ -258,7 +258,7 @@ class TestUtils(TestCase): """ Test the get_natural_key(string) function """ - with patch('openlp.core.utils.languagemanager.LanguageManager.get_language') as mocked_get_language: + with patch('openlp.core.common.languagemanager.LanguageManager.get_language') as mocked_get_language: # GIVEN: The language is English (a language, which sorts digits before letters) mocked_get_language.return_value = 'en' unsorted_list = ['item 10a', 'item 3b', '1st item']