fix trunk

This commit is contained in:
Tim Bentley 2014-03-18 20:36:02 +00:00
commit 30835067d3
90 changed files with 1048 additions and 1237 deletions

View File

@ -115,3 +115,38 @@ class RegistryProperties(object):
self._main_window = Registry().get('main_window')
return self._main_window
@property
def renderer(self):
"""
Adds the Renderer to the class dynamically
"""
if not hasattr(self, '_renderer') or not self._renderer:
self._renderer = Registry().get('renderer')
return self._renderer
@property
def theme_manager(self):
"""
Adds the theme manager to the class dynamically
"""
if not hasattr(self, '_theme_manager') or not self._theme_manager:
self._theme_manager = Registry().get('theme_manager')
return self._theme_manager
@property
def settings_form(self):
"""
Adds the settings form to the class dynamically
"""
if not hasattr(self, '_settings_form') or not self._settings_form:
self._settings_form = Registry().get('settings_form')
return self._settings_form
@property
def alerts_manager(self):
"""
Adds the alerts manager to the class dynamically
"""
if not hasattr(self, '_alerts_manager') or not self._alerts_manager:
self._alerts_manager = Registry().get('alerts_manager')
return self._alerts_manager

View File

@ -35,7 +35,7 @@ import re
from PyQt4 import QtCore, QtGui
from openlp.core.common import Registry, Settings, UiStrings, translate
from openlp.core.common import Registry, RegistryProperties, Settings, UiStrings, translate
from openlp.core.lib import FileDialog, OpenLPToolbar, ServiceItem, StringContent, ListWidgetWithDnD, \
ServiceItemContext
from openlp.core.lib.searchedit import SearchEdit
@ -44,7 +44,7 @@ from openlp.core.lib.ui import create_widget_action, critical_error_message_box
log = logging.getLogger(__name__)
class MediaManagerItem(QtGui.QWidget):
class MediaManagerItem(QtGui.QWidget, RegistryProperties):
"""
MediaManagerItem is a helper widget for plugins.
@ -684,97 +684,3 @@ s
:param show_error: Should the error be shown (True)
"""
raise NotImplementedError('Plugin.search needs to be defined by the plugin')
def _get_main_window(self):
"""
Adds the main window to the class dynamically
"""
if not hasattr(self, '_main_window'):
self._main_window = Registry().get('main_window')
return self._main_window
main_window = property(_get_main_window)
def _get_renderer(self):
"""
Adds the Renderer to the class dynamically
"""
if not hasattr(self, '_renderer'):
self._renderer = Registry().get('renderer')
return self._renderer
renderer = property(_get_renderer)
def _get_live_controller(self):
"""
Adds the live controller to the class dynamically
"""
if not hasattr(self, '_live_controller'):
self._live_controller = Registry().get('live_controller')
return self._live_controller
live_controller = property(_get_live_controller)
def _get_preview_controller(self):
"""
Adds the preview controller to the class dynamically
"""
if not hasattr(self, '_preview_controller'):
self._preview_controller = Registry().get('preview_controller')
return self._preview_controller
preview_controller = property(_get_preview_controller)
def _get_plugin_manager(self):
"""
Adds the plugin manager to the class dynamically
"""
if not hasattr(self, '_plugin_manager'):
self._plugin_manager = Registry().get('plugin_manager')
return self._plugin_manager
plugin_manager = property(_get_plugin_manager)
def _get_media_controller(self):
"""
Adds the media controller to the class dynamically
"""
if not hasattr(self, '_media_controller'):
self._media_controller = Registry().get('media_controller')
return self._media_controller
media_controller = property(_get_media_controller)
def _get_service_manager(self):
"""
Adds the service manager to the class dynamically
"""
if not hasattr(self, '_service_manager'):
self._service_manager = Registry().get('service_manager')
return self._service_manager
service_manager = property(_get_service_manager)
def _get_theme_manager(self):
"""
Adds the theme manager to the class dynamically
"""
if not hasattr(self, '_theme_manager'):
self._theme_manager = Registry().get('theme_manager')
return self._theme_manager
theme_manager = property(_get_theme_manager)
def _get_application(self):
"""
Adds the openlp to the class dynamically.
Windows needs to access the application in a dynamic manner.
"""
if os.name == 'nt':
return Registry().get('application')
else:
if not hasattr(self, '_application'):
self._application = Registry().get('application')
return self._application
application = property(_get_application)

View File

@ -30,11 +30,11 @@
Provide the generic plugin functionality for OpenLP plugins.
"""
import logging
import os
from PyQt4 import QtCore
from openlp.core.common import Registry, Settings, UiStrings
from openlp.core.common import Registry, RegistryProperties, Settings, UiStrings
from openlp.core.utils import get_application_version
log = logging.getLogger(__name__)
@ -65,7 +65,7 @@ class StringContent(object):
VisibleName = 'visible_name'
class Plugin(QtCore.QObject):
class Plugin(QtCore.QObject, RegistryProperties):
"""
Base class for openlp plugins to inherit from.
@ -393,27 +393,4 @@ class Plugin(QtCore.QObject):
"""
The plugin's needs to handle a new song creation
"""
pass
def _get_main_window(self):
"""
Adds the main window to the class dynamically
"""
if not hasattr(self, '_main_window'):
self._main_window = Registry().get('main_window')
return self._main_window
main_window = property(_get_main_window)
def _get_application(self):
"""
Adds the openlp to the class dynamically
"""
if os.name == 'nt':
return Registry().get('application')
else:
if not hasattr(self, '_application'):
self._application = Registry().get('application')
return self._application
application = property(_get_application)
pass

View File

@ -34,10 +34,10 @@ import sys
import imp
from openlp.core.lib import Plugin, PluginStatus
from openlp.core.common import AppLocation, Registry, OpenLPMixin, RegistryMixin
from openlp.core.common import AppLocation, RegistryProperties, OpenLPMixin, RegistryMixin
class PluginManager(RegistryMixin, OpenLPMixin):
class PluginManager(RegistryMixin, OpenLPMixin, RegistryProperties):
"""
This is the Plugin manager, which loads all the plugins,
and executes all the hooks, as and when necessary.
@ -217,23 +217,3 @@ class PluginManager(RegistryMixin, OpenLPMixin):
for plugin in self.plugins:
if plugin.is_active():
plugin.new_service_created()
def _get_settings_form(self):
"""
Adds the plugin manager to the class dynamically
"""
if not hasattr(self, '_settings_form'):
self._settings_form = Registry().get('settings_form')
return self._settings_form
settings_form = property(_get_settings_form)
def _get_main_window(self):
"""
Adds the main window to the class dynamically
"""
if not hasattr(self, '_main_window'):
self._main_window = Registry().get('main_window')
return self._main_window
main_window = property(_get_main_window)

View File

@ -30,7 +30,7 @@
from PyQt4 import QtGui, QtCore, QtWebKit
from openlp.core.common import Registry, OpenLPMixin, RegistryMixin, Settings
from openlp.core.common import Registry, RegistryProperties, OpenLPMixin, RegistryMixin, Settings
from openlp.core.lib import FormattingTags, ImageSource, ItemCapabilities, ScreenList, ServiceItem, expand_tags, \
build_lyrics_format_css, build_lyrics_outline_css
from openlp.core.common import ThemeLevel
@ -47,7 +47,7 @@ VERSE_FOR_LINE_COUNT = '\n'.join(map(str, range(100)))
FOOTER = ['Arky Arky (Unknown)', 'Public Domain', 'CCLI 123456']
class Renderer(OpenLPMixin, RegistryMixin):
class Renderer(OpenLPMixin, RegistryMixin, RegistryProperties):
"""
Class to pull all Renderer interactions into one place. The plugins will call helper methods to do the rendering but
this class will provide display defense code.
@ -563,23 +563,3 @@ class Renderer(OpenLPMixin, RegistryMixin):
# this parse we are to be wordy
line = line.replace('\n', ' ')
return line.split(' ')
def _get_image_manager(self):
"""
Adds the image manager to the class dynamically
"""
if not hasattr(self, '_image_manager'):
self._image_manager = Registry().get('image_manager')
return self._image_manager
image_manager = property(_get_image_manager)
def _get_theme_manager(self):
"""
Adds the theme manager to the class dynamically
"""
if not hasattr(self, '_theme_manager') or not self._theme_manager :
self._theme_manager = Registry().get('theme_manager')
return self._theme_manager
theme_manager = property(_get_theme_manager)

View File

@ -39,7 +39,7 @@ import uuid
from PyQt4 import QtGui
from openlp.core.common import Registry, Settings, translate
from openlp.core.common import RegistryProperties, Settings, translate
from openlp.core.lib import ImageSource, build_icon, clean_tags, expand_tags
log = logging.getLogger(__name__)
@ -127,7 +127,7 @@ class ItemCapabilities(object):
CanAutoStartForLive = 16
class ServiceItem(object):
class ServiceItem(RegistryProperties):
"""
The service item is a base class for the plugins to use to interact with
the service manager, the slide controller, and the projection screen
@ -628,23 +628,3 @@ class ServiceItem(object):
if file_suffix.lower() not in suffix_list:
self.is_valid = False
break
def _get_renderer(self):
"""
Adds the Renderer to the class dynamically
"""
if not hasattr(self, '_renderer'):
self._renderer = Registry().get('renderer')
return self._renderer
renderer = property(_get_renderer)
def _get_image_manager(self):
"""
Adds the image manager to the class dynamically
"""
if not hasattr(self, '_image_manager'):
self._image_manager = Registry().get('image_manager')
return self._image_manager
image_manager = property(_get_image_manager)

View File

@ -35,10 +35,10 @@ own tab to the settings dialog.
from PyQt4 import QtGui
from openlp.core.common import Registry
from openlp.core.common import RegistryProperties
class SettingsTab(QtGui.QWidget):
class SettingsTab(QtGui.QWidget, RegistryProperties):
"""
SettingsTab is a helper widget for plugins to define Tabs for the settings dialog.
"""
@ -137,63 +137,3 @@ class SettingsTab(QtGui.QWidget):
Tab has just been made visible to the user
"""
self.tab_visited = True
def _get_service_manager(self):
"""
Adds the service manager to the class dynamically
"""
if not hasattr(self, '_service_manager'):
self._service_manager = Registry().get('service_manager')
return self._service_manager
service_manager = property(_get_service_manager)
def _get_main_window(self):
"""
Adds the main window to the class dynamically
"""
if not hasattr(self, '_main_window'):
self._main_window = Registry().get('main_window')
return self._main_window
main_window = property(_get_main_window)
def _get_renderer(self):
"""
Adds the Renderer to the class dynamically
"""
if not hasattr(self, '_renderer'):
self._renderer = Registry().get('renderer')
return self._renderer
renderer = property(_get_renderer)
def _get_theme_manager(self):
"""
Adds the theme manager to the class dynamically
"""
if not hasattr(self, '_theme_manager'):
self._theme_manager = Registry().get('theme_manager')
return self._theme_manager
theme_manager = property(_get_theme_manager)
def _get_media_controller(self):
"""
Adds the media controller to the class dynamically
"""
if not hasattr(self, '_media_controller'):
self._media_controller = Registry().get('media_controller')
return self._media_controller
media_controller = property(_get_media_controller)
def _get_settings_form(self):
"""
Adds the plugin manager to the class dynamically
"""
if not hasattr(self, '_settings_form'):
self._settings_form = Registry().get('settings_form')
return self._settings_form
settings_form = property(_get_settings_form)

View File

@ -38,7 +38,7 @@ import bs4
import sqlalchemy
from lxml import etree
from openlp.core.common import Registry
from openlp.core.common import RegistryProperties
from PyQt4 import Qt, QtCore, QtGui, QtWebKit
@ -93,7 +93,7 @@ from .exceptiondialog import Ui_ExceptionDialog
log = logging.getLogger(__name__)
class ExceptionForm(QtGui.QDialog, Ui_ExceptionDialog):
class ExceptionForm(QtGui.QDialog, Ui_ExceptionDialog, RegistryProperties):
"""
The exception dialog
"""
@ -260,13 +260,3 @@ class ExceptionForm(QtGui.QDialog, Ui_ExceptionDialog):
return '-'
except:
return '- (Possible non-standard UNO installation)'
def _get_main_window(self):
"""
Adds the main window to the class dynamically
"""
if not hasattr(self, '_main_window'):
self._main_window = Registry().get('main_window')
return self._main_window
main_window = property(_get_main_window)

View File

@ -34,10 +34,10 @@ from PyQt4 import QtGui
from .filerenamedialog import Ui_FileRenameDialog
from openlp.core.common import Registry, translate
from openlp.core.common import Registry, RegistryProperties, translate
class FileRenameForm(QtGui.QDialog, Ui_FileRenameDialog):
class FileRenameForm(QtGui.QDialog, Ui_FileRenameDialog, RegistryProperties):
"""
The file rename dialog
"""
@ -57,14 +57,4 @@ class FileRenameForm(QtGui.QDialog, Ui_FileRenameDialog):
else:
self.setWindowTitle(translate('OpenLP.FileRenameForm', 'File Rename'))
self.file_name_edit.setFocus()
return QtGui.QDialog.exec_(self)
def _get_main_window(self):
"""
Adds the main window to the class dynamically
"""
if not hasattr(self, '_main_window'):
self._main_window = Registry().get('main_window')
return self._main_window
main_window = property(_get_main_window)
return QtGui.QDialog.exec_(self)

View File

@ -41,7 +41,7 @@ from configparser import ConfigParser
from PyQt4 import QtCore, QtGui
from openlp.core.common import Registry, AppLocation, Settings, check_directory_exists, translate
from openlp.core.common import Registry, RegistryProperties, AppLocation, Settings, check_directory_exists, translate
from openlp.core.lib import PluginStatus, build_icon
from openlp.core.utils import get_web_page
from .firsttimewizard import Ui_FirstTimeWizard, FirstTimePage
@ -75,7 +75,7 @@ class ThemeScreenshotThread(QtCore.QThread):
item.setFlags(item.flags() | QtCore.Qt.ItemIsUserCheckable)
class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard, RegistryProperties):
"""
This is the Theme Import Wizard, which allows easy creation and editing of OpenLP themes.
"""
@ -468,28 +468,4 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
Set the status of a plugin.
"""
status = PluginStatus.Active if field.checkState() == QtCore.Qt.Checked else PluginStatus.Inactive
Settings().setValue(tag, status)
def _get_theme_manager(self):
"""
Adds the theme manager to the class dynamically
"""
if not hasattr(self, '_theme_manager'):
self._theme_manager = Registry().get('theme_manager')
return self._theme_manager
theme_manager = property(_get_theme_manager)
def _get_application(self):
"""
Adds the openlp to the class dynamically.
Windows needs to access the application in a dynamic manner.
"""
if os.name == 'nt':
return Registry().get('application')
else:
if not hasattr(self, '_application'):
self._application = Registry().get('application')
return self._application
application = property(_get_application)
Settings().setValue(tag, status)

View File

@ -33,11 +33,11 @@ It is based on a QTableWidget but represents its contents in list form.
from PyQt4 import QtCore, QtGui
from openlp.core.common import Registry
from openlp.core.common import RegistryProperties
from openlp.core.lib import ImageSource, ServiceItem
class ListPreviewWidget(QtGui.QTableWidget):
class ListPreviewWidget(QtGui.QTableWidget, RegistryProperties):
def __init__(self, parent, screen_ratio):
"""
Initializes the widget to default state.
@ -160,15 +160,4 @@ class ListPreviewWidget(QtGui.QTableWidget):
"""
Returns the number of slides this widget holds.
"""
return super(ListPreviewWidget, self).rowCount()
def _get_image_manager(self):
"""
Adds the image manager to the class dynamically.
"""
if not hasattr(self, '_image_manager'):
self._image_manager = Registry().get('image_manager')
return self._image_manager
image_manager = property(_get_image_manager)
return super(ListPreviewWidget, self).rowCount()

View File

@ -38,13 +38,12 @@ Some of the code for this form is based on the examples at:
import cgi
import logging
import os
import sys
from PyQt4 import QtCore, QtGui, QtWebKit, QtOpenGL
from PyQt4.phonon import Phonon
from openlp.core.common import Registry, OpenLPMixin, Settings, translate
from openlp.core.common import Registry, RegistryProperties, OpenLPMixin, Settings, translate
from openlp.core.lib import ServiceItem, ImageSource, build_html, expand_tags, image_to_byte
from openlp.core.lib.theme import BackgroundType
@ -118,7 +117,7 @@ class Display(QtGui.QGraphicsView):
self.web_loaded = True
class MainDisplay(OpenLPMixin, Display):
class MainDisplay(OpenLPMixin, Display, RegistryProperties):
"""
This is the display screen as a specialized class from the Display class
"""
@ -468,50 +467,6 @@ class MainDisplay(OpenLPMixin, Display):
self.setCursor(QtCore.Qt.ArrowCursor)
self.frame.evaluateJavaScript('document.body.style.cursor = "auto"')
def _get_plugin_manager(self):
"""
Adds the Renderer to the class dynamically
"""
if not hasattr(self, '_plugin_manager'):
self._plugin_manager = Registry().get('plugin_manager')
return self._plugin_manager
plugin_manager = property(_get_plugin_manager)
def _get_image_manager(self):
"""
Adds the image manager to the class dynamically
"""
if not hasattr(self, '_image_manager'):
self._image_manager = Registry().get('image_manager')
return self._image_manager
image_manager = property(_get_image_manager)
def _get_application(self):
"""
Adds the openlp to the class dynamically.
Windows needs to access the application in a dynamic manner.
"""
if os.name == 'nt':
return Registry().get('application')
else:
if not hasattr(self, '_application'):
self._application = Registry().get('application')
return self._application
application = property(_get_application)
def _get_live_controller(self):
"""
Adds the live controller to the class dynamically
"""
if not hasattr(self, '_live_controller'):
self._live_controller = Registry().get('live_controller')
return self._live_controller
live_controller = property(_get_live_controller)
class AudioPlayer(OpenLPMixin, QtCore.QObject):
"""

View File

@ -493,13 +493,13 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow, RegistryProperties):
Settings().set_up_default_values()
self.about_form = AboutForm(self)
MediaController()
self.settings_form = SettingsForm(self)
SettingsForm(self)
self.formatting_tag_form = FormattingTagForm(self)
self.shortcut_form = ShortcutListForm(self)
# Set up the path with plugins
PluginManager(self)
ImageManager()
self.renderer = Renderer()
Renderer()
# Set up the interface
self.setupUi(self)
# Define the media Dock Manager

View File

@ -35,7 +35,7 @@ import os
import datetime
from PyQt4 import QtCore, QtGui
from openlp.core.common import Registry, RegistryMixin, Settings, UiStrings, translate
from openlp.core.common import OpenLPMixin, Registry, RegistryMixin, RegistryProperties, Settings, UiStrings, translate
from openlp.core.lib import OpenLPToolbar
from openlp.core.lib.ui import critical_error_message_box
from openlp.core.ui.media import MediaState, MediaInfo, MediaType, get_media_players, set_media_players
@ -80,7 +80,7 @@ class MediaSlider(QtGui.QSlider):
QtGui.QSlider.mouseReleaseEvent(self, event)
class MediaController(object):
class MediaController(RegistryMixin, OpenLPMixin, RegistryProperties):
"""
The implementation of the Media Controller. The Media Controller adds an own class for every Player.
Currently these are QtWebkit, Phonon and Vlc. display_controllers are an array of controllers keyed on the
@ -93,12 +93,11 @@ class MediaController(object):
current_media_players is an array of player instances keyed on ControllerType.
"""
def __init__(self):
def __init__(self, parent=None):
"""
Constructor
"""
Registry().register('media_controller', self)
Registry().register_function('bootstrap_initialise', self.bootstrap_initialise)
super(MediaController, self).__init__(parent)
self.media_players = {}
self.display_controllers = {}
self.current_media_players = {}
@ -702,24 +701,4 @@ class MediaController(object):
"""
if controller.is_live:
return controller.display
return controller.preview_display
def _get_service_manager(self):
"""
Adds the plugin manager to the class dynamically
"""
if not hasattr(self, '_service_manager'):
self._service_manager = Registry().get('service_manager')
return self._service_manager
service_manager = property(_get_service_manager)
def _get_live_controller(self):
"""
Adds the live controller to the class dynamically
"""
if not hasattr(self, '_live_controller'):
self._live_controller = Registry().get('live_controller')
return self._live_controller
live_controller = property(_get_live_controller)
return controller.preview_display

View File

@ -31,11 +31,11 @@ The :mod:`~openlp.core.ui.media.mediaplayer` module contains the MediaPlayer cla
"""
import os
from openlp.core.common import Registry
from openlp.core.common import RegistryProperties
from openlp.core.ui.media import MediaState
class MediaPlayer(object):
class MediaPlayer(RegistryProperties):
"""
This is the base class media Player class to provide OpenLP with a pluggable media display framework.
"""
@ -150,18 +150,4 @@ class MediaPlayer(object):
"""
Returns Information about the player
"""
return ''
def _get_application(self):
"""
Adds the openlp to the class dynamically.
Windows needs to access the application in a dynamic manner.
"""
if os.name == 'nt':
return Registry().get('application')
else:
if not hasattr(self, '_application'):
self._application = Registry().get('application')
return self._application
application = property(_get_application)
return ''

View File

@ -34,14 +34,14 @@ import os
from PyQt4 import QtGui
from openlp.core.common import Registry, translate
from openlp.core.common import RegistryProperties, translate
from openlp.core.lib import PluginStatus
from .plugindialog import Ui_PluginViewDialog
log = logging.getLogger(__name__)
class PluginForm(QtGui.QDialog, Ui_PluginViewDialog):
class PluginForm(QtGui.QDialog, Ui_PluginViewDialog, RegistryProperties):
"""
The plugin form provides user control over the plugins OpenLP uses.
"""
@ -154,28 +154,4 @@ class PluginForm(QtGui.QDialog, Ui_PluginViewDialog):
elif self.active_plugin.status == PluginStatus.Disabled:
status_text = translate('OpenLP.PluginForm', '%s (Disabled)')
self.plugin_list_widget.currentItem().setText(
status_text % self.active_plugin.name_strings['singular'])
def _get_plugin_manager(self):
"""
Adds the plugin manager to the class dynamically
"""
if not hasattr(self, '_plugin_manager'):
self._plugin_manager = Registry().get('plugin_manager')
return self._plugin_manager
plugin_manager = property(_get_plugin_manager)
def _get_application(self):
"""
Adds the openlp to the class dynamically.
Windows needs to access the application in a dynamic manner.
"""
if os.name == 'nt':
return Registry().get('application')
else:
if not hasattr(self, '_application'):
self._application = Registry().get('application')
return self._application
application = property(_get_application)
status_text % self.active_plugin.name_strings['singular'])

View File

@ -36,7 +36,7 @@ import lxml.html
from PyQt4 import QtCore, QtGui
from openlp.core.common import Registry, Settings, UiStrings, translate
from openlp.core.common import Registry, RegistryProperties, Settings, UiStrings, translate
from openlp.core.lib import get_text_file_string
from openlp.core.ui.printservicedialog import Ui_PrintServiceDialog, ZoomSize
from openlp.core.common import AppLocation
@ -111,7 +111,7 @@ http://doc.trolltech.com/4.7/richtext-html-subset.html#css-properties
"""
class PrintServiceForm(QtGui.QDialog, Ui_PrintServiceDialog):
class PrintServiceForm(QtGui.QDialog, Ui_PrintServiceDialog, RegistryProperties):
"""
The :class:`~openlp.core.ui.printserviceform.PrintServiceForm` class displays a dialog for printing the service.
"""
@ -394,24 +394,4 @@ class PrintServiceForm(QtGui.QDialog, Ui_PrintServiceDialog):
return
for item in self.service_manager.service_items:
# Trigger Audit requests
Registry().register_function('print_service_started', [item['service_item']])
def _get_service_manager(self):
"""
Adds the service manager to the class dynamically
"""
if not hasattr(self, '_service_manager'):
self._service_manager = Registry().get('service_manager')
return self._service_manager
service_manager = property(_get_service_manager)
def _get_main_window(self):
"""
Adds the main window to the class dynamically
"""
if not hasattr(self, '_main_window'):
self._main_window = Registry().get('main_window')
return self._main_window
main_window = property(_get_main_window)
Registry().register_function('print_service_started', [item['service_item']])

View File

@ -30,12 +30,12 @@
The service item edit dialog
"""
from PyQt4 import QtGui
from openlp.core.common import Registry
from openlp.core.common import Registry, RegistryProperties
from .serviceitemeditdialog import Ui_ServiceItemEditDialog
class ServiceItemEditForm(QtGui.QDialog, Ui_ServiceItemEditDialog):
class ServiceItemEditForm(QtGui.QDialog, Ui_ServiceItemEditDialog, RegistryProperties):
"""
This is the form that is used to edit the verses of the song.
"""
@ -150,14 +150,3 @@ class ServiceItemEditForm(QtGui.QDialog, Ui_ServiceItemEditDialog):
else:
self.up_button.setEnabled(True)
self.delete_button.setEnabled(True)
def _get_main_window(self):
"""
Adds the main window to the class dynamically
"""
if not hasattr(self, '_main_window'):
self._main_window = Registry().get('main_window')
return self._main_window
main_window = property(_get_main_window)

View File

@ -39,8 +39,8 @@ from datetime import datetime, timedelta
from PyQt4 import QtCore, QtGui
from openlp.core.common import Registry, AppLocation, Settings, ThemeLevel, OpenLPMixin, RegistryMixin, \
check_directory_exists, UiStrings, translate
from openlp.core.common import Registry, RegistryProperties, AppLocation, Settings, ThemeLevel, OpenLPMixin, \
RegistryMixin, check_directory_exists, UiStrings, translate
from openlp.core.lib import OpenLPToolbar, ServiceItem, ItemCapabilities, PluginStatus, build_icon
from openlp.core.lib.ui import critical_error_message_box, create_widget_action, find_and_set_in_combo_box
from openlp.core.ui import ServiceNoteForm, ServiceItemEditForm, StartTimeForm
@ -306,7 +306,7 @@ class Ui_ServiceManager(object):
event.accept()
class ServiceManager(OpenLPMixin, RegistryMixin, QtGui.QWidget, Ui_ServiceManager):
class ServiceManager(OpenLPMixin, RegistryMixin, QtGui.QWidget, Ui_ServiceManager, RegistryProperties):
"""
Manages the services. This involves taking text strings from plugins and adding them to the service. This service
can then be zipped up with all the resources used into one OSZ or oszl file for use on any OpenLP v2 installation.
@ -1632,68 +1632,4 @@ class ServiceManager(OpenLPMixin, RegistryMixin, QtGui.QWidget, Ui_ServiceManage
Print a Service Order Sheet.
"""
setting_dialog = PrintServiceForm()
setting_dialog.exec_()
def _get_renderer(self):
"""
Adds the Renderer to the class dynamically
"""
if not hasattr(self, '_renderer'):
self._renderer = Registry().get('renderer')
return self._renderer
renderer = property(_get_renderer)
def _get_live_controller(self):
"""
Adds the live controller to the class dynamically
"""
if not hasattr(self, '_live_controller'):
self._live_controller = Registry().get('live_controller')
return self._live_controller
live_controller = property(_get_live_controller)
def _get_preview_controller(self):
"""
Adds the preview controller to the class dynamically
"""
if not hasattr(self, '_preview_controller'):
self._preview_controller = Registry().get('preview_controller')
return self._preview_controller
preview_controller = property(_get_preview_controller)
def _get_plugin_manager(self):
"""
Adds the plugin manager to the class dynamically
"""
if not hasattr(self, '_plugin_manager'):
self._plugin_manager = Registry().get('plugin_manager')
return self._plugin_manager
plugin_manager = property(_get_plugin_manager)
def _get_main_window(self):
"""
Adds the main window to the class dynamically
"""
if not hasattr(self, '_main_window'):
self._main_window = Registry().get('main_window')
return self._main_window
main_window = property(_get_main_window)
def _get_application(self):
"""
Adds the openlp to the class dynamically.
Windows needs to access the application in a dynamic manner.
"""
if os.name == 'nt':
return Registry().get('application')
else:
if not hasattr(self, '_application'):
self._application = Registry().get('application')
return self._application
application = property(_get_application)
setting_dialog.exec_()

View File

@ -31,12 +31,12 @@ The :mod:`~openlp.core.ui.servicenoteform` module contains the `ServiceNoteForm`
"""
from PyQt4 import QtGui
from openlp.core.common import Registry, translate
from openlp.core.common import Registry, RegistryProperties, translate
from openlp.core.lib import SpellTextEdit
from openlp.core.lib.ui import create_button_box
class ServiceNoteForm(QtGui.QDialog):
class ServiceNoteForm(QtGui.QDialog, RegistryProperties):
"""
This is the form that is used to edit the verses of the song.
"""
@ -74,14 +74,4 @@ class ServiceNoteForm(QtGui.QDialog):
"""
Translate the UI on the fly
"""
self.setWindowTitle(translate('OpenLP.ServiceNoteForm', 'Service Item Notes'))
def _get_main_window(self):
"""
Adds the main window to the class dynamically
"""
if not hasattr(self, '_main_window'):
self._main_window = Registry().get('main_window')
return self._main_window
main_window = property(_get_main_window)
self.setWindowTitle(translate('OpenLP.ServiceNoteForm', 'Service Item Notes'))

View File

@ -33,7 +33,7 @@ import logging
from PyQt4 import QtGui
from openlp.core.common import Registry
from openlp.core.common import Registry, RegistryProperties
from openlp.core.lib import PluginStatus, build_icon
from openlp.core.ui import AdvancedTab, GeneralTab, ThemesTab
from openlp.core.ui.media import PlayerTab
@ -42,7 +42,7 @@ from .settingsdialog import Ui_SettingsDialog
log = logging.getLogger(__name__)
class SettingsForm(QtGui.QDialog, Ui_SettingsDialog):
class SettingsForm(QtGui.QDialog, Ui_SettingsDialog, RegistryProperties):
"""
Provide the form to manipulate the settings for OpenLP
"""
@ -151,34 +151,4 @@ class SettingsForm(QtGui.QDialog, Ui_SettingsDialog):
:param function: The function to be called
"""
if not function in self.processes:
self.processes.append(function)
def _get_main_window(self):
"""
Adds the main window to the class dynamically
"""
if not hasattr(self, '_main_window'):
self._main_window = Registry().get('main_window')
return self._main_window
main_window = property(_get_main_window)
def _get_service_manager(self):
"""
Adds the plugin manager to the class dynamically
"""
if not hasattr(self, '_service_manager'):
self._service_manager = Registry().get('service_manager')
return self._service_manager
service_manager = property(_get_service_manager)
def _get_plugin_manager(self):
"""
Adds the plugin manager to the class dynamically
"""
if not hasattr(self, '_plugin_manager'):
self._plugin_manager = Registry().get('plugin_manager')
return self._plugin_manager
plugin_manager = property(_get_plugin_manager)
self.processes.append(function)

View File

@ -33,7 +33,7 @@ import re
from PyQt4 import QtCore, QtGui
from openlp.core.common import Registry, Settings, translate
from openlp.core.common import RegistryProperties, Settings, translate
from openlp.core.utils.actions import ActionList
from .shortcutlistdialog import Ui_ShortcutListDialog
@ -42,7 +42,7 @@ REMOVE_AMPERSAND = re.compile(r'&{1}')
log = logging.getLogger(__name__)
class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog):
class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog, RegistryProperties):
"""
The shortcut list dialog
"""
@ -459,14 +459,3 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog):
button.setChecked(checked)
if enabled is not None:
button.setEnabled(enabled)
def _get_main_window(self):
"""
Adds the main window to the class dynamically
"""
if not hasattr(self, '_main_window'):
self._main_window = Registry().get('main_window')
return self._main_window
main_window = property(_get_main_window)

View File

@ -33,11 +33,11 @@ from PyQt4 import QtGui
from .starttimedialog import Ui_StartTimeDialog
from openlp.core.common import Registry, UiStrings, translate
from openlp.core.common import Registry, RegistryProperties, UiStrings, translate
from openlp.core.lib.ui import critical_error_message_box
class StartTimeForm(QtGui.QDialog, Ui_StartTimeDialog):
class StartTimeForm(QtGui.QDialog, Ui_StartTimeDialog, RegistryProperties):
"""
The start time dialog
"""
@ -88,20 +88,10 @@ class StartTimeForm(QtGui.QDialog, Ui_StartTimeDialog):
def _time_split(self, seconds):
"""
Split time up into hours minutes and seconds from secongs
Split time up into hours minutes and seconds from seconds
"""
hours = seconds // 3600
seconds -= 3600 * hours
minutes = seconds // 60
seconds -= 60 * minutes
return hours, minutes, seconds
def _get_main_window(self):
"""
Adds the main window to the class dynamically
"""
if not hasattr(self, '_main_window'):
self._main_window = Registry().get('main_window')
return self._main_window
main_window = property(_get_main_window)
return hours, minutes, seconds

View File

@ -34,7 +34,7 @@ import os
from PyQt4 import QtCore, QtGui
from openlp.core.common import Registry, UiStrings, translate
from openlp.core.common import Registry, RegistryProperties, UiStrings, translate
from openlp.core.lib.theme import BackgroundType, BackgroundGradientType
from openlp.core.lib.ui import critical_error_message_box
from openlp.core.ui import ThemeLayoutForm
@ -44,7 +44,7 @@ from .themewizard import Ui_ThemeWizard
log = logging.getLogger(__name__)
class ThemeForm(QtGui.QWizard, Ui_ThemeWizard):
class ThemeForm(QtGui.QWizard, Ui_ThemeWizard, RegistryProperties):
"""
This is the Theme Import Wizard, which allows easy creation and editing of
OpenLP themes.
@ -540,24 +540,4 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard):
new_color = QtGui.QColorDialog.getColor(QtGui.QColor(field), self)
if new_color.isValid():
field = new_color.name()
return field
def _get_renderer(self):
"""
Adds the Renderer to the class dynamically
"""
if not hasattr(self, '_renderer'):
self._renderer = Registry().get('renderer')
return self._renderer
renderer = property(_get_renderer)
def _get_theme_manager(self):
"""
Adds the theme manager to the class dynamically
"""
if not hasattr(self, '_theme_manager'):
self._theme_manager = Registry().get('theme_manager')
return self._theme_manager
theme_manager = property(_get_theme_manager)
return field

View File

@ -36,8 +36,8 @@ import shutil
from xml.etree.ElementTree import ElementTree, XML
from PyQt4 import QtCore, QtGui
from openlp.core.common import Registry, AppLocation, Settings, OpenLPMixin, RegistryMixin, check_directory_exists, \
UiStrings, translate
from openlp.core.common import Registry, RegistryProperties, AppLocation, Settings, OpenLPMixin, RegistryMixin, \
check_directory_exists, UiStrings, translate
from openlp.core.lib import FileDialog, ImageSource, OpenLPToolbar, get_text_file_string, build_icon, \
check_item_selected, create_thumb, validate_thumb
from openlp.core.lib.theme import ThemeXML, BackgroundType
@ -127,7 +127,7 @@ class Ui_ThemeManager(object):
self.theme_list_widget.currentItemChanged.connect(self.check_list_state)
class ThemeManager(OpenLPMixin, RegistryMixin, QtGui.QWidget, Ui_ThemeManager):
class ThemeManager(OpenLPMixin, RegistryMixin, QtGui.QWidget, Ui_ThemeManager, RegistryProperties):
"""
Manages the orders of Theme.
"""
@ -753,58 +753,4 @@ class ThemeManager(OpenLPMixin, RegistryMixin, QtGui.QWidget, Ui_ThemeManager):
% (theme, plugin.name))
return False
return True
return False
def _get_renderer(self):
"""
Adds the Renderer to the class dynamically
"""
if not hasattr(self, '_renderer'):
self._renderer = Registry().get('renderer')
return self._renderer
renderer = property(_get_renderer)
def _get_image_manager(self):
"""
Adds the image manager to the class dynamically
"""
if not hasattr(self, '_image_manager'):
self._image_manager = Registry().get('image_manager')
return self._image_manager
image_manager = property(_get_image_manager)
def _get_plugin_manager(self):
"""
Adds the Renderer to the class dynamically
"""
if not hasattr(self, '_plugin_manager'):
self._plugin_manager = Registry().get('plugin_manager')
return self._plugin_manager
plugin_manager = property(_get_plugin_manager)
def _get_main_window(self):
"""
Adds the main window to the class dynamically
"""
if not hasattr(self, '_main_window'):
self._main_window = Registry().get('main_window')
return self._main_window
main_window = property(_get_main_window)
def _get_application(self):
"""
Adds the openlp to the class dynamically.
Windows needs to access the application in a dynamic manner.
"""
if os.name == 'nt':
return Registry().get('application')
else:
if not hasattr(self, '_application'):
self._application = Registry().get('application')
return self._application
application = property(_get_application)
return False

View File

@ -34,7 +34,7 @@ import os
from PyQt4 import QtGui
from openlp.core.common import Registry, Settings, UiStrings, translate
from openlp.core.common import Registry, RegistryProperties, Settings, UiStrings, translate
from openlp.core.lib import build_icon
from openlp.core.lib.ui import add_welcome_page
@ -72,7 +72,7 @@ class WizardStrings(object):
'A song format e.g. PowerSong')
class OpenLPWizard(QtGui.QWizard):
class OpenLPWizard(QtGui.QWizard, RegistryProperties):
"""
Generic OpenLP wizard to provide generic functionality and a unified look
and feel.
@ -303,18 +303,4 @@ class OpenLPWizard(QtGui.QWizard):
QtGui.QFileDialog.ShowDirsOnly)
if folder:
editbox.setText(folder)
Settings().setValue(self.plugin.settings_section + '/' + setting_name, folder)
def _get_application(self):
"""
Adds the openlp to the class dynamically.
Windows needs to access the application in a dynamic manner.
"""
if os.name == 'nt':
return Registry().get('application')
else:
if not hasattr(self, '_application'):
self._application = Registry().get('application')
return self._application
application = property(_get_application)
Settings().setValue(self.plugin.settings_section + '/' + setting_name, folder)

View File

@ -140,7 +140,7 @@ class AlertsPlugin(Plugin):
self.weight = -3
self.icon_path = ':/plugins/plugin_alerts.png'
self.icon = build_icon(self.icon_path)
self.alerts_manager = AlertsManager(self)
AlertsManager(self)
self.manager = Manager('alerts', init_schema)
self.alert_form = AlertForm(self)

View File

@ -33,10 +33,10 @@ displaying of alerts.
from PyQt4 import QtCore
from openlp.core.common import OpenLPMixin, RegistryMixin, Registry, translate
from openlp.core.common import OpenLPMixin, RegistryMixin, Registry, RegistryProperties, translate
class AlertsManager(OpenLPMixin, RegistryMixin, QtCore.QObject):
class AlertsManager(OpenLPMixin, RegistryMixin, QtCore.QObject, RegistryProperties):
"""
AlertsManager manages the settings of Alerts.
"""
@ -97,24 +97,4 @@ class AlertsManager(OpenLPMixin, RegistryMixin, QtCore.QObject):
self.live_controller.display.alert('', alert_tab.location)
self.killTimer(self.timer_id)
self.timer_id = 0
self.generate_alert()
def _get_live_controller(self):
"""
Adds the live controller to the class dynamically
"""
if not hasattr(self, '_live_controller'):
self._live_controller = Registry().get('live_controller')
return self._live_controller
live_controller = property(_get_live_controller)
def _get_main_window(self):
"""
Adds the main window to the class dynamically
"""
if not hasattr(self, '_main_window'):
self._main_window = Registry().get('main_window')
return self._main_window
main_window = property(_get_main_window)
self.generate_alert()

View File

@ -33,7 +33,7 @@ import re
from PyQt4 import QtGui
from openlp.core.common import Registry, UiStrings, translate
from openlp.core.common import RegistryProperties, UiStrings, translate
from openlp.core.lib.ui import critical_error_message_box
from .editbibledialog import Ui_EditBibleDialog
from openlp.plugins.bibles.lib import BibleStrings
@ -42,7 +42,7 @@ from openlp.plugins.bibles.lib.db import BiblesResourcesDB
log = logging.getLogger(__name__)
class EditBibleForm(QtGui.QDialog, Ui_EditBibleDialog):
class EditBibleForm(QtGui.QDialog, Ui_EditBibleDialog, RegistryProperties):
"""
Class to manage the editing of a bible
"""
@ -198,17 +198,3 @@ class EditBibleForm(QtGui.QDialog, Ui_EditBibleDialog):
% new_book_name)
return False
return True
def _get_application(self):
"""
Adds the openlp to the class dynamically.
Windows needs to access the application in a dynamic manner.
"""
if os.name == 'nt':
return Registry().get('application')
else:
if not hasattr(self, '_application'):
self._application = Registry().get('application')
return self._application
application = property(_get_application)

View File

@ -38,7 +38,7 @@ from sqlalchemy import Column, ForeignKey, Table, or_, types, func
from sqlalchemy.orm import class_mapper, mapper, relation
from sqlalchemy.orm.exc import UnmappedClassError
from openlp.core.common import Registry, AppLocation, translate
from openlp.core.common import Registry, RegistryProperties, AppLocation, translate
from openlp.core.lib.db import BaseModel, init_db, Manager
from openlp.core.lib.ui import critical_error_message_box
from openlp.core.utils import clean_filename
@ -115,7 +115,7 @@ def init_schema(url):
return session
class BibleDB(QtCore.QObject, Manager):
class BibleDB(QtCore.QObject, Manager, RegistryProperties):
"""
This class represents a database-bound Bible. It is used as a base class for all the custom importers, so that
the can implement their own import methods, but benefit from the database methods in here via inheritance,
@ -500,20 +500,6 @@ class BibleDB(QtCore.QObject, Manager):
verses = self.session.query(Verse).all()
log.debug(verses)
def _get_application(self):
"""
Adds the openlp to the class dynamically.
Windows needs to access the application in a dynamic manner.
"""
if os.name == 'nt':
return Registry().get('application')
else:
if not hasattr(self, '_application'):
self._application = Registry().get('application')
return self._application
application = property(_get_application)
class BiblesResourcesDB(QtCore.QObject, Manager):
"""

View File

@ -29,7 +29,6 @@
"""
The :mod:`http` module enables OpenLP to retrieve scripture from bible websites.
"""
import os
import logging
import re
import socket
@ -38,7 +37,7 @@ from html.parser import HTMLParseError
from bs4 import BeautifulSoup, NavigableString, Tag
from openlp.core.common import Registry, translate
from openlp.core.common import Registry, RegistryProperties, translate
from openlp.core.lib.ui import critical_error_message_box
from openlp.core.utils import get_web_page
from openlp.plugins.bibles.lib import SearchResults
@ -61,7 +60,7 @@ VERSE_NUMBER_REGEX = re.compile(r'v(\d{1,2})(\d{3})(\d{3}) verse.*')
log = logging.getLogger(__name__)
class BGExtract(object):
class BGExtract(RegistryProperties):
"""
Extract verses from BibleGateway
"""
@ -285,22 +284,8 @@ class BGExtract(object):
books.append(book.contents[0])
return books
def _get_application(self):
"""
Adds the openlp to the class dynamically.
Windows needs to access the application in a dynamic manner.
"""
if os.name == 'nt':
return Registry().get('application')
else:
if not hasattr(self, '_application'):
self._application = Registry().get('application')
return self._application
application = property(_get_application)
class BSExtract(object):
class BSExtract(RegistryProperties):
"""
Extract verses from Bibleserver.com
"""
@ -359,22 +344,8 @@ class BSExtract(object):
content = content.find_all('li')
return [book.contents[0].contents[0] for book in content if len(book.contents[0].contents)]
def _get_application(self):
"""
Adds the openlp to the class dynamically.
Windows needs to access the application in a dynamic manner.
"""
if os.name == 'nt':
return Registry().get('application')
else:
if not hasattr(self, '_application'):
self._application = Registry().get('application')
return self._application
application = property(_get_application)
class CWExtract(object):
class CWExtract(RegistryProperties):
"""
Extract verses from CrossWalk/BibleStudyTools
"""
@ -457,22 +428,8 @@ class CWExtract(object):
books.append(book.contents[0])
return books
def _get_application(self):
"""
Adds the openlp to the class dynamically.
Windows needs to access the application in a dynamic manner.
"""
if os.name == 'nt':
return Registry().get('application')
else:
if not hasattr(self, '_application'):
self._application = Registry().get('application')
return self._application
application = property(_get_application)
class HTTPBible(BibleDB):
class HTTPBible(BibleDB, RegistryProperties):
log.info('%s HTTPBible loaded', __name__)
def __init__(self, parent, **kwargs):
@ -647,20 +604,6 @@ class HTTPBible(BibleDB):
log.debug('HTTPBible.get_verse_count("%s", %s)', book_id, chapter)
return BiblesResourcesDB.get_verse_count(book_id, chapter)
def _get_application(self):
"""
Adds the openlp to the class dynamically.
Windows needs to access the application in a dynamic manner.
"""
if os.name == 'nt':
return Registry().get('application')
else:
if not hasattr(self, '_application'):
self._application = Registry().get('application')
return self._application
application = property(_get_application)
def get_soup_for_bible_ref(reference_url, header=None, pre_parse_regex=None, pre_parse_substitute=None):
"""

View File

@ -30,7 +30,7 @@
import logging
import os
from openlp.core.common import Registry, AppLocation, Settings, translate
from openlp.core.common import RegistryProperties, AppLocation, Settings, translate
from openlp.core.utils import delete_file
from openlp.plugins.bibles.lib import parse_reference, get_reference_separator, LanguageSelection
from openlp.plugins.bibles.lib.db import BibleDB, BibleMeta
@ -84,7 +84,7 @@ class BibleFormat(object):
]
class BibleManager(object):
class BibleManager(RegistryProperties):
"""
The Bible manager which holds and manages all the Bibles.
"""
@ -405,15 +405,4 @@ class BibleManager(object):
for bible in self.db_cache:
self.db_cache[bible].finalise()
def _get_main_window(self):
"""
Adds the main window to the class dynamically
"""
if not hasattr(self, '_main_window'):
self._main_window = Registry().get('main_window')
return self._main_window
main_window = property(_get_main_window)
__all__ = ['BibleFormat']

View File

@ -123,13 +123,3 @@ class ImagePlugin(Plugin):
log.info('Images config_update')
background = QtGui.QColor(Settings().value(self.settings_section + '/background color'))
self.image_manager.update_images_border(ImageSource.ImagePlugin, background)
def _get_image_manager(self):
"""
Adds the image manager to the class dynamically
"""
if not hasattr(self, '_image_manager'):
self._image_manager = Registry().get('image_manager')
return self._image_manager
image_manager = property(_get_image_manager)

View File

@ -32,7 +32,8 @@ import os
from PyQt4 import QtCore, QtGui
from openlp.core.common import Registry, AppLocation, Settings, check_directory_exists, UiStrings, translate
from openlp.core.common import Registry, RegistryProperties, AppLocation, Settings, check_directory_exists, UiStrings,\
translate
from openlp.core.lib import ItemCapabilities, MediaManagerItem,MediaType, ServiceItem, ServiceItemContext, \
build_icon, check_item_selected
from openlp.core.lib.ui import critical_error_message_box, create_horizontal_adjusting_combo_box
@ -51,7 +52,7 @@ DVD_ICON = build_icon(':/media/media_video.png')
ERROR_ICON = build_icon(':/general/general_delete.png')
class MediaMediaItem(MediaManagerItem):
class MediaMediaItem(MediaManagerItem, RegistryProperties):
"""
This is the custom media manager item for Media Slides.
"""

View File

@ -31,7 +31,7 @@ import logging
from PyQt4 import QtCore
from openlp.core.common import Registry, translate
from openlp.core.common import translate
from openlp.core.lib import Plugin, StringContent, build_icon
from openlp.plugins.media.lib import MediaMediaItem, MediaTab
@ -120,13 +120,3 @@ class MediaPlugin(Plugin):
Add html code to htmlbuilder.
"""
return self.media_controller.get_media_display_html()
def _get_media_controller(self):
"""
Adds the media controller to the class dynamically
"""
if not hasattr(self, '_media_controller'):
self._media_controller = Registry().get('media_controller')
return self._media_controller
media_controller = property(_get_media_controller)

View File

@ -425,13 +425,3 @@ class PresentationController(object):
def close_presentation(self):
pass
def _get_plugin_manager(self):
"""
Adds the plugin manager to the class dynamically
"""
if not hasattr(self, '_plugin_manager'):
self._plugin_manager = Registry().get('plugin_manager')
return self._plugin_manager
plugin_manager = property(_get_plugin_manager)

View File

@ -124,7 +124,7 @@ from urllib.parse import urlparse, parse_qs
from mako.template import Template
from PyQt4 import QtCore
from openlp.core.common import Registry, AppLocation, Settings, translate
from openlp.core.common import Registry, RegistryProperties, AppLocation, Settings, translate
from openlp.core.lib import PluginStatus, StringContent, image_to_byte
log = logging.getLogger(__name__)
@ -139,7 +139,7 @@ FILE_TYPES = {
}
class HttpRouter(object):
class HttpRouter(RegistryProperties):
"""
This code is called by the HttpServer upon a request and it processes it based on the routing table.
This code is stateless and is created on each request.
@ -584,43 +584,3 @@ class HttpRouter(object):
item_id = plugin.media_item.create_item_from_id(id)
plugin.media_item.emit(QtCore.SIGNAL('%s_add_to_service' % plugin_name), [item_id, True])
self.do_http_success()
def _get_service_manager(self):
"""
Adds the service manager to the class dynamically
"""
if not hasattr(self, '_service_manager'):
self._service_manager = Registry().get('service_manager')
return self._service_manager
service_manager = property(_get_service_manager)
def _get_live_controller(self):
"""
Adds the live controller to the class dynamically
"""
if not hasattr(self, '_live_controller'):
self._live_controller = Registry().get('live_controller')
return self._live_controller
live_controller = property(_get_live_controller)
def _get_plugin_manager(self):
"""
Adds the plugin manager to the class dynamically
"""
if not hasattr(self, '_plugin_manager'):
self._plugin_manager = Registry().get('plugin_manager')
return self._plugin_manager
plugin_manager = property(_get_plugin_manager)
def _get_alerts_manager(self):
"""
Adds the alerts manager to the class dynamically
"""
if not hasattr(self, '_alerts_manager'):
self._alerts_manager = Registry().get('alerts_manager')
return self._alerts_manager
alerts_manager = property(_get_alerts_manager)

View File

@ -35,7 +35,7 @@ import os
from PyQt4 import QtCore, QtGui
from openlp.core.common import Registry, translate
from openlp.core.common import Registry, RegistryProperties, translate
from openlp.core.ui.wizard import OpenLPWizard, WizardStrings
from openlp.plugins.songs.lib import delete_song
from openlp.plugins.songs.lib.db import Song, MediaFile
@ -45,7 +45,7 @@ from openlp.plugins.songs.lib.songcompare import songs_probably_equal
log = logging.getLogger(__name__)
class DuplicateSongRemovalForm(OpenLPWizard):
class DuplicateSongRemovalForm(OpenLPWizard, RegistryProperties):
"""
This is the Duplicate Song Removal Wizard. It provides functionality to search for and remove duplicate songs
in the database.
@ -327,29 +327,4 @@ class DuplicateSongRemovalForm(OpenLPWizard):
self.button(QtGui.QWizard.FinishButton).show()
self.button(QtGui.QWizard.FinishButton).setEnabled(True)
self.button(QtGui.QWizard.NextButton).hide()
self.button(QtGui.QWizard.CancelButton).hide()
def _get_main_window(self):
"""
Adds the main window to the class dynamically.
"""
if not hasattr(self, '_main_window'):
self._main_window = Registry().get('main_window')
return self._main_window
main_window = property(_get_main_window)
def _get_application(self):
"""
Adds the openlp to the class dynamically.
Windows needs to access the application in a dynamic manner.
"""
if os.name == 'nt':
return Registry().get('application')
else:
if not hasattr(self, '_application'):
self._application = Registry().get('application')
return self._application
application = property(_get_application)
self.button(QtGui.QWizard.CancelButton).hide()

View File

@ -38,7 +38,7 @@ import shutil
from PyQt4 import QtCore, QtGui
from openlp.core.common import Registry, AppLocation, UiStrings, check_directory_exists, translate
from openlp.core.common import Registry, RegistryProperties, AppLocation, UiStrings, check_directory_exists, translate
from openlp.core.lib import FileDialog, PluginStatus, MediaType, create_separated_list
from openlp.core.lib.ui import set_case_insensitive_completer, critical_error_message_box, find_and_set_in_combo_box
from openlp.plugins.songs.lib import VerseType, clean_song
@ -52,7 +52,7 @@ from openlp.plugins.songs.forms.mediafilesform import MediaFilesForm
log = logging.getLogger(__name__)
class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
class EditSongForm(QtGui.QDialog, Ui_EditSongDialog, RegistryProperties):
"""
Class to manage the editing of a song
"""
@ -955,24 +955,4 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
log.exception('Could not remove directory: %s', save_path)
clean_song(self.manager, self.song)
self.manager.save_object(self.song)
self.media_item.auto_select_id = self.song.id
def _get_plugin_manager(self):
"""
Adds the plugin manager to the class dynamically
"""
if not hasattr(self, '_plugin_manager'):
self._plugin_manager = Registry().get('plugin_manager')
return self._plugin_manager
plugin_manager = property(_get_plugin_manager)
def _get_theme_manager(self):
"""
Adds the theme manager to the class dynamically
"""
if not hasattr(self, '_theme_manager'):
self._theme_manager = Registry().get('theme_manager')
return self._theme_manager
theme_manager = property(_get_theme_manager)
self.media_item.auto_select_id = self.song.id

View File

@ -35,7 +35,7 @@ import os
from PyQt4 import QtCore, QtGui
from openlp.core.common import Registry, Settings, UiStrings, translate
from openlp.core.common import RegistryProperties, Settings, UiStrings, translate
from openlp.core.lib import FileDialog
from openlp.core.lib.ui import critical_error_message_box
from openlp.core.ui.wizard import OpenLPWizard, WizardStrings
@ -44,7 +44,7 @@ from openlp.plugins.songs.lib.importer import SongFormat, SongFormatSelect
log = logging.getLogger(__name__)
class SongImportForm(OpenLPWizard):
class SongImportForm(OpenLPWizard, RegistryProperties):
"""
This is the Song Import Wizard, which allows easy importing of Songs
into OpenLP from other formats like OpenLyrics, OpenSong and CCLI.
@ -480,26 +480,6 @@ class SongImportForm(OpenLPWizard):
self.format_widgets[this_format]['import_widget'] = import_widget
return import_widget
def _get_main_window(self):
"""
Adds the main window to the class dynamically
"""
if not hasattr(self, '_main_window'):
self._main_window = Registry().get('main_window')
return self._main_window
main_window = property(_get_main_window)
def _get_main_window(self):
"""
Adds the main window to the class dynamically
"""
if not hasattr(self, '_main_window'):
self._main_window = Registry().get('main_window')
return self._main_window
main_window = property(_get_main_window)
class SongImportSourcePage(QtGui.QWizardPage):
"""

View File

@ -32,7 +32,7 @@ import os
from PyQt4 import QtGui, QtCore
from sqlalchemy.sql import and_
from openlp.core.common import Registry, UiStrings, translate
from openlp.core.common import Registry, RegistryProperties, UiStrings, translate
from openlp.core.lib.ui import critical_error_message_box
from openlp.plugins.songs.forms.authorsform import AuthorsForm
from openlp.plugins.songs.forms.topicsform import TopicsForm
@ -43,7 +43,7 @@ from .songmaintenancedialog import Ui_SongMaintenanceDialog
log = logging.getLogger(__name__)
class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog, RegistryProperties):
"""
Class documentation goes here.
"""
@ -531,18 +531,4 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
edit_button.setEnabled(False)
else:
delete_button.setEnabled(True)
edit_button.setEnabled(True)
def _get_application(self):
"""
Adds the openlp to the class dynamically.
Windows needs to access the application in a dynamic manner.
"""
if os.name == 'nt':
return Registry().get('application')
else:
if not hasattr(self, '_application'):
self._application = Registry().get('application')
return self._application
application = property(_get_application)
edit_button.setEnabled(True)

View File

@ -35,14 +35,14 @@ import os
from lxml import etree
from openlp.core.common import Registry, check_directory_exists, translate
from openlp.core.common import RegistryProperties, check_directory_exists, translate
from openlp.core.utils import clean_filename
from openlp.plugins.songs.lib.xml import OpenLyrics
log = logging.getLogger(__name__)
class OpenLyricsExport(object):
class OpenLyricsExport(RegistryProperties):
"""
This provides the Openlyrics export.
"""
@ -82,16 +82,3 @@ class OpenLyricsExport(object):
pretty_print=True)
return True
def _get_application(self):
"""
Adds the openlp to the class dynamically.
Windows needs to access the application in a dynamic manner.
"""
if os.name == 'nt':
return Registry().get('application')
else:
if not hasattr(self, '_application'):
self._application = Registry().get('application')
return self._application
application = property(_get_application)

View File

@ -29,12 +29,12 @@
from PyQt4 import QtGui
from openlp.core.common import Registry, translate
from openlp.core.common import RegistryProperties, translate
from openlp.plugins.songusage.lib.db import SongUsageItem
from .songusagedeletedialog import Ui_SongUsageDeleteDialog
class SongUsageDeleteForm(QtGui.QDialog, Ui_SongUsageDeleteDialog):
class SongUsageDeleteForm(QtGui.QDialog, Ui_SongUsageDeleteDialog, RegistryProperties):
"""
Class documentation goes here.
"""
@ -70,14 +70,4 @@ class SongUsageDeleteForm(QtGui.QDialog, Ui_SongUsageDeleteDialog):
)
self.accept()
else:
self.reject()
def _get_main_window(self):
"""
Adds the main window to the class dynamically
"""
if not hasattr(self, '_main_window'):
self._main_window = Registry().get('main_window')
return self._main_window
main_window = property(_get_main_window)
self.reject()

View File

@ -33,14 +33,14 @@ import os
from PyQt4 import QtGui
from sqlalchemy.sql import and_
from openlp.core.common import Registry, Settings, check_directory_exists, translate
from openlp.core.common import RegistryProperties, Settings, check_directory_exists, translate
from openlp.plugins.songusage.lib.db import SongUsageItem
from .songusagedetaildialog import Ui_SongUsageDetailDialog
log = logging.getLogger(__name__)
class SongUsageDetailForm(QtGui.QDialog, Ui_SongUsageDetailDialog):
class SongUsageDetailForm(QtGui.QDialog, Ui_SongUsageDetailDialog, RegistryProperties):
"""
Class documentation goes here.
"""
@ -118,13 +118,3 @@ class SongUsageDetailForm(QtGui.QDialog, Ui_SongUsageDetailDialog):
if file_handle:
file_handle.close()
self.close()
def _get_main_window(self):
"""
Adds the main window to the class dynamically
"""
if not hasattr(self, '_main_window'):
self._main_window = Registry().get('main_window')
return self._main_window
main_window = property(_get_main_window)

View File

@ -1,4 +1,31 @@
# -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
###############################################################################
# OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- #
# Copyright (c) 2008-2014 Raoul Snyman #
# Portions copyright (c) 2008-2014 Tim Bentley, Gerald Britton, Jonathan #
# Corwin, Samuel Findlay, Michael Gorven, Scott Guerrieri, Matthias Hub, #
# Meinert Jordan, Armin Köhler, Erik Lundin, Edwin Lunando, Brian T. Meyer. #
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free #
# Software Foundation; version 2 of the License. #
# #
# This program is distributed in the hope that it will be useful, but WITHOUT #
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
# more details. #
# #
# You should have received a copy of the GNU General Public License along #
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
"""
Base directory for tests
"""

View File

@ -41,17 +41,23 @@ class TestRegistryProperties(TestCase, RegistryProperties):
"""
def setUp(self):
"""
Create the UI
Create the Register
"""
Registry.create()
def no_application_test(self):
"""
Test property if no registry value assigned
"""
# GIVEN an Empty Registry
# WHEN there is no Application
# THEN the application should be none
self.assertEquals(self.application, None, 'The application value should be None')
def application_test(self):
"""
Test property if registry value assigned
"""
# GIVEN an Empty Registry
application = MagicMock()
# WHEN the application is registered

View File

@ -29,16 +29,13 @@
"""
Package to test the openlp.core.lib.settings package.
"""
import os
from tempfile import mkstemp
from unittest import TestCase
from PyQt4 import QtGui
from openlp.core.common import Settings
from tests.helpers.testmixin import TestMixin
class TestSettings(TestCase):
class TestSettings(TestCase, TestMixin):
"""
Test the functions in the Settings module
"""
@ -46,18 +43,14 @@ class TestSettings(TestCase):
"""
Create the UI
"""
Settings.setDefaultFormat(Settings.IniFormat)
self.fd, self.ini_file = mkstemp('.ini')
Settings().set_filename(self.ini_file)
self.application = QtGui.QApplication.instance()
self.get_application()
self.build_settings()
def tearDown(self):
"""
Delete all the C++ objects at the end so that we don't have a segfault
"""
del self.application
os.close(self.fd)
os.unlink(Settings().fileName())
self.destroy_settings()
def settings_basic_test(self):
"""

View File

@ -0,0 +1,31 @@
# -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
###############################################################################
# OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- #
# Copyright (c) 2008-2014 Raoul Snyman #
# Portions copyright (c) 2008-2014 Tim Bentley, Gerald Britton, Jonathan #
# Corwin, Samuel Findlay, Michael Gorven, Scott Guerrieri, Matthias Hub, #
# Meinert Jordan, Armin Köhler, Erik Lundin, Edwin Lunando, Brian T. Meyer. #
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free #
# Software Foundation; version 2 of the License. #
# #
# This program is distributed in the hope that it will be useful, but WITHOUT #
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
# more details. #
# #
# You should have received a copy of the GNU General Public License along #
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
"""
Package to test the openlp.core.lib package.
"""

View File

@ -7,6 +7,7 @@ from openlp.core.common import UiStrings
from openlp.core.lib.filedialog import FileDialog
from tests.functional import MagicMock, patch
class TestFileDialog(TestCase):
"""
Test the functions in the :mod:`filedialog` module.
@ -46,7 +47,7 @@ class TestFileDialog(TestCase):
def returned_file_list_test(self):
"""
Test that FileDialog.getOpenFileNames handles a list of files properly when QFileList.getOpenFileNames
returns a good file name, a urlencoded file name and a non-existing file
returns a good file name, a url encoded file name and a non-existing file
"""
self.mocked_os.rest()
self.mocked_qt_gui.reset()
@ -62,7 +63,7 @@ class TestFileDialog(TestCase):
result = FileDialog.getOpenFileNames(self.mocked_parent)
# THEN: os.path.exists should have been called with known args. QmessageBox.information should have been
# called. The returned result should corrilate with the input.
# called. The returned result should correlate with the input.
self.mocked_os.path.exists.assert_callde_with('/Valid File')
self.mocked_os.path.exists.assert_callde_with('/url%20encoded%20file%20%231')
self.mocked_os.path.exists.assert_callde_with('/url encoded file #1')

View File

@ -36,18 +36,19 @@ from PyQt4 import QtGui
from openlp.core.common import Registry
from openlp.core.lib import ImageManager, ScreenList
from tests.helpers.testmixin import TestMixin
TEST_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', 'resources'))
class TestImageManager(TestCase):
class TestImageManager(TestCase, TestMixin):
def setUp(self):
"""
Create the UI
"""
Registry.create()
self.app = QtGui.QApplication.instance()
self.get_application()
ScreenList.create(self.app.desktop())
self.image_manager = ImageManager()

View File

@ -0,0 +1,28 @@
# -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
###############################################################################
# OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- #
# Copyright (c) 2008-2014 Raoul Snyman #
# Portions copyright (c) 2008-2014 Tim Bentley, Gerald Britton, Jonathan #
# Corwin, Samuel Findlay, Michael Gorven, Scott Guerrieri, Matthias Hub, #
# Meinert Jordan, Armin Köhler, Erik Lundin, Edwin Lunando, Brian T. Meyer. #
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free #
# Software Foundation; version 2 of the License. #
# #
# This program is distributed in the hope that it will be useful, but WITHOUT #
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
# more details. #
# #
# You should have received a copy of the GNU General Public License along #
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################

View File

@ -29,17 +29,16 @@
"""
Package to test the openlp.core.utils.actions package.
"""
import os
from tempfile import mkstemp
from unittest import TestCase
from PyQt4 import QtGui, QtCore
from openlp.core.common import Settings
from openlp.core.utils import ActionList
from tests.helpers.testmixin import TestMixin
class TestActionList(TestCase):
class TestActionList(TestCase, TestMixin):
"""
Test the ActionList class
"""
@ -49,10 +48,8 @@ class TestActionList(TestCase):
Prepare the tests
"""
self.action_list = ActionList.get_instance()
Settings.setDefaultFormat(Settings.IniFormat)
self.build_settings()
self.settings = Settings()
self.fd, self.ini_file = mkstemp('.ini')
self.settings.set_filename(self.ini_file)
self.settings.beginGroup('shortcuts')
def tearDown(self):
@ -60,8 +57,7 @@ class TestActionList(TestCase):
Clean up
"""
self.settings.endGroup()
os.close(self.fd)
os.unlink(Settings().fileName())
self.destroy_settings()
def test_add_action_same_parent(self):
"""

View File

@ -1 +1,28 @@
__author__ = 'raoul'
# -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
###############################################################################
# OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- #
# Copyright (c) 2008-2014 Raoul Snyman #
# Portions copyright (c) 2008-2014 Tim Bentley, Gerald Britton, Jonathan #
# Corwin, Samuel Findlay, Michael Gorven, Scott Guerrieri, Matthias Hub, #
# Meinert Jordan, Armin Köhler, Erik Lundin, Edwin Lunando, Brian T. Meyer. #
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free #
# Software Foundation; version 2 of the License. #
# #
# This program is distributed in the hope that it will be useful, but WITHOUT #
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
# more details. #
# #
# You should have received a copy of the GNU General Public License along #
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################

View File

@ -25,4 +25,5 @@
# 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 #
###############################################################################
###############################################################################

View File

@ -63,6 +63,7 @@ from openlp.plugins.bibles.lib.http import BSExtract
# get_soup_for_bible_ref
# send_error_message
class TestBSExtract(TestCase):
"""
Test the BSExtractClass

View File

@ -49,7 +49,7 @@ class TestVerseReferenceList(TestCase):
verse = 1
version = 'testVersion'
copyright_ = 'testCopyright'
permission = 'testPermision'
permission = 'testPermission'
# WHEN: We add it to the verse list
reference_list.add(book, chapter, verse, version, copyright_, permission)
@ -57,9 +57,11 @@ class TestVerseReferenceList(TestCase):
# THEN: The entries should be in the first entry of the list
self.assertEqual(reference_list.current_index, 0, 'The current index should be 0')
self.assertEqual(reference_list.verse_list[0]['book'], book, 'The book in first entry should be %s' % book)
self.assertEqual(reference_list.verse_list[0]['chapter'], chapter, 'The chapter in first entry should be %u' % chapter)
self.assertEqual(reference_list.verse_list[0]['chapter'], chapter, 'The chapter in first entry should be %u' %
chapter)
self.assertEqual(reference_list.verse_list[0]['start'], verse, 'The start in first entry should be %u' % verse)
self.assertEqual(reference_list.verse_list[0]['version'], version, 'The version in first entry should be %s' % version)
self.assertEqual(reference_list.verse_list[0]['version'], version, 'The version in first entry should be %s' %
version)
self.assertEqual(reference_list.verse_list[0]['end'], verse, 'The end in first entry should be %u' % verse)
def add_next_verse_test(self):
@ -73,7 +75,7 @@ class TestVerseReferenceList(TestCase):
next_verse = 2
version = 'testVersion'
copyright_ = 'testCopyright'
permission = 'testPermision'
permission = 'testPermission'
reference_list = VerseReferenceList()
reference_list.add(book, chapter, verse, version, copyright_, permission)
@ -98,7 +100,7 @@ class TestVerseReferenceList(TestCase):
another_verse = 5
version = 'testVersion'
copyright_ = 'testCopyright'
permission = 'testPermision'
permission = 'testPermission'
reference_list = VerseReferenceList()
reference_list.add(book, chapter, verse, version, copyright_, permission)
@ -116,7 +118,7 @@ class TestVerseReferenceList(TestCase):
reference_list = VerseReferenceList()
version = 'testVersion'
copyright_ = 'testCopyright'
permission = 'testPermision'
permission = 'testPermission'
# WHEN: a not existing version will be added
reference_list.add_version(version, copyright_, permission)
@ -135,7 +137,7 @@ class TestVerseReferenceList(TestCase):
reference_list = VerseReferenceList()
version = 'testVersion'
copyright_ = 'testCopyright'
permission = 'testPermision'
permission = 'testPermission'
reference_list.add_version(version, copyright_, permission)
# WHEN: an existing version will be added

View File

@ -0,0 +1,28 @@
# -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
###############################################################################
# OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- #
# Copyright (c) 2008-2014 Raoul Snyman #
# Portions copyright (c) 2008-2014 Tim Bentley, Gerald Britton, Jonathan #
# Corwin, Samuel Findlay, Michael Gorven, Scott Guerrieri, Matthias Hub, #
# Meinert Jordan, Armin Köhler, Erik Lundin, Edwin Lunando, Brian T. Meyer. #
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free #
# Software Foundation; version 2 of the License. #
# #
# This program is distributed in the hope that it will be useful, but WITHOUT #
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
# more details. #
# #
# You should have received a copy of the GNU General Public License along #
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################

View File

@ -0,0 +1,28 @@
# -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
###############################################################################
# OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- #
# Copyright (c) 2008-2014 Raoul Snyman #
# Portions copyright (c) 2008-2014 Tim Bentley, Gerald Britton, Jonathan #
# Corwin, Samuel Findlay, Michael Gorven, Scott Guerrieri, Matthias Hub, #
# Meinert Jordan, Armin Köhler, Erik Lundin, Edwin Lunando, Brian T. Meyer. #
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free #
# Software Foundation; version 2 of the License. #
# #
# This program is distributed in the hope that it will be useful, but WITHOUT #
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
# more details. #
# #
# You should have received a copy of the GNU General Public License along #
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################

View File

@ -31,14 +31,13 @@ This module contains tests for the lib submodule of the Presentations plugin.
"""
from unittest import TestCase
from PyQt4 import QtGui
from openlp.core.common import Registry
from openlp.plugins.presentations.lib.mediaitem import PresentationMediaItem
from tests.functional import patch, MagicMock
from tests.helpers.testmixin import TestMixin
class TestMediaItem(TestCase):
class TestMediaItem(TestCase, TestMixin):
"""
Test the mediaitem methods.
"""
@ -52,13 +51,7 @@ class TestMediaItem(TestCase):
with patch('openlp.plugins.presentations.lib.mediaitem.MediaManagerItem._setup'), \
patch('openlp.plugins.presentations.lib.mediaitem.PresentationMediaItem.setup_item'):
self.media_item = PresentationMediaItem(None, MagicMock, MagicMock())
self.application = QtGui.QApplication.instance()
def tearDown(self):
"""
Delete all the C++ objects at the end so that we don't have a segfault
"""
del self.application
self.get_application()
def build_file_mask_string_test(self):
"""

View File

@ -32,22 +32,21 @@ This module contains tests for the PdfController
import os
import shutil
from unittest import TestCase, SkipTest
from tempfile import mkstemp, mkdtemp
from PyQt4 import QtGui
from tempfile import mkdtemp
from openlp.plugins.presentations.lib.pdfcontroller import PdfController, PdfDocument
from tests.functional import MagicMock
from openlp.core.common import Settings
from openlp.core.lib import ScreenList
from tests.utils.constants import TEST_RESOURCES_PATH
from tests.helpers.testmixin import TestMixin
__default_settings__ = {
'presentations/enable_pdf_program': False
}
class TestPdfController(TestCase):
class TestPdfController(TestCase, TestMixin):
"""
Test the PdfController.
"""
@ -55,11 +54,9 @@ class TestPdfController(TestCase):
"""
Set up the components need for all tests.
"""
Settings.setDefaultFormat(Settings.IniFormat)
self.fd, self.ini_file = mkstemp('.ini')
Settings().set_filename(self.ini_file)
self.application = QtGui.QApplication.instance()
ScreenList.create(self.application.desktop())
self.get_application()
self.build_settings()
ScreenList.create(self.app.desktop())
Settings().extend_default_settings(__default_settings__)
self.temp_folder = mkdtemp()
self.thumbnail_folder = mkdtemp()
@ -70,10 +67,8 @@ class TestPdfController(TestCase):
"""
Delete all the C++ objects at the end so that we don't have a segfault
"""
del self.application
try:
os.close(self.fd)
os.unlink(Settings().fileName())
self.destroy_settings()
shutil.rmtree(self.thumbnail_folder)
shutil.rmtree(self.temp_folder)
except OSError:

View File

@ -0,0 +1,28 @@
# -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
###############################################################################
# OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- #
# Copyright (c) 2008-2014 Raoul Snyman #
# Portions copyright (c) 2008-2014 Tim Bentley, Gerald Britton, Jonathan #
# Corwin, Samuel Findlay, Michael Gorven, Scott Guerrieri, Matthias Hub, #
# Meinert Jordan, Armin Köhler, Erik Lundin, Edwin Lunando, Brian T. Meyer. #
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free #
# Software Foundation; version 2 of the License. #
# #
# This program is distributed in the hope that it will be useful, but WITHOUT #
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
# more details. #
# #
# You should have received a copy of the GNU General Public License along #
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################

View File

@ -32,13 +32,13 @@ This module contains tests for the lib submodule of the Remotes plugin.
import os
import re
from unittest import TestCase
from tempfile import mkstemp
from PyQt4 import QtGui
from openlp.core.common import Settings
from openlp.plugins.remotes.lib.remotetab import RemoteTab
from tests.functional import patch
from tests.helpers.testmixin import TestMixin
__default_settings__ = {
'remotes/twelve hour': True,
@ -54,7 +54,7 @@ ZERO_URL = '0.0.0.0'
TEST_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..', 'resources'))
class TestRemoteTab(TestCase):
class TestRemoteTab(TestCase, TestMixin):
"""
Test the functions in the :mod:`lib` module.
"""
@ -62,10 +62,8 @@ class TestRemoteTab(TestCase):
"""
Create the UI
"""
Settings.setDefaultFormat(Settings.IniFormat)
self.fd, self.ini_file = mkstemp('.ini')
Settings().set_filename(self.ini_file)
self.application = QtGui.QApplication.instance()
self.get_application()
self.build_settings()
Settings().extend_default_settings(__default_settings__)
self.parent = QtGui.QMainWindow()
self.form = RemoteTab(self.parent, 'Remotes', None, None)
@ -74,11 +72,9 @@ class TestRemoteTab(TestCase):
"""
Delete all the C++ objects at the end so that we don't have a segfault
"""
del self.application
del self.parent
del self.form
os.close(self.fd)
os.unlink(Settings().fileName())
self.destroy_settings()
def get_ip_address_default_test(self):
"""

View File

@ -31,13 +31,11 @@ This module contains tests for the lib submodule of the Remotes plugin.
"""
import os
from unittest import TestCase
from tempfile import mkstemp
from PyQt4 import QtGui
from openlp.core.common import Settings
from openlp.plugins.remotes.lib.httpserver import HttpRouter
from tests.functional import MagicMock, patch, mock_open
from tests.helpers.testmixin import TestMixin
__default_settings__ = {
'remotes/twelve hour': True,
@ -53,7 +51,7 @@ __default_settings__ = {
TEST_PATH = os.path.abspath(os.path.dirname(__file__))
class TestRouter(TestCase):
class TestRouter(TestCase, TestMixin):
"""
Test the functions in the :mod:`lib` module.
"""
@ -61,10 +59,8 @@ class TestRouter(TestCase):
"""
Create the UI
"""
Settings.setDefaultFormat(Settings.IniFormat)
self.fd, self.ini_file = mkstemp('.ini')
Settings().set_filename(self.ini_file)
self.application = QtGui.QApplication.instance()
self.get_application()
self.build_settings()
Settings().extend_default_settings(__default_settings__)
self.router = HttpRouter()
@ -72,9 +68,7 @@ class TestRouter(TestCase):
"""
Delete all the C++ objects at the end so that we don't have a segfault
"""
del self.application
os.close(self.fd)
os.unlink(Settings().fileName())
self.destroy_settings()
def password_encrypter_test(self):
"""

View File

@ -1,3 +1,31 @@
# -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
###############################################################################
# OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- #
# Copyright (c) 2008-2014 Raoul Snyman #
# Portions copyright (c) 2008-2014 Tim Bentley, Gerald Britton, Jonathan #
# Corwin, Samuel Findlay, Michael Gorven, Scott Guerrieri, Matthias Hub, #
# Meinert Jordan, Armin Köhler, Erik Lundin, Edwin Lunando, Brian T. Meyer. #
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free #
# Software Foundation; version 2 of the License. #
# #
# This program is distributed in the hope that it will be useful, but WITHOUT #
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
# more details. #
# #
# You should have received a copy of the GNU General Public License along #
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
"""
Tests for the Songs plugin
"""

View File

@ -11,9 +11,10 @@ from openlp.core.common import Registry, Settings
from openlp.core.lib import ServiceItem
from openlp.plugins.songs.lib.mediaitem import SongMediaItem
from tests.functional import patch, MagicMock
from tests.helpers.testmixin import TestMixin
class TestMediaItem(TestCase):
class TestMediaItem(TestCase, TestMixin):
"""
Test the functions in the :mod:`lib` module.
"""
@ -27,24 +28,15 @@ class TestMediaItem(TestCase):
with patch('openlp.core.lib.mediamanageritem.MediaManagerItem._setup'), \
patch('openlp.plugins.songs.forms.editsongform.EditSongForm.__init__'):
self.media_item = SongMediaItem(None, MagicMock())
Settings.setDefaultFormat(Settings.IniFormat)
self.fd, self.ini_file = mkstemp('.ini')
Settings().set_filename(self.ini_file)
self.application = QtGui.QApplication.instance()
self.get_application()
self.build_settings()
QtCore.QLocale.setDefault(QtCore.QLocale('en_GB'))
def tearDown(self):
"""
Delete all the C++ objects at the end so that we don't have a segfault
"""
del self.application
# Not all tests use settings!
try:
os.close(self.fd)
os.unlink(Settings().fileName())
except Exception:
pass
self.destroy_settings()
def build_song_footer_one_author_test(self):
"""

View File

@ -39,6 +39,9 @@ from openlp.core.common import Settings
class TestMixin(object):
def get_application(self):
"""
Build or reuse the Application object
"""
old_app_instance = QtCore.QCoreApplication.instance()
if old_app_instance is None:
self.app = QtGui.QApplication([])
@ -46,11 +49,17 @@ class TestMixin(object):
self.app = old_app_instance
def build_settings(self):
"""
Build the settings Object and initialise it
"""
Settings.setDefaultFormat(Settings.IniFormat)
fd, self.ini_file = mkstemp('.ini')
Settings().set_filename(self.ini_file)
def destroy_settings(self):
"""
Destroy the Settings Object
"""
if hasattr(self, 'fd'):
os.close(self.fd)
os.unlink(Settings().fileName())

View File

@ -1,4 +1,31 @@
# -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
###############################################################################
# OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- #
# Copyright (c) 2008-2014 Raoul Snyman #
# Portions copyright (c) 2008-2014 Tim Bentley, Gerald Britton, Jonathan #
# Corwin, Samuel Findlay, Michael Gorven, Scott Guerrieri, Matthias Hub, #
# Meinert Jordan, Armin Köhler, Erik Lundin, Edwin Lunando, Brian T. Meyer. #
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free #
# Software Foundation; version 2 of the License. #
# #
# This program is distributed in the hope that it will be useful, but WITHOUT #
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
# more details. #
# #
# You should have received a copy of the GNU General Public License along #
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
import sip
sip.setapi('QDate', 2)
sip.setapi('QDateTime', 2)

View File

@ -0,0 +1,28 @@
# -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
###############################################################################
# OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- #
# Copyright (c) 2008-2014 Raoul Snyman #
# Portions copyright (c) 2008-2014 Tim Bentley, Gerald Britton, Jonathan #
# Corwin, Samuel Findlay, Michael Gorven, Scott Guerrieri, Matthias Hub, #
# Meinert Jordan, Armin Köhler, Erik Lundin, Edwin Lunando, Brian T. Meyer. #
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free #
# Software Foundation; version 2 of the License. #
# #
# This program is distributed in the hope that it will be useful, but WITHOUT #
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
# more details. #
# #
# You should have received a copy of the GNU General Public License along #
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################

View File

@ -1,20 +1,48 @@
# -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
###############################################################################
# OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- #
# Copyright (c) 2008-2014 Raoul Snyman #
# Portions copyright (c) 2008-2014 Tim Bentley, Gerald Britton, Jonathan #
# Corwin, Samuel Findlay, Michael Gorven, Scott Guerrieri, Matthias Hub, #
# Meinert Jordan, Armin Köhler, Erik Lundin, Edwin Lunando, Brian T. Meyer. #
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free #
# Software Foundation; version 2 of the License. #
# #
# This program is distributed in the hope that it will be useful, but WITHOUT #
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
# more details. #
# #
# You should have received a copy of the GNU General Public License along #
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
"""
Package to test the openlp.core.lib.pluginmanager package.
"""
import os
import sys
import shutil
from tempfile import mkstemp, mkdtemp
from tempfile import mkdtemp
from unittest import TestCase
from PyQt4 import QtGui, QtCore
from PyQt4 import QtGui
from openlp.core.common import Registry, Settings
from openlp.core.lib.pluginmanager import PluginManager
from tests.interfaces import MagicMock
from tests.helpers.testmixin import TestMixin
class TestPluginManager(TestCase):
class TestPluginManager(TestCase, TestMixin):
"""
Test the PluginManager class
"""
@ -24,25 +52,19 @@ class TestPluginManager(TestCase):
Some pre-test setup required.
"""
Settings.setDefaultFormat(Settings.IniFormat)
self.fd, self.ini_file = mkstemp('.ini')
self.build_settings()
self.temp_dir = mkdtemp('openlp')
Settings().set_filename(self.ini_file)
Settings().setValue('advanced/data path', self.temp_dir)
Registry.create()
Registry().register('service_list', MagicMock())
old_app_instance = QtCore.QCoreApplication.instance()
if old_app_instance is None:
self.app = QtGui.QApplication([])
else:
self.app = old_app_instance
self.get_application()
self.main_window = QtGui.QMainWindow()
Registry().register('main_window', self.main_window)
def tearDown(self):
del self.main_window
os.close(self.fd)
os.unlink(Settings().fileName())
Settings().remove('advanced/data path')
self.destroy_settings()
shutil.rmtree(self.temp_dir)
def find_plugins_test(self):

View File

@ -1 +1,28 @@
# -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
###############################################################################
# OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- #
# Copyright (c) 2008-2014 Raoul Snyman #
# Portions copyright (c) 2008-2014 Tim Bentley, Gerald Britton, Jonathan #
# Corwin, Samuel Findlay, Michael Gorven, Scott Guerrieri, Matthias Hub, #
# Meinert Jordan, Armin Köhler, Erik Lundin, Edwin Lunando, Brian T. Meyer. #
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free #
# Software Foundation; version 2 of the License. #
# #
# This program is distributed in the hope that it will be useful, but WITHOUT #
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
# more details. #
# #
# You should have received a copy of the GNU General Public License along #
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################

View File

@ -31,7 +31,7 @@
"""
from unittest import TestCase
from PyQt4 import QtCore, QtGui, QtTest
from PyQt4 import QtGui, QtTest
from openlp.core.common import Registry
from openlp.core.ui import filerenameform

View File

@ -1,30 +1,55 @@
# -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
###############################################################################
# OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- #
# Copyright (c) 2008-2014 Raoul Snyman #
# Portions copyright (c) 2008-2014 Tim Bentley, Gerald Britton, Jonathan #
# Corwin, Samuel Findlay, Michael Gorven, Scott Guerrieri, Matthias Hub, #
# Meinert Jordan, Armin Köhler, Erik Lundin, Edwin Lunando, Brian T. Meyer. #
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free #
# Software Foundation; version 2 of the License. #
# #
# This program is distributed in the hope that it will be useful, but WITHOUT #
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
# more details. #
# #
# You should have received a copy of the GNU General Public License along #
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
"""
Package to test the openlp.core.ui.listpreviewwidget.
"""
from unittest import TestCase
from PyQt4 import QtGui, QtCore
from PyQt4 import QtGui
from openlp.core.common import Registry
from openlp.core.lib import ServiceItem
from openlp.core.ui import listpreviewwidget
from tests.interfaces import MagicMock, patch
from tests.utils.osdinteraction import read_service_from_file
from tests.helpers.testmixin import TestMixin
class TestListPreviewWidget(TestCase):
class TestListPreviewWidget(TestCase, TestMixin):
def setUp(self):
"""
Create the UI.
"""
Registry.create()
old_app_instance = QtCore.QCoreApplication.instance()
if old_app_instance is None:
self.app = QtGui.QApplication([])
else:
self.app = old_app_instance
self.get_application()
self.main_window = QtGui.QMainWindow()
self.image = QtGui.QImage(1, 1, QtGui.QImage.Format_RGB32)
self.image_manager = MagicMock()

View File

@ -1,16 +1,44 @@
# -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
###############################################################################
# OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- #
# Copyright (c) 2008-2014 Raoul Snyman #
# Portions copyright (c) 2008-2014 Tim Bentley, Gerald Britton, Jonathan #
# Corwin, Samuel Findlay, Michael Gorven, Scott Guerrieri, Matthias Hub, #
# Meinert Jordan, Armin Köhler, Erik Lundin, Edwin Lunando, Brian T. Meyer. #
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free #
# Software Foundation; version 2 of the License. #
# #
# This program is distributed in the hope that it will be useful, but WITHOUT #
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
# more details. #
# #
# You should have received a copy of the GNU General Public License along #
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
"""
Package to test the openlp.core.ui.mainwindow package.
"""
from unittest import TestCase
from PyQt4 import QtGui, QtCore
from openlp.core.common import Registry
from openlp.core.ui.mainwindow import MainWindow
from tests.interfaces import MagicMock, patch
from tests.helpers.testmixin import TestMixin
class TestMainWindow(TestCase):
class TestMainWindow(TestCase, TestMixin):
def setUp(self):
"""
@ -18,11 +46,7 @@ class TestMainWindow(TestCase):
"""
Registry.create()
self.registry = Registry()
old_app_instance = QtCore.QCoreApplication.instance()
if old_app_instance is None:
self.app = QtGui.QApplication([])
else:
self.app = old_app_instance
self.get_application()
# Mock cursor busy/normal methods.
self.app.set_busy_cursor = MagicMock()
self.app.set_normal_cursor = MagicMock()

View File

@ -1,29 +1,52 @@
# -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
###############################################################################
# OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- #
# Copyright (c) 2008-2014 Raoul Snyman #
# Portions copyright (c) 2008-2014 Tim Bentley, Gerald Britton, Jonathan #
# Corwin, Samuel Findlay, Michael Gorven, Scott Guerrieri, Matthias Hub, #
# Meinert Jordan, Armin Köhler, Erik Lundin, Edwin Lunando, Brian T. Meyer. #
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free #
# Software Foundation; version 2 of the License. #
# #
# This program is distributed in the hope that it will be useful, but WITHOUT #
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
# more details. #
# #
# You should have received a copy of the GNU General Public License along #
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
"""
Package to test the openlp.core.lib package.
"""
from unittest import TestCase
from PyQt4 import QtGui, QtTest, QtCore
from openlp.core.common import Registry
from openlp.core.lib import ScreenList, ServiceItem, ItemCapabilities
from openlp.core.ui.mainwindow import MainWindow
from tests.interfaces import MagicMock, patch
from tests.helpers.testmixin import TestMixin
class TestServiceManager(TestCase):
class TestServiceManager(TestCase, TestMixin):
def setUp(self):
"""
Create the UI
"""
Registry.create()
old_app_instance = QtCore.QCoreApplication.instance()
if old_app_instance is None:
self.app = QtGui.QApplication([])
else:
self.app = old_app_instance
self.get_application()
ScreenList.create(self.app.desktop())
Registry().register('application', MagicMock())
with patch('openlp.core.lib.PluginManager'):

View File

@ -36,20 +36,17 @@ from PyQt4 import QtCore, QtGui, QtTest
from openlp.core.common import Registry
from openlp.core.ui import servicenoteform
from tests.interfaces import patch
from tests.helpers.testmixin import TestMixin
class TestStartNoteDialog(TestCase):
class TestStartNoteDialog(TestCase, TestMixin):
def setUp(self):
"""
Create the UI
"""
Registry.create()
old_app_instance = QtCore.QCoreApplication.instance()
if old_app_instance is None:
self.app = QtGui.QApplication([])
else:
self.app = old_app_instance
self.get_application()
self.main_window = QtGui.QMainWindow()
Registry().register('main_window', self.main_window)
self.form = servicenoteform.ServiceNoteForm()

View File

@ -31,13 +31,13 @@ Package to test the openlp.core.lib.settingsform package.
"""
from unittest import TestCase
from PyQt4 import QtCore, QtTest, QtGui
from PyQt4 import QtCore, QtTest
from openlp.core.common import Registry
from openlp.core.ui import settingsform
from openlp.core.lib import ScreenList
from tests.interfaces import MagicMock, patch
from tests.helpers.testmixin import TestMixin
SCREEN = {
'primary': False,
@ -46,7 +46,7 @@ SCREEN = {
}
class TestSettingsForm(TestCase):
class TestSettingsForm(TestCase, TestMixin):
"""
Test the PluginManager class
"""
@ -59,11 +59,7 @@ class TestSettingsForm(TestCase):
self.dummy2 = MagicMock()
self.dummy3 = MagicMock()
self.desktop = MagicMock()
old_app_instance = QtCore.QCoreApplication.instance()
if old_app_instance is None:
self.app = QtGui.QApplication([])
else:
self.app = old_app_instance
self.get_application()
self.desktop.primaryScreen.return_value = SCREEN['primary']
self.desktop.screenCount.return_value = SCREEN['number']
self.desktop.screenGeometry.return_value = SCREEN['size']

View File

@ -1,3 +1,31 @@
# -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
###############################################################################
# OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- #
# Copyright (c) 2008-2014 Raoul Snyman #
# Portions copyright (c) 2008-2014 Tim Bentley, Gerald Britton, Jonathan #
# Corwin, Samuel Findlay, Michael Gorven, Scott Guerrieri, Matthias Hub, #
# Meinert Jordan, Armin Köhler, Erik Lundin, Edwin Lunando, Brian T. Meyer. #
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free #
# Software Foundation; version 2 of the License. #
# #
# This program is distributed in the hope that it will be useful, but WITHOUT #
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
# more details. #
# #
# You should have received a copy of the GNU General Public License along #
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
"""
Package to test the openlp.core.ui package.
"""
@ -8,20 +36,17 @@ from PyQt4 import QtCore, QtGui, QtTest
from openlp.core.common import Registry
from openlp.core.ui import starttimeform
from tests.interfaces import MagicMock, patch
from tests.helpers.testmixin import TestMixin
class TestStartTimeDialog(TestCase):
class TestStartTimeDialog(TestCase, TestMixin):
def setUp(self):
"""
Create the UI
"""
Registry.create()
old_app_instance = QtCore.QCoreApplication.instance()
if old_app_instance is None:
self.app = QtGui.QApplication([])
else:
self.app = old_app_instance
self.get_application()
self.main_window = QtGui.QMainWindow()
Registry().register('main_window', self.main_window)
self.form = starttimeform.StartTimeForm()

View File

@ -0,0 +1,28 @@
# -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
###############################################################################
# OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- #
# Copyright (c) 2008-2014 Raoul Snyman #
# Portions copyright (c) 2008-2014 Tim Bentley, Gerald Britton, Jonathan #
# Corwin, Samuel Findlay, Michael Gorven, Scott Guerrieri, Matthias Hub, #
# Meinert Jordan, Armin Köhler, Erik Lundin, Edwin Lunando, Brian T. Meyer. #
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free #
# Software Foundation; version 2 of the License. #
# #
# This program is distributed in the hope that it will be useful, but WITHOUT #
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
# more details. #
# #
# You should have received a copy of the GNU General Public License along #
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################

View File

@ -1,15 +1,43 @@
# -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
###############################################################################
# OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- #
# Copyright (c) 2008-2014 Raoul Snyman #
# Portions copyright (c) 2008-2014 Tim Bentley, Gerald Britton, Jonathan #
# Corwin, Samuel Findlay, Michael Gorven, Scott Guerrieri, Matthias Hub, #
# Meinert Jordan, Armin Köhler, Erik Lundin, Edwin Lunando, Brian T. Meyer. #
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free #
# Software Foundation; version 2 of the License. #
# #
# This program is distributed in the hope that it will be useful, but WITHOUT #
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
# more details. #
# #
# You should have received a copy of the GNU General Public License along #
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
"""
Functional tests to test the AppLocation class and related methods.
"""
import os
from unittest import TestCase
from PyQt4 import QtCore, QtGui
from openlp.core.utils import is_not_image_file
from tests.utils.constants import TEST_RESOURCES_PATH
from tests.helpers.testmixin import TestMixin
class TestUtils(TestCase):
class TestUtils(TestCase, TestMixin):
"""
A test suite to test out various methods around the Utils functions.
"""
@ -18,11 +46,7 @@ class TestUtils(TestCase):
"""
Some pre-test setup required.
"""
old_app_instance = QtCore.QCoreApplication.instance()
if old_app_instance is None:
self.app = QtGui.QApplication([])
else:
self.app = old_app_instance
self.get_application()
def is_not_image_empty_test(self):
"""

View File

@ -0,0 +1,28 @@
# -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
###############################################################################
# OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- #
# Copyright (c) 2008-2014 Raoul Snyman #
# Portions copyright (c) 2008-2014 Tim Bentley, Gerald Britton, Jonathan #
# Corwin, Samuel Findlay, Michael Gorven, Scott Guerrieri, Matthias Hub, #
# Meinert Jordan, Armin Köhler, Erik Lundin, Edwin Lunando, Brian T. Meyer. #
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free #
# Software Foundation; version 2 of the License. #
# #
# This program is distributed in the hope that it will be useful, but WITHOUT #
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
# more details. #
# #
# You should have received a copy of the GNU General Public License along #
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################

View File

@ -0,0 +1,28 @@
# -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
###############################################################################
# OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- #
# Copyright (c) 2008-2014 Raoul Snyman #
# Portions copyright (c) 2008-2014 Tim Bentley, Gerald Britton, Jonathan #
# Corwin, Samuel Findlay, Michael Gorven, Scott Guerrieri, Matthias Hub, #
# Meinert Jordan, Armin Köhler, Erik Lundin, Edwin Lunando, Brian T. Meyer. #
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free #
# Software Foundation; version 2 of the License. #
# #
# This program is distributed in the hope that it will be useful, but WITHOUT #
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
# more details. #
# #
# You should have received a copy of the GNU General Public License along #
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################

View File

@ -38,9 +38,10 @@ from openlp.core.common import Registry
from openlp.plugins.custom.lib.mediaitem import CustomMediaItem
from openlp.plugins.custom.forms.editcustomform import EditCustomForm
from tests.interfaces import MagicMock, patch
from tests.helpers.testmixin import TestMixin
class TestEditCustomForm(TestCase):
class TestEditCustomForm(TestCase, TestMixin):
"""
Test the EditCustomForm.
"""
@ -49,11 +50,7 @@ class TestEditCustomForm(TestCase):
Create the UI
"""
Registry.create()
old_app_instance = QtCore.QCoreApplication.instance()
if old_app_instance is None:
self.app = QtGui.QApplication([])
else:
self.app = old_app_instance
self.get_application()
self.main_window = QtGui.QMainWindow()
Registry().register('main_window', self.main_window)
media_item = MagicMock()

View File

@ -1,16 +1,45 @@
# -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
###############################################################################
# OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- #
# Copyright (c) 2008-2014 Raoul Snyman #
# Portions copyright (c) 2008-2014 Tim Bentley, Gerald Britton, Jonathan #
# Corwin, Samuel Findlay, Michael Gorven, Scott Guerrieri, Matthias Hub, #
# Meinert Jordan, Armin Köhler, Erik Lundin, Edwin Lunando, Brian T. Meyer. #
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free #
# Software Foundation; version 2 of the License. #
# #
# This program is distributed in the hope that it will be useful, but WITHOUT #
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
# more details. #
# #
# You should have received a copy of the GNU General Public License along #
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
"""
Module to test the EditCustomSlideForm.
"""
from unittest import TestCase
from PyQt4 import QtGui, QtCore
from PyQt4 import QtGui
from openlp.core.common import Registry
from openlp.plugins.custom.forms.editcustomslideform import EditCustomSlideForm
from tests.interfaces import MagicMock, patch
from tests.helpers.testmixin import TestMixin
class TestEditCustomSlideForm(TestCase):
class TestEditCustomSlideForm(TestCase, TestMixin):
"""
Test the EditCustomSlideForm.
"""
@ -19,11 +48,7 @@ class TestEditCustomSlideForm(TestCase):
Create the UI
"""
Registry.create()
old_app_instance = QtCore.QCoreApplication.instance()
if old_app_instance is None:
self.app = QtGui.QApplication([])
else:
self.app = old_app_instance
self.get_application()
self.main_window = QtGui.QMainWindow()
Registry().register('main_window', self.main_window)
self.form = EditCustomSlideForm()

View File

@ -0,0 +1,28 @@
# -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
###############################################################################
# OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- #
# Copyright (c) 2008-2014 Raoul Snyman #
# Portions copyright (c) 2008-2014 Tim Bentley, Gerald Britton, Jonathan #
# Corwin, Samuel Findlay, Michael Gorven, Scott Guerrieri, Matthias Hub, #
# Meinert Jordan, Armin Köhler, Erik Lundin, Edwin Lunando, Brian T. Meyer. #
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free #
# Software Foundation; version 2 of the License. #
# #
# This program is distributed in the hope that it will be useful, but WITHOUT #
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
# more details. #
# #
# You should have received a copy of the GNU General Public License along #
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################

View File

@ -0,0 +1,28 @@
# -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
###############################################################################
# OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- #
# Copyright (c) 2008-2014 Raoul Snyman #
# Portions copyright (c) 2008-2014 Tim Bentley, Gerald Britton, Jonathan #
# Corwin, Samuel Findlay, Michael Gorven, Scott Guerrieri, Matthias Hub, #
# Meinert Jordan, Armin Köhler, Erik Lundin, Edwin Lunando, Brian T. Meyer. #
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free #
# Software Foundation; version 2 of the License. #
# #
# This program is distributed in the hope that it will be useful, but WITHOUT #
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
# more details. #
# #
# You should have received a copy of the GNU General Public License along #
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################

View File

@ -0,0 +1,28 @@
# -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
###############################################################################
# OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- #
# Copyright (c) 2008-2014 Raoul Snyman #
# Portions copyright (c) 2008-2014 Tim Bentley, Gerald Britton, Jonathan #
# Corwin, Samuel Findlay, Michael Gorven, Scott Guerrieri, Matthias Hub, #
# Meinert Jordan, Armin Köhler, Erik Lundin, Edwin Lunando, Brian T. Meyer. #
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free #
# Software Foundation; version 2 of the License. #
# #
# This program is distributed in the hope that it will be useful, but WITHOUT #
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
# more details. #
# #
# You should have received a copy of the GNU General Public License along #
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################

View File

@ -1,3 +1,31 @@
# -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
###############################################################################
# OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- #
# Copyright (c) 2008-2014 Raoul Snyman #
# Portions copyright (c) 2008-2014 Tim Bentley, Gerald Britton, Jonathan #
# Corwin, Samuel Findlay, Michael Gorven, Scott Guerrieri, Matthias Hub, #
# Meinert Jordan, Armin Köhler, Erik Lundin, Edwin Lunando, Brian T. Meyer. #
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free #
# Software Foundation; version 2 of the License. #
# #
# This program is distributed in the hope that it will be useful, but WITHOUT #
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
# more details. #
# #
# You should have received a copy of the GNU General Public License along #
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
"""
Package to test the openlp.plugins.songs.forms.authorsform package.
"""
@ -7,9 +35,10 @@ from PyQt4 import QtGui, QtCore
from openlp.core.common import Registry
from openlp.plugins.songs.forms.authorsform import AuthorsForm
from tests.helpers.testmixin import TestMixin
class TestAuthorsForm(TestCase):
class TestAuthorsForm(TestCase, TestMixin):
"""
Test the AuthorsForm class
"""
@ -19,11 +48,7 @@ class TestAuthorsForm(TestCase):
Create the UI
"""
Registry.create()
old_app_instance = QtCore.QCoreApplication.instance()
if old_app_instance is None:
self.app = QtGui.QApplication([])
else:
self.app = old_app_instance
self.get_application()
self.main_window = QtGui.QMainWindow()
Registry().register('main_window', self.main_window)
self.form = AuthorsForm()

View File

@ -1,16 +1,45 @@
# -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
###############################################################################
# OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- #
# Copyright (c) 2008-2014 Raoul Snyman #
# Portions copyright (c) 2008-2014 Tim Bentley, Gerald Britton, Jonathan #
# Corwin, Samuel Findlay, Michael Gorven, Scott Guerrieri, Matthias Hub, #
# Meinert Jordan, Armin Köhler, Erik Lundin, Edwin Lunando, Brian T. Meyer. #
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free #
# Software Foundation; version 2 of the License. #
# #
# This program is distributed in the hope that it will be useful, but WITHOUT #
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
# more details. #
# #
# You should have received a copy of the GNU General Public License along #
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
"""
Package to test the openlp.plugins.songs.forms.editsongform package.
"""
from unittest import TestCase
from PyQt4 import QtGui, QtCore
from PyQt4 import QtGui
from openlp.core.common import Registry
from openlp.plugins.songs.forms.editsongform import EditSongForm
from tests.interfaces import MagicMock
from tests.helpers.testmixin import TestMixin
class TestEditSongForm(TestCase):
class TestEditSongForm(TestCase, TestMixin):
"""
Test the EditSongForm class
"""
@ -20,11 +49,7 @@ class TestEditSongForm(TestCase):
Create the UI
"""
Registry.create()
old_app_instance = QtCore.QCoreApplication.instance()
if old_app_instance is None:
self.app = QtGui.QApplication([])
else:
self.app = old_app_instance
self.get_application()
self.main_window = QtGui.QMainWindow()
Registry().register('main_window', self.main_window)
Registry().register('theme_manager', MagicMock())

View File

@ -1,3 +1,31 @@
# -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
###############################################################################
# OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- #
# Copyright (c) 2008-2014 Raoul Snyman #
# Portions copyright (c) 2008-2014 Tim Bentley, Gerald Britton, Jonathan #
# Corwin, Samuel Findlay, Michael Gorven, Scott Guerrieri, Matthias Hub, #
# Meinert Jordan, Armin Köhler, Erik Lundin, Edwin Lunando, Brian T. Meyer. #
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free #
# Software Foundation; version 2 of the License. #
# #
# This program is distributed in the hope that it will be useful, but WITHOUT #
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
# more details. #
# #
# You should have received a copy of the GNU General Public License along #
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
"""
Package to test the openlp.plugins.songs.forms.editverseform package.
"""
@ -7,9 +35,10 @@ from PyQt4 import QtCore, QtGui, QtTest
from openlp.core.common import Registry
from openlp.plugins.songs.forms.editverseform import EditVerseForm
from tests.helpers.testmixin import TestMixin
class TestEditVerseForm(TestCase):
class TestEditVerseForm(TestCase, TestMixin):
"""
Test the EditVerseForm class
"""
@ -19,11 +48,7 @@ class TestEditVerseForm(TestCase):
Create the UI
"""
Registry.create()
old_app_instance = QtCore.QCoreApplication.instance()
if old_app_instance is None:
self.app = QtGui.QApplication([])
else:
self.app = old_app_instance
self.get_application()
self.main_window = QtGui.QMainWindow()
Registry().register('main_window', self.main_window)
self.form = EditVerseForm()

View File

@ -1,3 +1,31 @@
# -*- coding: utf-8 -*-
# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4
###############################################################################
# OpenLP - Open Source Lyrics Projection #
# --------------------------------------------------------------------------- #
# Copyright (c) 2008-2014 Raoul Snyman #
# Portions copyright (c) 2008-2014 Tim Bentley, Gerald Britton, Jonathan #
# Corwin, Samuel Findlay, Michael Gorven, Scott Guerrieri, Matthias Hub, #
# Meinert Jordan, Armin Köhler, Erik Lundin, Edwin Lunando, Brian T. Meyer. #
# Joshua Miller, Stevan Pettit, Andreas Preikschat, Mattias Põldaru, #
# Christian Richter, Philip Ridout, Simon Scudder, Jeffrey Smith, #
# Maikel Stuivenberg, Martin Thompson, Jon Tibble, Dave Warnock, #
# Frode Woldsund, Martin Zibricky, Patrick Zimmermann #
# --------------------------------------------------------------------------- #
# This program is free software; you can redistribute it and/or modify it #
# under the terms of the GNU General Public License as published by the Free #
# Software Foundation; version 2 of the License. #
# #
# This program is distributed in the hope that it will be useful, but WITHOUT #
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
# more details. #
# #
# You should have received a copy of the GNU General Public License along #
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
"""
Package to test the openlp.plugins.songs.forms.topicsform package.
"""
@ -7,9 +35,10 @@ from PyQt4 import QtGui, QtCore
from openlp.core.common import Registry
from openlp.plugins.songs.forms.topicsform import TopicsForm
from tests.helpers.testmixin import TestMixin
class TestTopicsForm(TestCase):
class TestTopicsForm(TestCase, TestMixin):
"""
Test the TopicsForm class
"""
@ -19,11 +48,7 @@ class TestTopicsForm(TestCase):
Create the UI
"""
Registry.create()
old_app_instance = QtCore.QCoreApplication.instance()
if old_app_instance is None:
self.app = QtGui.QApplication([])
else:
self.app = old_app_instance
self.get_application()
self.main_window = QtGui.QMainWindow()
Registry().register('main_window', self.main_window)
self.form = TopicsForm()