forked from openlp/openlp
More Migrations to Registry and Code Clean ups
New Tests for UI dialogs bzr-revno: 2162
This commit is contained in:
commit
a5031633b7
@ -200,12 +200,6 @@ class EventReceiver(QtCore.QObject):
|
|||||||
``{plugin}_unblank``
|
``{plugin}_unblank``
|
||||||
Requests a plugin to handle an unblank screen event.
|
Requests a plugin to handle an unblank screen event.
|
||||||
|
|
||||||
``{plugin}_edit``
|
|
||||||
Requests a plugin edit a database item with the key as the payload.
|
|
||||||
|
|
||||||
``{plugin}_edit_clear``
|
|
||||||
Editing has been completed.
|
|
||||||
|
|
||||||
``{plugin}_load_list``
|
``{plugin}_load_list``
|
||||||
Tells the the plugin to reload the media manager list.
|
Tells the the plugin to reload the media manager list.
|
||||||
|
|
||||||
|
@ -99,7 +99,7 @@ class MediaManagerItem(QtGui.QWidget):
|
|||||||
self.plugin = plugin
|
self.plugin = plugin
|
||||||
visible_title = self.plugin.getString(StringContent.VisibleName)
|
visible_title = self.plugin.getString(StringContent.VisibleName)
|
||||||
self.title = unicode(visible_title[u'title'])
|
self.title = unicode(visible_title[u'title'])
|
||||||
Registry().register(self.title, self)
|
Registry().register(self.plugin.name, self)
|
||||||
self.settingsSection = self.plugin.name
|
self.settingsSection = self.plugin.name
|
||||||
self.icon = None
|
self.icon = None
|
||||||
if icon:
|
if icon:
|
||||||
@ -436,8 +436,8 @@ class MediaManagerItem(QtGui.QWidget):
|
|||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def generateSlideData(self, serviceItem, item=None, xmlVersion=False,
|
def generateSlideData(self, serviceItem, item=None, xmlVersion=False, remote=False,
|
||||||
remote=False, context=ServiceItemContext.Live):
|
context=ServiceItemContext.Live):
|
||||||
raise NotImplementedError(u'MediaManagerItem.generateSlideData needs to be defined by the plugin')
|
raise NotImplementedError(u'MediaManagerItem.generateSlideData needs to be defined by the plugin')
|
||||||
|
|
||||||
def onDoubleClicked(self):
|
def onDoubleClicked(self):
|
||||||
@ -470,7 +470,7 @@ class MediaManagerItem(QtGui.QWidget):
|
|||||||
serviceItem = self.buildServiceItem()
|
serviceItem = self.buildServiceItem()
|
||||||
if serviceItem:
|
if serviceItem:
|
||||||
serviceItem.from_plugin = True
|
serviceItem.from_plugin = True
|
||||||
self.preview_controller.addServiceItem(serviceItem)
|
self.preview_controller.add_service_item(serviceItem)
|
||||||
if keepFocus:
|
if keepFocus:
|
||||||
self.listView.setFocus()
|
self.listView.setFocus()
|
||||||
|
|
||||||
@ -496,7 +496,7 @@ class MediaManagerItem(QtGui.QWidget):
|
|||||||
serviceItem.from_plugin = True
|
serviceItem.from_plugin = True
|
||||||
if remote:
|
if remote:
|
||||||
serviceItem.will_auto_start = True
|
serviceItem.will_auto_start = True
|
||||||
self.live_controller.addServiceItem(serviceItem)
|
self.live_controller.add_service_item(serviceItem)
|
||||||
|
|
||||||
def createItemFromId(self, item_id):
|
def createItemFromId(self, item_id):
|
||||||
item = QtGui.QListWidgetItem()
|
item = QtGui.QListWidgetItem()
|
||||||
@ -507,13 +507,13 @@ class MediaManagerItem(QtGui.QWidget):
|
|||||||
"""
|
"""
|
||||||
Add a selected item to the current service
|
Add a selected item to the current service
|
||||||
"""
|
"""
|
||||||
if not self.listView.selectedIndexes() and not self.remoteTriggered:
|
if not self.listView.selectedIndexes():
|
||||||
QtGui.QMessageBox.information(self, UiStrings().NISp,
|
QtGui.QMessageBox.information(self, UiStrings().NISp,
|
||||||
translate('OpenLP.MediaManagerItem', 'You must select one or more items to add.'))
|
translate('OpenLP.MediaManagerItem', 'You must select one or more items to add.'))
|
||||||
else:
|
else:
|
||||||
# Is it possible to process multiple list items to generate
|
# Is it possible to process multiple list items to generate
|
||||||
# multiple service items?
|
# multiple service items?
|
||||||
if self.singleServiceItem or self.remoteTriggered:
|
if self.singleServiceItem:
|
||||||
log.debug(u'%s Add requested', self.plugin.name)
|
log.debug(u'%s Add requested', self.plugin.name)
|
||||||
self.addToService(replace=self.remoteTriggered)
|
self.addToService(replace=self.remoteTriggered)
|
||||||
else:
|
else:
|
||||||
@ -525,7 +525,7 @@ class MediaManagerItem(QtGui.QWidget):
|
|||||||
serviceItem = self.buildServiceItem(item, True, remote=remote, context=ServiceItemContext.Service)
|
serviceItem = self.buildServiceItem(item, True, remote=remote, context=ServiceItemContext.Service)
|
||||||
if serviceItem:
|
if serviceItem:
|
||||||
serviceItem.from_plugin = False
|
serviceItem.from_plugin = False
|
||||||
self.service_manager.addServiceItem(serviceItem, replace=replace)
|
self.service_manager.add_service_item(serviceItem, replace=replace)
|
||||||
|
|
||||||
def onAddEditClick(self):
|
def onAddEditClick(self):
|
||||||
"""
|
"""
|
||||||
@ -536,13 +536,13 @@ class MediaManagerItem(QtGui.QWidget):
|
|||||||
translate('OpenLP.MediaManagerItem', 'You must select one or more items.'))
|
translate('OpenLP.MediaManagerItem', 'You must select one or more items.'))
|
||||||
else:
|
else:
|
||||||
log.debug(u'%s Add requested', self.plugin.name)
|
log.debug(u'%s Add requested', self.plugin.name)
|
||||||
serviceItem = self.plugin.serviceManager.getServiceItem()
|
serviceItem = self.service_manager.get_service_item()
|
||||||
if not serviceItem:
|
if not serviceItem:
|
||||||
QtGui.QMessageBox.information(self, UiStrings().NISs,
|
QtGui.QMessageBox.information(self, UiStrings().NISs,
|
||||||
translate('OpenLP.MediaManagerItem', 'You must select an existing service item to add to.'))
|
translate('OpenLP.MediaManagerItem', 'You must select an existing service item to add to.'))
|
||||||
elif self.plugin.name == serviceItem.name:
|
elif self.plugin.name == serviceItem.name:
|
||||||
self.generateSlideData(serviceItem)
|
self.generateSlideData(serviceItem)
|
||||||
self.service_manager.addServiceItem(serviceItem, replace=True)
|
self.service_manager.add_service_item(serviceItem, replace=True)
|
||||||
else:
|
else:
|
||||||
# Turn off the remote edit update message indicator
|
# Turn off the remote edit update message indicator
|
||||||
QtGui.QMessageBox.information(self, translate('OpenLP.MediaManagerItem', 'Invalid Service Item'),
|
QtGui.QMessageBox.information(self, translate('OpenLP.MediaManagerItem', 'Invalid Service Item'),
|
||||||
@ -554,8 +554,7 @@ class MediaManagerItem(QtGui.QWidget):
|
|||||||
"""
|
"""
|
||||||
serviceItem = ServiceItem(self.plugin)
|
serviceItem = ServiceItem(self.plugin)
|
||||||
serviceItem.add_icon(self.plugin.iconPath)
|
serviceItem.add_icon(self.plugin.iconPath)
|
||||||
if self.generateSlideData(serviceItem, item, xmlVersion, remote,
|
if self.generateSlideData(serviceItem, item, xmlVersion, remote, context):
|
||||||
context):
|
|
||||||
return serviceItem
|
return serviceItem
|
||||||
else:
|
else:
|
||||||
return None
|
return None
|
||||||
@ -681,10 +680,11 @@ class MediaManagerItem(QtGui.QWidget):
|
|||||||
|
|
||||||
def _get_service_manager(self):
|
def _get_service_manager(self):
|
||||||
"""
|
"""
|
||||||
Adds the plugin manager to the class dynamically
|
Adds the service manager to the class dynamically
|
||||||
"""
|
"""
|
||||||
if not hasattr(self, u'_service_manager'):
|
if not hasattr(self, u'_service_manager'):
|
||||||
self._service_manager = Registry().get(u'service_manager')
|
self._service_manager = Registry().get(u'service_manager')
|
||||||
return self._service_manager
|
return self._service_manager
|
||||||
|
|
||||||
service_manager = property(_get_service_manager)
|
service_manager = property(_get_service_manager)
|
||||||
|
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
Provide Registry Services
|
Provide Registry Services
|
||||||
"""
|
"""
|
||||||
import logging
|
import logging
|
||||||
|
import sys
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -54,8 +55,13 @@ class Registry(object):
|
|||||||
log.info(u'Registry Initialising')
|
log.info(u'Registry Initialising')
|
||||||
registry = cls()
|
registry = cls()
|
||||||
registry.service_list = {}
|
registry.service_list = {}
|
||||||
|
registry.running_under_test = False
|
||||||
|
# Allow the tests to remove Registry entries but not the live system
|
||||||
|
if u'nosetest' in sys.argv[0]:
|
||||||
|
registry.running_under_test = True
|
||||||
return registry
|
return registry
|
||||||
|
|
||||||
|
|
||||||
def get(self, key):
|
def get(self, key):
|
||||||
"""
|
"""
|
||||||
Extracts the registry value from the list based on the key passed in
|
Extracts the registry value from the list based on the key passed in
|
||||||
@ -75,3 +81,16 @@ class Registry(object):
|
|||||||
raise KeyError(u'Duplicate service exception %s' % key)
|
raise KeyError(u'Duplicate service exception %s' % key)
|
||||||
else:
|
else:
|
||||||
self.service_list[key] = reference
|
self.service_list[key] = reference
|
||||||
|
|
||||||
|
def remove(self, key):
|
||||||
|
"""
|
||||||
|
Removes the registry value from the list based on the key passed in
|
||||||
|
(Only valid and active for testing framework)
|
||||||
|
"""
|
||||||
|
if self.running_under_test == False:
|
||||||
|
log.error(u'Invalid Method call for key %s' % key)
|
||||||
|
raise KeyError(u'Invalid Method call for key %s' % key)
|
||||||
|
return
|
||||||
|
if key in self.service_list:
|
||||||
|
del self.service_list[key]
|
||||||
|
|
||||||
|
@ -165,7 +165,7 @@ class Settings(QtCore.QSettings):
|
|||||||
u'shortcuts/importBibleItem': [],
|
u'shortcuts/importBibleItem': [],
|
||||||
u'shortcuts/modeDefaultItem': [],
|
u'shortcuts/modeDefaultItem': [],
|
||||||
u'shortcuts/modeLiveItem': [],
|
u'shortcuts/modeLiveItem': [],
|
||||||
u'shortcuts/makeLive': [QtCore.Qt.Key_Enter, QtCore.Qt.Key_Return],
|
u'shortcuts/make_live': [QtCore.Qt.Key_Enter, QtCore.Qt.Key_Return],
|
||||||
u'shortcuts/moveUp': [QtCore.Qt.Key_PageUp],
|
u'shortcuts/moveUp': [QtCore.Qt.Key_PageUp],
|
||||||
u'shortcuts/moveTop': [QtCore.Qt.Key_Home],
|
u'shortcuts/moveTop': [QtCore.Qt.Key_Home],
|
||||||
u'shortcuts/modeSetupItem': [],
|
u'shortcuts/modeSetupItem': [],
|
||||||
@ -242,6 +242,7 @@ class Settings(QtCore.QSettings):
|
|||||||
(u'songs/last directory 1', u'songs/last directory import', []),
|
(u'songs/last directory 1', u'songs/last directory import', []),
|
||||||
(u'bibles/last directory 1', u'bibles/last directory import', []),
|
(u'bibles/last directory 1', u'bibles/last directory import', []),
|
||||||
(u'songusage/last directory 1', u'songusage/last directory export', []),
|
(u'songusage/last directory 1', u'songusage/last directory export', []),
|
||||||
|
(u'shortcuts/makeLive', u'shortcuts/make_live', []),
|
||||||
(u'advanced/stylesheet fix', u'', []),
|
(u'advanced/stylesheet fix', u'', []),
|
||||||
(u'media/background color', u'players/background color', [])
|
(u'media/background color', u'players/background color', [])
|
||||||
]
|
]
|
||||||
|
@ -74,8 +74,8 @@ class Ui_AboutDialog(object):
|
|||||||
self.aboutNotebook.addTab(self.licenseTab, u'')
|
self.aboutNotebook.addTab(self.licenseTab, u'')
|
||||||
self.aboutDialogLayout.addWidget(self.aboutNotebook)
|
self.aboutDialogLayout.addWidget(self.aboutNotebook)
|
||||||
self.volunteerButton = create_button(None, u'volunteerButton', icon=u':/system/system_volunteer.png')
|
self.volunteerButton = create_button(None, u'volunteerButton', icon=u':/system/system_volunteer.png')
|
||||||
self.buttonBox = create_button_box(aboutDialog, u'buttonBox', [u'close'], [self.volunteerButton])
|
self.button_box = create_button_box(aboutDialog, u'button_box', [u'close'], [self.volunteerButton])
|
||||||
self.aboutDialogLayout.addWidget(self.buttonBox)
|
self.aboutDialogLayout.addWidget(self.button_box)
|
||||||
self.retranslateUi(aboutDialog)
|
self.retranslateUi(aboutDialog)
|
||||||
self.aboutNotebook.setCurrentIndex(0)
|
self.aboutNotebook.setCurrentIndex(0)
|
||||||
|
|
||||||
|
@ -70,9 +70,9 @@ class Ui_ExceptionDialog(object):
|
|||||||
icon=u':/general/general_save.png', click=self.onSaveReportButtonClicked)
|
icon=u':/general/general_save.png', click=self.onSaveReportButtonClicked)
|
||||||
self.attachFileButton = create_button(exceptionDialog, u'attachFileButton',
|
self.attachFileButton = create_button(exceptionDialog, u'attachFileButton',
|
||||||
icon=u':/general/general_open.png', click=self.onAttachFileButtonClicked)
|
icon=u':/general/general_open.png', click=self.onAttachFileButtonClicked)
|
||||||
self.buttonBox = create_button_box(exceptionDialog, u'buttonBox',
|
self.button_box = create_button_box(exceptionDialog, u'button_box',
|
||||||
[u'close'], [self.sendReportButton, self.saveReportButton, self.attachFileButton])
|
[u'close'], [self.sendReportButton, self.saveReportButton, self.attachFileButton])
|
||||||
self.exceptionLayout.addWidget(self.buttonBox)
|
self.exceptionLayout.addWidget(self.button_box)
|
||||||
|
|
||||||
self.retranslateUi(exceptionDialog)
|
self.retranslateUi(exceptionDialog)
|
||||||
QtCore.QObject.connect(self.descriptionTextEdit,
|
QtCore.QObject.connect(self.descriptionTextEdit,
|
||||||
|
@ -37,7 +37,7 @@ class Ui_FileRenameDialog(object):
|
|||||||
fileRenameDialog.setObjectName(u'fileRenameDialog')
|
fileRenameDialog.setObjectName(u'fileRenameDialog')
|
||||||
fileRenameDialog.resize(300, 10)
|
fileRenameDialog.resize(300, 10)
|
||||||
self.dialogLayout = QtGui.QGridLayout(fileRenameDialog)
|
self.dialogLayout = QtGui.QGridLayout(fileRenameDialog)
|
||||||
self.dialogLayout.setObjectName(u'dialogLayout')
|
self.dialogLayout.setObjectName(u'dialog_layout')
|
||||||
self.fileNameLabel = QtGui.QLabel(fileRenameDialog)
|
self.fileNameLabel = QtGui.QLabel(fileRenameDialog)
|
||||||
self.fileNameLabel.setObjectName(u'fileNameLabel')
|
self.fileNameLabel.setObjectName(u'fileNameLabel')
|
||||||
self.dialogLayout.addWidget(self.fileNameLabel, 0, 0)
|
self.dialogLayout.addWidget(self.fileNameLabel, 0, 0)
|
||||||
@ -45,8 +45,8 @@ class Ui_FileRenameDialog(object):
|
|||||||
self.fileNameEdit.setValidator(QtGui.QRegExpValidator(QtCore.QRegExp(r'[^/\\?*|<>\[\]":+%]+'), self))
|
self.fileNameEdit.setValidator(QtGui.QRegExpValidator(QtCore.QRegExp(r'[^/\\?*|<>\[\]":+%]+'), self))
|
||||||
self.fileNameEdit.setObjectName(u'fileNameEdit')
|
self.fileNameEdit.setObjectName(u'fileNameEdit')
|
||||||
self.dialogLayout.addWidget(self.fileNameEdit, 0, 1)
|
self.dialogLayout.addWidget(self.fileNameEdit, 0, 1)
|
||||||
self.buttonBox = create_button_box(fileRenameDialog, u'buttonBox', [u'cancel', u'ok'])
|
self.button_box = create_button_box(fileRenameDialog, u'button_box', [u'cancel', u'ok'])
|
||||||
self.dialogLayout.addWidget(self.buttonBox, 1, 0, 1, 2)
|
self.dialogLayout.addWidget(self.button_box, 1, 0, 1, 2)
|
||||||
self.retranslateUi(fileRenameDialog)
|
self.retranslateUi(fileRenameDialog)
|
||||||
self.setMaximumHeight(self.sizeHint().height())
|
self.setMaximumHeight(self.sizeHint().height())
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ class Ui_FirstTimeLanguageDialog(object):
|
|||||||
self.dialogLayout = QtGui.QVBoxLayout(languageDialog)
|
self.dialogLayout = QtGui.QVBoxLayout(languageDialog)
|
||||||
self.dialogLayout.setContentsMargins(8, 8, 8, 8)
|
self.dialogLayout.setContentsMargins(8, 8, 8, 8)
|
||||||
self.dialogLayout.setSpacing(8)
|
self.dialogLayout.setSpacing(8)
|
||||||
self.dialogLayout.setObjectName(u'dialogLayout')
|
self.dialogLayout.setObjectName(u'dialog_layout')
|
||||||
self.infoLabel = QtGui.QLabel(languageDialog)
|
self.infoLabel = QtGui.QLabel(languageDialog)
|
||||||
self.infoLabel.setObjectName(u'infoLabel')
|
self.infoLabel.setObjectName(u'infoLabel')
|
||||||
self.dialogLayout.addWidget(self.infoLabel)
|
self.dialogLayout.addWidget(self.infoLabel)
|
||||||
@ -53,8 +53,8 @@ class Ui_FirstTimeLanguageDialog(object):
|
|||||||
self.languageComboBox.setObjectName("languageComboBox")
|
self.languageComboBox.setObjectName("languageComboBox")
|
||||||
self.languageLayout.addWidget(self.languageComboBox)
|
self.languageLayout.addWidget(self.languageComboBox)
|
||||||
self.dialogLayout.addLayout(self.languageLayout)
|
self.dialogLayout.addLayout(self.languageLayout)
|
||||||
self.buttonBox = create_button_box(languageDialog, u'buttonBox', [u'cancel', u'ok'])
|
self.button_box = create_button_box(languageDialog, u'button_box', [u'cancel', u'ok'])
|
||||||
self.dialogLayout.addWidget(self.buttonBox)
|
self.dialogLayout.addWidget(self.button_box)
|
||||||
self.retranslateUi(languageDialog)
|
self.retranslateUi(languageDialog)
|
||||||
self.setMaximumHeight(self.sizeHint().height())
|
self.setMaximumHeight(self.sizeHint().height())
|
||||||
|
|
||||||
|
@ -110,8 +110,8 @@ class Ui_FormattingTagDialog(object):
|
|||||||
self.savePushButton.setObjectName(u'savePushButton')
|
self.savePushButton.setObjectName(u'savePushButton')
|
||||||
self.dataGridLayout.addWidget(self.savePushButton, 4, 2, 1, 1)
|
self.dataGridLayout.addWidget(self.savePushButton, 4, 2, 1, 1)
|
||||||
self.listdataGridLayout.addWidget(self.editGroupBox, 2, 0, 1, 1)
|
self.listdataGridLayout.addWidget(self.editGroupBox, 2, 0, 1, 1)
|
||||||
self.buttonBox = create_button_box(formattingTagDialog, u'buttonBox', [u'close'])
|
self.button_box = create_button_box(formattingTagDialog, u'button_box', [u'close'])
|
||||||
self.listdataGridLayout.addWidget(self.buttonBox, 3, 0, 1, 1)
|
self.listdataGridLayout.addWidget(self.button_box, 3, 0, 1, 1)
|
||||||
|
|
||||||
self.retranslateUi(formattingTagDialog)
|
self.retranslateUi(formattingTagDialog)
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ class FormattingTagForm(QtGui.QDialog, Ui_FormattingTagDialog):
|
|||||||
QtCore.QObject.connect(self.newPushButton, QtCore.SIGNAL(u'clicked()'), self.onNewClicked)
|
QtCore.QObject.connect(self.newPushButton, QtCore.SIGNAL(u'clicked()'), self.onNewClicked)
|
||||||
QtCore.QObject.connect(self.savePushButton, QtCore.SIGNAL(u'clicked()'), self.onSavedClicked)
|
QtCore.QObject.connect(self.savePushButton, QtCore.SIGNAL(u'clicked()'), self.onSavedClicked)
|
||||||
QtCore.QObject.connect(self.deletePushButton, QtCore.SIGNAL(u'clicked()'), self.onDeleteClicked)
|
QtCore.QObject.connect(self.deletePushButton, QtCore.SIGNAL(u'clicked()'), self.onDeleteClicked)
|
||||||
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(u'rejected()'), self.close)
|
QtCore.QObject.connect(self.button_box, QtCore.SIGNAL(u'rejected()'), self.close)
|
||||||
QtCore.QObject.connect(self.descriptionLineEdit, QtCore.SIGNAL(u'textEdited(QString)'), self.onTextEdited)
|
QtCore.QObject.connect(self.descriptionLineEdit, QtCore.SIGNAL(u'textEdited(QString)'), self.onTextEdited)
|
||||||
QtCore.QObject.connect(self.tagLineEdit, QtCore.SIGNAL(u'textEdited(QString)'), self.onTextEdited)
|
QtCore.QObject.connect(self.tagLineEdit, QtCore.SIGNAL(u'textEdited(QString)'), self.onTextEdited)
|
||||||
QtCore.QObject.connect(self.startTagLineEdit, QtCore.SIGNAL(u'textEdited(QString)'), self.onTextEdited)
|
QtCore.QObject.connect(self.startTagLineEdit, QtCore.SIGNAL(u'textEdited(QString)'), self.onTextEdited)
|
||||||
|
@ -174,25 +174,25 @@ class Ui_MainWindow(object):
|
|||||||
icon=u':/general/general_new.png',
|
icon=u':/general/general_new.png',
|
||||||
shortcuts=[QtGui.QKeySequence(u'Ctrl+N')],
|
shortcuts=[QtGui.QKeySequence(u'Ctrl+N')],
|
||||||
category=UiStrings().File,
|
category=UiStrings().File,
|
||||||
triggers=self.serviceManagerContents.onNewServiceClicked)
|
triggers=self.serviceManagerContents.on_new_service_clicked)
|
||||||
self.fileOpenItem = create_action(mainWindow, u'fileOpenItem',
|
self.fileOpenItem = create_action(mainWindow, u'fileOpenItem',
|
||||||
icon=u':/general/general_open.png',
|
icon=u':/general/general_open.png',
|
||||||
shortcuts=[QtGui.QKeySequence(u'Ctrl+O')],
|
shortcuts=[QtGui.QKeySequence(u'Ctrl+O')],
|
||||||
category=UiStrings().File,
|
category=UiStrings().File,
|
||||||
triggers=self.serviceManagerContents.onLoadServiceClicked)
|
triggers=self.serviceManagerContents.on_load_service_clicked)
|
||||||
self.fileSaveItem = create_action(mainWindow, u'fileSaveItem',
|
self.fileSaveItem = create_action(mainWindow, u'fileSaveItem',
|
||||||
icon=u':/general/general_save.png',
|
icon=u':/general/general_save.png',
|
||||||
shortcuts=[QtGui.QKeySequence(u'Ctrl+S')],
|
shortcuts=[QtGui.QKeySequence(u'Ctrl+S')],
|
||||||
category=UiStrings().File,
|
category=UiStrings().File,
|
||||||
triggers=self.serviceManagerContents.saveFile)
|
triggers=self.serviceManagerContents.save_file)
|
||||||
self.fileSaveAsItem = create_action(mainWindow, u'fileSaveAsItem',
|
self.fileSaveAsItem = create_action(mainWindow, u'fileSaveAsItem',
|
||||||
shortcuts=[QtGui.QKeySequence(u'Ctrl+Shift+S')],
|
shortcuts=[QtGui.QKeySequence(u'Ctrl+Shift+S')],
|
||||||
category=UiStrings().File,
|
category=UiStrings().File,
|
||||||
triggers=self.serviceManagerContents.saveFileAs)
|
triggers=self.serviceManagerContents.save_file_as)
|
||||||
self.printServiceOrderItem = create_action(mainWindow,
|
self.printServiceOrderItem = create_action(mainWindow,
|
||||||
u'printServiceItem', shortcuts=[QtGui.QKeySequence(u'Ctrl+P')],
|
u'printServiceItem', shortcuts=[QtGui.QKeySequence(u'Ctrl+P')],
|
||||||
category=UiStrings().File,
|
category=UiStrings().File,
|
||||||
triggers=self.serviceManagerContents.printServiceOrder)
|
triggers=self.serviceManagerContents.print_service_order)
|
||||||
self.fileExitItem = create_action(mainWindow, u'fileExitItem',
|
self.fileExitItem = create_action(mainWindow, u'fileExitItem',
|
||||||
icon=u':/system/system_exit.png',
|
icon=u':/system/system_exit.png',
|
||||||
shortcuts=[QtGui.QKeySequence(u'Alt+F4')],
|
shortcuts=[QtGui.QKeySequence(u'Alt+F4')],
|
||||||
@ -528,7 +528,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
|||||||
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'live_display_blank_check'), self.blankCheck)
|
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'live_display_blank_check'), self.blankCheck)
|
||||||
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'config_screen_changed'), self.screenChanged)
|
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'config_screen_changed'), self.screenChanged)
|
||||||
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'mainwindow_status_text'), self.showStatusMessage)
|
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'mainwindow_status_text'), self.showStatusMessage)
|
||||||
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'cleanup'), self.cleanUp)
|
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'cleanup'), self.clean_up)
|
||||||
# Media Manager
|
# Media Manager
|
||||||
QtCore.QObject.connect(self.mediaToolBox, QtCore.SIGNAL(u'currentChanged(int)'), self.onMediaToolBoxChanged)
|
QtCore.QObject.connect(self.mediaToolBox, QtCore.SIGNAL(u'currentChanged(int)'), self.onMediaToolBoxChanged)
|
||||||
Receiver.send_message(u'cursor_busy')
|
Receiver.send_message(u'cursor_busy')
|
||||||
@ -618,9 +618,9 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
|||||||
filename = args[0]
|
filename = args[0]
|
||||||
if not isinstance(filename, unicode):
|
if not isinstance(filename, unicode):
|
||||||
filename = unicode(filename, sys.getfilesystemencoding())
|
filename = unicode(filename, sys.getfilesystemencoding())
|
||||||
self.serviceManagerContents.loadFile(filename)
|
self.serviceManagerContents.load_file(filename)
|
||||||
elif Settings().value(self.generalSettingsSection + u'/auto open'):
|
elif Settings().value(self.generalSettingsSection + u'/auto open'):
|
||||||
self.serviceManagerContents.loadLastFile()
|
self.serviceManagerContents.load_Last_file()
|
||||||
view_mode = Settings().value(u'%s/view mode' % self.generalSettingsSection)
|
view_mode = Settings().value(u'%s/view mode' % self.generalSettingsSection)
|
||||||
if view_mode == u'default':
|
if view_mode == u'default':
|
||||||
self.modeDefaultItem.setChecked(True)
|
self.modeDefaultItem.setChecked(True)
|
||||||
@ -866,7 +866,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
|||||||
'be applied the next time you start OpenLP.'),
|
'be applied the next time you start OpenLP.'),
|
||||||
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
|
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
|
||||||
self.settingsImported = True
|
self.settingsImported = True
|
||||||
self.cleanUp()
|
self.clean_up()
|
||||||
QtCore.QCoreApplication.exit()
|
QtCore.QCoreApplication.exit()
|
||||||
|
|
||||||
def onSettingsExportItemClicked(self):
|
def onSettingsExportItemClicked(self):
|
||||||
@ -999,18 +999,18 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
|||||||
return
|
return
|
||||||
# If we just did a settings import, close without saving changes.
|
# If we just did a settings import, close without saving changes.
|
||||||
if self.settingsImported:
|
if self.settingsImported:
|
||||||
self.cleanUp(False)
|
self.clean_up(False)
|
||||||
event.accept()
|
event.accept()
|
||||||
if self.serviceManagerContents.isModified():
|
if self.serviceManagerContents.is_modified():
|
||||||
ret = self.serviceManagerContents.saveModifiedService()
|
ret = self.serviceManagerContents.save_modified_service()
|
||||||
if ret == QtGui.QMessageBox.Save:
|
if ret == QtGui.QMessageBox.Save:
|
||||||
if self.serviceManagerContents.decideSaveMethod():
|
if self.serviceManagerContents.decide_save_method():
|
||||||
self.cleanUp()
|
self.clean_up()
|
||||||
event.accept()
|
event.accept()
|
||||||
else:
|
else:
|
||||||
event.ignore()
|
event.ignore()
|
||||||
elif ret == QtGui.QMessageBox.Discard:
|
elif ret == QtGui.QMessageBox.Discard:
|
||||||
self.cleanUp()
|
self.clean_up()
|
||||||
event.accept()
|
event.accept()
|
||||||
else:
|
else:
|
||||||
event.ignore()
|
event.ignore()
|
||||||
@ -1021,15 +1021,15 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
|||||||
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes | QtGui.QMessageBox.No),
|
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes | QtGui.QMessageBox.No),
|
||||||
QtGui.QMessageBox.Yes)
|
QtGui.QMessageBox.Yes)
|
||||||
if ret == QtGui.QMessageBox.Yes:
|
if ret == QtGui.QMessageBox.Yes:
|
||||||
self.cleanUp()
|
self.clean_up()
|
||||||
event.accept()
|
event.accept()
|
||||||
else:
|
else:
|
||||||
event.ignore()
|
event.ignore()
|
||||||
else:
|
else:
|
||||||
self.cleanUp()
|
self.clean_up()
|
||||||
event.accept()
|
event.accept()
|
||||||
|
|
||||||
def cleanUp(self, save_settings=True):
|
def clean_up(self, save_settings=True):
|
||||||
"""
|
"""
|
||||||
Runs all the cleanup code before OpenLP shuts down.
|
Runs all the cleanup code before OpenLP shuts down.
|
||||||
|
|
||||||
@ -1223,7 +1223,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
|||||||
action = create_action(self, u'',
|
action = create_action(self, u'',
|
||||||
text=u'&%d %s' % (fileId + 1, os.path.splitext(os.path.basename(
|
text=u'&%d %s' % (fileId + 1, os.path.splitext(os.path.basename(
|
||||||
unicode(filename)))[0]), data=filename,
|
unicode(filename)))[0]), data=filename,
|
||||||
triggers=self.serviceManagerContents.onRecentServiceClicked)
|
triggers=self.serviceManagerContents.on_recent_service_clicked)
|
||||||
self.recentFilesMenu.addAction(action)
|
self.recentFilesMenu.addAction(action)
|
||||||
clearRecentFilesAction = create_action(self, u'',
|
clearRecentFilesAction = create_action(self, u'',
|
||||||
text=translate('OpenLP.MainWindow', 'Clear List', 'Clear List of recent files'),
|
text=translate('OpenLP.MainWindow', 'Clear List', 'Clear List of recent files'),
|
||||||
|
@ -131,14 +131,14 @@ class MediaController(object):
|
|||||||
for item in player.audio_extensions_list:
|
for item in player.audio_extensions_list:
|
||||||
if not item in self.audio_extensions_list:
|
if not item in self.audio_extensions_list:
|
||||||
self.audio_extensions_list.append(item)
|
self.audio_extensions_list.append(item)
|
||||||
self.service_manager.supportedSuffixes(item[2:])
|
self.service_manager.supported_suffixes(item[2:])
|
||||||
self.video_extensions_list = []
|
self.video_extensions_list = []
|
||||||
for player in self.mediaPlayers.values():
|
for player in self.mediaPlayers.values():
|
||||||
if player.isActive:
|
if player.isActive:
|
||||||
for item in player.video_extensions_list:
|
for item in player.video_extensions_list:
|
||||||
if item not in self.video_extensions_list:
|
if item not in self.video_extensions_list:
|
||||||
self.video_extensions_list.extend(item)
|
self.video_extensions_list.extend(item)
|
||||||
self.service_manager.supportedSuffixes(item[2:])
|
self.service_manager.supported_suffixes(item[2:])
|
||||||
|
|
||||||
def register_players(self, player):
|
def register_players(self, player):
|
||||||
"""
|
"""
|
||||||
|
@ -194,7 +194,7 @@ class PlayerTab(SettingsTab):
|
|||||||
set_media_players(self.usedPlayers, override_player)
|
set_media_players(self.usedPlayers, override_player)
|
||||||
player_string_changed = True
|
player_string_changed = True
|
||||||
if player_string_changed:
|
if player_string_changed:
|
||||||
self.parent.resetSupportedSuffixes()
|
self.parent.reset_supported_suffixes()
|
||||||
Receiver.send_message(u'mediaitem_media_rebuild')
|
Receiver.send_message(u'mediaitem_media_rebuild')
|
||||||
Receiver.send_message(u'config_screen_changed')
|
Receiver.send_message(u'config_screen_changed')
|
||||||
|
|
||||||
|
@ -67,8 +67,8 @@ class Ui_PluginViewDialog(object):
|
|||||||
self.pluginInfoLayout.addRow(self.aboutLabel, self.aboutTextBrowser)
|
self.pluginInfoLayout.addRow(self.aboutLabel, self.aboutTextBrowser)
|
||||||
self.listLayout.addWidget(self.pluginInfoGroupBox)
|
self.listLayout.addWidget(self.pluginInfoGroupBox)
|
||||||
self.pluginLayout.addLayout(self.listLayout)
|
self.pluginLayout.addLayout(self.listLayout)
|
||||||
self.buttonBox = create_button_box(pluginViewDialog, u'buttonBox', [u'ok'])
|
self.button_box = create_button_box(pluginViewDialog, u'button_box', [u'ok'])
|
||||||
self.pluginLayout.addWidget(self.buttonBox)
|
self.pluginLayout.addWidget(self.button_box)
|
||||||
self.retranslateUi(pluginViewDialog)
|
self.retranslateUi(pluginViewDialog)
|
||||||
|
|
||||||
def retranslateUi(self, pluginViewDialog):
|
def retranslateUi(self, pluginViewDialog):
|
||||||
|
@ -33,7 +33,7 @@ import os
|
|||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
from lxml import html
|
from lxml import html
|
||||||
|
|
||||||
from openlp.core.lib import translate, get_text_file_string, Receiver, Settings, UiStrings
|
from openlp.core.lib import translate, get_text_file_string, Receiver, Settings, UiStrings, Registry
|
||||||
from openlp.core.ui.printservicedialog import Ui_PrintServiceDialog, ZoomSize
|
from openlp.core.ui.printservicedialog import Ui_PrintServiceDialog, ZoomSize
|
||||||
from openlp.core.utils import AppLocation
|
from openlp.core.utils import AppLocation
|
||||||
|
|
||||||
@ -108,13 +108,11 @@ http://doc.trolltech.com/4.7/richtext-html-subset.html#css-properties
|
|||||||
|
|
||||||
class PrintServiceForm(QtGui.QDialog, Ui_PrintServiceDialog):
|
class PrintServiceForm(QtGui.QDialog, Ui_PrintServiceDialog):
|
||||||
|
|
||||||
def __init__(self, mainWindow, serviceManager):
|
def __init__(self):
|
||||||
"""
|
"""
|
||||||
Constructor
|
Constructor
|
||||||
"""
|
"""
|
||||||
QtGui.QDialog.__init__(self, mainWindow)
|
QtGui.QDialog.__init__(self, self.main_window)
|
||||||
self.mainWindow = mainWindow
|
|
||||||
self.serviceManager = serviceManager
|
|
||||||
self.printer = QtGui.QPrinter()
|
self.printer = QtGui.QPrinter()
|
||||||
self.printDialog = QtGui.QPrintDialog(self.printer, self)
|
self.printDialog = QtGui.QPrintDialog(self.printer, self)
|
||||||
self.document = QtGui.QTextDocument()
|
self.document = QtGui.QTextDocument()
|
||||||
@ -140,7 +138,8 @@ class PrintServiceForm(QtGui.QDialog, Ui_PrintServiceDialog):
|
|||||||
QtCore.QObject.connect(self.zoomComboBox, QtCore.SIGNAL(u'currentIndexChanged(int)'), self.displaySizeChanged)
|
QtCore.QObject.connect(self.zoomComboBox, QtCore.SIGNAL(u'currentIndexChanged(int)'), self.displaySizeChanged)
|
||||||
QtCore.QObject.connect(self.plainCopy, QtCore.SIGNAL(u'triggered()'), self.copyText)
|
QtCore.QObject.connect(self.plainCopy, QtCore.SIGNAL(u'triggered()'), self.copyText)
|
||||||
QtCore.QObject.connect(self.htmlCopy, QtCore.SIGNAL(u'triggered()'), self.copyHtmlText)
|
QtCore.QObject.connect(self.htmlCopy, QtCore.SIGNAL(u'triggered()'), self.copyHtmlText)
|
||||||
QtCore.QObject.connect(self.slideTextCheckBox, QtCore.SIGNAL(u'stateChanged(int)'), self.onSlideTextCheckBoxChanged)
|
QtCore.QObject.connect(self.slideTextCheckBox, QtCore.SIGNAL(u'stateChanged(int)'),
|
||||||
|
self.onSlideTextCheckBoxChanged)
|
||||||
self.updatePreviewText()
|
self.updatePreviewText()
|
||||||
|
|
||||||
def toggleOptions(self, checked):
|
def toggleOptions(self, checked):
|
||||||
@ -170,7 +169,7 @@ class PrintServiceForm(QtGui.QDialog, Ui_PrintServiceDialog):
|
|||||||
self._addElement(u'body', parent=html_data)
|
self._addElement(u'body', parent=html_data)
|
||||||
self._addElement(u'h1', cgi.escape(self.titleLineEdit.text()),
|
self._addElement(u'h1', cgi.escape(self.titleLineEdit.text()),
|
||||||
html_data.body, classId=u'serviceTitle')
|
html_data.body, classId=u'serviceTitle')
|
||||||
for index, item in enumerate(self.serviceManager.serviceItems):
|
for index, item in enumerate(self.service_manager.serviceItems):
|
||||||
self._addPreviewItem(html_data.body, item[u'service_item'], index)
|
self._addPreviewItem(html_data.body, item[u'service_item'], index)
|
||||||
# Add the custom service notes:
|
# Add the custom service notes:
|
||||||
if self.footerTextEdit.toPlainText():
|
if self.footerTextEdit.toPlainText():
|
||||||
@ -319,14 +318,14 @@ class PrintServiceForm(QtGui.QDialog, Ui_PrintServiceDialog):
|
|||||||
# remove the icon from the text
|
# remove the icon from the text
|
||||||
clipboard_text = clipboard_text.replace(u'\ufffc\xa0', u'')
|
clipboard_text = clipboard_text.replace(u'\ufffc\xa0', u'')
|
||||||
# and put it all on the clipboard
|
# and put it all on the clipboard
|
||||||
self.mainWindow.clipboard.setText(clipboard_text)
|
self.main_window.clipboard.setText(clipboard_text)
|
||||||
|
|
||||||
def copyHtmlText(self):
|
def copyHtmlText(self):
|
||||||
"""
|
"""
|
||||||
Copies the display text to the clipboard as Html
|
Copies the display text to the clipboard as Html
|
||||||
"""
|
"""
|
||||||
self.update_song_usage()
|
self.update_song_usage()
|
||||||
self.mainWindow.clipboard.setText(self.document.toHtml())
|
self.main_window.clipboard.setText(self.document.toHtml())
|
||||||
|
|
||||||
def printServiceOrder(self):
|
def printServiceOrder(self):
|
||||||
"""
|
"""
|
||||||
@ -392,6 +391,26 @@ class PrintServiceForm(QtGui.QDialog, Ui_PrintServiceDialog):
|
|||||||
# Only continue when we include the song's text.
|
# Only continue when we include the song's text.
|
||||||
if not self.slideTextCheckBox.isChecked():
|
if not self.slideTextCheckBox.isChecked():
|
||||||
return
|
return
|
||||||
for item in self.serviceManager.serviceItems:
|
for item in self.service_manager.serviceItems:
|
||||||
# Trigger Audit requests
|
# Trigger Audit requests
|
||||||
Receiver.send_message(u'print_service_started', [item[u'service_item']])
|
Receiver.send_message(u'print_service_started', [item[u'service_item']])
|
||||||
|
|
||||||
|
def _get_service_manager(self):
|
||||||
|
"""
|
||||||
|
Adds the service manager to the class dynamically
|
||||||
|
"""
|
||||||
|
if not hasattr(self, u'_service_manager'):
|
||||||
|
self._service_manager = Registry().get(u'service_manager')
|
||||||
|
return self._service_manager
|
||||||
|
|
||||||
|
service_manager = property(_get_service_manager)
|
||||||
|
|
||||||
|
def _get_main_window(self):
|
||||||
|
"""
|
||||||
|
Adds the main window to the class dynamically
|
||||||
|
"""
|
||||||
|
if not hasattr(self, u'_main_window'):
|
||||||
|
self._main_window = Registry().get(u'main_window')
|
||||||
|
return self._main_window
|
||||||
|
|
||||||
|
main_window = property(_get_main_window)
|
@ -35,29 +35,29 @@ from openlp.core.lib.ui import create_button_box, create_button
|
|||||||
class Ui_ServiceItemEditDialog(object):
|
class Ui_ServiceItemEditDialog(object):
|
||||||
def setupUi(self, serviceItemEditDialog):
|
def setupUi(self, serviceItemEditDialog):
|
||||||
serviceItemEditDialog.setObjectName(u'serviceItemEditDialog')
|
serviceItemEditDialog.setObjectName(u'serviceItemEditDialog')
|
||||||
self.dialogLayout = QtGui.QGridLayout(serviceItemEditDialog)
|
self.dialog_layout = QtGui.QGridLayout(serviceItemEditDialog)
|
||||||
self.dialogLayout.setContentsMargins(8, 8, 8, 8)
|
self.dialog_layout.setContentsMargins(8, 8, 8, 8)
|
||||||
self.dialogLayout.setSpacing(8)
|
self.dialog_layout.setSpacing(8)
|
||||||
self.dialogLayout.setObjectName(u'dialogLayout')
|
self.dialog_layout.setObjectName(u'dialog_layout')
|
||||||
self.listWidget = QtGui.QListWidget(serviceItemEditDialog)
|
self.list_widget = QtGui.QListWidget(serviceItemEditDialog)
|
||||||
self.listWidget.setAlternatingRowColors(True)
|
self.list_widget.setAlternatingRowColors(True)
|
||||||
self.listWidget.setObjectName(u'listWidget')
|
self.list_widget.setObjectName(u'list_widget')
|
||||||
self.dialogLayout.addWidget(self.listWidget, 0, 0)
|
self.dialog_layout.addWidget(self.list_widget, 0, 0)
|
||||||
self.buttonLayout = QtGui.QVBoxLayout()
|
self.button_layout = QtGui.QVBoxLayout()
|
||||||
self.buttonLayout.setObjectName(u'buttonLayout')
|
self.button_layout.setObjectName(u'button_layout')
|
||||||
self.deleteButton = create_button(serviceItemEditDialog, u'deleteButton', role=u'delete',
|
self.delete_button = create_button(serviceItemEditDialog, u'deleteButton', role=u'delete',
|
||||||
click=serviceItemEditDialog.onDeleteButtonClicked)
|
click=serviceItemEditDialog.on_delete_button_clicked)
|
||||||
self.buttonLayout.addWidget(self.deleteButton)
|
self.button_layout.addWidget(self.delete_button)
|
||||||
self.buttonLayout.addStretch()
|
self.button_layout.addStretch()
|
||||||
self.upButton = create_button(serviceItemEditDialog, u'upButton', role=u'up',
|
self.up_button = create_button(serviceItemEditDialog, u'upButton', role=u'up',
|
||||||
click=serviceItemEditDialog.onUpButtonClicked)
|
click=serviceItemEditDialog.on_up_button_clicked)
|
||||||
self.downButton = create_button(serviceItemEditDialog, u'downButton', role=u'down',
|
self.down_button = create_button(serviceItemEditDialog, u'downButton', role=u'down',
|
||||||
click=serviceItemEditDialog.onDownButtonClicked)
|
click=serviceItemEditDialog.on_down_button_clicked)
|
||||||
self.buttonLayout.addWidget(self.upButton)
|
self.button_layout.addWidget(self.up_button)
|
||||||
self.buttonLayout.addWidget(self.downButton)
|
self.button_layout.addWidget(self.down_button)
|
||||||
self.dialogLayout.addLayout(self.buttonLayout, 0, 1)
|
self.dialog_layout.addLayout(self.button_layout, 0, 1)
|
||||||
self.buttonBox = create_button_box(serviceItemEditDialog, u'buttonBox', [u'cancel', u'save'])
|
self.button_box = create_button_box(serviceItemEditDialog, u'button_box', [u'cancel', u'save'])
|
||||||
self.dialogLayout.addWidget(self.buttonBox, 1, 0, 1, 2)
|
self.dialog_layout.addWidget(self.button_box, 1, 0, 1, 2)
|
||||||
self.retranslateUi(serviceItemEditDialog)
|
self.retranslateUi(serviceItemEditDialog)
|
||||||
|
|
||||||
def retranslateUi(self, serviceItemEditDialog):
|
def retranslateUi(self, serviceItemEditDialog):
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
from openlp.core.lib import Registry
|
||||||
|
|
||||||
from serviceitemeditdialog import Ui_ServiceItemEditDialog
|
from serviceitemeditdialog import Ui_ServiceItemEditDialog
|
||||||
|
|
||||||
@ -35,91 +36,92 @@ class ServiceItemEditForm(QtGui.QDialog, Ui_ServiceItemEditDialog):
|
|||||||
"""
|
"""
|
||||||
This is the form that is used to edit the verses of the song.
|
This is the form that is used to edit the verses of the song.
|
||||||
"""
|
"""
|
||||||
def __init__(self, parent=None):
|
def __init__(self):
|
||||||
"""
|
"""
|
||||||
Constructor
|
Constructor
|
||||||
"""
|
"""
|
||||||
QtGui.QDialog.__init__(self, parent)
|
QtGui.QDialog.__init__(self, self.main_window)
|
||||||
self.setupUi(self)
|
self.setupUi(self)
|
||||||
self.itemList = []
|
self.item_list = []
|
||||||
QtCore.QObject.connect(self.listWidget, QtCore.SIGNAL(u'currentRowChanged(int)'), self.onCurrentRowChanged)
|
QtCore.QObject.connect(self.list_widget, QtCore.SIGNAL(u'currentRowChanged(int)'),
|
||||||
|
self.on_current_row_changed)
|
||||||
|
|
||||||
def setServiceItem(self, item):
|
def set_service_item(self, item):
|
||||||
self.item = item
|
self.item = item
|
||||||
self.itemList = []
|
self.item_list = []
|
||||||
if self.item.is_image():
|
if self.item.is_image():
|
||||||
self.data = True
|
self.data = True
|
||||||
for frame in self.item._raw_frames:
|
for frame in self.item._raw_frames:
|
||||||
self.itemList.append(frame)
|
self.item_list.append(frame)
|
||||||
self.loadData()
|
self.load_data()
|
||||||
self.listWidget.setCurrentItem(self.listWidget.currentItem())
|
self.list_widget.setCurrentItem(self.list_widget.currentItem())
|
||||||
|
|
||||||
def getServiceItem(self):
|
def get_service_item(self):
|
||||||
if self.data:
|
if self.data:
|
||||||
self.item._raw_frames = []
|
self.item._raw_frames = []
|
||||||
if self.item.is_image():
|
if self.item.is_image():
|
||||||
for item in self.itemList:
|
for item in self.item_list:
|
||||||
self.item.add_from_image(item[u'path'], item[u'title'])
|
self.item.add_from_image(item[u'path'], item[u'title'])
|
||||||
self.item.render()
|
self.item.render()
|
||||||
return self.item
|
return self.item
|
||||||
|
|
||||||
def loadData(self):
|
def load_data(self):
|
||||||
"""
|
"""
|
||||||
Loads the image list.
|
Loads the image list.
|
||||||
"""
|
"""
|
||||||
self.listWidget.clear()
|
self.list_widget.clear()
|
||||||
for frame in self.itemList:
|
for frame in self.item_list:
|
||||||
item_name = QtGui.QListWidgetItem(frame[u'title'])
|
item_name = QtGui.QListWidgetItem(frame[u'title'])
|
||||||
self.listWidget.addItem(item_name)
|
self.list_widget.addItem(item_name)
|
||||||
|
|
||||||
def onDeleteButtonClicked(self):
|
def on_delete_button_clicked(self):
|
||||||
"""
|
"""
|
||||||
Delete the current row.
|
Delete the current row.
|
||||||
"""
|
"""
|
||||||
item = self.listWidget.currentItem()
|
item = self.list_widget.currentItem()
|
||||||
if not item:
|
if not item:
|
||||||
return
|
return
|
||||||
row = self.listWidget.row(item)
|
row = self.list_widget.row(item)
|
||||||
self.itemList.pop(row)
|
self.item_list.pop(row)
|
||||||
self.loadData()
|
self.load_data()
|
||||||
if row == self.listWidget.count():
|
if row == self.list_widget.count():
|
||||||
self.listWidget.setCurrentRow(row - 1)
|
self.list_widget.setCurrentRow(row - 1)
|
||||||
else:
|
else:
|
||||||
self.listWidget.setCurrentRow(row)
|
self.list_widget.setCurrentRow(row)
|
||||||
|
|
||||||
def onUpButtonClicked(self):
|
def on_up_button_clicked(self):
|
||||||
"""
|
"""
|
||||||
Move the current row up in the list.
|
Move the current row up in the list.
|
||||||
"""
|
"""
|
||||||
self.__moveItem(u'up')
|
self.__move_item(u'up')
|
||||||
|
|
||||||
def onDownButtonClicked(self):
|
def on_down_button_clicked(self):
|
||||||
"""
|
"""
|
||||||
Move the current row down in the list
|
Move the current row down in the list
|
||||||
"""
|
"""
|
||||||
self.__moveItem(u'down')
|
self.__move_item(u'down')
|
||||||
|
|
||||||
def __moveItem(self, direction=u''):
|
def __move_item(self, direction=u''):
|
||||||
"""
|
"""
|
||||||
Move the current item.
|
Move the current item.
|
||||||
"""
|
"""
|
||||||
if not direction:
|
if not direction:
|
||||||
return
|
return
|
||||||
item = self.listWidget.currentItem()
|
item = self.list_widget.currentItem()
|
||||||
if not item:
|
if not item:
|
||||||
return
|
return
|
||||||
row = self.listWidget.row(item)
|
row = self.list_widget.row(item)
|
||||||
temp = self.itemList[row]
|
temp = self.item_list[row]
|
||||||
self.itemList.pop(row)
|
self.item_list.pop(row)
|
||||||
if direction == u'up':
|
if direction == u'up':
|
||||||
row -= 1
|
row -= 1
|
||||||
else:
|
else:
|
||||||
row += 1
|
row += 1
|
||||||
self.itemList.insert(row, temp)
|
self.item_list.insert(row, temp)
|
||||||
self.loadData()
|
self.load_data()
|
||||||
self.listWidget.setCurrentRow(row)
|
self.list_widget.setCurrentRow(row)
|
||||||
|
|
||||||
def onCurrentRowChanged(self, row):
|
def on_current_row_changed(self, row):
|
||||||
"""
|
"""
|
||||||
Called when the currentRow has changed.
|
Called when the currentRow has changed.
|
||||||
|
|
||||||
@ -127,19 +129,29 @@ class ServiceItemEditForm(QtGui.QDialog, Ui_ServiceItemEditDialog):
|
|||||||
The row number (int).
|
The row number (int).
|
||||||
"""
|
"""
|
||||||
# Disable all buttons, as no row is selected or only one image is left.
|
# Disable all buttons, as no row is selected or only one image is left.
|
||||||
if row == -1 or self.listWidget.count() == 1:
|
if row == -1 or self.list_widget.count() == 1:
|
||||||
self.downButton.setEnabled(False)
|
self.down_button.setEnabled(False)
|
||||||
self.upButton.setEnabled(False)
|
self.up_button.setEnabled(False)
|
||||||
self.deleteButton.setEnabled(False)
|
self.delete_button.setEnabled(False)
|
||||||
else:
|
else:
|
||||||
# Check if we are at the end of the list.
|
# Check if we are at the end of the list.
|
||||||
if self.listWidget.count() == row + 1:
|
if self.list_widget.count() == row + 1:
|
||||||
self.downButton.setEnabled(False)
|
self.down_button.setEnabled(False)
|
||||||
else:
|
else:
|
||||||
self.downButton.setEnabled(True)
|
self.down_button.setEnabled(True)
|
||||||
# Check if we are at the beginning of the list.
|
# Check if we are at the beginning of the list.
|
||||||
if row == 0:
|
if row == 0:
|
||||||
self.upButton.setEnabled(False)
|
self.up_button.setEnabled(False)
|
||||||
else:
|
else:
|
||||||
self.upButton.setEnabled(True)
|
self.up_button.setEnabled(True)
|
||||||
self.deleteButton.setEnabled(True)
|
self.delete_button.setEnabled(True)
|
||||||
|
|
||||||
|
def _get_main_window(self):
|
||||||
|
"""
|
||||||
|
Adds the main window to the class dynamically
|
||||||
|
"""
|
||||||
|
if not hasattr(self, u'_main_window'):
|
||||||
|
self._main_window = Registry().get(u'main_window')
|
||||||
|
return self._main_window
|
||||||
|
|
||||||
|
main_window = property(_get_main_window)
|
File diff suppressed because it is too large
Load Diff
@ -29,36 +29,46 @@
|
|||||||
|
|
||||||
from PyQt4 import QtGui
|
from PyQt4 import QtGui
|
||||||
|
|
||||||
from openlp.core.lib import translate, SpellTextEdit
|
from openlp.core.lib import translate, SpellTextEdit, Registry
|
||||||
from openlp.core.lib.ui import create_button_box
|
from openlp.core.lib.ui import create_button_box
|
||||||
|
|
||||||
class ServiceNoteForm(QtGui.QDialog):
|
class ServiceNoteForm(QtGui.QDialog):
|
||||||
"""
|
"""
|
||||||
This is the form that is used to edit the verses of the song.
|
This is the form that is used to edit the verses of the song.
|
||||||
"""
|
"""
|
||||||
def __init__(self, parent=None):
|
def __init__(self):
|
||||||
"""
|
"""
|
||||||
Constructor
|
Constructor
|
||||||
"""
|
"""
|
||||||
QtGui.QDialog.__init__(self, parent)
|
QtGui.QDialog.__init__(self, self.main_window)
|
||||||
self.setupUi()
|
self.setupUi()
|
||||||
self.retranslateUi()
|
self.retranslateUi()
|
||||||
|
|
||||||
def exec_(self):
|
def exec_(self):
|
||||||
self.textEdit.setFocus()
|
self.text_edit.setFocus()
|
||||||
return QtGui.QDialog.exec_(self)
|
return QtGui.QDialog.exec_(self)
|
||||||
|
|
||||||
def setupUi(self):
|
def setupUi(self):
|
||||||
self.setObjectName(u'serviceNoteEdit')
|
self.setObjectName(u'serviceNoteEdit')
|
||||||
self.dialogLayout = QtGui.QVBoxLayout(self)
|
self.dialog_layout = QtGui.QVBoxLayout(self)
|
||||||
self.dialogLayout.setContentsMargins(8, 8, 8, 8)
|
self.dialog_layout.setContentsMargins(8, 8, 8, 8)
|
||||||
self.dialogLayout.setSpacing(8)
|
self.dialog_layout.setSpacing(8)
|
||||||
self.dialogLayout.setObjectName(u'verticalLayout')
|
self.dialog_layout.setObjectName(u'verticalLayout')
|
||||||
self.textEdit = SpellTextEdit(self, False)
|
self.text_edit = SpellTextEdit(self, False)
|
||||||
self.textEdit.setObjectName(u'textEdit')
|
self.text_edit.setObjectName(u'textEdit')
|
||||||
self.dialogLayout.addWidget(self.textEdit)
|
self.dialog_layout.addWidget(self.text_edit)
|
||||||
self.buttonBox = create_button_box(self, u'buttonBox', [u'cancel', u'save'])
|
self.button_box = create_button_box(self, u'button_box', [u'cancel', u'save'])
|
||||||
self.dialogLayout.addWidget(self.buttonBox)
|
self.dialog_layout.addWidget(self.button_box)
|
||||||
|
|
||||||
def retranslateUi(self):
|
def retranslateUi(self):
|
||||||
self.setWindowTitle(translate('OpenLP.ServiceNoteForm', 'Service Item Notes'))
|
self.setWindowTitle(translate('OpenLP.ServiceNoteForm', 'Service Item Notes'))
|
||||||
|
|
||||||
|
def _get_main_window(self):
|
||||||
|
"""
|
||||||
|
Adds the main window to the class dynamically
|
||||||
|
"""
|
||||||
|
if not hasattr(self, u'_main_window'):
|
||||||
|
self._main_window = Registry().get(u'main_window')
|
||||||
|
return self._main_window
|
||||||
|
|
||||||
|
main_window = property(_get_main_window)
|
@ -38,7 +38,7 @@ class Ui_SettingsDialog(object):
|
|||||||
settingsDialog.resize(800, 500)
|
settingsDialog.resize(800, 500)
|
||||||
settingsDialog.setWindowIcon(build_icon(u':/system/system_settings.png'))
|
settingsDialog.setWindowIcon(build_icon(u':/system/system_settings.png'))
|
||||||
self.dialogLayout = QtGui.QGridLayout(settingsDialog)
|
self.dialogLayout = QtGui.QGridLayout(settingsDialog)
|
||||||
self.dialogLayout.setObjectName(u'dialogLayout')
|
self.dialogLayout.setObjectName(u'dialog_layout')
|
||||||
self.dialogLayout.setMargin(8)
|
self.dialogLayout.setMargin(8)
|
||||||
self.settingListWidget = QtGui.QListWidget(settingsDialog)
|
self.settingListWidget = QtGui.QListWidget(settingsDialog)
|
||||||
self.settingListWidget.setUniformItemSizes(True)
|
self.settingListWidget.setUniformItemSizes(True)
|
||||||
@ -49,8 +49,8 @@ class Ui_SettingsDialog(object):
|
|||||||
self.stackedLayout = QtGui.QStackedLayout()
|
self.stackedLayout = QtGui.QStackedLayout()
|
||||||
self.stackedLayout.setObjectName(u'stackedLayout')
|
self.stackedLayout.setObjectName(u'stackedLayout')
|
||||||
self.dialogLayout.addLayout(self.stackedLayout, 0, 1, 1, 1)
|
self.dialogLayout.addLayout(self.stackedLayout, 0, 1, 1, 1)
|
||||||
self.buttonBox = create_button_box(settingsDialog, u'buttonBox', [u'cancel', u'ok'])
|
self.button_box = create_button_box(settingsDialog, u'button_box', [u'cancel', u'ok'])
|
||||||
self.dialogLayout.addWidget(self.buttonBox, 1, 1, 1, 1)
|
self.dialogLayout.addWidget(self.button_box, 1, 1, 1, 1)
|
||||||
self.retranslateUi(settingsDialog)
|
self.retranslateUi(settingsDialog)
|
||||||
QtCore.QObject.connect(self.settingListWidget, QtCore.SIGNAL(u'currentRowChanged(int)'), self.tabChanged)
|
QtCore.QObject.connect(self.settingListWidget, QtCore.SIGNAL(u'currentRowChanged(int)'), self.tabChanged)
|
||||||
|
|
||||||
|
@ -140,7 +140,7 @@ class SettingsForm(QtGui.QDialog, Ui_SettingsDialog):
|
|||||||
per save.
|
per save.
|
||||||
"""
|
"""
|
||||||
if self.resetSuffixes:
|
if self.resetSuffixes:
|
||||||
self.mainWindow.serviceManagerContents.resetSupportedSuffixes()
|
self.service_manager.reset_supported_suffixes()
|
||||||
self.resetSuffixes = False
|
self.resetSuffixes = False
|
||||||
|
|
||||||
def _get_main_window(self):
|
def _get_main_window(self):
|
||||||
@ -152,3 +152,13 @@ class SettingsForm(QtGui.QDialog, Ui_SettingsDialog):
|
|||||||
return self._main_window
|
return self._main_window
|
||||||
|
|
||||||
main_window = property(_get_main_window)
|
main_window = property(_get_main_window)
|
||||||
|
|
||||||
|
def _get_service_manager(self):
|
||||||
|
"""
|
||||||
|
Adds the plugin manager to the class dynamically
|
||||||
|
"""
|
||||||
|
if not hasattr(self, u'_service_manager'):
|
||||||
|
self._service_manager = Registry().get(u'service_manager')
|
||||||
|
return self._service_manager
|
||||||
|
|
||||||
|
service_manager = property(_get_service_manager)
|
@ -107,9 +107,9 @@ class Ui_ShortcutListDialog(object):
|
|||||||
self.alternateLabel.setObjectName(u'alternateLabel')
|
self.alternateLabel.setObjectName(u'alternateLabel')
|
||||||
self.detailsLayout.addWidget(self.alternateLabel, 0, 2, 1, 1)
|
self.detailsLayout.addWidget(self.alternateLabel, 0, 2, 1, 1)
|
||||||
self.shortcutListLayout.addLayout(self.detailsLayout)
|
self.shortcutListLayout.addLayout(self.detailsLayout)
|
||||||
self.buttonBox = create_button_box(shortcutListDialog, u'buttonBox', [u'cancel', u'ok', u'defaults'])
|
self.button_box = create_button_box(shortcutListDialog, u'button_box', [u'cancel', u'ok', u'defaults'])
|
||||||
self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
|
self.button_box.setOrientation(QtCore.Qt.Horizontal)
|
||||||
self.shortcutListLayout.addWidget(self.buttonBox)
|
self.shortcutListLayout.addWidget(self.button_box)
|
||||||
self.retranslateUi(shortcutListDialog)
|
self.retranslateUi(shortcutListDialog)
|
||||||
|
|
||||||
def retranslateUi(self, shortcutListDialog):
|
def retranslateUi(self, shortcutListDialog):
|
||||||
|
@ -64,7 +64,7 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog):
|
|||||||
self.onClearPrimaryButtonClicked)
|
self.onClearPrimaryButtonClicked)
|
||||||
QtCore.QObject.connect(self.clearAlternateButton, QtCore.SIGNAL(u'clicked(bool)'),
|
QtCore.QObject.connect(self.clearAlternateButton, QtCore.SIGNAL(u'clicked(bool)'),
|
||||||
self.onClearAlternateButtonClicked)
|
self.onClearAlternateButtonClicked)
|
||||||
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(u'clicked(QAbstractButton*)'),
|
QtCore.QObject.connect(self.button_box, QtCore.SIGNAL(u'clicked(QAbstractButton*)'),
|
||||||
self.onRestoreDefaultsClicked)
|
self.onRestoreDefaultsClicked)
|
||||||
QtCore.QObject.connect(self.defaultRadioButton, QtCore.SIGNAL(u'clicked(bool)'),
|
QtCore.QObject.connect(self.defaultRadioButton, QtCore.SIGNAL(u'clicked(bool)'),
|
||||||
self.onDefaultRadioButtonClicked)
|
self.onDefaultRadioButtonClicked)
|
||||||
@ -274,7 +274,7 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog):
|
|||||||
"""
|
"""
|
||||||
Restores all default shortcuts.
|
Restores all default shortcuts.
|
||||||
"""
|
"""
|
||||||
if self.buttonBox.buttonRole(button) != QtGui.QDialogButtonBox.ResetRole:
|
if self.button_box.buttonRole(button) != QtGui.QDialogButtonBox.ResetRole:
|
||||||
return
|
return
|
||||||
if QtGui.QMessageBox.question(self, translate('OpenLP.ShortcutListDialog', 'Restore Default Shortcuts'),
|
if QtGui.QMessageBox.question(self, translate('OpenLP.ShortcutListDialog', 'Restore Default Shortcuts'),
|
||||||
translate('OpenLP.ShortcutListDialog', 'Do you want to restore all '
|
translate('OpenLP.ShortcutListDialog', 'Do you want to restore all '
|
||||||
|
@ -297,8 +297,7 @@ class SlideController(DisplayController):
|
|||||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
|
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
|
||||||
sizePolicy.setHorizontalStretch(0)
|
sizePolicy.setHorizontalStretch(0)
|
||||||
sizePolicy.setVerticalStretch(0)
|
sizePolicy.setVerticalStretch(0)
|
||||||
sizePolicy.setHeightForWidth(
|
sizePolicy.setHeightForWidth(self.slidePreview.sizePolicy().hasHeightForWidth())
|
||||||
self.slidePreview.sizePolicy().hasHeightForWidth())
|
|
||||||
self.slidePreview.setSizePolicy(sizePolicy)
|
self.slidePreview.setSizePolicy(sizePolicy)
|
||||||
self.slidePreview.setFrameShape(QtGui.QFrame.Box)
|
self.slidePreview.setFrameShape(QtGui.QFrame.Box)
|
||||||
self.slidePreview.setFrameShadow(QtGui.QFrame.Plain)
|
self.slidePreview.setFrameShadow(QtGui.QFrame.Plain)
|
||||||
@ -649,12 +648,12 @@ class SlideController(DisplayController):
|
|||||||
item.render()
|
item.render()
|
||||||
self._processItem(item, self.selectedRow)
|
self._processItem(item, self.selectedRow)
|
||||||
|
|
||||||
def addServiceItem(self, item):
|
def add_service_item(self, item):
|
||||||
"""
|
"""
|
||||||
Method to install the service item into the controller
|
Method to install the service item into the controller
|
||||||
Called by plugins
|
Called by plugins
|
||||||
"""
|
"""
|
||||||
log.debug(u'addServiceItem live = %s' % self.isLive)
|
log.debug(u'add_service_item live = %s' % self.isLive)
|
||||||
item.render()
|
item.render()
|
||||||
slideno = 0
|
slideno = 0
|
||||||
if self.songEdit:
|
if self.songEdit:
|
||||||
@ -1183,14 +1182,16 @@ class SlideController(DisplayController):
|
|||||||
From the preview display requires the service Item to be editied
|
From the preview display requires the service Item to be editied
|
||||||
"""
|
"""
|
||||||
self.songEdit = True
|
self.songEdit = True
|
||||||
Receiver.send_message(u'%s_edit' % self.serviceItem.name.lower(), u'P:%s' % self.serviceItem.edit_id)
|
new_item = Registry().get(self.serviceItem.name).onRemoteEdit(self.serviceItem.edit_id, True)
|
||||||
|
if new_item:
|
||||||
|
self.add_service_item(new_item)
|
||||||
|
|
||||||
def onPreviewAddToService(self):
|
def onPreviewAddToService(self):
|
||||||
"""
|
"""
|
||||||
From the preview display request the Item to be added to service
|
From the preview display request the Item to be added to service
|
||||||
"""
|
"""
|
||||||
if self.serviceItem:
|
if self.serviceItem:
|
||||||
self.parent().serviceManagerContents.addServiceItem(self.serviceItem)
|
self.service_manager.add_service_item(self.serviceItem)
|
||||||
|
|
||||||
def onGoLiveClick(self):
|
def onGoLiveClick(self):
|
||||||
"""
|
"""
|
||||||
@ -1215,7 +1216,7 @@ class SlideController(DisplayController):
|
|||||||
Receiver.send_message('servicemanager_preview_live', u'%s:%s' %
|
Receiver.send_message('servicemanager_preview_live', u'%s:%s' %
|
||||||
(self.serviceItem.unique_identifier, row))
|
(self.serviceItem.unique_identifier, row))
|
||||||
else:
|
else:
|
||||||
self.parent().liveController.addServiceManagerItem(self.serviceItem, row)
|
self.live_controller.addServiceManagerItem(self.serviceItem, row)
|
||||||
|
|
||||||
def onMediaStart(self, item):
|
def onMediaStart(self, item):
|
||||||
"""
|
"""
|
||||||
@ -1309,3 +1310,22 @@ class SlideController(DisplayController):
|
|||||||
|
|
||||||
media_controller = property(_get_media_controller)
|
media_controller = property(_get_media_controller)
|
||||||
|
|
||||||
|
def _get_service_manager(self):
|
||||||
|
"""
|
||||||
|
Adds the service manager to the class dynamically
|
||||||
|
"""
|
||||||
|
if not hasattr(self, u'_service_manager'):
|
||||||
|
self._service_manager = Registry().get(u'service_manager')
|
||||||
|
return self._service_manager
|
||||||
|
|
||||||
|
service_manager = property(_get_service_manager)
|
||||||
|
|
||||||
|
def _get_live_controller(self):
|
||||||
|
"""
|
||||||
|
Adds the live controller to the class dynamically
|
||||||
|
"""
|
||||||
|
if not hasattr(self, u'_live_controller'):
|
||||||
|
self._live_controller = Registry().get(u'live_controller')
|
||||||
|
return self._live_controller
|
||||||
|
|
||||||
|
live_controller = property(_get_live_controller)
|
@ -38,7 +38,7 @@ class Ui_StartTimeDialog(object):
|
|||||||
StartTimeDialog.setObjectName(u'StartTimeDialog')
|
StartTimeDialog.setObjectName(u'StartTimeDialog')
|
||||||
StartTimeDialog.resize(350, 10)
|
StartTimeDialog.resize(350, 10)
|
||||||
self.dialogLayout = QtGui.QGridLayout(StartTimeDialog)
|
self.dialogLayout = QtGui.QGridLayout(StartTimeDialog)
|
||||||
self.dialogLayout.setObjectName(u'dialogLayout')
|
self.dialogLayout.setObjectName(u'dialog_layout')
|
||||||
self.startLabel = QtGui.QLabel(StartTimeDialog)
|
self.startLabel = QtGui.QLabel(StartTimeDialog)
|
||||||
self.startLabel.setObjectName(u'startLabel')
|
self.startLabel.setObjectName(u'startLabel')
|
||||||
self.startLabel.setAlignment(QtCore.Qt.AlignHCenter)
|
self.startLabel.setAlignment(QtCore.Qt.AlignHCenter)
|
||||||
@ -102,8 +102,8 @@ class Ui_StartTimeDialog(object):
|
|||||||
self.secondFinishLabel.setAlignment(QtCore.Qt.AlignRight)
|
self.secondFinishLabel.setAlignment(QtCore.Qt.AlignRight)
|
||||||
self.dialogLayout.addWidget(self.secondFinishLabel, 3, 3, 1, 1)
|
self.dialogLayout.addWidget(self.secondFinishLabel, 3, 3, 1, 1)
|
||||||
self.dialogLayout.addWidget(self.secondSpinBox, 3, 1, 1, 1)
|
self.dialogLayout.addWidget(self.secondSpinBox, 3, 1, 1, 1)
|
||||||
self.buttonBox = create_button_box(StartTimeDialog, u'buttonBox', [u'cancel', u'ok'])
|
self.button_box = create_button_box(StartTimeDialog, u'button_box', [u'cancel', u'ok'])
|
||||||
self.dialogLayout.addWidget(self.buttonBox, 5, 2, 1, 2)
|
self.dialogLayout.addWidget(self.button_box, 5, 2, 1, 2)
|
||||||
self.retranslateUi(StartTimeDialog)
|
self.retranslateUi(StartTimeDialog)
|
||||||
self.setMaximumHeight(self.sizeHint().height())
|
self.setMaximumHeight(self.sizeHint().height())
|
||||||
|
|
||||||
|
@ -31,15 +31,15 @@ from PyQt4 import QtGui
|
|||||||
|
|
||||||
from starttimedialog import Ui_StartTimeDialog
|
from starttimedialog import Ui_StartTimeDialog
|
||||||
|
|
||||||
from openlp.core.lib import translate, UiStrings
|
from openlp.core.lib import translate, UiStrings, Registry
|
||||||
from openlp.core.lib.ui import critical_error_message_box
|
from openlp.core.lib.ui import critical_error_message_box
|
||||||
|
|
||||||
class StartTimeForm(QtGui.QDialog, Ui_StartTimeDialog):
|
class StartTimeForm(QtGui.QDialog, Ui_StartTimeDialog):
|
||||||
"""
|
"""
|
||||||
The exception dialog
|
The exception dialog
|
||||||
"""
|
"""
|
||||||
def __init__(self, parent):
|
def __init__(self):
|
||||||
QtGui.QDialog.__init__(self, parent)
|
QtGui.QDialog.__init__(self, self.main_window)
|
||||||
self.setupUi(self)
|
self.setupUi(self)
|
||||||
|
|
||||||
def exec_(self):
|
def exec_(self):
|
||||||
@ -84,3 +84,13 @@ class StartTimeForm(QtGui.QDialog, Ui_StartTimeDialog):
|
|||||||
minutes = seconds / 60
|
minutes = seconds / 60
|
||||||
seconds -= 60 * minutes
|
seconds -= 60 * minutes
|
||||||
return hours, minutes, seconds
|
return hours, minutes, seconds
|
||||||
|
|
||||||
|
def _get_main_window(self):
|
||||||
|
"""
|
||||||
|
Adds the main window to the class dynamically
|
||||||
|
"""
|
||||||
|
if not hasattr(self, u'_main_window'):
|
||||||
|
self._main_window = Registry().get(u'main_window')
|
||||||
|
return self._main_window
|
||||||
|
|
||||||
|
main_window = property(_get_main_window)
|
@ -58,8 +58,8 @@ class Ui_ThemeLayoutDialog(object):
|
|||||||
self.footerColourLabel = QtGui.QLabel(self.previewArea)
|
self.footerColourLabel = QtGui.QLabel(self.previewArea)
|
||||||
self.footerColourLabel.setObjectName(u'footerColourLabel')
|
self.footerColourLabel.setObjectName(u'footerColourLabel')
|
||||||
self.previewLayout.addWidget(self.footerColourLabel)
|
self.previewLayout.addWidget(self.footerColourLabel)
|
||||||
self.buttonBox = create_button_box(themeLayoutDialog, u'buttonBox', [u'ok'])
|
self.button_box = create_button_box(themeLayoutDialog, u'button_box', [u'ok'])
|
||||||
self.previewLayout.addWidget(self.buttonBox)
|
self.previewLayout.addWidget(self.button_box)
|
||||||
self.retranslateUi(themeLayoutDialog)
|
self.retranslateUi(themeLayoutDialog)
|
||||||
|
|
||||||
def retranslateUi(self, themeLayoutDialog):
|
def retranslateUi(self, themeLayoutDialog):
|
||||||
|
@ -77,9 +77,9 @@ class Ui_AlertDialog(object):
|
|||||||
displayIcon = build_icon(u':/general/general_live.png')
|
displayIcon = build_icon(u':/general/general_live.png')
|
||||||
self.displayButton = create_button(alertDialog, u'displayButton', icon=displayIcon, enabled=False)
|
self.displayButton = create_button(alertDialog, u'displayButton', icon=displayIcon, enabled=False)
|
||||||
self.displayCloseButton = create_button(alertDialog, u'displayCloseButton', icon=displayIcon, enabled=False)
|
self.displayCloseButton = create_button(alertDialog, u'displayCloseButton', icon=displayIcon, enabled=False)
|
||||||
self.buttonBox = create_button_box(alertDialog, u'buttonBox', [u'close'],
|
self.button_box = create_button_box(alertDialog, u'button_box', [u'close'],
|
||||||
[self.displayButton, self.displayCloseButton])
|
[self.displayButton, self.displayCloseButton])
|
||||||
self.alertDialogLayout.addWidget(self.buttonBox, 2, 0, 1, 2)
|
self.alertDialogLayout.addWidget(self.button_box, 2, 0, 1, 2)
|
||||||
self.retranslateUi(alertDialog)
|
self.retranslateUi(alertDialog)
|
||||||
|
|
||||||
def retranslateUi(self, alertDialog):
|
def retranslateUi(self, alertDialog):
|
||||||
|
@ -80,8 +80,8 @@ class Ui_BookNameDialog(object):
|
|||||||
self.apocryphaCheckBox.setCheckState(QtCore.Qt.Checked)
|
self.apocryphaCheckBox.setCheckState(QtCore.Qt.Checked)
|
||||||
self.optionsLayout.addWidget(self.apocryphaCheckBox)
|
self.optionsLayout.addWidget(self.apocryphaCheckBox)
|
||||||
self.bookNameLayout.addWidget(self.optionsGroupBox)
|
self.bookNameLayout.addWidget(self.optionsGroupBox)
|
||||||
self.buttonBox = create_button_box(bookNameDialog, u'buttonBox', [u'cancel', u'ok'])
|
self.button_box = create_button_box(bookNameDialog, u'button_box', [u'cancel', u'ok'])
|
||||||
self.bookNameLayout.addWidget(self.buttonBox)
|
self.bookNameLayout.addWidget(self.button_box)
|
||||||
|
|
||||||
self.retranslateUi(bookNameDialog)
|
self.retranslateUi(bookNameDialog)
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ class Ui_EditBibleDialog(object):
|
|||||||
self.dialogLayout = QtGui.QVBoxLayout(editBibleDialog)
|
self.dialogLayout = QtGui.QVBoxLayout(editBibleDialog)
|
||||||
self.dialogLayout.setSpacing(8)
|
self.dialogLayout.setSpacing(8)
|
||||||
self.dialogLayout.setContentsMargins(8, 8, 8, 8)
|
self.dialogLayout.setContentsMargins(8, 8, 8, 8)
|
||||||
self.dialogLayout.setObjectName(u'dialogLayout')
|
self.dialogLayout.setObjectName(u'dialog_layout')
|
||||||
self.bibleTabWidget = QtGui.QTabWidget(editBibleDialog)
|
self.bibleTabWidget = QtGui.QTabWidget(editBibleDialog)
|
||||||
self.bibleTabWidget.setObjectName(u'BibleTabWidget')
|
self.bibleTabWidget.setObjectName(u'BibleTabWidget')
|
||||||
# Meta tab
|
# Meta tab
|
||||||
@ -121,8 +121,8 @@ class Ui_EditBibleDialog(object):
|
|||||||
self.bibleTabWidget.addTab(self.bookNameTab, u'')
|
self.bibleTabWidget.addTab(self.bookNameTab, u'')
|
||||||
# Last few bits
|
# Last few bits
|
||||||
self.dialogLayout.addWidget(self.bibleTabWidget)
|
self.dialogLayout.addWidget(self.bibleTabWidget)
|
||||||
self.buttonBox = create_button_box(editBibleDialog, u'buttonBox', [u'cancel', u'save'])
|
self.button_box = create_button_box(editBibleDialog, u'button_box', [u'cancel', u'save'])
|
||||||
self.dialogLayout.addWidget(self.buttonBox)
|
self.dialogLayout.addWidget(self.button_box)
|
||||||
self.retranslateUi(editBibleDialog)
|
self.retranslateUi(editBibleDialog)
|
||||||
QtCore.QMetaObject.connectSlotsByName(editBibleDialog)
|
QtCore.QMetaObject.connectSlotsByName(editBibleDialog)
|
||||||
|
|
||||||
|
@ -62,8 +62,8 @@ class Ui_LanguageDialog(object):
|
|||||||
self.languageComboBox.setObjectName(u'languageComboBox')
|
self.languageComboBox.setObjectName(u'languageComboBox')
|
||||||
self.languageHBoxLayout.addWidget(self.languageComboBox)
|
self.languageHBoxLayout.addWidget(self.languageComboBox)
|
||||||
self.languageLayout.addLayout(self.languageHBoxLayout)
|
self.languageLayout.addLayout(self.languageHBoxLayout)
|
||||||
self.buttonBox = create_button_box(languageDialog, u'buttonBox', [u'cancel', u'ok'])
|
self.button_box = create_button_box(languageDialog, u'button_box', [u'cancel', u'ok'])
|
||||||
self.languageLayout.addWidget(self.buttonBox)
|
self.languageLayout.addWidget(self.button_box)
|
||||||
|
|
||||||
self.retranslateUi(languageDialog)
|
self.retranslateUi(languageDialog)
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ class Ui_CustomEditDialog(object):
|
|||||||
customEditDialog.resize(450, 350)
|
customEditDialog.resize(450, 350)
|
||||||
customEditDialog.setWindowIcon(build_icon(u':/icon/openlp-logo-16x16.png'))
|
customEditDialog.setWindowIcon(build_icon(u':/icon/openlp-logo-16x16.png'))
|
||||||
self.dialogLayout = QtGui.QVBoxLayout(customEditDialog)
|
self.dialogLayout = QtGui.QVBoxLayout(customEditDialog)
|
||||||
self.dialogLayout.setObjectName(u'dialogLayout')
|
self.dialogLayout.setObjectName(u'dialog_layout')
|
||||||
self.titleLayout = QtGui.QHBoxLayout()
|
self.titleLayout = QtGui.QHBoxLayout()
|
||||||
self.titleLayout.setObjectName(u'titleLayout')
|
self.titleLayout.setObjectName(u'titleLayout')
|
||||||
self.titleLabel = QtGui.QLabel(customEditDialog)
|
self.titleLabel = QtGui.QLabel(customEditDialog)
|
||||||
@ -97,8 +97,8 @@ class Ui_CustomEditDialog(object):
|
|||||||
self.bottomFormLayout.addRow(self.creditLabel, self.creditEdit)
|
self.bottomFormLayout.addRow(self.creditLabel, self.creditEdit)
|
||||||
self.dialogLayout.addLayout(self.bottomFormLayout)
|
self.dialogLayout.addLayout(self.bottomFormLayout)
|
||||||
self.previewButton = QtGui.QPushButton()
|
self.previewButton = QtGui.QPushButton()
|
||||||
self.buttonBox = create_button_box(customEditDialog, u'buttonBox', [u'cancel', u'save'], [self.previewButton])
|
self.button_box = create_button_box(customEditDialog, u'button_box', [u'cancel', u'save'], [self.previewButton])
|
||||||
self.dialogLayout.addWidget(self.buttonBox)
|
self.dialogLayout.addWidget(self.button_box)
|
||||||
self.retranslateUi(customEditDialog)
|
self.retranslateUi(customEditDialog)
|
||||||
|
|
||||||
def retranslateUi(self, customEditDialog):
|
def retranslateUi(self, customEditDialog):
|
||||||
|
@ -102,10 +102,6 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog):
|
|||||||
# If not preview hide the preview button.
|
# If not preview hide the preview button.
|
||||||
self.previewButton.setVisible(preview)
|
self.previewButton.setVisible(preview)
|
||||||
|
|
||||||
def reject(self):
|
|
||||||
Receiver.send_message(u'custom_edit_clear')
|
|
||||||
QtGui.QDialog.reject(self)
|
|
||||||
|
|
||||||
def accept(self):
|
def accept(self):
|
||||||
log.debug(u'accept')
|
log.debug(u'accept')
|
||||||
if self.saveCustom():
|
if self.saveCustom():
|
||||||
|
@ -42,9 +42,9 @@ class Ui_CustomSlideEditDialog(object):
|
|||||||
self.dialogLayout.addWidget(self.slideTextEdit)
|
self.dialogLayout.addWidget(self.slideTextEdit)
|
||||||
self.splitButton = create_button(customSlideEditDialog, u'splitButton', icon=u':/general/general_add.png')
|
self.splitButton = create_button(customSlideEditDialog, u'splitButton', icon=u':/general/general_add.png')
|
||||||
self.insertButton = create_button(customSlideEditDialog, u'insertButton', icon=u':/general/general_add.png')
|
self.insertButton = create_button(customSlideEditDialog, u'insertButton', icon=u':/general/general_add.png')
|
||||||
self.buttonBox = create_button_box(customSlideEditDialog, u'buttonBox', [u'cancel', u'save'],
|
self.button_box = create_button_box(customSlideEditDialog, u'button_box', [u'cancel', u'save'],
|
||||||
[self.splitButton, self.insertButton])
|
[self.splitButton, self.insertButton])
|
||||||
self.dialogLayout.addWidget(self.buttonBox)
|
self.dialogLayout.addWidget(self.button_box)
|
||||||
self.retranslateUi(customSlideEditDialog)
|
self.retranslateUi(customSlideEditDialog)
|
||||||
|
|
||||||
def retranslateUi(self, customSlideEditDialog):
|
def retranslateUi(self, customSlideEditDialog):
|
||||||
|
@ -73,8 +73,6 @@ class CustomMediaItem(MediaManagerItem):
|
|||||||
QtCore.QObject.connect(self.searchTextEdit, QtCore.SIGNAL(u'cleared()'), self.onClearTextButtonClick)
|
QtCore.QObject.connect(self.searchTextEdit, QtCore.SIGNAL(u'cleared()'), self.onClearTextButtonClick)
|
||||||
QtCore.QObject.connect(self.searchTextEdit, QtCore.SIGNAL(u'searchTypeChanged(int)'),
|
QtCore.QObject.connect(self.searchTextEdit, QtCore.SIGNAL(u'searchTypeChanged(int)'),
|
||||||
self.onSearchTextButtonClicked)
|
self.onSearchTextButtonClicked)
|
||||||
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'custom_edit'), self.onRemoteEdit)
|
|
||||||
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'custom_edit_clear'), self.onRemoteEditClear)
|
|
||||||
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'custom_load_list'), self.loadList)
|
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'custom_load_list'), self.loadList)
|
||||||
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'custom_preview'), self.onPreviewClick)
|
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'custom_preview'), self.onPreviewClick)
|
||||||
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'config_updated'), self.config_updated)
|
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'config_updated'), self.config_updated)
|
||||||
@ -115,11 +113,6 @@ class CustomMediaItem(MediaManagerItem):
|
|||||||
# Called to redisplay the custom list screen edith from a search
|
# Called to redisplay the custom list screen edith from a search
|
||||||
# or from the exit of the Custom edit dialog. If remote editing is
|
# or from the exit of the Custom edit dialog. If remote editing is
|
||||||
# active trigger it and clean up so it will not update again.
|
# active trigger it and clean up so it will not update again.
|
||||||
if self.remoteTriggered == u'L':
|
|
||||||
self.onAddClick()
|
|
||||||
if self.remoteTriggered == u'P':
|
|
||||||
self.onPreviewClick()
|
|
||||||
self.onRemoteEditClear()
|
|
||||||
|
|
||||||
def onNewClick(self):
|
def onNewClick(self):
|
||||||
self.edit_custom_form.loadCustom(0)
|
self.edit_custom_form.loadCustom(0)
|
||||||
@ -127,26 +120,27 @@ class CustomMediaItem(MediaManagerItem):
|
|||||||
self.onClearTextButtonClick()
|
self.onClearTextButtonClick()
|
||||||
self.onSelectionChange()
|
self.onSelectionChange()
|
||||||
|
|
||||||
def onRemoteEditClear(self):
|
def onRemoteEdit(self, custom_id, preview=False):
|
||||||
self.remoteTriggered = None
|
|
||||||
self.remoteCustom = -1
|
|
||||||
|
|
||||||
def onRemoteEdit(self, message):
|
|
||||||
"""
|
"""
|
||||||
Called by ServiceManager or SlideController by event passing
|
Called by ServiceManager or SlideController by event passing
|
||||||
the custom Id in the payload along with an indicator to say which
|
the custom Id in the payload along with an indicator to say which
|
||||||
type of display is required.
|
type of display is required.
|
||||||
"""
|
"""
|
||||||
remote_type, custom_id = message.split(u':')
|
|
||||||
custom_id = int(custom_id)
|
custom_id = int(custom_id)
|
||||||
valid = self.manager.get_object(CustomSlide, custom_id)
|
valid = self.manager.get_object(CustomSlide, custom_id)
|
||||||
if valid:
|
if valid:
|
||||||
|
self.edit_custom_form.loadCustom(custom_id, preview)
|
||||||
|
if self.edit_custom_form.exec_() == QtGui.QDialog.Accepted:
|
||||||
|
self.remoteTriggered = True
|
||||||
self.remoteCustom = custom_id
|
self.remoteCustom = custom_id
|
||||||
self.remoteTriggered = remote_type
|
|
||||||
self.edit_custom_form.loadCustom(custom_id, (remote_type == u'P'))
|
|
||||||
self.edit_custom_form.exec_()
|
|
||||||
self.autoSelectId = -1
|
self.autoSelectId = -1
|
||||||
self.onSearchTextButtonClicked()
|
self.onSearchTextButtonClicked()
|
||||||
|
item = self.buildServiceItem(remote=True)
|
||||||
|
self.remoteTriggered = None
|
||||||
|
self.remoteCustom = 1
|
||||||
|
if item:
|
||||||
|
return item
|
||||||
|
return None
|
||||||
|
|
||||||
def onEditClick(self):
|
def onEditClick(self):
|
||||||
"""
|
"""
|
||||||
|
@ -189,10 +189,10 @@ class ImageMediaItem(MediaManagerItem):
|
|||||||
|
|
||||||
def onResetClick(self):
|
def onResetClick(self):
|
||||||
"""
|
"""
|
||||||
Called to reset the Live backgound with the image selected,
|
Called to reset the Live background with the image selected,
|
||||||
"""
|
"""
|
||||||
self.resetAction.setVisible(False)
|
self.resetAction.setVisible(False)
|
||||||
self.plugin.liveController.display.resetImage()
|
self.live_controller.display.resetImage()
|
||||||
|
|
||||||
def liveThemeChanged(self):
|
def liveThemeChanged(self):
|
||||||
"""
|
"""
|
||||||
@ -211,7 +211,7 @@ class ImageMediaItem(MediaManagerItem):
|
|||||||
bitem = self.listView.item(item.row())
|
bitem = self.listView.item(item.row())
|
||||||
filename = bitem.data(QtCore.Qt.UserRole)
|
filename = bitem.data(QtCore.Qt.UserRole)
|
||||||
if os.path.exists(filename):
|
if os.path.exists(filename):
|
||||||
if self.plugin.liveController.display.directImage(filename, background):
|
if self.live_controller.display.directImage(filename, background):
|
||||||
self.resetAction.setVisible(True)
|
self.resetAction.setVisible(True)
|
||||||
else:
|
else:
|
||||||
critical_error_message_box(UiStrings().LiveBGError,
|
critical_error_message_box(UiStrings().LiveBGError,
|
||||||
|
@ -131,7 +131,7 @@ class MediaMediaItem(MediaManagerItem):
|
|||||||
"""
|
"""
|
||||||
Called to reset the Live background with the media selected,
|
Called to reset the Live background with the media selected,
|
||||||
"""
|
"""
|
||||||
self.live_controller.mediaController.media_reset(self.plugin.liveController)
|
self.media_controller.media_reset(self.live_controller)
|
||||||
self.resetAction.setVisible(False)
|
self.resetAction.setVisible(False)
|
||||||
|
|
||||||
def videobackgroundReplaced(self):
|
def videobackgroundReplaced(self):
|
||||||
@ -154,7 +154,7 @@ class MediaMediaItem(MediaManagerItem):
|
|||||||
service_item.shortname = service_item.title
|
service_item.shortname = service_item.title
|
||||||
(path, name) = os.path.split(filename)
|
(path, name) = os.path.split(filename)
|
||||||
service_item.add_from_command(path, name,CLAPPERBOARD)
|
service_item.add_from_command(path, name,CLAPPERBOARD)
|
||||||
if self.live_controller.mediaController.video(DisplayControllerType.Live, service_item,
|
if self.media_controller.video(DisplayControllerType.Live, service_item,
|
||||||
videoBehindText=True):
|
videoBehindText=True):
|
||||||
self.resetAction.setVisible(True)
|
self.resetAction.setVisible(True)
|
||||||
else:
|
else:
|
||||||
|
@ -85,6 +85,6 @@ class MediaTab(SettingsTab):
|
|||||||
if Settings().value(setting_key) != self.autoStartCheckBox.checkState():
|
if Settings().value(setting_key) != self.autoStartCheckBox.checkState():
|
||||||
Settings().setValue(setting_key, self.autoStartCheckBox.checkState())
|
Settings().setValue(setting_key, self.autoStartCheckBox.checkState())
|
||||||
if override_changed:
|
if override_changed:
|
||||||
self.parent.resetSupportedSuffixes()
|
self.parent.reset_supported_suffixes()
|
||||||
Receiver.send_message(u'mediaitem_media_rebuild')
|
Receiver.send_message(u'mediaitem_media_rebuild')
|
||||||
Receiver.send_message(u'mediaitem_suffixes')
|
Receiver.send_message(u'mediaitem_suffixes')
|
||||||
|
@ -85,7 +85,7 @@ class PresentationMediaItem(MediaManagerItem):
|
|||||||
for type in types:
|
for type in types:
|
||||||
if fileType.find(type) == -1:
|
if fileType.find(type) == -1:
|
||||||
fileType += u'*.%s ' % type
|
fileType += u'*.%s ' % type
|
||||||
self.plugin.serviceManager.supportedSuffixes(type)
|
self.service_manager.supported_suffixes(type)
|
||||||
self.onNewFileMasks = translate('PresentationPlugin.MediaItem', 'Presentations (%s)') % fileType
|
self.onNewFileMasks = translate('PresentationPlugin.MediaItem', 'Presentations (%s)') % fileType
|
||||||
|
|
||||||
def requiredIcons(self):
|
def requiredIcons(self):
|
||||||
|
@ -129,7 +129,7 @@ class PresentationTab(SettingsTab):
|
|||||||
Settings().setValue(setting_key, self.OverrideAppCheckBox.checkState())
|
Settings().setValue(setting_key, self.OverrideAppCheckBox.checkState())
|
||||||
changed = True
|
changed = True
|
||||||
if changed:
|
if changed:
|
||||||
self.parent.resetSupportedSuffixes()
|
self.parent.reset_supported_suffixes()
|
||||||
Receiver.send_message(u'mediaitem_presentation_rebuild')
|
Receiver.send_message(u'mediaitem_presentation_rebuild')
|
||||||
Receiver.send_message(u'mediaitem_suffixes')
|
Receiver.send_message(u'mediaitem_suffixes')
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ class Ui_AuthorsDialog(object):
|
|||||||
authorsDialog.setObjectName(u'AuthorsDialog')
|
authorsDialog.setObjectName(u'AuthorsDialog')
|
||||||
authorsDialog.resize(300, 10)
|
authorsDialog.resize(300, 10)
|
||||||
self.dialogLayout = QtGui.QVBoxLayout(authorsDialog)
|
self.dialogLayout = QtGui.QVBoxLayout(authorsDialog)
|
||||||
self.dialogLayout.setObjectName(u'dialogLayout')
|
self.dialogLayout.setObjectName(u'dialog_layout')
|
||||||
self.authorLayout = QtGui.QFormLayout()
|
self.authorLayout = QtGui.QFormLayout()
|
||||||
self.authorLayout.setObjectName(u'authorLayout')
|
self.authorLayout.setObjectName(u'authorLayout')
|
||||||
self.firstNameLabel = QtGui.QLabel(authorsDialog)
|
self.firstNameLabel = QtGui.QLabel(authorsDialog)
|
||||||
@ -59,8 +59,8 @@ class Ui_AuthorsDialog(object):
|
|||||||
self.displayLabel.setBuddy(self.displayEdit)
|
self.displayLabel.setBuddy(self.displayEdit)
|
||||||
self.authorLayout.addRow(self.displayLabel, self.displayEdit)
|
self.authorLayout.addRow(self.displayLabel, self.displayEdit)
|
||||||
self.dialogLayout.addLayout(self.authorLayout)
|
self.dialogLayout.addLayout(self.authorLayout)
|
||||||
self.buttonBox = create_button_box(authorsDialog, u'buttonBox', [u'cancel', u'save'])
|
self.button_box = create_button_box(authorsDialog, u'button_box', [u'cancel', u'save'])
|
||||||
self.dialogLayout.addWidget(self.buttonBox)
|
self.dialogLayout.addWidget(self.button_box)
|
||||||
self.retranslateUi(authorsDialog)
|
self.retranslateUi(authorsDialog)
|
||||||
authorsDialog.setMaximumHeight(authorsDialog.sizeHint().height())
|
authorsDialog.setMaximumHeight(authorsDialog.sizeHint().height())
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ class Ui_EditSongDialog(object):
|
|||||||
self.dialogLayout = QtGui.QVBoxLayout(editSongDialog)
|
self.dialogLayout = QtGui.QVBoxLayout(editSongDialog)
|
||||||
self.dialogLayout.setSpacing(8)
|
self.dialogLayout.setSpacing(8)
|
||||||
self.dialogLayout.setContentsMargins(8, 8, 8, 8)
|
self.dialogLayout.setContentsMargins(8, 8, 8, 8)
|
||||||
self.dialogLayout.setObjectName(u'dialogLayout')
|
self.dialogLayout.setObjectName(u'dialog_layout')
|
||||||
self.songTabWidget = QtGui.QTabWidget(editSongDialog)
|
self.songTabWidget = QtGui.QTabWidget(editSongDialog)
|
||||||
self.songTabWidget.setObjectName(u'songTabWidget')
|
self.songTabWidget.setObjectName(u'songTabWidget')
|
||||||
# lyrics tab
|
# lyrics tab
|
||||||
@ -272,8 +272,8 @@ class Ui_EditSongDialog(object):
|
|||||||
self.warningLabel.setObjectName(u'warningLabel')
|
self.warningLabel.setObjectName(u'warningLabel')
|
||||||
self.warningLabel.setVisible(False)
|
self.warningLabel.setVisible(False)
|
||||||
self.bottomLayout.addWidget(self.warningLabel)
|
self.bottomLayout.addWidget(self.warningLabel)
|
||||||
self.buttonBox = create_button_box(editSongDialog, u'buttonBox', [u'cancel', u'save'])
|
self.button_box = create_button_box(editSongDialog, u'button_box', [u'cancel', u'save'])
|
||||||
self.bottomLayout.addWidget(self.buttonBox)
|
self.bottomLayout.addWidget(self.button_box)
|
||||||
self.dialogLayout.addLayout(self.bottomLayout)
|
self.dialogLayout.addLayout(self.bottomLayout)
|
||||||
self.retranslateUi(editSongDialog)
|
self.retranslateUi(editSongDialog)
|
||||||
|
|
||||||
|
@ -101,8 +101,8 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
|||||||
self.previewButton = QtGui.QPushButton()
|
self.previewButton = QtGui.QPushButton()
|
||||||
self.previewButton.setObjectName(u'previewButton')
|
self.previewButton.setObjectName(u'previewButton')
|
||||||
self.previewButton.setText(UiStrings().SaveAndPreview)
|
self.previewButton.setText(UiStrings().SaveAndPreview)
|
||||||
self.buttonBox.addButton(self.previewButton, QtGui.QDialogButtonBox.ActionRole)
|
self.button_box.addButton(self.previewButton, QtGui.QDialogButtonBox.ActionRole)
|
||||||
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(u'clicked(QAbstractButton*)'), self.onPreview)
|
QtCore.QObject.connect(self.button_box, QtCore.SIGNAL(u'clicked(QAbstractButton*)'), self.onPreview)
|
||||||
# Create other objects and forms
|
# Create other objects and forms
|
||||||
self.manager = manager
|
self.manager = manager
|
||||||
self.verseForm = EditVerseForm(self)
|
self.verseForm = EditVerseForm(self)
|
||||||
@ -775,7 +775,6 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
|||||||
Exit Dialog and do not save
|
Exit Dialog and do not save
|
||||||
"""
|
"""
|
||||||
log.debug (u'SongEditForm.reject')
|
log.debug (u'SongEditForm.reject')
|
||||||
Receiver.send_message(u'songs_edit_clear')
|
|
||||||
self.clearCaches()
|
self.clearCaches()
|
||||||
QtGui.QDialog.reject(self)
|
QtGui.QDialog.reject(self)
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ class Ui_EditVerseDialog(object):
|
|||||||
editVerseDialog.resize(400, 400)
|
editVerseDialog.resize(400, 400)
|
||||||
editVerseDialog.setModal(True)
|
editVerseDialog.setModal(True)
|
||||||
self.dialogLayout = QtGui.QVBoxLayout(editVerseDialog)
|
self.dialogLayout = QtGui.QVBoxLayout(editVerseDialog)
|
||||||
self.dialogLayout.setObjectName(u'dialogLayout')
|
self.dialogLayout.setObjectName(u'dialog_layout')
|
||||||
self.verseTextEdit = SpellTextEdit(editVerseDialog)
|
self.verseTextEdit = SpellTextEdit(editVerseDialog)
|
||||||
self.verseTextEdit.setObjectName(u'verseTextEdit')
|
self.verseTextEdit.setObjectName(u'verseTextEdit')
|
||||||
self.dialogLayout.addWidget(self.verseTextEdit)
|
self.dialogLayout.addWidget(self.verseTextEdit)
|
||||||
@ -67,8 +67,8 @@ class Ui_EditVerseDialog(object):
|
|||||||
self.verseTypeLayout.addWidget(self.insertButton)
|
self.verseTypeLayout.addWidget(self.insertButton)
|
||||||
self.verseTypeLayout.addStretch()
|
self.verseTypeLayout.addStretch()
|
||||||
self.dialogLayout.addLayout(self.verseTypeLayout)
|
self.dialogLayout.addLayout(self.verseTypeLayout)
|
||||||
self.buttonBox = create_button_box(editVerseDialog, u'buttonBox', [u'cancel', u'ok'])
|
self.button_box = create_button_box(editVerseDialog, u'button_box', [u'cancel', u'ok'])
|
||||||
self.dialogLayout.addWidget(self.buttonBox)
|
self.dialogLayout.addWidget(self.button_box)
|
||||||
self.retranslateUi(editVerseDialog)
|
self.retranslateUi(editVerseDialog)
|
||||||
|
|
||||||
def retranslateUi(self, editVerseDialog):
|
def retranslateUi(self, editVerseDialog):
|
||||||
|
@ -52,8 +52,8 @@ class Ui_MediaFilesDialog(object):
|
|||||||
self.fileListWidget.setSelectionMode(QtGui.QAbstractItemView.ExtendedSelection)
|
self.fileListWidget.setSelectionMode(QtGui.QAbstractItemView.ExtendedSelection)
|
||||||
self.fileListWidget.setObjectName(u'fileListWidget')
|
self.fileListWidget.setObjectName(u'fileListWidget')
|
||||||
self.filesVerticalLayout.addWidget(self.fileListWidget)
|
self.filesVerticalLayout.addWidget(self.fileListWidget)
|
||||||
self.buttonBox = create_button_box(mediaFilesDialog, u'buttonBox', [u'cancel', u'ok'])
|
self.button_box = create_button_box(mediaFilesDialog, u'button_box', [u'cancel', u'ok'])
|
||||||
self.filesVerticalLayout.addWidget(self.buttonBox)
|
self.filesVerticalLayout.addWidget(self.button_box)
|
||||||
self.retranslateUi(mediaFilesDialog)
|
self.retranslateUi(mediaFilesDialog)
|
||||||
|
|
||||||
def retranslateUi(self, mediaFilesDialog):
|
def retranslateUi(self, mediaFilesDialog):
|
||||||
|
@ -37,7 +37,7 @@ class Ui_SongBookDialog(object):
|
|||||||
songBookDialog.setObjectName(u'songBookDialog')
|
songBookDialog.setObjectName(u'songBookDialog')
|
||||||
songBookDialog.resize(300, 10)
|
songBookDialog.resize(300, 10)
|
||||||
self.dialogLayout = QtGui.QVBoxLayout(songBookDialog)
|
self.dialogLayout = QtGui.QVBoxLayout(songBookDialog)
|
||||||
self.dialogLayout.setObjectName(u'dialogLayout')
|
self.dialogLayout.setObjectName(u'dialog_layout')
|
||||||
self.bookLayout = QtGui.QFormLayout()
|
self.bookLayout = QtGui.QFormLayout()
|
||||||
self.bookLayout.setObjectName(u'bookLayout')
|
self.bookLayout.setObjectName(u'bookLayout')
|
||||||
self.nameLabel = QtGui.QLabel(songBookDialog)
|
self.nameLabel = QtGui.QLabel(songBookDialog)
|
||||||
@ -53,8 +53,8 @@ class Ui_SongBookDialog(object):
|
|||||||
self.publisherLabel.setBuddy(self.publisherEdit)
|
self.publisherLabel.setBuddy(self.publisherEdit)
|
||||||
self.bookLayout.addRow(self.publisherLabel, self.publisherEdit)
|
self.bookLayout.addRow(self.publisherLabel, self.publisherEdit)
|
||||||
self.dialogLayout.addLayout(self.bookLayout)
|
self.dialogLayout.addLayout(self.bookLayout)
|
||||||
self.buttonBox = create_button_box(songBookDialog, u'buttonBox', [u'cancel', u'save'])
|
self.button_box = create_button_box(songBookDialog, u'button_box', [u'cancel', u'save'])
|
||||||
self.dialogLayout.addWidget(self.buttonBox)
|
self.dialogLayout.addWidget(self.button_box)
|
||||||
self.retranslateUi(songBookDialog)
|
self.retranslateUi(songBookDialog)
|
||||||
songBookDialog.setMaximumHeight(songBookDialog.sizeHint().height())
|
songBookDialog.setMaximumHeight(songBookDialog.sizeHint().height())
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ class Ui_SongMaintenanceDialog(object):
|
|||||||
songMaintenanceDialog.setWindowModality(QtCore.Qt.ApplicationModal)
|
songMaintenanceDialog.setWindowModality(QtCore.Qt.ApplicationModal)
|
||||||
songMaintenanceDialog.resize(10, 350)
|
songMaintenanceDialog.resize(10, 350)
|
||||||
self.dialogLayout = QtGui.QGridLayout(songMaintenanceDialog)
|
self.dialogLayout = QtGui.QGridLayout(songMaintenanceDialog)
|
||||||
self.dialogLayout.setObjectName(u'dialogLayout')
|
self.dialogLayout.setObjectName(u'dialog_layout')
|
||||||
self.typeListWidget = QtGui.QListWidget(songMaintenanceDialog)
|
self.typeListWidget = QtGui.QListWidget(songMaintenanceDialog)
|
||||||
self.typeListWidget.setIconSize(QtCore.QSize(32, 32))
|
self.typeListWidget.setIconSize(QtCore.QSize(32, 32))
|
||||||
self.typeListWidget.setUniformItemSizes(True)
|
self.typeListWidget.setUniformItemSizes(True)
|
||||||
@ -130,8 +130,8 @@ class Ui_SongMaintenanceDialog(object):
|
|||||||
self.stackedLayout.addWidget(self.booksPage)
|
self.stackedLayout.addWidget(self.booksPage)
|
||||||
#
|
#
|
||||||
self.dialogLayout.addLayout(self.stackedLayout, 0, 1)
|
self.dialogLayout.addLayout(self.stackedLayout, 0, 1)
|
||||||
self.buttonBox = create_button_box(songMaintenanceDialog, u'buttonBox', [u'close'])
|
self.button_box = create_button_box(songMaintenanceDialog, u'button_box', [u'close'])
|
||||||
self.dialogLayout.addWidget(self.buttonBox, 1, 0, 1, 2)
|
self.dialogLayout.addWidget(self.button_box, 1, 0, 1, 2)
|
||||||
self.retranslateUi(songMaintenanceDialog)
|
self.retranslateUi(songMaintenanceDialog)
|
||||||
self.stackedLayout.setCurrentIndex(0)
|
self.stackedLayout.setCurrentIndex(0)
|
||||||
QtCore.QObject.connect(self.typeListWidget, QtCore.SIGNAL(u'currentRowChanged(int)'),
|
QtCore.QObject.connect(self.typeListWidget, QtCore.SIGNAL(u'currentRowChanged(int)'),
|
||||||
|
@ -37,7 +37,7 @@ class Ui_TopicsDialog(object):
|
|||||||
topicsDialog.setObjectName(u'topicsDialog')
|
topicsDialog.setObjectName(u'topicsDialog')
|
||||||
topicsDialog.resize(300, 10)
|
topicsDialog.resize(300, 10)
|
||||||
self.dialogLayout = QtGui.QVBoxLayout(topicsDialog)
|
self.dialogLayout = QtGui.QVBoxLayout(topicsDialog)
|
||||||
self.dialogLayout.setObjectName(u'dialogLayout')
|
self.dialogLayout.setObjectName(u'dialog_layout')
|
||||||
self.nameLayout = QtGui.QFormLayout()
|
self.nameLayout = QtGui.QFormLayout()
|
||||||
self.nameLayout.setObjectName(u'nameLayout')
|
self.nameLayout.setObjectName(u'nameLayout')
|
||||||
self.nameLabel = QtGui.QLabel(topicsDialog)
|
self.nameLabel = QtGui.QLabel(topicsDialog)
|
||||||
@ -47,8 +47,8 @@ class Ui_TopicsDialog(object):
|
|||||||
self.nameLabel.setBuddy(self.nameEdit)
|
self.nameLabel.setBuddy(self.nameEdit)
|
||||||
self.nameLayout.addRow(self.nameLabel, self.nameEdit)
|
self.nameLayout.addRow(self.nameLabel, self.nameEdit)
|
||||||
self.dialogLayout.addLayout(self.nameLayout)
|
self.dialogLayout.addLayout(self.nameLayout)
|
||||||
self.buttonBox = create_button_box(topicsDialog, u'buttonBox', [u'cancel', u'save'])
|
self.button_box = create_button_box(topicsDialog, u'button_box', [u'cancel', u'save'])
|
||||||
self.dialogLayout.addWidget(self.buttonBox)
|
self.dialogLayout.addWidget(self.button_box)
|
||||||
self.retranslateUi(topicsDialog)
|
self.retranslateUi(topicsDialog)
|
||||||
topicsDialog.setMaximumHeight(topicsDialog.sizeHint().height())
|
topicsDialog.setMaximumHeight(topicsDialog.sizeHint().height())
|
||||||
|
|
||||||
|
@ -35,15 +35,12 @@ import shutil
|
|||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
from sqlalchemy.sql import or_
|
from sqlalchemy.sql import or_
|
||||||
|
|
||||||
from openlp.core.lib import MediaManagerItem, Receiver, ItemCapabilities, \
|
from openlp.core.lib import MediaManagerItem, Receiver, ItemCapabilities, translate, check_item_selected, \
|
||||||
translate, check_item_selected, PluginStatus, create_separated_list, \
|
PluginStatus, create_separated_list, check_directory_exists, ServiceItemContext, Settings, UiStrings
|
||||||
check_directory_exists, ServiceItemContext, Settings, UiStrings
|
|
||||||
from openlp.core.lib.ui import create_widget_action
|
from openlp.core.lib.ui import create_widget_action
|
||||||
from openlp.core.utils import AppLocation
|
from openlp.core.utils import AppLocation
|
||||||
from openlp.plugins.songs.forms import EditSongForm, SongMaintenanceForm, \
|
from openlp.plugins.songs.forms import EditSongForm, SongMaintenanceForm, SongImportForm, SongExportForm
|
||||||
SongImportForm, SongExportForm
|
from openlp.plugins.songs.lib import OpenLyrics, SongXML, VerseType, clean_string, natcmp
|
||||||
from openlp.plugins.songs.lib import OpenLyrics, SongXML, VerseType, \
|
|
||||||
clean_string, natcmp
|
|
||||||
from openlp.plugins.songs.lib.db import Author, Song, Book, MediaFile
|
from openlp.plugins.songs.lib.db import Author, Song, Book, MediaFile
|
||||||
from openlp.plugins.songs.lib.ui import SongStrings
|
from openlp.plugins.songs.lib.ui import SongStrings
|
||||||
|
|
||||||
@ -105,8 +102,6 @@ class SongMediaItem(MediaManagerItem):
|
|||||||
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'songs_load_list'), self.onSongListLoad)
|
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'songs_load_list'), self.onSongListLoad)
|
||||||
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'config_updated'), self.configUpdated)
|
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'config_updated'), self.configUpdated)
|
||||||
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'songs_preview'), self.onPreviewClick)
|
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'songs_preview'), self.onPreviewClick)
|
||||||
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'songs_edit'), self.onRemoteEdit)
|
|
||||||
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'songs_edit_clear'), self.onRemoteEditClear)
|
|
||||||
QtCore.QObject.connect(self.searchTextEdit, QtCore.SIGNAL(u'cleared()'), self.onClearTextButtonClick)
|
QtCore.QObject.connect(self.searchTextEdit, QtCore.SIGNAL(u'cleared()'), self.onClearTextButtonClick)
|
||||||
QtCore.QObject.connect(self.searchTextEdit, QtCore.SIGNAL(u'searchTypeChanged(int)'),
|
QtCore.QObject.connect(self.searchTextEdit, QtCore.SIGNAL(u'searchTypeChanged(int)'),
|
||||||
self.onSearchTextButtonClicked)
|
self.onSearchTextButtonClicked)
|
||||||
@ -212,15 +207,10 @@ class SongMediaItem(MediaManagerItem):
|
|||||||
# Called to redisplay the song list screen edit from a search
|
# Called to redisplay the song list screen edit from a search
|
||||||
# or from the exit of the Song edit dialog. If remote editing is active
|
# or from the exit of the Song edit dialog. If remote editing is active
|
||||||
# Trigger it and clean up so it will not update again.
|
# Trigger it and clean up so it will not update again.
|
||||||
if self.remoteTriggered == u'L':
|
|
||||||
self.onAddClick()
|
|
||||||
if self.remoteTriggered == u'P':
|
|
||||||
self.onPreviewClick()
|
|
||||||
# Push edits to the service manager to update items
|
# Push edits to the service manager to update items
|
||||||
if self.editItem and self.updateServiceOnEdit and not self.remoteTriggered:
|
if self.editItem and self.updateServiceOnEdit and not self.remoteTriggered:
|
||||||
item = self.buildServiceItem(self.editItem)
|
item = self.buildServiceItem(self.editItem)
|
||||||
self.plugin.serviceManager.replaceServiceItem(item)
|
self.service_manager.replace_service_item(item)
|
||||||
self.onRemoteEditClear()
|
|
||||||
self.onSearchTextButtonClicked()
|
self.onSearchTextButtonClicked()
|
||||||
log.debug(u'onSongListLoad - finished')
|
log.debug(u'onSongListLoad - finished')
|
||||||
|
|
||||||
@ -321,28 +311,28 @@ class SongMediaItem(MediaManagerItem):
|
|||||||
def onSongMaintenanceClick(self):
|
def onSongMaintenanceClick(self):
|
||||||
self.songMaintenanceForm.exec_()
|
self.songMaintenanceForm.exec_()
|
||||||
|
|
||||||
def onRemoteEditClear(self):
|
def onRemoteEdit(self, song_id, preview=False):
|
||||||
log.debug(u'onRemoteEditClear')
|
|
||||||
self.remoteTriggered = None
|
|
||||||
self.remoteSong = -1
|
|
||||||
|
|
||||||
def onRemoteEdit(self, message):
|
|
||||||
"""
|
"""
|
||||||
Called by ServiceManager or SlideController by event passing
|
Called by ServiceManager or SlideController by event passing
|
||||||
the Song Id in the payload along with an indicator to say which
|
the Song Id in the payload along with an indicator to say which
|
||||||
type of display is required.
|
type of display is required.
|
||||||
"""
|
"""
|
||||||
log.debug(u'onRemoteEdit %s' % message)
|
log.debug(u'onRemoteEdit for song %s' % song_id)
|
||||||
remote_type, song_id = message.split(u':')
|
|
||||||
song_id = int(song_id)
|
song_id = int(song_id)
|
||||||
valid = self.plugin.manager.get_object(Song, song_id)
|
valid = self.plugin.manager.get_object(Song, song_id)
|
||||||
if valid:
|
if valid:
|
||||||
self.remoteSong = song_id
|
self.editSongForm.loadSong(song_id, preview)
|
||||||
self.remoteTriggered = remote_type
|
if self.editSongForm.exec_() == QtGui.QDialog.Accepted:
|
||||||
self.editSongForm.loadSong(song_id, remote_type == u'P')
|
|
||||||
self.editSongForm.exec_()
|
|
||||||
self.autoSelectId = -1
|
self.autoSelectId = -1
|
||||||
self.onSongListLoad()
|
self.onSongListLoad()
|
||||||
|
self.remoteSong = song_id
|
||||||
|
self.remoteTriggered = True
|
||||||
|
item = self.buildServiceItem(remote=True)
|
||||||
|
self.remoteSong = -1
|
||||||
|
self.remoteTriggered = None
|
||||||
|
if item:
|
||||||
|
return item
|
||||||
|
return None
|
||||||
|
|
||||||
def onEditClick(self):
|
def onEditClick(self):
|
||||||
"""
|
"""
|
||||||
@ -426,8 +416,7 @@ class SongMediaItem(MediaManagerItem):
|
|||||||
verse_list = SongXML().get_verses(song.lyrics)
|
verse_list = SongXML().get_verses(song.lyrics)
|
||||||
# no verse list or only 1 space (in error)
|
# no verse list or only 1 space (in error)
|
||||||
verse_tags_translated = False
|
verse_tags_translated = False
|
||||||
if VerseType.from_translated_string(unicode(
|
if VerseType.from_translated_string(unicode(verse_list[0][0][u'type'])) is not None:
|
||||||
verse_list[0][0][u'type'])) is not None:
|
|
||||||
verse_tags_translated = True
|
verse_tags_translated = True
|
||||||
if not song.verse_order.strip():
|
if not song.verse_order.strip():
|
||||||
for verse in verse_list:
|
for verse in verse_list:
|
||||||
|
@ -49,8 +49,8 @@ class Ui_SongUsageDeleteDialog(object):
|
|||||||
self.deleteCalendar.setVerticalHeaderFormat(QtGui.QCalendarWidget.NoVerticalHeader)
|
self.deleteCalendar.setVerticalHeaderFormat(QtGui.QCalendarWidget.NoVerticalHeader)
|
||||||
self.deleteCalendar.setObjectName(u'deleteCalendar')
|
self.deleteCalendar.setObjectName(u'deleteCalendar')
|
||||||
self.verticalLayout.addWidget(self.deleteCalendar)
|
self.verticalLayout.addWidget(self.deleteCalendar)
|
||||||
self.buttonBox = create_button_box(songUsageDeleteDialog, u'buttonBox', [u'cancel', u'ok'])
|
self.button_box = create_button_box(songUsageDeleteDialog, u'button_box', [u'cancel', u'ok'])
|
||||||
self.verticalLayout.addWidget(self.buttonBox)
|
self.verticalLayout.addWidget(self.button_box)
|
||||||
self.retranslateUi(songUsageDeleteDialog)
|
self.retranslateUi(songUsageDeleteDialog)
|
||||||
|
|
||||||
def retranslateUi(self, songUsageDeleteDialog):
|
def retranslateUi(self, songUsageDeleteDialog):
|
||||||
|
@ -44,11 +44,11 @@ class SongUsageDeleteForm(QtGui.QDialog, Ui_SongUsageDeleteDialog):
|
|||||||
self.manager = manager
|
self.manager = manager
|
||||||
QtGui.QDialog.__init__(self, parent)
|
QtGui.QDialog.__init__(self, parent)
|
||||||
self.setupUi(self)
|
self.setupUi(self)
|
||||||
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(u'clicked(QAbstractButton*)'),
|
QtCore.QObject.connect(self.button_box, QtCore.SIGNAL(u'clicked(QAbstractButton*)'),
|
||||||
self.onButtonBoxClicked)
|
self.onButtonBoxClicked)
|
||||||
|
|
||||||
def onButtonBoxClicked(self, button):
|
def onButtonBoxClicked(self, button):
|
||||||
if self.buttonBox.standardButton(button) == QtGui.QDialogButtonBox.Ok:
|
if self.button_box.standardButton(button) == QtGui.QDialogButtonBox.Ok:
|
||||||
ret = QtGui.QMessageBox.question(self,
|
ret = QtGui.QMessageBox.question(self,
|
||||||
translate('SongUsagePlugin.SongUsageDeleteForm', 'Delete Selected Song Usage Events?'),
|
translate('SongUsagePlugin.SongUsageDeleteForm', 'Delete Selected Song Usage Events?'),
|
||||||
translate('SongUsagePlugin.SongUsageDeleteForm',
|
translate('SongUsagePlugin.SongUsageDeleteForm',
|
||||||
|
@ -74,8 +74,8 @@ class Ui_SongUsageDetailDialog(object):
|
|||||||
self.saveFilePushButton.setObjectName(u'saveFilePushButton')
|
self.saveFilePushButton.setObjectName(u'saveFilePushButton')
|
||||||
self.fileHorizontalLayout.addWidget(self.saveFilePushButton)
|
self.fileHorizontalLayout.addWidget(self.saveFilePushButton)
|
||||||
self.verticalLayout.addWidget(self.fileGroupBox)
|
self.verticalLayout.addWidget(self.fileGroupBox)
|
||||||
self.buttonBox = create_button_box(songUsageDetailDialog, u'buttonBox', [u'cancel', u'ok'])
|
self.button_box = create_button_box(songUsageDetailDialog, u'button_box', [u'cancel', u'ok'])
|
||||||
self.verticalLayout.addWidget(self.buttonBox)
|
self.verticalLayout.addWidget(self.button_box)
|
||||||
self.retranslateUi(songUsageDetailDialog)
|
self.retranslateUi(songUsageDetailDialog)
|
||||||
QtCore.QObject.connect(self.saveFilePushButton, QtCore.SIGNAL(u'clicked()'),
|
QtCore.QObject.connect(self.saveFilePushButton, QtCore.SIGNAL(u'clicked()'),
|
||||||
songUsageDetailDialog.defineOutputLocation)
|
songUsageDetailDialog.defineOutputLocation)
|
||||||
|
@ -13,26 +13,36 @@ class TestRegistry(TestCase):
|
|||||||
|
|
||||||
def registry_basic_test(self):
|
def registry_basic_test(self):
|
||||||
"""
|
"""
|
||||||
Test the Service Item basic test
|
Test the registry creation and its usage
|
||||||
"""
|
"""
|
||||||
# GIVEN: A new registry
|
# GIVEN: A new registry
|
||||||
registry = Registry.create()
|
registry = Registry.create()
|
||||||
|
|
||||||
# WHEN: I add a service it should save it
|
# WHEN: I add a component it should save it
|
||||||
mock_1 = MagicMock()
|
mock_1 = MagicMock()
|
||||||
Registry().register(u'test1', mock_1)
|
Registry().register(u'test1', mock_1)
|
||||||
|
|
||||||
# THEN: we should be able retrieve the saved object
|
# THEN: we should be able retrieve the saved component
|
||||||
assert Registry().get(u'test1') == mock_1, u'The saved service can be retrieved and matches'
|
assert Registry().get(u'test1') == mock_1, u'The saved service can be retrieved and matches'
|
||||||
|
|
||||||
# WHEN: I add a service for the second time I am mad.
|
# WHEN: I add a component for the second time I am mad.
|
||||||
# THEN I will get an exception
|
# THEN and I will get an exception
|
||||||
with self.assertRaises(KeyError) as context:
|
with self.assertRaises(KeyError) as context:
|
||||||
Registry().register(u'test1', mock_1)
|
Registry().register(u'test1', mock_1)
|
||||||
self.assertEqual(context.exception[0], u'Duplicate service exception test1')
|
self.assertEqual(context.exception[0], u'Duplicate service exception test1',
|
||||||
|
u'KeyError exception should have been thrown for duplicate service')
|
||||||
|
|
||||||
# WHEN I try to get back a non existent service
|
# WHEN I try to get back a non existent component
|
||||||
# THEN I will get an exception
|
# THEN I will get an exception
|
||||||
with self.assertRaises(KeyError) as context:
|
with self.assertRaises(KeyError) as context:
|
||||||
temp = Registry().get(u'test2')
|
temp = Registry().get(u'test2')
|
||||||
self.assertEqual(context.exception[0], u'Service test2 not found in list')
|
self.assertEqual(context.exception[0], u'Service test2 not found in list',
|
||||||
|
u'KeyError exception should have been thrown for missing service')
|
||||||
|
|
||||||
|
# WHEN I try to replace a component I should be allowed (testing only)
|
||||||
|
Registry().remove(u'test1')
|
||||||
|
# THEN I will get an exception
|
||||||
|
with self.assertRaises(KeyError) as context:
|
||||||
|
temp = Registry().get(u'test1')
|
||||||
|
self.assertEqual(context.exception[0], u'Service test1 not found in list',
|
||||||
|
u'KeyError exception should have been thrown for deleted service')
|
||||||
|
@ -30,10 +30,9 @@ class TestServiceItem(TestCase):
|
|||||||
"""
|
"""
|
||||||
registry = Registry.create()
|
registry = Registry.create()
|
||||||
mocked_renderer = MagicMock()
|
mocked_renderer = MagicMock()
|
||||||
mocked_image_manager = MagicMock()
|
|
||||||
mocked_renderer.format_slide.return_value = [VERSE]
|
mocked_renderer.format_slide.return_value = [VERSE]
|
||||||
Registry().register(u'renderer', mocked_renderer)
|
Registry().register(u'renderer', mocked_renderer)
|
||||||
Registry().register(u'image_manager', mocked_image_manager)
|
Registry().register(u'image_manager', MagicMock())
|
||||||
|
|
||||||
def serviceitem_basic_test(self):
|
def serviceitem_basic_test(self):
|
||||||
"""
|
"""
|
||||||
|
67
tests/functional/openlp_core_ui/test_servicenotedialog.py
Normal file
67
tests/functional/openlp_core_ui/test_servicenotedialog.py
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
"""
|
||||||
|
Package to test the openlp.core.ui package.
|
||||||
|
"""
|
||||||
|
from unittest import TestCase
|
||||||
|
|
||||||
|
from mock import patch
|
||||||
|
from openlp.core.lib import Registry
|
||||||
|
from openlp.core.ui import servicenoteform
|
||||||
|
from PyQt4 import QtCore, QtGui, QtTest
|
||||||
|
|
||||||
|
class TestStartNoteDialog(TestCase):
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
"""
|
||||||
|
Create the UI
|
||||||
|
"""
|
||||||
|
registry = Registry.create()
|
||||||
|
self.app = QtGui.QApplication([])
|
||||||
|
self.main_window = QtGui.QMainWindow()
|
||||||
|
Registry().register(u'main_window', self.main_window)
|
||||||
|
self.form = servicenoteform.ServiceNoteForm()
|
||||||
|
|
||||||
|
def tearDown(self):
|
||||||
|
"""
|
||||||
|
Delete all the C++ objects at the end so that we don't have a segfault
|
||||||
|
"""
|
||||||
|
del self.form
|
||||||
|
del self.main_window
|
||||||
|
del self.app
|
||||||
|
|
||||||
|
def basic_display_test(self):
|
||||||
|
"""
|
||||||
|
Test Service Note form functionality
|
||||||
|
"""
|
||||||
|
# GIVEN: A dialog with an empty text box
|
||||||
|
self.form.text_edit.setPlainText(u'')
|
||||||
|
|
||||||
|
# WHEN displaying the UI and pressing enter
|
||||||
|
with patch(u'PyQt4.QtGui.QDialog') as mocked_exec:
|
||||||
|
self.form.exec_()
|
||||||
|
okWidget = self.form.button_box.button(self.form.button_box.Save)
|
||||||
|
QtTest.QTest.mouseClick(okWidget, QtCore.Qt.LeftButton)
|
||||||
|
|
||||||
|
# THEN the following input text is returned
|
||||||
|
self.assertEqual(self.form.text_edit.toPlainText(), u'', u'The returned text should be empty')
|
||||||
|
|
||||||
|
# WHEN displaying the UI, having set the text and pressing enter
|
||||||
|
text = u'OpenLP is the best worship software'
|
||||||
|
self.form.text_edit.setPlainText(text)
|
||||||
|
with patch(u'PyQt4.QtGui.QDialog') as mocked_exec:
|
||||||
|
self.form.exec_()
|
||||||
|
okWidget = self.form.button_box.button(self.form.button_box.Save)
|
||||||
|
QtTest.QTest.mouseClick(okWidget, QtCore.Qt.LeftButton)
|
||||||
|
|
||||||
|
# THEN the following text is returned
|
||||||
|
self.assertEqual(self.form.text_edit.toPlainText(), text, u'The text originally entered should still be there')
|
||||||
|
|
||||||
|
# WHEN displaying the UI, having set the text and pressing enter
|
||||||
|
self.form.text_edit.setPlainText(u'')
|
||||||
|
with patch(u'PyQt4.QtGui.QDialog') as mocked_exec:
|
||||||
|
self.form.exec_()
|
||||||
|
self.form.text_edit.setPlainText(text)
|
||||||
|
okWidget = self.form.button_box.button(self.form.button_box.Save)
|
||||||
|
QtTest.QTest.mouseClick(okWidget, QtCore.Qt.LeftButton)
|
||||||
|
|
||||||
|
# THEN the following text is returned
|
||||||
|
self.assertEqual(self.form.text_edit.toPlainText(), text, u'The new text should be returned')
|
@ -5,8 +5,9 @@ import sys
|
|||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
|
|
||||||
from mock import MagicMock, patch
|
from mock import MagicMock, patch
|
||||||
|
from openlp.core.lib import Registry
|
||||||
from openlp.core.ui import starttimeform
|
from openlp.core.ui import starttimeform
|
||||||
from PyQt4 import QtGui, QtTest
|
from PyQt4 import QtCore, QtGui, QtTest
|
||||||
|
|
||||||
class TestStartTimeDialog(TestCase):
|
class TestStartTimeDialog(TestCase):
|
||||||
|
|
||||||
@ -14,52 +15,81 @@ class TestStartTimeDialog(TestCase):
|
|||||||
"""
|
"""
|
||||||
Create the UI
|
Create the UI
|
||||||
"""
|
"""
|
||||||
|
registry = Registry.create()
|
||||||
self.app = QtGui.QApplication([])
|
self.app = QtGui.QApplication([])
|
||||||
self.window = QtGui.QMainWindow()
|
self.main_window = QtGui.QMainWindow()
|
||||||
self.form = starttimeform.StartTimeForm(self.window)
|
Registry().register(u'main_window', self.main_window)
|
||||||
|
self.form = starttimeform.StartTimeForm()
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
"""
|
"""
|
||||||
Delete all the C++ objects at the end so that we don't have a segfault
|
Delete all the C++ objects at the end so that we don't have a segfault
|
||||||
"""
|
"""
|
||||||
del self.form
|
del self.form
|
||||||
del self.window
|
del self.main_window
|
||||||
del self.app
|
del self.app
|
||||||
|
|
||||||
def ui_defaults_test(self):
|
def ui_defaults_test(self):
|
||||||
"""
|
"""
|
||||||
Test StartTimeDialog defaults
|
Test StartTimeDialog are defaults correct
|
||||||
"""
|
"""
|
||||||
self.assertEqual(self.form.hourSpinBox.minimum(), 0)
|
self.assertEqual(self.form.hourSpinBox.minimum(), 0, u'The minimum hour should stay the same as the dialog')
|
||||||
self.assertEqual(self.form.hourSpinBox.maximum(), 4)
|
self.assertEqual(self.form.hourSpinBox.maximum(), 4, u'The maximum hour should stay the same as the dialog')
|
||||||
self.assertEqual(self.form.minuteSpinBox.minimum(), 0)
|
self.assertEqual(self.form.minuteSpinBox.minimum(), 0,
|
||||||
self.assertEqual(self.form.minuteSpinBox.maximum(), 59)
|
u'The minimum minute should stay the same as the dialog')
|
||||||
self.assertEqual(self.form.secondSpinBox.minimum(), 0)
|
self.assertEqual(self.form.minuteSpinBox.maximum(), 59,
|
||||||
self.assertEqual(self.form.secondSpinBox.maximum(), 59)
|
u'The maximum minute should stay the same as the dialog')
|
||||||
self.assertEqual(self.form.hourFinishSpinBox.minimum(), 0)
|
self.assertEqual(self.form.secondSpinBox.minimum(), 0,
|
||||||
self.assertEqual(self.form.hourFinishSpinBox.maximum(), 4)
|
u'The minimum second should stay the same as the dialog')
|
||||||
self.assertEqual(self.form.minuteFinishSpinBox.minimum(), 0)
|
self.assertEqual(self.form.secondSpinBox.maximum(), 59,
|
||||||
self.assertEqual(self.form.minuteFinishSpinBox.maximum(), 59)
|
u'The maximum second should stay the same as the dialog')
|
||||||
self.assertEqual(self.form.secondFinishSpinBox.minimum(), 0)
|
self.assertEqual(self.form.hourFinishSpinBox.minimum(), 0,
|
||||||
self.assertEqual(self.form.secondFinishSpinBox.maximum(), 59)
|
u'The minimum finish hour should stay the same as the dialog')
|
||||||
|
self.assertEqual(self.form.hourFinishSpinBox.maximum(), 4,
|
||||||
|
u'The maximum finish hour should stay the same as the dialog')
|
||||||
|
self.assertEqual(self.form.minuteFinishSpinBox.minimum(), 0,
|
||||||
|
u'The minimum finish minute should stay the same as the dialog')
|
||||||
|
self.assertEqual(self.form.minuteFinishSpinBox.maximum(), 59,
|
||||||
|
u'The maximum finish minute should stay the same as the dialog')
|
||||||
|
self.assertEqual(self.form.secondFinishSpinBox.minimum(), 0,
|
||||||
|
u'The minimum finish second should stay the same as the dialog')
|
||||||
|
self.assertEqual(self.form.secondFinishSpinBox.maximum(), 59,
|
||||||
|
u'The maximum finish second should stay the same as the dialog')
|
||||||
|
|
||||||
def time_display_test(self):
|
def time_display_test(self):
|
||||||
"""
|
"""
|
||||||
Test StartTimeDialog display initialisation
|
Test StartTimeDialog display functionality
|
||||||
"""
|
"""
|
||||||
# GIVEN: A service item with with time
|
# GIVEN: A service item with with time
|
||||||
mocked_serviceitem = MagicMock()
|
mocked_serviceitem = MagicMock()
|
||||||
mocked_serviceitem.start_time = 61
|
mocked_serviceitem.start_time = 61
|
||||||
mocked_serviceitem.end_time = 3701
|
mocked_serviceitem.end_time = 3701
|
||||||
|
mocked_serviceitem.media_length = 3701
|
||||||
|
|
||||||
# WHEN displaying the UI and pressing enter
|
# WHEN displaying the UI and pressing enter
|
||||||
self.form.item = mocked_serviceitem
|
self.form.item = {u'service_item': mocked_serviceitem}
|
||||||
with patch(u'openlp.core.lib.QtGui.QDialog') as MockedQtGuiQDialog:
|
with patch(u'PyQt4.QtGui.QDialog') as mocked_exec:
|
||||||
MockedQtGuiQDialog.return_value = True
|
self.form.exec_()
|
||||||
#does not work yet
|
okWidget = self.form.button_box.button(self.form.button_box.Ok)
|
||||||
#self.form.exec_()
|
QtTest.QTest.mouseClick(okWidget, QtCore.Qt.LeftButton)
|
||||||
|
|
||||||
|
# THEN the following input values are returned
|
||||||
|
self.assertEqual(self.form.hourSpinBox.value(), 0)
|
||||||
|
self.assertEqual(self.form.minuteSpinBox.value(), 1)
|
||||||
|
self.assertEqual(self.form.secondSpinBox.value(), 1)
|
||||||
|
self.assertEqual(self.form.item[u'service_item'].start_time, 61, u'The start time should stay the same')
|
||||||
|
|
||||||
|
# WHEN displaying the UI, changing the time to 2min 3secs and pressing enter
|
||||||
|
self.form.item = {u'service_item': mocked_serviceitem}
|
||||||
|
with patch(u'PyQt4.QtGui.QDialog') as mocked_exec:
|
||||||
|
self.form.exec_()
|
||||||
|
self.form.minuteSpinBox.setValue(2)
|
||||||
|
self.form.secondSpinBox.setValue(3)
|
||||||
|
okWidget = self.form.button_box.button(self.form.button_box.Ok)
|
||||||
|
QtTest.QTest.mouseClick(okWidget, QtCore.Qt.LeftButton)
|
||||||
|
|
||||||
# THEN the following values are returned
|
# THEN the following values are returned
|
||||||
self.assertEqual(self.form.hourSpinBox.value(), 0)
|
self.assertEqual(self.form.hourSpinBox.value(), 0)
|
||||||
self.assertEqual(self.form.minuteSpinBox.value(), 0)
|
self.assertEqual(self.form.minuteSpinBox.value(), 2)
|
||||||
self.assertEqual(self.form.secondSpinBox.value(), 0)
|
self.assertEqual(self.form.secondSpinBox.value(), 3)
|
||||||
|
self.assertEqual(self.form.item[u'service_item'].start_time, 123, u'The start time should have changed')
|
Loading…
Reference in New Issue
Block a user