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