forked from openlp/openlp
Head 1180
This commit is contained in:
commit
e74f46a126
@ -84,7 +84,8 @@ html_expands.append({u'desc': u'Underline', u'start tag': u'{u}',
|
|||||||
u'start html': u'<span style="text-decoration: underline;">',
|
u'start html': u'<span style="text-decoration: underline;">',
|
||||||
u'end tag': u'{/u}', u'end html': u'</span>', u'protected': True})
|
u'end tag': u'{/u}', u'end html': u'</span>', u'protected': True})
|
||||||
|
|
||||||
def translate(context, text, comment=None):
|
def translate(context, text, comment=None,
|
||||||
|
encoding=QtCore.QCoreApplication.CodecForTr, n=-1):
|
||||||
"""
|
"""
|
||||||
A special shortcut method to wrap around the Qt4 translation functions.
|
A special shortcut method to wrap around the Qt4 translation functions.
|
||||||
This abstracts the translation procedure so that we can change it if at a
|
This abstracts the translation procedure so that we can change it if at a
|
||||||
@ -101,7 +102,7 @@ def translate(context, text, comment=None):
|
|||||||
An identifying string for when the same text is used in different roles
|
An identifying string for when the same text is used in different roles
|
||||||
within the same context.
|
within the same context.
|
||||||
"""
|
"""
|
||||||
return QtCore.QCoreApplication.translate(context, text, comment)
|
return QtCore.QCoreApplication.translate(context, text, comment, encoding, n)
|
||||||
|
|
||||||
def get_text_file_string(text_file):
|
def get_text_file_string(text_file):
|
||||||
"""
|
"""
|
||||||
@ -325,4 +326,4 @@ from dockwidget import OpenLPDockWidget
|
|||||||
from renderer import Renderer
|
from renderer import Renderer
|
||||||
from rendermanager import RenderManager
|
from rendermanager import RenderManager
|
||||||
from mediamanageritem import MediaManagerItem
|
from mediamanageritem import MediaManagerItem
|
||||||
from baselistwithdnd import BaseListWithDnD
|
from baselistwithdnd import BaseListWithDnD
|
||||||
|
@ -278,4 +278,4 @@ class Receiver(object):
|
|||||||
"""
|
"""
|
||||||
Get the global ``eventreceiver`` instance.
|
Get the global ``eventreceiver`` instance.
|
||||||
"""
|
"""
|
||||||
return Receiver.eventreceiver
|
return Receiver.eventreceiver
|
||||||
|
@ -284,34 +284,30 @@ class MediaManagerItem(QtGui.QWidget):
|
|||||||
self.listView.addAction(
|
self.listView.addAction(
|
||||||
context_menu_action(
|
context_menu_action(
|
||||||
self.listView, u':/general/general_edit.png',
|
self.listView, u':/general/general_edit.png',
|
||||||
unicode(translate('OpenLP.MediaManagerItem', '&Edit %s')) %
|
self.plugin.getString(StringContent.Edit)[u'title'],
|
||||||
name_string[u'singular'],
|
|
||||||
self.onEditClick))
|
self.onEditClick))
|
||||||
self.listView.addAction(context_menu_separator(self.listView))
|
self.listView.addAction(context_menu_separator(self.listView))
|
||||||
if self.hasDeleteIcon:
|
if self.hasDeleteIcon:
|
||||||
self.listView.addAction(
|
self.listView.addAction(
|
||||||
context_menu_action(
|
context_menu_action(
|
||||||
self.listView, u':/general/general_delete.png',
|
self.listView, u':/general/general_delete.png',
|
||||||
unicode(translate('OpenLP.MediaManagerItem',
|
self.plugin.getString(StringContent.Delete)[u'title'],
|
||||||
'&Delete %s')) %
|
|
||||||
name_string[u'singular'],
|
|
||||||
self.onDeleteClick))
|
self.onDeleteClick))
|
||||||
self.listView.addAction(context_menu_separator(self.listView))
|
self.listView.addAction(context_menu_separator(self.listView))
|
||||||
self.listView.addAction(
|
self.listView.addAction(
|
||||||
context_menu_action(
|
context_menu_action(
|
||||||
self.listView, u':/general/general_preview.png',
|
self.listView, u':/general/general_preview.png',
|
||||||
unicode(translate('OpenLP.MediaManagerItem', '&Preview %s')) %
|
self.plugin.getString(StringContent.Preview)[u'title'],
|
||||||
name_string[u'singular'],
|
|
||||||
self.onPreviewClick))
|
self.onPreviewClick))
|
||||||
self.listView.addAction(
|
self.listView.addAction(
|
||||||
context_menu_action(
|
context_menu_action(
|
||||||
self.listView, u':/general/general_live.png',
|
self.listView, u':/general/general_live.png',
|
||||||
translate('OpenLP.MediaManagerItem', '&Show Live'),
|
self.plugin.getString(StringContent.Live)[u'title'],
|
||||||
self.onLiveClick))
|
self.onLiveClick))
|
||||||
self.listView.addAction(
|
self.listView.addAction(
|
||||||
context_menu_action(
|
context_menu_action(
|
||||||
self.listView, u':/general/general_add.png',
|
self.listView, u':/general/general_add.png',
|
||||||
translate('OpenLP.MediaManagerItem', '&Add to Service'),
|
self.plugin.getString(StringContent.Service)[u'title'],
|
||||||
self.onAddClick))
|
self.onAddClick))
|
||||||
if self.addToServiceItem:
|
if self.addToServiceItem:
|
||||||
self.listView.addAction(
|
self.listView.addAction(
|
||||||
|
@ -135,7 +135,9 @@ class ExceptionForm(QtGui.QDialog, Ui_ExceptionDialog):
|
|||||||
'--- Please enter the report below this line. ---\n\n\n'
|
'--- Please enter the report below this line. ---\n\n\n'
|
||||||
'--- Exception Traceback ---\n%s\n'
|
'--- Exception Traceback ---\n%s\n'
|
||||||
'--- System information ---\n%s\n'
|
'--- System information ---\n%s\n'
|
||||||
'--- Library Versions ---\n%s\n'))
|
'--- Library Versions ---\n%s\n',
|
||||||
|
'Please add the information that bug reports are favoured written '
|
||||||
|
'in English.'))
|
||||||
content = self._createReport()
|
content = self._createReport()
|
||||||
for line in content[1].split(u'\n'):
|
for line in content[1].split(u'\n'):
|
||||||
if re.search(r'[/\\]openlp[/\\]', line):
|
if re.search(r'[/\\]openlp[/\\]', line):
|
||||||
|
@ -560,16 +560,16 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
|||||||
QtCore.QObject.connect(self.SettingsShortcutsItem,
|
QtCore.QObject.connect(self.SettingsShortcutsItem,
|
||||||
QtCore.SIGNAL(u'triggered()'), self.onSettingsShortcutsItemClicked)
|
QtCore.SIGNAL(u'triggered()'), self.onSettingsShortcutsItemClicked)
|
||||||
QtCore.QObject.connect(self.FileNewItem, QtCore.SIGNAL(u'triggered()'),
|
QtCore.QObject.connect(self.FileNewItem, QtCore.SIGNAL(u'triggered()'),
|
||||||
self.ServiceManagerContents.onNewService)
|
self.ServiceManagerContents.onNewServiceClicked)
|
||||||
QtCore.QObject.connect(self.FileOpenItem,
|
QtCore.QObject.connect(self.FileOpenItem,
|
||||||
QtCore.SIGNAL(u'triggered()'),
|
QtCore.SIGNAL(u'triggered()'),
|
||||||
self.ServiceManagerContents.onLoadService)
|
self.ServiceManagerContents.onLoadServiceClicked)
|
||||||
QtCore.QObject.connect(self.FileSaveItem,
|
QtCore.QObject.connect(self.FileSaveItem,
|
||||||
QtCore.SIGNAL(u'triggered()'),
|
QtCore.SIGNAL(u'triggered()'),
|
||||||
self.ServiceManagerContents.onQuickSaveService)
|
self.ServiceManagerContents.onSaveServiceClicked)
|
||||||
QtCore.QObject.connect(self.FileSaveAsItem,
|
QtCore.QObject.connect(self.FileSaveAsItem,
|
||||||
QtCore.SIGNAL(u'triggered()'),
|
QtCore.SIGNAL(u'triggered()'),
|
||||||
self.ServiceManagerContents.onSaveService)
|
self.ServiceManagerContents.onSaveServiceAsClicked)
|
||||||
# i18n set signals for languages
|
# i18n set signals for languages
|
||||||
QtCore.QObject.connect(self.AutoLanguageItem,
|
QtCore.QObject.connect(self.AutoLanguageItem,
|
||||||
QtCore.SIGNAL(u'toggled(bool)'), self.setAutoLanguage)
|
QtCore.SIGNAL(u'toggled(bool)'), self.setAutoLanguage)
|
||||||
@ -590,6 +590,14 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
|||||||
QtCore.SIGNAL(u'config_screen_changed'), self.screenChanged)
|
QtCore.SIGNAL(u'config_screen_changed'), self.screenChanged)
|
||||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||||
QtCore.SIGNAL(u'maindisplay_status_text'), self.showStatusMessage)
|
QtCore.SIGNAL(u'maindisplay_status_text'), self.showStatusMessage)
|
||||||
|
# Simple message boxes
|
||||||
|
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||||
|
QtCore.SIGNAL(u'openlp_error_message'), self.onErrorMessage)
|
||||||
|
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||||
|
QtCore.SIGNAL(u'openlp_warning_message'), self.onWarningMessage)
|
||||||
|
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||||
|
QtCore.SIGNAL(u'openlp_information_message'),
|
||||||
|
self.onInformationMessage)
|
||||||
# warning cyclic dependency
|
# warning cyclic dependency
|
||||||
# RenderManager needs to call ThemeManager and
|
# RenderManager needs to call ThemeManager and
|
||||||
# ThemeManager needs to call RenderManager
|
# ThemeManager needs to call RenderManager
|
||||||
@ -669,7 +677,8 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
|||||||
if QtCore.QSettings().value(
|
if QtCore.QSettings().value(
|
||||||
self.generalSettingsSection + u'/auto open',
|
self.generalSettingsSection + u'/auto open',
|
||||||
QtCore.QVariant(False)).toBool():
|
QtCore.QVariant(False)).toBool():
|
||||||
self.ServiceManagerContents.onLoadService(True)
|
#self.ServiceManagerContents.onLoadService(True)
|
||||||
|
self.ServiceManagerContents.loadLastFile()
|
||||||
view_mode = QtCore.QSettings().value(u'%s/view mode' % \
|
view_mode = QtCore.QSettings().value(u'%s/view mode' % \
|
||||||
self.generalSettingsSection, u'default')
|
self.generalSettingsSection, u'default')
|
||||||
if view_mode == u'default':
|
if view_mode == u'default':
|
||||||
@ -698,6 +707,15 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
|||||||
translate('OpenLP.MainWindow',
|
translate('OpenLP.MainWindow',
|
||||||
'The Main Display has been blanked out'))
|
'The Main Display has been blanked out'))
|
||||||
|
|
||||||
|
def onErrorMessage(self, data):
|
||||||
|
QtGui.QMessageBox.critical(self, data[u'title'], data[u'message'])
|
||||||
|
|
||||||
|
def onWarningMessage(self, data):
|
||||||
|
QtGui.QMessageBox.warning(self, data[u'title'], data[u'message'])
|
||||||
|
|
||||||
|
def onInformationMessage(self, data):
|
||||||
|
QtGui.QMessageBox.information(self, data[u'title'], data[u'message'])
|
||||||
|
|
||||||
def onHelpWebSiteClicked(self):
|
def onHelpWebSiteClicked(self):
|
||||||
"""
|
"""
|
||||||
Load the OpenLP website
|
Load the OpenLP website
|
||||||
@ -790,7 +808,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
|||||||
"""
|
"""
|
||||||
Hook to close the main window and display windows on exit
|
Hook to close the main window and display windows on exit
|
||||||
"""
|
"""
|
||||||
if self.serviceNotSaved:
|
if self.ServiceManagerContents.isModified():
|
||||||
ret = QtGui.QMessageBox.question(self,
|
ret = QtGui.QMessageBox.question(self,
|
||||||
translate('OpenLP.MainWindow', 'Save Changes to Service?'),
|
translate('OpenLP.MainWindow', 'Save Changes to Service?'),
|
||||||
translate('OpenLP.MainWindow', 'Your service has changed. '
|
translate('OpenLP.MainWindow', 'Your service has changed. '
|
||||||
@ -801,9 +819,12 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
|||||||
QtGui.QMessageBox.Save),
|
QtGui.QMessageBox.Save),
|
||||||
QtGui.QMessageBox.Save)
|
QtGui.QMessageBox.Save)
|
||||||
if ret == QtGui.QMessageBox.Save:
|
if ret == QtGui.QMessageBox.Save:
|
||||||
self.ServiceManagerContents.onSaveService(True)
|
#self.ServiceManagerContents.onSaveService(True)
|
||||||
self.cleanUp()
|
if self.ServiceManagerContents.saveFile():
|
||||||
event.accept()
|
self.cleanUp()
|
||||||
|
event.accept()
|
||||||
|
else:
|
||||||
|
event.ignore()
|
||||||
elif ret == QtGui.QMessageBox.Discard:
|
elif ret == QtGui.QMessageBox.Discard:
|
||||||
self.cleanUp()
|
self.cleanUp()
|
||||||
event.accept()
|
event.accept()
|
||||||
@ -812,10 +833,10 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
|||||||
else:
|
else:
|
||||||
ret = QtGui.QMessageBox.question(self,
|
ret = QtGui.QMessageBox.question(self,
|
||||||
translate('OpenLP.MainWindow', 'Close OpenLP'),
|
translate('OpenLP.MainWindow', 'Close OpenLP'),
|
||||||
translate('OpenLP.MainWindow', 'Are you sure you want to Exit?'),
|
translate('OpenLP.MainWindow',
|
||||||
|
'Are you sure you want to close OpenLP?'),
|
||||||
QtGui.QMessageBox.StandardButtons(
|
QtGui.QMessageBox.StandardButtons(
|
||||||
QtGui.QMessageBox.Yes |
|
QtGui.QMessageBox.Yes | QtGui.QMessageBox.No),
|
||||||
QtGui.QMessageBox.No),
|
|
||||||
QtGui.QMessageBox.Yes)
|
QtGui.QMessageBox.Yes)
|
||||||
if ret == QtGui.QMessageBox.Yes:
|
if ret == QtGui.QMessageBox.Yes:
|
||||||
self.cleanUp()
|
self.cleanUp()
|
||||||
@ -863,6 +884,23 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
|||||||
title = u'%s - %s*' % (self.mainTitle, service_name)
|
title = u'%s - %s*' % (self.mainTitle, service_name)
|
||||||
self.setWindowTitle(title)
|
self.setWindowTitle(title)
|
||||||
|
|
||||||
|
def setServiceModified(self, modified, fileName):
|
||||||
|
"""
|
||||||
|
This method is called from the ServiceManager to set the title of the
|
||||||
|
main window.
|
||||||
|
|
||||||
|
``modified``
|
||||||
|
Whether or not this service has been modified.
|
||||||
|
|
||||||
|
``fileName``
|
||||||
|
The file name of the service file.
|
||||||
|
"""
|
||||||
|
if modified:
|
||||||
|
title = u'%s - %s*' % (self.mainTitle, fileName)
|
||||||
|
else:
|
||||||
|
title = u'%s - %s' % (self.mainTitle, fileName)
|
||||||
|
self.setWindowTitle(title)
|
||||||
|
|
||||||
def showStatusMessage(self, message):
|
def showStatusMessage(self, message):
|
||||||
self.StatusBar.showMessage(message)
|
self.StatusBar.showMessage(message)
|
||||||
|
|
||||||
@ -964,11 +1002,12 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
|||||||
if recentFilesToDisplay:
|
if recentFilesToDisplay:
|
||||||
self.FileMenu.addSeparator()
|
self.FileMenu.addSeparator()
|
||||||
for fileId, filename in enumerate(recentFilesToDisplay):
|
for fileId, filename in enumerate(recentFilesToDisplay):
|
||||||
action = QtGui.QAction(u'&%d %s' % (fileId +1,
|
log.debug('Recent file name: %s', filename)
|
||||||
|
action = QtGui.QAction(u'&%d %s' % (fileId + 1,
|
||||||
QtCore.QFileInfo(filename).fileName()), self)
|
QtCore.QFileInfo(filename).fileName()), self)
|
||||||
action.setData(QtCore.QVariant(filename))
|
action.setData(QtCore.QVariant(filename))
|
||||||
self.connect(action, QtCore.SIGNAL(u'triggered()'),
|
self.connect(action, QtCore.SIGNAL(u'triggered()'),
|
||||||
self.ServiceManagerContents.loadService)
|
self.ServiceManagerContents.onRecentServiceClicked)
|
||||||
self.FileMenu.addAction(action)
|
self.FileMenu.addAction(action)
|
||||||
self.FileMenu.addSeparator()
|
self.FileMenu.addSeparator()
|
||||||
self.FileMenu.addAction(self.FileMenuActions[-1])
|
self.FileMenu.addAction(self.FileMenuActions[-1])
|
||||||
|
@ -37,7 +37,7 @@ from openlp.core.lib import OpenLPToolbar, ServiceItem, context_menu_action, \
|
|||||||
Receiver, build_icon, ItemCapabilities, SettingsManager, translate, \
|
Receiver, build_icon, ItemCapabilities, SettingsManager, translate, \
|
||||||
ThemeLevel
|
ThemeLevel
|
||||||
from openlp.core.ui import ServiceNoteForm, ServiceItemEditForm
|
from openlp.core.ui import ServiceNoteForm, ServiceItemEditForm
|
||||||
from openlp.core.utils import AppLocation
|
from openlp.core.utils import AppLocation, split_filename
|
||||||
|
|
||||||
class ServiceManagerList(QtGui.QTreeWidget):
|
class ServiceManagerList(QtGui.QTreeWidget):
|
||||||
"""
|
"""
|
||||||
@ -90,6 +90,7 @@ class ServiceManagerList(QtGui.QTreeWidget):
|
|||||||
mimeData.setText(u'ServiceManager')
|
mimeData.setText(u'ServiceManager')
|
||||||
drag.start(QtCore.Qt.CopyAction)
|
drag.start(QtCore.Qt.CopyAction)
|
||||||
|
|
||||||
|
|
||||||
class ServiceManager(QtGui.QWidget):
|
class ServiceManager(QtGui.QWidget):
|
||||||
"""
|
"""
|
||||||
Manages the services. This involves taking text strings from plugins and
|
Manages the services. This involves taking text strings from plugins and
|
||||||
@ -101,15 +102,16 @@ class ServiceManager(QtGui.QWidget):
|
|||||||
"""
|
"""
|
||||||
Sets up the service manager, toolbars, list view, et al.
|
Sets up the service manager, toolbars, list view, et al.
|
||||||
"""
|
"""
|
||||||
QtGui.QWidget.__init__(self)
|
QtGui.QWidget.__init__(self, parent)
|
||||||
self.parent = parent
|
self.parent = parent
|
||||||
self.serviceItems = []
|
self.serviceItems = []
|
||||||
self.serviceName = u''
|
self.serviceName = u''
|
||||||
self.suffixes = []
|
self.suffixes = []
|
||||||
self.droppos = 0
|
self.dropPosition = 0
|
||||||
self.expandTabs = False
|
self.expandTabs = False
|
||||||
#is a new service and has not been saved
|
#is a new service and has not been saved
|
||||||
self.isNew = True
|
self._modified = False
|
||||||
|
self._fileName = u''
|
||||||
self.serviceNoteForm = ServiceNoteForm(self.parent)
|
self.serviceNoteForm = ServiceNoteForm(self.parent)
|
||||||
self.serviceItemEditForm = ServiceItemEditForm(self.parent)
|
self.serviceItemEditForm = ServiceItemEditForm(self.parent)
|
||||||
#start with the layout
|
#start with the layout
|
||||||
@ -123,17 +125,17 @@ class ServiceManager(QtGui.QWidget):
|
|||||||
translate('OpenLP.ServiceManager', 'New Service'),
|
translate('OpenLP.ServiceManager', 'New Service'),
|
||||||
u':/general/general_new.png',
|
u':/general/general_new.png',
|
||||||
translate('OpenLP.ServiceManager', 'Create a new service'),
|
translate('OpenLP.ServiceManager', 'Create a new service'),
|
||||||
self.onNewService)
|
self.onNewServiceClicked)
|
||||||
self.toolbar.addToolbarButton(
|
self.toolbar.addToolbarButton(
|
||||||
translate('OpenLP.ServiceManager', 'Open Service'),
|
translate('OpenLP.ServiceManager', 'Open Service'),
|
||||||
u':/general/general_open.png',
|
u':/general/general_open.png',
|
||||||
translate('OpenLP.ServiceManager', 'Load an existing service'),
|
translate('OpenLP.ServiceManager', 'Load an existing service'),
|
||||||
self.onLoadService)
|
self.onLoadServiceClicked)
|
||||||
self.toolbar.addToolbarButton(
|
self.toolbar.addToolbarButton(
|
||||||
translate('OpenLP.ServiceManager', 'Save Service'),
|
translate('OpenLP.ServiceManager', 'Save Service'),
|
||||||
u':/general/general_save.png',
|
u':/general/general_save.png',
|
||||||
translate('OpenLP.ServiceManager', 'Save this service'),
|
translate('OpenLP.ServiceManager', 'Save this service'),
|
||||||
self.onQuickSaveService)
|
self.onSaveServiceClicked)
|
||||||
self.toolbar.addSeparator()
|
self.toolbar.addSeparator()
|
||||||
self.themeLabel = QtGui.QLabel(translate('OpenLP.ServiceManager',
|
self.themeLabel = QtGui.QLabel(translate('OpenLP.ServiceManager',
|
||||||
'Theme:'), self)
|
'Theme:'), self)
|
||||||
@ -282,6 +284,40 @@ class ServiceManager(QtGui.QWidget):
|
|||||||
self.menu.addMenu(self.themeMenu)
|
self.menu.addMenu(self.themeMenu)
|
||||||
self.configUpdated(True)
|
self.configUpdated(True)
|
||||||
|
|
||||||
|
def setModified(self, modified=True):
|
||||||
|
"""
|
||||||
|
Setter for property "modified". Sets whether or not the current service
|
||||||
|
has been modified.
|
||||||
|
"""
|
||||||
|
self._modified = modified
|
||||||
|
serviceFile = self.shortFileName() or u'Untitled Service'
|
||||||
|
self.parent.setServiceModified(modified, serviceFile)
|
||||||
|
|
||||||
|
def isModified(self):
|
||||||
|
"""
|
||||||
|
Getter for boolean property "modified".
|
||||||
|
"""
|
||||||
|
return self._modified
|
||||||
|
|
||||||
|
def setFileName(self, fileName):
|
||||||
|
"""
|
||||||
|
Setter for service file.
|
||||||
|
"""
|
||||||
|
self._fileName = unicode(fileName)
|
||||||
|
self.parent.setServiceModified(self.isModified, self.shortFileName())
|
||||||
|
|
||||||
|
def fileName(self):
|
||||||
|
"""
|
||||||
|
Return the current file name including path.
|
||||||
|
"""
|
||||||
|
return self._fileName
|
||||||
|
|
||||||
|
def shortFileName(self):
|
||||||
|
"""
|
||||||
|
Return the current file name, excluding the path.
|
||||||
|
"""
|
||||||
|
return split_filename(self._fileName)[1]
|
||||||
|
|
||||||
def configUpdated(self, firstTime=False):
|
def configUpdated(self, firstTime=False):
|
||||||
"""
|
"""
|
||||||
Triggered when Config dialog is updated.
|
Triggered when Config dialog is updated.
|
||||||
@ -295,6 +331,213 @@ class ServiceManager(QtGui.QWidget):
|
|||||||
def supportedSuffixes(self, suffix):
|
def supportedSuffixes(self, suffix):
|
||||||
self.suffixes.append(suffix)
|
self.suffixes.append(suffix)
|
||||||
|
|
||||||
|
def onNewServiceClicked(self):
|
||||||
|
"""
|
||||||
|
Create a new service.
|
||||||
|
"""
|
||||||
|
if self.isModified():
|
||||||
|
result = QtGui.QMessageBox.question(self.parent,
|
||||||
|
translate('OpenLP.ServiceManager', 'Save Changes'),
|
||||||
|
translate('OpenLP.ServiceManager', 'The current service has '
|
||||||
|
'been modified, would you like to save it?'),
|
||||||
|
QtGui.QMessageBox.Save | QtGui.QMessageBox.Discard |
|
||||||
|
QtGui.QMessageBox.Cancel, QtGui.QMessageBox.Save)
|
||||||
|
if result == QtGui.QMessageBox.Cancel:
|
||||||
|
return False
|
||||||
|
elif result == QtGui.QMessageBox.Save:
|
||||||
|
if not self.saveFile():
|
||||||
|
return False
|
||||||
|
self.newFile()
|
||||||
|
|
||||||
|
def onLoadServiceClicked(self):
|
||||||
|
if self.isModified():
|
||||||
|
result = QtGui.QMessageBox.question(self.parent,
|
||||||
|
translate('OpenLP.ServiceManager', 'Save Changes'),
|
||||||
|
translate('OpenLP.ServiceManager', 'The current service has '
|
||||||
|
'been modified, would you like to save it?'),
|
||||||
|
QtGui.QMessageBox.Save | QtGui.QMessageBox.Discard |
|
||||||
|
QtGui.QMessageBox.Cancel, QtGui.QMessageBox.Save)
|
||||||
|
if result == QtGui.QMessageBox.Cancel:
|
||||||
|
return False
|
||||||
|
elif result == QtGui.QMessageBox.Save:
|
||||||
|
self.saveFile()
|
||||||
|
fileName = unicode(QtGui.QFileDialog.getOpenFileName(self.parent,
|
||||||
|
translate('OpenLP.ServiceManager', 'Open File'),
|
||||||
|
SettingsManager.get_last_dir(self.parent.serviceSettingsSection),
|
||||||
|
translate('OpenLP.ServiceManager',
|
||||||
|
'OpenLP Service Files (*.osz) (*.osz)')))
|
||||||
|
if not fileName:
|
||||||
|
return False
|
||||||
|
SettingsManager.set_last_dir(self.parent.serviceSettingsSection,
|
||||||
|
split_filename(fileName)[0])
|
||||||
|
self.loadFile(fileName)
|
||||||
|
|
||||||
|
def onSaveServiceClicked(self):
|
||||||
|
self.saveFile()
|
||||||
|
|
||||||
|
def onSaveServiceAsClicked(self):
|
||||||
|
self.saveFileAs()
|
||||||
|
|
||||||
|
def onRecentServiceClicked(self):
|
||||||
|
sender = self.sender()
|
||||||
|
self.loadFile(sender.data().toString())
|
||||||
|
|
||||||
|
def newFile(self):
|
||||||
|
"""
|
||||||
|
Create a blank new service file.
|
||||||
|
"""
|
||||||
|
self.serviceManagerList.clear()
|
||||||
|
self.serviceItems = []
|
||||||
|
self.setFileName(u'')
|
||||||
|
self.setModified(False)
|
||||||
|
|
||||||
|
def saveFile(self):
|
||||||
|
"""
|
||||||
|
Save the current Service file.
|
||||||
|
"""
|
||||||
|
if not self.fileName():
|
||||||
|
return self.saveFileAs()
|
||||||
|
else:
|
||||||
|
fileName = self.fileName()
|
||||||
|
log.debug(u'ServiceManager.saveFile - %s' % fileName)
|
||||||
|
SettingsManager.set_last_dir(self.parent.serviceSettingsSection,
|
||||||
|
split_filename(fileName)[0])
|
||||||
|
service = []
|
||||||
|
serviceFileName = fileName.replace(u'.osz', u'.osd')
|
||||||
|
zip = None
|
||||||
|
file = None
|
||||||
|
try:
|
||||||
|
write_list = []
|
||||||
|
zip = zipfile.ZipFile(unicode(fileName), 'w')
|
||||||
|
for item in self.serviceItems:
|
||||||
|
service.append({u'serviceitem': \
|
||||||
|
item[u'service_item'].get_service_repr()})
|
||||||
|
if item[u'service_item'].uses_file():
|
||||||
|
for frame in item[u'service_item'].get_frames():
|
||||||
|
if item[u'service_item'].is_image():
|
||||||
|
path_from = frame[u'path']
|
||||||
|
else:
|
||||||
|
path_from = unicode(os.path.join(
|
||||||
|
frame[u'path'],
|
||||||
|
frame[u'title']))
|
||||||
|
# On write a file once
|
||||||
|
if not path_from in write_list:
|
||||||
|
write_list.append(path_from)
|
||||||
|
zip.write(path_from.encode(u'utf-8'))
|
||||||
|
file = open(serviceFileName, u'wb')
|
||||||
|
cPickle.dump(service, file)
|
||||||
|
file.close()
|
||||||
|
zip.write(serviceFileName.encode(u'utf-8'))
|
||||||
|
except IOError:
|
||||||
|
log.exception(u'Failed to save service to disk')
|
||||||
|
finally:
|
||||||
|
if file:
|
||||||
|
file.close()
|
||||||
|
if zip:
|
||||||
|
zip.close()
|
||||||
|
try:
|
||||||
|
os.remove(serviceFileName)
|
||||||
|
except (IOError, OSError):
|
||||||
|
# if not present do not worry
|
||||||
|
pass
|
||||||
|
self.parent.addRecentFile(fileName)
|
||||||
|
self.setModified(False)
|
||||||
|
return True
|
||||||
|
|
||||||
|
def saveFileAs(self):
|
||||||
|
"""
|
||||||
|
Get a file name and then call :function:`ServiceManager.saveFile` to
|
||||||
|
save the file.
|
||||||
|
"""
|
||||||
|
fileName = unicode(QtGui.QFileDialog.getSaveFileName(self.parent,
|
||||||
|
translate('OpenLP.ServiceManager', 'Save Service'),
|
||||||
|
SettingsManager.get_last_dir(self.parent.serviceSettingsSection),
|
||||||
|
translate('OpenLP.ServiceManager',
|
||||||
|
'OpenLP Service Files (*.osz) (*.osz)')))
|
||||||
|
if not fileName:
|
||||||
|
return False
|
||||||
|
if os.path.splitext(fileName)[1] == u'':
|
||||||
|
fileName += u'.osz'
|
||||||
|
else:
|
||||||
|
ext = os.path.splitext(fileName)[1]
|
||||||
|
fileName.replace(ext, u'.osz')
|
||||||
|
self.setFileName(fileName)
|
||||||
|
return self.saveFile()
|
||||||
|
|
||||||
|
def loadFile(self, fileName):
|
||||||
|
if not fileName:
|
||||||
|
return False
|
||||||
|
else:
|
||||||
|
fileName = unicode(fileName)
|
||||||
|
zip = None
|
||||||
|
fileTo = None
|
||||||
|
try:
|
||||||
|
zip = zipfile.ZipFile(unicode(fileName))
|
||||||
|
for file in zip.namelist():
|
||||||
|
try:
|
||||||
|
ucsfile = file.decode(u'utf-8')
|
||||||
|
except UnicodeDecodeError:
|
||||||
|
QtGui.QMessageBox.critical(
|
||||||
|
self, translate('OpenLP.ServiceManager', 'Error'),
|
||||||
|
translate('OpenLP.ServiceManager',
|
||||||
|
'File is not a valid service.\n'
|
||||||
|
'The content encoding is not UTF-8.'))
|
||||||
|
log.exception(u'Filename "%s" is not valid UTF-8' %
|
||||||
|
file.decode(u'utf-8', u'replace'))
|
||||||
|
continue
|
||||||
|
osfile = unicode(QtCore.QDir.toNativeSeparators(ucsfile))
|
||||||
|
filePath = os.path.join(self.servicePath,
|
||||||
|
os.path.split(osfile)[1])
|
||||||
|
fileTo = open(filePath, u'wb')
|
||||||
|
fileTo.write(zip.read(file))
|
||||||
|
fileTo.flush()
|
||||||
|
fileTo.close()
|
||||||
|
if filePath.endswith(u'osd'):
|
||||||
|
p_file = filePath
|
||||||
|
if 'p_file' in locals():
|
||||||
|
fileTo = open(p_file, u'r')
|
||||||
|
items = cPickle.load(fileTo)
|
||||||
|
fileTo.close()
|
||||||
|
self.newFile()
|
||||||
|
for item in items:
|
||||||
|
serviceItem = ServiceItem()
|
||||||
|
serviceItem.render_manager = self.parent.renderManager
|
||||||
|
serviceItem.set_from_service(item, self.servicePath)
|
||||||
|
self.validateItem(serviceItem)
|
||||||
|
self.addServiceItem(serviceItem)
|
||||||
|
if serviceItem.is_capable(
|
||||||
|
ItemCapabilities.OnLoadUpdate):
|
||||||
|
Receiver.send_message(u'%s_service_load' %
|
||||||
|
serviceItem.name.lower(), serviceItem)
|
||||||
|
try:
|
||||||
|
if os.path.isfile(p_file):
|
||||||
|
os.remove(p_file)
|
||||||
|
except (IOError, OSError):
|
||||||
|
log.exception(u'Failed to remove osd file')
|
||||||
|
else:
|
||||||
|
QtGui.QMessageBox.critical(
|
||||||
|
self, translate('OpenLP.ServiceManager', 'Error'),
|
||||||
|
translate('OpenLP.ServiceManager',
|
||||||
|
'File is not a valid service.'))
|
||||||
|
log.exception(u'File contains no service data')
|
||||||
|
except (IOError, NameError):
|
||||||
|
log.exception(u'Problem loading a service file')
|
||||||
|
finally:
|
||||||
|
if fileTo:
|
||||||
|
fileTo.close()
|
||||||
|
if zip:
|
||||||
|
zip.close()
|
||||||
|
self.setFileName(fileName)
|
||||||
|
self.parent.addRecentFile(fileName)
|
||||||
|
self.setModified(False)
|
||||||
|
# Refresh Plugin lists
|
||||||
|
Receiver.send_message(u'plugin_list_refresh')
|
||||||
|
|
||||||
|
def loadLastFile(self):
|
||||||
|
if not self.parent.recentFiles:
|
||||||
|
return
|
||||||
|
self.loadFile(self.parent.recentFiles[0])
|
||||||
|
|
||||||
def contextMenu(self, point):
|
def contextMenu(self, point):
|
||||||
item = self.serviceManagerList.itemAt(point)
|
item = self.serviceManagerList.itemAt(point)
|
||||||
if item is None:
|
if item is None:
|
||||||
@ -427,6 +670,7 @@ class ServiceManager(QtGui.QWidget):
|
|||||||
# Top Item was selected so set the last one
|
# Top Item was selected so set the last one
|
||||||
if setLastItem:
|
if setLastItem:
|
||||||
lastItem.setSelected(True)
|
lastItem.setSelected(True)
|
||||||
|
self.isModified = True
|
||||||
|
|
||||||
def onMoveSelectionDown(self):
|
def onMoveSelectionDown(self):
|
||||||
"""
|
"""
|
||||||
@ -449,6 +693,7 @@ class ServiceManager(QtGui.QWidget):
|
|||||||
serviceIterator += 1
|
serviceIterator += 1
|
||||||
if setSelected:
|
if setSelected:
|
||||||
firstItem.setSelected(True)
|
firstItem.setSelected(True)
|
||||||
|
self.isModified = True
|
||||||
|
|
||||||
def onCollapseAll(self):
|
def onCollapseAll(self):
|
||||||
"""
|
"""
|
||||||
@ -492,7 +737,7 @@ class ServiceManager(QtGui.QWidget):
|
|||||||
self.serviceItems.remove(self.serviceItems[item])
|
self.serviceItems.remove(self.serviceItems[item])
|
||||||
self.serviceItems.insert(0, temp)
|
self.serviceItems.insert(0, temp)
|
||||||
self.repaintServiceList(0, count)
|
self.repaintServiceList(0, count)
|
||||||
self.parent.serviceChanged(False, self.serviceName)
|
self.isModified = True
|
||||||
|
|
||||||
def onServiceUp(self):
|
def onServiceUp(self):
|
||||||
"""
|
"""
|
||||||
@ -505,7 +750,7 @@ class ServiceManager(QtGui.QWidget):
|
|||||||
self.serviceItems.remove(self.serviceItems[item])
|
self.serviceItems.remove(self.serviceItems[item])
|
||||||
self.serviceItems.insert(item - 1, temp)
|
self.serviceItems.insert(item - 1, temp)
|
||||||
self.repaintServiceList(item - 1, count)
|
self.repaintServiceList(item - 1, count)
|
||||||
self.parent.serviceChanged(False, self.serviceName)
|
self.setModified(True)
|
||||||
|
|
||||||
def onServiceDown(self):
|
def onServiceDown(self):
|
||||||
"""
|
"""
|
||||||
@ -518,7 +763,7 @@ class ServiceManager(QtGui.QWidget):
|
|||||||
self.serviceItems.remove(self.serviceItems[item])
|
self.serviceItems.remove(self.serviceItems[item])
|
||||||
self.serviceItems.insert(item + 1, temp)
|
self.serviceItems.insert(item + 1, temp)
|
||||||
self.repaintServiceList(item + 1, count)
|
self.repaintServiceList(item + 1, count)
|
||||||
self.parent.serviceChanged(False, self.serviceName)
|
self.setModified(True)
|
||||||
|
|
||||||
def onServiceEnd(self):
|
def onServiceEnd(self):
|
||||||
"""
|
"""
|
||||||
@ -530,30 +775,7 @@ class ServiceManager(QtGui.QWidget):
|
|||||||
self.serviceItems.remove(self.serviceItems[item])
|
self.serviceItems.remove(self.serviceItems[item])
|
||||||
self.serviceItems.insert(len(self.serviceItems), temp)
|
self.serviceItems.insert(len(self.serviceItems), temp)
|
||||||
self.repaintServiceList(len(self.serviceItems) - 1, count)
|
self.repaintServiceList(len(self.serviceItems) - 1, count)
|
||||||
self.parent.serviceChanged(False, self.serviceName)
|
self.setModified(True)
|
||||||
|
|
||||||
def onNewService(self):
|
|
||||||
"""
|
|
||||||
Clear the list to create a new service
|
|
||||||
"""
|
|
||||||
if self.parent.serviceNotSaved and QtCore.QSettings().value(
|
|
||||||
self.parent.generalSettingsSection + u'/save prompt',
|
|
||||||
QtCore.QVariant(False)).toBool():
|
|
||||||
ret = QtGui.QMessageBox.question(self,
|
|
||||||
translate('OpenLP.ServiceManager', 'Save Changes to Service?'),
|
|
||||||
translate('OpenLP.ServiceManager',
|
|
||||||
'Your service is unsaved, do you want to save '
|
|
||||||
'those changes before creating a new one?'),
|
|
||||||
QtGui.QMessageBox.StandardButtons(
|
|
||||||
QtGui.QMessageBox.Cancel | QtGui.QMessageBox.Save),
|
|
||||||
QtGui.QMessageBox.Save)
|
|
||||||
if ret == QtGui.QMessageBox.Save:
|
|
||||||
self.onSaveService()
|
|
||||||
self.serviceManagerList.clear()
|
|
||||||
self.serviceItems = []
|
|
||||||
self.serviceName = u''
|
|
||||||
self.isNew = True
|
|
||||||
self.parent.serviceChanged(True, self.serviceName)
|
|
||||||
|
|
||||||
def onDeleteFromService(self):
|
def onDeleteFromService(self):
|
||||||
"""
|
"""
|
||||||
@ -563,13 +785,19 @@ class ServiceManager(QtGui.QWidget):
|
|||||||
if item is not -1:
|
if item is not -1:
|
||||||
self.serviceItems.remove(self.serviceItems[item])
|
self.serviceItems.remove(self.serviceItems[item])
|
||||||
self.repaintServiceList(0, 0)
|
self.repaintServiceList(0, 0)
|
||||||
self.parent.serviceChanged(False, self.serviceName)
|
self.setModified(True)
|
||||||
|
|
||||||
def repaintServiceList(self, serviceItem, serviceItemCount):
|
def repaintServiceList(self, serviceItem, serviceItemCount):
|
||||||
"""
|
"""
|
||||||
Clear the existing service list and prepaint all the items
|
Clear the existing service list and prepaint all the items. This is
|
||||||
Used when moving items as the move takes place in supporting array,
|
used when moving items as the move takes place in a supporting list,
|
||||||
and when regenerating all the items due to theme changes
|
and when regenerating all the items due to theme changes.
|
||||||
|
|
||||||
|
``serviceItem``
|
||||||
|
The item which changed.
|
||||||
|
|
||||||
|
``serviceItemCount``
|
||||||
|
The number of items in the service.
|
||||||
"""
|
"""
|
||||||
# Correct order of items in array
|
# Correct order of items in array
|
||||||
count = 1
|
count = 1
|
||||||
@ -615,183 +843,6 @@ class ServiceManager(QtGui.QWidget):
|
|||||||
item[u'expanded'] = temp
|
item[u'expanded'] = temp
|
||||||
treewidgetitem.setExpanded(item[u'expanded'])
|
treewidgetitem.setExpanded(item[u'expanded'])
|
||||||
|
|
||||||
def onSaveService(self, quick=False):
|
|
||||||
"""
|
|
||||||
Save the current service in a zip (OSZ) file
|
|
||||||
This file contains
|
|
||||||
* An osd which is a pickle of the service items
|
|
||||||
* All image, presentation and video files needed to run the service.
|
|
||||||
"""
|
|
||||||
log.debug(u'onSaveService %s' % quick)
|
|
||||||
if not quick or self.isNew:
|
|
||||||
filename = QtGui.QFileDialog.getSaveFileName(self,
|
|
||||||
translate('OpenLP.ServiceManager', 'Save Service'),
|
|
||||||
SettingsManager.get_last_dir(self.parent.serviceSettingsSection),
|
|
||||||
translate('OpenLP.ServiceManager', 'OpenLP Service Files (*.osz)'))
|
|
||||||
else:
|
|
||||||
filename = os.path.join(SettingsManager.get_last_dir(
|
|
||||||
self.parent.serviceSettingsSection), self.serviceName)
|
|
||||||
if filename:
|
|
||||||
filename = QtCore.QDir.toNativeSeparators(filename)
|
|
||||||
splittedFile = filename.split(u'.')
|
|
||||||
if splittedFile[-1] != u'osz':
|
|
||||||
filename = filename + u'.osz'
|
|
||||||
filename = unicode(filename)
|
|
||||||
self.isNew = False
|
|
||||||
SettingsManager.set_last_dir(self.parent.serviceSettingsSection,
|
|
||||||
os.path.split(filename)[0])
|
|
||||||
service = []
|
|
||||||
servicefile = filename + u'.osd'
|
|
||||||
zip = None
|
|
||||||
file = None
|
|
||||||
try:
|
|
||||||
write_list = []
|
|
||||||
zip = zipfile.ZipFile(unicode(filename), 'w')
|
|
||||||
for item in self.serviceItems:
|
|
||||||
service.append({u'serviceitem':item[u'service_item']
|
|
||||||
.get_service_repr()})
|
|
||||||
if item[u'service_item'].uses_file():
|
|
||||||
for frame in item[u'service_item'].get_frames():
|
|
||||||
if item[u'service_item'].is_image():
|
|
||||||
path_from = frame[u'path']
|
|
||||||
else:
|
|
||||||
path_from = unicode(os.path.join(
|
|
||||||
frame[u'path'],
|
|
||||||
frame[u'title']))
|
|
||||||
# On write a file once
|
|
||||||
if not path_from in write_list:
|
|
||||||
write_list.append(path_from)
|
|
||||||
zip.write(path_from.encode(u'utf-8'))
|
|
||||||
file = open(servicefile, u'wb')
|
|
||||||
cPickle.dump(service, file)
|
|
||||||
file.close()
|
|
||||||
zip.write(servicefile.encode(u'utf-8'))
|
|
||||||
except IOError:
|
|
||||||
log.exception(u'Failed to save service to disk')
|
|
||||||
finally:
|
|
||||||
if file:
|
|
||||||
file.close()
|
|
||||||
if zip:
|
|
||||||
zip.close()
|
|
||||||
try:
|
|
||||||
os.remove(servicefile)
|
|
||||||
except (IOError, OSError):
|
|
||||||
pass #if not present do not worry
|
|
||||||
name = filename.split(os.path.sep)
|
|
||||||
self.serviceName = name[-1]
|
|
||||||
self.parent.addRecentFile(filename)
|
|
||||||
self.parent.serviceChanged(True, self.serviceName)
|
|
||||||
|
|
||||||
def onQuickSaveService(self):
|
|
||||||
self.onSaveService(True)
|
|
||||||
|
|
||||||
def onLoadService(self, lastService=False):
|
|
||||||
if lastService:
|
|
||||||
if not self.parent.recentFiles:
|
|
||||||
return
|
|
||||||
filename = self.parent.recentFiles[0]
|
|
||||||
else:
|
|
||||||
filename = QtGui.QFileDialog.getOpenFileName(
|
|
||||||
self, translate('OpenLP.ServiceManager', 'Open Service'),
|
|
||||||
SettingsManager.get_last_dir(
|
|
||||||
self.parent.serviceSettingsSection), u'Services (*.osz)')
|
|
||||||
filename = QtCore.QDir.toNativeSeparators(filename)
|
|
||||||
self.loadService(filename)
|
|
||||||
|
|
||||||
def loadService(self, filename=None):
|
|
||||||
"""
|
|
||||||
Load an existing service from disk and rebuild the serviceitems. All
|
|
||||||
files retrieved from the zip file are placed in a temporary directory
|
|
||||||
and will only be used for this service.
|
|
||||||
"""
|
|
||||||
if self.parent.serviceNotSaved:
|
|
||||||
ret = QtGui.QMessageBox.question(self,
|
|
||||||
translate('OpenLP.ServiceManager', 'Save Changes to Service?'),
|
|
||||||
translate('OpenLP.ServiceManager',
|
|
||||||
'Your current service is unsaved, do you want to '
|
|
||||||
'save the changes before opening a new one?'),
|
|
||||||
QtGui.QMessageBox.StandardButtons(
|
|
||||||
QtGui.QMessageBox.Discard | QtGui.QMessageBox.Save),
|
|
||||||
QtGui.QMessageBox.Save)
|
|
||||||
if ret == QtGui.QMessageBox.Save:
|
|
||||||
self.onSaveService()
|
|
||||||
if filename is None:
|
|
||||||
action = self.sender()
|
|
||||||
if isinstance(action, QtGui.QAction):
|
|
||||||
filename = action.data().toString()
|
|
||||||
else:
|
|
||||||
return
|
|
||||||
filename = unicode(filename)
|
|
||||||
name = filename.split(os.path.sep)
|
|
||||||
if filename:
|
|
||||||
SettingsManager.set_last_dir(self.parent.serviceSettingsSection,
|
|
||||||
os.path.split(filename)[0])
|
|
||||||
zip = None
|
|
||||||
file_to = None
|
|
||||||
try:
|
|
||||||
zip = zipfile.ZipFile(unicode(filename))
|
|
||||||
for file in zip.namelist():
|
|
||||||
try:
|
|
||||||
ucsfile = file.decode(u'utf-8')
|
|
||||||
except UnicodeDecodeError:
|
|
||||||
QtGui.QMessageBox.critical(
|
|
||||||
self, translate('OpenLP.ServiceManager', 'Error'),
|
|
||||||
translate('OpenLP.ServiceManager',
|
|
||||||
'File is not a valid service.\n'
|
|
||||||
'The content encoding is not UTF-8.'))
|
|
||||||
log.exception(u'Filename "%s" is not valid UTF-8' %
|
|
||||||
file.decode(u'utf-8', u'replace'))
|
|
||||||
continue
|
|
||||||
osfile = unicode(QtCore.QDir.toNativeSeparators(ucsfile))
|
|
||||||
names = osfile.split(os.path.sep)
|
|
||||||
file_path = os.path.join(self.servicePath,
|
|
||||||
names[len(names) - 1])
|
|
||||||
file_to = open(file_path, u'wb')
|
|
||||||
file_to.write(zip.read(file))
|
|
||||||
file_to.flush()
|
|
||||||
file_to.close()
|
|
||||||
if file_path.endswith(u'osd'):
|
|
||||||
p_file = file_path
|
|
||||||
if 'p_file' in locals():
|
|
||||||
file_to = open(p_file, u'r')
|
|
||||||
items = cPickle.load(file_to)
|
|
||||||
file_to.close()
|
|
||||||
self.onNewService()
|
|
||||||
for item in items:
|
|
||||||
serviceitem = ServiceItem()
|
|
||||||
serviceitem.render_manager = self.parent.renderManager
|
|
||||||
serviceitem.set_from_service(item, self.servicePath)
|
|
||||||
self.validateItem(serviceitem)
|
|
||||||
self.addServiceItem(serviceitem)
|
|
||||||
if serviceitem.is_capable(
|
|
||||||
ItemCapabilities.OnLoadUpdate):
|
|
||||||
Receiver.send_message(u'%s_service_load' %
|
|
||||||
serviceitem.name.lower(), serviceitem)
|
|
||||||
try:
|
|
||||||
if os.path.isfile(p_file):
|
|
||||||
os.remove(p_file)
|
|
||||||
except (IOError, OSError):
|
|
||||||
log.exception(u'Failed to remove osd file')
|
|
||||||
else:
|
|
||||||
QtGui.QMessageBox.critical(
|
|
||||||
self, translate('OpenLP.ServiceManager', 'Error'),
|
|
||||||
translate('OpenLP.ServiceManager',
|
|
||||||
'File is not a valid service.'))
|
|
||||||
log.exception(u'File contains no service data')
|
|
||||||
except (IOError, NameError):
|
|
||||||
log.exception(u'Problem loading a service file')
|
|
||||||
finally:
|
|
||||||
if file_to:
|
|
||||||
file_to.close()
|
|
||||||
if zip:
|
|
||||||
zip.close()
|
|
||||||
self.isNew = False
|
|
||||||
self.serviceName = name[len(name) - 1]
|
|
||||||
self.parent.addRecentFile(filename)
|
|
||||||
self.parent.serviceChanged(True, self.serviceName)
|
|
||||||
# Refresh Plugin lists
|
|
||||||
Receiver.send_message(u'plugin_list_refresh')
|
|
||||||
|
|
||||||
def validateItem(self, serviceItem):
|
def validateItem(self, serviceItem):
|
||||||
"""
|
"""
|
||||||
Validates the service item and if the suffix matches an accepted
|
Validates the service item and if the suffix matches an accepted
|
||||||
@ -857,7 +908,7 @@ class ServiceManager(QtGui.QWidget):
|
|||||||
item[u'service_item'], False, expand=item[u'expanded'])
|
item[u'service_item'], False, expand=item[u'expanded'])
|
||||||
# Set to False as items may have changed rendering
|
# Set to False as items may have changed rendering
|
||||||
# does not impact the saved song so True may also be valid
|
# does not impact the saved song so True may also be valid
|
||||||
self.parent.serviceChanged(False, self.serviceName)
|
self.setModified(True)
|
||||||
|
|
||||||
def serviceItemUpdate(self, message):
|
def serviceItemUpdate(self, message):
|
||||||
"""
|
"""
|
||||||
@ -881,7 +932,7 @@ class ServiceManager(QtGui.QWidget):
|
|||||||
item[u'service_item'] = newItem
|
item[u'service_item'] = newItem
|
||||||
self.repaintServiceList(itemcount + 1, 0)
|
self.repaintServiceList(itemcount + 1, 0)
|
||||||
self.parent.liveController.replaceServiceManagerItem(newItem)
|
self.parent.liveController.replaceServiceManagerItem(newItem)
|
||||||
self.parent.serviceChanged(False, self.serviceName)
|
self.setModified(True)
|
||||||
|
|
||||||
def addServiceItem(self, item, rebuild=False, expand=None, replace=False):
|
def addServiceItem(self, item, rebuild=False, expand=None, replace=False):
|
||||||
"""
|
"""
|
||||||
@ -905,7 +956,7 @@ class ServiceManager(QtGui.QWidget):
|
|||||||
self.parent.liveController.replaceServiceManagerItem(item)
|
self.parent.liveController.replaceServiceManagerItem(item)
|
||||||
else:
|
else:
|
||||||
# nothing selected for dnd
|
# nothing selected for dnd
|
||||||
if self.droppos == 0:
|
if self.dropPosition == 0:
|
||||||
if isinstance(item, list):
|
if isinstance(item, list):
|
||||||
for inditem in item:
|
for inditem in item:
|
||||||
self.serviceItems.append({u'service_item': inditem,
|
self.serviceItems.append({u'service_item': inditem,
|
||||||
@ -917,15 +968,15 @@ class ServiceManager(QtGui.QWidget):
|
|||||||
u'expanded':expand})
|
u'expanded':expand})
|
||||||
self.repaintServiceList(len(self.serviceItems) + 1, 0)
|
self.repaintServiceList(len(self.serviceItems) + 1, 0)
|
||||||
else:
|
else:
|
||||||
self.serviceItems.insert(self.droppos, {u'service_item': item,
|
self.serviceItems.insert(self.dropPosition, {u'service_item': item,
|
||||||
u'order': self.droppos,
|
u'order': self.dropPosition,
|
||||||
u'expanded':expand})
|
u'expanded':expand})
|
||||||
self.repaintServiceList(self.droppos, 0)
|
self.repaintServiceList(self.dropPosition, 0)
|
||||||
# if rebuilding list make sure live is fixed.
|
# if rebuilding list make sure live is fixed.
|
||||||
if rebuild:
|
if rebuild:
|
||||||
self.parent.liveController.replaceServiceManagerItem(item)
|
self.parent.liveController.replaceServiceManagerItem(item)
|
||||||
self.droppos = 0
|
self.dropPosition = 0
|
||||||
self.parent.serviceChanged(False, self.serviceName)
|
self.setModified(True)
|
||||||
|
|
||||||
def makePreview(self):
|
def makePreview(self):
|
||||||
"""
|
"""
|
||||||
@ -1045,7 +1096,7 @@ class ServiceManager(QtGui.QWidget):
|
|||||||
# we are not over anything so drop
|
# we are not over anything so drop
|
||||||
replace = False
|
replace = False
|
||||||
if item is None:
|
if item is None:
|
||||||
self.droppos = len(self.serviceItems)
|
self.dropPosition = len(self.serviceItems)
|
||||||
else:
|
else:
|
||||||
# we are over somthing so lets investigate
|
# we are over somthing so lets investigate
|
||||||
pos = self._getParentItemData(item) - 1
|
pos = self._getParentItemData(item) - 1
|
||||||
@ -1056,14 +1107,14 @@ class ServiceManager(QtGui.QWidget):
|
|||||||
action = self.dndMenu.exec_(QtGui.QCursor.pos())
|
action = self.dndMenu.exec_(QtGui.QCursor.pos())
|
||||||
# New action required
|
# New action required
|
||||||
if action == self.newAction:
|
if action == self.newAction:
|
||||||
self.droppos = self._getParentItemData(item)
|
self.dropPosition = self._getParentItemData(item)
|
||||||
# Append to existing action
|
# Append to existing action
|
||||||
if action == self.addToAction:
|
if action == self.addToAction:
|
||||||
self.droppos = self._getParentItemData(item)
|
self.dropPosition = self._getParentItemData(item)
|
||||||
item.setSelected(True)
|
item.setSelected(True)
|
||||||
replace = True
|
replace = True
|
||||||
else:
|
else:
|
||||||
self.droppos = self._getParentItemData(item)
|
self.dropPosition = self._getParentItemData(item)
|
||||||
Receiver.send_message(u'%s_add_service_item' % plugin, replace)
|
Receiver.send_message(u'%s_add_service_item' % plugin, replace)
|
||||||
|
|
||||||
def updateThemeList(self, theme_list):
|
def updateThemeList(self, theme_list):
|
||||||
@ -1119,4 +1170,4 @@ class ServiceManager(QtGui.QWidget):
|
|||||||
data_item[u'notes'] = unicode(service_item.notes)
|
data_item[u'notes'] = unicode(service_item.notes)
|
||||||
data_item[u'selected'] = (item == curitem)
|
data_item[u'selected'] = (item == curitem)
|
||||||
data.append(data_item)
|
data.append(data_item)
|
||||||
Receiver.send_message(u'servicemanager_list_response', data)
|
Receiver.send_message(u'servicemanager_list_response', data)
|
||||||
|
@ -1042,7 +1042,8 @@ class SlideController(QtGui.QWidget):
|
|||||||
if self.ThemeScreen.isChecked:
|
if self.ThemeScreen.isChecked:
|
||||||
self.ThemeScreen.setChecked(False)
|
self.ThemeScreen.setChecked(False)
|
||||||
self.HideMenu.setDefaultAction(self.ThemeScreen)
|
self.HideMenu.setDefaultAction(self.ThemeScreen)
|
||||||
if self.DesktopScreen.isChecked:
|
if self.screens.display_count > 1:
|
||||||
self.DesktopScreen.setChecked(False)
|
if self.DesktopScreen.isChecked:
|
||||||
self.HideMenu.setDefaultAction(self.DesktopScreen)
|
self.DesktopScreen.setChecked(False)
|
||||||
|
self.HideMenu.setDefaultAction(self.DesktopScreen)
|
||||||
|
|
||||||
|
@ -567,8 +567,7 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard):
|
|||||||
QtGui.QMessageBox.critical(self,
|
QtGui.QMessageBox.critical(self,
|
||||||
translate('OpenLP.ThemeForm', 'Theme Name Missing'),
|
translate('OpenLP.ThemeForm', 'Theme Name Missing'),
|
||||||
translate('OpenLP.ThemeForm',
|
translate('OpenLP.ThemeForm',
|
||||||
'There is no name for this theme. '
|
'There is no name for this theme. Please enter one.'),
|
||||||
'Please enter one.'),
|
|
||||||
(QtGui.QMessageBox.Ok),
|
(QtGui.QMessageBox.Ok),
|
||||||
QtGui.QMessageBox.Ok)
|
QtGui.QMessageBox.Ok)
|
||||||
return
|
return
|
||||||
@ -576,8 +575,7 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard):
|
|||||||
QtGui.QMessageBox.critical(self,
|
QtGui.QMessageBox.critical(self,
|
||||||
translate('OpenLP.ThemeForm', 'Theme Name Invalid'),
|
translate('OpenLP.ThemeForm', 'Theme Name Invalid'),
|
||||||
translate('OpenLP.ThemeForm',
|
translate('OpenLP.ThemeForm',
|
||||||
'Invalid theme name. '
|
'Invalid theme name. Please enter one.'),
|
||||||
'Please enter one.'),
|
|
||||||
(QtGui.QMessageBox.Ok),
|
(QtGui.QMessageBox.Ok),
|
||||||
QtGui.QMessageBox.Ok)
|
QtGui.QMessageBox.Ok)
|
||||||
return
|
return
|
||||||
|
@ -223,8 +223,11 @@ class ThemeManager(QtGui.QWidget):
|
|||||||
"""
|
"""
|
||||||
Renames an existing theme to a new name
|
Renames an existing theme to a new name
|
||||||
"""
|
"""
|
||||||
action = unicode(translate('OpenLP.ThemeManager', 'Rename'))
|
if self._validate_theme_action(unicode(translate('OpenLP.ThemeManager',
|
||||||
if self._validate_theme_action(action, False):
|
'You must select a theme to rename.')),
|
||||||
|
unicode(translate('OpenLP.ThemeManager', 'Rename Confirmation')),
|
||||||
|
unicode(translate('OpenLP.ThemeManager', 'Rename %s theme?')),
|
||||||
|
False):
|
||||||
item = self.themeListWidget.currentItem()
|
item = self.themeListWidget.currentItem()
|
||||||
oldThemeName = unicode(item.data(QtCore.Qt.UserRole).toString())
|
oldThemeName = unicode(item.data(QtCore.Qt.UserRole).toString())
|
||||||
self.fileRenameForm.fileNameEdit.setText(oldThemeName)
|
self.fileRenameForm.fileNameEdit.setText(oldThemeName)
|
||||||
@ -288,8 +291,10 @@ class ThemeManager(QtGui.QWidget):
|
|||||||
"""
|
"""
|
||||||
Delete a theme
|
Delete a theme
|
||||||
"""
|
"""
|
||||||
action = unicode(translate('OpenLP.ThemeManager', 'Delete'))
|
if self._validate_theme_action(unicode(translate('OpenLP.ThemeManager',
|
||||||
if self._validate_theme_action(action):
|
'You must select a theme to delete.')),
|
||||||
|
unicode(translate('OpenLP.ThemeManager', 'Delete Confirmation')),
|
||||||
|
unicode(translate('OpenLP.ThemeManager', 'Delete %s theme?'))):
|
||||||
item = self.themeListWidget.currentItem()
|
item = self.themeListWidget.currentItem()
|
||||||
theme = unicode(item.text())
|
theme = unicode(item.text())
|
||||||
row = self.themeListWidget.row(item)
|
row = self.themeListWidget.row(item)
|
||||||
@ -750,7 +755,8 @@ class ThemeManager(QtGui.QWidget):
|
|||||||
theme.extend_image_filename(path)
|
theme.extend_image_filename(path)
|
||||||
return theme
|
return theme
|
||||||
|
|
||||||
def _validate_theme_action(self, action, testPlugin=True):
|
def _validate_theme_action(self, select_text, confirm_title, confirm_text,
|
||||||
|
testPlugin=True):
|
||||||
"""
|
"""
|
||||||
Check to see if theme has been selected and the destructive action
|
Check to see if theme has been selected and the destructive action
|
||||||
is allowed.
|
is allowed.
|
||||||
@ -758,19 +764,14 @@ class ThemeManager(QtGui.QWidget):
|
|||||||
self.global_theme = unicode(QtCore.QSettings().value(
|
self.global_theme = unicode(QtCore.QSettings().value(
|
||||||
self.settingsSection + u'/global theme',
|
self.settingsSection + u'/global theme',
|
||||||
QtCore.QVariant(u'')).toString())
|
QtCore.QVariant(u'')).toString())
|
||||||
if check_item_selected(self.themeListWidget,
|
if check_item_selected(self.themeListWidget, select_text):
|
||||||
unicode(translate('OpenLP.ThemeManager',
|
|
||||||
'You must select a theme to %s.')) % action):
|
|
||||||
item = self.themeListWidget.currentItem()
|
item = self.themeListWidget.currentItem()
|
||||||
theme = unicode(item.text())
|
theme = unicode(item.text())
|
||||||
# confirm deletion
|
# confirm deletion
|
||||||
answer = QtGui.QMessageBox.question(self,
|
answer = QtGui.QMessageBox.question(self, confirm_title,
|
||||||
unicode(translate('OpenLP.ThemeManager', '%s Confirmation'))
|
confirm_text % theme, QtGui.QMessageBox.StandardButtons(
|
||||||
% action,
|
QtGui.QMessageBox.Yes | QtGui.QMessageBox.No),
|
||||||
unicode(translate('OpenLP.ThemeManager', '%s %s theme?'))
|
QtGui.QMessageBox.No)
|
||||||
% (action, theme),
|
|
||||||
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes |
|
|
||||||
QtGui.QMessageBox.No), QtGui.QMessageBox.No)
|
|
||||||
if answer == QtGui.QMessageBox.No:
|
if answer == QtGui.QMessageBox.No:
|
||||||
return False
|
return False
|
||||||
# should be the same unless default
|
# should be the same unless default
|
||||||
@ -779,6 +780,7 @@ class ThemeManager(QtGui.QWidget):
|
|||||||
translate('OpenLP.ThemeManager', 'Error'),
|
translate('OpenLP.ThemeManager', 'Error'),
|
||||||
translate('OpenLP.ThemeManager',
|
translate('OpenLP.ThemeManager',
|
||||||
'You are unable to delete the default theme.'))
|
'You are unable to delete the default theme.'))
|
||||||
|
return False
|
||||||
else:
|
else:
|
||||||
if testPlugin:
|
if testPlugin:
|
||||||
for plugin in self.parent.pluginManager.plugins:
|
for plugin in self.parent.pluginManager.plugins:
|
||||||
|
@ -275,8 +275,15 @@ def get_images_filter():
|
|||||||
visible_formats, actual_formats)
|
visible_formats, actual_formats)
|
||||||
return images_filter
|
return images_filter
|
||||||
|
|
||||||
|
def split_filename(path):
|
||||||
|
path = os.path.abspath(path)
|
||||||
|
if not os.path.isfile(path):
|
||||||
|
return path, u''
|
||||||
|
else:
|
||||||
|
return os.path.split(path)
|
||||||
|
|
||||||
from languagemanager import LanguageManager
|
from languagemanager import LanguageManager
|
||||||
from actions import ActionList
|
from actions import ActionList
|
||||||
|
|
||||||
__all__ = [u'AppLocation', u'check_latest_version', u'add_actions',
|
__all__ = [u'AppLocation', u'check_latest_version', u'add_actions',
|
||||||
u'get_filesystem_encoding', u'LanguageManager', u'ActionList']
|
u'get_filesystem_encoding', u'LanguageManager', u'ActionList']
|
||||||
|
@ -114,10 +114,10 @@ class AlertsPlugin(Plugin):
|
|||||||
"""
|
"""
|
||||||
## Name PluginList ##
|
## Name PluginList ##
|
||||||
self.textStrings[StringContent.Name] = {
|
self.textStrings[StringContent.Name] = {
|
||||||
u'singular': translate('AlertsPlugin', 'Alert'),
|
u'singular': translate('AlertsPlugin', 'Alert', 'name singular'),
|
||||||
u'plural': translate('AlertsPlugin', 'Alerts')
|
u'plural': translate('AlertsPlugin', 'Alerts', 'name plural')
|
||||||
}
|
}
|
||||||
## Name for MediaDockManager, SettingsManager ##
|
## Name for MediaDockManager, SettingsManager ##
|
||||||
self.textStrings[StringContent.VisibleName] = {
|
self.textStrings[StringContent.VisibleName] = {
|
||||||
u'title': translate('AlertsPlugin', 'Alerts')
|
u'title': translate('AlertsPlugin', 'Alerts', 'container title')
|
||||||
}
|
}
|
||||||
|
@ -126,53 +126,48 @@ class BiblePlugin(Plugin):
|
|||||||
"""
|
"""
|
||||||
## Name PluginList ##
|
## Name PluginList ##
|
||||||
self.textStrings[StringContent.Name] = {
|
self.textStrings[StringContent.Name] = {
|
||||||
u'singular': translate('BiblesPlugin', 'Bible'),
|
u'singular': translate('BiblesPlugin', 'Bible', 'name singular'),
|
||||||
u'plural': translate('BiblesPlugin', 'Bibles')
|
u'plural': translate('BiblesPlugin', 'Bibles', 'name plural')
|
||||||
}
|
}
|
||||||
## Name for MediaDockManager, SettingsManager ##
|
## Name for MediaDockManager, SettingsManager ##
|
||||||
self.textStrings[StringContent.VisibleName] = {
|
self.textStrings[StringContent.VisibleName] = {
|
||||||
u'title': translate('BiblesPlugin', 'Bibles')
|
u'title': translate('BiblesPlugin', 'Bibles', 'container title')
|
||||||
}
|
}
|
||||||
# Middle Header Bar
|
# Middle Header Bar
|
||||||
## Import Button ##
|
## Import Action ##
|
||||||
self.textStrings[StringContent.Import] = {
|
self.textStrings[StringContent.Import] = {
|
||||||
u'title': translate('BiblesPlugin', 'Import'),
|
u'title': translate('BiblesPlugin', '&Import'),
|
||||||
u'tooltip': translate('BiblesPlugin',
|
u'tooltip': translate('BiblesPlugin', 'Import a Bible')
|
||||||
'Import a Bible')
|
|
||||||
}
|
}
|
||||||
## New Button ##
|
## New Action ##
|
||||||
self.textStrings[StringContent.New] = {
|
self.textStrings[StringContent.New] = {
|
||||||
u'title': translate('BiblesPlugin', 'Add'),
|
u'title': translate('BiblesPlugin', '&Add'),
|
||||||
u'tooltip': translate('BiblesPlugin',
|
u'tooltip': translate('BiblesPlugin', 'Add a new Bible')
|
||||||
'Add a new Bible')
|
|
||||||
}
|
}
|
||||||
## Edit Button ##
|
## Edit Action ##
|
||||||
self.textStrings[StringContent.Edit] = {
|
self.textStrings[StringContent.Edit] = {
|
||||||
u'title': translate('BiblesPlugin', 'Edit'),
|
u'title': translate('BiblesPlugin', '&Edit'),
|
||||||
u'tooltip': translate('BiblesPlugin',
|
u'tooltip': translate('BiblesPlugin', 'Edit the selected Bible')
|
||||||
'Edit the selected Bible')
|
|
||||||
}
|
}
|
||||||
## Delete Button ##
|
## Delete Action ##
|
||||||
self.textStrings[StringContent.Delete] = {
|
self.textStrings[StringContent.Delete] = {
|
||||||
u'title': translate('BiblesPlugin', 'Delete'),
|
u'title': translate('BiblesPlugin', '&Delete'),
|
||||||
u'tooltip': translate('BiblesPlugin',
|
u'tooltip': translate('BiblesPlugin', 'Delete the selected Bible')
|
||||||
'Delete the selected Bible')
|
|
||||||
}
|
}
|
||||||
## Preview ##
|
## Preview Action ##
|
||||||
self.textStrings[StringContent.Preview] = {
|
self.textStrings[StringContent.Preview] = {
|
||||||
u'title': translate('BiblesPlugin', 'Preview'),
|
u'title': translate('BiblesPlugin', 'Preview'),
|
||||||
u'tooltip': translate('BiblesPlugin',
|
u'tooltip': translate('BiblesPlugin', 'Preview the selected Bible')
|
||||||
'Preview the selected Bible')
|
|
||||||
}
|
}
|
||||||
## Live Button ##
|
## Send Live Action ##
|
||||||
self.textStrings[StringContent.Live] = {
|
self.textStrings[StringContent.Live] = {
|
||||||
u'title': translate('BiblesPlugin', 'Live'),
|
u'title': translate('BiblesPlugin', 'Live'),
|
||||||
u'tooltip': translate('BiblesPlugin',
|
u'tooltip': translate('BiblesPlugin',
|
||||||
'Send the selected Bible live')
|
'Send the selected Bible live')
|
||||||
}
|
}
|
||||||
## Add to service Button ##
|
## Add to Service Action ##
|
||||||
self.textStrings[StringContent.Service] = {
|
self.textStrings[StringContent.Service] = {
|
||||||
u'title': translate('BiblesPlugin', 'Service'),
|
u'title': translate('BiblesPlugin', 'Service'),
|
||||||
u'tooltip': translate('BiblesPlugin',
|
u'tooltip': translate('BiblesPlugin',
|
||||||
'Add the selected Bible to the service')
|
'Add the selected Bible to the service')
|
||||||
}
|
}
|
||||||
|
@ -93,9 +93,10 @@ class CSVBible(BibleDB):
|
|||||||
if book_ptr != line[0]:
|
if book_ptr != line[0]:
|
||||||
book = self.get_book(line[0])
|
book = self.get_book(line[0])
|
||||||
book_ptr = book.name
|
book_ptr = book.name
|
||||||
self.wizard.incrementProgressBar(u'%s %s %s...' % (
|
self.wizard.incrementProgressBar(unicode(translate(
|
||||||
translate('BiblesPlugin.CSVImport', 'Importing'),
|
'BiblesPlugin.CSVImport', 'Importing %s %s...',
|
||||||
book.name, line[1]))
|
'Importing <book name> <chapter>...')) %
|
||||||
|
(book.name, int(line[1])))
|
||||||
self.session.commit()
|
self.session.commit()
|
||||||
self.create_verse(book.id, line[1], line[2],
|
self.create_verse(book.id, line[1], line[2],
|
||||||
unicode(line[3], details['encoding']))
|
unicode(line[3], details['encoding']))
|
||||||
|
@ -33,7 +33,7 @@ from sqlalchemy import Column, ForeignKey, or_, Table, types
|
|||||||
from sqlalchemy.orm import class_mapper, mapper, relation
|
from sqlalchemy.orm import class_mapper, mapper, relation
|
||||||
from sqlalchemy.orm.exc import UnmappedClassError
|
from sqlalchemy.orm.exc import UnmappedClassError
|
||||||
|
|
||||||
from openlp.core.lib import translate
|
from openlp.core.lib import Receiver, translate
|
||||||
from openlp.core.lib.db import BaseModel, init_db, Manager
|
from openlp.core.lib.db import BaseModel, init_db, Manager
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
@ -354,12 +354,12 @@ class BibleDB(QtCore.QObject, Manager):
|
|||||||
verse_list.extend(verses)
|
verse_list.extend(verses)
|
||||||
else:
|
else:
|
||||||
log.debug(u'OpenLP failed to find book %s', book)
|
log.debug(u'OpenLP failed to find book %s', book)
|
||||||
QtGui.QMessageBox.information(self.bible_plugin.mediaItem,
|
Receiver.send_message(u'openlp_error_message', {
|
||||||
translate('BiblesPlugin.BibleDB', 'Book not found'),
|
u'title': translate('BiblesPlugin', 'No Book Found'),
|
||||||
translate('BiblesPlugin.BibleDB', 'The book you requested '
|
u'message': translate('BiblesPlugin', 'No matching book '
|
||||||
'could not be found in this Bible. Please check your '
|
'could be found in this Bible. Check that you have '
|
||||||
'spelling and that this is a complete Bible not just '
|
'spelled the name of the book correctly.')
|
||||||
'one testament.'))
|
})
|
||||||
return verse_list
|
return verse_list
|
||||||
|
|
||||||
def verse_search(self, text):
|
def verse_search(self, text):
|
||||||
|
@ -28,13 +28,14 @@ import logging
|
|||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import sqlite3
|
import sqlite3
|
||||||
|
import socket
|
||||||
import urllib
|
import urllib
|
||||||
import urllib2
|
import urllib2
|
||||||
from HTMLParser import HTMLParseError
|
from HTMLParser import HTMLParseError
|
||||||
|
|
||||||
from BeautifulSoup import BeautifulSoup, NavigableString
|
from BeautifulSoup import BeautifulSoup, NavigableString
|
||||||
|
|
||||||
from openlp.core.lib import Receiver
|
from openlp.core.lib import Receiver, translate
|
||||||
from openlp.core.utils import AppLocation
|
from openlp.core.utils import AppLocation
|
||||||
from openlp.plugins.bibles.lib import SearchResults
|
from openlp.plugins.bibles.lib import SearchResults
|
||||||
from openlp.plugins.bibles.lib.db import BibleDB, Book
|
from openlp.plugins.bibles.lib.db import BibleDB, Book
|
||||||
@ -184,6 +185,7 @@ class BGExtract(object):
|
|||||||
def __init__(self, proxyurl=None):
|
def __init__(self, proxyurl=None):
|
||||||
log.debug(u'init %s', proxyurl)
|
log.debug(u'init %s', proxyurl)
|
||||||
self.proxyurl = proxyurl
|
self.proxyurl = proxyurl
|
||||||
|
socket.setdefaulttimeout(30)
|
||||||
|
|
||||||
def get_bible_chapter(self, version, bookname, chapter):
|
def get_bible_chapter(self, version, bookname, chapter):
|
||||||
"""
|
"""
|
||||||
@ -210,6 +212,13 @@ class BGExtract(object):
|
|||||||
Receiver.send_message(u'openlp_process_events')
|
Receiver.send_message(u'openlp_process_events')
|
||||||
except urllib2.URLError:
|
except urllib2.URLError:
|
||||||
log.exception(u'The web bible page could not be downloaded.')
|
log.exception(u'The web bible page could not be downloaded.')
|
||||||
|
Receiver.send_message(u'openlp_error_message', {
|
||||||
|
u'title': translate('BiblePlugin.HTTPBible', 'Download Error'),
|
||||||
|
u'message': translate('BiblePlugin.HTTPBible', 'There was a '
|
||||||
|
'problem downloading your verse selection. Please check your '
|
||||||
|
'Internet connection, and if this error continues to occur '
|
||||||
|
'consider reporting a bug.')
|
||||||
|
})
|
||||||
finally:
|
finally:
|
||||||
if not page:
|
if not page:
|
||||||
return None
|
return None
|
||||||
@ -219,6 +228,7 @@ class BGExtract(object):
|
|||||||
soup = BeautifulSoup(page, markupMassage=cleaner)
|
soup = BeautifulSoup(page, markupMassage=cleaner)
|
||||||
except HTMLParseError:
|
except HTMLParseError:
|
||||||
log.exception(u'BeautifulSoup could not parse the bible page.')
|
log.exception(u'BeautifulSoup could not parse the bible page.')
|
||||||
|
Receiver.send_message(u'bibles_download_error')
|
||||||
finally:
|
finally:
|
||||||
if not soup:
|
if not soup:
|
||||||
return None
|
return None
|
||||||
@ -247,6 +257,7 @@ class BSExtract(object):
|
|||||||
def __init__(self, proxyurl=None):
|
def __init__(self, proxyurl=None):
|
||||||
log.debug(u'init %s', proxyurl)
|
log.debug(u'init %s', proxyurl)
|
||||||
self.proxyurl = proxyurl
|
self.proxyurl = proxyurl
|
||||||
|
socket.setdefaulttimeout(30)
|
||||||
|
|
||||||
def get_bible_chapter(self, version, bookname, chapter):
|
def get_bible_chapter(self, version, bookname, chapter):
|
||||||
"""
|
"""
|
||||||
@ -264,7 +275,7 @@ class BSExtract(object):
|
|||||||
log.debug(u'get_bible_chapter %s,%s,%s', version, bookname, chapter)
|
log.debug(u'get_bible_chapter %s,%s,%s', version, bookname, chapter)
|
||||||
chapter_url = u'http://m.bibleserver.com/text/%s/%s%s' % \
|
chapter_url = u'http://m.bibleserver.com/text/%s/%s%s' % \
|
||||||
(version, bookname, chapter)
|
(version, bookname, chapter)
|
||||||
|
|
||||||
log.debug(u'URL: %s', chapter_url)
|
log.debug(u'URL: %s', chapter_url)
|
||||||
page = None
|
page = None
|
||||||
try:
|
try:
|
||||||
@ -272,6 +283,13 @@ class BSExtract(object):
|
|||||||
Receiver.send_message(u'openlp_process_events')
|
Receiver.send_message(u'openlp_process_events')
|
||||||
except urllib2.URLError:
|
except urllib2.URLError:
|
||||||
log.exception(u'The web bible page could not be downloaded.')
|
log.exception(u'The web bible page could not be downloaded.')
|
||||||
|
Receiver.send_message(u'openlp_error_message', {
|
||||||
|
u'title': translate('BiblePlugin.HTTPBible', 'Download Error'),
|
||||||
|
u'message': translate('BiblePlugin.HTTPBible', 'There was a '
|
||||||
|
'problem downloading your verse selection. Please check your '
|
||||||
|
'Internet connection, and if this error continues to occur '
|
||||||
|
'consider reporting a bug.')
|
||||||
|
})
|
||||||
finally:
|
finally:
|
||||||
if not page:
|
if not page:
|
||||||
return None
|
return None
|
||||||
@ -280,9 +298,13 @@ class BSExtract(object):
|
|||||||
soup = BeautifulSoup(page)
|
soup = BeautifulSoup(page)
|
||||||
except HTMLParseError:
|
except HTMLParseError:
|
||||||
log.exception(u'BeautifulSoup could not parse the bible page.')
|
log.exception(u'BeautifulSoup could not parse the bible page.')
|
||||||
finally:
|
Receiver.send_message(u'openlp_error_message', {
|
||||||
if not soup:
|
u'title': translate('BiblePlugin.HTTPBible', 'Parse Error'),
|
||||||
return None
|
u'message': translate('BiblePlugin.HTTPBible', 'There was a '
|
||||||
|
'problem extracting your verse selection. If this error '
|
||||||
|
'continues to occur consider reporting a bug.')
|
||||||
|
})
|
||||||
|
return None
|
||||||
Receiver.send_message(u'openlp_process_events')
|
Receiver.send_message(u'openlp_process_events')
|
||||||
content = None
|
content = None
|
||||||
try:
|
try:
|
||||||
@ -308,6 +330,7 @@ class CWExtract(object):
|
|||||||
def __init__(self, proxyurl=None):
|
def __init__(self, proxyurl=None):
|
||||||
log.debug(u'init %s', proxyurl)
|
log.debug(u'init %s', proxyurl)
|
||||||
self.proxyurl = proxyurl
|
self.proxyurl = proxyurl
|
||||||
|
socket.setdefaulttimeout(30)
|
||||||
|
|
||||||
def get_bible_chapter(self, version, bookname, chapter):
|
def get_bible_chapter(self, version, bookname, chapter):
|
||||||
"""
|
"""
|
||||||
@ -333,17 +356,26 @@ class CWExtract(object):
|
|||||||
Receiver.send_message(u'openlp_process_events')
|
Receiver.send_message(u'openlp_process_events')
|
||||||
except urllib2.URLError:
|
except urllib2.URLError:
|
||||||
log.exception(u'The web bible page could not be downloaded.')
|
log.exception(u'The web bible page could not be downloaded.')
|
||||||
finally:
|
Receiver.send_message(u'openlp_error_message', {
|
||||||
if not page:
|
u'title': translate('BiblePlugin.HTTPBible', 'Download Error'),
|
||||||
return None
|
u'message': translate('BiblePlugin.HTTPBible', 'There was a '
|
||||||
|
'problem downloading your verse selection. Please check your '
|
||||||
|
'Internet connection, and if this error continues to occur '
|
||||||
|
'consider reporting a bug.')
|
||||||
|
})
|
||||||
|
return None
|
||||||
soup = None
|
soup = None
|
||||||
try:
|
try:
|
||||||
soup = BeautifulSoup(page)
|
soup = BeautifulSoup(page)
|
||||||
except HTMLParseError:
|
except HTMLParseError:
|
||||||
log.exception(u'BeautifulSoup could not parse the bible page.')
|
log.exception(u'BeautifulSoup could not parse the bible page.')
|
||||||
finally:
|
Receiver.send_message(u'openlp_error_message', {
|
||||||
if not soup:
|
u'title': translate('BiblePlugin.HTTPBible', 'Parse Error'),
|
||||||
return None
|
u'message': translate('BiblePlugin.HTTPBible', 'There was a '
|
||||||
|
'problem extracting your verse selection. If this error '
|
||||||
|
'continues to occur consider reporting a bug.')
|
||||||
|
})
|
||||||
|
return None
|
||||||
Receiver.send_message(u'openlp_process_events')
|
Receiver.send_message(u'openlp_process_events')
|
||||||
htmlverses = soup.findAll(u'span', u'versetext')
|
htmlverses = soup.findAll(u'span', u'versetext')
|
||||||
verses = {}
|
verses = {}
|
||||||
@ -453,7 +485,12 @@ class HTTPBible(BibleDB):
|
|||||||
if not db_book:
|
if not db_book:
|
||||||
book_details = self.lookup_book(book)
|
book_details = self.lookup_book(book)
|
||||||
if not book_details:
|
if not book_details:
|
||||||
Receiver.send_message(u'bibles_nobook')
|
Receiver.send_message(u'openlp_error_message', {
|
||||||
|
u'title': translate('BiblesPlugin', 'No Book Found'),
|
||||||
|
u'message': translate('BiblesPlugin', 'No matching '
|
||||||
|
'book could be found in this Bible. Check that you'
|
||||||
|
'have spelled the name of the book correctly.')
|
||||||
|
})
|
||||||
return []
|
return []
|
||||||
db_book = self.create_book(book_details[u'name'],
|
db_book = self.create_book(book_details[u'name'],
|
||||||
book_details[u'abbreviation'],
|
book_details[u'abbreviation'],
|
||||||
|
@ -259,8 +259,6 @@ class BibleMediaItem(MediaManagerItem):
|
|||||||
QtCore.SIGNAL(u'bibles_showprogress'), self.onSearchProgressShow)
|
QtCore.SIGNAL(u'bibles_showprogress'), self.onSearchProgressShow)
|
||||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||||
QtCore.SIGNAL(u'bibles_hideprogress'), self.onSearchProgressHide)
|
QtCore.SIGNAL(u'bibles_hideprogress'), self.onSearchProgressHide)
|
||||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
|
||||||
QtCore.SIGNAL(u'bibles_nobook'), self.onNoBookFound)
|
|
||||||
|
|
||||||
def addListViewToToolBar(self):
|
def addListViewToToolBar(self):
|
||||||
MediaManagerItem.addListViewToToolBar(self)
|
MediaManagerItem.addListViewToToolBar(self)
|
||||||
@ -360,13 +358,6 @@ class BibleMediaItem(MediaManagerItem):
|
|||||||
def onSearchProgressHide(self):
|
def onSearchProgressHide(self):
|
||||||
self.SearchProgress.setVisible(False)
|
self.SearchProgress.setVisible(False)
|
||||||
|
|
||||||
def onNoBookFound(self):
|
|
||||||
QtGui.QMessageBox.critical(self,
|
|
||||||
translate('BiblesPlugin.MediaItem', 'No Book Found'),
|
|
||||||
translate('BiblesPlugin.MediaItem',
|
|
||||||
'No matching book could be found in this Bible.'))
|
|
||||||
self.AdvancedSearchButton.setEnabled(True)
|
|
||||||
|
|
||||||
def onImportClick(self):
|
def onImportClick(self):
|
||||||
if not hasattr(self, u'import_wizard'):
|
if not hasattr(self, u'import_wizard'):
|
||||||
self.import_wizard = BibleImportForm(self, self.parent.manager,
|
self.import_wizard = BibleImportForm(self, self.parent.manager,
|
||||||
@ -912,7 +903,7 @@ class BibleMediaItem(MediaManagerItem):
|
|||||||
old_chapter != chapter:
|
old_chapter != chapter:
|
||||||
verse_text = unicode(chapter) + verse_separator + unicode(verse)
|
verse_text = unicode(chapter) + verse_separator + unicode(verse)
|
||||||
else:
|
else:
|
||||||
verse_text = u'%s' % verse
|
verse_text = unicode(verse)
|
||||||
if self.parent.settings_tab.display_style == 1:
|
if self.parent.settings_tab.display_style == 1:
|
||||||
verse_text = u'{su}(' + verse_text + u'){/su}'
|
verse_text = u'{su}(' + verse_text + u'){/su}'
|
||||||
elif self.parent.settings_tab.display_style == 2:
|
elif self.parent.settings_tab.display_style == 2:
|
||||||
@ -921,4 +912,4 @@ class BibleMediaItem(MediaManagerItem):
|
|||||||
verse_text = u'{su}[' + verse_text + u']{/su}'
|
verse_text = u'{su}[' + verse_text + u']{/su}'
|
||||||
else:
|
else:
|
||||||
verse_text = u'{su}' + verse_text + u'{/su}'
|
verse_text = u'{su}' + verse_text + u'{/su}'
|
||||||
return verse_text
|
return verse_text
|
||||||
|
@ -73,8 +73,8 @@ class OpenLP1Bible(BibleDB):
|
|||||||
abbreviation = unicode(book[3], u'cp1252')
|
abbreviation = unicode(book[3], u'cp1252')
|
||||||
self.create_book(name, abbreviation, testament_id)
|
self.create_book(name, abbreviation, testament_id)
|
||||||
# Update the progess bar.
|
# Update the progess bar.
|
||||||
self.wizard.incrementProgressBar(u'%s %s...' % (translate(
|
self.wizard.incrementProgressBar(unicode(translate(
|
||||||
'BiblesPlugin.OpenLP1Import', 'Importing'), name))
|
'BiblesPlugin.OpenLP1Import', 'Importing %s...')) % name)
|
||||||
# Import the verses for this book.
|
# Import the verses for this book.
|
||||||
cursor.execute(u'SELECT chapter, verse, text || \'\' AS text FROM '
|
cursor.execute(u'SELECT chapter, verse, text || \'\' AS text FROM '
|
||||||
'verse WHERE book_id=%s' % book_id)
|
'verse WHERE book_id=%s' % book_id)
|
||||||
@ -90,4 +90,4 @@ class OpenLP1Bible(BibleDB):
|
|||||||
Receiver.send_message(u'openlp_process_events')
|
Receiver.send_message(u'openlp_process_events')
|
||||||
self.session.commit()
|
self.session.commit()
|
||||||
connection.close()
|
connection.close()
|
||||||
return True
|
return True
|
||||||
|
@ -84,9 +84,10 @@ class OpenSongBible(BibleDB):
|
|||||||
unicode(verse.text)
|
unicode(verse.text)
|
||||||
)
|
)
|
||||||
Receiver.send_message(u'openlp_process_events')
|
Receiver.send_message(u'openlp_process_events')
|
||||||
self.wizard.incrementProgressBar(u'%s %s %s...' % (
|
self.wizard.incrementProgressBar(unicode(translate(
|
||||||
translate('BiblesPlugin.Opensong', 'Importing'),
|
'BiblesPlugin.Opensong', 'Importing %s %s...',
|
||||||
db_book.name, chapter.attrib[u'n']))
|
'Importing <book name> <chapter>...')) %
|
||||||
|
(db_book.name, int(chapter.attrib[u'n'])))
|
||||||
self.session.commit()
|
self.session.commit()
|
||||||
except IOError, AttributeError:
|
except IOError, AttributeError:
|
||||||
log.exception(u'Loading bible from OpenSong file failed')
|
log.exception(u'Loading bible from OpenSong file failed')
|
||||||
@ -97,4 +98,4 @@ class OpenSongBible(BibleDB):
|
|||||||
if self.stop_import_flag:
|
if self.stop_import_flag:
|
||||||
return False
|
return False
|
||||||
else:
|
else:
|
||||||
return success
|
return success
|
||||||
|
@ -140,9 +140,10 @@ class OSISBible(BibleDB):
|
|||||||
if last_chapter != chapter:
|
if last_chapter != chapter:
|
||||||
if last_chapter != 0:
|
if last_chapter != 0:
|
||||||
self.session.commit()
|
self.session.commit()
|
||||||
self.wizard.incrementProgressBar(u'%s %s %s...' % (
|
self.wizard.incrementProgressBar(unicode(translate(
|
||||||
translate('BiblesPlugin.OsisImport', 'Importing'),
|
'BiblesPlugin.OsisImport', 'Importing %s %s...',
|
||||||
self.books[match.group(1)][0], chapter))
|
'Importing <book name> <chapter>...')) %
|
||||||
|
(self.books[match.group(1)][0], chapter))
|
||||||
last_chapter = chapter
|
last_chapter = chapter
|
||||||
# All of this rigmarol below is because the mod2osis
|
# All of this rigmarol below is because the mod2osis
|
||||||
# tool from the Sword library embeds XML in the OSIS
|
# tool from the Sword library embeds XML in the OSIS
|
||||||
|
@ -104,57 +104,57 @@ class CustomPlugin(Plugin):
|
|||||||
"""
|
"""
|
||||||
## Name PluginList ##
|
## Name PluginList ##
|
||||||
self.textStrings[StringContent.Name] = {
|
self.textStrings[StringContent.Name] = {
|
||||||
u'singular': translate('CustomsPlugin', 'Custom'),
|
u'singular': translate('CustomsPlugin', 'Custom', 'name singular'),
|
||||||
u'plural': translate('CustomsPlugin', 'Customs')
|
u'plural': translate('CustomsPlugin', 'Customs', 'name plural')
|
||||||
}
|
}
|
||||||
## Name for MediaDockManager, SettingsManager ##
|
## Name for MediaDockManager, SettingsManager ##
|
||||||
self.textStrings[StringContent.VisibleName] = {
|
self.textStrings[StringContent.VisibleName] = {
|
||||||
u'title': translate('CustomsPlugin', 'Custom')
|
u'title': translate('CustomsPlugin', 'Custom', 'container title')
|
||||||
}
|
}
|
||||||
# Middle Header Bar
|
# Middle Header Bar
|
||||||
## Import Button ##
|
## Import Action ##
|
||||||
self.textStrings[StringContent.Import] = {
|
self.textStrings[StringContent.Import] = {
|
||||||
u'title': translate('CustomsPlugin', 'Import'),
|
u'title': translate('CustomsPlugin', 'Import'),
|
||||||
u'tooltip': translate('CustomsPlugin',
|
u'tooltip': translate('CustomsPlugin',
|
||||||
'Import a Custom')
|
'Import a Custom')
|
||||||
}
|
}
|
||||||
## Load Button ##
|
## Load Action ##
|
||||||
self.textStrings[StringContent.Load] = {
|
self.textStrings[StringContent.Load] = {
|
||||||
u'title': translate('CustomsPlugin', 'Load'),
|
u'title': translate('CustomsPlugin', 'Load'),
|
||||||
u'tooltip': translate('CustomsPlugin',
|
u'tooltip': translate('CustomsPlugin',
|
||||||
'Load a new Custom')
|
'Load a new Custom')
|
||||||
}
|
}
|
||||||
## New Button ##
|
## New Action ##
|
||||||
self.textStrings[StringContent.New] = {
|
self.textStrings[StringContent.New] = {
|
||||||
u'title': translate('CustomsPlugin', 'Add'),
|
u'title': translate('CustomsPlugin', 'Add'),
|
||||||
u'tooltip': translate('CustomsPlugin',
|
u'tooltip': translate('CustomsPlugin',
|
||||||
'Add a new Custom')
|
'Add a new Custom')
|
||||||
}
|
}
|
||||||
## Edit Button ##
|
## Edit Action ##
|
||||||
self.textStrings[StringContent.Edit] = {
|
self.textStrings[StringContent.Edit] = {
|
||||||
u'title': translate('CustomsPlugin', 'Edit'),
|
u'title': translate('CustomsPlugin', 'Edit'),
|
||||||
u'tooltip': translate('CustomsPlugin',
|
u'tooltip': translate('CustomsPlugin',
|
||||||
'Edit the selected Custom')
|
'Edit the selected Custom')
|
||||||
}
|
}
|
||||||
## Delete Button ##
|
## Delete Action ##
|
||||||
self.textStrings[StringContent.Delete] = {
|
self.textStrings[StringContent.Delete] = {
|
||||||
u'title': translate('CustomsPlugin', 'Delete'),
|
u'title': translate('CustomsPlugin', 'Delete'),
|
||||||
u'tooltip': translate('CustomsPlugin',
|
u'tooltip': translate('CustomsPlugin',
|
||||||
'Delete the selected Custom')
|
'Delete the selected Custom')
|
||||||
}
|
}
|
||||||
## Preview ##
|
## Preview Action ##
|
||||||
self.textStrings[StringContent.Preview] = {
|
self.textStrings[StringContent.Preview] = {
|
||||||
u'title': translate('CustomsPlugin', 'Preview'),
|
u'title': translate('CustomsPlugin', 'Preview'),
|
||||||
u'tooltip': translate('CustomsPlugin',
|
u'tooltip': translate('CustomsPlugin',
|
||||||
'Preview the selected Custom')
|
'Preview the selected Custom')
|
||||||
}
|
}
|
||||||
## Live Button ##
|
## Send Live Action ##
|
||||||
self.textStrings[StringContent.Live] = {
|
self.textStrings[StringContent.Live] = {
|
||||||
u'title': translate('CustomsPlugin', 'Live'),
|
u'title': translate('CustomsPlugin', 'Live'),
|
||||||
u'tooltip': translate('CustomsPlugin',
|
u'tooltip': translate('CustomsPlugin',
|
||||||
'Send the selected Custom live')
|
'Send the selected Custom live')
|
||||||
}
|
}
|
||||||
## Add to service Button ##
|
## Add to Service Action ##
|
||||||
self.textStrings[StringContent.Service] = {
|
self.textStrings[StringContent.Service] = {
|
||||||
u'title': translate('CustomsPlugin', 'Service'),
|
u'title': translate('CustomsPlugin', 'Service'),
|
||||||
u'tooltip': translate('CustomsPlugin',
|
u'tooltip': translate('CustomsPlugin',
|
||||||
@ -167,4 +167,4 @@ class CustomPlugin(Plugin):
|
|||||||
"""
|
"""
|
||||||
log.info(u'Custom Finalising')
|
log.info(u'Custom Finalising')
|
||||||
self.manager.finalise()
|
self.manager.finalise()
|
||||||
Plugin.finalise(self)
|
Plugin.finalise(self)
|
||||||
|
@ -64,12 +64,12 @@ class ImagePlugin(Plugin):
|
|||||||
"""
|
"""
|
||||||
## Name PluginList ##
|
## Name PluginList ##
|
||||||
self.textStrings[StringContent.Name] = {
|
self.textStrings[StringContent.Name] = {
|
||||||
u'singular': translate('ImagePlugin', 'Image'),
|
u'singular': translate('ImagePlugin', 'Image', 'name singular'),
|
||||||
u'plural': translate('ImagePlugin', 'Images')
|
u'plural': translate('ImagePlugin', 'Images', 'name plural')
|
||||||
}
|
}
|
||||||
## Name for MediaDockManager, SettingsManager ##
|
## Name for MediaDockManager, SettingsManager ##
|
||||||
self.textStrings[StringContent.VisibleName] = {
|
self.textStrings[StringContent.VisibleName] = {
|
||||||
u'title': translate('ImagePlugin', 'Images')
|
u'title': translate('ImagePlugin', 'Images', 'container title')
|
||||||
}
|
}
|
||||||
# Middle Header Bar
|
# Middle Header Bar
|
||||||
## Load Button ##
|
## Load Button ##
|
||||||
@ -113,4 +113,4 @@ class ImagePlugin(Plugin):
|
|||||||
u'title': translate('ImagePlugin', 'Service'),
|
u'title': translate('ImagePlugin', 'Service'),
|
||||||
u'tooltip': translate('ImagePlugin',
|
u'tooltip': translate('ImagePlugin',
|
||||||
'Add the selected Image to the service')
|
'Add the selected Image to the service')
|
||||||
}
|
}
|
||||||
|
@ -109,7 +109,7 @@ class ImageMediaItem(MediaManagerItem):
|
|||||||
translate('ImagePlugin.MediaItem', 'Replace Live Background'),
|
translate('ImagePlugin.MediaItem', 'Replace Live Background'),
|
||||||
self.onReplaceClick, False)
|
self.onReplaceClick, False)
|
||||||
self.resetButton = self.toolbar.addToolbarButton(
|
self.resetButton = self.toolbar.addToolbarButton(
|
||||||
translate('ImagePlugin.MediaItem', u'Reset Background'),
|
translate('ImagePlugin.MediaItem', 'Reset Background'),
|
||||||
u':/system/system_close.png',
|
u':/system/system_close.png',
|
||||||
translate('ImagePlugin.MediaItem', 'Reset Live Background'),
|
translate('ImagePlugin.MediaItem', 'Reset Live Background'),
|
||||||
self.onResetClick, False)
|
self.onResetClick, False)
|
||||||
|
@ -60,10 +60,9 @@ class MediaMediaItem(MediaManagerItem):
|
|||||||
|
|
||||||
def retranslateUi(self):
|
def retranslateUi(self):
|
||||||
self.OnNewPrompt = translate('MediaPlugin.MediaItem', 'Select Media')
|
self.OnNewPrompt = translate('MediaPlugin.MediaItem', 'Select Media')
|
||||||
self.OnNewFileMasks = translate('MediaPlugin.MediaItem',
|
self.OnNewFileMasks = unicode(translate('MediaPlugin.MediaItem',
|
||||||
u'Videos (%s);;'
|
'Videos (%s);;Audio (%s);;All files (*)')) % \
|
||||||
u'Audio (%s);;'
|
(self.parent.video_list, self.parent.audio_list)
|
||||||
u'All files (*)' % (self.parent.video_list, self.parent.audio_list))
|
|
||||||
|
|
||||||
def requiredIcons(self):
|
def requiredIcons(self):
|
||||||
MediaManagerItem.requiredIcons(self)
|
MediaManagerItem.requiredIcons(self)
|
||||||
|
@ -93,51 +93,51 @@ class MediaPlugin(Plugin):
|
|||||||
"""
|
"""
|
||||||
## Name PluginList ##
|
## Name PluginList ##
|
||||||
self.textStrings[StringContent.Name] = {
|
self.textStrings[StringContent.Name] = {
|
||||||
u'singular': translate('MediaPlugin', 'Media'),
|
u'singular': translate('MediaPlugin', 'Media', 'name singular'),
|
||||||
u'plural': translate('MediaPlugin', 'Media')
|
u'plural': translate('MediaPlugin', 'Media', 'name plural')
|
||||||
}
|
}
|
||||||
## Name for MediaDockManager, SettingsManager ##
|
## Name for MediaDockManager, SettingsManager ##
|
||||||
self.textStrings[StringContent.VisibleName] = {
|
self.textStrings[StringContent.VisibleName] = {
|
||||||
u'title': translate('MediaPlugin', 'Media')
|
u'title': translate('MediaPlugin', 'Media', 'container title')
|
||||||
}
|
}
|
||||||
# Middle Header Bar
|
# Middle Header Bar
|
||||||
## Load Button ##
|
## Load Action ##
|
||||||
self.textStrings[StringContent.Load] = {
|
self.textStrings[StringContent.Load] = {
|
||||||
u'title': translate('MediaPlugin', 'Load'),
|
u'title': translate('MediaPlugin', 'Load'),
|
||||||
u'tooltip': translate('MediaPlugin',
|
u'tooltip': translate('MediaPlugin',
|
||||||
'Load a new Media')
|
'Load a new Media')
|
||||||
}
|
}
|
||||||
## New Button ##
|
## New Action ##
|
||||||
self.textStrings[StringContent.New] = {
|
self.textStrings[StringContent.New] = {
|
||||||
u'title': translate('MediaPlugin', 'Add'),
|
u'title': translate('MediaPlugin', 'Add'),
|
||||||
u'tooltip': translate('MediaPlugin',
|
u'tooltip': translate('MediaPlugin',
|
||||||
'Add a new Media')
|
'Add a new Media')
|
||||||
}
|
}
|
||||||
## Edit Button ##
|
## Edit Action ##
|
||||||
self.textStrings[StringContent.Edit] = {
|
self.textStrings[StringContent.Edit] = {
|
||||||
u'title': translate('MediaPlugin', 'Edit'),
|
u'title': translate('MediaPlugin', 'Edit'),
|
||||||
u'tooltip': translate('MediaPlugin',
|
u'tooltip': translate('MediaPlugin',
|
||||||
'Edit the selected Media')
|
'Edit the selected Media')
|
||||||
}
|
}
|
||||||
## Delete Button ##
|
## Delete Action ##
|
||||||
self.textStrings[StringContent.Delete] = {
|
self.textStrings[StringContent.Delete] = {
|
||||||
u'title': translate('MediaPlugin', 'Delete'),
|
u'title': translate('MediaPlugin', 'Delete'),
|
||||||
u'tooltip': translate('MediaPlugin',
|
u'tooltip': translate('MediaPlugin',
|
||||||
'Delete the selected Media')
|
'Delete the selected Media')
|
||||||
}
|
}
|
||||||
## Preview ##
|
## Preview Action ##
|
||||||
self.textStrings[StringContent.Preview] = {
|
self.textStrings[StringContent.Preview] = {
|
||||||
u'title': translate('MediaPlugin', 'Preview'),
|
u'title': translate('MediaPlugin', 'Preview'),
|
||||||
u'tooltip': translate('MediaPlugin',
|
u'tooltip': translate('MediaPlugin',
|
||||||
'Preview the selected Media')
|
'Preview the selected Media')
|
||||||
}
|
}
|
||||||
## Live Button ##
|
## Send Live Action ##
|
||||||
self.textStrings[StringContent.Live] = {
|
self.textStrings[StringContent.Live] = {
|
||||||
u'title': translate('MediaPlugin', 'Live'),
|
u'title': translate('MediaPlugin', 'Live'),
|
||||||
u'tooltip': translate('MediaPlugin',
|
u'tooltip': translate('MediaPlugin',
|
||||||
'Send the selected Media live')
|
'Send the selected Media live')
|
||||||
}
|
}
|
||||||
## Add to service Button ##
|
## Add to Service Action ##
|
||||||
self.textStrings[StringContent.Service] = {
|
self.textStrings[StringContent.Service] = {
|
||||||
u'title': translate('MediaPlugin', 'Service'),
|
u'title': translate('MediaPlugin', 'Service'),
|
||||||
u'tooltip': translate('MediaPlugin',
|
u'tooltip': translate('MediaPlugin',
|
||||||
|
@ -90,8 +90,8 @@ class PresentationMediaItem(MediaManagerItem):
|
|||||||
if fileType.find(type) == -1:
|
if fileType.find(type) == -1:
|
||||||
fileType += u'*.%s ' % type
|
fileType += u'*.%s ' % type
|
||||||
self.parent.serviceManager.supportedSuffixes(type)
|
self.parent.serviceManager.supportedSuffixes(type)
|
||||||
self.OnNewFileMasks = translate('PresentationPlugin.MediaItem',
|
self.OnNewFileMasks = unicode(translate('PresentationPlugin.MediaItem',
|
||||||
'Presentations (%s)' % fileType)
|
'Presentations (%s)')) % fileType
|
||||||
|
|
||||||
def requiredIcons(self):
|
def requiredIcons(self):
|
||||||
"""
|
"""
|
||||||
|
@ -152,41 +152,44 @@ class PresentationPlugin(Plugin):
|
|||||||
"""
|
"""
|
||||||
## Name PluginList ##
|
## Name PluginList ##
|
||||||
self.textStrings[StringContent.Name] = {
|
self.textStrings[StringContent.Name] = {
|
||||||
u'singular': translate('PresentationPlugin', 'Presentation'),
|
u'singular': translate('PresentationPlugin', 'Presentation',
|
||||||
u'plural': translate('PresentationPlugin', 'Presentations')
|
'name singular'),
|
||||||
|
u'plural': translate('PresentationPlugin', 'Presentations',
|
||||||
|
'name plural')
|
||||||
}
|
}
|
||||||
## Name for MediaDockManager, SettingsManager ##
|
## Name for MediaDockManager, SettingsManager ##
|
||||||
self.textStrings[StringContent.VisibleName] = {
|
self.textStrings[StringContent.VisibleName] = {
|
||||||
u'title': translate('PresentationPlugin', 'Presentations')
|
u'title': translate('PresentationPlugin', 'Presentations',
|
||||||
|
'container title')
|
||||||
}
|
}
|
||||||
# Middle Header Bar
|
# Middle Header Bar
|
||||||
## Load Button ##
|
## Load Action ##
|
||||||
self.textStrings[StringContent.Load] = {
|
self.textStrings[StringContent.Load] = {
|
||||||
u'title': translate('PresentationPlugin', 'Load'),
|
u'title': translate('PresentationPlugin', 'Load'),
|
||||||
u'tooltip': translate('PresentationPlugin',
|
u'tooltip': translate('PresentationPlugin',
|
||||||
'Load a new Presentation')
|
'Load a new Presentation')
|
||||||
}
|
}
|
||||||
## Delete Button ##
|
## Delete Action ##
|
||||||
self.textStrings[StringContent.Delete] = {
|
self.textStrings[StringContent.Delete] = {
|
||||||
u'title': translate('PresentationPlugin', 'Delete'),
|
u'title': translate('PresentationPlugin', 'Delete'),
|
||||||
u'tooltip': translate('PresentationPlugin',
|
u'tooltip': translate('PresentationPlugin',
|
||||||
'Delete the selected Presentation')
|
'Delete the selected Presentation')
|
||||||
}
|
}
|
||||||
## Preview ##
|
## Preview Action ##
|
||||||
self.textStrings[StringContent.Preview] = {
|
self.textStrings[StringContent.Preview] = {
|
||||||
u'title': translate('PresentationPlugin', 'Preview'),
|
u'title': translate('PresentationPlugin', 'Preview'),
|
||||||
u'tooltip': translate('PresentationPlugin',
|
u'tooltip': translate('PresentationPlugin',
|
||||||
'Preview the selected Presentation')
|
'Preview the selected Presentation')
|
||||||
}
|
}
|
||||||
## Live Button ##
|
## Send Live Action ##
|
||||||
self.textStrings[StringContent.Live] = {
|
self.textStrings[StringContent.Live] = {
|
||||||
u'title': translate('PresentationPlugin', 'Live'),
|
u'title': translate('PresentationPlugin', 'Live'),
|
||||||
u'tooltip': translate('PresentationPlugin',
|
u'tooltip': translate('PresentationPlugin',
|
||||||
'Send the selected Presentation live')
|
'Send the selected Presentation live')
|
||||||
}
|
}
|
||||||
## Add to service Button ##
|
## Add to Service Action ##
|
||||||
self.textStrings[StringContent.Service] = {
|
self.textStrings[StringContent.Service] = {
|
||||||
u'title': translate('PresentationPlugin', 'Service'),
|
u'title': translate('PresentationPlugin', 'Service'),
|
||||||
u'tooltip': translate('PresentationPlugin',
|
u'tooltip': translate('PresentationPlugin',
|
||||||
'Add the selected Presentation to the service')
|
'Add the selected Presentation to the service')
|
||||||
}
|
}
|
||||||
|
@ -84,10 +84,10 @@ class RemotesPlugin(Plugin):
|
|||||||
"""
|
"""
|
||||||
## Name PluginList ##
|
## Name PluginList ##
|
||||||
self.textStrings[StringContent.Name] = {
|
self.textStrings[StringContent.Name] = {
|
||||||
u'singular': translate('RemotePlugin', 'Remote'),
|
u'singular': translate('RemotePlugin', 'Remote', 'name singular'),
|
||||||
u'plural': translate('RemotePlugin', 'Remotes')
|
u'plural': translate('RemotePlugin', 'Remotes', 'name plural')
|
||||||
}
|
}
|
||||||
## Name for MediaDockManager, SettingsManager ##
|
## Name for MediaDockManager, SettingsManager ##
|
||||||
self.textStrings[StringContent.VisibleName] = {
|
self.textStrings[StringContent.VisibleName] = {
|
||||||
u'title': translate('RemotePlugin', 'Remote')
|
u'title': translate('RemotePlugin', 'Remote', 'container title')
|
||||||
}
|
}
|
||||||
|
@ -109,7 +109,7 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
|
|||||||
author_name = QtGui.QListWidgetItem(author.display_name)
|
author_name = QtGui.QListWidgetItem(author.display_name)
|
||||||
else:
|
else:
|
||||||
author_name = QtGui.QListWidgetItem(
|
author_name = QtGui.QListWidgetItem(
|
||||||
u'%s %s' % (author.first_name, author.last_name))
|
u' '.join(author.first_name, author.last_name))
|
||||||
author_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(author.id))
|
author_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(author.id))
|
||||||
self.AuthorsListWidget.addItem(author_name)
|
self.AuthorsListWidget.addItem(author_name)
|
||||||
if self.AuthorsListWidget.count() == 0:
|
if self.AuthorsListWidget.count() == 0:
|
||||||
@ -305,12 +305,13 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
|
|||||||
'Could not save your changes.'))
|
'Could not save your changes.'))
|
||||||
elif QtGui.QMessageBox.critical(self,
|
elif QtGui.QMessageBox.critical(self,
|
||||||
translate('SongsPlugin.SongMaintenanceForm', 'Error'),
|
translate('SongsPlugin.SongMaintenanceForm', 'Error'),
|
||||||
translate('SongsPlugin.SongMaintenanceForm', 'The author %s'
|
unicode(translate('SongsPlugin.SongMaintenanceForm',
|
||||||
' already exists. Would you like to make songs with author '
|
'The author %s already exists. Would you like to make songs'
|
||||||
'%s use the existing author %s?' % (author.display_name,
|
' with author %s use the existing author %s?')) %
|
||||||
temp_display_name, author.display_name)),
|
(author.display_name, temp_display_name,
|
||||||
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.No |
|
author.display_name), QtGui.QMessageBox.StandardButtons(
|
||||||
QtGui.QMessageBox.Yes)) == QtGui.QMessageBox.Yes:
|
QtGui.QMessageBox.No | QtGui.QMessageBox.Yes)) == \
|
||||||
|
QtGui.QMessageBox.Yes:
|
||||||
self.mergeAuthors(author)
|
self.mergeAuthors(author)
|
||||||
self.resetAuthors()
|
self.resetAuthors()
|
||||||
Receiver.send_message(u'songs_load_list')
|
Receiver.send_message(u'songs_load_list')
|
||||||
@ -346,12 +347,12 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
|
|||||||
'Could not save your changes.'))
|
'Could not save your changes.'))
|
||||||
elif QtGui.QMessageBox.critical(self,
|
elif QtGui.QMessageBox.critical(self,
|
||||||
translate('SongsPlugin.SongMaintenanceForm', 'Error'),
|
translate('SongsPlugin.SongMaintenanceForm', 'Error'),
|
||||||
translate('SongsPlugin.SongMaintenanceForm', 'The topic %s '
|
unicode(translate('SongsPlugin.SongMaintenanceForm',
|
||||||
'already exists. Would you like to make songs with topic %s'
|
'The topic %s already exists. Would you like to make songs '
|
||||||
' use the existing topic %s?' % (topic.name, temp_name,
|
'with topic %s use the existing topic %s?')) % (topic.name,
|
||||||
topic.name)),
|
temp_name, topic.name), QtGui.QMessageBox.StandardButtons(
|
||||||
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.No |
|
QtGui.QMessageBox.No | QtGui.QMessageBox.Yes)) == \
|
||||||
QtGui.QMessageBox.Yes)) == QtGui.QMessageBox.Yes:
|
QtGui.QMessageBox.Yes:
|
||||||
self.mergeTopics(topic)
|
self.mergeTopics(topic)
|
||||||
self.resetTopics()
|
self.resetTopics()
|
||||||
else:
|
else:
|
||||||
@ -389,12 +390,12 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
|
|||||||
'Could not save your changes.'))
|
'Could not save your changes.'))
|
||||||
elif QtGui.QMessageBox.critical(self,
|
elif QtGui.QMessageBox.critical(self,
|
||||||
translate('SongsPlugin.SongMaintenanceForm', 'Error'),
|
translate('SongsPlugin.SongMaintenanceForm', 'Error'),
|
||||||
translate('SongsPlugin.SongMaintenanceForm', 'The book %s '
|
unicode(translate('SongsPlugin.SongMaintenanceForm',
|
||||||
'already exists. Would you like to make songs with book %s '
|
'The book %s already exists. Would you like to make songs '
|
||||||
'use the existing book %s?' % (book.name, temp_name,
|
'with book %s use the existing book %s?')) % (book.name,
|
||||||
book.name)),
|
temp_name, book.name), QtGui.QMessageBox.StandardButtons(
|
||||||
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.No |
|
QtGui.QMessageBox.No | QtGui.QMessageBox.Yes)) == \
|
||||||
QtGui.QMessageBox.Yes)) == QtGui.QMessageBox.Yes:
|
QtGui.QMessageBox.Yes:
|
||||||
self.mergeBooks(book)
|
self.mergeBooks(book)
|
||||||
self.resetBooks()
|
self.resetBooks()
|
||||||
else:
|
else:
|
||||||
@ -498,4 +499,4 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
|
|||||||
translate('SongsPlugin.SongMaintenanceForm',
|
translate('SongsPlugin.SongMaintenanceForm',
|
||||||
'This book cannot be deleted, it is currently '
|
'This book cannot be deleted, it is currently '
|
||||||
'assigned to at least one song.'),
|
'assigned to at least one song.'),
|
||||||
translate('SongsPlugin.SongMaintenanceForm', 'No book selected!'))
|
translate('SongsPlugin.SongMaintenanceForm', 'No book selected!'))
|
||||||
|
@ -29,6 +29,7 @@ import os
|
|||||||
import chardet
|
import chardet
|
||||||
import codecs
|
import codecs
|
||||||
|
|
||||||
|
from openlp.core.lib import translate
|
||||||
from songimport import SongImport
|
from songimport import SongImport
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
@ -69,8 +70,9 @@ class CCLIFileImport(SongImport):
|
|||||||
self.import_wizard.importProgressBar.setMaximum(song_total)
|
self.import_wizard.importProgressBar.setMaximum(song_total)
|
||||||
song_count = 1
|
song_count = 1
|
||||||
for filename in self.filenames:
|
for filename in self.filenames:
|
||||||
self.import_wizard.incrementProgressBar(
|
self.import_wizard.incrementProgressBar(unicode(translate(
|
||||||
u'Importing song %s of %s' % (song_count, song_total))
|
'SongsPlugin.CCLIFileImport', 'Importing song %d of %d')) %
|
||||||
|
(song_count, song_total))
|
||||||
filename = unicode(filename)
|
filename = unicode(filename)
|
||||||
log.debug(u'Importing CCLI File: %s', filename)
|
log.debug(u'Importing CCLI File: %s', filename)
|
||||||
lines = []
|
lines = []
|
||||||
|
@ -232,7 +232,7 @@ class SongMediaItem(MediaManagerItem):
|
|||||||
self.listView.clear()
|
self.listView.clear()
|
||||||
for author in searchresults:
|
for author in searchresults:
|
||||||
for song in author.songs:
|
for song in author.songs:
|
||||||
song_detail = '%s (%s)' % (author.display_name, song.title)
|
song_detail = u'%s (%s)' % (author.display_name, song.title)
|
||||||
song_name = QtGui.QListWidgetItem(song_detail)
|
song_name = QtGui.QListWidgetItem(song_detail)
|
||||||
song_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(song.id))
|
song_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(song.id))
|
||||||
self.listView.addItem(song_name)
|
self.listView.addItem(song_name)
|
||||||
@ -314,16 +314,11 @@ class SongMediaItem(MediaManagerItem):
|
|||||||
translate('SongsPlugin.MediaItem',
|
translate('SongsPlugin.MediaItem',
|
||||||
'You must select an item to delete.')):
|
'You must select an item to delete.')):
|
||||||
items = self.listView.selectedIndexes()
|
items = self.listView.selectedIndexes()
|
||||||
if len(items) == 1:
|
|
||||||
del_message = translate('SongsPlugin.MediaItem',
|
|
||||||
'Are you sure you want to delete the selected song?')
|
|
||||||
else:
|
|
||||||
del_message = unicode(translate('SongsPlugin.MediaItem',
|
|
||||||
'Are you sure you want to delete the %d selected '
|
|
||||||
'songs?')) % len(items)
|
|
||||||
ans = QtGui.QMessageBox.question(self,
|
ans = QtGui.QMessageBox.question(self,
|
||||||
translate('SongsPlugin.MediaItem', 'Delete Song(s)?'),
|
translate('SongsPlugin.MediaItem', 'Delete Song(s)?'),
|
||||||
del_message,
|
translate('SongsPlugin.MediaItem',
|
||||||
|
'Are you sure you want to delete the %n selected song(s)?', '',
|
||||||
|
QtCore.QCoreApplication.CodecForTr, len(items)),
|
||||||
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok|
|
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok|
|
||||||
QtGui.QMessageBox.Cancel),
|
QtGui.QMessageBox.Cancel),
|
||||||
QtGui.QMessageBox.Ok)
|
QtGui.QMessageBox.Ok)
|
||||||
|
@ -34,6 +34,7 @@ from sqlalchemy.orm import class_mapper, mapper, relation, scoped_session, \
|
|||||||
sessionmaker
|
sessionmaker
|
||||||
from sqlalchemy.orm.exc import UnmappedClassError
|
from sqlalchemy.orm.exc import UnmappedClassError
|
||||||
|
|
||||||
|
from openlp.core.lib import translate
|
||||||
from openlp.core.lib.db import BaseModel
|
from openlp.core.lib.db import BaseModel
|
||||||
from openlp.plugins.songs.lib.db import Author, Book, Song, Topic #, MediaFile
|
from openlp.plugins.songs.lib.db import Author, Book, Song, Topic #, MediaFile
|
||||||
from songimport import SongImport
|
from songimport import SongImport
|
||||||
@ -148,8 +149,9 @@ class OpenLPSongImport(SongImport):
|
|||||||
self.import_wizard.importProgressBar.setMaximum(song_total)
|
self.import_wizard.importProgressBar.setMaximum(song_total)
|
||||||
song_count = 1
|
song_count = 1
|
||||||
for song in source_songs:
|
for song in source_songs:
|
||||||
self.import_wizard.incrementProgressBar(
|
self.import_wizard.incrementProgressBar(unicode(translate(
|
||||||
u'Importing song %s of %s' % (song_count, song_total))
|
'SongsPlugin.OpenLPSongImport', 'Importing song %d of %d.')) %
|
||||||
|
(song_count, song_total))
|
||||||
new_song = Song()
|
new_song = Song()
|
||||||
new_song.title = song.title
|
new_song.title = song.title
|
||||||
if has_media_files and hasattr(song, 'alternate_title'):
|
if has_media_files and hasattr(song, 'alternate_title'):
|
||||||
@ -220,4 +222,4 @@ class OpenLPSongImport(SongImport):
|
|||||||
if self.stop_import_flag:
|
if self.stop_import_flag:
|
||||||
return False
|
return False
|
||||||
engine.dispose()
|
engine.dispose()
|
||||||
return True
|
return True
|
||||||
|
@ -126,17 +126,17 @@ class SongBeamerImport(SongImport):
|
|||||||
if verse_start:
|
if verse_start:
|
||||||
verse_start = False
|
verse_start = False
|
||||||
if not self.check_verse_marks(line):
|
if not self.check_verse_marks(line):
|
||||||
self.current_verse = u'%s\n' % line
|
self.current_verse = line + u'\n'
|
||||||
else:
|
else:
|
||||||
self.current_verse += u'%s\n' % line
|
self.current_verse += line + u'\n'
|
||||||
if self.current_verse:
|
if self.current_verse:
|
||||||
self.replace_html_tags()
|
self.replace_html_tags()
|
||||||
self.add_verse(self.current_verse, self.current_verse_type)
|
self.add_verse(self.current_verse, self.current_verse_type)
|
||||||
if self.check_complete():
|
if self.check_complete():
|
||||||
self.finish()
|
self.finish()
|
||||||
self.import_wizard.incrementProgressBar(u'%s %s...' %
|
self.import_wizard.incrementProgressBar(unicode(translate(
|
||||||
(translate('SongsPlugin.SongBeamerImport', 'Importing'),
|
'SongsPlugin.SongBeamerImport', 'Importing %s...')) %
|
||||||
self.file_name))
|
self.file_name)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def replace_html_tags(self):
|
def replace_html_tags(self):
|
||||||
@ -252,7 +252,7 @@ class SongBeamerImport(SongImport):
|
|||||||
elif tag_val[0] == u'#TextAlign':
|
elif tag_val[0] == u'#TextAlign':
|
||||||
pass
|
pass
|
||||||
elif tag_val[0] == u'#Title':
|
elif tag_val[0] == u'#Title':
|
||||||
self.title = u'%s' % tag_val[1]
|
self.title = unicode(tag_val[1])
|
||||||
elif tag_val[0] == u'#TitleAlign':
|
elif tag_val[0] == u'#TitleAlign':
|
||||||
pass
|
pass
|
||||||
elif tag_val[0] == u'#TitleFontSize':
|
elif tag_val[0] == u'#TitleFontSize':
|
||||||
|
@ -213,45 +213,45 @@ class SongsPlugin(Plugin):
|
|||||||
"""
|
"""
|
||||||
## Name PluginList ##
|
## Name PluginList ##
|
||||||
self.textStrings[StringContent.Name] = {
|
self.textStrings[StringContent.Name] = {
|
||||||
u'singular': translate('SongsPlugin', 'Song'),
|
u'singular': translate('SongsPlugin', 'Song', 'name singular'),
|
||||||
u'plural': translate('SongsPlugin', 'Songs')
|
u'plural': translate('SongsPlugin', 'Songs', 'name plural')
|
||||||
}
|
}
|
||||||
## Name for MediaDockManager, SettingsManager ##
|
## Name for MediaDockManager, SettingsManager ##
|
||||||
self.textStrings[StringContent.VisibleName] = {
|
self.textStrings[StringContent.VisibleName] = {
|
||||||
u'title': translate('SongsPlugin', 'Songs')
|
u'title': translate('SongsPlugin', 'Songs', 'container title')
|
||||||
}
|
}
|
||||||
# Middle Header Bar
|
# Middle Header Bar
|
||||||
## New Button ##
|
## New Action ##
|
||||||
self.textStrings[StringContent.New] = {
|
self.textStrings[StringContent.New] = {
|
||||||
u'title': translate('SongsPlugin', 'Add'),
|
u'title': translate('SongsPlugin', 'Add'),
|
||||||
u'tooltip': translate('SongsPlugin',
|
u'tooltip': translate('SongsPlugin',
|
||||||
'Add a new Song')
|
'Add a new Song')
|
||||||
}
|
}
|
||||||
## Edit Button ##
|
## Edit Action ##
|
||||||
self.textStrings[StringContent.Edit] = {
|
self.textStrings[StringContent.Edit] = {
|
||||||
u'title': translate('SongsPlugin', 'Edit'),
|
u'title': translate('SongsPlugin', 'Edit'),
|
||||||
u'tooltip': translate('SongsPlugin',
|
u'tooltip': translate('SongsPlugin',
|
||||||
'Edit the selected Song')
|
'Edit the selected Song')
|
||||||
}
|
}
|
||||||
## Delete Button ##
|
## Delete Action ##
|
||||||
self.textStrings[StringContent.Delete] = {
|
self.textStrings[StringContent.Delete] = {
|
||||||
u'title': translate('SongsPlugin', 'Delete'),
|
u'title': translate('SongsPlugin', 'Delete'),
|
||||||
u'tooltip': translate('SongsPlugin',
|
u'tooltip': translate('SongsPlugin',
|
||||||
'Delete the selected Song')
|
'Delete the selected Song')
|
||||||
}
|
}
|
||||||
## Preview ##
|
## Preview Action ##
|
||||||
self.textStrings[StringContent.Preview] = {
|
self.textStrings[StringContent.Preview] = {
|
||||||
u'title': translate('SongsPlugin', 'Preview'),
|
u'title': translate('SongsPlugin', 'Preview'),
|
||||||
u'tooltip': translate('SongsPlugin',
|
u'tooltip': translate('SongsPlugin',
|
||||||
'Preview the selected Song')
|
'Preview the selected Song')
|
||||||
}
|
}
|
||||||
## Live Button ##
|
## Send Live Action ##
|
||||||
self.textStrings[StringContent.Live] = {
|
self.textStrings[StringContent.Live] = {
|
||||||
u'title': translate('SongsPlugin', 'Live'),
|
u'title': translate('SongsPlugin', 'Live'),
|
||||||
u'tooltip': translate('SongsPlugin',
|
u'tooltip': translate('SongsPlugin',
|
||||||
'Send the selected Song live')
|
'Send the selected Song live')
|
||||||
}
|
}
|
||||||
## Add to service Button ##
|
## Add to Service Action ##
|
||||||
self.textStrings[StringContent.Service] = {
|
self.textStrings[StringContent.Service] = {
|
||||||
u'title': translate('SongsPlugin', 'Service'),
|
u'title': translate('SongsPlugin', 'Service'),
|
||||||
u'tooltip': translate('SongsPlugin',
|
u'tooltip': translate('SongsPlugin',
|
||||||
@ -265,4 +265,4 @@ class SongsPlugin(Plugin):
|
|||||||
log.info(u'Songs Finalising')
|
log.info(u'Songs Finalising')
|
||||||
self.manager.finalise()
|
self.manager.finalise()
|
||||||
self.toolsReindexItem.setVisible(False)
|
self.toolsReindexItem.setVisible(False)
|
||||||
Plugin.finalise(self)
|
Plugin.finalise(self)
|
||||||
|
@ -73,7 +73,8 @@ class SongUsageDetailForm(QtGui.QDialog, Ui_SongUsageDetailDialog):
|
|||||||
|
|
||||||
def accept(self):
|
def accept(self):
|
||||||
log.debug(u'Detailed report generated')
|
log.debug(u'Detailed report generated')
|
||||||
filename = u'usage_detail_%s_%s.txt' % (
|
filename = unicode(translate('SongUsagePlugin.SongUsageDetailForm',
|
||||||
|
'usage_detail_%s_%s.txt')) % (
|
||||||
self.fromDate.selectedDate().toString(u'ddMMyyyy'),
|
self.fromDate.selectedDate().toString(u'ddMMyyyy'),
|
||||||
self.toDate.selectedDate().toString(u'ddMMyyyy'))
|
self.toDate.selectedDate().toString(u'ddMMyyyy'))
|
||||||
usage = self.plugin.manager.get_all_objects(
|
usage = self.plugin.manager.get_all_objects(
|
||||||
@ -95,4 +96,4 @@ class SongUsageDetailForm(QtGui.QDialog, Ui_SongUsageDetailDialog):
|
|||||||
finally:
|
finally:
|
||||||
if file:
|
if file:
|
||||||
file.close()
|
file.close()
|
||||||
self.close()
|
self.close()
|
||||||
|
@ -175,10 +175,13 @@ class SongUsagePlugin(Plugin):
|
|||||||
"""
|
"""
|
||||||
## Name PluginList ##
|
## Name PluginList ##
|
||||||
self.textStrings[StringContent.Name] = {
|
self.textStrings[StringContent.Name] = {
|
||||||
u'singular': translate('SongUsagePlugin', 'SongUsage'),
|
u'singular': translate('SongUsagePlugin', 'SongUsage',
|
||||||
u'plural': translate('SongUsagePlugin', 'SongUsage')
|
'name singular'),
|
||||||
|
u'plural': translate('SongUsagePlugin', 'SongUsage',
|
||||||
|
'name plural')
|
||||||
}
|
}
|
||||||
## Name for MediaDockManager, SettingsManager ##
|
## Name for MediaDockManager, SettingsManager ##
|
||||||
self.textStrings[StringContent.VisibleName] = {
|
self.textStrings[StringContent.VisibleName] = {
|
||||||
u'title': translate('SongUsagePlugin', 'SongUsage')
|
u'title': translate('SongUsagePlugin', 'SongUsage',
|
||||||
}
|
'container title')
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user