diff --git a/MANIFEST.in b/MANIFEST.in index be81efb23..7bfefe740 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -7,9 +7,11 @@ recursive-include openlp *.css recursive-include openlp *.png recursive-include openlp *.ps recursive-include openlp *.json +recursive-include openlp *.ttf recursive-include documentation * recursive-include resources * recursive-include scripts * +recursive-include tests/resources * include copyright.txt include LICENSE include README.txt diff --git a/openlp/core/api/endpoint/controller.py b/openlp/core/api/endpoint/controller.py index 3523568aa..7aa75b182 100644 --- a/openlp/core/api/endpoint/controller.py +++ b/openlp/core/api/endpoint/controller.py @@ -31,7 +31,8 @@ from openlp.core.common.applocation import AppLocation from openlp.core.common.path import Path from openlp.core.common.registry import Registry from openlp.core.common.settings import Settings -from openlp.core.lib import ItemCapabilities, create_thumb +from openlp.core.lib import create_thumb +from openlp.core.lib.serviceitem import ItemCapabilities log = logging.getLogger(__name__) diff --git a/openlp/core/api/endpoint/core.py b/openlp/core/api/endpoint/core.py index 9ad95f4df..43a2b8459 100644 --- a/openlp/core/api/endpoint/core.py +++ b/openlp/core/api/endpoint/core.py @@ -29,7 +29,9 @@ from openlp.core.api.http import requires_auth from openlp.core.api.http.endpoint import Endpoint from openlp.core.common.i18n import UiStrings, translate from openlp.core.common.registry import Registry -from openlp.core.lib import PluginStatus, StringContent, image_to_byte +from openlp.core.lib import image_to_byte +from openlp.core.lib.plugin import StringContent +from openlp.core.lib.plugin import PluginStatus template_dir = 'templates' static_dir = 'static' diff --git a/openlp/core/api/endpoint/pluginhelpers.py b/openlp/core/api/endpoint/pluginhelpers.py index 75dc8e8e6..e024c484b 100644 --- a/openlp/core/api/endpoint/pluginhelpers.py +++ b/openlp/core/api/endpoint/pluginhelpers.py @@ -28,7 +28,8 @@ from webob import Response from openlp.core.api.http.errors import NotFound from openlp.core.common.applocation import AppLocation from openlp.core.common.registry import Registry -from openlp.core.lib import PluginStatus, image_to_byte +from openlp.core.lib import image_to_byte +from openlp.core.lib.plugin import PluginStatus def search(request, plugin_name, log): diff --git a/openlp/core/api/tab.py b/openlp/core/api/tab.py index b0477a282..61e922c32 100644 --- a/openlp/core/api/tab.py +++ b/openlp/core/api/tab.py @@ -28,7 +28,7 @@ from openlp.core.common import get_local_ip4 from openlp.core.common.i18n import UiStrings, translate from openlp.core.common.registry import Registry from openlp.core.common.settings import Settings -from openlp.core.lib import SettingsTab +from openlp.core.lib.settingstab import SettingsTab from openlp.core.ui.icons import UiIcons ZERO_URL = '0.0.0.0' diff --git a/openlp/core/app.py b/openlp/core/app.py index 328b149c1..b9479dc0c 100644 --- a/openlp/core/app.py +++ b/openlp/core/app.py @@ -43,7 +43,7 @@ from openlp.core.common.registry import Registry from openlp.core.common.settings import Settings from openlp.core.display.screens import ScreenList from openlp.core.resources import qInitResources -from openlp.core.ui import SplashScreen +from openlp.core.ui.splashscreen import SplashScreen from openlp.core.ui.exceptionform import ExceptionForm from openlp.core.ui.firsttimeform import FirstTimeForm from openlp.core.ui.firsttimelanguageform import FirstTimeLanguageForm diff --git a/openlp/core/common/i18n.py b/openlp/core/common/i18n.py index 77b47073d..56e6be724 100644 --- a/openlp/core/common/i18n.py +++ b/openlp/core/common/i18n.py @@ -271,9 +271,10 @@ class LanguageManager(object): language = Settings().value('core/language') language = str(language) log.info("Language file: '{language}' Loaded from conf file".format(language=language)) - if re.match(r'[[].*[]]', language): + m = re.match(r'\[(.*)\]', language) + if m: LanguageManager.auto_language = True - language = re.sub(r'[\[\]]', '', language) + language = m.group(1) return language @staticmethod diff --git a/openlp/core/lib/__init__.py b/openlp/core/lib/__init__.py index 4a3220c52..ee841228c 100644 --- a/openlp/core/lib/__init__.py +++ b/openlp/core/lib/__init__.py @@ -30,6 +30,7 @@ from PyQt5 import QtCore, QtGui, QtWidgets from openlp.core.common.i18n import translate from openlp.core.common.path import Path +from openlp.core.lib.formattingtags import FormattingTags log = logging.getLogger(__name__ + '.__init__') @@ -301,15 +302,4 @@ def create_separated_list(string_list): last=string_list[-1]) else: list_to_string = '' - return list_to_string - - -from .exceptions import ValidationError -from .formattingtags import FormattingTags -from .plugin import PluginStatus, StringContent, Plugin -from .pluginmanager import PluginManager -from .settingstab import SettingsTab -from .serviceitem import ServiceItem, ServiceItemType, ItemCapabilities -from .htmlbuilder import build_html, build_lyrics_format_css, build_lyrics_outline_css, build_chords_css -from .imagemanager import ImageManager -from .mediamanageritem import MediaManagerItem + return list_to_string \ No newline at end of file diff --git a/openlp/core/lib/mediamanageritem.py b/openlp/core/lib/mediamanageritem.py index 1a3dbab56..009734c0a 100644 --- a/openlp/core/lib/mediamanageritem.py +++ b/openlp/core/lib/mediamanageritem.py @@ -33,7 +33,9 @@ from openlp.core.common.mixins import RegistryProperties from openlp.core.common.path import path_to_str, str_to_path from openlp.core.common.registry import Registry from openlp.core.common.settings import Settings -from openlp.core.lib import ServiceItem, StringContent, ServiceItemContext +from openlp.core.lib import ServiceItemContext +from openlp.core.lib.plugin import StringContent +from openlp.core.lib.serviceitem import ServiceItem from openlp.core.lib.ui import create_widget_action, critical_error_message_box from openlp.core.widgets.dialogs import FileDialog from openlp.core.widgets.edits import SearchEdit diff --git a/openlp/core/lib/pluginmanager.py b/openlp/core/lib/pluginmanager.py index 76d0cb46b..4cff2de35 100644 --- a/openlp/core/lib/pluginmanager.py +++ b/openlp/core/lib/pluginmanager.py @@ -31,7 +31,7 @@ from openlp.core.common.applocation import AppLocation from openlp.core.common.i18n import UiStrings from openlp.core.common.mixins import LogMixin, RegistryProperties from openlp.core.common.registry import RegistryBase -from openlp.core.lib import Plugin, PluginStatus +from openlp.core.lib.plugin import Plugin, PluginStatus class PluginManager(RegistryBase, LogMixin, RegistryProperties): diff --git a/openlp/core/projectors/tab.py b/openlp/core/projectors/tab.py index 6af901661..2407bad66 100644 --- a/openlp/core/projectors/tab.py +++ b/openlp/core/projectors/tab.py @@ -28,7 +28,7 @@ from PyQt5 import QtWidgets from openlp.core.common.i18n import UiStrings, translate from openlp.core.common.settings import Settings -from openlp.core.lib import SettingsTab +from openlp.core.lib.settingstab import SettingsTab from openlp.core.ui.icons import UiIcons from openlp.core.projectors import DialogSourceStyle diff --git a/openlp/core/ui/__init__.py b/openlp/core/ui/__init__.py index d743999a5..1e82f14e5 100644 --- a/openlp/core/ui/__init__.py +++ b/openlp/core/ui/__init__.py @@ -93,34 +93,4 @@ class SingleColumnTableWidget(QtWidgets.QTableWidget): self.resizeRowsToContents() -from .firsttimeform import FirstTimeForm -from .firsttimelanguageform import FirstTimeLanguageForm -from .themelayoutform import ThemeLayoutForm -from .themeform import ThemeForm -from .filerenameform import FileRenameForm -from .starttimeform import StartTimeForm -from .servicenoteform import ServiceNoteForm -from .serviceitemeditform import ServiceItemEditForm -from .splashscreen import SplashScreen -from .generaltab import GeneralTab -from .themestab import ThemesTab -from .advancedtab import AdvancedTab -from .aboutform import AboutForm -from .pluginform import PluginForm -from .settingsform import SettingsForm -from .formattingtagform import FormattingTagForm -from .formattingtagcontroller import FormattingTagController -from .shortcutlistform import ShortcutListForm -from .servicemanager import ServiceManager -from .thememanager import ThemeManager - -from openlp.core.projectors.editform import ProjectorEditForm -from openlp.core.projectors.manager import ProjectorManager -from openlp.core.projectors.tab import ProjectorTab - -__all__ = ['SplashScreen', 'AboutForm', 'SettingsForm', 'MainDisplay', 'SlideController', 'ServiceManager', 'ThemeForm', - 'ThemeManager', 'ServiceItemEditForm', 'FirstTimeForm', 'FirstTimeLanguageForm', 'Display', 'AudioPlayer', - 'ServiceNoteForm', 'ThemeLayoutForm', 'FileRenameForm', 'StartTimeForm', 'MainDisplay', - 'SlideController', 'DisplayController', 'GeneralTab', 'ThemesTab', 'AdvancedTab', 'PluginForm', - 'FormattingTagForm', 'ShortcutListForm', 'FormattingTagController', 'SingleColumnTableWidget', - 'ProjectorManager', 'ProjectorTab', 'ProjectorEditForm', 'LiveController', 'PreviewController'] +__all__ = ['SingleColumnTableWidget'] diff --git a/openlp/core/ui/advancedtab.py b/openlp/core/ui/advancedtab.py index 81fdd409b..25e51f485 100644 --- a/openlp/core/ui/advancedtab.py +++ b/openlp/core/ui/advancedtab.py @@ -31,7 +31,7 @@ from openlp.core.common import SlideLimits from openlp.core.common.applocation import AppLocation from openlp.core.common.i18n import UiStrings, format_time, translate from openlp.core.common.settings import Settings -from openlp.core.lib import SettingsTab, build_icon +from openlp.core.lib.settingstab import SettingsTab from openlp.core.ui.style import HAS_DARK_STYLE from openlp.core.ui.icons import UiIcons from openlp.core.widgets.edits import PathEdit diff --git a/openlp/core/ui/firsttimeform.py b/openlp/core/ui/firsttimeform.py index 04a321036..fce6749e4 100644 --- a/openlp/core/ui/firsttimeform.py +++ b/openlp/core/ui/firsttimeform.py @@ -40,7 +40,8 @@ from openlp.core.common.mixins import RegistryProperties from openlp.core.common.path import Path, create_paths from openlp.core.common.registry import Registry from openlp.core.common.settings import Settings -from openlp.core.lib import PluginStatus, build_icon +from openlp.core.lib import build_icon +from openlp.core.lib.plugin import PluginStatus from openlp.core.lib.ui import critical_error_message_box from openlp.core.threading import ThreadWorker, run_thread, get_thread_worker, is_thread_finished from openlp.core.ui.firsttimewizard import UiFirstTimeWizard, FirstTimePage diff --git a/openlp/core/ui/formattingtagcontroller.py b/openlp/core/ui/formattingtagcontroller.py index 198a9f975..14f62f7e6 100644 --- a/openlp/core/ui/formattingtagcontroller.py +++ b/openlp/core/ui/formattingtagcontroller.py @@ -27,7 +27,7 @@ cannot be changed. import re from openlp.core.common.i18n import translate -from openlp.core.lib import FormattingTags +from openlp.core.lib.formattingtags import FormattingTags class FormattingTagController(object): diff --git a/openlp/core/ui/formattingtagform.py b/openlp/core/ui/formattingtagform.py index e4045e59e..6482e73d3 100644 --- a/openlp/core/ui/formattingtagform.py +++ b/openlp/core/ui/formattingtagform.py @@ -27,7 +27,7 @@ Base Tags cannot be changed. from PyQt5 import QtCore, QtWidgets from openlp.core.common.i18n import translate -from openlp.core.lib import FormattingTags +from openlp.core.lib.formattingtags import FormattingTags from openlp.core.ui.formattingtagcontroller import FormattingTagController from openlp.core.ui.formattingtagdialog import Ui_FormattingTagDialog diff --git a/openlp/core/ui/generaltab.py b/openlp/core/ui/generaltab.py index 41d4dedfd..a8e72b8b7 100644 --- a/openlp/core/ui/generaltab.py +++ b/openlp/core/ui/generaltab.py @@ -32,7 +32,7 @@ from openlp.core.common.path import Path from openlp.core.common.registry import Registry from openlp.core.common.settings import Settings from openlp.core.display.screens import ScreenList -from openlp.core.lib import SettingsTab +from openlp.core.lib.settingstab import SettingsTab from openlp.core.widgets.buttons import ColorButton from openlp.core.widgets.edits import PathEdit diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index 407f008da..6ebd920b9 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -42,12 +42,19 @@ from openlp.core.common.path import Path, copyfile, create_paths from openlp.core.common.registry import Registry from openlp.core.common.settings import Settings from openlp.core.display.screens import ScreenList -from openlp.core.lib import PluginManager, ImageManager, PluginStatus +from openlp.core.lib.imagemanager import ImageManager +from openlp.core.lib.plugin import PluginStatus +from openlp.core.lib.pluginmanager import PluginManager from openlp.core.lib.ui import create_action from openlp.core.projectors.manager import ProjectorManager -from openlp.core.ui import AboutForm, SettingsForm, ServiceManager, ThemeManager, PluginForm, ShortcutListForm, \ - FormattingTagForm +from openlp.core.ui.shortcutlistform import ShortcutListForm +from openlp.core.ui.formattingtagform import FormattingTagForm +from openlp.core.ui.thememanager import ThemeManager +from openlp.core.ui.servicemanager import ServiceManager +from openlp.core.ui.aboutform import AboutForm +from openlp.core.ui.pluginform import PluginForm from openlp.core.ui.slidecontroller import LiveController, PreviewController +from openlp.core.ui.settingsform import SettingsForm from openlp.core.ui.firsttimeform import FirstTimeForm from openlp.core.ui.media import MediaController from openlp.core.ui.printserviceform import PrintServiceForm diff --git a/openlp/core/ui/media/mediacontroller.py b/openlp/core/ui/media/mediacontroller.py index 3aa0e4c0a..4af015c06 100644 --- a/openlp/core/ui/media/mediacontroller.py +++ b/openlp/core/ui/media/mediacontroller.py @@ -35,7 +35,7 @@ from openlp.core.common.i18n import UiStrings, translate from openlp.core.common.mixins import LogMixin, RegistryProperties from openlp.core.common.registry import Registry, RegistryBase from openlp.core.common.settings import Settings -from openlp.core.lib import ItemCapabilities +from openlp.core.lib.serviceitem import ItemCapabilities from openlp.core.lib.ui import critical_error_message_box from openlp.core.ui import DisplayControllerType from openlp.core.ui.icons import UiIcons diff --git a/openlp/core/ui/media/playertab.py b/openlp/core/ui/media/playertab.py index db6351c05..6425e4310 100644 --- a/openlp/core/ui/media/playertab.py +++ b/openlp/core/ui/media/playertab.py @@ -29,7 +29,7 @@ from PyQt5 import QtCore, QtWidgets from openlp.core.common.i18n import UiStrings, translate from openlp.core.common.registry import Registry from openlp.core.common.settings import Settings -from openlp.core.lib import SettingsTab +from openlp.core.lib.settingstab import SettingsTab from openlp.core.lib.ui import create_button from openlp.core.ui.icons import UiIcons 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 6eb296b70..386d3e5b0 100644 --- a/openlp/core/ui/pluginform.py +++ b/openlp/core/ui/pluginform.py @@ -28,7 +28,7 @@ from PyQt5 import QtCore, QtWidgets from openlp.core.common.i18n import translate from openlp.core.common.mixins import RegistryProperties -from openlp.core.lib import PluginStatus +from openlp.core.lib.plugin import PluginStatus from openlp.core.ui.plugindialog import Ui_PluginViewDialog log = logging.getLogger(__name__) diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index 8378c2062..9658bd1e4 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -43,10 +43,14 @@ from openlp.core.common.mixins import LogMixin, RegistryProperties from openlp.core.common.path import Path, str_to_path from openlp.core.common.registry import Registry, RegistryBase from openlp.core.common.settings import Settings -from openlp.core.lib import ServiceItem, ItemCapabilities, PluginStatus, build_icon +from openlp.core.lib import build_icon +from openlp.core.lib.plugin import PluginStatus +from openlp.core.lib.serviceitem import ServiceItem, ItemCapabilities from openlp.core.lib.exceptions import ValidationError 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.serviceitemeditform import ServiceItemEditForm +from openlp.core.ui.servicenoteform import ServiceNoteForm +from openlp.core.ui.starttimeform import StartTimeForm from openlp.core.widgets.dialogs import FileDialog from openlp.core.widgets.toolbar import OpenLPToolbar diff --git a/openlp/core/ui/settingsform.py b/openlp/core/ui/settingsform.py index e3190eab6..fc8b4e74e 100644 --- a/openlp/core/ui/settingsform.py +++ b/openlp/core/ui/settingsform.py @@ -26,12 +26,14 @@ import logging from PyQt5 import QtCore, QtWidgets -from openlp.core.api import ApiTab +from openlp.core.api.tab import ApiTab from openlp.core.common.mixins import RegistryProperties from openlp.core.common.registry import Registry from openlp.core.lib import build_icon from openlp.core.projectors.tab import ProjectorTab -from openlp.core.ui import AdvancedTab, GeneralTab, ThemesTab +from openlp.core.ui.advancedtab import AdvancedTab +from openlp.core.ui.generaltab import GeneralTab +from openlp.core.ui.themestab import ThemesTab from openlp.core.ui.media import PlayerTab from openlp.core.ui.settingsdialog import Ui_SettingsDialog diff --git a/openlp/core/ui/slidecontroller.py b/openlp/core/ui/slidecontroller.py index bb7f583fc..03fe08290 100644 --- a/openlp/core/ui/slidecontroller.py +++ b/openlp/core/ui/slidecontroller.py @@ -35,7 +35,8 @@ from openlp.core.common.mixins import LogMixin, RegistryProperties from openlp.core.common.registry import Registry, RegistryBase from openlp.core.common.settings import Settings from openlp.core.display.screens import ScreenList -from openlp.core.lib import ItemCapabilities, ImageSource, ServiceItemAction, build_icon +from openlp.core.lib import ImageSource, ServiceItemAction +from openlp.core.lib.serviceitem import ItemCapabilities from openlp.core.lib.ui import create_action from openlp.core.ui import HideMode, DisplayControllerType from openlp.core.ui.icons import UiIcons @@ -769,7 +770,7 @@ class SlideController(QtWidgets.QWidget, LogMixin, RegistryProperties): def add_service_manager_item(self, item, slide_no): """ Method to install the service item into the controller and request the correct toolbar for the plugin. Called by - :class:`~openlp.core.ui.ServiceManager` + :class:`~openlp.core.ui.servicemanager.ServiceManager` :param item: The current service item :param slide_no: The slide number to select diff --git a/openlp/core/ui/themeform.py b/openlp/core/ui/themeform.py index eb3e44652..e8a368006 100644 --- a/openlp/core/ui/themeform.py +++ b/openlp/core/ui/themeform.py @@ -32,7 +32,7 @@ from openlp.core.common.mixins import RegistryProperties from openlp.core.common.registry import Registry from openlp.core.lib.theme import BackgroundType, BackgroundGradientType from openlp.core.lib.ui import critical_error_message_box -from openlp.core.ui import ThemeLayoutForm +from openlp.core.ui.themelayoutform import ThemeLayoutForm from openlp.core.ui.themewizard import Ui_ThemeWizard # TODO: Fix this. Use a "get_video_extensions" method which uses the current media player from openlp.core.ui.media.vlcplayer import VIDEO_EXT @@ -154,7 +154,7 @@ class ThemeForm(QtWidgets.QWizard, Ui_ThemeWizard, RegistryProperties): Calculate the number of lines on a page by rendering text """ # Do not trigger on start up - if self.currentPage != self.welcome_page: + if self.currentPage() != self.welcome_page: self.update_theme() self.theme_manager.generate_image(self.theme, True) diff --git a/openlp/core/ui/thememanager.py b/openlp/core/ui/thememanager.py index 8f5b001af..fe6267dfa 100644 --- a/openlp/core/ui/thememanager.py +++ b/openlp/core/ui/thememanager.py @@ -36,11 +36,13 @@ from openlp.core.common.mixins import LogMixin, RegistryProperties from openlp.core.common.path import Path, copyfile, create_paths, path_to_str from openlp.core.common.registry import Registry, RegistryBase from openlp.core.common.settings import Settings -from openlp.core.lib import ImageSource, ValidationError, get_text_file_string, build_icon, \ +from openlp.core.lib import ImageSource, get_text_file_string, build_icon, \ check_item_selected, create_thumb, validate_thumb +from openlp.core.lib.exceptions import ValidationError from openlp.core.lib.theme import Theme, BackgroundType from openlp.core.lib.ui import critical_error_message_box, create_widget_action -from openlp.core.ui import FileRenameForm, ThemeForm +from openlp.core.ui.filerenameform import FileRenameForm +from openlp.core.ui.themeform import ThemeForm from openlp.core.widgets.dialogs import FileDialog from openlp.core.widgets.toolbar import OpenLPToolbar diff --git a/openlp/core/ui/themestab.py b/openlp/core/ui/themestab.py index 3e09e6406..6a5d9bccf 100644 --- a/openlp/core/ui/themestab.py +++ b/openlp/core/ui/themestab.py @@ -28,7 +28,7 @@ from openlp.core.common import ThemeLevel from openlp.core.common.i18n import UiStrings, translate from openlp.core.common.registry import Registry from openlp.core.common.settings import Settings -from openlp.core.lib import SettingsTab +from openlp.core.lib.settingstab import SettingsTab from openlp.core.lib.ui import find_and_set_in_combo_box from openlp.core.ui.icons import UiIcons diff --git a/openlp/core/widgets/docks.py b/openlp/core/widgets/docks.py index b016aeb2c..5d2858ae6 100644 --- a/openlp/core/widgets/docks.py +++ b/openlp/core/widgets/docks.py @@ -27,7 +27,8 @@ import logging from PyQt5 import QtWidgets from openlp.core.display.screens import ScreenList -from openlp.core.lib import StringContent, build_icon +from openlp.core.lib import build_icon +from openlp.core.lib.plugin import StringContent log = logging.getLogger(__name__) diff --git a/openlp/core/widgets/edits.py b/openlp/core/widgets/edits.py index 130283291..3333df633 100644 --- a/openlp/core/widgets/edits.py +++ b/openlp/core/widgets/edits.py @@ -31,7 +31,8 @@ from openlp.core.common import CONTROL_CHARS from openlp.core.common.i18n import UiStrings, translate from openlp.core.common.path import Path, path_to_str, str_to_path from openlp.core.common.settings import Settings -from openlp.core.lib import FormattingTags, build_icon +from openlp.core.lib import build_icon +from openlp.core.lib.formattingtags import FormattingTags from openlp.core.lib.ui import create_widget_action, create_action from openlp.core.ui.icons import UiIcons from openlp.core.widgets.dialogs import FileDialog diff --git a/openlp/core/widgets/views.py b/openlp/core/widgets/views.py index 89ae91586..d194f891a 100644 --- a/openlp/core/widgets/views.py +++ b/openlp/core/widgets/views.py @@ -31,7 +31,7 @@ from openlp.core.common.mixins import RegistryProperties from openlp.core.common.path import Path from openlp.core.common.registry import Registry from openlp.core.common.settings import Settings -from openlp.core.lib import ItemCapabilities, ServiceItem +from openlp.core.lib.serviceitem import ItemCapabilities, ServiceItem from openlp.core.widgets.layouts import AspectRatioLayout diff --git a/openlp/plugins/alerts/alertsplugin.py b/openlp/plugins/alerts/alertsplugin.py index ad836b473..f613c30c7 100644 --- a/openlp/plugins/alerts/alertsplugin.py +++ b/openlp/plugins/alerts/alertsplugin.py @@ -28,7 +28,7 @@ from openlp.core.api.http import register_endpoint from openlp.core.common.actions import ActionList from openlp.core.common.i18n import UiStrings, translate from openlp.core.common.settings import Settings -from openlp.core.lib import Plugin, StringContent +from openlp.core.lib.plugin import Plugin, StringContent from openlp.core.lib.db import Manager from openlp.core.lib.theme import VerticalType from openlp.core.lib.ui import create_action diff --git a/openlp/plugins/alerts/endpoint.py b/openlp/plugins/alerts/endpoint.py index e4b9a64bd..542d5ef37 100644 --- a/openlp/plugins/alerts/endpoint.py +++ b/openlp/plugins/alerts/endpoint.py @@ -27,7 +27,7 @@ from urllib.parse import urlparse from openlp.core.api.http import requires_auth from openlp.core.api.http.endpoint import Endpoint from openlp.core.common.registry import Registry -from openlp.core.lib import PluginStatus +from openlp.core.lib.plugin import PluginStatus log = logging.getLogger(__name__) diff --git a/openlp/plugins/alerts/lib/alertstab.py b/openlp/plugins/alerts/lib/alertstab.py index b93f74db4..f01b5440f 100644 --- a/openlp/plugins/alerts/lib/alertstab.py +++ b/openlp/plugins/alerts/lib/alertstab.py @@ -24,7 +24,7 @@ from PyQt5 import QtGui, QtWidgets from openlp.core.common.i18n import UiStrings, translate from openlp.core.common.settings import Settings -from openlp.core.lib import SettingsTab +from openlp.core.lib.settingstab import SettingsTab from openlp.core.lib.ui import create_valign_selection_widgets from openlp.core.widgets.buttons import ColorButton diff --git a/openlp/plugins/bibles/bibleplugin.py b/openlp/plugins/bibles/bibleplugin.py index dcf8c988f..1b507e97f 100644 --- a/openlp/plugins/bibles/bibleplugin.py +++ b/openlp/plugins/bibles/bibleplugin.py @@ -26,7 +26,8 @@ from openlp.core.api.http import register_endpoint from openlp.core.common.actions import ActionList from openlp.core.common.i18n import UiStrings, translate from openlp.core.ui.icons import UiIcons -from openlp.core.lib import Plugin, StringContent, build_icon +from openlp.core.lib import build_icon +from openlp.core.lib.plugin import Plugin, StringContent from openlp.core.lib.ui import create_action from openlp.plugins.bibles.endpoint import api_bibles_endpoint, bibles_endpoint from openlp.plugins.bibles.lib import BibleManager, BiblesTab, BibleMediaItem, LayoutStyle, DisplayStyle, \ diff --git a/openlp/plugins/bibles/lib/bibleimport.py b/openlp/plugins/bibles/lib/bibleimport.py index 4804362c6..8ffb8e5b5 100644 --- a/openlp/plugins/bibles/lib/bibleimport.py +++ b/openlp/plugins/bibles/lib/bibleimport.py @@ -27,7 +27,7 @@ from lxml import etree, objectify from openlp.core.common.i18n import get_language, translate from openlp.core.common.mixins import LogMixin, RegistryProperties from openlp.core.common.registry import Registry -from openlp.core.lib import ValidationError +from openlp.core.lib.exceptions import ValidationError from openlp.core.lib.ui import critical_error_message_box from openlp.plugins.bibles.lib.db import AlternativeBookNamesDB, BibleDB, BiblesResourcesDB diff --git a/openlp/plugins/bibles/lib/biblestab.py b/openlp/plugins/bibles/lib/biblestab.py index c98ff2943..fa90811a4 100644 --- a/openlp/plugins/bibles/lib/biblestab.py +++ b/openlp/plugins/bibles/lib/biblestab.py @@ -27,7 +27,7 @@ from PyQt5 import QtCore, QtGui, QtWidgets from openlp.core.common.i18n import UiStrings, translate from openlp.core.common.registry import Registry from openlp.core.common.settings import Settings -from openlp.core.lib import SettingsTab +from openlp.core.lib.settingstab 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/mediaitem.py b/openlp/plugins/bibles/lib/mediaitem.py index 291a26054..32ca16bd6 100755 --- a/openlp/plugins/bibles/lib/mediaitem.py +++ b/openlp/plugins/bibles/lib/mediaitem.py @@ -29,7 +29,9 @@ from PyQt5 import QtCore, QtWidgets from openlp.core.common.i18n import UiStrings, translate, get_locale_key from openlp.core.common.registry import Registry from openlp.core.common.settings import Settings -from openlp.core.lib import MediaManagerItem, ItemCapabilities, ServiceItemContext +from openlp.core.lib import ServiceItemContext +from openlp.core.lib.mediamanageritem import MediaManagerItem +from openlp.core.lib.serviceitem import ItemCapabilities 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 from openlp.core.ui.icons import UiIcons diff --git a/openlp/plugins/custom/customplugin.py b/openlp/plugins/custom/customplugin.py index cc9ec4f17..194553bfd 100644 --- a/openlp/plugins/custom/customplugin.py +++ b/openlp/plugins/custom/customplugin.py @@ -29,7 +29,8 @@ import logging from openlp.core.api.http import register_endpoint from openlp.core.common.i18n import translate from openlp.core.ui.icons import UiIcons -from openlp.core.lib import Plugin, StringContent, build_icon +from openlp.core.lib import build_icon +from openlp.core.lib.plugin import Plugin, StringContent from openlp.core.lib.db import Manager from openlp.plugins.custom.endpoint import api_custom_endpoint, custom_endpoint from openlp.plugins.custom.lib import CustomMediaItem, CustomTab diff --git a/openlp/plugins/custom/lib/customtab.py b/openlp/plugins/custom/lib/customtab.py index 40a36f6c7..1150b9c0f 100644 --- a/openlp/plugins/custom/lib/customtab.py +++ b/openlp/plugins/custom/lib/customtab.py @@ -27,7 +27,7 @@ from PyQt5 import QtCore, QtWidgets from openlp.core.common.i18n import translate from openlp.core.common.settings import Settings -from openlp.core.lib import SettingsTab +from openlp.core.lib.settingstab import SettingsTab class CustomTab(SettingsTab): diff --git a/openlp/plugins/custom/lib/mediaitem.py b/openlp/plugins/custom/lib/mediaitem.py index 02aa5c70f..77441d2a4 100644 --- a/openlp/plugins/custom/lib/mediaitem.py +++ b/openlp/plugins/custom/lib/mediaitem.py @@ -28,8 +28,10 @@ from sqlalchemy.sql import or_, func, and_ from openlp.core.common.i18n import UiStrings, translate from openlp.core.common.registry import Registry from openlp.core.common.settings import Settings -from openlp.core.lib import MediaManagerItem, ItemCapabilities, ServiceItemContext, PluginStatus, \ - check_item_selected +from openlp.core.lib import ServiceItemContext, check_item_selected +from openlp.core.lib.mediamanageritem import MediaManagerItem +from openlp.core.lib.serviceitem import ItemCapabilities +from openlp.core.lib.plugin import PluginStatus from openlp.core.lib.ui import create_widget_action from openlp.core.ui.icons import UiIcons from openlp.plugins.custom.forms.editcustomform import EditCustomForm diff --git a/openlp/plugins/images/imageplugin.py b/openlp/plugins/images/imageplugin.py index 231273548..cb6f91741 100644 --- a/openlp/plugins/images/imageplugin.py +++ b/openlp/plugins/images/imageplugin.py @@ -28,7 +28,8 @@ from openlp.core.api.http import register_endpoint from openlp.core.common.i18n import translate from openlp.core.ui.icons import UiIcons from openlp.core.common.settings import Settings -from openlp.core.lib import Plugin, StringContent, ImageSource, build_icon +from openlp.core.lib import ImageSource, build_icon +from openlp.core.lib.plugin import Plugin, StringContent from openlp.core.lib.db import Manager from openlp.plugins.images.endpoint import api_images_endpoint, images_endpoint from openlp.plugins.images.lib import ImageMediaItem, ImageTab, upgrade diff --git a/openlp/plugins/images/lib/imagetab.py b/openlp/plugins/images/lib/imagetab.py index 3f559bb0d..a3845dba3 100644 --- a/openlp/plugins/images/lib/imagetab.py +++ b/openlp/plugins/images/lib/imagetab.py @@ -24,7 +24,7 @@ from PyQt5 import QtWidgets from openlp.core.common.i18n import UiStrings, translate from openlp.core.common.settings import Settings -from openlp.core.lib import SettingsTab +from openlp.core.lib.settingstab import SettingsTab from openlp.core.widgets.buttons import ColorButton diff --git a/openlp/plugins/images/lib/mediaitem.py b/openlp/plugins/images/lib/mediaitem.py index 393cfdb22..8d7701696 100644 --- a/openlp/plugins/images/lib/mediaitem.py +++ b/openlp/plugins/images/lib/mediaitem.py @@ -30,8 +30,11 @@ from openlp.core.common.i18n import UiStrings, translate, get_natural_key from openlp.core.common.path import Path, create_paths from openlp.core.common.registry import Registry from openlp.core.common.settings import Settings -from openlp.core.lib import ItemCapabilities, MediaManagerItem, ServiceItemContext, StringContent, build_icon, \ - check_item_selected, create_thumb, validate_thumb +from openlp.core.lib import ServiceItemContext, build_icon, check_item_selected, \ + create_thumb, validate_thumb +from openlp.core.lib.mediamanageritem import MediaManagerItem +from openlp.core.lib.serviceitem import ItemCapabilities +from openlp.core.lib.plugin import StringContent from openlp.core.lib.ui import create_widget_action, critical_error_message_box from openlp.core.ui.icons import UiIcons from openlp.core.widgets.views import TreeWidgetWithDnD diff --git a/openlp/plugins/media/lib/mediaitem.py b/openlp/plugins/media/lib/mediaitem.py index 30349c6e5..c77b42288 100644 --- a/openlp/plugins/media/lib/mediaitem.py +++ b/openlp/plugins/media/lib/mediaitem.py @@ -31,8 +31,9 @@ from openlp.core.common.mixins import RegistryProperties from openlp.core.common.path import Path, path_to_str, create_paths from openlp.core.common.registry import Registry from openlp.core.common.settings import Settings -from openlp.core.lib import ItemCapabilities, MediaManagerItem, MediaType, ServiceItem, ServiceItemContext, \ - check_item_selected +from openlp.core.lib import MediaType, ServiceItemContext, check_item_selected +from openlp.core.lib.mediamanageritem import MediaManagerItem +from openlp.core.lib.serviceitem import ItemCapabilities, ServiceItem from openlp.core.lib.ui import create_widget_action, critical_error_message_box, create_horizontal_adjusting_combo_box from openlp.core.ui import DisplayControllerType from openlp.core.ui.icons import UiIcons diff --git a/openlp/plugins/media/lib/mediatab.py b/openlp/plugins/media/lib/mediatab.py index 9842be5b6..297a9e723 100644 --- a/openlp/plugins/media/lib/mediatab.py +++ b/openlp/plugins/media/lib/mediatab.py @@ -24,7 +24,7 @@ from PyQt5 import QtWidgets from openlp.core.common.i18n import UiStrings, translate from openlp.core.common.settings import Settings -from openlp.core.lib import SettingsTab +from openlp.core.lib.settingstab import SettingsTab class MediaTab(SettingsTab): diff --git a/openlp/plugins/media/mediaplugin.py b/openlp/plugins/media/mediaplugin.py index b81d730d5..1b3130705 100644 --- a/openlp/plugins/media/mediaplugin.py +++ b/openlp/plugins/media/mediaplugin.py @@ -33,7 +33,8 @@ from openlp.core.common.applocation import AppLocation from openlp.core.common.i18n import translate from openlp.core.ui.icons import UiIcons from openlp.core.common.path import Path -from openlp.core.lib import Plugin, StringContent, build_icon +from openlp.core.lib import build_icon +from openlp.core.lib.plugin import Plugin, StringContent from openlp.plugins.media.endpoint import api_media_endpoint, media_endpoint 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 b0072ce83..468bd75f9 100644 --- a/openlp/plugins/presentations/lib/mediaitem.py +++ b/openlp/plugins/presentations/lib/mediaitem.py @@ -27,8 +27,10 @@ from openlp.core.common.i18n import UiStrings, translate, get_natural_key from openlp.core.common.path import path_to_str, str_to_path from openlp.core.common.registry import Registry from openlp.core.common.settings import Settings -from openlp.core.lib import MediaManagerItem, ItemCapabilities, ServiceItemContext, \ - build_icon, check_item_selected, create_thumb, validate_thumb +from openlp.core.lib import ServiceItemContext, build_icon, check_item_selected, \ + create_thumb, validate_thumb +from openlp.core.lib.mediamanageritem import MediaManagerItem +from openlp.core.lib.serviceitem import ItemCapabilities from openlp.core.lib.ui import critical_error_message_box, create_horizontal_adjusting_combo_box from openlp.core.ui.icons import UiIcons from openlp.plugins.presentations.lib import MessageListener diff --git a/openlp/plugins/presentations/lib/presentationtab.py b/openlp/plugins/presentations/lib/presentationtab.py index d2856d143..e1437b875 100644 --- a/openlp/plugins/presentations/lib/presentationtab.py +++ b/openlp/plugins/presentations/lib/presentationtab.py @@ -24,7 +24,7 @@ from PyQt5 import QtWidgets from openlp.core.common.i18n import UiStrings, translate from openlp.core.common.settings import Settings -from openlp.core.lib import SettingsTab +from openlp.core.lib.settingstab import SettingsTab from openlp.core.lib.ui import critical_error_message_box from openlp.core.widgets.edits import PathEdit from openlp.plugins.presentations.lib.pdfcontroller import PdfController diff --git a/openlp/plugins/presentations/presentationplugin.py b/openlp/plugins/presentations/presentationplugin.py index fa72c5eb1..c64df5cde 100644 --- a/openlp/plugins/presentations/presentationplugin.py +++ b/openlp/plugins/presentations/presentationplugin.py @@ -33,7 +33,8 @@ from openlp.core.common import extension_loader from openlp.core.common.i18n import translate from openlp.core.ui.icons import UiIcons from openlp.core.common.settings import Settings -from openlp.core.lib import Plugin, StringContent, build_icon +from openlp.core.lib import build_icon +from openlp.core.lib.plugin import Plugin, StringContent from openlp.plugins.presentations.endpoint import api_presentations_endpoint, presentations_endpoint from openlp.plugins.presentations.lib import PresentationController, PresentationMediaItem, PresentationTab diff --git a/openlp/plugins/songs/forms/editsongform.py b/openlp/plugins/songs/forms/editsongform.py index 53aa443bb..06ca0d893 100644 --- a/openlp/plugins/songs/forms/editsongform.py +++ b/openlp/plugins/songs/forms/editsongform.py @@ -33,7 +33,8 @@ from openlp.core.common.i18n import UiStrings, translate, get_natural_key from openlp.core.common.mixins import RegistryProperties from openlp.core.common.path import create_paths, copyfile from openlp.core.common.registry import Registry -from openlp.core.lib import PluginStatus, MediaType, create_separated_list +from openlp.core.lib import MediaType, create_separated_list +from openlp.core.lib.plugin import PluginStatus from openlp.core.lib.ui import set_case_insensitive_completer, critical_error_message_box, find_and_set_in_combo_box from openlp.core.widgets.dialogs import FileDialog from openlp.plugins.songs.forms.editsongdialog import Ui_EditSongDialog diff --git a/openlp/plugins/songs/lib/mediaitem.py b/openlp/plugins/songs/lib/mediaitem.py index 53b7f544f..51f4d0407 100644 --- a/openlp/plugins/songs/lib/mediaitem.py +++ b/openlp/plugins/songs/lib/mediaitem.py @@ -31,8 +31,10 @@ from openlp.core.ui.icons import UiIcons from openlp.core.common.path import copyfile, create_paths from openlp.core.common.registry import Registry from openlp.core.common.settings import Settings -from openlp.core.lib import MediaManagerItem, ItemCapabilities, PluginStatus, ServiceItemContext, \ - check_item_selected, create_separated_list +from openlp.core.lib import ServiceItemContext, check_item_selected, create_separated_list +from openlp.core.lib.mediamanageritem import MediaManagerItem +from openlp.core.lib.plugin import PluginStatus +from openlp.core.lib.serviceitem import ItemCapabilities from openlp.core.lib.ui import create_widget_action from openlp.plugins.songs.forms.editsongform import EditSongForm from openlp.plugins.songs.forms.songexportform import SongExportForm diff --git a/openlp/plugins/songs/lib/openlyricsxml.py b/openlp/plugins/songs/lib/openlyricsxml.py index 63a528cfe..d5aecc178 100644 --- a/openlp/plugins/songs/lib/openlyricsxml.py +++ b/openlp/plugins/songs/lib/openlyricsxml.py @@ -63,7 +63,7 @@ from lxml import etree, objectify from openlp.core.common.i18n import translate from openlp.core.common.settings import Settings -from openlp.core.lib import FormattingTags +from openlp.core.lib.formattingtags import FormattingTags from openlp.core.version import get_version from openlp.plugins.songs.lib import VerseType, clean_song from openlp.plugins.songs.lib.db import Author, AuthorType, Book, Song, Topic diff --git a/openlp/plugins/songs/lib/songstab.py b/openlp/plugins/songs/lib/songstab.py index 37335f16f..f28728cf2 100644 --- a/openlp/plugins/songs/lib/songstab.py +++ b/openlp/plugins/songs/lib/songstab.py @@ -24,7 +24,7 @@ from PyQt5 import QtCore, QtWidgets from openlp.core.common.i18n import translate from openlp.core.common.settings import Settings -from openlp.core.lib import SettingsTab +from openlp.core.lib.settingstab import SettingsTab from openlp.plugins.songs.lib.ui import SongStrings diff --git a/openlp/plugins/songs/songsplugin.py b/openlp/plugins/songs/songsplugin.py index 176c6b6b7..e810dab3e 100644 --- a/openlp/plugins/songs/songsplugin.py +++ b/openlp/plugins/songs/songsplugin.py @@ -36,7 +36,8 @@ from openlp.core.common.actions import ActionList from openlp.core.common.i18n import UiStrings, translate from openlp.core.ui.icons import UiIcons from openlp.core.common.registry import Registry -from openlp.core.lib import Plugin, StringContent, build_icon +from openlp.core.lib import build_icon +from openlp.core.lib.plugin import Plugin, StringContent from openlp.core.lib.db import Manager from openlp.core.lib.ui import create_action from openlp.plugins.songs import reporting diff --git a/openlp/plugins/songusage/songusageplugin.py b/openlp/plugins/songusage/songusageplugin.py index 6d600dfb6..a0dcff54f 100644 --- a/openlp/plugins/songusage/songusageplugin.py +++ b/openlp/plugins/songusage/songusageplugin.py @@ -29,7 +29,7 @@ from openlp.core.common.actions import ActionList from openlp.core.common.i18n import translate from openlp.core.common.registry import Registry from openlp.core.common.settings import Settings -from openlp.core.lib import Plugin, StringContent +from openlp.core.lib.plugin import Plugin, StringContent from openlp.core.lib.db import Manager from openlp.core.lib.ui import create_action from openlp.core.ui.icons import UiIcons diff --git a/scripts/mp_update.py b/scripts/mp_update.py new file mode 100644 index 000000000..303913f9a --- /dev/null +++ b/scripts/mp_update.py @@ -0,0 +1,61 @@ +#!/usr/bin/env python2 +import sys +import os +from argparse import ArgumentParser +from launchpadlib.credentials import UnencryptedFileCredentialStore +from launchpadlib.launchpad import Launchpad + +HERE = os.path.dirname(os.path.abspath(__file__)) + + +def parse_args(): + """ + Parse the command line arguments + """ + parser = ArgumentParser() + parser.add_argument('-p', '--merge-proposal', required=True, + help='The main part of the URL to the merge proposal, without the hostname.') + parser.add_argument('-m', '--message', required=True, + help='The comment to add to the merge proposal') + parser.add_argument('-s', '--subject', default=None, help='The subject for the comment') + return parser.parse_args() + + +def get_merge_proposal(merge_proposal_url): + """ + Get the merge proposal for the ``merge_proposal_url`` + """ + lp = Launchpad.login_with('OpenLP CI', 'production', version='devel', + credential_store=UnencryptedFileCredentialStore(os.path.join(HERE, 'launchpadcreds.txt'))) + openlp_project = lp.projects['openlp'] + merge_proposals = openlp_project.getMergeProposals() + for merge_proposal in merge_proposals: + if str(merge_proposal).endswith(merge_proposal_url): + return merge_proposal + return None + + +def create_comment(merge_proposal, comment, subject): + """ + Create a comment on the merge proposal + """ + if not subject: + subject = 'Jenkins test update' + merge_proposal.createComment(subject=subject, content=comment) + + +def main(): + """ + Run the thing + """ + args = parse_args() + merge_proposal = get_merge_proposal(args.merge_proposal) + if not merge_proposal: + print('No merge proposal with that URL found') + sys.exit(1) + else: + create_comment(merge_proposal, args.message, args.subject) + + +if __name__ == '__main__': + main() diff --git a/setup.py b/setup.py index fdbcdaea5..a28fa0300 100755 --- a/setup.py +++ b/setup.py @@ -99,10 +99,11 @@ try: if tree_revision == tag_revision: version_string = tag_version.decode('utf-8') else: - version_string = '%s-bzr%s' % (tag_version.decode('utf-8'), tree_revision.decode('utf-8')) + version_string = '{version}.dev{revision}'.format(version=tag_version.decode('utf-8'), + revision=tree_revision.decode('utf-8')) ver_file = open(VERSION_FILE, 'w') ver_file.write(version_string) -except: +except Exception: ver_file = open(VERSION_FILE, 'r') version_string = ver_file.read().strip() finally: diff --git a/tests/functional/openlp_core/api/endpoint/test_controller.py b/tests/functional/openlp_core/api/endpoint/test_controller.py index c8fc70057..2d9bf3307 100644 --- a/tests/functional/openlp_core/api/endpoint/test_controller.py +++ b/tests/functional/openlp_core/api/endpoint/test_controller.py @@ -28,7 +28,7 @@ from openlp.core.common.registry import Registry from openlp.core.api.endpoint.controller import controller_text, controller_direction from openlp.core.display.renderer import Renderer from openlp.core.display.screens import ScreenList -from openlp.core.lib import ServiceItem +from openlp.core.lib.serviceitem import ServiceItem from tests.utils import convert_file_service_item from tests.utils.constants import RESOURCE_PATH diff --git a/tests/functional/openlp_core/common/test_i18n.py b/tests/functional/openlp_core/common/test_i18n.py index 16d321f4f..7dadcb976 100644 --- a/tests/functional/openlp_core/common/test_i18n.py +++ b/tests/functional/openlp_core/common/test_i18n.py @@ -27,7 +27,8 @@ from unittest.mock import MagicMock, patch from openlp.core.common import is_macosx from openlp.core.common.i18n import LANGUAGES, Language, UiStrings, get_language, get_locale_key, get_natural_key, \ - translate + translate, LanguageManager +from openlp.core.common.settings import Settings def test_languages_type(): @@ -158,6 +159,14 @@ def test_check_same_instance(): assert first_instance is second_instance, 'Two UiStrings objects should be the same instance' +def test_get_language_from_settings(): + assert LanguageManager.get_language() == 'en' + +def test_get_language_from_settings_returns_unchanged_if_unknown_format(): + Settings().setValue('core/language', '(foobar)') + assert LanguageManager.get_language() == '(foobar)' + + def test_translate(): """ Test the translate() function diff --git a/tests/functional/openlp_core/lib/test_formattingtags.py b/tests/functional/openlp_core/lib/test_formattingtags.py index 0787c67eb..151611496 100644 --- a/tests/functional/openlp_core/lib/test_formattingtags.py +++ b/tests/functional/openlp_core/lib/test_formattingtags.py @@ -26,7 +26,7 @@ import copy from unittest import TestCase from unittest.mock import patch -from openlp.core.lib import FormattingTags +from openlp.core.lib.formattingtags import FormattingTags TAG = { 'end tag': '{/aa}', diff --git a/tests/functional/openlp_core/lib/test_lib.py b/tests/functional/openlp_core/lib/test_lib.py index 8ea1c00de..46bf658a2 100644 --- a/tests/functional/openlp_core/lib/test_lib.py +++ b/tests/functional/openlp_core/lib/test_lib.py @@ -30,6 +30,7 @@ from PyQt5 import QtCore, QtGui from openlp.core.common.path import Path from openlp.core.lib import build_icon, check_item_selected, create_separated_list, create_thumb, \ get_text_file_string, image_to_byte, resize_image, str_to_bool, validate_thumb +from openlp.core.lib.formattingtags import FormattingTags from tests.utils.constants import RESOURCE_PATH diff --git a/tests/functional/openlp_core/lib/test_mediamanageritem.py b/tests/functional/openlp_core/lib/test_mediamanageritem.py index aba4d4c06..7acc46146 100644 --- a/tests/functional/openlp_core/lib/test_mediamanageritem.py +++ b/tests/functional/openlp_core/lib/test_mediamanageritem.py @@ -25,7 +25,7 @@ Package to test the openlp.core.lib.mediamanageritem package. from unittest import TestCase from unittest.mock import MagicMock, patch -from openlp.core.lib import MediaManagerItem +from openlp.core.lib.mediamanageritem import MediaManagerItem from tests.helpers.testmixin import TestMixin diff --git a/tests/functional/openlp_core/lib/test_pluginmanager.py b/tests/functional/openlp_core/lib/test_pluginmanager.py index a2e981276..9d2966746 100644 --- a/tests/functional/openlp_core/lib/test_pluginmanager.py +++ b/tests/functional/openlp_core/lib/test_pluginmanager.py @@ -27,7 +27,7 @@ from unittest.mock import MagicMock, patch from openlp.core.common.registry import Registry from openlp.core.common.settings import Settings -from openlp.core.lib import PluginStatus +from openlp.core.lib.plugin import PluginStatus from openlp.core.lib.pluginmanager import PluginManager diff --git a/tests/functional/openlp_core/lib/test_serviceitem.py b/tests/functional/openlp_core/lib/test_serviceitem.py index 85d3b1050..b860ea790 100644 --- a/tests/functional/openlp_core/lib/test_serviceitem.py +++ b/tests/functional/openlp_core/lib/test_serviceitem.py @@ -30,7 +30,8 @@ from openlp.core.common import md5_hash from openlp.core.common.path import Path from openlp.core.common.registry import Registry from openlp.core.common.settings import Settings -from openlp.core.lib import ItemCapabilities, ServiceItem, ServiceItemType, FormattingTags +from openlp.core.lib.formattingtags import FormattingTags +from openlp.core.lib.serviceitem import ItemCapabilities, ServiceItem, ServiceItemType from tests.helpers.testmixin import TestMixin from tests.utils import assert_length, convert_file_service_item from tests.utils.constants import RESOURCE_PATH diff --git a/tests/functional/openlp_core/ui/media/test_systemplayer.py b/tests/functional/openlp_core/ui/media/test_systemplayer.py index fc03e2541..1726f7e2e 100644 --- a/tests/functional/openlp_core/ui/media/test_systemplayer.py +++ b/tests/functional/openlp_core/ui/media/test_systemplayer.py @@ -508,6 +508,30 @@ class TestCheckMediaWorker(TestCase): # THEN: The correct values should be set up assert worker is not None + @patch('openlp.core.ui.media.systemplayer.functools.partial') + @patch('openlp.core.ui.media.systemplayer.QtMultimedia.QMediaContent') + def test_start(self, MockQMediaContent, mocked_partial): + """ + Test the start method + """ + # GIVEN: A CheckMediaWorker instance + worker = CheckMediaWorker('file.ogv') + MockQMediaContent.side_effect = lambda x: x + mocked_partial.side_effect = lambda x, y: y + + # WHEN: start() is called + with patch.object(worker, 'error') as mocked_error, \ + patch.object(worker, 'mediaStatusChanged') as mocked_status_change, \ + patch.object(worker, 'setMedia') as mocked_set_media, \ + patch.object(worker, 'play') as mocked_play: + worker.start() + + # THEN: The correct methods should be called + mocked_error.connect.assert_called_once_with('error') + mocked_status_change.connect.assert_called_once_with('media') + mocked_set_media.assert_called_once_with(QtCore.QUrl('file:file.ogv')) + mocked_play.assert_called_once_with() + def test_signals_media(self): """ Test the signals() signal of the CheckMediaWorker class with a "media" origin diff --git a/tests/functional/openlp_core/ui/test_firsttimeform.py b/tests/functional/openlp_core/ui/test_firsttimeform.py index cd507452e..76f1be051 100644 --- a/tests/functional/openlp_core/ui/test_firsttimeform.py +++ b/tests/functional/openlp_core/ui/test_firsttimeform.py @@ -233,3 +233,39 @@ class TestFirstTimeForm(TestCase, TestMixin): mocked_message_box.critical.assert_called_once_with( first_time_form, 'Network Error', 'There was a network error attempting to connect to retrieve ' 'initial configuration information', 'OK') + + @patch('openlp.core.ui.firsttimewizard.Settings') + def test_on_projectors_check_box_checked(self, MockSettings): + """ + Test that the projector panel is shown when the checkbox in the first time wizard is checked + """ + # GIVEN: A First Time Wizard and a mocked settings object + frw = FirstTimeForm(None) + mocked_settings = MagicMock() + mocked_settings.value.return_value = True + MockSettings.return_value = mocked_settings + + # WHEN: on_projectors_check_box_clicked() is called + frw.on_projectors_check_box_clicked() + + # THEN: The visibility of the projects panel should have been set + mocked_settings.value.assert_called_once_with('projector/show after wizard') + mocked_settings.setValue.assert_called_once_with('projector/show after wizard', False) + + @patch('openlp.core.ui.firsttimewizard.Settings') + def test_on_projectors_check_box_unchecked(self, MockSettings): + """ + Test that the projector panel is shown when the checkbox in the first time wizard is checked + """ + # GIVEN: A First Time Wizard and a mocked settings object + frw = FirstTimeForm(None) + mocked_settings = MagicMock() + mocked_settings.value.return_value = False + MockSettings.return_value = mocked_settings + + # WHEN: on_projectors_check_box_clicked() is called + frw.on_projectors_check_box_clicked() + + # THEN: The visibility of the projects panel should have been set + mocked_settings.value.assert_called_once_with('projector/show after wizard') + mocked_settings.setValue.assert_called_once_with('projector/show after wizard', True) diff --git a/tests/functional/openlp_core/ui/test_formattingtagscontroller.py b/tests/functional/openlp_core/ui/test_formattingtagscontroller.py index f4fb9f571..48ebddbe6 100644 --- a/tests/functional/openlp_core/ui/test_formattingtagscontroller.py +++ b/tests/functional/openlp_core/ui/test_formattingtagscontroller.py @@ -24,7 +24,7 @@ Package to test the openlp.core.ui.formattingtagscontroller package. """ from unittest import TestCase -from openlp.core.ui import FormattingTagController +from openlp.core.ui.formattingtagcontroller import FormattingTagController class TestFormattingTagController(TestCase): diff --git a/tests/functional/openlp_core/ui/test_servicemanager.py b/tests/functional/openlp_core/ui/test_servicemanager.py index 53c612698..89080f835 100644 --- a/tests/functional/openlp_core/ui/test_servicemanager.py +++ b/tests/functional/openlp_core/ui/test_servicemanager.py @@ -30,8 +30,8 @@ import PyQt5 from openlp.core.common import ThemeLevel from openlp.core.common.registry import Registry -from openlp.core.lib import ServiceItem, ServiceItemType, ItemCapabilities -from openlp.core.ui import ServiceManager +from openlp.core.lib.serviceitem import ServiceItem, ServiceItemType, ItemCapabilities +from openlp.core.ui.servicemanager import ServiceManager from openlp.core.widgets.toolbar import OpenLPToolbar diff --git a/tests/functional/openlp_core/ui/test_themeform.py b/tests/functional/openlp_core/ui/test_themeform.py index 31e4f4acb..44c0e1435 100644 --- a/tests/functional/openlp_core/ui/test_themeform.py +++ b/tests/functional/openlp_core/ui/test_themeform.py @@ -26,7 +26,7 @@ from unittest import TestCase from unittest.mock import MagicMock, patch from openlp.core.common.path import Path -from openlp.core.ui import ThemeForm +from openlp.core.ui.themeform import ThemeForm class TestThemeManager(TestCase): @@ -34,7 +34,7 @@ class TestThemeManager(TestCase): Test the functions in the ThemeManager Class """ def setUp(self): - with patch('openlp.core.ui.ThemeForm._setup'): + with patch('openlp.core.ui.themeform.ThemeForm._setup'): self.instance = ThemeForm(None) def test_on_image_path_edit_path_changed(self): diff --git a/tests/functional/openlp_core/ui/test_thememanager.py b/tests/functional/openlp_core/ui/test_thememanager.py index ba5f7fc05..54d2687e3 100644 --- a/tests/functional/openlp_core/ui/test_thememanager.py +++ b/tests/functional/openlp_core/ui/test_thememanager.py @@ -32,7 +32,7 @@ from PyQt5 import QtWidgets from openlp.core.common.path import Path from openlp.core.common.registry import Registry -from openlp.core.ui import ThemeManager +from openlp.core.ui.thememanager import ThemeManager from tests.utils.constants import RESOURCE_PATH diff --git a/tests/functional/openlp_plugins/bibles/test_mediaitem.py b/tests/functional/openlp_plugins/bibles/test_mediaitem.py index 4508e864e..2e7d76e90 100755 --- a/tests/functional/openlp_plugins/bibles/test_mediaitem.py +++ b/tests/functional/openlp_plugins/bibles/test_mediaitem.py @@ -28,7 +28,7 @@ from unittest.mock import MagicMock, call, patch from PyQt5 import QtCore, QtWidgets from openlp.core.common.registry import Registry -from openlp.core.lib import MediaManagerItem +from openlp.core.lib.mediamanageritem import MediaManagerItem from openlp.plugins.bibles.lib.mediaitem import BibleMediaItem, BibleSearch, ResultsTab, SearchStatus, SearchTabs, \ get_reference_separators, VALID_TEXT_SEARCH from tests.helpers.testmixin import TestMixin diff --git a/tests/functional/openlp_plugins/custom/test_mediaitem.py b/tests/functional/openlp_plugins/custom/test_mediaitem.py index faa091bef..e934adb10 100644 --- a/tests/functional/openlp_plugins/custom/test_mediaitem.py +++ b/tests/functional/openlp_plugins/custom/test_mediaitem.py @@ -28,7 +28,8 @@ from unittest.mock import patch, MagicMock from PyQt5 import QtCore from openlp.core.common.registry import Registry -from openlp.core.lib import ServiceItem, PluginStatus +from openlp.core.lib.plugin import PluginStatus +from openlp.core.lib.serviceitem import ServiceItem from openlp.plugins.custom.lib import CustomMediaItem from tests.helpers.testmixin import TestMixin diff --git a/tests/functional/openlp_plugins/songs/test_mediaitem.py b/tests/functional/openlp_plugins/songs/test_mediaitem.py index afe8b370b..a63e16a72 100644 --- a/tests/functional/openlp_plugins/songs/test_mediaitem.py +++ b/tests/functional/openlp_plugins/songs/test_mediaitem.py @@ -29,7 +29,7 @@ from PyQt5 import QtCore from openlp.core.common.registry import Registry from openlp.core.common.settings import Settings -from openlp.core.lib import ServiceItem +from openlp.core.lib.serviceitem import ServiceItem from openlp.plugins.songs.lib.db import AuthorType, Song from openlp.plugins.songs.lib.mediaitem import SongMediaItem from tests.helpers.testmixin import TestMixin diff --git a/tests/interfaces/openlp_core/ui/test_filerenamedialog.py b/tests/interfaces/openlp_core/ui/test_filerenamedialog.py index ebff60310..be1ceab9d 100644 --- a/tests/interfaces/openlp_core/ui/test_filerenamedialog.py +++ b/tests/interfaces/openlp_core/ui/test_filerenamedialog.py @@ -28,7 +28,7 @@ from unittest.mock import MagicMock, patch from PyQt5 import QtTest, QtWidgets from openlp.core.common.registry import Registry -from openlp.core.ui import filerenameform +from openlp.core.ui.filerenameform import FileRenameForm from tests.helpers.testmixin import TestMixin @@ -42,7 +42,7 @@ class TestStartFileRenameForm(TestCase, TestMixin): self.setup_application() self.main_window = QtWidgets.QMainWindow() Registry().register('main_window', self.main_window) - self.form = filerenameform.FileRenameForm() + self.form = FileRenameForm() def tearDown(self): """ diff --git a/tests/interfaces/openlp_core/ui/test_servicemanager.py b/tests/interfaces/openlp_core/ui/test_servicemanager.py index aab7abf27..007b3fb8a 100644 --- a/tests/interfaces/openlp_core/ui/test_servicemanager.py +++ b/tests/interfaces/openlp_core/ui/test_servicemanager.py @@ -29,7 +29,7 @@ from PyQt5 import QtCore, QtGui, QtWidgets from openlp.core.common.registry import Registry -from openlp.core.lib import ServiceItem, ItemCapabilities +from openlp.core.lib.serviceitem import ServiceItem, ItemCapabilities from openlp.core.ui.servicemanager import ServiceManager from tests.helpers.testmixin import TestMixin diff --git a/tests/interfaces/openlp_core/ui/test_thememanager.py b/tests/interfaces/openlp_core/ui/test_thememanager.py index e308ae00e..ea4beef01 100644 --- a/tests/interfaces/openlp_core/ui/test_thememanager.py +++ b/tests/interfaces/openlp_core/ui/test_thememanager.py @@ -28,7 +28,7 @@ from unittest.mock import patch, MagicMock from openlp.core.common.path import Path from openlp.core.common.registry import Registry from openlp.core.common.settings import Settings -from openlp.core.ui import ThemeManager +from openlp.core.ui.thememanager import ThemeManager from tests.helpers.testmixin import TestMixin diff --git a/tests/interfaces/openlp_core/widgets/test_views.py b/tests/interfaces/openlp_core/widgets/test_views.py index a4b0cb4fb..eb641fd15 100644 --- a/tests/interfaces/openlp_core/widgets/test_views.py +++ b/tests/interfaces/openlp_core/widgets/test_views.py @@ -28,7 +28,7 @@ from unittest.mock import MagicMock, patch from PyQt5 import QtGui, QtWidgets from openlp.core.common.registry import Registry -from openlp.core.lib import ServiceItem +from openlp.core.lib.serviceitem import ServiceItem from openlp.core.widgets.views import ListPreviewWidget from tests.helpers.testmixin import TestMixin from tests.utils.osdinteraction import read_service_from_file diff --git a/tests/openlp_core/ui/test_themeform.py b/tests/openlp_core/ui/test_themeform.py new file mode 100644 index 000000000..a45654943 --- /dev/null +++ b/tests/openlp_core/ui/test_themeform.py @@ -0,0 +1,49 @@ +# -*- coding: utf-8 -*- +# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4 + +############################################################################### +# OpenLP - Open Source Lyrics Projection # +# --------------------------------------------------------------------------- # +# Copyright (c) 2008-2018 OpenLP Developers # +# --------------------------------------------------------------------------- # +# 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 # +############################################################################### +""" +Interface tests to test the ThemeWizard class and related methods. +""" +from unittest import TestCase + +from openlp.core.common.registry import Registry +from openlp.core.ui.themeform import ThemeForm +from tests.helpers.testmixin import TestMixin + + +class TestThemeManager(TestCase, TestMixin): + """ + Test the functions in the ThemeManager module + """ + def setUp(self): + """ + Create the UI + """ + Registry.create() + + def test_create_theme_wizard(self): + """ + Test creating a ThemeForm instance + """ + # GIVEN: A ThemeForm class + # WHEN: An object is created + # THEN: There should be no problems + ThemeForm(None)