Merge HEAD

This commit is contained in:
Arjan Schrijver 2013-02-01 13:01:24 +01:00
commit 3f4df4f22c
61 changed files with 1233 additions and 968 deletions

View File

@ -121,11 +121,15 @@ class OpenLP(QtGui.QApplication):
if FirstTimeForm(screens).exec_() == QtGui.QDialog.Accepted:
Settings().setValue(u'general/has run wizard', True)
# Correct stylesheet bugs
if os.name == u'nt':
application_stylesheet = u''
if not Settings().value(u'advanced/alternate rows'):
base_color = self.palette().color(QtGui.QPalette.Active, QtGui.QPalette.Base)
application_stylesheet = \
alternate_rows_repair_stylesheet = \
u'QTableWidget, QListWidget, QTreeWidget {alternate-background-color: ' + base_color.name() + ';}\n'
application_stylesheet += alternate_rows_repair_stylesheet
if os.name == u'nt':
application_stylesheet += nt_repair_stylesheet
if application_stylesheet:
self.setStyleSheet(application_stylesheet)
show_splash = Settings().value(u'general/show splash')
if show_splash:

View File

@ -200,12 +200,6 @@ class EventReceiver(QtCore.QObject):
``{plugin}_unblank``
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``
Tells the the plugin to reload the media manager list.

View File

@ -100,7 +100,7 @@ class MediaManagerItem(QtGui.QWidget):
self.plugin = plugin
visible_title = self.plugin.getString(StringContent.VisibleName)
self.title = unicode(visible_title[u'title'])
Registry().register(self.title, self)
Registry().register(self.plugin.name, self)
self.settingsSection = self.plugin.name
self.icon = None
if icon:
@ -443,8 +443,8 @@ class MediaManagerItem(QtGui.QWidget):
"""
pass
def generateSlideData(self, serviceItem, item=None, xmlVersion=False,
remote=False, context=ServiceItemContext.Live):
def generateSlideData(self, serviceItem, item=None, xmlVersion=False, remote=False,
context=ServiceItemContext.Live):
raise NotImplementedError(u'MediaManagerItem.generateSlideData needs to be defined by the plugin')
def onDoubleClicked(self):
@ -477,7 +477,7 @@ class MediaManagerItem(QtGui.QWidget):
serviceItem = self.buildServiceItem()
if serviceItem:
serviceItem.from_plugin = True
self.preview_controller.addServiceItem(serviceItem)
self.preview_controller.add_service_item(serviceItem)
if keepFocus:
self.listView.setFocus()
@ -503,7 +503,7 @@ class MediaManagerItem(QtGui.QWidget):
serviceItem.from_plugin = True
if remote:
serviceItem.will_auto_start = True
self.live_controller.addServiceItem(serviceItem)
self.live_controller.add_service_item(serviceItem)
def createItemFromId(self, item_id):
item = QtGui.QTreeWidgetItem()
@ -514,13 +514,13 @@ class MediaManagerItem(QtGui.QWidget):
"""
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,
translate('OpenLP.MediaManagerItem', 'You must select one or more items to add.'))
else:
# Is it possible to process multiple list items to generate
# multiple service items?
if self.singleServiceItem or self.remoteTriggered:
if self.singleServiceItem:
log.debug(u'%s Add requested', self.plugin.name)
self.addToService(replace=self.remoteTriggered)
else:
@ -532,7 +532,7 @@ class MediaManagerItem(QtGui.QWidget):
serviceItem = self.buildServiceItem(item, True, remote=remote, context=ServiceItemContext.Service)
if serviceItem:
serviceItem.from_plugin = False
self.service_manager.addServiceItem(serviceItem, replace=replace)
self.service_manager.add_service_item(serviceItem, replace=replace)
def onAddEditClick(self):
"""
@ -543,13 +543,13 @@ class MediaManagerItem(QtGui.QWidget):
translate('OpenLP.MediaManagerItem', 'You must select one or more items.'))
else:
log.debug(u'%s Add requested', self.plugin.name)
serviceItem = self.plugin.serviceManager.getServiceItem()
serviceItem = self.service_manager.get_service_item()
if not serviceItem:
QtGui.QMessageBox.information(self, UiStrings().NISs,
translate('OpenLP.MediaManagerItem', 'You must select an existing service item to add to.'))
elif self.plugin.name == serviceItem.name:
self.generateSlideData(serviceItem)
self.service_manager.addServiceItem(serviceItem, replace=True)
self.service_manager.add_service_item(serviceItem, replace=True)
else:
# Turn off the remote edit update message indicator
QtGui.QMessageBox.information(self, translate('OpenLP.MediaManagerItem', 'Invalid Service Item'),
@ -561,8 +561,7 @@ class MediaManagerItem(QtGui.QWidget):
"""
serviceItem = ServiceItem(self.plugin)
serviceItem.add_icon(self.plugin.iconPath)
if self.generateSlideData(serviceItem, item, xmlVersion, remote,
context):
if self.generateSlideData(serviceItem, item, xmlVersion, remote, context):
return serviceItem
else:
return None
@ -689,7 +688,7 @@ class MediaManagerItem(QtGui.QWidget):
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'):
self._service_manager = Registry().get(u'service_manager')

View File

@ -30,6 +30,7 @@
Provide Registry Services
"""
import logging
import sys
log = logging.getLogger(__name__)
@ -54,8 +55,13 @@ class Registry(object):
log.info(u'Registry Initialising')
registry = cls()
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
def get(self, key):
"""
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)
else:
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]

View File

@ -87,6 +87,7 @@ class Settings(QtCore.QSettings):
"""
__default_settings__ = {
u'advanced/x11 bypass wm': X11_BYPASS_DEFAULT,
u'advanced/alternate rows': not sys.platform.startswith(u'win'),
u'advanced/default service enabled': True,
u'advanced/enable exit confirmation': True,
u'advanced/save current plugin': False,
@ -98,6 +99,7 @@ class Settings(QtCore.QSettings):
u'advanced/hide mouse': True,
u'advanced/current media plugin': -1,
u'advanced/double click live': False,
u'advanced/data path': u'',
u'advanced/default service hour': 11,
u'advanced/default color': u'#ffffff',
u'advanced/default image': u':/graphics/openlp-splash-screen.png',
@ -140,7 +142,6 @@ class Settings(QtCore.QSettings):
u'general/blank warning': False,
u'players/background color': u'#000000',
u'servicemanager/service theme': u'',
u'servicemanager/last directory': u'',
u'servicemanager/last file': u'',
u'SettingsImport/Make_Changes': u'At_Own_RISK',
u'SettingsImport/type': u'OpenLP_settings_export',
@ -165,7 +166,7 @@ class Settings(QtCore.QSettings):
u'shortcuts/importBibleItem': [],
u'shortcuts/modeDefaultItem': [],
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/moveTop': [QtCore.Qt.Key_Home],
u'shortcuts/modeSetupItem': [],
@ -227,7 +228,10 @@ class Settings(QtCore.QSettings):
u'user interface/live splitter geometry': QtCore.QByteArray(),
u'user interface/main window state': QtCore.QByteArray(),
u'media/players': u'webkit',
u'media/override player': QtCore.Qt.Unchecked
u'media/override player': QtCore.Qt.Unchecked,
# Old settings (not used anymore). Have to be here, so that old setting.config backups can be imported.
u'advanced/stylesheet fix': u'',
u'servicemanager/last directory': u''
}
__file_path__ = u''
__obsolete_settings__ = [
@ -238,7 +242,10 @@ class Settings(QtCore.QSettings):
(u'servicemanager/last directory', u'', []),
(u'songs/last directory 1', u'songs/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'media/background color', u'players/background color', [])
]
@staticmethod

View File

@ -74,8 +74,8 @@ class Ui_AboutDialog(object):
self.aboutNotebook.addTab(self.licenseTab, u'')
self.aboutDialogLayout.addWidget(self.aboutNotebook)
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.aboutDialogLayout.addWidget(self.buttonBox)
self.button_box = create_button_box(aboutDialog, u'button_box', [u'close'], [self.volunteerButton])
self.aboutDialogLayout.addWidget(self.button_box)
self.retranslateUi(aboutDialog)
self.aboutNotebook.setCurrentIndex(0)

View File

@ -229,14 +229,18 @@ class AdvancedTab(SettingsTab):
self.nextItemRadioButton.setObjectName(u'nextItemRadioButton')
self.slideLayout.addWidget(self.nextItemRadioButton)
self.rightLayout.addWidget(self.slideGroupBox)
self.x11GroupBox = QtGui.QGroupBox(self.leftColumn)
self.x11GroupBox.setObjectName(u'x11GroupBox')
self.x11Layout = QtGui.QVBoxLayout(self.x11GroupBox)
self.x11Layout.setObjectName(u'x11Layout')
self.x11BypassCheckBox = QtGui.QCheckBox(self.x11GroupBox)
# Display Workarounds
self.displayWorkaroundGroupBox = QtGui.QGroupBox(self.leftColumn)
self.displayWorkaroundGroupBox.setObjectName(u'displayWorkaroundGroupBox')
self.displayWorkaroundLayout = QtGui.QVBoxLayout(self.displayWorkaroundGroupBox)
self.displayWorkaroundLayout.setObjectName(u'displayWorkaroundLayout')
self.x11BypassCheckBox = QtGui.QCheckBox(self.displayWorkaroundGroupBox)
self.x11BypassCheckBox.setObjectName(u'x11BypassCheckBox')
self.x11Layout.addWidget(self.x11BypassCheckBox)
self.rightLayout.addWidget(self.x11GroupBox)
self.displayWorkaroundLayout.addWidget(self.x11BypassCheckBox)
self.alternateRowsCheckBox = QtGui.QCheckBox(self.displayWorkaroundGroupBox)
self.alternateRowsCheckBox.setObjectName(u'alternateRowsCheckBox')
self.displayWorkaroundLayout.addWidget(self.alternateRowsCheckBox)
self.rightLayout.addWidget(self.displayWorkaroundGroupBox)
self.rightLayout.addStretch()
self.shouldUpdateServiceNameExample = False
QtCore.QObject.connect(self.serviceNameCheckBox, QtCore.SIGNAL(u'toggled(bool)'),
@ -253,6 +257,8 @@ class AdvancedTab(SettingsTab):
QtCore.QObject.connect(self.defaultBrowseButton, QtCore.SIGNAL(u'clicked()'), self.onDefaultBrowseButtonClicked)
QtCore.QObject.connect(self.defaultRevertButton, QtCore.SIGNAL(u'clicked()'), self.onDefaultRevertButtonClicked)
QtCore.QObject.connect(self.x11BypassCheckBox, QtCore.SIGNAL(u'toggled(bool)'), self.onX11BypassCheckBoxToggled)
QtCore.QObject.connect(self.alternateRowsCheckBox,
QtCore.SIGNAL(u'toggled(bool)'), self.onAlternateRowsCheckBoxToggled)
QtCore.QObject.connect(self.dataDirectoryBrowseButton, QtCore.SIGNAL(u'clicked()'),
self.onDataDirectoryBrowseButtonClicked)
QtCore.QObject.connect(self.dataDirectoryDefaultButton, QtCore.SIGNAL(u'clicked()'),
@ -260,7 +266,7 @@ class AdvancedTab(SettingsTab):
QtCore.QObject.connect(self.dataDirectoryCancelButton, QtCore.SIGNAL(u'clicked()'),
self.onDataDirectoryCancelButtonClicked)
QtCore.QObject.connect(self.dataDirectoryCopyCheckBox, QtCore.SIGNAL(u'toggled(bool)'),
self.onDataDirectoryCopyCheckBoxToggled)
self.onDataDirectoryCopyCheckBoxToggled)
QtCore.QObject.connect(self.endSlideRadioButton, QtCore.SIGNAL(u'clicked()'), self.onEndSlideButtonClicked)
QtCore.QObject.connect(self.wrapSlideRadioButton, QtCore.SIGNAL(u'clicked()'), self.onWrapSlideButtonClicked)
QtCore.QObject.connect(self.nextItemRadioButton, QtCore.SIGNAL(u'clicked()'), self.onnextItemButtonClicked)
@ -323,8 +329,9 @@ class AdvancedTab(SettingsTab):
self.newDataDirectoryHasFilesLabel.setText(
translate('OpenLP.AdvancedTab', '<strong>WARNING:</strong> New data directory location contains '
'OpenLP data files. These files WILL be replaced during a copy.'))
self.x11GroupBox.setTitle(translate('OpenLP.AdvancedTab', 'X11'))
self.displayWorkaroundGroupBox.setTitle(translate('OpenLP.AdvancedTab', 'Display Workarounds'))
self.x11BypassCheckBox.setText(translate('OpenLP.AdvancedTab','Bypass X11 Window Manager'))
self.alternateRowsCheckBox.setText(translate('OpenLP.AdvancedTab', 'Use alternating row colours in lists'))
# Slide Limits
self.slideGroupBox.setTitle(translate('OpenLP.GeneralTab', 'Service Item Slide Limits'))
self.slideLabel.setText(translate('OpenLP.GeneralTab', 'Behavior of next/previous on the last/first slide:'))
@ -361,6 +368,10 @@ class AdvancedTab(SettingsTab):
self.defaultColor = settings.value(u'default color')
self.defaultFileEdit.setText(settings.value(u'default image'))
self.slide_limits = settings.value(u'slide limits')
# Prevent the dialog displayed by the alternateRowsCheckBox to display.
self.alternateRowsCheckBox.blockSignals(True)
self.alternateRowsCheckBox.setChecked(settings.value(u'alternate rows'))
self.alternateRowsCheckBox.blockSignals(False)
if self.slide_limits == SlideLimits.End:
self.endSlideRadioButton.setChecked(True)
elif self.slide_limits == SlideLimits.Wrap:
@ -430,6 +441,7 @@ class AdvancedTab(SettingsTab):
settings.setValue(u'enable exit confirmation', self.enableAutoCloseCheckBox.isChecked())
settings.setValue(u'hide mouse', self.hideMouseCheckBox.isChecked())
settings.setValue(u'x11 bypass wm', self.x11BypassCheckBox.isChecked())
settings.setValue(u'alternate rows', self.alternateRowsCheckBox.isChecked())
settings.setValue(u'default color', self.defaultColor)
settings.setValue(u'default image', self.defaultFileEdit.text())
settings.setValue(u'slide limits', self.slide_limits)
@ -613,6 +625,17 @@ class AdvancedTab(SettingsTab):
The state of the check box (boolean).
"""
self.displayChanged = True
def onAlternateRowsCheckBoxToggled(self, checked):
"""
Notify user about required restart.
``checked``
The state of the check box (boolean).
"""
QtGui.QMessageBox.information(self,
translate('OpenLP.AdvancedTab', 'Restart Required'),
translate('OpenLP.AdvancedTab', 'This change will only take effect once OpenLP has been restarted.'))
def onEndSlideButtonClicked(self):
self.slide_limits = SlideLimits.End

View File

@ -70,9 +70,9 @@ class Ui_ExceptionDialog(object):
icon=u':/general/general_save.png', click=self.onSaveReportButtonClicked)
self.attachFileButton = create_button(exceptionDialog, u'attachFileButton',
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])
self.exceptionLayout.addWidget(self.buttonBox)
self.exceptionLayout.addWidget(self.button_box)
self.retranslateUi(exceptionDialog)
QtCore.QObject.connect(self.descriptionTextEdit,

View File

@ -37,7 +37,7 @@ class Ui_FileRenameDialog(object):
fileRenameDialog.setObjectName(u'fileRenameDialog')
fileRenameDialog.resize(300, 10)
self.dialogLayout = QtGui.QGridLayout(fileRenameDialog)
self.dialogLayout.setObjectName(u'dialogLayout')
self.dialogLayout.setObjectName(u'dialog_layout')
self.fileNameLabel = QtGui.QLabel(fileRenameDialog)
self.fileNameLabel.setObjectName(u'fileNameLabel')
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.setObjectName(u'fileNameEdit')
self.dialogLayout.addWidget(self.fileNameEdit, 0, 1)
self.buttonBox = create_button_box(fileRenameDialog, u'buttonBox', [u'cancel', u'ok'])
self.dialogLayout.addWidget(self.buttonBox, 1, 0, 1, 2)
self.button_box = create_button_box(fileRenameDialog, u'button_box', [u'cancel', u'ok'])
self.dialogLayout.addWidget(self.button_box, 1, 0, 1, 2)
self.retranslateUi(fileRenameDialog)
self.setMaximumHeight(self.sizeHint().height())

View File

@ -39,7 +39,7 @@ class Ui_FirstTimeLanguageDialog(object):
self.dialogLayout = QtGui.QVBoxLayout(languageDialog)
self.dialogLayout.setContentsMargins(8, 8, 8, 8)
self.dialogLayout.setSpacing(8)
self.dialogLayout.setObjectName(u'dialogLayout')
self.dialogLayout.setObjectName(u'dialog_layout')
self.infoLabel = QtGui.QLabel(languageDialog)
self.infoLabel.setObjectName(u'infoLabel')
self.dialogLayout.addWidget(self.infoLabel)
@ -53,8 +53,8 @@ class Ui_FirstTimeLanguageDialog(object):
self.languageComboBox.setObjectName("languageComboBox")
self.languageLayout.addWidget(self.languageComboBox)
self.dialogLayout.addLayout(self.languageLayout)
self.buttonBox = create_button_box(languageDialog, u'buttonBox', [u'cancel', u'ok'])
self.dialogLayout.addWidget(self.buttonBox)
self.button_box = create_button_box(languageDialog, u'button_box', [u'cancel', u'ok'])
self.dialogLayout.addWidget(self.button_box)
self.retranslateUi(languageDialog)
self.setMaximumHeight(self.sizeHint().height())

View File

@ -110,8 +110,8 @@ class Ui_FormattingTagDialog(object):
self.savePushButton.setObjectName(u'savePushButton')
self.dataGridLayout.addWidget(self.savePushButton, 4, 2, 1, 1)
self.listdataGridLayout.addWidget(self.editGroupBox, 2, 0, 1, 1)
self.buttonBox = create_button_box(formattingTagDialog, u'buttonBox', [u'close'])
self.listdataGridLayout.addWidget(self.buttonBox, 3, 0, 1, 1)
self.button_box = create_button_box(formattingTagDialog, u'button_box', [u'close'])
self.listdataGridLayout.addWidget(self.button_box, 3, 0, 1, 1)
self.retranslateUi(formattingTagDialog)

View File

@ -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.savePushButton, QtCore.SIGNAL(u'clicked()'), self.onSavedClicked)
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.tagLineEdit, QtCore.SIGNAL(u'textEdited(QString)'), self.onTextEdited)
QtCore.QObject.connect(self.startTagLineEdit, QtCore.SIGNAL(u'textEdited(QString)'), self.onTextEdited)

View File

@ -174,25 +174,25 @@ class Ui_MainWindow(object):
icon=u':/general/general_new.png',
shortcuts=[QtGui.QKeySequence(u'Ctrl+N')],
category=UiStrings().File,
triggers=self.serviceManagerContents.onNewServiceClicked)
triggers=self.serviceManagerContents.on_new_service_clicked)
self.fileOpenItem = create_action(mainWindow, u'fileOpenItem',
icon=u':/general/general_open.png',
shortcuts=[QtGui.QKeySequence(u'Ctrl+O')],
category=UiStrings().File,
triggers=self.serviceManagerContents.onLoadServiceClicked)
triggers=self.serviceManagerContents.on_load_service_clicked)
self.fileSaveItem = create_action(mainWindow, u'fileSaveItem',
icon=u':/general/general_save.png',
shortcuts=[QtGui.QKeySequence(u'Ctrl+S')],
category=UiStrings().File,
triggers=self.serviceManagerContents.saveFile)
triggers=self.serviceManagerContents.save_file)
self.fileSaveAsItem = create_action(mainWindow, u'fileSaveAsItem',
shortcuts=[QtGui.QKeySequence(u'Ctrl+Shift+S')],
category=UiStrings().File,
triggers=self.serviceManagerContents.saveFileAs)
triggers=self.serviceManagerContents.save_file_as)
self.printServiceOrderItem = create_action(mainWindow,
u'printServiceItem', shortcuts=[QtGui.QKeySequence(u'Ctrl+P')],
category=UiStrings().File,
triggers=self.serviceManagerContents.printServiceOrder)
triggers=self.serviceManagerContents.print_service_order)
self.fileExitItem = create_action(mainWindow, u'fileExitItem',
icon=u':/system/system_exit.png',
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'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'cleanup'), self.cleanUp)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'cleanup'), self.clean_up)
# Media Manager
QtCore.QObject.connect(self.mediaToolBox, QtCore.SIGNAL(u'currentChanged(int)'), self.onMediaToolBoxChanged)
Receiver.send_message(u'cursor_busy')
@ -618,9 +618,9 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
filename = args[0]
if not isinstance(filename, unicode):
filename = unicode(filename, sys.getfilesystemencoding())
self.serviceManagerContents.loadFile(filename)
self.serviceManagerContents.load_file(filename)
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)
if view_mode == u'default':
self.modeDefaultItem.setChecked(True)
@ -866,7 +866,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
'be applied the next time you start OpenLP.'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
self.settingsImported = True
self.cleanUp()
self.clean_up()
QtCore.QCoreApplication.exit()
def onSettingsExportItemClicked(self):
@ -921,7 +921,8 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
# Write all the sections and keys.
for section_key in keys:
# FIXME: We are conflicting with the standard "General" section.
section_key = section_key.lower()
if u'eneral' in section_key:
section_key = section_key.lower()
key_value = settings.value(section_key)
if key_value is not None:
export_settings.setValue(section_key, key_value)
@ -939,7 +940,6 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
temp_conf.close()
export_conf.close()
os.remove(temp_file)
return
def onModeDefaultItemClicked(self):
"""
@ -999,18 +999,18 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
return
# If we just did a settings import, close without saving changes.
if self.settingsImported:
self.cleanUp(False)
self.clean_up(False)
event.accept()
if self.serviceManagerContents.isModified():
ret = self.serviceManagerContents.saveModifiedService()
if self.serviceManagerContents.is_modified():
ret = self.serviceManagerContents.save_modified_service()
if ret == QtGui.QMessageBox.Save:
if self.serviceManagerContents.decideSaveMethod():
self.cleanUp()
if self.serviceManagerContents.decide_save_method():
self.clean_up()
event.accept()
else:
event.ignore()
elif ret == QtGui.QMessageBox.Discard:
self.cleanUp()
self.clean_up()
event.accept()
else:
event.ignore()
@ -1021,15 +1021,15 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes | QtGui.QMessageBox.No),
QtGui.QMessageBox.Yes)
if ret == QtGui.QMessageBox.Yes:
self.cleanUp()
self.clean_up()
event.accept()
else:
event.ignore()
else:
self.cleanUp()
self.clean_up()
event.accept()
def cleanUp(self, save_settings=True):
def clean_up(self, save_settings=True):
"""
Runs all the cleanup code before OpenLP shuts down.
@ -1223,7 +1223,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
action = create_action(self, u'',
text=u'&%d %s' % (fileId + 1, os.path.splitext(os.path.basename(
unicode(filename)))[0]), data=filename,
triggers=self.serviceManagerContents.onRecentServiceClicked)
triggers=self.serviceManagerContents.on_recent_service_clicked)
self.recentFilesMenu.addAction(action)
clearRecentFilesAction = create_action(self, u'',
text=translate('OpenLP.MainWindow', 'Clear List', 'Clear List of recent files'),

View File

@ -131,14 +131,14 @@ class MediaController(object):
for item in player.audio_extensions_list:
if not item in self.audio_extensions_list:
self.audio_extensions_list.append(item)
self.service_manager.supportedSuffixes(item[2:])
self.service_manager.supported_suffixes(item[2:])
self.video_extensions_list = []
for player in self.mediaPlayers.values():
if player.isActive:
for item in player.video_extensions_list:
if item not in self.video_extensions_list:
self.video_extensions_list.extend(item)
self.service_manager.supportedSuffixes(item[2:])
self.service_manager.supported_suffixes(item[2:])
def register_players(self, player):
"""

View File

@ -194,7 +194,7 @@ class PlayerTab(SettingsTab):
set_media_players(self.usedPlayers, override_player)
player_string_changed = True
if player_string_changed:
self.parent.resetSupportedSuffixes()
self.parent.reset_supported_suffixes()
Receiver.send_message(u'mediaitem_media_rebuild')
Receiver.send_message(u'config_screen_changed')

View File

@ -67,8 +67,8 @@ class Ui_PluginViewDialog(object):
self.pluginInfoLayout.addRow(self.aboutLabel, self.aboutTextBrowser)
self.listLayout.addWidget(self.pluginInfoGroupBox)
self.pluginLayout.addLayout(self.listLayout)
self.buttonBox = create_button_box(pluginViewDialog, u'buttonBox', [u'ok'])
self.pluginLayout.addWidget(self.buttonBox)
self.button_box = create_button_box(pluginViewDialog, u'button_box', [u'ok'])
self.pluginLayout.addWidget(self.button_box)
self.retranslateUi(pluginViewDialog)
def retranslateUi(self, pluginViewDialog):

View File

@ -33,7 +33,7 @@ import os
from PyQt4 import QtCore, QtGui
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.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):
def __init__(self, mainWindow, serviceManager):
def __init__(self):
"""
Constructor
"""
QtGui.QDialog.__init__(self, mainWindow)
self.mainWindow = mainWindow
self.serviceManager = serviceManager
QtGui.QDialog.__init__(self, self.main_window)
self.printer = QtGui.QPrinter()
self.printDialog = QtGui.QPrintDialog(self.printer, self)
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.plainCopy, QtCore.SIGNAL(u'triggered()'), self.copyText)
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()
def toggleOptions(self, checked):
@ -170,7 +169,7 @@ class PrintServiceForm(QtGui.QDialog, Ui_PrintServiceDialog):
self._addElement(u'body', parent=html_data)
self._addElement(u'h1', cgi.escape(self.titleLineEdit.text()),
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)
# Add the custom service notes:
if self.footerTextEdit.toPlainText():
@ -319,14 +318,14 @@ class PrintServiceForm(QtGui.QDialog, Ui_PrintServiceDialog):
# remove the icon from the text
clipboard_text = clipboard_text.replace(u'\ufffc\xa0', u'')
# and put it all on the clipboard
self.mainWindow.clipboard.setText(clipboard_text)
self.main_window.clipboard.setText(clipboard_text)
def copyHtmlText(self):
"""
Copies the display text to the clipboard as Html
"""
self.update_song_usage()
self.mainWindow.clipboard.setText(self.document.toHtml())
self.main_window.clipboard.setText(self.document.toHtml())
def printServiceOrder(self):
"""
@ -392,6 +391,26 @@ class PrintServiceForm(QtGui.QDialog, Ui_PrintServiceDialog):
# Only continue when we include the song's text.
if not self.slideTextCheckBox.isChecked():
return
for item in self.serviceManager.serviceItems:
for item in self.service_manager.serviceItems:
# Trigger Audit requests
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)

View File

@ -35,29 +35,29 @@ from openlp.core.lib.ui import create_button_box, create_button
class Ui_ServiceItemEditDialog(object):
def setupUi(self, serviceItemEditDialog):
serviceItemEditDialog.setObjectName(u'serviceItemEditDialog')
self.dialogLayout = QtGui.QGridLayout(serviceItemEditDialog)
self.dialogLayout.setContentsMargins(8, 8, 8, 8)
self.dialogLayout.setSpacing(8)
self.dialogLayout.setObjectName(u'dialogLayout')
self.listWidget = QtGui.QListWidget(serviceItemEditDialog)
self.listWidget.setAlternatingRowColors(True)
self.listWidget.setObjectName(u'listWidget')
self.dialogLayout.addWidget(self.listWidget, 0, 0)
self.buttonLayout = QtGui.QVBoxLayout()
self.buttonLayout.setObjectName(u'buttonLayout')
self.deleteButton = create_button(serviceItemEditDialog, u'deleteButton', role=u'delete',
click=serviceItemEditDialog.onDeleteButtonClicked)
self.buttonLayout.addWidget(self.deleteButton)
self.buttonLayout.addStretch()
self.upButton = create_button(serviceItemEditDialog, u'upButton', role=u'up',
click=serviceItemEditDialog.onUpButtonClicked)
self.downButton = create_button(serviceItemEditDialog, u'downButton', role=u'down',
click=serviceItemEditDialog.onDownButtonClicked)
self.buttonLayout.addWidget(self.upButton)
self.buttonLayout.addWidget(self.downButton)
self.dialogLayout.addLayout(self.buttonLayout, 0, 1)
self.buttonBox = create_button_box(serviceItemEditDialog, u'buttonBox', [u'cancel', u'save'])
self.dialogLayout.addWidget(self.buttonBox, 1, 0, 1, 2)
self.dialog_layout = QtGui.QGridLayout(serviceItemEditDialog)
self.dialog_layout.setContentsMargins(8, 8, 8, 8)
self.dialog_layout.setSpacing(8)
self.dialog_layout.setObjectName(u'dialog_layout')
self.list_widget = QtGui.QListWidget(serviceItemEditDialog)
self.list_widget.setAlternatingRowColors(True)
self.list_widget.setObjectName(u'list_widget')
self.dialog_layout.addWidget(self.list_widget, 0, 0)
self.button_layout = QtGui.QVBoxLayout()
self.button_layout.setObjectName(u'button_layout')
self.delete_button = create_button(serviceItemEditDialog, u'deleteButton', role=u'delete',
click=serviceItemEditDialog.on_delete_button_clicked)
self.button_layout.addWidget(self.delete_button)
self.button_layout.addStretch()
self.up_button = create_button(serviceItemEditDialog, u'upButton', role=u'up',
click=serviceItemEditDialog.on_up_button_clicked)
self.down_button = create_button(serviceItemEditDialog, u'downButton', role=u'down',
click=serviceItemEditDialog.on_down_button_clicked)
self.button_layout.addWidget(self.up_button)
self.button_layout.addWidget(self.down_button)
self.dialog_layout.addLayout(self.button_layout, 0, 1)
self.button_box = create_button_box(serviceItemEditDialog, u'button_box', [u'cancel', u'save'])
self.dialog_layout.addWidget(self.button_box, 1, 0, 1, 2)
self.retranslateUi(serviceItemEditDialog)
def retranslateUi(self, serviceItemEditDialog):

View File

@ -28,6 +28,7 @@
###############################################################################
from PyQt4 import QtCore, QtGui
from openlp.core.lib import Registry
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.
"""
def __init__(self, parent=None):
def __init__(self):
"""
Constructor
"""
QtGui.QDialog.__init__(self, parent)
QtGui.QDialog.__init__(self, self.main_window)
self.setupUi(self)
self.itemList = []
QtCore.QObject.connect(self.listWidget, QtCore.SIGNAL(u'currentRowChanged(int)'), self.onCurrentRowChanged)
self.item_list = []
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.itemList = []
self.item_list = []
if self.item.is_image():
self.data = True
for frame in self.item._raw_frames:
self.itemList.append(frame)
self.loadData()
self.listWidget.setCurrentItem(self.listWidget.currentItem())
self.item_list.append(frame)
self.load_data()
self.list_widget.setCurrentItem(self.list_widget.currentItem())
def getServiceItem(self):
def get_service_item(self):
if self.data:
self.item._raw_frames = []
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.render()
return self.item
def loadData(self):
def load_data(self):
"""
Loads the image list.
"""
self.listWidget.clear()
for frame in self.itemList:
self.list_widget.clear()
for frame in self.item_list:
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.
"""
item = self.listWidget.currentItem()
item = self.list_widget.currentItem()
if not item:
return
row = self.listWidget.row(item)
self.itemList.pop(row)
self.loadData()
if row == self.listWidget.count():
self.listWidget.setCurrentRow(row - 1)
row = self.list_widget.row(item)
self.item_list.pop(row)
self.load_data()
if row == self.list_widget.count():
self.list_widget.setCurrentRow(row - 1)
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.
"""
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
"""
self.__moveItem(u'down')
self.__move_item(u'down')
def __moveItem(self, direction=u''):
def __move_item(self, direction=u''):
"""
Move the current item.
"""
if not direction:
return
item = self.listWidget.currentItem()
item = self.list_widget.currentItem()
if not item:
return
row = self.listWidget.row(item)
temp = self.itemList[row]
self.itemList.pop(row)
row = self.list_widget.row(item)
temp = self.item_list[row]
self.item_list.pop(row)
if direction == u'up':
row -= 1
else:
row += 1
self.itemList.insert(row, temp)
self.loadData()
self.listWidget.setCurrentRow(row)
self.item_list.insert(row, temp)
self.load_data()
self.list_widget.setCurrentRow(row)
def onCurrentRowChanged(self, row):
def on_current_row_changed(self, row):
"""
Called when the currentRow has changed.
@ -127,19 +129,29 @@ class ServiceItemEditForm(QtGui.QDialog, Ui_ServiceItemEditDialog):
The row number (int).
"""
# Disable all buttons, as no row is selected or only one image is left.
if row == -1 or self.listWidget.count() == 1:
self.downButton.setEnabled(False)
self.upButton.setEnabled(False)
self.deleteButton.setEnabled(False)
if row == -1 or self.list_widget.count() == 1:
self.down_button.setEnabled(False)
self.up_button.setEnabled(False)
self.delete_button.setEnabled(False)
else:
# Check if we are at the end of the list.
if self.listWidget.count() == row + 1:
self.downButton.setEnabled(False)
if self.list_widget.count() == row + 1:
self.down_button.setEnabled(False)
else:
self.downButton.setEnabled(True)
self.down_button.setEnabled(True)
# Check if we are at the beginning of the list.
if row == 0:
self.upButton.setEnabled(False)
self.up_button.setEnabled(False)
else:
self.upButton.setEnabled(True)
self.deleteButton.setEnabled(True)
self.up_button.setEnabled(True)
self.delete_button.setEnabled(True)
def _get_main_window(self):
"""
Adds the main window to the class dynamically
"""
if not hasattr(self, 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

View File

@ -29,36 +29,46 @@
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
class ServiceNoteForm(QtGui.QDialog):
"""
This is the form that is used to edit the verses of the song.
"""
def __init__(self, parent=None):
def __init__(self):
"""
Constructor
"""
QtGui.QDialog.__init__(self, parent)
QtGui.QDialog.__init__(self, self.main_window)
self.setupUi()
self.retranslateUi()
def exec_(self):
self.textEdit.setFocus()
self.text_edit.setFocus()
return QtGui.QDialog.exec_(self)
def setupUi(self):
self.setObjectName(u'serviceNoteEdit')
self.dialogLayout = QtGui.QVBoxLayout(self)
self.dialogLayout.setContentsMargins(8, 8, 8, 8)
self.dialogLayout.setSpacing(8)
self.dialogLayout.setObjectName(u'verticalLayout')
self.textEdit = SpellTextEdit(self, False)
self.textEdit.setObjectName(u'textEdit')
self.dialogLayout.addWidget(self.textEdit)
self.buttonBox = create_button_box(self, u'buttonBox', [u'cancel', u'save'])
self.dialogLayout.addWidget(self.buttonBox)
self.dialog_layout = QtGui.QVBoxLayout(self)
self.dialog_layout.setContentsMargins(8, 8, 8, 8)
self.dialog_layout.setSpacing(8)
self.dialog_layout.setObjectName(u'verticalLayout')
self.text_edit = SpellTextEdit(self, False)
self.text_edit.setObjectName(u'textEdit')
self.dialog_layout.addWidget(self.text_edit)
self.button_box = create_button_box(self, u'button_box', [u'cancel', u'save'])
self.dialog_layout.addWidget(self.button_box)
def retranslateUi(self):
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)

View File

@ -38,7 +38,7 @@ class Ui_SettingsDialog(object):
settingsDialog.resize(800, 500)
settingsDialog.setWindowIcon(build_icon(u':/system/system_settings.png'))
self.dialogLayout = QtGui.QGridLayout(settingsDialog)
self.dialogLayout.setObjectName(u'dialogLayout')
self.dialogLayout.setObjectName(u'dialog_layout')
self.dialogLayout.setMargin(8)
self.settingListWidget = QtGui.QListWidget(settingsDialog)
self.settingListWidget.setUniformItemSizes(True)
@ -49,8 +49,8 @@ class Ui_SettingsDialog(object):
self.stackedLayout = QtGui.QStackedLayout()
self.stackedLayout.setObjectName(u'stackedLayout')
self.dialogLayout.addLayout(self.stackedLayout, 0, 1, 1, 1)
self.buttonBox = create_button_box(settingsDialog, u'buttonBox', [u'cancel', u'ok'])
self.dialogLayout.addWidget(self.buttonBox, 1, 1, 1, 1)
self.button_box = create_button_box(settingsDialog, u'button_box', [u'cancel', u'ok'])
self.dialogLayout.addWidget(self.button_box, 1, 1, 1, 1)
self.retranslateUi(settingsDialog)
QtCore.QObject.connect(self.settingListWidget, QtCore.SIGNAL(u'currentRowChanged(int)'), self.tabChanged)

View File

@ -140,7 +140,7 @@ class SettingsForm(QtGui.QDialog, Ui_SettingsDialog):
per save.
"""
if self.resetSuffixes:
self.mainWindow.serviceManagerContents.resetSupportedSuffixes()
self.service_manager.reset_supported_suffixes()
self.resetSuffixes = False
def _get_main_window(self):
@ -151,4 +151,14 @@ class SettingsForm(QtGui.QDialog, Ui_SettingsDialog):
self._main_window = Registry().get(u'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)

View File

@ -107,9 +107,9 @@ class Ui_ShortcutListDialog(object):
self.alternateLabel.setObjectName(u'alternateLabel')
self.detailsLayout.addWidget(self.alternateLabel, 0, 2, 1, 1)
self.shortcutListLayout.addLayout(self.detailsLayout)
self.buttonBox = create_button_box(shortcutListDialog, u'buttonBox', [u'cancel', u'ok', u'defaults'])
self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
self.shortcutListLayout.addWidget(self.buttonBox)
self.button_box = create_button_box(shortcutListDialog, u'button_box', [u'cancel', u'ok', u'defaults'])
self.button_box.setOrientation(QtCore.Qt.Horizontal)
self.shortcutListLayout.addWidget(self.button_box)
self.retranslateUi(shortcutListDialog)
def retranslateUi(self, shortcutListDialog):

View File

@ -64,7 +64,7 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog):
self.onClearPrimaryButtonClicked)
QtCore.QObject.connect(self.clearAlternateButton, QtCore.SIGNAL(u'clicked(bool)'),
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)
QtCore.QObject.connect(self.defaultRadioButton, QtCore.SIGNAL(u'clicked(bool)'),
self.onDefaultRadioButtonClicked)
@ -274,7 +274,7 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog):
"""
Restores all default shortcuts.
"""
if self.buttonBox.buttonRole(button) != QtGui.QDialogButtonBox.ResetRole:
if self.button_box.buttonRole(button) != QtGui.QDialogButtonBox.ResetRole:
return
if QtGui.QMessageBox.question(self, translate('OpenLP.ShortcutListDialog', 'Restore Default Shortcuts'),
translate('OpenLP.ShortcutListDialog', 'Do you want to restore all '

View File

@ -92,6 +92,14 @@ class SlideController(DisplayController):
u'audioPauseItem',
u'audioTimeLabel'
]
self.wideMenu = [
u'blankScreenButton',
u'themeScreenButton',
u'desktopScreenButton'
]
self.hideMenuList = [
u'hideMenu'
]
self.timer_id = 0
self.songEdit = False
self.selectedRow = 0
@ -193,6 +201,19 @@ class SlideController(DisplayController):
self.hideMenu.menu().addAction(self.blankScreen)
self.hideMenu.menu().addAction(self.themeScreen)
self.hideMenu.menu().addAction(self.desktopScreen)
# Wide menu of display control buttons.
self.blankScreenButton = QtGui.QToolButton(self.toolbar)
self.blankScreenButton.setObjectName(u'blankScreenButton')
self.toolbar.addToolbarWidget(self.blankScreenButton)
self.blankScreenButton.setDefaultAction(self.blankScreen)
self.themeScreenButton = QtGui.QToolButton(self.toolbar)
self.themeScreenButton.setObjectName(u'themeScreenButton')
self.toolbar.addToolbarWidget(self.themeScreenButton)
self.themeScreenButton.setDefaultAction(self.themeScreen)
self.desktopScreenButton = QtGui.QToolButton(self.toolbar)
self.desktopScreenButton.setObjectName(u'desktopScreenButton')
self.toolbar.addToolbarWidget(self.desktopScreenButton)
self.desktopScreenButton.setDefaultAction(self.desktopScreen)
self.toolbar.addToolbarAction(u'loopSeparator', separator=True)
# Play Slides Menu
self.playSlidesMenu = QtGui.QToolButton(self.toolbar)
@ -297,8 +318,7 @@ class SlideController(DisplayController):
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(
self.slidePreview.sizePolicy().hasHeightForWidth())
sizePolicy.setHeightForWidth(self.slidePreview.sizePolicy().hasHeightForWidth())
self.slidePreview.setSizePolicy(sizePolicy)
self.slidePreview.setFrameShape(QtGui.QFrame.Box)
self.slidePreview.setFrameShadow(QtGui.QFrame.Plain)
@ -345,6 +365,7 @@ class SlideController(DisplayController):
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'slidecontroller_toggle_display'), self.toggleDisplay)
self.toolbar.setWidgetVisible(self.loopList, False)
self.toolbar.setWidgetVisible(self.wideMenu, False)
else:
QtCore.QObject.connect(self.previewListWidget,
QtCore.SIGNAL(u'doubleClicked(QModelIndex)'), self.onGoLiveClick)
@ -563,7 +584,20 @@ class SlideController(DisplayController):
width = self.parent().controlSplitter.sizes()[self.split]
for framenumber in range(len(self.serviceItem.get_frames())):
self.previewListWidget.setRowHeight(framenumber, width / self.ratio)
self.onControllerSizeChanged(self.controller.width(), self.controller.height())
def onControllerSizeChanged(self, width, height):
"""
Change layout of display control buttons on controller size change
"""
if self.isLive:
if width > 300 and self.hideMenu.isVisible():
self.toolbar.setWidgetVisible(self.hideMenuList, False)
self.toolbar.setWidgetVisible(self.wideMenu)
elif width < 300 and not self.hideMenu.isVisible():
self.toolbar.setWidgetVisible(self.wideMenu, False)
self.toolbar.setWidgetVisible(self.hideMenuList)
def onSongBarHandler(self):
request = self.sender().text()
slide_no = self.slideList[request]
@ -649,12 +683,12 @@ class SlideController(DisplayController):
item.render()
self._processItem(item, self.selectedRow)
def addServiceItem(self, item):
def add_service_item(self, item):
"""
Method to install the service item into the controller
Called by plugins
"""
log.debug(u'addServiceItem live = %s' % self.isLive)
log.debug(u'add_service_item live = %s' % self.isLive)
item.render()
slideno = 0
if self.songEdit:
@ -1183,14 +1217,16 @@ class SlideController(DisplayController):
From the preview display requires the service Item to be editied
"""
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):
"""
From the preview display request the Item to be added to service
"""
if self.serviceItem:
self.parent().serviceManagerContents.addServiceItem(self.serviceItem)
self.service_manager.add_service_item(self.serviceItem)
def onGoLiveClick(self):
"""
@ -1215,7 +1251,7 @@ class SlideController(DisplayController):
Receiver.send_message('servicemanager_preview_live', u'%s:%s' %
(self.serviceItem.unique_identifier, row))
else:
self.parent().liveController.addServiceManagerItem(self.serviceItem, row)
self.live_controller.addServiceManagerItem(self.serviceItem, row)
def onMediaStart(self, item):
"""
@ -1309,3 +1345,22 @@ class SlideController(DisplayController):
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)

View File

@ -38,7 +38,7 @@ class Ui_StartTimeDialog(object):
StartTimeDialog.setObjectName(u'StartTimeDialog')
StartTimeDialog.resize(350, 10)
self.dialogLayout = QtGui.QGridLayout(StartTimeDialog)
self.dialogLayout.setObjectName(u'dialogLayout')
self.dialogLayout.setObjectName(u'dialog_layout')
self.startLabel = QtGui.QLabel(StartTimeDialog)
self.startLabel.setObjectName(u'startLabel')
self.startLabel.setAlignment(QtCore.Qt.AlignHCenter)
@ -102,8 +102,8 @@ class Ui_StartTimeDialog(object):
self.secondFinishLabel.setAlignment(QtCore.Qt.AlignRight)
self.dialogLayout.addWidget(self.secondFinishLabel, 3, 3, 1, 1)
self.dialogLayout.addWidget(self.secondSpinBox, 3, 1, 1, 1)
self.buttonBox = create_button_box(StartTimeDialog, u'buttonBox', [u'cancel', u'ok'])
self.dialogLayout.addWidget(self.buttonBox, 5, 2, 1, 2)
self.button_box = create_button_box(StartTimeDialog, u'button_box', [u'cancel', u'ok'])
self.dialogLayout.addWidget(self.button_box, 5, 2, 1, 2)
self.retranslateUi(StartTimeDialog)
self.setMaximumHeight(self.sizeHint().height())

View File

@ -31,15 +31,15 @@ from PyQt4 import QtGui
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
class StartTimeForm(QtGui.QDialog, Ui_StartTimeDialog):
"""
The exception dialog
"""
def __init__(self, parent):
QtGui.QDialog.__init__(self, parent)
def __init__(self):
QtGui.QDialog.__init__(self, self.main_window)
self.setupUi(self)
def exec_(self):
@ -84,3 +84,13 @@ class StartTimeForm(QtGui.QDialog, Ui_StartTimeDialog):
minutes = seconds / 60
seconds -= 60 * minutes
return hours, minutes, seconds
def _get_main_window(self):
"""
Adds the main window to the class dynamically
"""
if not hasattr(self, u'_main_window'):
self._main_window = Registry().get(u'main_window')
return self._main_window
main_window = property(_get_main_window)

View File

@ -58,8 +58,8 @@ class Ui_ThemeLayoutDialog(object):
self.footerColourLabel = QtGui.QLabel(self.previewArea)
self.footerColourLabel.setObjectName(u'footerColourLabel')
self.previewLayout.addWidget(self.footerColourLabel)
self.buttonBox = create_button_box(themeLayoutDialog, u'buttonBox', [u'ok'])
self.previewLayout.addWidget(self.buttonBox)
self.button_box = create_button_box(themeLayoutDialog, u'button_box', [u'ok'])
self.previewLayout.addWidget(self.button_box)
self.retranslateUi(themeLayoutDialog)
def retranslateUi(self, themeLayoutDialog):

View File

@ -77,9 +77,9 @@ class Ui_AlertDialog(object):
displayIcon = build_icon(u':/general/general_live.png')
self.displayButton = create_button(alertDialog, u'displayButton', 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.alertDialogLayout.addWidget(self.buttonBox, 2, 0, 1, 2)
self.alertDialogLayout.addWidget(self.button_box, 2, 0, 1, 2)
self.retranslateUi(alertDialog)
def retranslateUi(self, alertDialog):

View File

@ -80,8 +80,8 @@ class Ui_BookNameDialog(object):
self.apocryphaCheckBox.setCheckState(QtCore.Qt.Checked)
self.optionsLayout.addWidget(self.apocryphaCheckBox)
self.bookNameLayout.addWidget(self.optionsGroupBox)
self.buttonBox = create_button_box(bookNameDialog, u'buttonBox', [u'cancel', u'ok'])
self.bookNameLayout.addWidget(self.buttonBox)
self.button_box = create_button_box(bookNameDialog, u'button_box', [u'cancel', u'ok'])
self.bookNameLayout.addWidget(self.button_box)
self.retranslateUi(bookNameDialog)

View File

@ -44,7 +44,7 @@ class Ui_EditBibleDialog(object):
self.dialogLayout = QtGui.QVBoxLayout(editBibleDialog)
self.dialogLayout.setSpacing(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.setObjectName(u'BibleTabWidget')
# Meta tab
@ -121,8 +121,8 @@ class Ui_EditBibleDialog(object):
self.bibleTabWidget.addTab(self.bookNameTab, u'')
# Last few bits
self.dialogLayout.addWidget(self.bibleTabWidget)
self.buttonBox = create_button_box(editBibleDialog, u'buttonBox', [u'cancel', u'save'])
self.dialogLayout.addWidget(self.buttonBox)
self.button_box = create_button_box(editBibleDialog, u'button_box', [u'cancel', u'save'])
self.dialogLayout.addWidget(self.button_box)
self.retranslateUi(editBibleDialog)
QtCore.QMetaObject.connectSlotsByName(editBibleDialog)

View File

@ -62,8 +62,8 @@ class Ui_LanguageDialog(object):
self.languageComboBox.setObjectName(u'languageComboBox')
self.languageHBoxLayout.addWidget(self.languageComboBox)
self.languageLayout.addLayout(self.languageHBoxLayout)
self.buttonBox = create_button_box(languageDialog, u'buttonBox', [u'cancel', u'ok'])
self.languageLayout.addWidget(self.buttonBox)
self.button_box = create_button_box(languageDialog, u'button_box', [u'cancel', u'ok'])
self.languageLayout.addWidget(self.button_box)
self.retranslateUi(languageDialog)

View File

@ -38,7 +38,7 @@ class Ui_CustomEditDialog(object):
customEditDialog.resize(450, 350)
customEditDialog.setWindowIcon(build_icon(u':/icon/openlp-logo-16x16.png'))
self.dialogLayout = QtGui.QVBoxLayout(customEditDialog)
self.dialogLayout.setObjectName(u'dialogLayout')
self.dialogLayout.setObjectName(u'dialog_layout')
self.titleLayout = QtGui.QHBoxLayout()
self.titleLayout.setObjectName(u'titleLayout')
self.titleLabel = QtGui.QLabel(customEditDialog)
@ -97,8 +97,8 @@ class Ui_CustomEditDialog(object):
self.bottomFormLayout.addRow(self.creditLabel, self.creditEdit)
self.dialogLayout.addLayout(self.bottomFormLayout)
self.previewButton = QtGui.QPushButton()
self.buttonBox = create_button_box(customEditDialog, u'buttonBox', [u'cancel', u'save'], [self.previewButton])
self.dialogLayout.addWidget(self.buttonBox)
self.button_box = create_button_box(customEditDialog, u'button_box', [u'cancel', u'save'], [self.previewButton])
self.dialogLayout.addWidget(self.button_box)
self.retranslateUi(customEditDialog)
def retranslateUi(self, customEditDialog):

View File

@ -102,10 +102,6 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog):
# If not preview hide the preview button.
self.previewButton.setVisible(preview)
def reject(self):
Receiver.send_message(u'custom_edit_clear')
QtGui.QDialog.reject(self)
def accept(self):
log.debug(u'accept')
if self.saveCustom():

View File

@ -42,9 +42,9 @@ class Ui_CustomSlideEditDialog(object):
self.dialogLayout.addWidget(self.slideTextEdit)
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.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.dialogLayout.addWidget(self.buttonBox)
self.dialogLayout.addWidget(self.button_box)
self.retranslateUi(customSlideEditDialog)
def retranslateUi(self, customSlideEditDialog):

View File

@ -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'searchTypeChanged(int)'),
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_preview'), self.onPreviewClick)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'config_updated'), self.config_updated)
@ -116,11 +114,6 @@ class CustomMediaItem(MediaManagerItem):
# Called to redisplay the custom list screen edith from a search
# 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.
if self.remoteTriggered == u'L':
self.onAddClick()
if self.remoteTriggered == u'P':
self.onPreviewClick()
self.onRemoteEditClear()
def onNewClick(self):
self.edit_custom_form.loadCustom(0)
@ -128,26 +121,27 @@ class CustomMediaItem(MediaManagerItem):
self.onClearTextButtonClick()
self.onSelectionChange()
def onRemoteEditClear(self):
self.remoteTriggered = None
self.remoteCustom = -1
def onRemoteEdit(self, message):
def onRemoteEdit(self, custom_id, preview=False):
"""
Called by ServiceManager or SlideController by event passing
the custom Id in the payload along with an indicator to say which
type of display is required.
"""
remote_type, custom_id = message.split(u':')
custom_id = int(custom_id)
valid = self.manager.get_object(CustomSlide, custom_id)
if valid:
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.onSearchTextButtonClicked()
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.autoSelectId = -1
self.onSearchTextButtonClicked()
item = self.buildServiceItem(remote=True)
self.remoteTriggered = None
self.remoteCustom = 1
if item:
return item
return None
def onEditClick(self):
"""

View File

@ -440,10 +440,10 @@ class ImageMediaItem(MediaManagerItem):
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.plugin.liveController.display.resetImage()
self.live_controller.display.resetImage()
def liveThemeChanged(self):
"""
@ -461,7 +461,7 @@ class ImageMediaItem(MediaManagerItem):
bitem = self.listView.selectedItems()[0]
filename = bitem.data(0, QtCore.Qt.UserRole).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)
else:
critical_error_message_box(UiStrings().LiveBGError,

View File

@ -131,7 +131,7 @@ class MediaMediaItem(MediaManagerItem):
"""
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)
def videobackgroundReplaced(self):
@ -154,7 +154,7 @@ class MediaMediaItem(MediaManagerItem):
service_item.shortname = service_item.title
(path, name) = os.path.split(filename)
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):
self.resetAction.setVisible(True)
else:

View File

@ -85,6 +85,6 @@ class MediaTab(SettingsTab):
if Settings().value(setting_key) != self.autoStartCheckBox.checkState():
Settings().setValue(setting_key, self.autoStartCheckBox.checkState())
if override_changed:
self.parent.resetSupportedSuffixes()
self.parent.reset_supported_suffixes()
Receiver.send_message(u'mediaitem_media_rebuild')
Receiver.send_message(u'mediaitem_suffixes')

View File

@ -85,7 +85,7 @@ class PresentationMediaItem(MediaManagerItem):
for type in types:
if fileType.find(type) == -1:
fileType += u'*.%s ' % type
self.plugin.serviceManager.supportedSuffixes(type)
self.service_manager.supported_suffixes(type)
self.onNewFileMasks = translate('PresentationPlugin.MediaItem', 'Presentations (%s)') % fileType
def requiredIcons(self):

View File

@ -129,7 +129,7 @@ class PresentationTab(SettingsTab):
Settings().setValue(setting_key, self.OverrideAppCheckBox.checkState())
changed = True
if changed:
self.parent.resetSupportedSuffixes()
self.parent.reset_supported_suffixes()
Receiver.send_message(u'mediaitem_presentation_rebuild')
Receiver.send_message(u'mediaitem_suffixes')

View File

@ -37,7 +37,7 @@ class Ui_AuthorsDialog(object):
authorsDialog.setObjectName(u'AuthorsDialog')
authorsDialog.resize(300, 10)
self.dialogLayout = QtGui.QVBoxLayout(authorsDialog)
self.dialogLayout.setObjectName(u'dialogLayout')
self.dialogLayout.setObjectName(u'dialog_layout')
self.authorLayout = QtGui.QFormLayout()
self.authorLayout.setObjectName(u'authorLayout')
self.firstNameLabel = QtGui.QLabel(authorsDialog)
@ -59,8 +59,8 @@ class Ui_AuthorsDialog(object):
self.displayLabel.setBuddy(self.displayEdit)
self.authorLayout.addRow(self.displayLabel, self.displayEdit)
self.dialogLayout.addLayout(self.authorLayout)
self.buttonBox = create_button_box(authorsDialog, u'buttonBox', [u'cancel', u'save'])
self.dialogLayout.addWidget(self.buttonBox)
self.button_box = create_button_box(authorsDialog, u'button_box', [u'cancel', u'save'])
self.dialogLayout.addWidget(self.button_box)
self.retranslateUi(authorsDialog)
authorsDialog.setMaximumHeight(authorsDialog.sizeHint().height())

View File

@ -42,7 +42,7 @@ class Ui_EditSongDialog(object):
self.dialogLayout = QtGui.QVBoxLayout(editSongDialog)
self.dialogLayout.setSpacing(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.setObjectName(u'songTabWidget')
# lyrics tab
@ -272,8 +272,8 @@ class Ui_EditSongDialog(object):
self.warningLabel.setObjectName(u'warningLabel')
self.warningLabel.setVisible(False)
self.bottomLayout.addWidget(self.warningLabel)
self.buttonBox = create_button_box(editSongDialog, u'buttonBox', [u'cancel', u'save'])
self.bottomLayout.addWidget(self.buttonBox)
self.button_box = create_button_box(editSongDialog, u'button_box', [u'cancel', u'save'])
self.bottomLayout.addWidget(self.button_box)
self.dialogLayout.addLayout(self.bottomLayout)
self.retranslateUi(editSongDialog)

View File

@ -101,8 +101,8 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
self.previewButton = QtGui.QPushButton()
self.previewButton.setObjectName(u'previewButton')
self.previewButton.setText(UiStrings().SaveAndPreview)
self.buttonBox.addButton(self.previewButton, QtGui.QDialogButtonBox.ActionRole)
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(u'clicked(QAbstractButton*)'), self.onPreview)
self.button_box.addButton(self.previewButton, QtGui.QDialogButtonBox.ActionRole)
QtCore.QObject.connect(self.button_box, QtCore.SIGNAL(u'clicked(QAbstractButton*)'), self.onPreview)
# Create other objects and forms
self.manager = manager
self.verseForm = EditVerseForm(self)
@ -775,7 +775,6 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
Exit Dialog and do not save
"""
log.debug (u'SongEditForm.reject')
Receiver.send_message(u'songs_edit_clear')
self.clearCaches()
QtGui.QDialog.reject(self)

View File

@ -39,7 +39,7 @@ class Ui_EditVerseDialog(object):
editVerseDialog.resize(400, 400)
editVerseDialog.setModal(True)
self.dialogLayout = QtGui.QVBoxLayout(editVerseDialog)
self.dialogLayout.setObjectName(u'dialogLayout')
self.dialogLayout.setObjectName(u'dialog_layout')
self.verseTextEdit = SpellTextEdit(editVerseDialog)
self.verseTextEdit.setObjectName(u'verseTextEdit')
self.dialogLayout.addWidget(self.verseTextEdit)
@ -67,8 +67,8 @@ class Ui_EditVerseDialog(object):
self.verseTypeLayout.addWidget(self.insertButton)
self.verseTypeLayout.addStretch()
self.dialogLayout.addLayout(self.verseTypeLayout)
self.buttonBox = create_button_box(editVerseDialog, u'buttonBox', [u'cancel', u'ok'])
self.dialogLayout.addWidget(self.buttonBox)
self.button_box = create_button_box(editVerseDialog, u'button_box', [u'cancel', u'ok'])
self.dialogLayout.addWidget(self.button_box)
self.retranslateUi(editVerseDialog)
def retranslateUi(self, editVerseDialog):

View File

@ -52,8 +52,8 @@ class Ui_MediaFilesDialog(object):
self.fileListWidget.setSelectionMode(QtGui.QAbstractItemView.ExtendedSelection)
self.fileListWidget.setObjectName(u'fileListWidget')
self.filesVerticalLayout.addWidget(self.fileListWidget)
self.buttonBox = create_button_box(mediaFilesDialog, u'buttonBox', [u'cancel', u'ok'])
self.filesVerticalLayout.addWidget(self.buttonBox)
self.button_box = create_button_box(mediaFilesDialog, u'button_box', [u'cancel', u'ok'])
self.filesVerticalLayout.addWidget(self.button_box)
self.retranslateUi(mediaFilesDialog)
def retranslateUi(self, mediaFilesDialog):

View File

@ -37,7 +37,7 @@ class Ui_SongBookDialog(object):
songBookDialog.setObjectName(u'songBookDialog')
songBookDialog.resize(300, 10)
self.dialogLayout = QtGui.QVBoxLayout(songBookDialog)
self.dialogLayout.setObjectName(u'dialogLayout')
self.dialogLayout.setObjectName(u'dialog_layout')
self.bookLayout = QtGui.QFormLayout()
self.bookLayout.setObjectName(u'bookLayout')
self.nameLabel = QtGui.QLabel(songBookDialog)
@ -53,8 +53,8 @@ class Ui_SongBookDialog(object):
self.publisherLabel.setBuddy(self.publisherEdit)
self.bookLayout.addRow(self.publisherLabel, self.publisherEdit)
self.dialogLayout.addLayout(self.bookLayout)
self.buttonBox = create_button_box(songBookDialog, u'buttonBox', [u'cancel', u'save'])
self.dialogLayout.addWidget(self.buttonBox)
self.button_box = create_button_box(songBookDialog, u'button_box', [u'cancel', u'save'])
self.dialogLayout.addWidget(self.button_box)
self.retranslateUi(songBookDialog)
songBookDialog.setMaximumHeight(songBookDialog.sizeHint().height())

View File

@ -39,7 +39,7 @@ class Ui_SongMaintenanceDialog(object):
songMaintenanceDialog.setWindowModality(QtCore.Qt.ApplicationModal)
songMaintenanceDialog.resize(10, 350)
self.dialogLayout = QtGui.QGridLayout(songMaintenanceDialog)
self.dialogLayout.setObjectName(u'dialogLayout')
self.dialogLayout.setObjectName(u'dialog_layout')
self.typeListWidget = QtGui.QListWidget(songMaintenanceDialog)
self.typeListWidget.setIconSize(QtCore.QSize(32, 32))
self.typeListWidget.setUniformItemSizes(True)
@ -130,8 +130,8 @@ class Ui_SongMaintenanceDialog(object):
self.stackedLayout.addWidget(self.booksPage)
#
self.dialogLayout.addLayout(self.stackedLayout, 0, 1)
self.buttonBox = create_button_box(songMaintenanceDialog, u'buttonBox', [u'close'])
self.dialogLayout.addWidget(self.buttonBox, 1, 0, 1, 2)
self.button_box = create_button_box(songMaintenanceDialog, u'button_box', [u'close'])
self.dialogLayout.addWidget(self.button_box, 1, 0, 1, 2)
self.retranslateUi(songMaintenanceDialog)
self.stackedLayout.setCurrentIndex(0)
QtCore.QObject.connect(self.typeListWidget, QtCore.SIGNAL(u'currentRowChanged(int)'),

View File

@ -37,7 +37,7 @@ class Ui_TopicsDialog(object):
topicsDialog.setObjectName(u'topicsDialog')
topicsDialog.resize(300, 10)
self.dialogLayout = QtGui.QVBoxLayout(topicsDialog)
self.dialogLayout.setObjectName(u'dialogLayout')
self.dialogLayout.setObjectName(u'dialog_layout')
self.nameLayout = QtGui.QFormLayout()
self.nameLayout.setObjectName(u'nameLayout')
self.nameLabel = QtGui.QLabel(topicsDialog)
@ -47,8 +47,8 @@ class Ui_TopicsDialog(object):
self.nameLabel.setBuddy(self.nameEdit)
self.nameLayout.addRow(self.nameLabel, self.nameEdit)
self.dialogLayout.addLayout(self.nameLayout)
self.buttonBox = create_button_box(topicsDialog, u'buttonBox', [u'cancel', u'save'])
self.dialogLayout.addWidget(self.buttonBox)
self.button_box = create_button_box(topicsDialog, u'button_box', [u'cancel', u'save'])
self.dialogLayout.addWidget(self.button_box)
self.retranslateUi(topicsDialog)
topicsDialog.setMaximumHeight(topicsDialog.sizeHint().height())

View File

@ -35,15 +35,12 @@ import shutil
from PyQt4 import QtCore, QtGui
from sqlalchemy.sql import or_
from openlp.core.lib import MediaManagerItem, Receiver, ItemCapabilities, \
translate, check_item_selected, PluginStatus, create_separated_list, \
check_directory_exists, ServiceItemContext, Settings, UiStrings
from openlp.core.lib import MediaManagerItem, Receiver, ItemCapabilities, translate, check_item_selected, \
PluginStatus, create_separated_list, check_directory_exists, ServiceItemContext, Settings, UiStrings
from openlp.core.lib.ui import create_widget_action
from openlp.core.utils import AppLocation
from openlp.plugins.songs.forms import EditSongForm, SongMaintenanceForm, \
SongImportForm, SongExportForm
from openlp.plugins.songs.lib import OpenLyrics, SongXML, VerseType, \
clean_string, natcmp
from openlp.plugins.songs.forms import EditSongForm, SongMaintenanceForm, SongImportForm, SongExportForm
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.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'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_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'searchTypeChanged(int)'),
self.onSearchTextButtonClicked)
@ -212,15 +207,10 @@ class SongMediaItem(MediaManagerItem):
# 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
# 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
if self.editItem and self.updateServiceOnEdit and not self.remoteTriggered:
item = self.buildServiceItem(self.editItem)
self.plugin.serviceManager.replaceServiceItem(item)
self.onRemoteEditClear()
self.service_manager.replace_service_item(item)
self.onSearchTextButtonClicked()
log.debug(u'onSongListLoad - finished')
@ -324,28 +314,28 @@ class SongMediaItem(MediaManagerItem):
def onSongMaintenanceClick(self):
self.songMaintenanceForm.exec_()
def onRemoteEditClear(self):
log.debug(u'onRemoteEditClear')
self.remoteTriggered = None
self.remoteSong = -1
def onRemoteEdit(self, message):
def onRemoteEdit(self, song_id, preview=False):
"""
Called by ServiceManager or SlideController by event passing
the Song Id in the payload along with an indicator to say which
type of display is required.
"""
log.debug(u'onRemoteEdit %s' % message)
remote_type, song_id = message.split(u':')
log.debug(u'onRemoteEdit for song %s' % song_id)
song_id = int(song_id)
valid = self.plugin.manager.get_object(Song, song_id)
if valid:
self.remoteSong = song_id
self.remoteTriggered = remote_type
self.editSongForm.loadSong(song_id, remote_type == u'P')
self.editSongForm.exec_()
self.autoSelectId = -1
self.onSongListLoad()
self.editSongForm.loadSong(song_id, preview)
if self.editSongForm.exec_() == QtGui.QDialog.Accepted:
self.autoSelectId = -1
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):
"""
@ -413,7 +403,7 @@ class SongMediaItem(MediaManagerItem):
self.onSongListLoad()
def generateSlideData(self, service_item, item=None, xmlVersion=False,
remote=False, context=ServiceItemContext.Service):
remote=False, context=ServiceItemContext.Service):
log.debug(u'generateSlideData: %s, %s, %s' % (service_item, item, self.remoteSong))
item_id = self._getIdOfItemToGenerate(item, self.remoteSong)
service_item.add_capability(ItemCapabilities.CanEdit)
@ -429,8 +419,7 @@ class SongMediaItem(MediaManagerItem):
verse_list = SongXML().get_verses(song.lyrics)
# no verse list or only 1 space (in error)
verse_tags_translated = False
if VerseType.from_translated_string(unicode(
verse_list[0][0][u'type'])) is not None:
if VerseType.from_translated_string(unicode(verse_list[0][0][u'type'])) is not None:
verse_tags_translated = True
if not song.verse_order.strip():
for verse in verse_list:

View File

@ -49,8 +49,8 @@ class Ui_SongUsageDeleteDialog(object):
self.deleteCalendar.setVerticalHeaderFormat(QtGui.QCalendarWidget.NoVerticalHeader)
self.deleteCalendar.setObjectName(u'deleteCalendar')
self.verticalLayout.addWidget(self.deleteCalendar)
self.buttonBox = create_button_box(songUsageDeleteDialog, u'buttonBox', [u'cancel', u'ok'])
self.verticalLayout.addWidget(self.buttonBox)
self.button_box = create_button_box(songUsageDeleteDialog, u'button_box', [u'cancel', u'ok'])
self.verticalLayout.addWidget(self.button_box)
self.retranslateUi(songUsageDeleteDialog)
def retranslateUi(self, songUsageDeleteDialog):

View File

@ -44,11 +44,11 @@ class SongUsageDeleteForm(QtGui.QDialog, Ui_SongUsageDeleteDialog):
self.manager = manager
QtGui.QDialog.__init__(self, parent)
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)
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,
translate('SongUsagePlugin.SongUsageDeleteForm', 'Delete Selected Song Usage Events?'),
translate('SongUsagePlugin.SongUsageDeleteForm',

View File

@ -74,8 +74,8 @@ class Ui_SongUsageDetailDialog(object):
self.saveFilePushButton.setObjectName(u'saveFilePushButton')
self.fileHorizontalLayout.addWidget(self.saveFilePushButton)
self.verticalLayout.addWidget(self.fileGroupBox)
self.buttonBox = create_button_box(songUsageDetailDialog, u'buttonBox', [u'cancel', u'ok'])
self.verticalLayout.addWidget(self.buttonBox)
self.button_box = create_button_box(songUsageDetailDialog, u'button_box', [u'cancel', u'ok'])
self.verticalLayout.addWidget(self.button_box)
self.retranslateUi(songUsageDetailDialog)
QtCore.QObject.connect(self.saveFilePushButton, QtCore.SIGNAL(u'clicked()'),
songUsageDetailDialog.defineOutputLocation)

View File

@ -13,26 +13,36 @@ class TestRegistry(TestCase):
def registry_basic_test(self):
"""
Test the Service Item basic test
Test the registry creation and its usage
"""
# GIVEN: A new registry
registry = Registry.create()
# WHEN: I add a service it should save it
# WHEN: I add a component it should save it
mock_1 = MagicMock()
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'
# WHEN: I add a service for the second time I am mad.
# THEN I will get an exception
# WHEN: I add a component for the second time I am mad.
# THEN and I will get an exception
with self.assertRaises(KeyError) as context:
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
with self.assertRaises(KeyError) as context:
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')

View File

@ -29,11 +29,10 @@ class TestServiceItem(TestCase):
Set up the Registry
"""
registry = Registry.create()
mocked_renderer = MagicMock()
mocked_image_manager = MagicMock()
mocked_renderer = MagicMock()
mocked_renderer.format_slide.return_value = [VERSE]
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):
"""

View File

@ -1,65 +0,0 @@
"""
Package to test the openlp.core.ui package.
"""
import sys
from unittest import TestCase
from mock import MagicMock, patch
from openlp.core.ui import starttimeform
from PyQt4 import QtGui, QtTest
class TestStartTimeDialog(TestCase):
def setUp(self):
"""
Create the UI
"""
self.app = QtGui.QApplication([])
self.window = QtGui.QMainWindow()
self.form = starttimeform.StartTimeForm(self.window)
def tearDown(self):
"""
Delete all the C++ objects at the end so that we don't have a segfault
"""
del self.form
del self.window
del self.app
def ui_defaults_test(self):
"""
Test StartTimeDialog defaults
"""
self.assertEqual(self.form.hourSpinBox.minimum(), 0)
self.assertEqual(self.form.hourSpinBox.maximum(), 4)
self.assertEqual(self.form.minuteSpinBox.minimum(), 0)
self.assertEqual(self.form.minuteSpinBox.maximum(), 59)
self.assertEqual(self.form.secondSpinBox.minimum(), 0)
self.assertEqual(self.form.secondSpinBox.maximum(), 59)
self.assertEqual(self.form.hourFinishSpinBox.minimum(), 0)
self.assertEqual(self.form.hourFinishSpinBox.maximum(), 4)
self.assertEqual(self.form.minuteFinishSpinBox.minimum(), 0)
self.assertEqual(self.form.minuteFinishSpinBox.maximum(), 59)
self.assertEqual(self.form.secondFinishSpinBox.minimum(), 0)
self.assertEqual(self.form.secondFinishSpinBox.maximum(), 59)
def time_display_test(self):
"""
Test StartTimeDialog display initialisation
"""
# GIVEN: A service item with with time
mocked_serviceitem = MagicMock()
mocked_serviceitem.start_time = 61
mocked_serviceitem.end_time = 3701
# WHEN displaying the UI and pressing enter
self.form.item = mocked_serviceitem
with patch(u'openlp.core.lib.QtGui.QDialog') as MockedQtGuiQDialog:
MockedQtGuiQDialog.return_value = True
#does not work yet
#self.form.exec_()
# THEN the following values are returned
self.assertEqual(self.form.hourSpinBox.value(), 0)
self.assertEqual(self.form.minuteSpinBox.value(), 0)
self.assertEqual(self.form.secondSpinBox.value(), 0)

View File

@ -48,7 +48,7 @@ class TestAppLocation(TestCase):
data_path = AppLocation.get_data_path()
# THEN: the mocked Settings methods were called and the value returned was our set up value
mocked_settings.contains.assert_called_with(u'advanced/data path')
mocked_settings.value.assert_called_with(u'advanced/data path', u'')
mocked_settings.value.assert_called_with(u'advanced/data path')
assert data_path == u'custom/dir', u'Result should be "custom/dir"'
def get_section_data_path_test(self):
@ -76,7 +76,7 @@ class TestAppLocation(TestCase):
directory = AppLocation.get_directory(AppLocation.AppDir)
# THEN:
assert directory == u'app/dir', u'Directory should be "app/dir"'
def get_directory_for_plugins_dir_test(self):
"""
Test the AppLocation.get_directory() method for AppLocation.PluginsDir
@ -94,4 +94,4 @@ class TestAppLocation(TestCase):
directory = AppLocation.get_directory(AppLocation.PluginsDir)
# THEN:
assert directory == u'plugins/dir', u'Directory should be "plugins/dir"'

View 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')

View File

@ -0,0 +1,95 @@
"""
Package to test the openlp.core.ui package.
"""
import sys
from unittest import TestCase
from mock import MagicMock, patch
from openlp.core.lib import Registry
from openlp.core.ui import starttimeform
from PyQt4 import QtCore, QtGui, QtTest
class TestStartTimeDialog(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 = starttimeform.StartTimeForm()
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 ui_defaults_test(self):
"""
Test StartTimeDialog are defaults correct
"""
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, u'The maximum hour should stay the same as the dialog')
self.assertEqual(self.form.minuteSpinBox.minimum(), 0,
u'The minimum minute should stay the same as the dialog')
self.assertEqual(self.form.minuteSpinBox.maximum(), 59,
u'The maximum minute should stay the same as the dialog')
self.assertEqual(self.form.secondSpinBox.minimum(), 0,
u'The minimum second should stay the same as the dialog')
self.assertEqual(self.form.secondSpinBox.maximum(), 59,
u'The maximum second should stay the same as the dialog')
self.assertEqual(self.form.hourFinishSpinBox.minimum(), 0,
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):
"""
Test StartTimeDialog display functionality
"""
# GIVEN: A service item with with time
mocked_serviceitem = MagicMock()
mocked_serviceitem.start_time = 61
mocked_serviceitem.end_time = 3701
mocked_serviceitem.media_length = 3701
# WHEN displaying the UI and pressing enter
self.form.item = {u'service_item': mocked_serviceitem}
with patch(u'PyQt4.QtGui.QDialog') as mocked_exec:
self.form.exec_()
okWidget = self.form.button_box.button(self.form.button_box.Ok)
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
self.assertEqual(self.form.hourSpinBox.value(), 0)
self.assertEqual(self.form.minuteSpinBox.value(), 2)
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')