Move var cleanups

This commit is contained in:
Tim Bentley 2013-01-27 20:36:18 +00:00
parent 96c9c5679d
commit 80a2a7449e
38 changed files with 260 additions and 192 deletions

View File

@ -470,7 +470,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()
@ -496,7 +496,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.QListWidgetItem()
@ -525,7 +525,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):
"""
@ -536,13 +536,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.service_manager.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'),

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

@ -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

@ -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

@ -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

@ -42,85 +42,86 @@ class ServiceItemEditForm(QtGui.QDialog, Ui_ServiceItemEditDialog):
"""
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.
@ -128,22 +129,22 @@ 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):
"""

View File

@ -194,9 +194,11 @@ class ServiceManagerDialog(object):
self.on_make_live)
QtCore.QObject.connect(self.service_manager_list, QtCore.SIGNAL(u'itemCollapsed(QTreeWidgetItem*)'),
self.collapsed)
QtCore.QObject.connect(self.service_manager_list, QtCore.SIGNAL(u'itemExpanded(QTreeWidgetItem*)'), self.expanded)
QtCore.QObject.connect(self.service_manager_list, QtCore.SIGNAL(u'itemExpanded(QTreeWidgetItem*)'),
self.expanded)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'theme_update_list'), self.update_theme_list)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'servicemanager_preview_live'), self.preview_live)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'servicemanager_preview_live'),
self.preview_live)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'servicemanager_next_item'), self.next_item)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'servicemanager_previous_item'),
self.previous_item)
@ -248,7 +250,7 @@ class ServiceManagerDialog(object):
checked=False, triggers=self.on_timed_slide_interval)
self.menu.addSeparator()
self.preview_action = create_widget_action(self.menu, text=translate('OpenLP.ServiceManager', 'Show &Preview'),
icon=u':/general/general_preview.png', triggers=self.makePreview)
icon=u':/general/general_preview.png', triggers=self.make_preview)
# Add already existing make live action to the menu.
self.menu.addAction(self.service_manager_list.make_live)
self.menu.addSeparator()
@ -509,7 +511,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
service_item[u'header'][u'background_audio'][i] = new_file
# Add the service item to the service.
service.append({u'serviceitem': service_item})
self.repaintServiceList(-1, -1)
self.repaint_service_list(-1, -1)
for file_item in write_list:
file_size = os.path.getsize(file_item)
total_size += file_size
@ -730,7 +732,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
if service_item.unique_identifier == self.load_item_unique_identifier:
service_item.edit_id = int(self.load_item_edit_id)
service_item.temporary_edit = self.load_item_temporary
self.addServiceItem(service_item, repaint=False)
self.add_service_item(service_item, repaint=False)
delete_file(p_file)
self.main_window.addRecentFile(file_name)
self.set_modified(False)
@ -761,7 +763,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
zip_file.close()
self.main_window.finishedProgressBar()
Receiver.send_message(u'cursor_normal')
self.repaintServiceList(-1, -1)
self.repaint_service_list(-1, -1)
def load_Last_file(self):
"""
@ -843,11 +845,10 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
Allow the service note to be edited
"""
item = self.find_service_item()[0]
self.serviceNoteForm.textEdit.setPlainText(
self.service_items[item][u'service_item'].notes)
self.serviceNoteForm.text_edit.setPlainText(self.service_items[item][u'service_item'].notes)
if self.serviceNoteForm.exec_():
self.service_items[item][u'service_item'].notes = self.serviceNoteForm.textEdit.toPlainText()
self.repaintServiceList(item, -1)
self.service_items[item][u'service_item'].notes = self.serviceNoteForm.text_edit.toPlainText()
self.repaint_service_list(item, -1)
self.set_modified()
def on_start_time_form(self):
@ -857,7 +858,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
item = self.find_service_item()[0]
self.startTimeForm.item = self.service_items[item]
if self.startTimeForm.exec_():
self.repaintServiceList(item, -1)
self.repaint_service_list(item, -1)
def toggle_auto_play_slides_once(self):
"""
@ -925,10 +926,9 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
display if changes are saved.
"""
item = self.find_service_item()[0]
self.serviceItemEditForm.setServiceItem(
self.service_items[item][u'service_item'])
self.serviceItemEditForm.set_service_item(self.service_items[item][u'service_item'])
if self.serviceItemEditForm.exec_():
self.addServiceItem(self.serviceItemEditForm.getServiceItem(),
self.add_service_item(self.serviceItemEditForm.get_service_item(),
replace=True, expand=self.service_items[item][u'expanded'])
def preview_live(self, message):
@ -1070,7 +1070,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
temp = self.service_items[item]
self.service_items.remove(self.service_items[item])
self.service_items.insert(0, temp)
self.repaintServiceList(0, child)
self.repaint_service_list(0, child)
self.set_modified()
def onServiceUp(self):
@ -1082,7 +1082,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
temp = self.service_items[item]
self.service_items.remove(self.service_items[item])
self.service_items.insert(item - 1, temp)
self.repaintServiceList(item - 1, child)
self.repaint_service_list(item - 1, child)
self.set_modified()
def onServiceDown(self):
@ -1094,7 +1094,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
temp = self.service_items[item]
self.service_items.remove(self.service_items[item])
self.service_items.insert(item + 1, temp)
self.repaintServiceList(item + 1, child)
self.repaint_service_list(item + 1, child)
self.set_modified()
def onServiceEnd(self):
@ -1106,7 +1106,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
temp = self.service_items[item]
self.service_items.remove(self.service_items[item])
self.service_items.insert(len(self.service_items), temp)
self.repaintServiceList(len(self.service_items) - 1, child)
self.repaint_service_list(len(self.service_items) - 1, child)
self.set_modified()
def onDeleteFromService(self):
@ -1116,10 +1116,10 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
item = self.find_service_item()[0]
if item != -1:
self.service_items.remove(self.service_items[item])
self.repaintServiceList(item - 1, -1)
self.repaint_service_list(item - 1, -1)
self.set_modified()
def repaintServiceList(self, serviceItem, serviceItemChild):
def repaint_service_list(self, serviceItem, serviceItemChild):
"""
Clear the existing service list and prepaint all the items. This is
used when moving items as the move takes place in a supporting list,
@ -1257,14 +1257,14 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
self.service_items = []
self.isNew = True
for item in tempServiceItems:
self.addServiceItem(item[u'service_item'], False, expand=item[u'expanded'], repaint=False,
self.add_service_item(item[u'service_item'], False, expand=item[u'expanded'], repaint=False,
selected=item[u'selected'])
# Set to False as items may have changed rendering
# does not impact the saved song so True may also be valid
if changed:
self.set_modified()
# Repaint it once only at the end
self.repaintServiceList(-1, -1)
self.repaint_service_list(-1, -1)
Receiver.send_message(u'cursor_normal')
def serviceItemUpdate(self, message):
@ -1276,7 +1276,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
self.load_item_edit_id = int(edit_id)
self.load_item_temporary = str_to_bool(temporary)
def replaceServiceItem(self, newItem):
def replace_service_item(self, newItem):
"""
Using the service item passed replace the one with the same edit id
if found.
@ -1286,11 +1286,11 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
newItem.render()
newItem.merge(item[u'service_item'])
item[u'service_item'] = newItem
self.repaintServiceList(item_count + 1, 0)
self.repaint_service_list(item_count + 1, 0)
self.live_controller.replaceServiceManagerItem(newItem)
self.set_modified()
def addServiceItem(self, item, rebuild=False, expand=None, replace=False, repaint=True, selected=False):
def add_service_item(self, item, rebuild=False, expand=None, replace=False, repaint=True, selected=False):
"""
Add a Service item to the list
@ -1308,7 +1308,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
sitem, child = self.find_service_item()
item.merge(self.service_items[sitem][u'service_item'])
self.service_items[sitem][u'service_item'] = item
self.repaintServiceList(sitem, child)
self.repaint_service_list(sitem, child)
self.live_controller.replaceServiceManagerItem(item)
else:
item.render()
@ -1324,19 +1324,19 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
u'order': len(self.service_items) + 1,
u'expanded': expand, u'selected': selected})
if repaint:
self.repaintServiceList(len(self.service_items) - 1, -1)
self.repaint_service_list(len(self.service_items) - 1, -1)
else:
self.service_items.insert(self.drop_position,
{u'service_item': item, u'order': self.drop_position,
u'expanded': expand, u'selected': selected})
self.repaintServiceList(self.drop_position, -1)
self.repaint_service_list(self.drop_position, -1)
# if rebuilding list make sure live is fixed.
if rebuild:
self.live_controller.replaceServiceManagerItem(item)
self.drop_position = 0
self.set_modified()
def makePreview(self):
def make_preview(self):
"""
Send the current item to the Preview slide controller
"""
@ -1350,7 +1350,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
'Your item cannot be displayed as there is no handler to display it'))
Receiver.send_message(u'cursor_normal')
def getServiceItem(self):
def get_service_item(self):
"""
Send the current item to the Preview slide controller
"""
@ -1407,7 +1407,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
new_item = Registry().get(self.service_items[item][u'service_item'].name). \
onRemoteEdit(self.service_items[item][u'service_item'].edit_id)
if new_item:
self.addServiceItem(new_item, replace=True)
self.add_service_item(new_item, replace=True)
def create_custom(self):
"""
@ -1477,7 +1477,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
serviceItem = self.service_items[startpos]
self.service_items.remove(serviceItem)
self.service_items.insert(endpos, serviceItem)
self.repaintServiceList(endpos, child)
self.repaint_service_list(endpos, child)
self.set_modified()
else:
# we are not over anything so drop

View File

@ -45,20 +45,20 @@ class ServiceNoteForm(QtGui.QDialog):
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'))

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

@ -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

@ -648,12 +648,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:
@ -1184,14 +1184,14 @@ class SlideController(DisplayController):
self.songEdit = True
new_item = Registry().get(self.serviceItem.name).onRemoteEdit(self.serviceItem.edit_id, True)
if new_item:
self.addServiceItem(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.service_manager.addServiceItem(self.serviceItem)
self.service_manager.add_service_item(self.serviceItem)
def onGoLiveClick(self):
"""

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

@ -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

@ -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

@ -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)

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

@ -210,7 +210,7 @@ class SongMediaItem(MediaManagerItem):
# 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.service_manager.replaceServiceItem(item)
self.service_manager.replace_service_item(item)
self.onSearchTextButtonClicked()
log.debug(u'onSongListLoad - finished')

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

@ -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 is 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 is as originally entered')
# 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 text is as changed text is returned')

View File

@ -48,7 +48,7 @@ class TestStartTimeDialog(TestCase):
def time_display_test(self):
"""
Test StartTimeDialog display initialisation
Test StartTimeDialog display functionality
"""
# GIVEN: A service item with with time
mocked_serviceitem = MagicMock()
@ -63,7 +63,7 @@ class TestStartTimeDialog(TestCase):
okWidget = self.form.buttonBox.button(self.form.buttonBox.Ok)
QtTest.QTest.mouseClick(okWidget, QtCore.Qt.LeftButton)
# THEN the following input values values are returned
# 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)
@ -78,7 +78,7 @@ class TestStartTimeDialog(TestCase):
okWidget = self.form.buttonBox.button(self.form.buttonBox.Ok)
QtTest.QTest.mouseClick(okWidget, QtCore.Qt.LeftButton)
# THEN the following values values are returned
# 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)