forked from openlp/openlp
Finish adding RegistryProperties
This commit is contained in:
parent
85111766d5
commit
0a2456fa19
|
@ -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
|
|
@ -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)
|
||||
|
|
|
@ -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.
|
||||
|
||||
|
@ -409,27 +409,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
|
|
@ -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.
|
||||
|
@ -220,23 +220,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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
@ -652,23 +652,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)
|
||||
|
|
|
@ -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.
|
||||
"""
|
||||
|
@ -140,63 +140,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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
|
@ -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.
|
||||
"""
|
||||
|
@ -473,28 +473,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)
|
|
@ -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()
|
|
@ -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):
|
||||
"""
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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(RegistryProperties):
|
||||
"""
|
||||
The implementation of the Media Controller. The Media Controller adds an own
|
||||
class for every Player. Currently these are QtWebkit, Phonon and Vlc.
|
||||
|
@ -743,24 +743,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
|
|
@ -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 ''
|
|
@ -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'])
|
|
@ -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.
|
||||
"""
|
||||
|
@ -403,24 +403,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']])
|
|
@ -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.
|
||||
"""
|
||||
|
@ -151,14 +151,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)
|
||||
|
||||
|
|
|
@ -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_()
|
|
@ -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'))
|
|
@ -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
|
||||
"""
|
||||
|
@ -152,34 +152,4 @@ class SettingsForm(QtGui.QDialog, Ui_SettingsDialog):
|
|||
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)
|
|
@ -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
|
||||
"""
|
||||
|
@ -462,14 +462,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)
|
||||
|
||||
|
|
|
@ -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
|
|
@ -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.
|
||||
|
@ -541,24 +541,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
|
|
@ -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
|
|
@ -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):
|
|||
'%s folder to import from.', '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.
|
||||
|
@ -318,18 +318,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)
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -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()
|
|
@ -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
|
||||
|
@ -41,7 +41,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
|
||||
"""
|
||||
|
@ -189,17 +189,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)
|
||||
|
|
|
@ -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
|
||||
|
@ -116,7 +116,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
|
||||
|
@ -542,20 +542,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):
|
||||
"""
|
||||
|
|
|
@ -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
|
||||
"""
|
||||
|
@ -300,22 +299,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
|
||||
"""
|
||||
|
@ -380,22 +365,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
|
||||
"""
|
||||
|
@ -484,22 +455,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):
|
||||
|
@ -677,20 +634,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):
|
||||
"""
|
||||
|
|
|
@ -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
|
||||
|
@ -86,7 +86,7 @@ class BibleFormat(object):
|
|||
]
|
||||
|
||||
|
||||
class BibleManager(object):
|
||||
class BibleManager(RegistryProperties):
|
||||
"""
|
||||
The Bible manager which holds and manages all the Bibles.
|
||||
"""
|
||||
|
@ -435,15 +435,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']
|
||||
|
|
|
@ -124,13 +124,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)
|
||||
|
|
|
@ -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.
|
||||
"""
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -430,13 +430,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)
|
||||
|
|
|
@ -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.
|
||||
|
@ -601,43 +601,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)
|
||||
|
|
|
@ -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()
|
|
@ -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
|
|
@ -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):
|
||||
"""
|
||||
|
|
|
@ -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)
|
|
@ -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.
|
||||
"""
|
||||
|
@ -80,18 +80,4 @@ class OpenLyricsExport(object):
|
|||
# characters in the path (see lp:757673 and lp:744337).
|
||||
tree.write(open(os.path.join(self.save_path, filename), 'wb'),
|
||||
encoding='utf-8', xml_declaration=True, 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)
|
||||
return True
|
|
@ -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()
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue