forked from openlp/openlp
Merged from trunk - updated to lxml
This commit is contained in:
commit
cfc9c72845
@ -60,18 +60,6 @@
|
|||||||
.. autoclass:: openlp.core.lib.settingstab.SettingsTab
|
.. autoclass:: openlp.core.lib.settingstab.SettingsTab
|
||||||
:members:
|
:members:
|
||||||
|
|
||||||
:mod:`SongXMLBuilder`
|
|
||||||
---------------------
|
|
||||||
|
|
||||||
.. autoclass:: openlp.core.lib.songxmlhandler.SongXMLBuilder
|
|
||||||
:members:
|
|
||||||
|
|
||||||
:mod:`SongXMLParser`
|
|
||||||
--------------------
|
|
||||||
|
|
||||||
.. autoclass:: openlp.core.lib.songxmlhandler.SongXMLParser
|
|
||||||
:members:
|
|
||||||
|
|
||||||
:mod:`ThemeXML`
|
:mod:`ThemeXML`
|
||||||
---------------
|
---------------
|
||||||
|
|
||||||
@ -83,10 +71,3 @@
|
|||||||
|
|
||||||
.. autoclass:: openlp.core.lib.toolbar.OpenLPToolbar
|
.. autoclass:: openlp.core.lib.toolbar.OpenLPToolbar
|
||||||
:members:
|
:members:
|
||||||
|
|
||||||
:mod:`XmlRootClass`
|
|
||||||
-------------------
|
|
||||||
|
|
||||||
.. autoclass:: openlp.core.lib.xmlrootclass.XmlRootClass
|
|
||||||
:members:
|
|
||||||
|
|
||||||
|
@ -202,28 +202,17 @@ def check_item_selected(list_widget, message):
|
|||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
class ThemeLevel(object):
|
|
||||||
"""
|
|
||||||
Provides an enumeration for the level a theme applies to
|
|
||||||
"""
|
|
||||||
Global = 1
|
|
||||||
Service = 2
|
|
||||||
Song = 3
|
|
||||||
|
|
||||||
from eventreceiver import Receiver
|
from eventreceiver import Receiver
|
||||||
from settingsmanager import SettingsManager
|
from settingsmanager import SettingsManager
|
||||||
from plugin import PluginStatus, Plugin
|
from plugin import PluginStatus, Plugin
|
||||||
from pluginmanager import PluginManager
|
from pluginmanager import PluginManager
|
||||||
from settingstab import SettingsTab
|
from settingstab import SettingsTab
|
||||||
from xmlrootclass import XmlRootClass
|
|
||||||
from serviceitem import ServiceItem
|
from serviceitem import ServiceItem
|
||||||
from serviceitem import ServiceItemType
|
from serviceitem import ServiceItemType
|
||||||
from serviceitem import ItemCapabilities
|
from serviceitem import ItemCapabilities
|
||||||
from toolbar import OpenLPToolbar
|
from toolbar import OpenLPToolbar
|
||||||
from dockwidget import OpenLPDockWidget
|
from dockwidget import OpenLPDockWidget
|
||||||
from songxmlhandler import SongXMLBuilder, SongXMLParser
|
from theme import ThemeLevel, ThemeXML
|
||||||
from themexmlhandler import ThemeXML
|
|
||||||
from renderer import Renderer
|
from renderer import Renderer
|
||||||
from rendermanager import RenderManager
|
from rendermanager import RenderManager
|
||||||
from mediamanageritem import MediaManagerItem
|
from mediamanageritem import MediaManagerItem
|
||||||
|
@ -166,17 +166,17 @@ class Manager(object):
|
|||||||
else:
|
else:
|
||||||
return self.session.query(object_class).get(key)
|
return self.session.query(object_class).get(key)
|
||||||
|
|
||||||
def get_object_filtered(self, object_class, filter_string):
|
def get_object_filtered(self, object_class, filter_clause):
|
||||||
"""
|
"""
|
||||||
Returns an object matching specified criteria
|
Returns an object matching specified criteria
|
||||||
|
|
||||||
``object_class``
|
``object_class``
|
||||||
The type of object to return
|
The type of object to return
|
||||||
|
|
||||||
``filter_string``
|
``filter_clause``
|
||||||
The criteria to select the object by
|
The criteria to select the object by
|
||||||
"""
|
"""
|
||||||
return self.session.query(object_class).filter(filter_string).first()
|
return self.session.query(object_class).filter(filter_clause).first()
|
||||||
|
|
||||||
def get_all_objects(self, object_class, order_by_ref=None):
|
def get_all_objects(self, object_class, order_by_ref=None):
|
||||||
"""
|
"""
|
||||||
@ -188,21 +188,29 @@ class Manager(object):
|
|||||||
``order_by_ref``
|
``order_by_ref``
|
||||||
Any parameters to order the returned objects by. Defaults to None.
|
Any parameters to order the returned objects by. Defaults to None.
|
||||||
"""
|
"""
|
||||||
if order_by_ref:
|
query = self.session.query(object_class)
|
||||||
return self.session.query(object_class).order_by(order_by_ref).all()
|
if order_by_ref is not None:
|
||||||
return self.session.query(object_class).all()
|
return query.order_by(order_by_ref).all()
|
||||||
|
return query.all()
|
||||||
|
|
||||||
def get_all_objects_filtered(self, object_class, filter_string):
|
def get_all_objects_filtered(self, object_class, filter_clause,
|
||||||
|
order_by_ref=None):
|
||||||
"""
|
"""
|
||||||
Returns a selection of objects from the database
|
Returns a selection of objects from the database
|
||||||
|
|
||||||
``object_class``
|
``object_class``
|
||||||
The type of objects to return
|
The type of objects to return
|
||||||
|
|
||||||
``filter_string``
|
``filter_clause``
|
||||||
The filter governing selection of objects to return
|
The filter governing selection of objects to return
|
||||||
|
|
||||||
|
``order_by_ref``
|
||||||
|
Any parameters to order the returned objects by. Defaults to None.
|
||||||
"""
|
"""
|
||||||
return self.session.query(object_class).filter(filter_string).all()
|
query = self.session.query(object_class).filter(filter_clause)
|
||||||
|
if order_by_ref is not None:
|
||||||
|
return query.order_by(order_by_ref).all()
|
||||||
|
return query.all()
|
||||||
|
|
||||||
def delete_object(self, object_class, key):
|
def delete_object(self, object_class, key):
|
||||||
"""
|
"""
|
||||||
|
@ -443,7 +443,7 @@ class MediaManagerItem(QtGui.QWidget):
|
|||||||
service_item = self.buildServiceItem()
|
service_item = self.buildServiceItem()
|
||||||
if service_item:
|
if service_item:
|
||||||
service_item.from_plugin = True
|
service_item.from_plugin = True
|
||||||
self.parent.preview_controller.addServiceItem(service_item)
|
self.parent.previewController.addServiceItem(service_item)
|
||||||
|
|
||||||
def onLiveClick(self):
|
def onLiveClick(self):
|
||||||
"""
|
"""
|
||||||
@ -460,7 +460,7 @@ class MediaManagerItem(QtGui.QWidget):
|
|||||||
service_item = self.buildServiceItem()
|
service_item = self.buildServiceItem()
|
||||||
if service_item:
|
if service_item:
|
||||||
service_item.from_plugin = True
|
service_item.from_plugin = True
|
||||||
self.parent.live_controller.addServiceItem(service_item)
|
self.parent.liveController.addServiceItem(service_item)
|
||||||
|
|
||||||
def onAddClick(self):
|
def onAddClick(self):
|
||||||
"""
|
"""
|
||||||
@ -479,7 +479,7 @@ class MediaManagerItem(QtGui.QWidget):
|
|||||||
service_item = self.buildServiceItem()
|
service_item = self.buildServiceItem()
|
||||||
if service_item:
|
if service_item:
|
||||||
service_item.from_plugin = False
|
service_item.from_plugin = False
|
||||||
self.parent.service_manager.addServiceItem(service_item,
|
self.parent.serviceManager.addServiceItem(service_item,
|
||||||
replace=self.remoteTriggered)
|
replace=self.remoteTriggered)
|
||||||
else:
|
else:
|
||||||
items = self.ListView.selectedIndexes()
|
items = self.ListView.selectedIndexes()
|
||||||
@ -487,7 +487,7 @@ class MediaManagerItem(QtGui.QWidget):
|
|||||||
service_item = self.buildServiceItem(item)
|
service_item = self.buildServiceItem(item)
|
||||||
if service_item:
|
if service_item:
|
||||||
service_item.from_plugin = False
|
service_item.from_plugin = False
|
||||||
self.parent.service_manager.addServiceItem(service_item)
|
self.parent.serviceManager.addServiceItem(service_item)
|
||||||
|
|
||||||
def onAddEditClick(self):
|
def onAddEditClick(self):
|
||||||
"""
|
"""
|
||||||
@ -500,7 +500,7 @@ class MediaManagerItem(QtGui.QWidget):
|
|||||||
'You must select one or more items'))
|
'You must select one or more items'))
|
||||||
else:
|
else:
|
||||||
log.debug(self.PluginNameShort + u' Add requested')
|
log.debug(self.PluginNameShort + u' Add requested')
|
||||||
service_item = self.parent.service_manager.getServiceItem()
|
service_item = self.parent.serviceManager.getServiceItem()
|
||||||
if not service_item:
|
if not service_item:
|
||||||
QtGui.QMessageBox.information(self,
|
QtGui.QMessageBox.information(self,
|
||||||
translate('MediaManagerItem', 'No Service Item Selected'),
|
translate('MediaManagerItem', 'No Service Item Selected'),
|
||||||
@ -508,7 +508,7 @@ class MediaManagerItem(QtGui.QWidget):
|
|||||||
'You must select an existing service item to add to.'))
|
'You must select an existing service item to add to.'))
|
||||||
elif self.title.lower() == service_item.name.lower():
|
elif self.title.lower() == service_item.name.lower():
|
||||||
self.generateSlideData(service_item)
|
self.generateSlideData(service_item)
|
||||||
self.parent.service_manager.addServiceItem(service_item,
|
self.parent.serviceManager.addServiceItem(service_item,
|
||||||
replace=True)
|
replace=True)
|
||||||
else:
|
else:
|
||||||
#Turn off the remote edit update message indicator
|
#Turn off the remote edit update message indicator
|
||||||
|
@ -67,23 +67,23 @@ class Plugin(QtCore.QObject):
|
|||||||
|
|
||||||
**Hook Functions**
|
**Hook Functions**
|
||||||
|
|
||||||
``check_pre_conditions()``
|
``checkPreConditions()``
|
||||||
Provides the Plugin with a handle to check if it can be loaded.
|
Provides the Plugin with a handle to check if it can be loaded.
|
||||||
|
|
||||||
``get_media_manager_item()``
|
``getMediaManagerItem()``
|
||||||
Returns an instance of MediaManagerItem to be used in the Media Manager.
|
Returns an instance of MediaManagerItem to be used in the Media Manager.
|
||||||
|
|
||||||
``add_import_menu_item(import_menu)``
|
``addImportMenuItem(import_menu)``
|
||||||
Add an item to the Import menu.
|
Add an item to the Import menu.
|
||||||
|
|
||||||
``add_export_menu_item(export_menu)``
|
``addExportMenuItem(export_menu)``
|
||||||
Add an item to the Export menu.
|
Add an item to the Export menu.
|
||||||
|
|
||||||
``get_settings_tab()``
|
``getSettingsTab()``
|
||||||
Returns an instance of SettingsTabItem to be used in the Settings
|
Returns an instance of SettingsTabItem to be used in the Settings
|
||||||
dialog.
|
dialog.
|
||||||
|
|
||||||
``add_to_menu(menubar)``
|
``addToMenu(menubar)``
|
||||||
A method to add a menu item to anywhere in the menu, given the menu bar.
|
A method to add a menu item to anywhere in the menu, given the menu bar.
|
||||||
|
|
||||||
``handle_event(event)``
|
``handle_event(event)``
|
||||||
@ -124,18 +124,19 @@ class Plugin(QtCore.QObject):
|
|||||||
self.status = PluginStatus.Inactive
|
self.status = PluginStatus.Inactive
|
||||||
# Set up logging
|
# Set up logging
|
||||||
self.log = logging.getLogger(self.name)
|
self.log = logging.getLogger(self.name)
|
||||||
self.preview_controller = plugin_helpers[u'preview']
|
self.previewController = plugin_helpers[u'preview']
|
||||||
self.live_controller = plugin_helpers[u'live']
|
self.liveController = plugin_helpers[u'live']
|
||||||
self.render_manager = plugin_helpers[u'render']
|
self.renderManager = plugin_helpers[u'render']
|
||||||
self.service_manager = plugin_helpers[u'service']
|
self.serviceManager = plugin_helpers[u'service']
|
||||||
self.settings_form = plugin_helpers[u'settings form']
|
self.settingsForm = plugin_helpers[u'settings form']
|
||||||
self.mediadock = plugin_helpers[u'toolbox']
|
self.mediadock = plugin_helpers[u'toolbox']
|
||||||
self.maindisplay = plugin_helpers[u'maindisplay']
|
self.displayManager = plugin_helpers[u'displaymanager']
|
||||||
|
self.pluginManager = plugin_helpers[u'pluginmanager']
|
||||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||||
QtCore.SIGNAL(u'%s_add_service_item' % self.name),
|
QtCore.SIGNAL(u'%s_add_service_item' % self.name),
|
||||||
self.process_add_service_event)
|
self.processAddServiceEvent)
|
||||||
|
|
||||||
def check_pre_conditions(self):
|
def checkPreConditions(self):
|
||||||
"""
|
"""
|
||||||
Provides the Plugin with a handle to check if it can be loaded.
|
Provides the Plugin with a handle to check if it can be loaded.
|
||||||
Failing Preconditions does not stop a settings Tab being created
|
Failing Preconditions does not stop a settings Tab being created
|
||||||
@ -144,7 +145,7 @@ class Plugin(QtCore.QObject):
|
|||||||
"""
|
"""
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def set_status(self):
|
def setStatus(self):
|
||||||
"""
|
"""
|
||||||
Sets the status of the plugin
|
Sets the status of the plugin
|
||||||
"""
|
"""
|
||||||
@ -152,7 +153,7 @@ class Plugin(QtCore.QObject):
|
|||||||
self.settingsSection + u'/status',
|
self.settingsSection + u'/status',
|
||||||
QtCore.QVariant(PluginStatus.Inactive)).toInt()[0]
|
QtCore.QVariant(PluginStatus.Inactive)).toInt()[0]
|
||||||
|
|
||||||
def toggle_status(self, new_status):
|
def toggleStatus(self, new_status):
|
||||||
"""
|
"""
|
||||||
Changes the status of the plugin and remembers it
|
Changes the status of the plugin and remembers it
|
||||||
"""
|
"""
|
||||||
@ -160,7 +161,7 @@ class Plugin(QtCore.QObject):
|
|||||||
QtCore.QSettings().setValue(
|
QtCore.QSettings().setValue(
|
||||||
self.settingsSection + u'/status', QtCore.QVariant(self.status))
|
self.settingsSection + u'/status', QtCore.QVariant(self.status))
|
||||||
|
|
||||||
def is_active(self):
|
def isActive(self):
|
||||||
"""
|
"""
|
||||||
Indicates if the plugin is active
|
Indicates if the plugin is active
|
||||||
|
|
||||||
@ -168,47 +169,47 @@ class Plugin(QtCore.QObject):
|
|||||||
"""
|
"""
|
||||||
return self.status == PluginStatus.Active
|
return self.status == PluginStatus.Active
|
||||||
|
|
||||||
def get_media_manager_item(self):
|
def getMediaManagerItem(self):
|
||||||
"""
|
"""
|
||||||
Construct a MediaManagerItem object with all the buttons and things
|
Construct a MediaManagerItem object with all the buttons and things
|
||||||
you need, and return it for integration into openlp.org.
|
you need, and return it for integration into openlp.org.
|
||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def add_import_menu_item(self, import_menu):
|
def addImportMenuItem(self, importMenu):
|
||||||
"""
|
"""
|
||||||
Create a menu item and add it to the "Import" menu.
|
Create a menu item and add it to the "Import" menu.
|
||||||
|
|
||||||
``import_menu``
|
``importMenu``
|
||||||
The Import menu.
|
The Import menu.
|
||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def add_export_menu_item(self, export_menu):
|
def addExportMenuItem(self, exportMenu):
|
||||||
"""
|
"""
|
||||||
Create a menu item and add it to the "Export" menu.
|
Create a menu item and add it to the "Export" menu.
|
||||||
|
|
||||||
``export_menu``
|
``exportMenu``
|
||||||
The Export menu
|
The Export menu
|
||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def add_tools_menu_item(self, tools_menu):
|
def addToolsMenuItem(self, toolsMenu):
|
||||||
"""
|
"""
|
||||||
Create a menu item and add it to the "Tools" menu.
|
Create a menu item and add it to the "Tools" menu.
|
||||||
|
|
||||||
``tools_menu``
|
``toolsMenu``
|
||||||
The Tools menu
|
The Tools menu
|
||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def get_settings_tab(self):
|
def getSettingsTab(self):
|
||||||
"""
|
"""
|
||||||
Create a tab for the settings window.
|
Create a tab for the settings window.
|
||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def add_to_menu(self, menubar):
|
def addToMenu(self, menubar):
|
||||||
"""
|
"""
|
||||||
Add menu items to the menu, given the menubar.
|
Add menu items to the menu, given the menubar.
|
||||||
|
|
||||||
@ -217,16 +218,16 @@ class Plugin(QtCore.QObject):
|
|||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def process_add_service_event(self, replace=False):
|
def processAddServiceEvent(self, replace=False):
|
||||||
"""
|
"""
|
||||||
Generic Drag and drop handler triggered from service_manager.
|
Generic Drag and drop handler triggered from service_manager.
|
||||||
"""
|
"""
|
||||||
log.debug(u'process_add_service_event event called for plugin %s' %
|
log.debug(u'processAddServiceEvent event called for plugin %s' %
|
||||||
self.name)
|
self.name)
|
||||||
if replace:
|
if replace:
|
||||||
self.media_item.onAddEditClick()
|
self.mediaItem.onAddEditClick()
|
||||||
else:
|
else:
|
||||||
self.media_item.onAddClick()
|
self.mediaItem.onAddClick()
|
||||||
|
|
||||||
def about(self):
|
def about(self):
|
||||||
"""
|
"""
|
||||||
@ -240,33 +241,36 @@ class Plugin(QtCore.QObject):
|
|||||||
"""
|
"""
|
||||||
Called by the plugin Manager to initialise anything it needs.
|
Called by the plugin Manager to initialise anything it needs.
|
||||||
"""
|
"""
|
||||||
if self.media_item:
|
if self.mediaItem:
|
||||||
self.media_item.initialise()
|
self.mediaItem.initialise()
|
||||||
|
self.insertToolboxItem()
|
||||||
|
|
||||||
def finalise(self):
|
def finalise(self):
|
||||||
"""
|
"""
|
||||||
Called by the plugin Manager to cleanup things.
|
Called by the plugin Manager to cleanup things.
|
||||||
"""
|
"""
|
||||||
pass
|
self.removeToolboxItem()
|
||||||
|
|
||||||
def remove_toolbox_item(self):
|
def removeToolboxItem(self):
|
||||||
"""
|
"""
|
||||||
Called by the plugin to remove toolbar
|
Called by the plugin to remove toolbar
|
||||||
"""
|
"""
|
||||||
self.mediadock.remove_dock(self.name)
|
if self.mediaItem:
|
||||||
self.settings_form.removeTab(self.name)
|
self.mediadock.remove_dock(self.name)
|
||||||
|
if self.settings_tab:
|
||||||
|
self.settingsForm.removeTab(self.name)
|
||||||
|
|
||||||
def insert_toolbox_item(self):
|
def insertToolboxItem(self):
|
||||||
"""
|
"""
|
||||||
Called by plugin to replace toolbar
|
Called by plugin to replace toolbar
|
||||||
"""
|
"""
|
||||||
if self.media_item:
|
if self.mediaItem:
|
||||||
self.mediadock.insert_dock(self.media_item, self.icon, self.weight)
|
self.mediadock.insert_dock(self.mediaItem, self.icon, self.weight)
|
||||||
if self.settings_tab:
|
if self.settings_tab:
|
||||||
self.settings_form.insertTab(self.settings_tab, self.weight)
|
self.settingsForm.insertTab(self.settings_tab, self.weight)
|
||||||
|
|
||||||
def can_delete_theme(self, theme):
|
def canDeleteTheme(self, theme):
|
||||||
"""
|
"""
|
||||||
Called to ask the plugin if a theme can be deleted
|
Called to ask the plugin if a theme can be deleted
|
||||||
"""
|
"""
|
||||||
return True
|
return True
|
@ -109,9 +109,9 @@ class PluginManager(object):
|
|||||||
log.exception(u'loaded plugin %s has no helpers', unicode(p))
|
log.exception(u'loaded plugin %s has no helpers', unicode(p))
|
||||||
plugins_list = sorted(plugin_objects, self.order_by_weight)
|
plugins_list = sorted(plugin_objects, self.order_by_weight)
|
||||||
for plugin in plugins_list:
|
for plugin in plugins_list:
|
||||||
if plugin.check_pre_conditions():
|
if plugin.checkPreConditions():
|
||||||
log.debug(u'Plugin %s active', unicode(plugin.name))
|
log.debug(u'Plugin %s active', unicode(plugin.name))
|
||||||
plugin.set_status()
|
plugin.setStatus()
|
||||||
else:
|
else:
|
||||||
plugin.status = PluginStatus.Disabled
|
plugin.status = PluginStatus.Disabled
|
||||||
self.plugins.append(plugin)
|
self.plugins.append(plugin)
|
||||||
@ -138,7 +138,7 @@ class PluginManager(object):
|
|||||||
"""
|
"""
|
||||||
for plugin in self.plugins:
|
for plugin in self.plugins:
|
||||||
if plugin.status is not PluginStatus.Disabled:
|
if plugin.status is not PluginStatus.Disabled:
|
||||||
plugin.media_item = plugin.get_media_manager_item()
|
plugin.mediaItem = plugin.getMediaManagerItem()
|
||||||
|
|
||||||
def hook_settings_tabs(self, settingsform=None):
|
def hook_settings_tabs(self, settingsform=None):
|
||||||
"""
|
"""
|
||||||
@ -151,7 +151,7 @@ class PluginManager(object):
|
|||||||
"""
|
"""
|
||||||
for plugin in self.plugins:
|
for plugin in self.plugins:
|
||||||
if plugin.status is not PluginStatus.Disabled:
|
if plugin.status is not PluginStatus.Disabled:
|
||||||
plugin.settings_tab = plugin.get_settings_tab()
|
plugin.settings_tab = plugin.getSettingsTab()
|
||||||
if plugin.settings_tab:
|
if plugin.settings_tab:
|
||||||
log.debug(u'Inserting settings tab item from %s' %
|
log.debug(u'Inserting settings tab item from %s' %
|
||||||
plugin.name)
|
plugin.name)
|
||||||
@ -169,7 +169,7 @@ class PluginManager(object):
|
|||||||
"""
|
"""
|
||||||
for plugin in self.plugins:
|
for plugin in self.plugins:
|
||||||
if plugin.status is not PluginStatus.Disabled:
|
if plugin.status is not PluginStatus.Disabled:
|
||||||
plugin.add_import_menu_item(import_menu)
|
plugin.addImportMenuItem(import_menu)
|
||||||
|
|
||||||
def hook_export_menu(self, export_menu):
|
def hook_export_menu(self, export_menu):
|
||||||
"""
|
"""
|
||||||
@ -181,7 +181,7 @@ class PluginManager(object):
|
|||||||
"""
|
"""
|
||||||
for plugin in self.plugins:
|
for plugin in self.plugins:
|
||||||
if plugin.status is not PluginStatus.Disabled:
|
if plugin.status is not PluginStatus.Disabled:
|
||||||
plugin.add_export_menu_item(export_menu)
|
plugin.addExportMenuItem(export_menu)
|
||||||
|
|
||||||
def hook_tools_menu(self, tools_menu):
|
def hook_tools_menu(self, tools_menu):
|
||||||
"""
|
"""
|
||||||
@ -193,7 +193,7 @@ class PluginManager(object):
|
|||||||
"""
|
"""
|
||||||
for plugin in self.plugins:
|
for plugin in self.plugins:
|
||||||
if plugin.status is not PluginStatus.Disabled:
|
if plugin.status is not PluginStatus.Disabled:
|
||||||
plugin.add_tools_menu_item(tools_menu)
|
plugin.addToolsMenuItem(tools_menu)
|
||||||
|
|
||||||
def initialise_plugins(self):
|
def initialise_plugins(self):
|
||||||
"""
|
"""
|
||||||
@ -202,12 +202,12 @@ class PluginManager(object):
|
|||||||
"""
|
"""
|
||||||
for plugin in self.plugins:
|
for plugin in self.plugins:
|
||||||
log.info(u'initialising plugins %s in a %s state'
|
log.info(u'initialising plugins %s in a %s state'
|
||||||
% (plugin.name, plugin.is_active()))
|
% (plugin.name, plugin.isActive()))
|
||||||
if plugin.is_active():
|
if plugin.isActive():
|
||||||
plugin.initialise()
|
plugin.initialise()
|
||||||
log.info(u'Initialisation Complete for %s ' % plugin.name)
|
log.info(u'Initialisation Complete for %s ' % plugin.name)
|
||||||
if not plugin.is_active():
|
if not plugin.isActive():
|
||||||
plugin.remove_toolbox_item()
|
plugin.removeToolboxItem()
|
||||||
|
|
||||||
def finalise_plugins(self):
|
def finalise_plugins(self):
|
||||||
"""
|
"""
|
||||||
@ -216,7 +216,6 @@ class PluginManager(object):
|
|||||||
"""
|
"""
|
||||||
log.info(u'finalising plugins')
|
log.info(u'finalising plugins')
|
||||||
for plugin in self.plugins:
|
for plugin in self.plugins:
|
||||||
if plugin.is_active():
|
if plugin.isActive():
|
||||||
plugin.finalise()
|
plugin.finalise()
|
||||||
log.info(u'Finalisation Complete for %s ' % plugin.name)
|
log.info(u'Finalisation Complete for %s ' % plugin.name)
|
||||||
|
|
@ -29,6 +29,7 @@ format it for the output display.
|
|||||||
import logging
|
import logging
|
||||||
|
|
||||||
from PyQt4 import QtGui, QtCore
|
from PyQt4 import QtGui, QtCore
|
||||||
|
|
||||||
from openlp.core.lib import resize_image
|
from openlp.core.lib import resize_image
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
@ -27,8 +27,7 @@ import logging
|
|||||||
|
|
||||||
from PyQt4 import QtCore
|
from PyQt4 import QtCore
|
||||||
|
|
||||||
from renderer import Renderer
|
from openlp.core.lib import Renderer, ThemeLevel
|
||||||
from openlp.core.lib import ThemeLevel
|
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
@ -35,7 +35,6 @@ import uuid
|
|||||||
from PyQt4 import QtGui
|
from PyQt4 import QtGui
|
||||||
|
|
||||||
from openlp.core.lib import build_icon, resize_image
|
from openlp.core.lib import build_icon, resize_image
|
||||||
from openlp.core.utils import AppLocation
|
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -74,7 +73,7 @@ class ServiceItem(object):
|
|||||||
The plugin that this service item belongs to.
|
The plugin that this service item belongs to.
|
||||||
"""
|
"""
|
||||||
if plugin:
|
if plugin:
|
||||||
self.render_manager = plugin.render_manager
|
self.render_manager = plugin.renderManager
|
||||||
self.name = plugin.name
|
self.name = plugin.name
|
||||||
self.title = u''
|
self.title = u''
|
||||||
self.shortname = u''
|
self.shortname = u''
|
||||||
@ -93,7 +92,6 @@ class ServiceItem(object):
|
|||||||
self.is_valid = True
|
self.is_valid = True
|
||||||
self.cache = {}
|
self.cache = {}
|
||||||
self.icon = None
|
self.icon = None
|
||||||
self.serviceItemPath = AppLocation.get_section_data_path(u'serviceItems')
|
|
||||||
|
|
||||||
def add_capability(self, capability):
|
def add_capability(self, capability):
|
||||||
"""
|
"""
|
||||||
@ -155,12 +153,9 @@ class ServiceItem(object):
|
|||||||
del self.cache[len(self._display_frames)]
|
del self.cache[len(self._display_frames)]
|
||||||
log.log(15, u'Formatting took %4s' % (time.time() - before))
|
log.log(15, u'Formatting took %4s' % (time.time() - before))
|
||||||
elif self.service_item_type == ServiceItemType.Image:
|
elif self.service_item_type == ServiceItemType.Image:
|
||||||
for count, slide in enumerate(self._raw_frames):
|
for slide in self._raw_frames:
|
||||||
slide[u'image'] = resize_image(slide[u'image'],
|
slide[u'image'] = resize_image(slide[u'image'],
|
||||||
self.render_manager.width, self.render_manager.height)
|
self.render_manager.width, self.render_manager.height)
|
||||||
path = os.path.join(self.serviceItemPath, self._uuid + unicode(count) + u'.png')
|
|
||||||
slide[u'image'].save(path)
|
|
||||||
slide[u'display'] = path
|
|
||||||
elif self.service_item_type == ServiceItemType.Command:
|
elif self.service_item_type == ServiceItemType.Command:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
@ -376,8 +371,7 @@ class ServiceItem(object):
|
|||||||
if self.service_item_type == ServiceItemType.Text:
|
if self.service_item_type == ServiceItemType.Text:
|
||||||
return self.render_individual(row)
|
return self.render_individual(row)
|
||||||
else:
|
else:
|
||||||
return {u'main':self._raw_frames[row][u'image'],
|
return {u'main':self._raw_frames[row][u'image'], u'trans':None}
|
||||||
u'trans':None, u'display':self._raw_frames[row][u'display']}
|
|
||||||
|
|
||||||
def get_frame_title(self, row=0):
|
def get_frame_title(self, row=0):
|
||||||
"""
|
"""
|
||||||
|
@ -79,6 +79,14 @@ BLANK_THEME_XML = \
|
|||||||
</theme>
|
</theme>
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
class ThemeLevel(object):
|
||||||
|
"""
|
||||||
|
Provides an enumeration for the level a theme applies to
|
||||||
|
"""
|
||||||
|
Global = 1
|
||||||
|
Service = 2
|
||||||
|
Song = 3
|
||||||
|
|
||||||
class ThemeXML(object):
|
class ThemeXML(object):
|
||||||
"""
|
"""
|
||||||
A class to encapsulate the Theme XML.
|
A class to encapsulate the Theme XML.
|
||||||
@ -313,7 +321,6 @@ class ThemeXML(object):
|
|||||||
element.appendChild(value)
|
element.appendChild(value)
|
||||||
background.appendChild(element)
|
background.appendChild(element)
|
||||||
|
|
||||||
|
|
||||||
def child_element(self, element, tag, value):
|
def child_element(self, element, tag, value):
|
||||||
"""
|
"""
|
||||||
Generic child element creator.
|
Generic child element creator.
|
||||||
@ -351,14 +358,8 @@ class ThemeXML(object):
|
|||||||
``xml``
|
``xml``
|
||||||
The XML string to parse.
|
The XML string to parse.
|
||||||
"""
|
"""
|
||||||
self.base_parse_xml()
|
|
||||||
self.parse_xml(xml)
|
|
||||||
|
|
||||||
def base_parse_xml(self):
|
|
||||||
"""
|
|
||||||
Pull in the blank theme XML as a starting point.
|
|
||||||
"""
|
|
||||||
self.parse_xml(BLANK_THEME_XML)
|
self.parse_xml(BLANK_THEME_XML)
|
||||||
|
self.parse_xml(xml)
|
||||||
|
|
||||||
def parse_xml(self, xml):
|
def parse_xml(self, xml):
|
||||||
"""
|
"""
|
||||||
@ -414,4 +415,3 @@ class ThemeXML(object):
|
|||||||
if key[0:1] != u'_':
|
if key[0:1] != u'_':
|
||||||
theme_strings.append(u'%30s: %s' % (key, getattr(self, key)))
|
theme_strings.append(u'%30s: %s' % (key, getattr(self, key)))
|
||||||
return u'\n'.join(theme_strings)
|
return u'\n'.join(theme_strings)
|
||||||
|
|
@ -1,104 +0,0 @@
|
|||||||
# -*- coding: utf-8 -*-
|
|
||||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
# OpenLP - Open Source Lyrics Projection #
|
|
||||||
# --------------------------------------------------------------------------- #
|
|
||||||
# Copyright (c) 2008-2010 Raoul Snyman #
|
|
||||||
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
|
|
||||||
# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
|
|
||||||
# Thompson, Jon Tibble, Carsten Tinggaard #
|
|
||||||
# --------------------------------------------------------------------------- #
|
|
||||||
# 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 os
|
|
||||||
import sys
|
|
||||||
|
|
||||||
from lxml.etree import ElementTree, XML
|
|
||||||
|
|
||||||
sys.path.append(os.path.abspath(os.path.join(u'.', u'..', u'..')))
|
|
||||||
|
|
||||||
class XmlRootClass(object):
|
|
||||||
"""
|
|
||||||
Root class for themes, songs etc
|
|
||||||
|
|
||||||
This class provides interface for parsing xml files into object attributes.
|
|
||||||
|
|
||||||
If you overload this class and provide a function called `post_tag_hook`,
|
|
||||||
it will be called thusly for each `tag, value` pair::
|
|
||||||
|
|
||||||
(element.tag, val) = self.post_tag_hook(element.tag, val)
|
|
||||||
"""
|
|
||||||
def _set_from_xml(self, xml, root_tag):
|
|
||||||
"""
|
|
||||||
Set song properties from given xml content.
|
|
||||||
|
|
||||||
``xml``
|
|
||||||
Formatted xml tags and values.
|
|
||||||
``root_tag``
|
|
||||||
The root tag of the xml.
|
|
||||||
"""
|
|
||||||
root = ElementTree(element=XML(xml))
|
|
||||||
xml_iter = root.getiterator()
|
|
||||||
for element in xml_iter:
|
|
||||||
if element.tag != root_tag:
|
|
||||||
text = element.text
|
|
||||||
if text is None:
|
|
||||||
val = text
|
|
||||||
elif isinstance(text, basestring):
|
|
||||||
# Strings need special handling to sort the colours out
|
|
||||||
if text[0] == u'$':
|
|
||||||
# This might be a hex number, let's try to convert it.
|
|
||||||
try:
|
|
||||||
val = int(text[1:], 16)
|
|
||||||
except ValueError:
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
# Let's just see if it's a integer.
|
|
||||||
try:
|
|
||||||
val = int(text)
|
|
||||||
except ValueError:
|
|
||||||
# Ok, it seems to be a string.
|
|
||||||
val = text
|
|
||||||
if hasattr(self, u'post_tag_hook'):
|
|
||||||
(element.tag, val) = \
|
|
||||||
self.post_tag_hook(element.tag, val)
|
|
||||||
setattr(self, element.tag, val)
|
|
||||||
|
|
||||||
def __str__(self):
|
|
||||||
"""
|
|
||||||
Return string with all public attributes
|
|
||||||
|
|
||||||
The string is formatted with one attribute per line
|
|
||||||
If the string is split on newline then the length of the
|
|
||||||
list is equal to the number of attributes
|
|
||||||
"""
|
|
||||||
attributes = []
|
|
||||||
for attrib in dir(self):
|
|
||||||
if not attrib.startswith(u'_'):
|
|
||||||
attributes.append(
|
|
||||||
u'%30s : %s' % (attrib, getattr(self, attrib)))
|
|
||||||
return u'\n'.join(attributes)
|
|
||||||
|
|
||||||
def _get_as_string(self):
|
|
||||||
"""
|
|
||||||
Return one string with all public attributes
|
|
||||||
"""
|
|
||||||
result = u''
|
|
||||||
for attrib in dir(self):
|
|
||||||
if not attrib.startswith(u'_'):
|
|
||||||
result += u'_%s_' % getattr(self, attrib)
|
|
||||||
return result
|
|
||||||
|
|
@ -222,4 +222,3 @@ class Theme(object):
|
|||||||
if key[0:1] != u'_':
|
if key[0:1] != u'_':
|
||||||
theme_strings.append(u'%30s : %s' % (key, getattr(self, key)))
|
theme_strings.append(u'%30s : %s' % (key, getattr(self, key)))
|
||||||
return u'\n'.join(theme_strings)
|
return u'\n'.join(theme_strings)
|
||||||
|
|
||||||
|
@ -178,13 +178,11 @@ class Ui_AmendThemeDialog(object):
|
|||||||
self.MainFontLayout.setWidget(2, QtGui.QFormLayout.LabelRole,
|
self.MainFontLayout.setWidget(2, QtGui.QFormLayout.LabelRole,
|
||||||
self.FontMainSize)
|
self.FontMainSize)
|
||||||
self.FontMainSizeSpinBox = QtGui.QSpinBox(self.FontMainGroupBox)
|
self.FontMainSizeSpinBox = QtGui.QSpinBox(self.FontMainGroupBox)
|
||||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum,
|
defaultSizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum,
|
||||||
QtGui.QSizePolicy.Fixed)
|
QtGui.QSizePolicy.Fixed)
|
||||||
sizePolicy.setHorizontalStretch(0)
|
defaultSizePolicy.setHeightForWidth(
|
||||||
sizePolicy.setVerticalStretch(0)
|
|
||||||
sizePolicy.setHeightForWidth(
|
|
||||||
self.FontMainSizeSpinBox.sizePolicy().hasHeightForWidth())
|
self.FontMainSizeSpinBox.sizePolicy().hasHeightForWidth())
|
||||||
self.FontMainSizeSpinBox.setSizePolicy(sizePolicy)
|
self.FontMainSizeSpinBox.setSizePolicy(defaultSizePolicy)
|
||||||
self.FontMainSizeSpinBox.setMinimumSize(QtCore.QSize(70, 0))
|
self.FontMainSizeSpinBox.setMinimumSize(QtCore.QSize(70, 0))
|
||||||
self.FontMainSizeSpinBox.setProperty(u'value', QtCore.QVariant(16))
|
self.FontMainSizeSpinBox.setProperty(u'value', QtCore.QVariant(16))
|
||||||
self.FontMainSizeSpinBox.setMaximum(999)
|
self.FontMainSizeSpinBox.setMaximum(999)
|
||||||
@ -230,8 +228,7 @@ class Ui_AmendThemeDialog(object):
|
|||||||
self.FontMainLineSpacingSpinBox)
|
self.FontMainLineSpacingSpinBox)
|
||||||
self.FontMainLinesPageLabel = QtGui.QLabel(self.FontMainGroupBox)
|
self.FontMainLinesPageLabel = QtGui.QLabel(self.FontMainGroupBox)
|
||||||
self.FontMainLinesPageLabel.setObjectName(u'FontMainLinesPageLabel')
|
self.FontMainLinesPageLabel.setObjectName(u'FontMainLinesPageLabel')
|
||||||
self.MainFontLayout.setWidget(6, QtGui.QFormLayout.LabelRole,
|
self.MainFontLayout.addRow(self.FontMainLinesPageLabel)
|
||||||
self.FontMainLinesPageLabel)
|
|
||||||
spacerItem1 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum,
|
spacerItem1 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum,
|
||||||
QtGui.QSizePolicy.Expanding)
|
QtGui.QSizePolicy.Expanding)
|
||||||
self.MainLeftLayout.addItem(spacerItem1)
|
self.MainLeftLayout.addItem(spacerItem1)
|
||||||
@ -275,13 +272,9 @@ class Ui_AmendThemeDialog(object):
|
|||||||
self.MainLocationLayout.setWidget(4, QtGui.QFormLayout.LabelRole,
|
self.MainLocationLayout.setWidget(4, QtGui.QFormLayout.LabelRole,
|
||||||
self.FontMainHeightLabel)
|
self.FontMainHeightLabel)
|
||||||
self.FontMainXSpinBox = QtGui.QSpinBox(self.MainLocationGroupBox)
|
self.FontMainXSpinBox = QtGui.QSpinBox(self.MainLocationGroupBox)
|
||||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum,
|
defaultSizePolicy.setHeightForWidth(
|
||||||
QtGui.QSizePolicy.Fixed)
|
|
||||||
sizePolicy.setHorizontalStretch(0)
|
|
||||||
sizePolicy.setVerticalStretch(0)
|
|
||||||
sizePolicy.setHeightForWidth(
|
|
||||||
self.FontMainXSpinBox.sizePolicy().hasHeightForWidth())
|
self.FontMainXSpinBox.sizePolicy().hasHeightForWidth())
|
||||||
self.FontMainXSpinBox.setSizePolicy(sizePolicy)
|
self.FontMainXSpinBox.setSizePolicy(defaultSizePolicy)
|
||||||
self.FontMainXSpinBox.setMinimumSize(QtCore.QSize(78, 0))
|
self.FontMainXSpinBox.setMinimumSize(QtCore.QSize(78, 0))
|
||||||
self.FontMainXSpinBox.setProperty(u'value', QtCore.QVariant(0))
|
self.FontMainXSpinBox.setProperty(u'value', QtCore.QVariant(0))
|
||||||
self.FontMainXSpinBox.setMaximum(9999)
|
self.FontMainXSpinBox.setMaximum(9999)
|
||||||
@ -289,39 +282,27 @@ class Ui_AmendThemeDialog(object):
|
|||||||
self.MainLocationLayout.setWidget(1, QtGui.QFormLayout.FieldRole,
|
self.MainLocationLayout.setWidget(1, QtGui.QFormLayout.FieldRole,
|
||||||
self.FontMainXSpinBox)
|
self.FontMainXSpinBox)
|
||||||
self.FontMainYSpinBox = QtGui.QSpinBox(self.MainLocationGroupBox)
|
self.FontMainYSpinBox = QtGui.QSpinBox(self.MainLocationGroupBox)
|
||||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum,
|
defaultSizePolicy.setHeightForWidth(
|
||||||
QtGui.QSizePolicy.Fixed)
|
|
||||||
sizePolicy.setHorizontalStretch(0)
|
|
||||||
sizePolicy.setVerticalStretch(0)
|
|
||||||
sizePolicy.setHeightForWidth(
|
|
||||||
self.FontMainYSpinBox.sizePolicy().hasHeightForWidth())
|
self.FontMainYSpinBox.sizePolicy().hasHeightForWidth())
|
||||||
self.FontMainYSpinBox.setSizePolicy(sizePolicy)
|
self.FontMainYSpinBox.setSizePolicy(defaultSizePolicy)
|
||||||
self.FontMainYSpinBox.setMinimumSize(QtCore.QSize(78, 0))
|
self.FontMainYSpinBox.setMinimumSize(QtCore.QSize(78, 0))
|
||||||
self.FontMainYSpinBox.setMaximum(9999)
|
self.FontMainYSpinBox.setMaximum(9999)
|
||||||
self.FontMainYSpinBox.setObjectName(u'FontMainYSpinBox')
|
self.FontMainYSpinBox.setObjectName(u'FontMainYSpinBox')
|
||||||
self.MainLocationLayout.setWidget(2, QtGui.QFormLayout.FieldRole,
|
self.MainLocationLayout.setWidget(2, QtGui.QFormLayout.FieldRole,
|
||||||
self.FontMainYSpinBox)
|
self.FontMainYSpinBox)
|
||||||
self.FontMainWidthSpinBox = QtGui.QSpinBox(self.MainLocationGroupBox)
|
self.FontMainWidthSpinBox = QtGui.QSpinBox(self.MainLocationGroupBox)
|
||||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum,
|
defaultSizePolicy.setHeightForWidth(
|
||||||
QtGui.QSizePolicy.Fixed)
|
|
||||||
sizePolicy.setHorizontalStretch(0)
|
|
||||||
sizePolicy.setVerticalStretch(0)
|
|
||||||
sizePolicy.setHeightForWidth(
|
|
||||||
self.FontMainWidthSpinBox.sizePolicy().hasHeightForWidth())
|
self.FontMainWidthSpinBox.sizePolicy().hasHeightForWidth())
|
||||||
self.FontMainWidthSpinBox.setSizePolicy(sizePolicy)
|
self.FontMainWidthSpinBox.setSizePolicy(defaultSizePolicy)
|
||||||
self.FontMainWidthSpinBox.setMinimumSize(QtCore.QSize(78, 0))
|
self.FontMainWidthSpinBox.setMinimumSize(QtCore.QSize(78, 0))
|
||||||
self.FontMainWidthSpinBox.setMaximum(9999)
|
self.FontMainWidthSpinBox.setMaximum(9999)
|
||||||
self.FontMainWidthSpinBox.setObjectName(u'FontMainWidthSpinBox')
|
self.FontMainWidthSpinBox.setObjectName(u'FontMainWidthSpinBox')
|
||||||
self.MainLocationLayout.setWidget(3, QtGui.QFormLayout.FieldRole,
|
self.MainLocationLayout.setWidget(3, QtGui.QFormLayout.FieldRole,
|
||||||
self.FontMainWidthSpinBox)
|
self.FontMainWidthSpinBox)
|
||||||
self.FontMainHeightSpinBox = QtGui.QSpinBox(self.MainLocationGroupBox)
|
self.FontMainHeightSpinBox = QtGui.QSpinBox(self.MainLocationGroupBox)
|
||||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum,
|
defaultSizePolicy.setHeightForWidth(
|
||||||
QtGui.QSizePolicy.Fixed)
|
|
||||||
sizePolicy.setHorizontalStretch(0)
|
|
||||||
sizePolicy.setVerticalStretch(0)
|
|
||||||
sizePolicy.setHeightForWidth(
|
|
||||||
self.FontMainHeightSpinBox.sizePolicy().hasHeightForWidth())
|
self.FontMainHeightSpinBox.sizePolicy().hasHeightForWidth())
|
||||||
self.FontMainHeightSpinBox.setSizePolicy(sizePolicy)
|
self.FontMainHeightSpinBox.setSizePolicy(defaultSizePolicy)
|
||||||
self.FontMainHeightSpinBox.setMinimumSize(QtCore.QSize(78, 0))
|
self.FontMainHeightSpinBox.setMinimumSize(QtCore.QSize(78, 0))
|
||||||
self.FontMainHeightSpinBox.setMaximum(9999)
|
self.FontMainHeightSpinBox.setMaximum(9999)
|
||||||
self.FontMainHeightSpinBox.setObjectName(u'FontMainHeightSpinBox')
|
self.FontMainHeightSpinBox.setObjectName(u'FontMainHeightSpinBox')
|
||||||
@ -378,13 +359,9 @@ class Ui_AmendThemeDialog(object):
|
|||||||
self.FooterFontLayout.setWidget(2, QtGui.QFormLayout.LabelRole,
|
self.FooterFontLayout.setWidget(2, QtGui.QFormLayout.LabelRole,
|
||||||
self.FontFooterSizeLabel)
|
self.FontFooterSizeLabel)
|
||||||
self.FontFooterSizeSpinBox = QtGui.QSpinBox(self.FooterFontGroupBox)
|
self.FontFooterSizeSpinBox = QtGui.QSpinBox(self.FooterFontGroupBox)
|
||||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum,
|
defaultSizePolicy.setHeightForWidth(
|
||||||
QtGui.QSizePolicy.Fixed)
|
|
||||||
sizePolicy.setHorizontalStretch(0)
|
|
||||||
sizePolicy.setVerticalStretch(0)
|
|
||||||
sizePolicy.setHeightForWidth(
|
|
||||||
self.FontFooterSizeSpinBox.sizePolicy().hasHeightForWidth())
|
self.FontFooterSizeSpinBox.sizePolicy().hasHeightForWidth())
|
||||||
self.FontFooterSizeSpinBox.setSizePolicy(sizePolicy)
|
self.FontFooterSizeSpinBox.setSizePolicy(defaultSizePolicy)
|
||||||
self.FontFooterSizeSpinBox.setMinimumSize(QtCore.QSize(70, 0))
|
self.FontFooterSizeSpinBox.setMinimumSize(QtCore.QSize(70, 0))
|
||||||
self.FontFooterSizeSpinBox.setProperty(u'value', QtCore.QVariant(10))
|
self.FontFooterSizeSpinBox.setProperty(u'value', QtCore.QVariant(10))
|
||||||
self.FontFooterSizeSpinBox.setMaximum(999)
|
self.FontFooterSizeSpinBox.setMaximum(999)
|
||||||
@ -453,13 +430,9 @@ class Ui_AmendThemeDialog(object):
|
|||||||
self.LocationFooterLayout.setWidget(4, QtGui.QFormLayout.LabelRole,
|
self.LocationFooterLayout.setWidget(4, QtGui.QFormLayout.LabelRole,
|
||||||
self.FontFooterHeightLabel)
|
self.FontFooterHeightLabel)
|
||||||
self.FontFooterXSpinBox = QtGui.QSpinBox(self.LocationFooterGroupBox)
|
self.FontFooterXSpinBox = QtGui.QSpinBox(self.LocationFooterGroupBox)
|
||||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum,
|
defaultSizePolicy.setHeightForWidth(
|
||||||
QtGui.QSizePolicy.Fixed)
|
|
||||||
sizePolicy.setHorizontalStretch(0)
|
|
||||||
sizePolicy.setVerticalStretch(0)
|
|
||||||
sizePolicy.setHeightForWidth(
|
|
||||||
self.FontFooterXSpinBox.sizePolicy().hasHeightForWidth())
|
self.FontFooterXSpinBox.sizePolicy().hasHeightForWidth())
|
||||||
self.FontFooterXSpinBox.setSizePolicy(sizePolicy)
|
self.FontFooterXSpinBox.setSizePolicy(defaultSizePolicy)
|
||||||
self.FontFooterXSpinBox.setMinimumSize(QtCore.QSize(78, 0))
|
self.FontFooterXSpinBox.setMinimumSize(QtCore.QSize(78, 0))
|
||||||
self.FontFooterXSpinBox.setProperty(u'value', QtCore.QVariant(0))
|
self.FontFooterXSpinBox.setProperty(u'value', QtCore.QVariant(0))
|
||||||
self.FontFooterXSpinBox.setMaximum(9999)
|
self.FontFooterXSpinBox.setMaximum(9999)
|
||||||
@ -467,13 +440,9 @@ class Ui_AmendThemeDialog(object):
|
|||||||
self.LocationFooterLayout.setWidget(1, QtGui.QFormLayout.FieldRole,
|
self.LocationFooterLayout.setWidget(1, QtGui.QFormLayout.FieldRole,
|
||||||
self.FontFooterXSpinBox)
|
self.FontFooterXSpinBox)
|
||||||
self.FontFooterYSpinBox = QtGui.QSpinBox(self.LocationFooterGroupBox)
|
self.FontFooterYSpinBox = QtGui.QSpinBox(self.LocationFooterGroupBox)
|
||||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum,
|
defaultSizePolicy.setHeightForWidth(
|
||||||
QtGui.QSizePolicy.Fixed)
|
self.FontFooterXSpinBox.sizePolicy().hasHeightForWidth())
|
||||||
sizePolicy.setHorizontalStretch(0)
|
self.FontFooterYSpinBox.setSizePolicy(defaultSizePolicy)
|
||||||
sizePolicy.setVerticalStretch(0)
|
|
||||||
sizePolicy.setHeightForWidth(
|
|
||||||
self.FontFooterYSpinBox.sizePolicy().hasHeightForWidth())
|
|
||||||
self.FontFooterYSpinBox.setSizePolicy(sizePolicy)
|
|
||||||
self.FontFooterYSpinBox.setMinimumSize(QtCore.QSize(78, 0))
|
self.FontFooterYSpinBox.setMinimumSize(QtCore.QSize(78, 0))
|
||||||
self.FontFooterYSpinBox.setProperty(u'value', QtCore.QVariant(0))
|
self.FontFooterYSpinBox.setProperty(u'value', QtCore.QVariant(0))
|
||||||
self.FontFooterYSpinBox.setMaximum(9999)
|
self.FontFooterYSpinBox.setMaximum(9999)
|
||||||
@ -901,4 +870,3 @@ class Ui_AmendThemeDialog(object):
|
|||||||
self.ThemeTabWidget.indexOf(self.OtherOptionsTab),
|
self.ThemeTabWidget.indexOf(self.OtherOptionsTab),
|
||||||
translate('AmendThemeForm', '&Other Options'))
|
translate('AmendThemeForm', '&Other Options'))
|
||||||
self.PreviewGroupBox.setTitle(translate('AmendThemeForm', 'Preview'))
|
self.PreviewGroupBox.setTitle(translate('AmendThemeForm', 'Preview'))
|
||||||
|
|
||||||
|
@ -242,4 +242,3 @@ class DisplayTab(SettingsTab):
|
|||||||
if self.amend_display_start != self.amend_display:
|
if self.amend_display_start != self.amend_display:
|
||||||
self.amend_display_start = self.amend_display
|
self.amend_display_start = self.amend_display
|
||||||
Receiver.send_message(u'config_screen_changed')
|
Receiver.send_message(u'config_screen_changed')
|
||||||
|
|
||||||
|
@ -32,13 +32,16 @@ class GeneralTab(SettingsTab):
|
|||||||
GeneralTab is the general settings tab in the settings dialog.
|
GeneralTab is the general settings tab in the settings dialog.
|
||||||
"""
|
"""
|
||||||
def __init__(self, screens):
|
def __init__(self, screens):
|
||||||
|
"""
|
||||||
|
Initialise the general settings tab
|
||||||
|
"""
|
||||||
self.screens = screens
|
self.screens = screens
|
||||||
|
self.MonitorNumber = 0
|
||||||
SettingsTab.__init__(self, u'General')
|
SettingsTab.__init__(self, u'General')
|
||||||
|
|
||||||
def preLoad(self):
|
def preLoad(self):
|
||||||
"""
|
"""
|
||||||
Set up the display screen and set correct screen
|
Set up the display screen and set correct screen values.
|
||||||
values.
|
|
||||||
If not set before default to last screen.
|
If not set before default to last screen.
|
||||||
"""
|
"""
|
||||||
settings = QtCore.QSettings()
|
settings = QtCore.QSettings()
|
||||||
@ -47,12 +50,14 @@ class GeneralTab(SettingsTab):
|
|||||||
QtCore.QVariant(self.screens.display_count - 1)).toInt()[0]
|
QtCore.QVariant(self.screens.display_count - 1)).toInt()[0]
|
||||||
self.screens.set_current_display(self.MonitorNumber)
|
self.screens.set_current_display(self.MonitorNumber)
|
||||||
self.screens.monitor_number = self.MonitorNumber
|
self.screens.monitor_number = self.MonitorNumber
|
||||||
self.DisplayOnMonitor = settings.value(
|
self.screens.display = settings.value(
|
||||||
u'display on monitor', QtCore.QVariant(True)).toBool()
|
u'display on monitor', QtCore.QVariant(True)).toBool()
|
||||||
self.screens.display = self.DisplayOnMonitor
|
|
||||||
settings.endGroup()
|
settings.endGroup()
|
||||||
|
|
||||||
def setupUi(self):
|
def setupUi(self):
|
||||||
|
"""
|
||||||
|
Create the user interface for the general settings tab
|
||||||
|
"""
|
||||||
self.setObjectName(u'GeneralTab')
|
self.setObjectName(u'GeneralTab')
|
||||||
self.tabTitleVisible = translate('GeneralTab', 'General')
|
self.tabTitleVisible = translate('GeneralTab', 'General')
|
||||||
self.GeneralLayout = QtGui.QHBoxLayout(self)
|
self.GeneralLayout = QtGui.QHBoxLayout(self)
|
||||||
@ -152,31 +157,11 @@ class GeneralTab(SettingsTab):
|
|||||||
QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
|
QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
|
||||||
self.GeneralRightLayout.addItem(self.GeneralRightSpacer)
|
self.GeneralRightLayout.addItem(self.GeneralRightSpacer)
|
||||||
self.GeneralLayout.addWidget(self.GeneralRightWidget)
|
self.GeneralLayout.addWidget(self.GeneralRightWidget)
|
||||||
QtCore.QObject.connect(self.MonitorComboBox,
|
|
||||||
QtCore.SIGNAL(u'activated(int)'), self.onMonitorComboBoxChanged)
|
|
||||||
QtCore.QObject.connect(self.DisplayOnMonitorCheck,
|
|
||||||
QtCore.SIGNAL(u'stateChanged(int)'),
|
|
||||||
self.onDisplayOnMonitorCheckChanged)
|
|
||||||
QtCore.QObject.connect(self.WarningCheckBox,
|
|
||||||
QtCore.SIGNAL(u'stateChanged(int)'), self.onWarningCheckBoxChanged)
|
|
||||||
QtCore.QObject.connect(self.AutoOpenCheckBox,
|
|
||||||
QtCore.SIGNAL(u'stateChanged(int)'), self.onAutoOpenCheckBoxChanged)
|
|
||||||
QtCore.QObject.connect(self.ShowSplashCheckBox,
|
|
||||||
QtCore.SIGNAL(u'stateChanged(int)'),
|
|
||||||
self.onShowSplashCheckBoxChanged)
|
|
||||||
QtCore.QObject.connect(self.SaveCheckServiceCheckBox,
|
|
||||||
QtCore.SIGNAL(u'stateChanged(int)'),
|
|
||||||
self.onSaveCheckServiceCheckBox)
|
|
||||||
QtCore.QObject.connect(self.AutoPreviewCheckBox,
|
|
||||||
QtCore.SIGNAL(u'stateChanged(int)'), self.onAutoPreviewCheckBox)
|
|
||||||
QtCore.QObject.connect(self.NumberEdit,
|
|
||||||
QtCore.SIGNAL(u'editingFinished()'), self.onNumberEditLostFocus)
|
|
||||||
QtCore.QObject.connect(self.UsernameEdit,
|
|
||||||
QtCore.SIGNAL(u'editingFinished()'), self.onUsernameEditLostFocus)
|
|
||||||
QtCore.QObject.connect(self.PasswordEdit,
|
|
||||||
QtCore.SIGNAL(u'editingFinished()'), self.onPasswordEditLostFocus)
|
|
||||||
|
|
||||||
def retranslateUi(self):
|
def retranslateUi(self):
|
||||||
|
"""
|
||||||
|
Translate the general settings tab to the currently selected language
|
||||||
|
"""
|
||||||
self.MonitorGroupBox.setTitle(translate('GeneralTab', 'Monitors'))
|
self.MonitorGroupBox.setTitle(translate('GeneralTab', 'Monitors'))
|
||||||
self.MonitorLabel.setText(
|
self.MonitorLabel.setText(
|
||||||
translate('GeneralTab', 'Select monitor for output display:'))
|
translate('GeneralTab', 'Select monitor for output display:'))
|
||||||
@ -204,37 +189,10 @@ class GeneralTab(SettingsTab):
|
|||||||
self.PasswordLabel.setText(
|
self.PasswordLabel.setText(
|
||||||
translate('GeneralTab', 'SongSelect Password:'))
|
translate('GeneralTab', 'SongSelect Password:'))
|
||||||
|
|
||||||
def onMonitorComboBoxChanged(self):
|
|
||||||
self.MonitorNumber = self.MonitorComboBox.currentIndex()
|
|
||||||
|
|
||||||
def onDisplayOnMonitorCheckChanged(self, value):
|
|
||||||
self.DisplayOnMonitor = (value == QtCore.Qt.Checked)
|
|
||||||
|
|
||||||
def onAutoOpenCheckBoxChanged(self, value):
|
|
||||||
self.AutoOpen = (value == QtCore.Qt.Checked)
|
|
||||||
|
|
||||||
def onShowSplashCheckBoxChanged(self, value):
|
|
||||||
self.ShowSplash = (value == QtCore.Qt.Checked)
|
|
||||||
|
|
||||||
def onWarningCheckBoxChanged(self, value):
|
|
||||||
self.Warning = (value == QtCore.Qt.Checked)
|
|
||||||
|
|
||||||
def onSaveCheckServiceCheckBox(self, value):
|
|
||||||
self.PromptSaveService = (value == QtCore.Qt.Checked)
|
|
||||||
|
|
||||||
def onAutoPreviewCheckBox(self, value):
|
|
||||||
self.AutoPreview = (value == QtCore.Qt.Checked)
|
|
||||||
|
|
||||||
def onNumberEditLostFocus(self):
|
|
||||||
self.CCLINumber = self.NumberEdit.displayText()
|
|
||||||
|
|
||||||
def onUsernameEditLostFocus(self):
|
|
||||||
self.Username = self.UsernameEdit.displayText()
|
|
||||||
|
|
||||||
def onPasswordEditLostFocus(self):
|
|
||||||
self.Password = self.PasswordEdit.displayText()
|
|
||||||
|
|
||||||
def load(self):
|
def load(self):
|
||||||
|
"""
|
||||||
|
Load the settings to populate the form
|
||||||
|
"""
|
||||||
settings = QtCore.QSettings()
|
settings = QtCore.QSettings()
|
||||||
settings.beginGroup(self.settingsSection)
|
settings.beginGroup(self.settingsSection)
|
||||||
for screen in self.screens.screen_list:
|
for screen in self.screens.screen_list:
|
||||||
@ -244,55 +202,54 @@ class GeneralTab(SettingsTab):
|
|||||||
screen_name = u'%s (%s)' % (screen_name,
|
screen_name = u'%s (%s)' % (screen_name,
|
||||||
translate('GeneralTab', 'primary'))
|
translate('GeneralTab', 'primary'))
|
||||||
self.MonitorComboBox.addItem(screen_name)
|
self.MonitorComboBox.addItem(screen_name)
|
||||||
# Get the configs
|
self.NumberEdit.setText(unicode(settings.value(
|
||||||
self.Warning = settings.value(
|
u'ccli number', QtCore.QVariant(u'')).toString()))
|
||||||
u'blank warning', QtCore.QVariant(False)).toBool()
|
self.UsernameEdit.setText(unicode(settings.value(
|
||||||
self.AutoOpen = settings.value(
|
u'songselect username', QtCore.QVariant(u'')).toString()))
|
||||||
u'auto open', QtCore.QVariant(False)).toBool()
|
self.PasswordEdit.setText(unicode(settings.value(
|
||||||
self.ShowSplash = settings.value(
|
u'songselect password', QtCore.QVariant(u'')).toString()))
|
||||||
u'show splash', QtCore.QVariant(True)).toBool()
|
self.SaveCheckServiceCheckBox.setChecked(settings.value(u'save prompt',
|
||||||
self.PromptSaveService = settings.value(
|
QtCore.QVariant(False)).toBool())
|
||||||
u'save prompt', QtCore.QVariant(False)).toBool()
|
|
||||||
self.AutoPreview = settings.value(
|
|
||||||
u'auto preview', QtCore.QVariant(False)).toBool()
|
|
||||||
self.CCLINumber = unicode(settings.value(
|
|
||||||
u'ccli number', QtCore.QVariant(u'')).toString())
|
|
||||||
self.Username = unicode(settings.value(
|
|
||||||
u'songselect username', QtCore.QVariant(u'')).toString())
|
|
||||||
self.Password = unicode(settings.value(
|
|
||||||
u'songselect password', QtCore.QVariant(u'')).toString())
|
|
||||||
settings.endGroup()
|
|
||||||
self.SaveCheckServiceCheckBox.setChecked(self.PromptSaveService)
|
|
||||||
# Set a few things up
|
|
||||||
self.MonitorComboBox.setCurrentIndex(self.MonitorNumber)
|
self.MonitorComboBox.setCurrentIndex(self.MonitorNumber)
|
||||||
self.DisplayOnMonitorCheck.setChecked(self.DisplayOnMonitor)
|
self.DisplayOnMonitorCheck.setChecked(self.screens.display)
|
||||||
self.WarningCheckBox.setChecked(self.Warning)
|
self.WarningCheckBox.setChecked(settings.value(u'blank warning',
|
||||||
self.AutoOpenCheckBox.setChecked(self.AutoOpen)
|
QtCore.QVariant(False)).toBool())
|
||||||
self.ShowSplashCheckBox.setChecked(self.ShowSplash)
|
self.AutoOpenCheckBox.setChecked(settings.value(u'auto open',
|
||||||
self.AutoPreviewCheckBox.setChecked(self.AutoPreview)
|
QtCore.QVariant(False)).toBool())
|
||||||
self.NumberEdit.setText(self.CCLINumber)
|
self.ShowSplashCheckBox.setChecked(settings.value(u'show splash',
|
||||||
self.UsernameEdit.setText(self.Username)
|
QtCore.QVariant(True)).toBool())
|
||||||
self.PasswordEdit.setText(self.Password)
|
self.AutoPreviewCheckBox.setChecked(settings.value(u'auto preview',
|
||||||
|
QtCore.QVariant(False)).toBool())
|
||||||
|
settings.endGroup()
|
||||||
|
|
||||||
def save(self):
|
def save(self):
|
||||||
|
"""
|
||||||
|
Save the settings from the form
|
||||||
|
"""
|
||||||
|
self.MonitorNumber = self.MonitorComboBox.currentIndex()
|
||||||
settings = QtCore.QSettings()
|
settings = QtCore.QSettings()
|
||||||
settings.beginGroup(self.settingsSection)
|
settings.beginGroup(self.settingsSection)
|
||||||
settings.setValue(u'monitor', QtCore.QVariant(self.MonitorNumber))
|
settings.setValue(u'monitor', QtCore.QVariant(self.MonitorNumber))
|
||||||
settings.setValue(u'display on monitor',
|
settings.setValue(u'display on monitor',
|
||||||
QtCore.QVariant(self.DisplayOnMonitor))
|
QtCore.QVariant(self.DisplayOnMonitorCheck.isChecked()))
|
||||||
settings.setValue(u'blank warning', QtCore.QVariant(self.Warning))
|
settings.setValue(u'blank warning',
|
||||||
settings.setValue(u'auto open', QtCore.QVariant(self.AutoOpen))
|
QtCore.QVariant(self.WarningCheckBox.isChecked()))
|
||||||
settings.setValue(u'show splash', QtCore.QVariant(self.ShowSplash))
|
settings.setValue(u'auto open',
|
||||||
|
QtCore.QVariant(self.AutoOpenCheckBox.isChecked()))
|
||||||
|
settings.setValue(u'show splash',
|
||||||
|
QtCore.QVariant(self.ShowSplashCheckBox.isChecked()))
|
||||||
settings.setValue(u'save prompt',
|
settings.setValue(u'save prompt',
|
||||||
QtCore.QVariant(self.PromptSaveService))
|
QtCore.QVariant(self.SaveCheckServiceCheckBox.isChecked()))
|
||||||
settings.setValue(u'auto preview', QtCore.QVariant(self.AutoPreview))
|
settings.setValue(u'auto preview',
|
||||||
settings.setValue(u'ccli number', QtCore.QVariant(self.CCLINumber))
|
QtCore.QVariant(self.AutoPreviewCheckBox.isChecked()))
|
||||||
|
settings.setValue(u'ccli number',
|
||||||
|
QtCore.QVariant(self.NumberEdit.displayText()))
|
||||||
settings.setValue(u'songselect username',
|
settings.setValue(u'songselect username',
|
||||||
QtCore.QVariant(self.Username))
|
QtCore.QVariant(self.UsernameEdit.displayText()))
|
||||||
settings.setValue(u'songselect password',
|
settings.setValue(u'songselect password',
|
||||||
QtCore.QVariant(self.Password))
|
QtCore.QVariant(self.PasswordEdit.displayText()))
|
||||||
settings.endGroup()
|
settings.endGroup()
|
||||||
self.screens.display = self.DisplayOnMonitor
|
self.screens.display = self.DisplayOnMonitorCheck.isChecked()
|
||||||
#Monitor Number has changed.
|
#Monitor Number has changed.
|
||||||
if self.screens.monitor_number != self.MonitorNumber:
|
if self.screens.monitor_number != self.MonitorNumber:
|
||||||
self.screens.monitor_number = self.MonitorNumber
|
self.screens.monitor_number = self.MonitorNumber
|
||||||
|
@ -25,37 +25,37 @@
|
|||||||
|
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
|
import time
|
||||||
|
|
||||||
from PyQt4 import QtCore, QtGui, QtWebKit
|
from PyQt4 import QtCore, QtGui, QtWebKit
|
||||||
from PyQt4.phonon import Phonon
|
from PyQt4.phonon import Phonon
|
||||||
|
|
||||||
from openlp.core.lib import Receiver, resize_image
|
from openlp.core.lib import Receiver, resize_image
|
||||||
from openlp.core.ui import HideMode
|
from openlp.core.ui import HideMode
|
||||||
from openlp.core.utils import AppLocation
|
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
HTMLIMAGE = """<html>
|
|
||||||
<body>
|
|
||||||
<img src=\"file://%s\" alt\"Hello\">
|
|
||||||
</body></html>
|
|
||||||
"""
|
|
||||||
|
|
||||||
#http://www.steveheffernan.com/html5-video-player/demo-video-player.html
|
#http://www.steveheffernan.com/html5-video-player/demo-video-player.html
|
||||||
HTMLVIDEO = u"""<html>
|
HTMLVIDEO = u"""<html>
|
||||||
<script type="text/javascript" charset="utf-8">
|
<head>
|
||||||
|
<style>
|
||||||
|
*{
|
||||||
|
margin: 0;
|
||||||
|
padding:0
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<script type="text/javascript" charset="utf-8">
|
||||||
var video;
|
var video;
|
||||||
var bodyLoaded = function(){
|
var bodyLoaded = function(){
|
||||||
video = document.getElementById("video");
|
video = document.getElementById("video");
|
||||||
video.volume = 0;
|
video.volume = 0;
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<body id=\"body\" onload=\"bodyLoaded();>\"
|
</head>
|
||||||
<video id=\"video\" src=\"%s\"
|
<body id="body" onload="bodyLoaded();">
|
||||||
autoplay loop width=%s height=%s autobuffer=\"autobuffer\" preload >
|
<video id="video" src="%s" autoplay="autoplay" loop="loop"
|
||||||
your browser does not support the video tag
|
width="%s" height="%s" autobuffer="autobuffer" preload="preload" />
|
||||||
</video>
|
</body></html>
|
||||||
</body></html>
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
class DisplayManager(QtGui.QWidget):
|
class DisplayManager(QtGui.QWidget):
|
||||||
@ -104,11 +104,17 @@ class DisplayManager(QtGui.QWidget):
|
|||||||
"""
|
"""
|
||||||
self.mainDisplay.addAlert(alertMessage, location)
|
self.mainDisplay.addAlert(alertMessage, location)
|
||||||
|
|
||||||
def displayImage(self, path):
|
def displayImageWithText(self, frame):
|
||||||
"""
|
"""
|
||||||
Handles the addition of a background Image to the displays
|
Handles the addition of a background Image to the displays
|
||||||
"""
|
"""
|
||||||
self.mainDisplay.displayImage(path)
|
self.mainDisplay.addImageWithText(frame)
|
||||||
|
|
||||||
|
def displayImage(self, frame):
|
||||||
|
"""
|
||||||
|
Handles the addition of a background Image to the displays
|
||||||
|
"""
|
||||||
|
self.mainDisplay.displayImage(frame)
|
||||||
|
|
||||||
def displayVideo(self, path):
|
def displayVideo(self, path):
|
||||||
"""
|
"""
|
||||||
@ -212,6 +218,7 @@ class MainDisplay(DisplayWidget):
|
|||||||
pass
|
pass
|
||||||
self.screens = screens
|
self.screens = screens
|
||||||
self.setupScene()
|
self.setupScene()
|
||||||
|
self.setupVideo()
|
||||||
self.setupImage()
|
self.setupImage()
|
||||||
self.setupText()
|
self.setupText()
|
||||||
self.setupAlert()
|
self.setupAlert()
|
||||||
@ -248,7 +255,7 @@ class MainDisplay(DisplayWidget):
|
|||||||
(self.screen[u'size'].width() - splash_image.width()) / 2,
|
(self.screen[u'size'].width() - splash_image.width()) / 2,
|
||||||
(self.screen[u'size'].height() - splash_image.height()) / 2,
|
(self.screen[u'size'].height() - splash_image.height()) / 2,
|
||||||
splash_image)
|
splash_image)
|
||||||
#self.display_image.setPixmap(QtGui.QPixmap.fromImage(self.InitialFrame))
|
self.displayImage(self.InitialFrame)
|
||||||
self.repaint()
|
self.repaint()
|
||||||
#Build a Black screen
|
#Build a Black screen
|
||||||
painter = QtGui.QPainter()
|
painter = QtGui.QPainter()
|
||||||
@ -262,7 +269,7 @@ class MainDisplay(DisplayWidget):
|
|||||||
self.transparent = QtGui.QPixmap(
|
self.transparent = QtGui.QPixmap(
|
||||||
self.screen[u'size'].width(), self.screen[u'size'].height())
|
self.screen[u'size'].width(), self.screen[u'size'].height())
|
||||||
self.transparent.fill(QtCore.Qt.transparent)
|
self.transparent.fill(QtCore.Qt.transparent)
|
||||||
# self.display_text.setPixmap(self.transparent)
|
# self.displayText.setPixmap(self.transparent)
|
||||||
#self.frameView(self.transparent)
|
#self.frameView(self.transparent)
|
||||||
# To display or not to display?
|
# To display or not to display?
|
||||||
if not self.screen[u'primary']:
|
if not self.screen[u'primary']:
|
||||||
@ -277,25 +284,30 @@ class MainDisplay(DisplayWidget):
|
|||||||
self.scene.setSceneRect(0,0,self.size().width(), self.size().height())
|
self.scene.setSceneRect(0,0,self.size().width(), self.size().height())
|
||||||
self.setScene(self.scene)
|
self.setScene(self.scene)
|
||||||
|
|
||||||
def setupImage(self):
|
def setupVideo(self):
|
||||||
self.webView = QtWebKit.QWebView()
|
self.webView = QtWebKit.QWebView()
|
||||||
self.page = self.webView.page()
|
self.page = self.webView.page()
|
||||||
self.imageDisplay = self.page.mainFrame()
|
self.videoDisplay = self.page.mainFrame()
|
||||||
self.imageDisplay.setScrollBarPolicy(QtCore.Qt.Vertical, QtCore.Qt.ScrollBarAlwaysOff)
|
self.videoDisplay.setScrollBarPolicy(QtCore.Qt.Vertical, QtCore.Qt.ScrollBarAlwaysOff)
|
||||||
self.imageDisplay.setScrollBarPolicy(QtCore.Qt.Horizontal, QtCore.Qt.ScrollBarAlwaysOff)
|
self.videoDisplay.setScrollBarPolicy(QtCore.Qt.Horizontal, QtCore.Qt.ScrollBarAlwaysOff)
|
||||||
self.proxy = QtGui.QGraphicsProxyWidget()
|
self.proxy = QtGui.QGraphicsProxyWidget()
|
||||||
self.proxy.setWidget(self.webView)
|
self.proxy.setWidget(self.webView)
|
||||||
self.proxy.setWindowFlags(QtCore.Qt.Window | QtCore.Qt.FramelessWindowHint)
|
self.proxy.setWindowFlags(QtCore.Qt.Window | QtCore.Qt.FramelessWindowHint)
|
||||||
self.proxy.setZValue(2)
|
self.proxy.setZValue(1)
|
||||||
self.scene.addItem(self.proxy)
|
self.scene.addItem(self.proxy)
|
||||||
|
|
||||||
|
def setupImage(self):
|
||||||
|
self.imageDisplay = QtGui.QGraphicsPixmapItem()
|
||||||
|
self.imageDisplay.setZValue(2)
|
||||||
|
self.scene.addItem(self.imageDisplay)
|
||||||
|
|
||||||
def setupText(self):
|
def setupText(self):
|
||||||
#self.display_text = QtGui.QGraphicsTextItem()
|
#self.displayText = QtGui.QGraphicsTextItem()
|
||||||
self.display_text = QtGui.QGraphicsPixmapItem()
|
self.displayText = QtGui.QGraphicsPixmapItem()
|
||||||
#self.display_text.setPos(0,0)
|
#self.displayText.setPos(0,0)
|
||||||
#self.display_text.setTextWidth(self.size().width())
|
#self.displayText.setTextWidth(self.size().width())
|
||||||
self.display_text.setZValue(4)
|
self.displayText.setZValue(4)
|
||||||
self.scene.addItem(self.display_text)
|
self.scene.addItem(self.displayText)
|
||||||
|
|
||||||
def setupAlert(self):
|
def setupAlert(self):
|
||||||
self.alertText = QtGui.QGraphicsTextItem()
|
self.alertText = QtGui.QGraphicsTextItem()
|
||||||
@ -304,9 +316,9 @@ class MainDisplay(DisplayWidget):
|
|||||||
self.scene.addItem(self.alertText)
|
self.scene.addItem(self.alertText)
|
||||||
|
|
||||||
def setupBlank(self):
|
def setupBlank(self):
|
||||||
self.display_blank = QtGui.QGraphicsPixmapItem()
|
self.displayBlank = QtGui.QGraphicsPixmapItem()
|
||||||
self.display_blank.setZValue(10)
|
self.displayBlank.setZValue(10)
|
||||||
self.scene.addItem(self.display_blank)
|
self.scene.addItem(self.displayBlank)
|
||||||
|
|
||||||
def resetDisplay(self):
|
def resetDisplay(self):
|
||||||
log.debug(u'resetDisplay')
|
log.debug(u'resetDisplay')
|
||||||
@ -328,19 +340,19 @@ class MainDisplay(DisplayWidget):
|
|||||||
Store the images so they can be replaced when required
|
Store the images so they can be replaced when required
|
||||||
"""
|
"""
|
||||||
log.debug(u'hideDisplay mode = %d', mode)
|
log.debug(u'hideDisplay mode = %d', mode)
|
||||||
#self.display_text.setPixmap(self.transparent)
|
#self.displayText.setPixmap(self.transparent)
|
||||||
if mode == HideMode.Screen:
|
if mode == HideMode.Screen:
|
||||||
#self.display_image.setPixmap(self.transparent)
|
#self.display_image.setPixmap(self.transparent)
|
||||||
self.setVisible(False)
|
self.setVisible(False)
|
||||||
elif mode == HideMode.Blank:
|
elif mode == HideMode.Blank:
|
||||||
self.display_blank.setPixmap(
|
self.displayBlank.setPixmap(
|
||||||
QtGui.QPixmap.fromImage(self.blankFrame))
|
QtGui.QPixmap.fromImage(self.blankFrame))
|
||||||
else:
|
else:
|
||||||
if self.parent.renderManager.renderer.bg_frame:
|
if self.parent.renderManager.renderer.bg_frame:
|
||||||
self.display_blank.setPixmap(QtGui.QPixmap.fromImage(
|
self.displayBlank.setPixmap(QtGui.QPixmap.fromImage(
|
||||||
self.parent.renderManager.renderer.bg_frame))
|
self.parent.renderManager.renderer.bg_frame))
|
||||||
else:
|
else:
|
||||||
self.display_blank.setPixmap(
|
self.displayBlank.setPixmap(
|
||||||
QtGui.QPixmap.fromImage(self.blankFrame))
|
QtGui.QPixmap.fromImage(self.blankFrame))
|
||||||
|
|
||||||
def showDisplay(self, message=u''):
|
def showDisplay(self, message=u''):
|
||||||
@ -350,7 +362,7 @@ class MainDisplay(DisplayWidget):
|
|||||||
Make the stored images None to release memory.
|
Make the stored images None to release memory.
|
||||||
"""
|
"""
|
||||||
log.debug(u'showDisplay')
|
log.debug(u'showDisplay')
|
||||||
self.display_blank.setPixmap(self.transparent)
|
self.displayBlank.setPixmap(self.transparent)
|
||||||
#Trigger actions when display is active again
|
#Trigger actions when display is active again
|
||||||
Receiver.send_message(u'maindisplay_active')
|
Receiver.send_message(u'maindisplay_active')
|
||||||
|
|
||||||
@ -358,7 +370,8 @@ class MainDisplay(DisplayWidget):
|
|||||||
log.debug(u'addImageWithText')
|
log.debug(u'addImageWithText')
|
||||||
frame = resize_image(
|
frame = resize_image(
|
||||||
frame, self.screen[u'size'].width(), self.screen[u'size'].height())
|
frame, self.screen[u'size'].width(), self.screen[u'size'].height())
|
||||||
self.display_image.setPixmap(QtGui.QPixmap.fromImage(frame))
|
self.imageDisplay.setPixmap(QtGui.QPixmap.fromImage(frame))
|
||||||
|
self.videoDisplay.setHtml(u'<html></html>')
|
||||||
|
|
||||||
def addAlert(self, message, location):
|
def addAlert(self, message, location):
|
||||||
"""
|
"""
|
||||||
@ -378,14 +391,18 @@ class MainDisplay(DisplayWidget):
|
|||||||
self.alertText.setPos(0,self.size().height() - 76)
|
self.alertText.setPos(0,self.size().height() - 76)
|
||||||
self.alertText.setHtml(message)
|
self.alertText.setHtml(message)
|
||||||
|
|
||||||
def displayImage(self, path):
|
def displayImage(self, frame):
|
||||||
"""
|
"""
|
||||||
Places the Image passed on the display screen
|
Places the Image passed on the display screen
|
||||||
``path``
|
``frame``
|
||||||
The path to the image to be displayed
|
The image to be displayed
|
||||||
"""
|
"""
|
||||||
log.debug(u'adddisplayImage')
|
log.debug(u'adddisplayImage')
|
||||||
self.imageDisplay.setHtml(HTMLIMAGE % path)
|
if isinstance(frame, QtGui.QImage):
|
||||||
|
self.imageDisplay.setPixmap(QtGui.QPixmap.fromImage(frame))
|
||||||
|
else:
|
||||||
|
self.imageDisplay.setPixmap(frame)
|
||||||
|
self.videoDisplay.setHtml(u'<html></html>')
|
||||||
|
|
||||||
def displayVideo(self, path):
|
def displayVideo(self, path):
|
||||||
"""
|
"""
|
||||||
@ -394,7 +411,8 @@ class MainDisplay(DisplayWidget):
|
|||||||
The path to the image to be displayed
|
The path to the image to be displayed
|
||||||
"""
|
"""
|
||||||
log.debug(u'adddisplayVideo')
|
log.debug(u'adddisplayVideo')
|
||||||
self.imageDisplay.setHtml(HTMLVIDEO %
|
self.displayImage(self.transparent)
|
||||||
|
self.videoDisplay.setHtml(HTMLVIDEO %
|
||||||
(path, self.screen[u'size'].width(), self.screen[u'size'].height()))
|
(path, self.screen[u'size'].width(), self.screen[u'size'].height()))
|
||||||
|
|
||||||
def frameView(self, frame, transition=False):
|
def frameView(self, frame, transition=False):
|
||||||
@ -409,42 +427,29 @@ class MainDisplay(DisplayWidget):
|
|||||||
log.debug(u'frameView')
|
log.debug(u'frameView')
|
||||||
if transition:
|
if transition:
|
||||||
if self.frame is not None:
|
if self.frame is not None:
|
||||||
self.display_text.setPixmap(
|
self.displayText.setPixmap(
|
||||||
QtGui.QPixmap.fromImage(self.frame))
|
QtGui.QPixmap.fromImage(self.frame))
|
||||||
self.update()
|
self.repaint()
|
||||||
|
Receiver.send_message(u'openlp_process_events')
|
||||||
|
time.sleep(0.1)
|
||||||
self.frame = None
|
self.frame = None
|
||||||
if frame[u'trans'] is not None:
|
if frame[u'trans'] is not None:
|
||||||
self.display_text.setPixmap(
|
self.displayText.setPixmap(
|
||||||
QtGui.QPixmap.fromImage(frame[u'trans']))
|
QtGui.QPixmap.fromImage(frame[u'trans']))
|
||||||
self.repaint()
|
self.repaint()
|
||||||
|
Receiver.send_message(u'openlp_process_events')
|
||||||
|
time.sleep(0.1)
|
||||||
self.frame = frame[u'trans']
|
self.frame = frame[u'trans']
|
||||||
self.display_text.setPixmap(
|
self.displayText.setPixmap(
|
||||||
QtGui.QPixmap.fromImage(frame[u'main']))
|
QtGui.QPixmap.fromImage(frame[u'main']))
|
||||||
self.display_frame = frame[u'main']
|
|
||||||
self.repaint()
|
|
||||||
else:
|
else:
|
||||||
if isinstance(frame, QtGui.QPixmap):
|
if isinstance(frame, QtGui.QPixmap):
|
||||||
self.display_text.setPixmap(frame)
|
self.displayText.setPixmap(frame)
|
||||||
else:
|
else:
|
||||||
self.display_text.setPixmap(QtGui.QPixmap.fromImage(frame))
|
self.displayText.setPixmap(QtGui.QPixmap.fromImage(frame))
|
||||||
self.display_frame = frame
|
|
||||||
if not self.isVisible() and self.screens.display:
|
if not self.isVisible() and self.screens.display:
|
||||||
self.setVisible(True)
|
self.setVisible(True)
|
||||||
|
|
||||||
def closeEvent(self, event):
|
|
||||||
"""
|
|
||||||
Shutting down cleans up background files
|
|
||||||
"""
|
|
||||||
serviceItemPath = AppLocation.get_section_data_path(u'serviceItems')
|
|
||||||
for file in os.listdir(serviceItemPath):
|
|
||||||
file_path = os.path.join(serviceItemPath, file)
|
|
||||||
try:
|
|
||||||
if os.path.isfile(file_path):
|
|
||||||
os.remove(file_path)
|
|
||||||
except OSError:
|
|
||||||
log.exception(u'Failed to clean up servicePath')
|
|
||||||
|
|
||||||
|
|
||||||
class VideoDisplay(Phonon.VideoWidget):
|
class VideoDisplay(Phonon.VideoWidget):
|
||||||
"""
|
"""
|
||||||
This is the form that is used to display videos on the projector.
|
This is the form that is used to display videos on the projector.
|
||||||
|
@ -580,7 +580,8 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
|||||||
self.plugin_helpers[u'service'] = self.ServiceManagerContents
|
self.plugin_helpers[u'service'] = self.ServiceManagerContents
|
||||||
self.plugin_helpers[u'settings form'] = self.settingsForm
|
self.plugin_helpers[u'settings form'] = self.settingsForm
|
||||||
self.plugin_helpers[u'toolbox'] = self.mediaDockManager
|
self.plugin_helpers[u'toolbox'] = self.mediaDockManager
|
||||||
self.plugin_helpers[u'maindisplay'] = self.displayManager.mainDisplay
|
self.plugin_helpers[u'displaymanager'] = self.displayManager
|
||||||
|
self.plugin_helpers[u'pluginmanager'] = self.plugin_manager
|
||||||
self.plugin_manager.find_plugins(pluginpath, self.plugin_helpers)
|
self.plugin_manager.find_plugins(pluginpath, self.plugin_helpers)
|
||||||
# hook methods have to happen after find_plugins. Find plugins needs
|
# hook methods have to happen after find_plugins. Find plugins needs
|
||||||
# the controllers hence the hooks have moved from setupUI() to here
|
# the controllers hence the hooks have moved from setupUI() to here
|
||||||
|
@ -115,10 +115,10 @@ class PluginForm(QtGui.QDialog, Ui_PluginViewDialog):
|
|||||||
if self.programaticChange:
|
if self.programaticChange:
|
||||||
return
|
return
|
||||||
if status == 0:
|
if status == 0:
|
||||||
self.activePlugin.toggle_status(PluginStatus.Active)
|
self.activePlugin.toggleStatus(PluginStatus.Active)
|
||||||
self.activePlugin.initialise()
|
self.activePlugin.initialise()
|
||||||
else:
|
else:
|
||||||
self.activePlugin.toggle_status(PluginStatus.Inactive)
|
self.activePlugin.toggleStatus(PluginStatus.Inactive)
|
||||||
self.activePlugin.finalise()
|
self.activePlugin.finalise()
|
||||||
status_text = 'Inactive'
|
status_text = 'Inactive'
|
||||||
if self.activePlugin.status == PluginStatus.Active:
|
if self.activePlugin.status == PluginStatus.Active:
|
||||||
@ -128,4 +128,4 @@ class PluginForm(QtGui.QDialog, Ui_PluginViewDialog):
|
|||||||
elif self.activePlugin.status == PluginStatus.Disabled:
|
elif self.activePlugin.status == PluginStatus.Disabled:
|
||||||
status_text = 'Disabled'
|
status_text = 'Disabled'
|
||||||
self.PluginListWidget.currentItem().setText(
|
self.PluginListWidget.currentItem().setText(
|
||||||
u'%s (%s)' % (self.activePlugin.name, status_text))
|
u'%s (%s)' % (self.activePlugin.name, status_text))
|
@ -785,7 +785,7 @@ class SlideController(QtGui.QWidget):
|
|||||||
if self.serviceItem.is_text():
|
if self.serviceItem.is_text():
|
||||||
self.mainDisplay.frameView(frame, True)
|
self.mainDisplay.frameView(frame, True)
|
||||||
else:
|
else:
|
||||||
self.displayManager.displayImage(frame[u'display'])
|
self.displayManager.displayImage(frame[u'main'])
|
||||||
self.selectedRow = row
|
self.selectedRow = row
|
||||||
Receiver.send_message(u'slidecontroller_%s_changed' % self.typePrefix,
|
Receiver.send_message(u'slidecontroller_%s_changed' % self.typePrefix,
|
||||||
row)
|
row)
|
||||||
|
@ -212,7 +212,7 @@ class ThemeManager(QtGui.QWidget):
|
|||||||
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
|
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
|
||||||
else:
|
else:
|
||||||
for plugin in self.parent.plugin_manager.plugins:
|
for plugin in self.parent.plugin_manager.plugins:
|
||||||
if not plugin.can_delete_theme(theme):
|
if not plugin.canDeleteTheme(theme):
|
||||||
QtGui.QMessageBox.critical(self,
|
QtGui.QMessageBox.critical(self,
|
||||||
translate('ThemeManager', 'Error'),
|
translate('ThemeManager', 'Error'),
|
||||||
unicode(translate('ThemeManager',
|
unicode(translate('ThemeManager',
|
||||||
@ -682,4 +682,3 @@ class ThemeManager(QtGui.QWidget):
|
|||||||
#theme.theme_mode
|
#theme.theme_mode
|
||||||
theme.theme_name = theme.theme_name.strip()
|
theme.theme_name = theme.theme_name.strip()
|
||||||
#theme.theme_version
|
#theme.theme_version
|
||||||
|
|
||||||
|
@ -47,14 +47,14 @@ class alertsPlugin(Plugin):
|
|||||||
self.alertForm = AlertForm(self.manager, self)
|
self.alertForm = AlertForm(self.manager, self)
|
||||||
self.status = PluginStatus.Active
|
self.status = PluginStatus.Active
|
||||||
|
|
||||||
def get_settings_tab(self):
|
def getSettingsTab(self):
|
||||||
"""
|
"""
|
||||||
Return the settings tab for the Alerts plugin
|
Return the settings tab for the Alerts plugin
|
||||||
"""
|
"""
|
||||||
self.alertsTab = AlertsTab(self)
|
self.alertsTab = AlertsTab(self)
|
||||||
return self.alertsTab
|
return self.alertsTab
|
||||||
|
|
||||||
def add_tools_menu_item(self, tools_menu):
|
def addToolsMenuItem(self, tools_menu):
|
||||||
"""
|
"""
|
||||||
Give the alerts plugin the opportunity to add items to the
|
Give the alerts plugin the opportunity to add items to the
|
||||||
**Tools** menu.
|
**Tools** menu.
|
||||||
@ -73,7 +73,7 @@ class alertsPlugin(Plugin):
|
|||||||
self.toolsAlertItem.setStatusTip(
|
self.toolsAlertItem.setStatusTip(
|
||||||
translate('AlertsPlugin', 'Show an alert message'))
|
translate('AlertsPlugin', 'Show an alert message'))
|
||||||
self.toolsAlertItem.setShortcut(u'F7')
|
self.toolsAlertItem.setShortcut(u'F7')
|
||||||
self.service_manager.parent.ToolsMenu.addAction(self.toolsAlertItem)
|
self.serviceManager.parent.ToolsMenu.addAction(self.toolsAlertItem)
|
||||||
QtCore.QObject.connect(self.toolsAlertItem,
|
QtCore.QObject.connect(self.toolsAlertItem,
|
||||||
QtCore.SIGNAL(u'triggered()'), self.onAlertsTrigger)
|
QtCore.SIGNAL(u'triggered()'), self.onAlertsTrigger)
|
||||||
self.toolsAlertItem.setVisible(False)
|
self.toolsAlertItem.setVisible(False)
|
||||||
@ -85,8 +85,8 @@ class alertsPlugin(Plugin):
|
|||||||
|
|
||||||
def finalise(self):
|
def finalise(self):
|
||||||
log.info(u'Plugin Finalise')
|
log.info(u'Plugin Finalise')
|
||||||
|
Plugin.finalise(self)
|
||||||
self.toolsAlertItem.setVisible(False)
|
self.toolsAlertItem.setVisible(False)
|
||||||
#stop any events being processed
|
|
||||||
|
|
||||||
def togglealertsState(self):
|
def togglealertsState(self):
|
||||||
self.alertsActive = not self.alertsActive
|
self.alertsActive = not self.alertsActive
|
||||||
@ -102,4 +102,4 @@ class alertsPlugin(Plugin):
|
|||||||
about_text = translate('AlertsPlugin',
|
about_text = translate('AlertsPlugin',
|
||||||
'<b>Alerts Plugin</b><br>This plugin '
|
'<b>Alerts Plugin</b><br>This plugin '
|
||||||
'controls the displaying of alerts on the presentations screen')
|
'controls the displaying of alerts on the presentations screen')
|
||||||
return about_text
|
return about_text
|
@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore
|
||||||
|
|
||||||
from openlp.core.lib import Receiver, translate
|
from openlp.core.lib import Receiver, translate
|
||||||
|
|
||||||
@ -95,7 +95,8 @@ class AlertsManager(QtCore.QObject):
|
|||||||
alertTab = self.parent.alertsTab
|
alertTab = self.parent.alertsTab
|
||||||
text = HTMLCODE % (alertTab.font_color, alertTab.bg_color,
|
text = HTMLCODE % (alertTab.font_color, alertTab.bg_color,
|
||||||
alertTab.font_face, alertTab.font_size, text)
|
alertTab.font_face, alertTab.font_size, text)
|
||||||
self.parent.preview_controller.parent.displayManager.addAlert(text, alertTab.location)
|
self.parent.preview_controller.parent.displayManager.addAlert(text,
|
||||||
|
alertTab.location)
|
||||||
# check to see if we have a timer running
|
# check to see if we have a timer running
|
||||||
if self.timer_id == 0:
|
if self.timer_id == 0:
|
||||||
self.timer_id = self.startTimer(int(alertTab.timeout) * 1000)
|
self.timer_id = self.startTimer(int(alertTab.timeout) * 1000)
|
||||||
@ -111,7 +112,8 @@ class AlertsManager(QtCore.QObject):
|
|||||||
log.debug(u'timer event')
|
log.debug(u'timer event')
|
||||||
alertTab = self.parent.alertsTab
|
alertTab = self.parent.alertsTab
|
||||||
if event.timerId() == self.timer_id:
|
if event.timerId() == self.timer_id:
|
||||||
self.parent.preview_controller.parent.displayManager.addAlert(u'', alertTab.location)
|
self.parent.preview_controller.parent.displayManager.addAlert(u'',
|
||||||
|
alertTab.location)
|
||||||
self.killTimer(self.timer_id)
|
self.killTimer(self.timer_id)
|
||||||
self.timer_id = 0
|
self.timer_id = 0
|
||||||
self.generateAlert()
|
self.generateAlert()
|
||||||
|
@ -48,25 +48,23 @@ class BiblePlugin(Plugin):
|
|||||||
if self.manager is None:
|
if self.manager is None:
|
||||||
self.manager = BibleManager(self)
|
self.manager = BibleManager(self)
|
||||||
Plugin.initialise(self)
|
Plugin.initialise(self)
|
||||||
self.insert_toolbox_item()
|
|
||||||
self.ImportBibleItem.setVisible(True)
|
self.ImportBibleItem.setVisible(True)
|
||||||
self.ExportBibleItem.setVisible(True)
|
self.ExportBibleItem.setVisible(True)
|
||||||
|
|
||||||
def finalise(self):
|
def finalise(self):
|
||||||
log.info(u'Plugin Finalise')
|
log.info(u'Plugin Finalise')
|
||||||
Plugin.finalise(self)
|
Plugin.finalise(self)
|
||||||
self.remove_toolbox_item()
|
|
||||||
self.ImportBibleItem.setVisible(False)
|
self.ImportBibleItem.setVisible(False)
|
||||||
self.ExportBibleItem.setVisible(False)
|
self.ExportBibleItem.setVisible(False)
|
||||||
|
|
||||||
def get_settings_tab(self):
|
def getSettingsTab(self):
|
||||||
return BiblesTab(self.name)
|
return BiblesTab(self.name)
|
||||||
|
|
||||||
def get_media_manager_item(self):
|
def getMediaManagerItem(self):
|
||||||
# Create the BibleManagerItem object
|
# Create the BibleManagerItem object
|
||||||
return BibleMediaItem(self, self.icon, self.name)
|
return BibleMediaItem(self, self.icon, self.name)
|
||||||
|
|
||||||
def add_import_menu_item(self, import_menu):
|
def addImportMenuItem(self, import_menu):
|
||||||
self.ImportBibleItem = QtGui.QAction(import_menu)
|
self.ImportBibleItem = QtGui.QAction(import_menu)
|
||||||
self.ImportBibleItem.setObjectName(u'ImportBibleItem')
|
self.ImportBibleItem.setObjectName(u'ImportBibleItem')
|
||||||
import_menu.addAction(self.ImportBibleItem)
|
import_menu.addAction(self.ImportBibleItem)
|
||||||
@ -77,7 +75,7 @@ class BiblePlugin(Plugin):
|
|||||||
QtCore.SIGNAL(u'triggered()'), self.onBibleImportClick)
|
QtCore.SIGNAL(u'triggered()'), self.onBibleImportClick)
|
||||||
self.ImportBibleItem.setVisible(False)
|
self.ImportBibleItem.setVisible(False)
|
||||||
|
|
||||||
def add_export_menu_item(self, export_menu):
|
def addExportMenuItem(self, export_menu):
|
||||||
self.ExportBibleItem = QtGui.QAction(export_menu)
|
self.ExportBibleItem = QtGui.QAction(export_menu)
|
||||||
self.ExportBibleItem.setObjectName(u'ExportBibleItem')
|
self.ExportBibleItem.setObjectName(u'ExportBibleItem')
|
||||||
export_menu.addAction(self.ExportBibleItem)
|
export_menu.addAction(self.ExportBibleItem)
|
||||||
@ -96,7 +94,7 @@ class BiblePlugin(Plugin):
|
|||||||
'displayed on the screen during the service.')
|
'displayed on the screen during the service.')
|
||||||
return about_text
|
return about_text
|
||||||
|
|
||||||
def can_delete_theme(self, theme):
|
def canDeleteTheme(self, theme):
|
||||||
if self.settings_tab.bible_theme == theme:
|
if self.settings_tab.bible_theme == theme:
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
@ -299,11 +299,10 @@ class BibleDB(QtCore.QObject, Manager):
|
|||||||
The name of the book to return
|
The name of the book to return
|
||||||
"""
|
"""
|
||||||
log.debug(u'BibleDb.get_book("%s")', book)
|
log.debug(u'BibleDb.get_book("%s")', book)
|
||||||
db_book = self.session.query(Book).filter(
|
db_book = self.get_object_filtered(Book, Book.name.like(book + u'%'))
|
||||||
Book.name.like(book + u'%')).first()
|
|
||||||
if db_book is None:
|
if db_book is None:
|
||||||
db_book = self.session.query(Book).filter(
|
db_book = self.get_object_filtered(Book,
|
||||||
Book.abbreviation.like(book + u'%')).first()
|
Book.abbreviation.like(book + u'%'))
|
||||||
return db_book
|
return db_book
|
||||||
|
|
||||||
def get_verses(self, reference_list):
|
def get_verses(self, reference_list):
|
||||||
|
@ -53,22 +53,13 @@ class CustomPlugin(Plugin):
|
|||||||
self.icon = build_icon(u':/plugins/plugin_custom.png')
|
self.icon = build_icon(u':/plugins/plugin_custom.png')
|
||||||
self.status = PluginStatus.Active
|
self.status = PluginStatus.Active
|
||||||
|
|
||||||
def get_settings_tab(self):
|
def getSettingsTab(self):
|
||||||
return CustomTab(self.name)
|
return CustomTab(self.name)
|
||||||
|
|
||||||
def get_media_manager_item(self):
|
def getMediaManagerItem(self):
|
||||||
# Create the CustomManagerItem object
|
# Create the CustomManagerItem object
|
||||||
return CustomMediaItem(self, self.icon, self.name)
|
return CustomMediaItem(self, self.icon, self.name)
|
||||||
|
|
||||||
def initialise(self):
|
|
||||||
log.info(u'Plugin Initialising')
|
|
||||||
Plugin.initialise(self)
|
|
||||||
self.insert_toolbox_item()
|
|
||||||
|
|
||||||
def finalise(self):
|
|
||||||
log.info(u'Plugin Finalise')
|
|
||||||
self.remove_toolbox_item()
|
|
||||||
|
|
||||||
def about(self):
|
def about(self):
|
||||||
about_text = translate('CustomPlugin',
|
about_text = translate('CustomPlugin',
|
||||||
'<b>Custom Plugin</b><br>This plugin '
|
'<b>Custom Plugin</b><br>This plugin '
|
||||||
@ -77,9 +68,8 @@ class CustomPlugin(Plugin):
|
|||||||
'songs plugin.<br>')
|
'songs plugin.<br>')
|
||||||
return about_text
|
return about_text
|
||||||
|
|
||||||
def can_delete_theme(self, theme):
|
def canDeleteTheme(self, theme):
|
||||||
filter_string = u'theme_name=\'%s\'' % theme
|
|
||||||
if not self.custommanager.get_all_objects_filtered(CustomSlide,
|
if not self.custommanager.get_all_objects_filtered(CustomSlide,
|
||||||
filter_string):
|
CustomSlide.theme_name == theme):
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
@ -28,7 +28,8 @@ import logging
|
|||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
from editcustomdialog import Ui_customEditDialog
|
from editcustomdialog import Ui_customEditDialog
|
||||||
from openlp.core.lib import SongXMLBuilder, SongXMLParser, Receiver, translate
|
from openlp.core.lib import Receiver, translate
|
||||||
|
from openlp.plugins.custom.lib import CustomXMLBuilder, CustomXMLParser
|
||||||
from openlp.plugins.custom.lib.db import CustomSlide
|
from openlp.plugins.custom.lib.db import CustomSlide
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
@ -119,8 +120,8 @@ class EditCustomForm(QtGui.QDialog, Ui_customEditDialog):
|
|||||||
self.customSlide = self.custommanager.get_object(CustomSlide, id)
|
self.customSlide = self.custommanager.get_object(CustomSlide, id)
|
||||||
self.TitleEdit.setText(self.customSlide.title)
|
self.TitleEdit.setText(self.customSlide.title)
|
||||||
self.CreditEdit.setText(self.customSlide.credits)
|
self.CreditEdit.setText(self.customSlide.credits)
|
||||||
songXML = SongXMLParser(self.customSlide.text)
|
customXML = CustomXMLParser(self.customSlide.text)
|
||||||
verseList = songXML.get_verses()
|
verseList = customXML.get_verses()
|
||||||
for verse in verseList:
|
for verse in verseList:
|
||||||
self.VerseListView.addItem(verse[1])
|
self.VerseListView.addItem(verse[1])
|
||||||
theme = self.customSlide.theme_name
|
theme = self.customSlide.theme_name
|
||||||
@ -152,7 +153,7 @@ class EditCustomForm(QtGui.QDialog, Ui_customEditDialog):
|
|||||||
translate('CustomPlugin.EditCustomForm', 'Error'), message,
|
translate('CustomPlugin.EditCustomForm', 'Error'), message,
|
||||||
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
|
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
|
||||||
return False
|
return False
|
||||||
sxml = SongXMLBuilder()
|
sxml = CustomXMLBuilder()
|
||||||
sxml.new_document()
|
sxml.new_document()
|
||||||
sxml.add_lyrics_to_song()
|
sxml.add_lyrics_to_song()
|
||||||
count = 1
|
count = 1
|
||||||
|
@ -23,5 +23,6 @@
|
|||||||
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
|
from customxmlhandler import CustomXMLBuilder, CustomXMLParser
|
||||||
from mediaitem import CustomMediaItem
|
from mediaitem import CustomMediaItem
|
||||||
from customtab import CustomTab
|
from customtab import CustomTab
|
||||||
|
@ -23,7 +23,8 @@
|
|||||||
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
||||||
###############################################################################
|
###############################################################################
|
||||||
"""
|
"""
|
||||||
The :mod:`songxmlhandler` module provides the XML functionality for songs
|
The :mod:`customxmlhandler` module provides the XML functionality for custom
|
||||||
|
slides
|
||||||
|
|
||||||
The basic XML is of the format::
|
The basic XML is of the format::
|
||||||
|
|
||||||
@ -39,32 +40,32 @@ The basic XML is of the format::
|
|||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from lxml.etree import ElementTree, XML, dump
|
|
||||||
from xml.parsers.expat import ExpatError
|
|
||||||
from xml.dom.minidom import Document
|
from xml.dom.minidom import Document
|
||||||
|
from xml.etree.ElementTree import ElementTree, XML, dump
|
||||||
|
from xml.parsers.expat import ExpatError
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
class SongXMLBuilder(object):
|
class CustomXMLBuilder(object):
|
||||||
"""
|
"""
|
||||||
This class builds the XML used to describe songs.
|
This class builds the XML used to describe songs.
|
||||||
"""
|
"""
|
||||||
log.info(u'SongXMLBuilder Loaded')
|
log.info(u'CustomXMLBuilder Loaded')
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
"""
|
"""
|
||||||
Set up the song builder.
|
Set up the song builder.
|
||||||
"""
|
"""
|
||||||
# Create the minidom document
|
# Create the minidom document
|
||||||
self.song_xml = Document()
|
self.custom_xml = Document()
|
||||||
|
|
||||||
def new_document(self):
|
def new_document(self):
|
||||||
"""
|
"""
|
||||||
Create a new song XML document.
|
Create a new song XML document.
|
||||||
"""
|
"""
|
||||||
# Create the <song> base element
|
# Create the <song> base element
|
||||||
self.song = self.song_xml.createElement(u'song')
|
self.song = self.custom_xml.createElement(u'song')
|
||||||
self.song_xml.appendChild(self.song)
|
self.custom_xml.appendChild(self.song)
|
||||||
self.song.setAttribute(u'version', u'1.0')
|
self.song.setAttribute(u'version', u'1.0')
|
||||||
|
|
||||||
def add_lyrics_to_song(self):
|
def add_lyrics_to_song(self):
|
||||||
@ -73,7 +74,7 @@ class SongXMLBuilder(object):
|
|||||||
song.
|
song.
|
||||||
"""
|
"""
|
||||||
# Create the main <lyrics> element
|
# Create the main <lyrics> element
|
||||||
self.lyrics = self.song_xml.createElement(u'lyrics')
|
self.lyrics = self.custom_xml.createElement(u'lyrics')
|
||||||
self.lyrics.setAttribute(u'language', u'en')
|
self.lyrics.setAttribute(u'language', u'en')
|
||||||
self.song.appendChild(self.lyrics)
|
self.song.appendChild(self.lyrics)
|
||||||
|
|
||||||
@ -92,32 +93,32 @@ class SongXMLBuilder(object):
|
|||||||
The actual text of the verse to be stored.
|
The actual text of the verse to be stored.
|
||||||
"""
|
"""
|
||||||
#log.debug(u'add_verse_to_lyrics %s, %s\n%s' % (type, number, content))
|
#log.debug(u'add_verse_to_lyrics %s, %s\n%s' % (type, number, content))
|
||||||
verse = self.song_xml.createElement(u'verse')
|
verse = self.custom_xml.createElement(u'verse')
|
||||||
verse.setAttribute(u'type', type)
|
verse.setAttribute(u'type', type)
|
||||||
verse.setAttribute(u'label', number)
|
verse.setAttribute(u'label', number)
|
||||||
self.lyrics.appendChild(verse)
|
self.lyrics.appendChild(verse)
|
||||||
# add data as a CDATA section to protect the XML from special chars
|
# add data as a CDATA section to protect the XML from special chars
|
||||||
cds = self.song_xml.createCDATASection(content)
|
cds = self.custom_xml.createCDATASection(content)
|
||||||
verse.appendChild(cds)
|
verse.appendChild(cds)
|
||||||
|
|
||||||
def dump_xml(self):
|
def dump_xml(self):
|
||||||
"""
|
"""
|
||||||
Debugging aid to dump XML so that we can see what we have.
|
Debugging aid to dump XML so that we can see what we have.
|
||||||
"""
|
"""
|
||||||
return self.song_xml.toprettyxml(indent=u' ')
|
return self.custom_xml.toprettyxml(indent=u' ')
|
||||||
|
|
||||||
def extract_xml(self):
|
def extract_xml(self):
|
||||||
"""
|
"""
|
||||||
Extract our newly created XML song.
|
Extract our newly created XML song.
|
||||||
"""
|
"""
|
||||||
return self.song_xml.toxml(u'utf-8')
|
return self.custom_xml.toxml(u'utf-8')
|
||||||
|
|
||||||
|
|
||||||
class SongXMLParser(object):
|
class CustomXMLParser(object):
|
||||||
"""
|
"""
|
||||||
A class to read in and parse a song's XML.
|
A class to read in and parse a song's XML.
|
||||||
"""
|
"""
|
||||||
log.info(u'SongXMLParser Loaded')
|
log.info(u'CustomXMLParser Loaded')
|
||||||
|
|
||||||
def __init__(self, xml):
|
def __init__(self, xml):
|
||||||
"""
|
"""
|
||||||
@ -126,9 +127,9 @@ class SongXMLParser(object):
|
|||||||
``xml``
|
``xml``
|
||||||
The XML of the song to be parsed.
|
The XML of the song to be parsed.
|
||||||
"""
|
"""
|
||||||
self.song_xml = None
|
self.custom_xml = None
|
||||||
try:
|
try:
|
||||||
self.song_xml = ElementTree(
|
self.custom_xml = ElementTree(
|
||||||
element=XML(unicode(xml).encode('unicode-escape')))
|
element=XML(unicode(xml).encode('unicode-escape')))
|
||||||
except ExpatError:
|
except ExpatError:
|
||||||
log.exception(u'Invalid xml %s', xml)
|
log.exception(u'Invalid xml %s', xml)
|
||||||
@ -138,7 +139,7 @@ class SongXMLParser(object):
|
|||||||
Iterates through the verses in the XML and returns a list of verses
|
Iterates through the verses in the XML and returns a list of verses
|
||||||
and their attributes.
|
and their attributes.
|
||||||
"""
|
"""
|
||||||
xml_iter = self.song_xml.getiterator()
|
xml_iter = self.custom_xml.getiterator()
|
||||||
verse_list = []
|
verse_list = []
|
||||||
for element in xml_iter:
|
for element in xml_iter:
|
||||||
if element.tag == u'verse':
|
if element.tag == u'verse':
|
||||||
@ -152,4 +153,4 @@ class SongXMLParser(object):
|
|||||||
"""
|
"""
|
||||||
Debugging aid to dump XML so that we can see what we have.
|
Debugging aid to dump XML so that we can see what we have.
|
||||||
"""
|
"""
|
||||||
return dump(self.song_xml)
|
return dump(self.custom_xml)
|
@ -27,8 +27,9 @@ import logging
|
|||||||
|
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
from openlp.core.lib import MediaManagerItem, SongXMLParser, BaseListWithDnD, \
|
from openlp.core.lib import MediaManagerItem, BaseListWithDnD, \
|
||||||
Receiver, ItemCapabilities, translate, check_item_selected
|
Receiver, ItemCapabilities, translate, check_item_selected
|
||||||
|
from openlp.plugins.custom.lib import CustomXMLParser
|
||||||
from openlp.plugins.custom.lib.db import CustomSlide
|
from openlp.plugins.custom.lib.db import CustomSlide
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
@ -141,7 +142,7 @@ class CustomMediaItem(MediaManagerItem):
|
|||||||
id_list = [(item.data(QtCore.Qt.UserRole)).toInt()[0]
|
id_list = [(item.data(QtCore.Qt.UserRole)).toInt()[0]
|
||||||
for item in self.ListView.selectedIndexes()]
|
for item in self.ListView.selectedIndexes()]
|
||||||
for id in id_list:
|
for id in id_list:
|
||||||
self.parent.custommanager.delete_custom(id)
|
self.parent.custommanager.delete_object(CustomSlide, id)
|
||||||
for row in row_list:
|
for row in row_list:
|
||||||
self.ListView.takeItem(row)
|
self.ListView.takeItem(row)
|
||||||
|
|
||||||
@ -170,8 +171,8 @@ class CustomMediaItem(MediaManagerItem):
|
|||||||
theme = customSlide.theme_name
|
theme = customSlide.theme_name
|
||||||
if theme:
|
if theme:
|
||||||
service_item.theme = theme
|
service_item.theme = theme
|
||||||
songXML = SongXMLParser(customSlide.text)
|
customXML = CustomXMLParser(customSlide.text)
|
||||||
verseList = songXML.get_verses()
|
verseList = customXML.get_verses()
|
||||||
for verse in verseList:
|
for verse in verseList:
|
||||||
raw_slides.append(verse[1])
|
raw_slides.append(verse[1])
|
||||||
service_item.title = title
|
service_item.title = title
|
||||||
|
@ -39,19 +39,10 @@ class ImagePlugin(Plugin):
|
|||||||
self.icon = build_icon(u':/plugins/plugin_images.png')
|
self.icon = build_icon(u':/plugins/plugin_images.png')
|
||||||
self.status = PluginStatus.Active
|
self.status = PluginStatus.Active
|
||||||
|
|
||||||
def initialise(self):
|
def getSettingsTab(self):
|
||||||
log.info(u'Plugin Initialising')
|
|
||||||
Plugin.initialise(self)
|
|
||||||
self.insert_toolbox_item()
|
|
||||||
|
|
||||||
def finalise(self):
|
|
||||||
log.info(u'Plugin Finalise')
|
|
||||||
self.remove_toolbox_item()
|
|
||||||
|
|
||||||
def get_settings_tab(self):
|
|
||||||
return ImageTab(self.name)
|
return ImageTab(self.name)
|
||||||
|
|
||||||
def get_media_manager_item(self):
|
def getMediaManagerItem(self):
|
||||||
# Create the MediaManagerItem object
|
# Create the MediaManagerItem object
|
||||||
return ImageMediaItem(self, self.icon, self.name)
|
return ImageMediaItem(self, self.icon, self.name)
|
||||||
|
|
||||||
@ -64,4 +55,4 @@ class ImagePlugin(Plugin):
|
|||||||
'an image is selected any songs which are rendered will use the '
|
'an image is selected any songs which are rendered will use the '
|
||||||
'selected image from the background instead of the one provied by '
|
'selected image from the background instead of the one provied by '
|
||||||
'the theme.<br>')
|
'the theme.<br>')
|
||||||
return about_text
|
return about_text
|
@ -173,11 +173,12 @@ class ImageMediaItem(MediaManagerItem):
|
|||||||
if check_item_selected(self.ListView,
|
if check_item_selected(self.ListView,
|
||||||
translate('ImagePlugin.MediaItem',
|
translate('ImagePlugin.MediaItem',
|
||||||
'You must select an item to process.')):
|
'You must select an item to process.')):
|
||||||
item = self.buildServiceItem()
|
items = self.ListView.selectedIndexes()
|
||||||
item.render()
|
for item in items:
|
||||||
self.parent.live_controller.displayManager. \
|
bitem = self.ListView.item(item.row())
|
||||||
displayImage(item.get_rendered_frame(0)[u'display'])
|
filename = unicode(bitem.data(QtCore.Qt.UserRole).toString())
|
||||||
|
frame = QtGui.QImage(unicode(filename))
|
||||||
|
self.parent.displayManager.displayImageWithText(frame)
|
||||||
|
|
||||||
def onPreviewClick(self):
|
def onPreviewClick(self):
|
||||||
MediaManagerItem.onPreviewClick(self)
|
MediaManagerItem.onPreviewClick(self)
|
||||||
|
@ -101,22 +101,13 @@ class MediaMediaItem(MediaManagerItem):
|
|||||||
self.PageLayout.addWidget(self.ImageWidget)
|
self.PageLayout.addWidget(self.ImageWidget)
|
||||||
|
|
||||||
def onReplaceClick(self):
|
def onReplaceClick(self):
|
||||||
# if self.background:
|
|
||||||
# self.background = False
|
|
||||||
# Receiver.send_message(u'videodisplay_stop')
|
|
||||||
# else:
|
|
||||||
# self.background = True
|
|
||||||
if check_item_selected(self.ListView,
|
if check_item_selected(self.ListView,
|
||||||
translate('ImagePlugin.MediaItem',
|
translate('ImagePlugin.MediaItem',
|
||||||
'You must select an item to process.')):
|
'You must select an item to process.')):
|
||||||
item = self.ListView.currentItem()
|
item = self.ListView.currentItem()
|
||||||
filename = unicode(item.data(QtCore.Qt.UserRole).toString())
|
filename = unicode(item.data(QtCore.Qt.UserRole).toString())
|
||||||
self.parent.live_controller.displayManager.displayVideo(filename)
|
self.parent.displayManager.displayVideo(filename)
|
||||||
# items = self.ListView.selectedIndexes()
|
|
||||||
# for item in items:
|
|
||||||
# bitem = self.ListView.item(item.row())
|
|
||||||
# filename = unicode(bitem.data(QtCore.Qt.UserRole).toString())
|
|
||||||
# Receiver.send_message(u'videodisplay_background', filename)
|
|
||||||
|
|
||||||
def generateSlideData(self, service_item, item=None):
|
def generateSlideData(self, service_item, item=None):
|
||||||
if item is None:
|
if item is None:
|
||||||
|
@ -47,36 +47,27 @@ class MediaPlugin(Plugin):
|
|||||||
for mimetype in Phonon.BackendCapabilities.availableMimeTypes():
|
for mimetype in Phonon.BackendCapabilities.availableMimeTypes():
|
||||||
mimetype = unicode(mimetype)
|
mimetype = unicode(mimetype)
|
||||||
type = mimetype.split(u'audio/x-')
|
type = mimetype.split(u'audio/x-')
|
||||||
self.audio_list, mimetype = self._add_to_list(self.audio_list,
|
self.audio_list, mimetype = self._addToList(self.audio_list,
|
||||||
type, mimetype)
|
type, mimetype)
|
||||||
type = mimetype.split(u'audio/')
|
type = mimetype.split(u'audio/')
|
||||||
self.audio_list, mimetype = self._add_to_list(self.audio_list,
|
self.audio_list, mimetype = self._addToList(self.audio_list,
|
||||||
type, mimetype)
|
type, mimetype)
|
||||||
type = mimetype.split(u'video/x-')
|
type = mimetype.split(u'video/x-')
|
||||||
self.video_list, mimetype = self._add_to_list(self.video_list,
|
self.video_list, mimetype = self._addToList(self.video_list,
|
||||||
type, mimetype)
|
type, mimetype)
|
||||||
type = mimetype.split(u'video/')
|
type = mimetype.split(u'video/')
|
||||||
self.video_list, mimetype = self._add_to_list(self.video_list,
|
self.video_list, mimetype = self._addToList(self.video_list,
|
||||||
type, mimetype)
|
type, mimetype)
|
||||||
|
|
||||||
def _add_to_list(self, list, value, type):
|
def _addToList(self, list, value, type):
|
||||||
if len(value) == 2:
|
if len(value) == 2:
|
||||||
if list.find(value[1]) == -1:
|
if list.find(value[1]) == -1:
|
||||||
list += u'*.%s ' % value[1]
|
list += u'*.%s ' % value[1]
|
||||||
self.service_manager.supportedSuffixes(value[1])
|
self.serviceManager.supportedSuffixes(value[1])
|
||||||
type = u''
|
type = u''
|
||||||
return list, type
|
return list, type
|
||||||
|
|
||||||
def initialise(self):
|
def getMediaManagerItem(self):
|
||||||
log.info(u'Plugin Initialising')
|
|
||||||
Plugin.initialise(self)
|
|
||||||
self.insert_toolbox_item()
|
|
||||||
|
|
||||||
def finalise(self):
|
|
||||||
log.info(u'Plugin Finalise')
|
|
||||||
self.remove_toolbox_item()
|
|
||||||
|
|
||||||
def get_media_manager_item(self):
|
|
||||||
# Create the MediaManagerItem object
|
# Create the MediaManagerItem object
|
||||||
return MediaMediaItem(self, self.icon, self.name)
|
return MediaMediaItem(self, self.icon, self.name)
|
||||||
|
|
||||||
|
@ -77,7 +77,7 @@ class PresentationMediaItem(MediaManagerItem):
|
|||||||
for type in types:
|
for type in types:
|
||||||
if fileType.find(type) == -1:
|
if fileType.find(type) == -1:
|
||||||
fileType += u'*%s ' % type
|
fileType += u'*%s ' % type
|
||||||
self.parent.service_manager.supportedSuffixes(type)
|
self.parent.serviceManager.supportedSuffixes(type)
|
||||||
self.OnNewFileMasks = translate('PresentationPlugin.MediaItem',
|
self.OnNewFileMasks = translate('PresentationPlugin.MediaItem',
|
||||||
'Presentations (%s)' % fileType)
|
'Presentations (%s)' % fileType)
|
||||||
|
|
||||||
|
@ -173,7 +173,7 @@ class PowerpointDocument(PresentationDocument):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
def is_active(self):
|
def isActive(self):
|
||||||
"""
|
"""
|
||||||
Returns true if a presentation is currently active
|
Returns true if a presentation is currently active
|
||||||
"""
|
"""
|
||||||
@ -206,7 +206,7 @@ class PowerpointDocument(PresentationDocument):
|
|||||||
"""
|
"""
|
||||||
Returns true if screen is blank
|
Returns true if screen is blank
|
||||||
"""
|
"""
|
||||||
if self.is_active():
|
if self.isActive():
|
||||||
return self.presentation.SlideShowWindow.View.State == 3
|
return self.presentation.SlideShowWindow.View.State == 3
|
||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
@ -298,4 +298,4 @@ class PowerpointDocument(PresentationDocument):
|
|||||||
shape = shapes(idx + 1)
|
shape = shapes(idx + 1)
|
||||||
if shape.HasTextFrame:
|
if shape.HasTextFrame:
|
||||||
text += shape.TextFrame.TextRange.Text + '\n'
|
text += shape.TextFrame.TextRange.Text + '\n'
|
||||||
return text
|
return text
|
@ -27,7 +27,7 @@ import os
|
|||||||
import logging
|
import logging
|
||||||
|
|
||||||
if os.name == u'nt':
|
if os.name == u'nt':
|
||||||
from ctypes import *
|
from ctypes import cdll
|
||||||
from ctypes.wintypes import RECT
|
from ctypes.wintypes import RECT
|
||||||
|
|
||||||
from presentationcontroller import PresentationController, PresentationDocument
|
from presentationcontroller import PresentationController, PresentationDocument
|
||||||
@ -79,8 +79,9 @@ class PptviewController(PresentationController):
|
|||||||
if self.process:
|
if self.process:
|
||||||
return
|
return
|
||||||
log.debug(u'start PPTView')
|
log.debug(u'start PPTView')
|
||||||
self.process = cdll.LoadLibrary(
|
dllpath = os.path.join(self.plugin.pluginManager.basepath,
|
||||||
r'openlp\plugins\presentations\lib\pptviewlib\pptviewlib.dll')
|
u'presentations', u'lib', u'pptviewlib', u'pptviewlib.dll')
|
||||||
|
self.process = cdll.LoadLibrary(dllpath)
|
||||||
#self.process.SetDebug(1)
|
#self.process.SetDebug(1)
|
||||||
|
|
||||||
def kill(self):
|
def kill(self):
|
||||||
@ -118,7 +119,7 @@ class PptviewDocument(PresentationDocument):
|
|||||||
log.debug(u'LoadPresentation')
|
log.debug(u'LoadPresentation')
|
||||||
#if self.pptid >= 0:
|
#if self.pptid >= 0:
|
||||||
# self.close_presentation()
|
# self.close_presentation()
|
||||||
rendermanager = self.controller.plugin.render_manager
|
rendermanager = self.controller.plugin.renderManager
|
||||||
rect = rendermanager.screens.current[u'size']
|
rect = rendermanager.screens.current[u'size']
|
||||||
rect = RECT(rect.x(), rect.y(), rect.right(), rect.bottom())
|
rect = RECT(rect.x(), rect.y(), rect.right(), rect.bottom())
|
||||||
filepath = str(self.filepath.replace(u'/', u'\\'))
|
filepath = str(self.filepath.replace(u'/', u'\\'))
|
||||||
|
@ -43,7 +43,7 @@ class PresentationPlugin(Plugin):
|
|||||||
self.icon = build_icon(u':/plugins/plugin_presentations.png')
|
self.icon = build_icon(u':/plugins/plugin_presentations.png')
|
||||||
self.status = PluginStatus.Active
|
self.status = PluginStatus.Active
|
||||||
|
|
||||||
def get_settings_tab(self):
|
def getSettingsTab(self):
|
||||||
"""
|
"""
|
||||||
Create the settings Tab
|
Create the settings Tab
|
||||||
"""
|
"""
|
||||||
@ -52,7 +52,7 @@ class PresentationPlugin(Plugin):
|
|||||||
def initialise(self):
|
def initialise(self):
|
||||||
log.info(u'Presentations Initialising')
|
log.info(u'Presentations Initialising')
|
||||||
Plugin.initialise(self)
|
Plugin.initialise(self)
|
||||||
self.insert_toolbox_item()
|
self.insertToolboxItem()
|
||||||
for controller in self.controllers:
|
for controller in self.controllers:
|
||||||
if self.controllers[controller].enabled:
|
if self.controllers[controller].enabled:
|
||||||
self.controllers[controller].start_process()
|
self.controllers[controller].start_process()
|
||||||
@ -64,9 +64,9 @@ class PresentationPlugin(Plugin):
|
|||||||
controller = self.controllers[key]
|
controller = self.controllers[key]
|
||||||
if controller.enabled:
|
if controller.enabled:
|
||||||
controller.kill()
|
controller.kill()
|
||||||
self.remove_toolbox_item()
|
Plugin.finalise(self)
|
||||||
|
|
||||||
def get_media_manager_item(self):
|
def getMediaManagerItem(self):
|
||||||
"""
|
"""
|
||||||
Create the Media Manager List
|
Create the Media Manager List
|
||||||
"""
|
"""
|
||||||
@ -76,12 +76,12 @@ class PresentationPlugin(Plugin):
|
|||||||
def registerControllers(self, controller):
|
def registerControllers(self, controller):
|
||||||
self.controllers[controller.name] = controller
|
self.controllers[controller.name] = controller
|
||||||
|
|
||||||
def check_pre_conditions(self):
|
def checkPreConditions(self):
|
||||||
"""
|
"""
|
||||||
Check to see if we have any presentation software available
|
Check to see if we have any presentation software available
|
||||||
If Not do not install the plugin.
|
If Not do not install the plugin.
|
||||||
"""
|
"""
|
||||||
log.debug(u'check_pre_conditions')
|
log.debug(u'checkPreConditions')
|
||||||
controller_dir = os.path.join(
|
controller_dir = os.path.join(
|
||||||
AppLocation.get_directory(AppLocation.PluginsDir),
|
AppLocation.get_directory(AppLocation.PluginsDir),
|
||||||
u'presentations', u'lib')
|
u'presentations', u'lib')
|
||||||
@ -113,4 +113,4 @@ class PresentationPlugin(Plugin):
|
|||||||
'the ability to show presentations using a number of different '
|
'the ability to show presentations using a number of different '
|
||||||
'programs. The choice of available presentation programs is '
|
'programs. The choice of available presentation programs is '
|
||||||
'available to the user in a drop down box.')
|
'available to the user in a drop down box.')
|
||||||
return about_text
|
return about_text
|
@ -48,7 +48,7 @@ class RemotesPlugin(Plugin):
|
|||||||
"""
|
"""
|
||||||
log.debug(u'initialise')
|
log.debug(u'initialise')
|
||||||
Plugin.initialise(self)
|
Plugin.initialise(self)
|
||||||
self.insert_toolbox_item()
|
self.insertToolboxItem()
|
||||||
self.server = HttpServer(self)
|
self.server = HttpServer(self)
|
||||||
|
|
||||||
def finalise(self):
|
def finalise(self):
|
||||||
@ -56,11 +56,11 @@ class RemotesPlugin(Plugin):
|
|||||||
Tidy up and close down the http server
|
Tidy up and close down the http server
|
||||||
"""
|
"""
|
||||||
log.debug(u'finalise')
|
log.debug(u'finalise')
|
||||||
self.remove_toolbox_item()
|
Plugin.finalise(self)
|
||||||
if self.server:
|
if self.server:
|
||||||
self.server.close()
|
self.server.close()
|
||||||
|
|
||||||
def get_settings_tab(self):
|
def getSettingsTab(self):
|
||||||
"""
|
"""
|
||||||
Create the settings Tab
|
Create the settings Tab
|
||||||
"""
|
"""
|
||||||
@ -75,4 +75,4 @@ class RemotesPlugin(Plugin):
|
|||||||
'provides the ability to send messages to a running version of '
|
'provides the ability to send messages to a running version of '
|
||||||
'openlp on a different computer via a web browser or other app<br>'
|
'openlp on a different computer via a web browser or other app<br>'
|
||||||
'The Primary use for this would be to send alerts from a creche')
|
'The Primary use for this would be to send alerts from a creche')
|
||||||
return about_text
|
return about_text
|
@ -28,9 +28,9 @@ import re
|
|||||||
|
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
from openlp.core.lib import SongXMLBuilder, SongXMLParser, Receiver, translate
|
from openlp.core.lib import Receiver, translate
|
||||||
from openlp.plugins.songs.forms import EditVerseForm
|
from openlp.plugins.songs.forms import EditVerseForm
|
||||||
from openlp.plugins.songs.lib import VerseType
|
from openlp.plugins.songs.lib import SongXMLBuilder, SongXMLParser, VerseType
|
||||||
from openlp.plugins.songs.lib.db import Book, Song, Author, Topic
|
from openlp.plugins.songs.lib.db import Book, Song, Author, Topic
|
||||||
from editsongdialog import Ui_EditSongDialog
|
from editsongdialog import Ui_EditSongDialog
|
||||||
|
|
||||||
@ -88,7 +88,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
|||||||
QtCore.SIGNAL(u'activated(int)'), self.onThemeComboChanged)
|
QtCore.SIGNAL(u'activated(int)'), self.onThemeComboChanged)
|
||||||
QtCore.QObject.connect(self.ThemeAddButton,
|
QtCore.QObject.connect(self.ThemeAddButton,
|
||||||
QtCore.SIGNAL(u'clicked()'),
|
QtCore.SIGNAL(u'clicked()'),
|
||||||
self.parent.parent.render_manager.theme_manager.onAddTheme)
|
self.parent.parent.renderManager.theme_manager.onAddTheme)
|
||||||
QtCore.QObject.connect(self.MaintenanceButton,
|
QtCore.QObject.connect(self.MaintenanceButton,
|
||||||
QtCore.SIGNAL(u'clicked()'), self.onMaintenanceButtonClicked)
|
QtCore.SIGNAL(u'clicked()'), self.onMaintenanceButtonClicked)
|
||||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||||
@ -639,8 +639,6 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
|||||||
log.debug(u'processLyrics')
|
log.debug(u'processLyrics')
|
||||||
try:
|
try:
|
||||||
sxml = SongXMLBuilder()
|
sxml = SongXMLBuilder()
|
||||||
sxml.new_document()
|
|
||||||
sxml.add_lyrics_to_song()
|
|
||||||
text = u''
|
text = u''
|
||||||
multiple = []
|
multiple = []
|
||||||
for i in range (0, self.VerseListWidget.rowCount()):
|
for i in range (0, self.VerseListWidget.rowCount()):
|
||||||
@ -666,4 +664,3 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
|||||||
log.debug(u'processTitle')
|
log.debug(u'processTitle')
|
||||||
self.song.search_title = \
|
self.song.search_title = \
|
||||||
re.sub(r'[\'"`,;:(){}?]+', u'', unicode(self.song.search_title))
|
re.sub(r'[\'"`,;:(){}?]+', u'', unicode(self.song.search_title))
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ from PyQt4 import QtCore, QtGui
|
|||||||
from songimportwizard import Ui_SongImportWizard
|
from songimportwizard import Ui_SongImportWizard
|
||||||
from openlp.core.lib import Receiver, SettingsManager, translate
|
from openlp.core.lib import Receiver, SettingsManager, translate
|
||||||
#from openlp.core.utils import AppLocation
|
#from openlp.core.utils import AppLocation
|
||||||
from openlp.plugins.songs.lib.manager import SongFormat
|
from openlp.plugins.songs.lib import SongFormat
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
@ -25,6 +25,52 @@
|
|||||||
|
|
||||||
from openlp.core.lib import translate
|
from openlp.core.lib import translate
|
||||||
|
|
||||||
|
#from openlp.plugins.songs.lib import OpenLyricsSong, OpenSongSong, CCLISong, \
|
||||||
|
# CSVSong
|
||||||
|
|
||||||
|
class SongFormat(object):
|
||||||
|
"""
|
||||||
|
This is a special enumeration class that holds the various types of songs,
|
||||||
|
plus a few helper functions to facilitate generic handling of song types
|
||||||
|
for importing.
|
||||||
|
"""
|
||||||
|
Unknown = -1
|
||||||
|
OpenLyrics = 0
|
||||||
|
OpenSong = 1
|
||||||
|
CCLI = 2
|
||||||
|
CSV = 3
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def get_class(id):
|
||||||
|
"""
|
||||||
|
Return the appropriate imeplementation class.
|
||||||
|
|
||||||
|
``id``
|
||||||
|
The song format.
|
||||||
|
"""
|
||||||
|
# if id == SongFormat.OpenLyrics:
|
||||||
|
# return OpenLyricsSong
|
||||||
|
# elif id == SongFormat.OpenSong:
|
||||||
|
# return OpenSongSong
|
||||||
|
# elif id == SongFormat.CCLI:
|
||||||
|
# return CCLISong
|
||||||
|
# elif id == SongFormat.CSV:
|
||||||
|
# return CSVSong
|
||||||
|
# else:
|
||||||
|
return None
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def list():
|
||||||
|
"""
|
||||||
|
Return a list of the supported song formats.
|
||||||
|
"""
|
||||||
|
return [
|
||||||
|
SongFormat.OpenLyrics,
|
||||||
|
SongFormat.OpenSong,
|
||||||
|
SongFormat.CCLI,
|
||||||
|
SongFormat.CSV
|
||||||
|
]
|
||||||
|
|
||||||
class VerseType(object):
|
class VerseType(object):
|
||||||
"""
|
"""
|
||||||
VerseType provides an enumeration for the tags that may be associated
|
VerseType provides an enumeration for the tags that may be associated
|
||||||
@ -91,7 +137,7 @@ class VerseType(object):
|
|||||||
unicode(VerseType.to_string(VerseType.Other)).lower():
|
unicode(VerseType.to_string(VerseType.Other)).lower():
|
||||||
return VerseType.Other
|
return VerseType.Other
|
||||||
|
|
||||||
from manager import SongManager
|
from xml import LyricsXML, SongXMLBuilder, SongXMLParser
|
||||||
from songstab import SongsTab
|
from songstab import SongsTab
|
||||||
from mediaitem import SongMediaItem
|
from mediaitem import SongMediaItem
|
||||||
from songimport import SongImport
|
from songimport import SongImport
|
||||||
@ -101,4 +147,3 @@ try:
|
|||||||
from oooimport import OooImport
|
from oooimport import OooImport
|
||||||
except ImportError:
|
except ImportError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@ -22,24 +22,124 @@
|
|||||||
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
|
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
|
||||||
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
"""
|
||||||
|
The :mod:`xml` module provides the XML functionality for songs
|
||||||
|
|
||||||
|
The basic XML is of the format::
|
||||||
|
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<song version="1.0">
|
||||||
|
<lyrics language="en">
|
||||||
|
<verse type="chorus" label="1">
|
||||||
|
<![CDATA[ ... ]]>
|
||||||
|
</verse>
|
||||||
|
</lyrics>
|
||||||
|
</song>
|
||||||
|
"""
|
||||||
|
|
||||||
|
import logging
|
||||||
|
|
||||||
|
from lxml import etree, objectify
|
||||||
|
|
||||||
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
class SongXMLBuilder(object):
|
||||||
|
"""
|
||||||
|
This class builds the XML used to describe songs.
|
||||||
|
"""
|
||||||
|
log.info(u'SongXMLBuilder Loaded')
|
||||||
|
|
||||||
|
def __init__(self, song_language=None):
|
||||||
|
"""
|
||||||
|
Set up the song builder.
|
||||||
|
|
||||||
|
``song_language``
|
||||||
|
The language used in this song
|
||||||
|
"""
|
||||||
|
lang = u'en'
|
||||||
|
if song_language:
|
||||||
|
lang = song_language
|
||||||
|
self.song_xml = objectify.fromstring(u'<song version="1.0" />')
|
||||||
|
self.lyrics = etree.SubElement(self.song_xml, u'lyrics', language=lang)
|
||||||
|
|
||||||
|
def add_verse_to_lyrics(self, type, number, content):
|
||||||
|
"""
|
||||||
|
Add a verse to the ``<lyrics>`` tag.
|
||||||
|
|
||||||
|
``type``
|
||||||
|
A string denoting the type of verse. Possible values are "Chorus",
|
||||||
|
"Verse", "Bridge", and "Custom".
|
||||||
|
|
||||||
|
``number``
|
||||||
|
An integer denoting the number of the item, for example: verse 1.
|
||||||
|
|
||||||
|
``content``
|
||||||
|
The actual text of the verse to be stored.
|
||||||
|
"""
|
||||||
|
#log.debug(u'add_verse_to_lyrics %s, %s\n%s' % (type, number, content))
|
||||||
|
verse = etree.SubElement(self.lyrics, u'verse', type=type, label=number)
|
||||||
|
verse.text = etree.CDATA(content)
|
||||||
|
|
||||||
|
def dump_xml(self):
|
||||||
|
"""
|
||||||
|
Debugging aid to dump XML so that we can see what we have.
|
||||||
|
"""
|
||||||
|
return etree.tostring(self.song_xml, encoding=u'UTF-8',
|
||||||
|
xml_declaration=True, pretty_print=True)
|
||||||
|
|
||||||
|
def extract_xml(self):
|
||||||
|
"""
|
||||||
|
Extract our newly created XML song.
|
||||||
|
"""
|
||||||
|
return etree.tostring(self.song_xml, encoding=u'UTF-8',
|
||||||
|
xml_declaration=True)
|
||||||
|
|
||||||
|
|
||||||
|
class SongXMLParser(object):
|
||||||
|
"""
|
||||||
|
A class to read in and parse a song's XML.
|
||||||
|
"""
|
||||||
|
log.info(u'SongXMLParser Loaded')
|
||||||
|
|
||||||
|
def __init__(self, xml):
|
||||||
|
"""
|
||||||
|
Set up our song XML parser.
|
||||||
|
|
||||||
|
``xml``
|
||||||
|
The XML of the song to be parsed.
|
||||||
|
"""
|
||||||
|
self.song_xml = None
|
||||||
|
if xml[:5] == u'<?xml':
|
||||||
|
xml = xml[38:]
|
||||||
|
try:
|
||||||
|
self.song_xml = objectify.fromstring(xml)
|
||||||
|
except etree.XMLSyntaxError:
|
||||||
|
log.exception(u'Invalid xml %s', xml)
|
||||||
|
|
||||||
|
def get_verses(self):
|
||||||
|
"""
|
||||||
|
Iterates through the verses in the XML and returns a list of verses
|
||||||
|
and their attributes.
|
||||||
|
"""
|
||||||
|
xml_iter = self.song_xml.getiterator()
|
||||||
|
verse_list = []
|
||||||
|
for element in xml_iter:
|
||||||
|
if element.tag == u'verse':
|
||||||
|
if element.text is None:
|
||||||
|
element.text = u''
|
||||||
|
verse_list.append([element.attrib, unicode(element.text)])
|
||||||
|
return verse_list
|
||||||
|
|
||||||
|
def dump_xml(self):
|
||||||
|
"""
|
||||||
|
Debugging aid to dump XML so that we can see what we have.
|
||||||
|
"""
|
||||||
|
return etree.dump(self.song_xml)
|
||||||
|
|
||||||
from lxml import objectify
|
|
||||||
from lxml.etree import XMLSyntaxError
|
|
||||||
|
|
||||||
class LyricsXML(object):
|
class LyricsXML(object):
|
||||||
"""
|
"""
|
||||||
This class represents the XML in the ``lyrics`` field of a song.
|
This class represents the XML in the ``lyrics`` field of a song.
|
||||||
|
|
||||||
The basic XML looks like this::
|
|
||||||
|
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<song version="1.0">
|
|
||||||
<lyrics language="en">
|
|
||||||
<verse type="chorus" label="1">
|
|
||||||
<![CDATA[ ... ]]>
|
|
||||||
</verse>
|
|
||||||
</lyrics>
|
|
||||||
</song>
|
|
||||||
"""
|
"""
|
||||||
def __init__(self, song=None):
|
def __init__(self, song=None):
|
||||||
if song:
|
if song:
|
||||||
@ -74,7 +174,7 @@ class LyricsXML(object):
|
|||||||
})
|
})
|
||||||
self.lyrics.append(language)
|
self.lyrics.append(language)
|
||||||
return True
|
return True
|
||||||
except XMLSyntaxError:
|
except etree.XMLSyntaxError:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def extract(self, text):
|
def extract(self, text):
|
||||||
@ -136,4 +236,3 @@ class LyricsXML(object):
|
|||||||
song_output = u'<?xml version="1.0" encoding="UTF-8"?>' + \
|
song_output = u'<?xml version="1.0" encoding="UTF-8"?>' + \
|
||||||
u'<song version="1.0">%s</song>' % lyrics_output
|
u'<song version="1.0">%s</song>' % lyrics_output
|
||||||
return song_output
|
return song_output
|
||||||
|
|
||||||
|
@ -1,116 +0,0 @@
|
|||||||
# -*- coding: utf-8 -*-
|
|
||||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
# OpenLP - Open Source Lyrics Projection #
|
|
||||||
# --------------------------------------------------------------------------- #
|
|
||||||
# Copyright (c) 2008-2010 Raoul Snyman #
|
|
||||||
# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael #
|
|
||||||
# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin #
|
|
||||||
# Thompson, Jon Tibble, Carsten Tinggaard #
|
|
||||||
# --------------------------------------------------------------------------- #
|
|
||||||
# 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 logging
|
|
||||||
|
|
||||||
from openlp.core.lib.db import Manager
|
|
||||||
from openlp.plugins.songs.lib.db import init_schema, Song, Author
|
|
||||||
#from openlp.plugins.songs.lib import OpenLyricsSong, OpenSongSong, CCLISong, \
|
|
||||||
# CSVSong
|
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
|
||||||
|
|
||||||
class SongFormat(object):
|
|
||||||
"""
|
|
||||||
This is a special enumeration class that holds the various types of songs,
|
|
||||||
plus a few helper functions to facilitate generic handling of song types
|
|
||||||
for importing.
|
|
||||||
"""
|
|
||||||
Unknown = -1
|
|
||||||
OpenLyrics = 0
|
|
||||||
OpenSong = 1
|
|
||||||
CCLI = 2
|
|
||||||
CSV = 3
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def get_class(id):
|
|
||||||
"""
|
|
||||||
Return the appropriate imeplementation class.
|
|
||||||
|
|
||||||
``id``
|
|
||||||
The song format.
|
|
||||||
"""
|
|
||||||
# if id == SongFormat.OpenLyrics:
|
|
||||||
# return OpenLyricsSong
|
|
||||||
# elif id == SongFormat.OpenSong:
|
|
||||||
# return OpenSongSong
|
|
||||||
# elif id == SongFormat.CCLI:
|
|
||||||
# return CCLISong
|
|
||||||
# elif id == SongFormat.CSV:
|
|
||||||
# return CSVSong
|
|
||||||
# else:
|
|
||||||
return None
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def list():
|
|
||||||
"""
|
|
||||||
Return a list of the supported song formats.
|
|
||||||
"""
|
|
||||||
return [
|
|
||||||
SongFormat.OpenLyrics,
|
|
||||||
SongFormat.OpenSong,
|
|
||||||
SongFormat.CCLI,
|
|
||||||
SongFormat.CSV
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
class SongManager(Manager):
|
|
||||||
"""
|
|
||||||
The Song Manager provides a central location for all database code. This
|
|
||||||
class takes care of connecting to the database and running all the queries.
|
|
||||||
"""
|
|
||||||
log.info(u'Song manager loaded')
|
|
||||||
|
|
||||||
def __init__(self):
|
|
||||||
"""
|
|
||||||
Creates the connection to the database, and creates the tables if they
|
|
||||||
don't exist.
|
|
||||||
"""
|
|
||||||
log.debug(u'Song Initialising')
|
|
||||||
Manager.__init__(self, u'songs', init_schema)
|
|
||||||
log.debug(u'Song Initialised')
|
|
||||||
|
|
||||||
def search_song_title(self, keywords):
|
|
||||||
"""
|
|
||||||
Searches the song title for keywords.
|
|
||||||
"""
|
|
||||||
return self.session.query(Song).filter(
|
|
||||||
Song.search_title.like(u'%' + keywords + u'%')).order_by(
|
|
||||||
Song.search_title.asc()).all()
|
|
||||||
|
|
||||||
def search_song_lyrics(self, keywords):
|
|
||||||
"""
|
|
||||||
Searches the song lyrics for keywords.
|
|
||||||
"""
|
|
||||||
return self.session.query(Song).filter(
|
|
||||||
Song.search_lyrics.like(u'%' + keywords + u'%')).order_by(
|
|
||||||
Song.search_lyrics.asc()).all()
|
|
||||||
|
|
||||||
def get_song_from_author(self, keywords):
|
|
||||||
"""
|
|
||||||
Searches the song authors for keywords.
|
|
||||||
"""
|
|
||||||
return self.session.query(Author).filter(Author.display_name.like(
|
|
||||||
u'%' + keywords + u'%')).order_by(Author.display_name.asc()).all()
|
|
@ -27,11 +27,12 @@ import logging
|
|||||||
|
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
from openlp.core.lib import MediaManagerItem, SongXMLParser, \
|
from openlp.core.lib import MediaManagerItem, BaseListWithDnD, Receiver, \
|
||||||
BaseListWithDnD, Receiver, ItemCapabilities, translate, check_item_selected
|
ItemCapabilities, translate, check_item_selected
|
||||||
from openlp.plugins.songs.forms import EditSongForm, SongMaintenanceForm, \
|
from openlp.plugins.songs.forms import EditSongForm, SongMaintenanceForm, \
|
||||||
ImportWizardForm
|
ImportWizardForm
|
||||||
from openlp.plugins.songs.lib.db import Song
|
from openlp.plugins.songs.lib import SongXMLParser
|
||||||
|
from openlp.plugins.songs.lib.db import Author, Song
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -165,18 +166,21 @@ class SongMediaItem(MediaManagerItem):
|
|||||||
search_type = self.SearchTypeComboBox.currentIndex()
|
search_type = self.SearchTypeComboBox.currentIndex()
|
||||||
if search_type == 0:
|
if search_type == 0:
|
||||||
log.debug(u'Titles Search')
|
log.debug(u'Titles Search')
|
||||||
search_results = self.parent.manager.search_song_title(
|
search_results = self.parent.manager.get_all_objects_filtered(Song,
|
||||||
search_keywords)
|
Song.search_title.like(u'%' + search_keywords + u'%'),
|
||||||
|
Song.search_title.asc())
|
||||||
self.displayResultsSong(search_results)
|
self.displayResultsSong(search_results)
|
||||||
elif search_type == 1:
|
elif search_type == 1:
|
||||||
log.debug(u'Lyrics Search')
|
log.debug(u'Lyrics Search')
|
||||||
search_results = self.parent.manager.search_song_lyrics(
|
search_results = self.parent.manager.get_all_objects_filtered(Song,
|
||||||
search_keywords)
|
Song.search_lyrics.like(u'%' + search_keywords + u'%'),
|
||||||
|
Song.search_lyrics.asc())
|
||||||
self.displayResultsSong(search_results)
|
self.displayResultsSong(search_results)
|
||||||
elif search_type == 2:
|
elif search_type == 2:
|
||||||
log.debug(u'Authors Search')
|
log.debug(u'Authors Search')
|
||||||
search_results = self.parent.manager.get_song_from_author(
|
search_results = self.parent.manager.get_all_objects_filtered(
|
||||||
search_keywords)
|
Author, Author.display_name.like(u'%' + search_keywords + u'%'),
|
||||||
|
Author.display_name.asc())
|
||||||
self.displayResultsAuthor(search_results)
|
self.displayResultsAuthor(search_results)
|
||||||
#Called to redisplay the song list screen edith from a search
|
#Called to redisplay the song list screen edith from a search
|
||||||
#or from the exit of the Song edit dialog. If remote editing is active
|
#or from the exit of the Song edit dialog. If remote editing is active
|
||||||
@ -368,7 +372,8 @@ class SongMediaItem(MediaManagerItem):
|
|||||||
author_list = author_list + unicode(author.display_name)
|
author_list = author_list + unicode(author.display_name)
|
||||||
author_audit.append(unicode(author.display_name))
|
author_audit.append(unicode(author.display_name))
|
||||||
if song.ccli_number is None or len(song.ccli_number) == 0:
|
if song.ccli_number is None or len(song.ccli_number) == 0:
|
||||||
ccli = self.parent.settings_form.GeneralTab.CCLINumber
|
ccli = QtCore.QSettings().value(u'general/ccli number',
|
||||||
|
QtCore.QVariant(u'')).toString()
|
||||||
else:
|
else:
|
||||||
ccli = unicode(song.ccli_number)
|
ccli = unicode(song.ccli_number)
|
||||||
raw_footer.append(song.title)
|
raw_footer.append(song.title)
|
||||||
|
@ -25,8 +25,8 @@
|
|||||||
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from openlp.core.lib import SongXMLBuilder, translate
|
from openlp.core.lib import translate
|
||||||
from openlp.plugins.songs.lib import VerseType
|
from openlp.plugins.songs.lib import SongXMLBuilder, VerseType
|
||||||
from openlp.plugins.songs.lib.db import Song, Author, Topic, Book
|
from openlp.plugins.songs.lib.db import Song, Author, Topic, Book
|
||||||
|
|
||||||
class SongImport(object):
|
class SongImport(object):
|
||||||
@ -276,8 +276,6 @@ class SongImport(object):
|
|||||||
song.song_number = self.song_number
|
song.song_number = self.song_number
|
||||||
song.search_lyrics = u''
|
song.search_lyrics = u''
|
||||||
sxml = SongXMLBuilder()
|
sxml = SongXMLBuilder()
|
||||||
sxml.new_document()
|
|
||||||
sxml.add_lyrics_to_song()
|
|
||||||
for (versetag, versetext) in self.verses:
|
for (versetag, versetext) in self.verses:
|
||||||
if versetag[0] == u'C':
|
if versetag[0] == u'C':
|
||||||
versetype = VerseType.to_string(VerseType.Chorus)
|
versetype = VerseType.to_string(VerseType.Chorus)
|
||||||
@ -302,7 +300,8 @@ class SongImport(object):
|
|||||||
song.theme_name = self.theme_name
|
song.theme_name = self.theme_name
|
||||||
song.ccli_number = self.ccli_number
|
song.ccli_number = self.ccli_number
|
||||||
for authortext in self.authors:
|
for authortext in self.authors:
|
||||||
author = self.manager.get_object_filtered(Author, Author.display_name == authortext)
|
author = self.manager.get_object_filtered(Author,
|
||||||
|
Author.display_name == authortext)
|
||||||
if author is None:
|
if author is None:
|
||||||
author = Author()
|
author = Author()
|
||||||
author.display_name = authortext
|
author.display_name = authortext
|
||||||
@ -311,7 +310,8 @@ class SongImport(object):
|
|||||||
self.manager.save_object(author)
|
self.manager.save_object(author)
|
||||||
song.authors.append(author)
|
song.authors.append(author)
|
||||||
if self.song_book_name:
|
if self.song_book_name:
|
||||||
song_book = self.manager.get_object_filtered(Book, Book.name == self.song_book_name)
|
song_book = self.manager.get_object_filtered(Book,
|
||||||
|
Book.name == self.song_book_name)
|
||||||
if song_book is None:
|
if song_book is None:
|
||||||
song_book = Book()
|
song_book = Book()
|
||||||
song_book.name = self.song_book_name
|
song_book.name = self.song_book_name
|
||||||
|
@ -24,18 +24,18 @@
|
|||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
import sys
|
#import sys
|
||||||
import os
|
#import os
|
||||||
|
|
||||||
from types import ListType
|
from types import ListType
|
||||||
|
from xml.etree.ElementTree import ElementTree, XML
|
||||||
|
|
||||||
sys.path.append(os.path.abspath(u'./../../../..'))
|
# Do we need these two lines?
|
||||||
|
#sys.path.append(os.path.abspath(u'./../../../..'))
|
||||||
from openlp.core.lib import XmlRootClass
|
#sys.path.append(os.path.abspath(os.path.join(u'.', u'..', u'..')))
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class SongException(Exception):
|
class SongException(Exception):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@ -74,23 +74,78 @@ _BLANK_OPENSONG_XML = \
|
|||||||
</song>
|
</song>
|
||||||
'''
|
'''
|
||||||
|
|
||||||
class _OpenSong(XmlRootClass):
|
class _OpenSong(object):
|
||||||
"""Class for import of OpenSong"""
|
"""
|
||||||
|
Class for import of OpenSong
|
||||||
|
"""
|
||||||
def __init__(self, xmlContent = None):
|
def __init__(self, xmlContent = None):
|
||||||
"""Initialize from given xml content"""
|
"""
|
||||||
super(_OpenSong, self).__init__()
|
Initialize from given xml content
|
||||||
self.from_buffer(xmlContent)
|
"""
|
||||||
|
self._set_from_xml(_BLANK_OPENSONG_XML, 'song')
|
||||||
def _reset(self):
|
|
||||||
"""Reset all song attributes"""
|
|
||||||
self._setFromXml(_BLANK_OPENSONG_XML, 'song')
|
|
||||||
|
|
||||||
def from_buffer(self, xmlContent):
|
|
||||||
"""Initialize from buffer(string) with xml content"""
|
|
||||||
self._reset()
|
|
||||||
if xmlContent:
|
if xmlContent:
|
||||||
self._setFromXml(xmlContent, 'song')
|
self._set_from_xml(xmlContent, 'song')
|
||||||
|
|
||||||
|
def _set_from_xml(self, xml, root_tag):
|
||||||
|
"""
|
||||||
|
Set song properties from given xml content.
|
||||||
|
|
||||||
|
``xml``
|
||||||
|
Formatted xml tags and values.
|
||||||
|
``root_tag``
|
||||||
|
The root tag of the xml.
|
||||||
|
"""
|
||||||
|
root = ElementTree(element=XML(xml))
|
||||||
|
xml_iter = root.getiterator()
|
||||||
|
for element in xml_iter:
|
||||||
|
if element.tag != root_tag:
|
||||||
|
text = element.text
|
||||||
|
if text is None:
|
||||||
|
val = text
|
||||||
|
elif isinstance(text, basestring):
|
||||||
|
# Strings need special handling to sort the colours out
|
||||||
|
if text[0] == u'$':
|
||||||
|
# This might be a hex number, let's try to convert it.
|
||||||
|
try:
|
||||||
|
val = int(text[1:], 16)
|
||||||
|
except ValueError:
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
# Let's just see if it's a integer.
|
||||||
|
try:
|
||||||
|
val = int(text)
|
||||||
|
except ValueError:
|
||||||
|
# Ok, it seems to be a string.
|
||||||
|
val = text
|
||||||
|
if hasattr(self, u'post_tag_hook'):
|
||||||
|
(element.tag, val) = \
|
||||||
|
self.post_tag_hook(element.tag, val)
|
||||||
|
setattr(self, element.tag, val)
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
"""
|
||||||
|
Return string with all public attributes
|
||||||
|
|
||||||
|
The string is formatted with one attribute per line
|
||||||
|
If the string is split on newline then the length of the
|
||||||
|
list is equal to the number of attributes
|
||||||
|
"""
|
||||||
|
attributes = []
|
||||||
|
for attrib in dir(self):
|
||||||
|
if not attrib.startswith(u'_'):
|
||||||
|
attributes.append(
|
||||||
|
u'%30s : %s' % (attrib, getattr(self, attrib)))
|
||||||
|
return u'\n'.join(attributes)
|
||||||
|
|
||||||
|
def _get_as_string(self):
|
||||||
|
"""
|
||||||
|
Return one string with all public attributes
|
||||||
|
"""
|
||||||
|
result = u''
|
||||||
|
for attrib in dir(self):
|
||||||
|
if not attrib.startswith(u'_'):
|
||||||
|
result += u'_%s_' % getattr(self, attrib)
|
||||||
|
return result
|
||||||
|
|
||||||
def get_author_list(self):
|
def get_author_list(self):
|
||||||
"""Convert author field to an authorlist
|
"""Convert author field to an authorlist
|
||||||
@ -252,14 +307,6 @@ class Song(object):
|
|||||||
self.set_lyrics(u'')
|
self.set_lyrics(u'')
|
||||||
return
|
return
|
||||||
|
|
||||||
def set_songid(self, songid):
|
|
||||||
"""Set the songid for the database"""
|
|
||||||
self.songid = songid
|
|
||||||
|
|
||||||
def get_songid(self):
|
|
||||||
"""Return the songid for the database"""
|
|
||||||
return self.songid
|
|
||||||
|
|
||||||
def from_opensong_buffer(self, xmlcontent):
|
def from_opensong_buffer(self, xmlcontent):
|
||||||
"""Initialize from buffer(string) of xml lines in opensong format"""
|
"""Initialize from buffer(string) of xml lines in opensong format"""
|
||||||
self._reset()
|
self._reset()
|
||||||
@ -323,10 +370,6 @@ class Song(object):
|
|||||||
"""Return title value"""
|
"""Return title value"""
|
||||||
return self.title
|
return self.title
|
||||||
|
|
||||||
def get_search_title(self):
|
|
||||||
"""Return search_title"""
|
|
||||||
return self.search_title
|
|
||||||
|
|
||||||
def from_ccli_text_buffer(self, textList):
|
def from_ccli_text_buffer(self, textList):
|
||||||
"""
|
"""
|
||||||
Create song from a list of texts (strings) - CCLI text format expected
|
Create song from a list of texts (strings) - CCLI text format expected
|
||||||
|
@ -29,8 +29,9 @@ from PyQt4 import QtCore, QtGui
|
|||||||
|
|
||||||
from openlp.core.lib import Plugin, build_icon, PluginStatus, Receiver, \
|
from openlp.core.lib import Plugin, build_icon, PluginStatus, Receiver, \
|
||||||
translate
|
translate
|
||||||
from openlp.plugins.songs.lib import SongManager, SongMediaItem, SongsTab
|
from openlp.core.lib.db import Manager
|
||||||
from openlp.plugins.songs.lib.db import Song
|
from openlp.plugins.songs.lib import SongMediaItem, SongsTab
|
||||||
|
from openlp.plugins.songs.lib.db import init_schema, Song
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from openlp.plugins.songs.lib import SofImport, OooImport
|
from openlp.plugins.songs.lib import SofImport, OooImport
|
||||||
@ -58,35 +59,27 @@ class SongsPlugin(Plugin):
|
|||||||
"""
|
"""
|
||||||
Plugin.__init__(self, u'Songs', u'1.9.2', plugin_helpers)
|
Plugin.__init__(self, u'Songs', u'1.9.2', plugin_helpers)
|
||||||
self.weight = -10
|
self.weight = -10
|
||||||
self.manager = SongManager()
|
self.manager = Manager(u'songs', init_schema)
|
||||||
self.icon = build_icon(u':/plugins/plugin_songs.png')
|
self.icon = build_icon(u':/plugins/plugin_songs.png')
|
||||||
self.status = PluginStatus.Active
|
self.status = PluginStatus.Active
|
||||||
|
|
||||||
def get_settings_tab(self):
|
def getSettingsTab(self):
|
||||||
return SongsTab(self.name)
|
return SongsTab(self.name)
|
||||||
|
|
||||||
def initialise(self):
|
def initialise(self):
|
||||||
log.info(u'Songs Initialising')
|
log.info(u'Songs Initialising')
|
||||||
#if self.songmanager is None:
|
|
||||||
# self.songmanager = SongManager()
|
|
||||||
Plugin.initialise(self)
|
Plugin.initialise(self)
|
||||||
self.insert_toolbox_item()
|
self.mediaItem.displayResultsSong(
|
||||||
self.media_item.displayResultsSong(
|
|
||||||
self.manager.get_all_objects(Song, Song.title))
|
self.manager.get_all_objects(Song, Song.title))
|
||||||
|
|
||||||
def finalise(self):
|
def getMediaManagerItem(self):
|
||||||
log.info(u'Plugin Finalise')
|
|
||||||
Plugin.finalise(self)
|
|
||||||
self.remove_toolbox_item()
|
|
||||||
|
|
||||||
def get_media_manager_item(self):
|
|
||||||
"""
|
"""
|
||||||
Create the MediaManagerItem object, which is displaed in the
|
Create the MediaManagerItem object, which is displaed in the
|
||||||
Media Manager.
|
Media Manager.
|
||||||
"""
|
"""
|
||||||
return SongMediaItem(self, self.icon, self.name)
|
return SongMediaItem(self, self.icon, self.name)
|
||||||
|
|
||||||
def add_import_menu_item(self, import_menu):
|
def addImportMenuItem(self, import_menu):
|
||||||
"""
|
"""
|
||||||
Give the Songs plugin the opportunity to add items to the
|
Give the Songs plugin the opportunity to add items to the
|
||||||
**Import** menu.
|
**Import** menu.
|
||||||
@ -165,7 +158,7 @@ class SongsPlugin(Plugin):
|
|||||||
QtCore.SIGNAL(u'triggered()'), self.onImportOpenSongItemClick)
|
QtCore.SIGNAL(u'triggered()'), self.onImportOpenSongItemClick)
|
||||||
|
|
||||||
|
|
||||||
def add_export_menu_item(self, export_menu):
|
def addExportMenuItem(self, export_menu):
|
||||||
"""
|
"""
|
||||||
Give the Songs plugin the opportunity to add items to the
|
Give the Songs plugin the opportunity to add items to the
|
||||||
**Export** menu.
|
**Export** menu.
|
||||||
@ -239,8 +232,8 @@ class SongsPlugin(Plugin):
|
|||||||
'This plugin allows songs to be managed and displayed.')
|
'This plugin allows songs to be managed and displayed.')
|
||||||
return about_text
|
return about_text
|
||||||
|
|
||||||
def can_delete_theme(self, theme):
|
def canDeleteTheme(self, theme):
|
||||||
filter_string = u'theme_name=\'%s\'' % theme
|
if not self.manager.get_all_objects_filtered(Song,
|
||||||
if not self.manager.get_all_objects_filtered(Song, filter_string):
|
Song.theme_name == theme):
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
@ -46,7 +46,7 @@ class SongUsagePlugin(Plugin):
|
|||||||
self.songusagemanager = None
|
self.songusagemanager = None
|
||||||
self.songusageActive = False
|
self.songusageActive = False
|
||||||
|
|
||||||
def add_tools_menu_item(self, tools_menu):
|
def addToolsMenuItem(self, tools_menu):
|
||||||
"""
|
"""
|
||||||
Give the SongUsage plugin the opportunity to add items to the
|
Give the SongUsage plugin the opportunity to add items to the
|
||||||
**Tools** menu.
|
**Tools** menu.
|
||||||
@ -162,4 +162,4 @@ class SongUsagePlugin(Plugin):
|
|||||||
'<b>SongUsage Plugin</b><br>This plugin '
|
'<b>SongUsage Plugin</b><br>This plugin '
|
||||||
'records the use of songs and when they have been used during '
|
'records the use of songs and when they have been used during '
|
||||||
'a live service')
|
'a live service')
|
||||||
return about_text
|
return about_text
|
Loading…
Reference in New Issue
Block a user