reworked GUI layout for the rest of the code

alignment fix for SearchEdit (visible with Clearlooks theme)
replaced capitalized variable names in touched classes
use codepage selection fallback for the ewimporter
This commit is contained in:
M2j 2011-01-05 18:53:58 +01:00
commit a6566a1f84
29 changed files with 1435 additions and 1757 deletions

View File

@ -111,7 +111,7 @@ class MediaManagerItem(QtGui.QWidget):
self.singleServiceItem = True self.singleServiceItem = True
self.pageLayout = QtGui.QVBoxLayout(self) self.pageLayout = QtGui.QVBoxLayout(self)
self.pageLayout.setSpacing(0) self.pageLayout.setSpacing(0)
self.pageLayout.setContentsMargins(4, 0, 4, 0) self.pageLayout.setMargin(0)
self.requiredIcons() self.requiredIcons()
self.setupUi() self.setupUi()
self.retranslateUi() self.retranslateUi()
@ -176,7 +176,7 @@ class MediaManagerItem(QtGui.QWidget):
# break compatability), but it makes sense for the icon to # break compatability), but it makes sense for the icon to
# come before the tooltip (as you have to have an icon, but # come before the tooltip (as you have to have an icon, but
# not neccesarily a tooltip) # not neccesarily a tooltip)
self.toolbar.addToolbarButton(title, icon, tooltip, slot, checkable) return self.toolbar.addToolbarButton(title, icon, tooltip, slot, checkable)
def addToolbarSeparator(self): def addToolbarSeparator(self):
""" """
@ -268,7 +268,6 @@ class MediaManagerItem(QtGui.QWidget):
#Add the List widget #Add the List widget
self.listView = self.ListViewWithDnD_class(self) self.listView = self.ListViewWithDnD_class(self)
self.listView.uniformItemSizes = True self.listView.uniformItemSizes = True
self.listView.setGeometry(QtCore.QRect(10, 100, 256, 591))
self.listView.setSpacing(1) self.listView.setSpacing(1)
self.listView.setSelectionMode( self.listView.setSelectionMode(
QtGui.QAbstractItemView.ExtendedSelection) QtGui.QAbstractItemView.ExtendedSelection)

View File

@ -69,7 +69,7 @@ class SearchEdit(QtGui.QLineEdit):
""" """
frameWidth = self.style().pixelMetric( frameWidth = self.style().pixelMetric(
QtGui.QStyle.PM_DefaultFrameWidth) QtGui.QStyle.PM_DefaultFrameWidth)
rightPadding = self.clearButton.sizeHint().width() + frameWidth rightPadding = self.clearButton.width() + frameWidth
if hasattr(self, u'menuButton'): if hasattr(self, u'menuButton'):
leftPadding = self.menuButton.width() leftPadding = self.menuButton.width()
self.setStyleSheet( self.setStyleSheet(
@ -81,7 +81,7 @@ class SearchEdit(QtGui.QLineEdit):
msz = self.minimumSizeHint(); msz = self.minimumSizeHint();
self.setMinimumSize( self.setMinimumSize(
max(msz.width(), max(msz.width(),
self.clearButton.sizeHint().width() + (frameWidth * 2) + 2), self.clearButton.width() + (frameWidth * 2) + 2),
max(msz.height(), max(msz.height(),
self.clearButton.height() + (frameWidth * 2) + 2) self.clearButton.height() + (frameWidth * 2) + 2)
) )
@ -93,13 +93,13 @@ class SearchEdit(QtGui.QLineEdit):
``event`` ``event``
The event that happened. The event that happened.
""" """
sz = self.clearButton.sizeHint() sz = self.clearButton.size()
frameWidth = self.style().pixelMetric( frameWidth = self.style().pixelMetric(
QtGui.QStyle.PM_DefaultFrameWidth) QtGui.QStyle.PM_DefaultFrameWidth)
self.clearButton.move(self.rect().right() - frameWidth - sz.width(), self.clearButton.move(self.rect().right() - frameWidth - sz.width(),
(self.rect().bottom() + 1 - sz.height()) / 2) (self.rect().bottom() + 1 - sz.height()) / 2)
if hasattr(self, u'menuButton'): if hasattr(self, u'menuButton'):
sz = self.menuButton.sizeHint() sz = self.menuButton.size()
self.menuButton.move(self.rect().left() + frameWidth + 2, self.menuButton.move(self.rect().left() + frameWidth + 2,
(self.rect().bottom() + 1 - sz.height()) / 2) (self.rect().bottom() + 1 - sz.height()) / 2)

View File

@ -72,27 +72,27 @@ class OpenLPToolbar(QtGui.QToolBar):
``objectname`` ``objectname``
The name of the object, as used in `<button>.setObjectName()`. The name of the object, as used in `<button>.setObjectName()`.
""" """
toolbarButton = None newAction = None
if icon: if icon:
buttonIcon = build_icon(icon) actionIcon = build_icon(icon)
if slot and not checkable: if slot and not checkable:
toolbarButton = self.addAction(buttonIcon, title, slot) newAction = self.addAction(actionIcon, title, slot)
else: else:
toolbarButton = self.addAction(buttonIcon, title) newAction = self.addAction(actionIcon, title)
self.icons[title] = buttonIcon self.icons[title] = actionIcon
else: else:
toolbarButton = QtGui.QAction(title, toolbarButton) newAction = QtGui.QAction(title, newAction)
self.addAction(toolbarButton) self.addAction(newAction)
QtCore.QObject.connect(toolbarButton, QtCore.QObject.connect(newAction,
QtCore.SIGNAL(u'triggered()'), slot) QtCore.SIGNAL(u'triggered()'), slot)
if tooltip: if tooltip:
toolbarButton.setToolTip(tooltip) newAction.setToolTip(tooltip)
if checkable: if checkable:
toolbarButton.setCheckable(True) newAction.setCheckable(True)
QtCore.QObject.connect(toolbarButton, QtCore.QObject.connect(newAction,
QtCore.SIGNAL(u'toggled(bool)'), slot) QtCore.SIGNAL(u'toggled(bool)'), slot)
self.actions[title] = toolbarButton self.actions[title] = newAction
return toolbarButton return newAction
def addToolbarSeparator(self, handle): def addToolbarSeparator(self, handle):
""" """
@ -154,4 +154,4 @@ class OpenLPToolbar(QtGui.QToolBar):
push_button.setCheckable(True) push_button.setCheckable(True)
push_button.setFlat(True) push_button.setFlat(True)
self.addWidget(push_button) self.addWidget(push_button)
return push_button return push_button

View File

@ -31,14 +31,13 @@ from openlp.core.lib import translate
class Ui_FileRenameDialog(object): class Ui_FileRenameDialog(object):
def setupUi(self, FileRenameDialog): def setupUi(self, FileRenameDialog):
FileRenameDialog.setObjectName(u'FileRenameDialog') FileRenameDialog.setObjectName(u'FileRenameDialog')
FileRenameDialog.resize(300, 10)
self.dialogLayout = QtGui.QGridLayout(FileRenameDialog) self.dialogLayout = QtGui.QGridLayout(FileRenameDialog)
self.dialogLayout.setObjectName(u'dialogLayout') self.dialogLayout.setObjectName(u'dialogLayout')
self.fileNameLabel = QtGui.QLabel(FileRenameDialog) self.fileNameLabel = QtGui.QLabel(FileRenameDialog)
self.fileNameLabel.setObjectName(u'fileNameLabel') self.fileNameLabel.setObjectName(u'fileNameLabel')
self.dialogLayout.addWidget(self.fileNameLabel, 0, 0) self.dialogLayout.addWidget(self.fileNameLabel, 0, 0)
self.fileNameEdit = QtGui.QLineEdit(FileRenameDialog) self.fileNameEdit = QtGui.QLineEdit(FileRenameDialog)
self.fileNameEdit.resize(self.fileNameEdit.sizeHint().width() * 2,
self.fileNameEdit.sizeHint().height())
self.fileNameEdit.setObjectName(u'fileNameEdit') self.fileNameEdit.setObjectName(u'fileNameEdit')
self.dialogLayout.addWidget(self.fileNameEdit, 0, 1) self.dialogLayout.addWidget(self.fileNameEdit, 0, 1)
self.buttonBox = QtGui.QDialogButtonBox(FileRenameDialog) self.buttonBox = QtGui.QDialogButtonBox(FileRenameDialog)

View File

@ -370,7 +370,7 @@ class ServiceManager(QtGui.QWidget):
translate('OpenLP.ServiceManager', 'Open File'), translate('OpenLP.ServiceManager', 'Open File'),
SettingsManager.get_last_dir(self.parent.serviceSettingsSection), SettingsManager.get_last_dir(self.parent.serviceSettingsSection),
translate('OpenLP.ServiceManager', translate('OpenLP.ServiceManager',
'OpenLP Service Files (*.osz) (*.osz)'))) 'OpenLP Service Files (*.osz)')))
if not fileName: if not fileName:
return False return False
SettingsManager.set_last_dir(self.parent.serviceSettingsSection, SettingsManager.set_last_dir(self.parent.serviceSettingsSection,
@ -460,7 +460,7 @@ class ServiceManager(QtGui.QWidget):
translate('OpenLP.ServiceManager', 'Save Service'), translate('OpenLP.ServiceManager', 'Save Service'),
SettingsManager.get_last_dir(self.parent.serviceSettingsSection), SettingsManager.get_last_dir(self.parent.serviceSettingsSection),
translate('OpenLP.ServiceManager', translate('OpenLP.ServiceManager',
'OpenLP Service Files (*.osz) (*.osz)'))) 'OpenLP Service Files (*.osz)')))
if not fileName: if not fileName:
return False return False
if os.path.splitext(fileName)[1] == u'': if os.path.splitext(fileName)[1] == u'':

View File

@ -29,115 +29,81 @@ from PyQt4 import QtCore, QtGui
from openlp.core.lib import build_icon, translate from openlp.core.lib import build_icon, translate
class Ui_AlertDialog(object): class Ui_AlertDialog(object):
def setupUi(self, AlertDialog): def setupUi(self, alertDialog):
AlertDialog.setObjectName(u'AlertDialog') alertDialog.setObjectName(u'alertDialog')
AlertDialog.resize(567, 440) alertDialog.resize(400, 300)
AlertDialog.setWindowIcon(build_icon(u':/icon/openlp.org-icon-32.bmp')) alertDialog.setWindowIcon(build_icon(u':/icon/openlp.org-icon-32.bmp'))
self.AlertDialogLayout = QtGui.QVBoxLayout(AlertDialog) self.alertDialogLayout = QtGui.QGridLayout(alertDialog)
self.AlertDialogLayout.setSpacing(8) self.alertDialogLayout.setObjectName(u'alertDialogLayout')
self.AlertDialogLayout.setMargin(8) self.alertTextLayout = QtGui.QFormLayout()
self.AlertDialogLayout.setObjectName(u'AlertDialogLayout') self.alertTextLayout.setObjectName(u'alertTextLayout')
self.AlertTextLayout = QtGui.QFormLayout() self.alertEntryLabel = QtGui.QLabel(alertDialog)
self.AlertTextLayout.setContentsMargins(0, 0, -1, -1) self.alertEntryLabel.setObjectName(u'alertEntryLabel')
self.AlertTextLayout.setSpacing(8) self.alertTextEdit = QtGui.QLineEdit(alertDialog)
self.AlertTextLayout.setObjectName(u'AlertTextLayout') self.alertTextEdit.setObjectName(u'alertTextEdit')
self.AlertEntryLabel = QtGui.QLabel(AlertDialog) self.alertEntryLabel.setBuddy(self.alertTextEdit)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, self.alertTextLayout.addRow(self.alertEntryLabel, self.alertTextEdit)
QtGui.QSizePolicy.Fixed) self.alertParameter = QtGui.QLabel(alertDialog)
sizePolicy.setHorizontalStretch(0) self.alertParameter.setObjectName(u'alertParameter')
sizePolicy.setVerticalStretch(0) self.parameterEdit = QtGui.QLineEdit(alertDialog)
sizePolicy.setHeightForWidth( self.parameterEdit.setObjectName(u'parameterEdit')
self.AlertEntryLabel.sizePolicy().hasHeightForWidth()) self.alertParameter.setBuddy(self.parameterEdit)
self.AlertEntryLabel.setSizePolicy(sizePolicy) self.alertTextLayout.addRow(self.alertParameter, self.parameterEdit)
self.AlertEntryLabel.setObjectName(u'AlertEntryLabel') self.alertDialogLayout.addLayout(self.alertTextLayout, 0, 0, 1, 2)
self.AlertTextLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.alertListWidget = QtGui.QListWidget(alertDialog)
self.AlertEntryLabel) self.alertListWidget.setAlternatingRowColors(True)
self.AlertParameter = QtGui.QLabel(AlertDialog) self.alertListWidget.setObjectName(u'alertListWidget')
self.AlertParameter.setObjectName(u'AlertParameter') self.alertDialogLayout.addWidget(self.alertListWidget, 1, 0)
self.AlertTextLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.manageButtonLayout = QtGui.QVBoxLayout()
self.AlertParameter) self.manageButtonLayout.setObjectName(u'manageButtonLayout')
self.ParameterEdit = QtGui.QLineEdit(AlertDialog) self.newButton = QtGui.QPushButton(alertDialog)
self.ParameterEdit.setObjectName(u'ParameterEdit') self.newButton.setIcon(build_icon(u':/general/general_new.png'))
self.AlertTextLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.newButton.setObjectName(u'newButton')
self.ParameterEdit) self.manageButtonLayout.addWidget(self.newButton)
self.AlertTextEdit = QtGui.QLineEdit(AlertDialog) self.saveButton = QtGui.QPushButton(alertDialog)
self.AlertTextEdit.setObjectName(u'AlertTextEdit') self.saveButton.setEnabled(False)
self.AlertTextLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.saveButton.setIcon(build_icon(u':/general/general_save.png'))
self.AlertTextEdit) self.saveButton.setObjectName(u'saveButton')
self.AlertDialogLayout.addLayout(self.AlertTextLayout) self.manageButtonLayout.addWidget(self.saveButton)
self.ManagementLayout = QtGui.QHBoxLayout() self.deleteButton = QtGui.QPushButton(alertDialog)
self.ManagementLayout.setSpacing(8) self.deleteButton.setIcon(build_icon(u':/general/general_delete.png'))
self.ManagementLayout.setContentsMargins(-1, -1, -1, 0) self.deleteButton.setObjectName(u'deleteButton')
self.ManagementLayout.setObjectName(u'ManagementLayout') self.manageButtonLayout.addWidget(self.deleteButton)
self.AlertListWidget = QtGui.QListWidget(AlertDialog) self.manageButtonLayout.addStretch()
self.AlertListWidget.setAlternatingRowColors(True) self.alertDialogLayout.addLayout(self.manageButtonLayout, 1, 1)
self.AlertListWidget.setObjectName(u'AlertListWidget') self.buttonBox = QtGui.QDialogButtonBox(alertDialog)
self.ManagementLayout.addWidget(self.AlertListWidget) self.buttonBox.addButton(QtGui.QDialogButtonBox.Close)
self.ManageButtonLayout = QtGui.QVBoxLayout()
self.ManageButtonLayout.setSpacing(8)
self.ManageButtonLayout.setObjectName(u'ManageButtonLayout')
self.NewButton = QtGui.QPushButton(AlertDialog)
self.NewButton.setIcon(build_icon(u':/general/general_new.png'))
self.NewButton.setObjectName(u'NewButton')
self.ManageButtonLayout.addWidget(self.NewButton)
self.SaveButton = QtGui.QPushButton(AlertDialog)
self.SaveButton.setEnabled(False)
self.SaveButton.setIcon(build_icon(u':/general/general_save.png'))
self.SaveButton.setObjectName(u'SaveButton')
self.ManageButtonLayout.addWidget(self.SaveButton)
self.DeleteButton = QtGui.QPushButton(AlertDialog)
self.DeleteButton.setIcon(build_icon(u':/general/general_delete.png'))
self.DeleteButton.setObjectName(u'DeleteButton')
self.ManageButtonLayout.addWidget(self.DeleteButton)
spacerItem = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum,
QtGui.QSizePolicy.Expanding)
self.ManageButtonLayout.addItem(spacerItem)
self.ManagementLayout.addLayout(self.ManageButtonLayout)
self.AlertDialogLayout.addLayout(self.ManagementLayout)
self.AlertButtonLayout = QtGui.QHBoxLayout()
self.AlertButtonLayout.setSpacing(8)
self.AlertButtonLayout.setObjectName(u'AlertButtonLayout')
spacerItem1 = QtGui.QSpacerItem(181, 0, QtGui.QSizePolicy.Expanding,
QtGui.QSizePolicy.Minimum)
self.AlertButtonLayout.addItem(spacerItem1)
displayIcon = build_icon(u':/general/general_live.png') displayIcon = build_icon(u':/general/general_live.png')
self.DisplayButton = QtGui.QPushButton(AlertDialog) self.displayButton = QtGui.QPushButton(alertDialog)
self.DisplayButton.setIcon(displayIcon) self.displayButton.setIcon(displayIcon)
self.DisplayButton.setObjectName(u'DisplayButton') self.displayButton.setObjectName(u'displayButton')
self.AlertButtonLayout.addWidget(self.DisplayButton) self.buttonBox.addButton(self.displayButton,
self.DisplayCloseButton = QtGui.QPushButton(AlertDialog) QtGui.QDialogButtonBox.ActionRole)
self.DisplayCloseButton.setIcon(displayIcon) self.displayCloseButton = QtGui.QPushButton(alertDialog)
self.DisplayCloseButton.setObjectName(u'DisplayCloseButton') self.displayCloseButton.setIcon(displayIcon)
self.AlertButtonLayout.addWidget(self.DisplayCloseButton) self.displayCloseButton.setObjectName(u'displayCloseButton')
self.CloseButton = QtGui.QPushButton(AlertDialog) self.buttonBox.addButton(self.displayCloseButton,
self.CloseButton.setIcon(build_icon(u':/system/system_close.png')) QtGui.QDialogButtonBox.ActionRole)
self.CloseButton.setObjectName(u'CloseButton') self.alertDialogLayout.addWidget(self.buttonBox, 2, 0, 1, 2)
self.AlertButtonLayout.addWidget(self.CloseButton) self.retranslateUi(alertDialog)
self.AlertDialogLayout.addLayout(self.AlertButtonLayout) QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(u'rejected()'),
self.AlertEntryLabel.setBuddy(self.AlertTextEdit) alertDialog.close)
self.AlertParameter.setBuddy(self.ParameterEdit) QtCore.QMetaObject.connectSlotsByName(alertDialog)
self.retranslateUi(AlertDialog) def retranslateUi(self, alertDialog):
QtCore.QObject.connect(self.CloseButton, QtCore.SIGNAL(u'clicked()'), alertDialog.setWindowTitle(
AlertDialog.close)
QtCore.QMetaObject.connectSlotsByName(AlertDialog)
def retranslateUi(self, AlertDialog):
AlertDialog.setWindowTitle(
translate('AlertsPlugin.AlertForm', 'Alert Message')) translate('AlertsPlugin.AlertForm', 'Alert Message'))
self.AlertEntryLabel.setText( self.alertEntryLabel.setText(
translate('AlertsPlugin.AlertForm', 'Alert &text:')) translate('AlertsPlugin.AlertForm', 'Alert &text:'))
self.AlertParameter.setText( self.alertParameter.setText(
translate('AlertsPlugin.AlertForm', '&Parameter:')) translate('AlertsPlugin.AlertForm', '&Parameter:'))
self.NewButton.setText( self.newButton.setText(
translate('AlertsPlugin.AlertForm', '&New')) translate('AlertsPlugin.AlertForm', '&New'))
self.SaveButton.setText( self.saveButton.setText(
translate('AlertsPlugin.AlertForm', '&Save')) translate('AlertsPlugin.AlertForm', '&Save'))
self.DeleteButton.setText( self.deleteButton.setText(
translate('AlertsPlugin.AlertForm', '&Delete')) translate('AlertsPlugin.AlertForm', '&Delete'))
self.DisplayButton.setText( self.displayButton.setText(
translate('AlertsPlugin.AlertForm', 'Displ&ay')) translate('AlertsPlugin.AlertForm', 'Displ&ay'))
self.DisplayCloseButton.setText( self.displayCloseButton.setText(
translate('AlertsPlugin.AlertForm', 'Display && Cl&ose')) translate('AlertsPlugin.AlertForm', 'Display && Cl&ose'))
self.CloseButton.setText(
translate('AlertsPlugin.AlertForm', '&Close'))

View File

@ -44,62 +44,62 @@ class AlertForm(QtGui.QDialog, Ui_AlertDialog):
self.item_id = None self.item_id = None
QtGui.QDialog.__init__(self, plugin.formparent) QtGui.QDialog.__init__(self, plugin.formparent)
self.setupUi(self) self.setupUi(self)
QtCore.QObject.connect(self.DisplayButton, QtCore.SIGNAL(u'clicked()'), QtCore.QObject.connect(self.displayButton, QtCore.SIGNAL(u'clicked()'),
self.onDisplayClicked) self.onDisplayClicked)
QtCore.QObject.connect(self.DisplayCloseButton, QtCore.QObject.connect(self.displayCloseButton,
QtCore.SIGNAL(u'clicked()'), self.onDisplayCloseClicked) QtCore.SIGNAL(u'clicked()'), self.onDisplayCloseClicked)
QtCore.QObject.connect(self.AlertTextEdit, QtCore.QObject.connect(self.alertTextEdit,
QtCore.SIGNAL(u'textChanged(const QString&)'), self.onTextChanged) QtCore.SIGNAL(u'textChanged(const QString&)'), self.onTextChanged)
QtCore.QObject.connect(self.NewButton, QtCore.SIGNAL(u'clicked()'), QtCore.QObject.connect(self.newButton, QtCore.SIGNAL(u'clicked()'),
self.onNewClick) self.onNewClick)
QtCore.QObject.connect(self.DeleteButton, QtCore.SIGNAL(u'clicked()'), QtCore.QObject.connect(self.deleteButton, QtCore.SIGNAL(u'clicked()'),
self.onDeleteClick) self.onDeleteClick)
QtCore.QObject.connect(self.SaveButton, QtCore.SIGNAL(u'clicked()'), QtCore.QObject.connect(self.saveButton, QtCore.SIGNAL(u'clicked()'),
self.onSaveClick) self.onSaveClick)
QtCore.QObject.connect(self.AlertListWidget, QtCore.QObject.connect(self.alertListWidget,
QtCore.SIGNAL(u'doubleClicked(QModelIndex)'), self.onDoubleClick) QtCore.SIGNAL(u'doubleClicked(QModelIndex)'), self.onDoubleClick)
QtCore.QObject.connect(self.AlertListWidget, QtCore.QObject.connect(self.alertListWidget,
QtCore.SIGNAL(u'clicked(QModelIndex)'), self.onSingleClick) QtCore.SIGNAL(u'clicked(QModelIndex)'), self.onSingleClick)
def loadList(self): def loadList(self):
""" """
Loads the list with alerts. Loads the list with alerts.
""" """
self.AlertListWidget.clear() self.alertListWidget.clear()
alerts = self.manager.get_all_objects(AlertItem, alerts = self.manager.get_all_objects(AlertItem,
order_by_ref=AlertItem.text) order_by_ref=AlertItem.text)
for alert in alerts: for alert in alerts:
item_name = QtGui.QListWidgetItem(alert.text) item_name = QtGui.QListWidgetItem(alert.text)
item_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(alert.id)) item_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(alert.id))
self.AlertListWidget.addItem(item_name) self.alertListWidget.addItem(item_name)
self.SaveButton.setEnabled(False) self.saveButton.setEnabled(False)
self.DeleteButton.setEnabled(False) self.deleteButton.setEnabled(False)
def onDisplayClicked(self): def onDisplayClicked(self):
if self.triggerAlert(unicode(self.AlertTextEdit.text())): if self.triggerAlert(unicode(self.alertTextEdit.text())):
self.loadList() self.loadList()
def onDisplayCloseClicked(self): def onDisplayCloseClicked(self):
if self.triggerAlert(unicode(self.AlertTextEdit.text())): if self.triggerAlert(unicode(self.alertTextEdit.text())):
self.close() self.close()
def onDeleteClick(self): def onDeleteClick(self):
""" """
Deletes the selected item. Deletes the selected item.
""" """
item = self.AlertListWidget.currentItem() item = self.alertListWidget.currentItem()
if item: if item:
item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0] item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
self.manager.delete_object(AlertItem, item_id) self.manager.delete_object(AlertItem, item_id)
row = self.AlertListWidget.row(item) row = self.alertListWidget.row(item)
self.AlertListWidget.takeItem(row) self.alertListWidget.takeItem(row)
self.item_id = None self.item_id = None
self.AlertTextEdit.setText(u'') self.alertTextEdit.setText(u'')
self.SaveButton.setEnabled(False) self.saveButton.setEnabled(False)
self.DeleteButton.setEnabled(False) self.deleteButton.setEnabled(False)
def onNewClick(self): def onNewClick(self):
if len(self.AlertTextEdit.text()) == 0: if len(self.alertTextEdit.text()) == 0:
QtGui.QMessageBox.information(self, QtGui.QMessageBox.information(self,
translate('AlertsPlugin.AlertForm', 'New Alert'), translate('AlertsPlugin.AlertForm', 'New Alert'),
translate('AlertsPlugin.AlertForm', 'You haven\'t specified ' translate('AlertsPlugin.AlertForm', 'You haven\'t specified '
@ -107,9 +107,9 @@ class AlertForm(QtGui.QDialog, Ui_AlertDialog):
'clicking New.')) 'clicking New.'))
else: else:
alert = AlertItem() alert = AlertItem()
alert.text = unicode(self.AlertTextEdit.text()) alert.text = unicode(self.alertTextEdit.text())
self.manager.save_object(alert) self.manager.save_object(alert)
self.AlertTextEdit.setText(u'') self.alertTextEdit.setText(u'')
self.loadList() self.loadList()
def onSaveClick(self): def onSaveClick(self):
@ -118,7 +118,7 @@ class AlertForm(QtGui.QDialog, Ui_AlertDialog):
""" """
if self.item_id: if self.item_id:
alert = self.manager.get_object(AlertItem, self.item_id) alert = self.manager.get_object(AlertItem, self.item_id)
alert.text = unicode(self.AlertTextEdit.text()) alert.text = unicode(self.alertTextEdit.text())
self.manager.save_object(alert) self.manager.save_object(alert)
self.item_id = None self.item_id = None
self.loadList() self.loadList()
@ -129,36 +129,36 @@ class AlertForm(QtGui.QDialog, Ui_AlertDialog):
""" """
# Only enable the button, if we are editing an item. # Only enable the button, if we are editing an item.
if self.item_id: if self.item_id:
self.SaveButton.setEnabled(True) self.saveButton.setEnabled(True)
def onDoubleClick(self): def onDoubleClick(self):
""" """
List item has been double clicked to display it List item has been double clicked to display it
""" """
items = self.AlertListWidget.selectedIndexes() items = self.alertListWidget.selectedIndexes()
for item in items: for item in items:
bitem = self.AlertListWidget.item(item.row()) bitem = self.alertListWidget.item(item.row())
self.triggerAlert(unicode(bitem.text())) self.triggerAlert(unicode(bitem.text()))
self.AlertTextEdit.setText(unicode(bitem.text())) self.alertTextEdit.setText(unicode(bitem.text()))
self.item_id = (bitem.data(QtCore.Qt.UserRole)).toInt()[0] self.item_id = (bitem.data(QtCore.Qt.UserRole)).toInt()[0]
self.SaveButton.setEnabled(False) self.saveButton.setEnabled(False)
self.DeleteButton.setEnabled(True) self.deleteButton.setEnabled(True)
def onSingleClick(self): def onSingleClick(self):
""" """
List item has been single clicked to add it to List item has been single clicked to add it to
the edit field so it can be changed. the edit field so it can be changed.
""" """
items = self.AlertListWidget.selectedIndexes() items = self.alertListWidget.selectedIndexes()
for item in items: for item in items:
bitem = self.AlertListWidget.item(item.row()) bitem = self.alertListWidget.item(item.row())
self.AlertTextEdit.setText(unicode(bitem.text())) self.alertTextEdit.setText(unicode(bitem.text()))
self.item_id = (bitem.data(QtCore.Qt.UserRole)).toInt()[0] self.item_id = (bitem.data(QtCore.Qt.UserRole)).toInt()[0]
# If the alert does not contain '<>' we clear the ParameterEdit field. # If the alert does not contain '<>' we clear the ParameterEdit field.
if unicode(self.AlertTextEdit.text()).find(u'<>') == -1: if unicode(self.alertTextEdit.text()).find(u'<>') == -1:
self.ParameterEdit.setText(u'') self.parameterEdit.setText(u'')
self.SaveButton.setEnabled(False) self.saveButton.setEnabled(False)
self.DeleteButton.setEnabled(True) self.deleteButton.setEnabled(True)
def triggerAlert(self, text): def triggerAlert(self, text):
""" """
@ -170,27 +170,27 @@ class AlertForm(QtGui.QDialog, Ui_AlertDialog):
if text: if text:
# We found '<>' in the alert text, but the ParameterEdit field is # We found '<>' in the alert text, but the ParameterEdit field is
# empty. # empty.
if text.find(u'<>') != -1 and not self.ParameterEdit.text() and \ if text.find(u'<>') != -1 and not self.parameterEdit.text() and \
QtGui.QMessageBox.question(self, QtGui.QMessageBox.question(self,
translate('AlertPlugin.AlertForm', 'No Parameter found'), translate('AlertPlugin.AlertForm', 'No Parameter found'),
translate('AlertPlugin.AlertForm', 'You have not entered a ' translate('AlertPlugin.AlertForm', 'You have not entered a '
'parameter to be replaced.\nDo you want to continue anyway?'), 'parameter to be replaced.\nDo you want to continue anyway?'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.No | QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.No |
QtGui.QMessageBox.Yes)) == QtGui.QMessageBox.No: QtGui.QMessageBox.Yes)) == QtGui.QMessageBox.No:
self.ParameterEdit.setFocus() self.parameterEdit.setFocus()
return False return False
# The ParameterEdit field is not empty, but we have not found '<>' # The ParameterEdit field is not empty, but we have not found '<>'
# in the alert text. # in the alert text.
elif text.find(u'<>') == -1 and self.ParameterEdit.text() and \ elif text.find(u'<>') == -1 and self.parameterEdit.text() and \
QtGui.QMessageBox.question(self, QtGui.QMessageBox.question(self,
translate('AlertPlugin.AlertForm', 'No Placeholder found'), translate('AlertPlugin.AlertForm', 'No Placeholder found'),
translate('AlertPlugin.AlertForm', 'The alert text does not' translate('AlertPlugin.AlertForm', 'The alert text does not'
' contain \'<>\'.\nDo want to continue anyway?'), ' contain \'<>\'.\nDo want to continue anyway?'),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.No | QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.No |
QtGui.QMessageBox.Yes)) == QtGui.QMessageBox.No: QtGui.QMessageBox.Yes)) == QtGui.QMessageBox.No:
self.ParameterEdit.setFocus() self.parameterEdit.setFocus()
return False return False
text = text.replace(u'<>', unicode(self.ParameterEdit.text())) text = text.replace(u'<>', unicode(self.parameterEdit.text()))
self.parent.alertsmanager.displayAlert(text) self.parent.alertsmanager.displayAlert(text)
return True return True
return False return False

View File

@ -56,8 +56,6 @@ class BibleMediaItem(MediaManagerItem):
log.info(u'Bible Media Item loaded') log.info(u'Bible Media Item loaded')
def __init__(self, parent, plugin, icon): def __init__(self, parent, plugin, icon):
self.PluginNameShort = u'Bible'
self.pluginNameVisible = translate('BiblesPlugin.MediaItem', 'Bible')
self.IconPath = u'songs/song' self.IconPath = u'songs/song'
self.ListViewWithDnD_class = BibleListView self.ListViewWithDnD_class = BibleListView
MediaManagerItem.__init__(self, parent, plugin, icon) MediaManagerItem.__init__(self, parent, plugin, icon)
@ -76,184 +74,178 @@ class BibleMediaItem(MediaManagerItem):
self.addToServiceItem = False self.addToServiceItem = False
def addEndHeaderBar(self): def addEndHeaderBar(self):
self.SearchTabWidget = QtGui.QTabWidget(self) self.searchTabWidget = QtGui.QTabWidget(self)
sizePolicy = QtGui.QSizePolicy( self.searchTabWidget.setSizePolicy(
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Minimum)
sizePolicy.setHorizontalStretch(0) self.searchTabWidget.setObjectName(u'SearchTabWidget')
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(
self.SearchTabWidget.sizePolicy().hasHeightForWidth())
self.SearchTabWidget.setSizePolicy(sizePolicy)
self.SearchTabWidget.setObjectName(u'SearchTabWidget')
# Add the Quick Search tab. # Add the Quick Search tab.
self.QuickTab = QtGui.QWidget() self.quickTab = QtGui.QWidget()
self.QuickTab.setObjectName(u'QuickTab') self.quickTab.setObjectName(u'quickTab')
self.QuickLayout = QtGui.QGridLayout(self.QuickTab) self.quickLayout = QtGui.QFormLayout(self.quickTab)
self.QuickLayout.setMargin(2) self.quickLayout.setObjectName(u'quickLayout')
self.QuickLayout.setSpacing(4) self.quickVersionLabel = QtGui.QLabel(self.quickTab)
self.QuickLayout.setVerticalSpacing(4) self.quickVersionLabel.setObjectName(u'quickVersionLabel')
self.QuickLayout.setObjectName(u'QuickLayout') self.quickVersionComboBox = QtGui.QComboBox(self.quickTab)
self.QuickVersionLabel = QtGui.QLabel(self.QuickTab) self.quickVersionComboBox.setSizePolicy(
self.QuickVersionLabel.setObjectName(u'QuickVersionLabel') QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
self.QuickLayout.addWidget(self.QuickVersionLabel, 0, 0, 1, 1) self.quickVersionComboBox.setObjectName(u'quickVersionComboBox')
self.QuickVersionComboBox = QtGui.QComboBox(self.QuickTab) self.quickVersionLabel.setBuddy(self.quickVersionComboBox)
self.QuickVersionComboBox.setSizeAdjustPolicy( self.quickLayout.addRow(self.quickVersionLabel,
QtGui.QComboBox.AdjustToMinimumContentsLength) self.quickVersionComboBox)
self.QuickVersionComboBox.setObjectName(u'VersionComboBox') self.quickSecondLabel = QtGui.QLabel(self.quickTab)
self.QuickLayout.addWidget(self.QuickVersionComboBox, 0, 1, 1, 2) self.quickSecondLabel.setObjectName(u'quickSecondLabel')
self.QuickSecondVersionLabel = QtGui.QLabel(self.QuickTab) self.quickSecondComboBox = QtGui.QComboBox(self.quickTab)
self.QuickSecondVersionLabel.setObjectName(u'QuickSecondVersionLabel') self.quickSecondComboBox.setSizePolicy(
self.QuickLayout.addWidget(self.QuickSecondVersionLabel, 1, 0, 1, 1) QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
self.QuickSecondBibleComboBox = QtGui.QComboBox(self.QuickTab) self.quickSecondComboBox.setObjectName(u'quickSecondComboBox')
self.QuickSecondBibleComboBox.setSizeAdjustPolicy( self.quickSecondLabel.setBuddy(self.quickSecondComboBox)
QtGui.QComboBox.AdjustToMinimumContentsLength) self.quickLayout.addRow(self.quickSecondLabel, self.quickSecondComboBox)
self.QuickSecondBibleComboBox.setObjectName(u'SecondBible') self.quickSearchTypeLabel = QtGui.QLabel(self.quickTab)
self.QuickLayout.addWidget(self.QuickSecondBibleComboBox, 1, 1, 1, 2) self.quickSearchTypeLabel.setObjectName(u'quickSearchTypeLabel')
self.QuickSearchLabel = QtGui.QLabel(self.QuickTab) self.quickSearchComboBox = QtGui.QComboBox(self.quickTab)
self.QuickSearchLabel.setObjectName(u'QuickSearchLabel') self.quickSearchComboBox.setSizePolicy(
self.QuickLayout.addWidget(self.QuickSearchLabel, 2, 0, 1, 1) QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
self.QuickSearchComboBox = QtGui.QComboBox(self.QuickTab) self.quickSearchComboBox.setObjectName(u'quickSearchComboBox')
self.QuickSearchComboBox.setObjectName(u'SearchComboBox') self.quickSearchTypeLabel.setBuddy(self.quickSearchComboBox)
self.QuickLayout.addWidget(self.QuickSearchComboBox, 2, 1, 1, 2) self.quickLayout.addRow(self.quickSearchTypeLabel,
self.QuickSearchLabel = QtGui.QLabel(self.QuickTab) self.quickSearchComboBox)
self.QuickSearchLabel.setObjectName(u'QuickSearchLabel') self.quickSearchLabel = QtGui.QLabel(self.quickTab)
self.QuickLayout.addWidget(self.QuickSearchLabel, 3, 0, 1, 1) self.quickSearchLabel.setObjectName(u'quickSearchLabel')
self.QuickSearchEdit = QtGui.QLineEdit(self.QuickTab) self.quickSearchEdit = QtGui.QLineEdit(self.quickTab)
self.QuickSearchEdit.setObjectName(u'QuickSearchEdit') self.quickSearchEdit.setObjectName(u'quickSearchEdit')
self.QuickLayout.addWidget(self.QuickSearchEdit, 3, 1, 1, 2) self.quickSearchLabel.setBuddy(self.quickSearchEdit)
self.QuickClearLabel = QtGui.QLabel(self.QuickTab) self.quickLayout.addRow(self.quickSearchLabel, self.quickSearchEdit)
self.QuickClearLabel.setObjectName(u'QuickSearchLabel') self.quickClearLabel = QtGui.QLabel(self.quickTab)
self.QuickLayout.addWidget(self.QuickClearLabel, 4, 0, 1, 1) self.quickClearLabel.setObjectName(u'quickClearLabel')
self.ClearQuickSearchComboBox = QtGui.QComboBox(self.QuickTab) self.quickClearComboBox = QtGui.QComboBox(self.quickTab)
self.ClearQuickSearchComboBox.setObjectName(u'ClearQuickSearchComboBox') self.quickClearComboBox.setSizePolicy(
self.QuickLayout.addWidget(self.ClearQuickSearchComboBox, 4, 1, 1, 2) QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
self.QuickSearchButtonLayout = QtGui.QHBoxLayout() self.quickClearComboBox.setObjectName(u'quickClearComboBox')
self.QuickSearchButtonLayout.setMargin(0) self.quickLayout.addRow(self.quickClearLabel, self.quickClearComboBox)
self.QuickSearchButtonLayout.setSpacing(0) self.quickSearchButtonLayout = QtGui.QHBoxLayout()
self.QuickSearchButtonLayout.setObjectName(u'QuickSearchButtonLayout') self.quickSearchButtonLayout.setObjectName(u'quickSearchButtonLayout')
self.QuickSearchButtonSpacer = QtGui.QSpacerItem(40, 20, self.quickSearchButtonLayout.addStretch()
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.quickSearchButton = QtGui.QPushButton(self.quickTab)
self.QuickSearchButtonLayout.addItem(self.QuickSearchButtonSpacer) self.quickSearchButton.setObjectName(u'quickSearchButton')
self.QuickSearchButton = QtGui.QPushButton(self.QuickTab) self.quickSearchButtonLayout.addWidget(self.quickSearchButton)
self.QuickSearchButton.setObjectName(u'QuickSearchButton') self.quickLayout.addRow(self.quickSearchButtonLayout)
self.QuickSearchButtonLayout.addWidget(self.QuickSearchButton) self.quickMessage = QtGui.QLabel(self.quickTab)
self.QuickLayout.addLayout(self.QuickSearchButtonLayout, 5, 0, 1, 3) self.quickMessage.setObjectName(u'quickMessage')
self.QuickMessage = QtGui.QLabel(self.QuickTab) self.quickLayout.addRow(self.quickMessage)
self.QuickMessage.setObjectName(u'QuickMessage') self.searchTabWidget.addTab(self.quickTab,
self.QuickLayout.addWidget(self.QuickMessage, 6, 0, 1, 3)
self.SearchTabWidget.addTab(self.QuickTab,
translate('BiblesPlugin.MediaItem', 'Quick')) translate('BiblesPlugin.MediaItem', 'Quick'))
QuickSpacerItem = QtGui.QSpacerItem(20, 35, QtGui.QSizePolicy.Minimum,
QtGui.QSizePolicy.Expanding)
self.QuickLayout.addItem(QuickSpacerItem, 6, 2, 1, 1)
# Add the Advanced Search tab. # Add the Advanced Search tab.
self.AdvancedTab = QtGui.QWidget() self.advancedTab = QtGui.QWidget()
self.AdvancedTab.setObjectName(u'AdvancedTab') self.advancedTab.setObjectName(u'advancedTab')
self.AdvancedLayout = QtGui.QGridLayout(self.AdvancedTab) self.advancedLayout = QtGui.QGridLayout(self.advancedTab)
self.AdvancedLayout.setMargin(2) self.advancedLayout.setObjectName(u'advancedLayout')
self.AdvancedLayout.setSpacing(4) self.advancedVersionLabel = QtGui.QLabel(self.advancedTab)
self.AdvancedLayout.setVerticalSpacing(4) self.advancedVersionLabel.setObjectName(u'advancedVersionLabel')
self.AdvancedLayout.setObjectName(u'AdvancedLayout') self.advancedLayout.addWidget(self.advancedVersionLabel, 0, 0,
self.AdvancedVersionLabel = QtGui.QLabel(self.AdvancedTab) QtCore.Qt.AlignRight)
self.AdvancedVersionLabel.setObjectName(u'AdvancedVersionLabel') self.advancedVersionComboBox = QtGui.QComboBox(self.advancedTab)
self.AdvancedLayout.addWidget(self.AdvancedVersionLabel, 0, 0, 1, 1) self.advancedVersionComboBox.setSizePolicy(
self.AdvancedVersionComboBox = QtGui.QComboBox(self.AdvancedTab) QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
self.AdvancedVersionComboBox.setSizeAdjustPolicy( self.advancedVersionComboBox.setObjectName(u'advancedVersionComboBox')
QtGui.QComboBox.AdjustToMinimumContentsLength) self.advancedVersionLabel.setBuddy(self.advancedVersionComboBox)
self.AdvancedVersionComboBox.setObjectName(u'AdvancedVersionComboBox') self.advancedLayout.addWidget(self.advancedVersionComboBox, 0, 1, 1, 2)
self.AdvancedLayout.addWidget(self.AdvancedVersionComboBox, 0, 1, 1, 2) self.advancedSecondLabel = QtGui.QLabel(self.advancedTab)
self.AdvancedSecondBibleLabel = QtGui.QLabel(self.AdvancedTab) self.advancedSecondLabel.setObjectName(u'advancedSecondLabel')
self.AdvancedSecondBibleLabel.setObjectName(u'AdvancedSecondBibleLabel') self.advancedLayout.addWidget(self.advancedSecondLabel, 1, 0,
self.AdvancedLayout.addWidget(self.AdvancedSecondBibleLabel, 1, 0, 1, 1) QtCore.Qt.AlignRight)
self.AdvancedSecondBibleComboBox = QtGui.QComboBox(self.AdvancedTab) self.advancedSecondComboBox = QtGui.QComboBox(self.advancedTab)
self.AdvancedSecondBibleComboBox.setSizeAdjustPolicy( self.advancedSecondComboBox.setSizePolicy(
QtGui.QComboBox.AdjustToMinimumContentsLength) QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
self.AdvancedSecondBibleComboBox.setObjectName( self.advancedSecondComboBox.setObjectName(u'advancedSecondComboBox')
u'AdvancedSecondBibleComboBox') self.advancedSecondLabel.setBuddy(self.advancedSecondComboBox)
self.AdvancedLayout.addWidget( self.advancedLayout.addWidget(self.advancedSecondComboBox, 1, 1, 1, 2)
self.AdvancedSecondBibleComboBox, 1, 1, 1, 2) self.advancedBookLabel = QtGui.QLabel(self.advancedTab)
self.AdvancedBookLabel = QtGui.QLabel(self.AdvancedTab) self.advancedBookLabel.setObjectName(u'advancedBookLabel')
self.AdvancedBookLabel.setObjectName(u'AdvancedBookLabel') self.advancedLayout.addWidget(self.advancedBookLabel, 2, 0,
self.AdvancedLayout.addWidget(self.AdvancedBookLabel, 2, 0, 1, 1) QtCore.Qt.AlignRight)
self.AdvancedBookComboBox = QtGui.QComboBox(self.AdvancedTab) self.advancedBookComboBox = QtGui.QComboBox(self.advancedTab)
self.AdvancedBookComboBox.setObjectName(u'AdvancedBookComboBox') self.advancedBookComboBox.setSizePolicy(
self.AdvancedLayout.addWidget(self.AdvancedBookComboBox, 2, 1, 1, 2) QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
self.AdvancedChapterLabel = QtGui.QLabel(self.AdvancedTab) self.advancedBookComboBox.setObjectName(u'advancedBookComboBox')
self.AdvancedChapterLabel.setObjectName(u'AdvancedChapterLabel') self.advancedBookLabel.setBuddy(self.advancedBookComboBox)
self.AdvancedLayout.addWidget(self.AdvancedChapterLabel, 3, 1, 1, 1) self.advancedLayout.addWidget(self.advancedBookComboBox, 2, 1, 1, 2)
self.AdvancedVerseLabel = QtGui.QLabel(self.AdvancedTab) self.advancedChapterLabel = QtGui.QLabel(self.advancedTab)
self.AdvancedVerseLabel.setObjectName(u'AdvancedVerseLabel') self.advancedChapterLabel.setObjectName(u'advancedChapterLabel')
self.AdvancedLayout.addWidget(self.AdvancedVerseLabel, 3, 2, 1, 1) self.advancedLayout.addWidget(self.advancedChapterLabel, 3, 1)
self.AdvancedFromLabel = QtGui.QLabel(self.AdvancedTab) self.advancedVerseLabel = QtGui.QLabel(self.advancedTab)
self.AdvancedFromLabel.setObjectName(u'AdvancedFromLabel') self.advancedVerseLabel.setObjectName(u'advancedVerseLabel')
self.AdvancedLayout.addWidget(self.AdvancedFromLabel, 4, 0, 1, 1) self.advancedLayout.addWidget(self.advancedVerseLabel, 3, 2)
self.AdvancedFromChapter = QtGui.QComboBox(self.AdvancedTab) self.advancedFromLabel = QtGui.QLabel(self.advancedTab)
self.AdvancedFromChapter.setObjectName(u'AdvancedFromChapter') self.advancedFromLabel.setObjectName(u'advancedFromLabel')
self.AdvancedLayout.addWidget(self.AdvancedFromChapter, 4, 1, 1, 1) self.advancedLayout.addWidget(self.advancedFromLabel, 4, 0,
self.AdvancedFromVerse = QtGui.QComboBox(self.AdvancedTab) QtCore.Qt.AlignRight)
self.AdvancedFromVerse.setObjectName(u'AdvancedFromVerse') self.advancedFromChapter = QtGui.QComboBox(self.advancedTab)
self.AdvancedLayout.addWidget(self.AdvancedFromVerse, 4, 2, 1, 1) self.advancedFromChapter.setObjectName(u'advancedFromChapter')
self.AdvancedToLabel = QtGui.QLabel(self.AdvancedTab) self.advancedLayout.addWidget(self.advancedFromChapter, 4, 1)
self.AdvancedToLabel.setObjectName(u'AdvancedToLabel') self.advancedFromVerse = QtGui.QComboBox(self.advancedTab)
self.AdvancedLayout.addWidget(self.AdvancedToLabel, 5, 0, 1, 1) self.advancedFromVerse.setObjectName(u'advancedFromVerse')
self.AdvancedToChapter = QtGui.QComboBox(self.AdvancedTab) self.advancedLayout.addWidget(self.advancedFromVerse, 4, 2)
self.AdvancedToChapter.setObjectName(u'AdvancedToChapter') self.advancedToLabel = QtGui.QLabel(self.advancedTab)
self.AdvancedLayout.addWidget(self.AdvancedToChapter, 5, 1, 1, 1) self.advancedToLabel.setObjectName(u'advancedToLabel')
self.AdvancedToVerse = QtGui.QComboBox(self.AdvancedTab) self.advancedLayout.addWidget(self.advancedToLabel, 5, 0,
self.AdvancedToVerse.setObjectName(u'AdvancedToVerse') QtCore.Qt.AlignRight)
self.AdvancedLayout.addWidget(self.AdvancedToVerse, 5, 2, 1, 1) self.advancedToChapter = QtGui.QComboBox(self.advancedTab)
self.AdvancedClearLabel = QtGui.QLabel(self.QuickTab) self.advancedToChapter.setObjectName(u'advancedToChapter')
self.AdvancedClearLabel.setObjectName(u'QuickSearchLabel') self.advancedLayout.addWidget(self.advancedToChapter, 5, 1)
self.AdvancedLayout.addWidget(self.AdvancedClearLabel, 6, 0, 1, 1) self.advancedToVerse = QtGui.QComboBox(self.advancedTab)
self.ClearAdvancedSearchComboBox = QtGui.QComboBox(self.QuickTab) self.advancedToVerse.setObjectName(u'advancedToVerse')
self.ClearAdvancedSearchComboBox.setObjectName( self.advancedLayout.addWidget(self.advancedToVerse, 5, 2)
u'ClearAdvancedSearchComboBox')
self.AdvancedLayout.addWidget( self.advancedClearLabel = QtGui.QLabel(self.quickTab)
self.ClearAdvancedSearchComboBox, 6, 1, 1, 2) self.advancedClearLabel.setObjectName(u'advancedClearLabel')
self.AdvancedSearchButtonLayout = QtGui.QHBoxLayout() self.advancedLayout.addWidget(self.advancedClearLabel, 6, 0,
self.AdvancedSearchButtonLayout.setMargin(0) QtCore.Qt.AlignRight)
self.AdvancedSearchButtonLayout.setSpacing(0) self.advancedClearComboBox = QtGui.QComboBox(self.quickTab)
self.AdvancedSearchButtonLayout.setObjectName( self.advancedClearComboBox.setSizePolicy(
u'AdvancedSearchButtonLayout') QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
self.AdvancedSearchButtonSpacer = QtGui.QSpacerItem(40, 20, self.advancedClearComboBox.setObjectName(u'advancedClearComboBox')
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.advancedClearLabel.setBuddy(self.advancedClearComboBox)
self.AdvancedSearchButtonLayout.addItem(self.AdvancedSearchButtonSpacer) self.advancedLayout.addWidget(self.advancedClearComboBox, 6, 1, 1, 2)
self.AdvancedSearchButton = QtGui.QPushButton(self.AdvancedTab) self.advancedSearchButtonLayout = QtGui.QHBoxLayout()
self.AdvancedSearchButton.setObjectName(u'AdvancedSearchButton') self.advancedSearchButtonLayout.setObjectName(
self.AdvancedSearchButtonLayout.addWidget(self.AdvancedSearchButton) u'advancedSearchButtonLayout')
self.AdvancedLayout.addLayout( self.advancedSearchButtonLayout.addStretch()
self.AdvancedSearchButtonLayout, 7, 0, 1, 3) self.advancedSearchButton = QtGui.QPushButton(self.advancedTab)
self.AdvancedMessage = QtGui.QLabel(self.AdvancedTab) self.advancedSearchButton.setObjectName(u'advancedSearchButton')
self.AdvancedMessage.setObjectName(u'AdvancedMessage') self.advancedSearchButtonLayout.addWidget(self.advancedSearchButton)
self.AdvancedLayout.addWidget(self.AdvancedMessage, 8, 0, 1, 3) self.advancedLayout.addLayout(
self.SearchTabWidget.addTab(self.AdvancedTab, self.advancedSearchButtonLayout, 7, 0, 1, 3)
self.advancedMessage = QtGui.QLabel(self.advancedTab)
self.advancedMessage.setObjectName(u'advancedMessage')
self.advancedLayout.addWidget(self.advancedMessage, 8, 0, 1, 3)
self.searchTabWidget.addTab(self.advancedTab,
translate('BiblesPlugin.MediaItem', 'Advanced')) translate('BiblesPlugin.MediaItem', 'Advanced'))
# Add the search tab widget to the page layout. # Add the search tab widget to the page layout.
self.pageLayout.addWidget(self.SearchTabWidget) self.pageLayout.addWidget(self.searchTabWidget)
# Combo Boxes # Combo Boxes
QtCore.QObject.connect(self.AdvancedVersionComboBox, QtCore.QObject.connect(self.advancedVersionComboBox,
QtCore.SIGNAL(u'activated(int)'), self.onAdvancedVersionComboBox) QtCore.SIGNAL(u'activated(int)'), self.onAdvancedVersionComboBox)
QtCore.QObject.connect(self.AdvancedBookComboBox, QtCore.QObject.connect(self.advancedBookComboBox,
QtCore.SIGNAL(u'activated(int)'), self.onAdvancedBookComboBox) QtCore.SIGNAL(u'activated(int)'), self.onAdvancedBookComboBox)
QtCore.QObject.connect(self.AdvancedFromChapter, QtCore.QObject.connect(self.advancedFromChapter,
QtCore.SIGNAL(u'activated(int)'), self.onAdvancedFromChapter) QtCore.SIGNAL(u'activated(int)'), self.onAdvancedFromChapter)
QtCore.QObject.connect(self.AdvancedFromVerse, QtCore.QObject.connect(self.advancedFromVerse,
QtCore.SIGNAL(u'activated(int)'), self.onAdvancedFromVerse) QtCore.SIGNAL(u'activated(int)'), self.onAdvancedFromVerse)
QtCore.QObject.connect(self.AdvancedToChapter, QtCore.QObject.connect(self.advancedToChapter,
QtCore.SIGNAL(u'activated(int)'), self.onAdvancedToChapter) QtCore.SIGNAL(u'activated(int)'), self.onAdvancedToChapter)
QtCore.QObject.connect(self.QuickSearchComboBox, QtCore.QObject.connect(self.quickSearchComboBox,
QtCore.SIGNAL(u'activated(int)'), self.updateAutoCompleter) QtCore.SIGNAL(u'activated(int)'), self.updateAutoCompleter)
QtCore.QObject.connect(self.QuickVersionComboBox, QtCore.QObject.connect(self.quickVersionComboBox,
QtCore.SIGNAL(u'activated(int)'), self.updateAutoCompleter) QtCore.SIGNAL(u'activated(int)'), self.updateAutoCompleter)
# Buttons # Buttons
QtCore.QObject.connect(self.AdvancedSearchButton, QtCore.QObject.connect(self.advancedSearchButton,
QtCore.SIGNAL(u'pressed()'), self.onAdvancedSearchButton) QtCore.SIGNAL(u'pressed()'), self.onAdvancedSearchButton)
QtCore.QObject.connect(self.QuickSearchButton, QtCore.QObject.connect(self.quickSearchButton,
QtCore.SIGNAL(u'pressed()'), self.onQuickSearchButton) QtCore.SIGNAL(u'pressed()'), self.onQuickSearchButton)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'config_updated'), self.configUpdated) QtCore.SIGNAL(u'config_updated'), self.configUpdated)
# Other stuff # Other stuff
QtCore.QObject.connect(self.QuickSearchEdit, QtCore.QObject.connect(self.quickSearchEdit,
QtCore.SIGNAL(u'returnPressed()'), self.onQuickSearchButton) QtCore.SIGNAL(u'returnPressed()'), self.onQuickSearchButton)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'bibles_showprogress'), self.onSearchProgressShow) QtCore.SIGNAL(u'bibles_showprogress'), self.onSearchProgressShow)
@ -276,59 +268,59 @@ class BibleMediaItem(MediaManagerItem):
log.debug(u'configUpdated') log.debug(u'configUpdated')
if QtCore.QSettings().value(self.settingsSection + u'/second bibles', if QtCore.QSettings().value(self.settingsSection + u'/second bibles',
QtCore.QVariant(True)).toBool(): QtCore.QVariant(True)).toBool():
self.AdvancedSecondBibleLabel.setVisible(True) self.advancedSecondLabel.setVisible(True)
self.AdvancedSecondBibleComboBox.setVisible(True) self.advancedSecondComboBox.setVisible(True)
self.QuickSecondVersionLabel.setVisible(True) self.quickSecondLabel.setVisible(True)
self.QuickSecondBibleComboBox.setVisible(True) self.quickSecondComboBox.setVisible(True)
else: else:
self.AdvancedSecondBibleLabel.setVisible(False) self.advancedSecondLabel.setVisible(False)
self.AdvancedSecondBibleComboBox.setVisible(False) self.advancedSecondComboBox.setVisible(False)
self.QuickSecondVersionLabel.setVisible(False) self.quickSecondLabel.setVisible(False)
self.QuickSecondBibleComboBox.setVisible(False) self.quickSecondComboBox.setVisible(False)
def retranslateUi(self): def retranslateUi(self):
log.debug(u'retranslateUi') log.debug(u'retranslateUi')
self.QuickVersionLabel.setText( self.quickVersionLabel.setText(
translate('BiblesPlugin.MediaItem', 'Version:')) translate('BiblesPlugin.MediaItem', 'Version:'))
self.QuickSecondVersionLabel.setText( self.quickSecondLabel.setText(
translate('BiblesPlugin.MediaItem', 'Second:')) translate('BiblesPlugin.MediaItem', 'Second:'))
self.QuickSearchLabel.setText( self.quickSearchTypeLabel.setText(
translate('BiblesPlugin.MediaItem', 'Search type:')) translate('BiblesPlugin.MediaItem', 'Search type:'))
self.QuickSearchLabel.setText( self.quickSearchLabel.setText(
translate('BiblesPlugin.MediaItem', 'Find:')) translate('BiblesPlugin.MediaItem', 'Find:'))
self.QuickSearchButton.setText( self.quickSearchButton.setText(
translate('BiblesPlugin.MediaItem', 'Search')) translate('BiblesPlugin.MediaItem', 'Search'))
self.QuickClearLabel.setText( self.quickClearLabel.setText(
translate('BiblesPlugin.MediaItem', 'Results:')) translate('BiblesPlugin.MediaItem', 'Results:'))
self.AdvancedVersionLabel.setText( self.advancedVersionLabel.setText(
translate('BiblesPlugin.MediaItem', 'Version:')) translate('BiblesPlugin.MediaItem', 'Version:'))
self.AdvancedSecondBibleLabel.setText( self.advancedSecondLabel.setText(
translate('BiblesPlugin.MediaItem', 'Second:')) translate('BiblesPlugin.MediaItem', 'Second:'))
self.AdvancedBookLabel.setText( self.advancedBookLabel.setText(
translate('BiblesPlugin.MediaItem', 'Book:')) translate('BiblesPlugin.MediaItem', 'Book:'))
self.AdvancedChapterLabel.setText( self.advancedChapterLabel.setText(
translate('BiblesPlugin.MediaItem', 'Chapter:')) translate('BiblesPlugin.MediaItem', 'Chapter:'))
self.AdvancedVerseLabel.setText( self.advancedVerseLabel.setText(
translate('BiblesPlugin.MediaItem', 'Verse:')) translate('BiblesPlugin.MediaItem', 'Verse:'))
self.AdvancedFromLabel.setText( self.advancedFromLabel.setText(
translate('BiblesPlugin.MediaItem', 'From:')) translate('BiblesPlugin.MediaItem', 'From:'))
self.AdvancedToLabel.setText( self.advancedToLabel.setText(
translate('BiblesPlugin.MediaItem', 'To:')) translate('BiblesPlugin.MediaItem', 'To:'))
self.AdvancedClearLabel.setText( self.advancedClearLabel.setText(
translate('BiblesPlugin.MediaItem', 'Results:')) translate('BiblesPlugin.MediaItem', 'Results:'))
self.AdvancedSearchButton.setText( self.advancedSearchButton.setText(
translate('BiblesPlugin.MediaItem', 'Search')) translate('BiblesPlugin.MediaItem', 'Search'))
self.QuickSearchComboBox.addItem( self.quickSearchComboBox.addItem(
translate('BiblesPlugin.MediaItem', 'Verse Search')) translate('BiblesPlugin.MediaItem', 'Verse Search'))
self.QuickSearchComboBox.addItem( self.quickSearchComboBox.addItem(
translate('BiblesPlugin.MediaItem', 'Text Search')) translate('BiblesPlugin.MediaItem', 'Text Search'))
self.ClearQuickSearchComboBox.addItem( self.quickClearComboBox.addItem(
translate('BiblesPlugin.MediaItem', 'Clear')) translate('BiblesPlugin.MediaItem', 'Clear'))
self.ClearQuickSearchComboBox.addItem( self.quickClearComboBox.addItem(
translate('BiblesPlugin.MediaItem', 'Keep')) translate('BiblesPlugin.MediaItem', 'Keep'))
self.ClearAdvancedSearchComboBox.addItem( self.advancedClearComboBox.addItem(
translate('BiblesPlugin.MediaItem', 'Clear')) translate('BiblesPlugin.MediaItem', 'Clear'))
self.ClearAdvancedSearchComboBox.addItem( self.advancedClearComboBox.addItem(
translate('BiblesPlugin.MediaItem', 'Keep')) translate('BiblesPlugin.MediaItem', 'Keep'))
def initialise(self): def initialise(self):
@ -340,8 +332,8 @@ class BibleMediaItem(MediaManagerItem):
log.debug(u'bible manager initialise complete') log.debug(u'bible manager initialise complete')
def setQuickMessage(self, text): def setQuickMessage(self, text):
self.QuickMessage.setText(text) self.quickMessage.setText(text)
self.AdvancedMessage.setText(text) self.advancedMessage.setText(text)
Receiver.send_message(u'openlp_process_events') Receiver.send_message(u'openlp_process_events')
# Minor delay to get the events processed. # Minor delay to get the events processed.
time.sleep(0.1) time.sleep(0.1)
@ -368,12 +360,12 @@ class BibleMediaItem(MediaManagerItem):
def loadBibles(self): def loadBibles(self):
log.debug(u'Loading Bibles') log.debug(u'Loading Bibles')
self.QuickVersionComboBox.clear() self.quickVersionComboBox.clear()
self.QuickSecondBibleComboBox.clear() self.quickSecondComboBox.clear()
self.AdvancedVersionComboBox.clear() self.advancedVersionComboBox.clear()
self.AdvancedSecondBibleComboBox.clear() self.advancedSecondComboBox.clear()
self.QuickSecondBibleComboBox.addItem(u'') self.quickSecondComboBox.addItem(u'')
self.AdvancedSecondBibleComboBox.addItem(u'') self.advancedSecondComboBox.addItem(u'')
# Get all bibles and sort the list. # Get all bibles and sort the list.
bibles = self.parent.manager.get_bibles().keys() bibles = self.parent.manager.get_bibles().keys()
bibles.sort() bibles.sort()
@ -381,10 +373,10 @@ class BibleMediaItem(MediaManagerItem):
first = True first = True
for bible in bibles: for bible in bibles:
if bible: if bible:
self.QuickVersionComboBox.addItem(bible) self.quickVersionComboBox.addItem(bible)
self.QuickSecondBibleComboBox.addItem(bible) self.quickSecondComboBox.addItem(bible)
self.AdvancedVersionComboBox.addItem(bible) self.advancedVersionComboBox.addItem(bible)
self.AdvancedSecondBibleComboBox.addItem(bible) self.advancedSecondComboBox.addItem(bible)
if first: if first:
first = False first = False
self.initialiseBible(bible) self.initialiseBible(bible)
@ -406,12 +398,12 @@ class BibleMediaItem(MediaManagerItem):
""" """
log.debug(u'initialiseBible %s', bible) log.debug(u'initialiseBible %s', bible)
book_data = self.parent.manager.get_books(bible) book_data = self.parent.manager.get_books(bible)
self.AdvancedBookComboBox.clear() self.advancedBookComboBox.clear()
first = True first = True
for book in book_data: for book in book_data:
row = self.AdvancedBookComboBox.count() row = self.advancedBookComboBox.count()
self.AdvancedBookComboBox.addItem(book[u'name']) self.advancedBookComboBox.addItem(book[u'name'])
self.AdvancedBookComboBox.setItemData( self.advancedBookComboBox.setItemData(
row, QtCore.QVariant(book[u'chapters'])) row, QtCore.QVariant(book[u'chapters']))
if first: if first:
first = False first = False
@ -423,16 +415,16 @@ class BibleMediaItem(MediaManagerItem):
self.chapter_count = chapter_count self.chapter_count = chapter_count
verse_count = self.parent.manager.get_verse_count(bible, book, 1) verse_count = self.parent.manager.get_verse_count(bible, book, 1)
if verse_count == 0: if verse_count == 0:
self.AdvancedSearchButton.setEnabled(False) self.advancedSearchButton.setEnabled(False)
self.AdvancedMessage.setText( self.advancedMessage.setText(
translate('BiblesPlugin.MediaItem', 'Bible not fully loaded.')) translate('BiblesPlugin.MediaItem', 'Bible not fully loaded.'))
else: else:
self.AdvancedSearchButton.setEnabled(True) self.advancedSearchButton.setEnabled(True)
self.AdvancedMessage.setText(u'') self.advancedMessage.setText(u'')
self.adjustComboBox(1, self.chapter_count, self.AdvancedFromChapter) self.adjustComboBox(1, self.chapter_count, self.advancedFromChapter)
self.adjustComboBox(1, self.chapter_count, self.AdvancedToChapter) self.adjustComboBox(1, self.chapter_count, self.advancedToChapter)
self.adjustComboBox(1, verse_count, self.AdvancedFromVerse) self.adjustComboBox(1, verse_count, self.advancedFromVerse)
self.adjustComboBox(1, verse_count, self.AdvancedToVerse) self.adjustComboBox(1, verse_count, self.advancedToVerse)
def updateAutoCompleter(self): def updateAutoCompleter(self):
""" """
@ -442,73 +434,73 @@ class BibleMediaItem(MediaManagerItem):
""" """
books = [] books = []
# We have to do a 'Verse Search'. # We have to do a 'Verse Search'.
if self.QuickSearchComboBox.currentIndex() == 0: if self.quickSearchComboBox.currentIndex() == 0:
bibles = self.parent.manager.get_bibles() bibles = self.parent.manager.get_bibles()
bible = unicode(self.QuickVersionComboBox.currentText()) bible = unicode(self.quickVersionComboBox.currentText())
if bible: if bible:
book_data = bibles[bible].get_books() book_data = bibles[bible].get_books()
books = [book.name for book in book_data] books = [book.name for book in book_data]
books.sort() books.sort()
completer = QtGui.QCompleter(books) completer = QtGui.QCompleter(books)
completer.setCaseSensitivity(QtCore.Qt.CaseInsensitive) completer.setCaseSensitivity(QtCore.Qt.CaseInsensitive)
self.QuickSearchEdit.setCompleter(completer) self.quickSearchEdit.setCompleter(completer)
def onAdvancedVersionComboBox(self): def onAdvancedVersionComboBox(self):
self.initialiseBible( self.initialiseBible(
unicode(self.AdvancedVersionComboBox.currentText())) unicode(self.advancedVersionComboBox.currentText()))
def onAdvancedBookComboBox(self): def onAdvancedBookComboBox(self):
item = int(self.AdvancedBookComboBox.currentIndex()) item = int(self.advancedBookComboBox.currentIndex())
self.initialiseChapterVerse( self.initialiseChapterVerse(
unicode(self.AdvancedVersionComboBox.currentText()), unicode(self.advancedVersionComboBox.currentText()),
unicode(self.AdvancedBookComboBox.currentText()), unicode(self.advancedBookComboBox.currentText()),
self.AdvancedBookComboBox.itemData(item).toInt()[0]) self.advancedBookComboBox.itemData(item).toInt()[0])
def onAdvancedFromVerse(self): def onAdvancedFromVerse(self):
chapter_from = int(self.AdvancedFromChapter.currentText()) chapter_from = int(self.advancedFromChapter.currentText())
chapter_to = int(self.AdvancedToChapter.currentText()) chapter_to = int(self.advancedToChapter.currentText())
if chapter_from == chapter_to: if chapter_from == chapter_to:
bible = unicode(self.AdvancedVersionComboBox.currentText()) bible = unicode(self.advancedVersionComboBox.currentText())
book = unicode(self.AdvancedBookComboBox.currentText()) book = unicode(self.advancedBookComboBox.currentText())
verse_from = int(self.AdvancedFromVerse.currentText()) verse_from = int(self.advancedFromVerse.currentText())
verse_count = self.parent.manager.get_verse_count(bible, book, verse_count = self.parent.manager.get_verse_count(bible, book,
chapter_to) chapter_to)
self.adjustComboBox(verse_from, verse_count, self.adjustComboBox(verse_from, verse_count,
self.AdvancedToVerse, True) self.advancedToVerse, True)
def onAdvancedToChapter(self): def onAdvancedToChapter(self):
bible = unicode(self.AdvancedVersionComboBox.currentText()) bible = unicode(self.advancedVersionComboBox.currentText())
book = unicode(self.AdvancedBookComboBox.currentText()) book = unicode(self.advancedBookComboBox.currentText())
chapter_from = int(self.AdvancedFromChapter.currentText()) chapter_from = int(self.advancedFromChapter.currentText())
chapter_to = int(self.AdvancedToChapter.currentText()) chapter_to = int(self.advancedToChapter.currentText())
verse_from = int(self.AdvancedFromVerse.currentText()) verse_from = int(self.advancedFromVerse.currentText())
verse_to = int(self.AdvancedToVerse.currentText()) verse_to = int(self.advancedToVerse.currentText())
verse_count = self.parent.manager.get_verse_count(bible, book, verse_count = self.parent.manager.get_verse_count(bible, book,
chapter_to) chapter_to)
if chapter_from == chapter_to and verse_from > verse_to: if chapter_from == chapter_to and verse_from > verse_to:
self.adjustComboBox(verse_from, verse_count, self.AdvancedToVerse) self.adjustComboBox(verse_from, verse_count, self.advancedToVerse)
else: else:
self.adjustComboBox(1, verse_count, self.AdvancedToVerse) self.adjustComboBox(1, verse_count, self.advancedToVerse)
def onAdvancedFromChapter(self): def onAdvancedFromChapter(self):
bible = unicode(self.AdvancedVersionComboBox.currentText()) bible = unicode(self.advancedVersionComboBox.currentText())
book = unicode(self.AdvancedBookComboBox.currentText()) book = unicode(self.advancedBookComboBox.currentText())
chapter_from = int(self.AdvancedFromChapter.currentText()) chapter_from = int(self.advancedFromChapter.currentText())
chapter_to = int(self.AdvancedToChapter.currentText()) chapter_to = int(self.advancedToChapter.currentText())
verse_count = self.parent.manager.get_verse_count(bible, book, verse_count = self.parent.manager.get_verse_count(bible, book,
chapter_from) chapter_from)
self.adjustComboBox(1, verse_count, self.AdvancedFromVerse) self.adjustComboBox(1, verse_count, self.advancedFromVerse)
if chapter_from > chapter_to: if chapter_from > chapter_to:
self.adjustComboBox(1, verse_count, self.AdvancedToVerse) self.adjustComboBox(1, verse_count, self.advancedToVerse)
self.adjustComboBox(chapter_from, self.chapter_count, self.adjustComboBox(chapter_from, self.chapter_count,
self.AdvancedToChapter) self.advancedToChapter)
elif chapter_from == chapter_to: elif chapter_from == chapter_to:
self.adjustComboBox(chapter_from, self.chapter_count, self.adjustComboBox(chapter_from, self.chapter_count,
self.AdvancedToChapter) self.advancedToChapter)
self.adjustComboBox(1, verse_count, self.AdvancedToVerse, True) self.adjustComboBox(1, verse_count, self.advancedToVerse, True)
else: else:
self.adjustComboBox(chapter_from, self.chapter_count, self.adjustComboBox(chapter_from, self.chapter_count,
self.AdvancedToChapter, True) self.advancedToChapter, True)
def adjustComboBox(self, range_from, range_to, combo, restore=False): def adjustComboBox(self, range_from, range_to, combo, restore=False):
""" """
@ -541,14 +533,14 @@ class BibleMediaItem(MediaManagerItem):
Does an advanced search and saves the search results. Does an advanced search and saves the search results.
""" """
log.debug(u'Advanced Search Button pressed') log.debug(u'Advanced Search Button pressed')
self.AdvancedSearchButton.setEnabled(False) self.advancedSearchButton.setEnabled(False)
bible = unicode(self.AdvancedVersionComboBox.currentText()) bible = unicode(self.advancedVersionComboBox.currentText())
second_bible = unicode(self.AdvancedSecondBibleComboBox.currentText()) second_bible = unicode(self.advancedSecondComboBox.currentText())
book = unicode(self.AdvancedBookComboBox.currentText()) book = unicode(self.advancedBookComboBox.currentText())
chapter_from = self.AdvancedFromChapter.currentText() chapter_from = self.advancedFromChapter.currentText()
chapter_to = self.AdvancedToChapter.currentText() chapter_to = self.advancedToChapter.currentText()
verse_from = self.AdvancedFromVerse.currentText() verse_from = self.advancedFromVerse.currentText()
verse_to = self.AdvancedToVerse.currentText() verse_to = self.advancedToVerse.currentText()
verse_separator = get_reference_match(u'sep_v_display') verse_separator = get_reference_match(u'sep_v_display')
range_separator = get_reference_match(u'sep_r_display') range_separator = get_reference_match(u'sep_r_display')
verse_range = chapter_from + verse_separator + verse_from + \ verse_range = chapter_from + verse_separator + verse_from + \
@ -558,7 +550,7 @@ class BibleMediaItem(MediaManagerItem):
if second_bible: if second_bible:
self.second_search_results = self.parent.manager.get_verses( self.second_search_results = self.parent.manager.get_verses(
second_bible, versetext) second_bible, versetext)
if self.ClearAdvancedSearchComboBox.currentIndex() == 0: if self.advancedClearComboBox.currentIndex() == 0:
self.listView.clear() self.listView.clear()
if self.listView.count() != 0: if self.listView.count() != 0:
# Check if the first item is a second bible item or not. # Check if the first item is a second bible item or not.
@ -578,7 +570,7 @@ class BibleMediaItem(MediaManagerItem):
self.displayResults(bible, second_bible) self.displayResults(bible, second_bible)
else: else:
self.displayResults(bible, second_bible) self.displayResults(bible, second_bible)
self.AdvancedSearchButton.setEnabled(True) self.advancedSearchButton.setEnabled(True)
def onQuickSearchButton(self): def onQuickSearchButton(self):
""" """
@ -586,11 +578,11 @@ class BibleMediaItem(MediaManagerItem):
either be "Verse Search" or "Text Search". either be "Verse Search" or "Text Search".
""" """
log.debug(u'Quick Search Button pressed') log.debug(u'Quick Search Button pressed')
self.QuickSearchButton.setEnabled(False) self.quickSearchButton.setEnabled(False)
bible = unicode(self.QuickVersionComboBox.currentText()) bible = unicode(self.quickVersionComboBox.currentText())
second_bible = unicode(self.QuickSecondBibleComboBox.currentText()) second_bible = unicode(self.quickSecondComboBox.currentText())
text = unicode(self.QuickSearchEdit.text()) text = unicode(self.quickSearchEdit.text())
if self.QuickSearchComboBox.currentIndex() == 0: if self.quickSearchComboBox.currentIndex() == 0:
# We are doing a 'Verse Search'. # We are doing a 'Verse Search'.
self.search_results = self.parent.manager.get_verses(bible, text) self.search_results = self.parent.manager.get_verses(bible, text)
if second_bible and self.search_results: if second_bible and self.search_results:
@ -608,7 +600,7 @@ class BibleMediaItem(MediaManagerItem):
verse.verse)) verse.verse))
self.second_search_results = \ self.second_search_results = \
bibles[second_bible].get_verses(text) bibles[second_bible].get_verses(text)
if self.ClearQuickSearchComboBox.currentIndex() == 0: if self.quickClearComboBox.currentIndex() == 0:
self.listView.clear() self.listView.clear()
if self.listView.count() != 0 and self.search_results: if self.listView.count() != 0 and self.search_results:
bitem = self.listView.item(0) bitem = self.listView.item(0)
@ -627,7 +619,7 @@ class BibleMediaItem(MediaManagerItem):
self.displayResults(bible, second_bible) self.displayResults(bible, second_bible)
elif self.search_results: elif self.search_results:
self.displayResults(bible, second_bible) self.displayResults(bible, second_bible)
self.QuickSearchButton.setEnabled(True) self.quickSearchButton.setEnabled(True)
def displayResults(self, bible, second_bible=u''): def displayResults(self, bible, second_bible=u''):
""" """

View File

@ -31,86 +31,73 @@ from openlp.core.lib import build_icon, translate
class Ui_CustomEditDialog(object): class Ui_CustomEditDialog(object):
def setupUi(self, customEditDialog): def setupUi(self, customEditDialog):
customEditDialog.setObjectName(u'customEditDialog') customEditDialog.setObjectName(u'customEditDialog')
customEditDialog.resize(590, 541) customEditDialog.resize(450, 350)
customEditDialog.setWindowIcon( customEditDialog.setWindowIcon(
build_icon(u':/icon/openlp.org-icon-32.bmp')) build_icon(u':/icon/openlp.org-icon-32.bmp'))
self.gridLayout = QtGui.QGridLayout(customEditDialog) self.dialogLayout = QtGui.QVBoxLayout(customEditDialog)
self.gridLayout.setObjectName(u'gridLayout') self.dialogLayout.setObjectName(u'dialogLayout')
self.horizontalLayout3 = QtGui.QHBoxLayout() self.titleLayout = QtGui.QHBoxLayout()
self.horizontalLayout3.setObjectName(u'horizontalLayout3') self.titleLayout.setObjectName(u'titleLayout')
self.titleLabel = QtGui.QLabel(customEditDialog)
self.titleLabel.setObjectName(u'titleLabel')
self.titleLayout.addWidget(self.titleLabel)
self.titleEdit = QtGui.QLineEdit(customEditDialog)
self.titleLabel.setBuddy(self.titleEdit)
self.titleEdit.setObjectName(u'titleEdit')
self.titleLayout.addWidget(self.titleEdit)
self.dialogLayout.addLayout(self.titleLayout)
self.centralLayout = QtGui.QHBoxLayout()
self.centralLayout.setObjectName(u'centralLayout')
self.slideListView = QtGui.QListWidget(customEditDialog)
self.slideListView.setAlternatingRowColors(True)
self.slideListView.setObjectName(u'slideListView')
self.centralLayout.addWidget(self.slideListView)
self.buttonLayout = QtGui.QVBoxLayout()
self.buttonLayout.setObjectName(u'buttonLayout')
self.addButton = QtGui.QPushButton(customEditDialog)
self.addButton.setObjectName(u'addButton')
self.buttonLayout.addWidget(self.addButton)
self.editButton = QtGui.QPushButton(customEditDialog)
self.editButton.setObjectName(u'editButton')
self.buttonLayout.addWidget(self.editButton)
self.editAllButton = QtGui.QPushButton(customEditDialog)
self.editAllButton.setObjectName(u'editAllButton')
self.buttonLayout.addWidget(self.editAllButton)
self.deleteButton = QtGui.QPushButton(customEditDialog)
self.deleteButton.setObjectName(u'deleteButton')
self.buttonLayout.addWidget(self.deleteButton)
self.buttonLayout.addStretch()
self.upButton = QtGui.QPushButton(customEditDialog)
self.upButton.setIcon(build_icon(u':/services/service_up.png'))
self.upButton.setObjectName(u'upButton')
self.buttonLayout.addWidget(self.upButton)
self.downButton = QtGui.QPushButton(customEditDialog)
self.downButton.setIcon(build_icon(u':/services/service_down.png'))
self.downButton.setObjectName(u'downButton')
self.buttonLayout.addWidget(self.downButton)
self.centralLayout.addLayout(self.buttonLayout)
self.dialogLayout.addLayout(self.centralLayout)
self.bottomFormLayout = QtGui.QFormLayout()
self.bottomFormLayout.setObjectName(u'bottomFormLayout')
self.themeLabel = QtGui.QLabel(customEditDialog) self.themeLabel = QtGui.QLabel(customEditDialog)
self.themeLabel.setObjectName(u'themeLabel') self.themeLabel.setObjectName(u'themeLabel')
self.horizontalLayout3.addWidget(self.themeLabel)
self.themeComboBox = QtGui.QComboBox(customEditDialog) self.themeComboBox = QtGui.QComboBox(customEditDialog)
self.themeLabel.setBuddy(self.themeComboBox) self.themeComboBox.setSizeAdjustPolicy(QtGui.QComboBox.AdjustToContents)
self.themeComboBox.setObjectName(u'themeComboBox') self.themeComboBox.setObjectName(u'themeComboBox')
self.horizontalLayout3.addWidget(self.themeComboBox) self.themeLabel.setBuddy(self.themeComboBox)
self.gridLayout.addLayout(self.horizontalLayout3, 2, 0, 1, 1) self.bottomFormLayout.addRow(self.themeLabel, self.themeComboBox)
self.horizontalLayout2 = QtGui.QHBoxLayout()
self.horizontalLayout2.setObjectName(u'horizontalLayout2')
self.creditLabel = QtGui.QLabel(customEditDialog) self.creditLabel = QtGui.QLabel(customEditDialog)
self.creditLabel.setObjectName(u'creditLabel') self.creditLabel.setObjectName(u'creditLabel')
self.horizontalLayout2.addWidget(self.creditLabel)
self.creditEdit = QtGui.QLineEdit(customEditDialog) self.creditEdit = QtGui.QLineEdit(customEditDialog)
self.creditLabel.setBuddy(self.creditEdit)
self.creditEdit.setObjectName(u'creditEdit') self.creditEdit.setObjectName(u'creditEdit')
self.horizontalLayout2.addWidget(self.creditEdit) self.creditLabel.setBuddy(self.creditEdit)
self.gridLayout.addLayout(self.horizontalLayout2, 3, 0, 1, 1) self.bottomFormLayout.addRow(self.creditLabel, self.creditEdit)
self.dialogLayout.addLayout(self.bottomFormLayout)
self.buttonBox = QtGui.QDialogButtonBox(customEditDialog) self.buttonBox = QtGui.QDialogButtonBox(customEditDialog)
self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel | self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel |
QtGui.QDialogButtonBox.Save) QtGui.QDialogButtonBox.Save)
self.buttonBox.setObjectName(u'buttonBox') self.buttonBox.setObjectName(u'buttonBox')
self.gridLayout.addWidget(self.buttonBox, 4, 0, 1, 1) self.dialogLayout.addWidget(self.buttonBox)
self.horizontalLayout4 = QtGui.QHBoxLayout()
self.horizontalLayout4.setObjectName(u'horizontalLayout4')
self.slideListView = QtGui.QListWidget(customEditDialog)
self.slideListView.setAlternatingRowColors(True)
self.slideListView.setObjectName(u'slideListView')
self.horizontalLayout4.addWidget(self.slideListView)
self.verticalLayout = QtGui.QVBoxLayout()
self.verticalLayout.setObjectName(u'verticalLayout')
self.addButton = QtGui.QPushButton(customEditDialog)
self.addButton.setObjectName(u'addButton')
self.verticalLayout.addWidget(self.addButton)
self.editButton = QtGui.QPushButton(customEditDialog)
self.editButton.setObjectName(u'editButton')
self.verticalLayout.addWidget(self.editButton)
self.editAllButton = QtGui.QPushButton(customEditDialog)
self.editAllButton.setObjectName(u'editAllButton')
self.verticalLayout.addWidget(self.editAllButton)
self.deleteButton = QtGui.QPushButton(customEditDialog)
self.deleteButton.setObjectName(u'deleteButton')
self.verticalLayout.addWidget(self.deleteButton)
spacerItem = QtGui.QSpacerItem(20, 128, QtGui.QSizePolicy.Minimum,
QtGui.QSizePolicy.Expanding)
self.verticalLayout.addItem(spacerItem)
self.upButton = QtGui.QPushButton(customEditDialog)
icon1 = QtGui.QIcon()
icon1.addPixmap(QtGui.QPixmap(u':/services/service_up.png'),
QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.upButton.setIcon(icon1)
self.upButton.setObjectName(u'upButton')
self.verticalLayout.addWidget(self.upButton)
self.downButton = QtGui.QPushButton(customEditDialog)
icon2 = QtGui.QIcon()
icon2.addPixmap(QtGui.QPixmap(u':/services/service_down.png'),
QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.downButton.setIcon(icon2)
self.downButton.setObjectName(u'downButton')
self.verticalLayout.addWidget(self.downButton)
self.horizontalLayout4.addLayout(self.verticalLayout)
self.gridLayout.addLayout(self.horizontalLayout4, 1, 0, 1, 1)
self.horizontalLayout = QtGui.QHBoxLayout()
self.horizontalLayout.setObjectName(u'horizontalLayout')
self.titleLabel = QtGui.QLabel(customEditDialog)
self.titleLabel.setObjectName(u'titleLabel')
self.horizontalLayout.addWidget(self.titleLabel)
self.titleEdit = QtGui.QLineEdit(customEditDialog)
self.titleLabel.setBuddy(self.titleEdit)
self.titleEdit.setObjectName(u'titleEdit')
self.horizontalLayout.addWidget(self.titleEdit)
self.gridLayout.addLayout(self.horizontalLayout, 0, 0, 1, 1)
self.retranslateUi(customEditDialog) self.retranslateUi(customEditDialog)
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(u'accepted()'), QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(u'accepted()'),
customEditDialog.accept) customEditDialog.accept)
@ -152,4 +139,4 @@ class Ui_CustomEditDialog(object):
self.themeLabel.setText( self.themeLabel.setText(
translate('CustomPlugin.EditCustomForm', 'The&me:')) translate('CustomPlugin.EditCustomForm', 'The&me:'))
self.creditLabel.setText( self.creditLabel.setText(
translate('CustomPlugin.EditCustomForm', '&Credits:')) translate('CustomPlugin.EditCustomForm', '&Credits:'))

View File

@ -31,19 +31,20 @@ from openlp.core.lib import translate, SpellTextEdit
class Ui_CustomSlideEditDialog(object): class Ui_CustomSlideEditDialog(object):
def setupUi(self, customSlideEditDialog): def setupUi(self, customSlideEditDialog):
customSlideEditDialog.setObjectName(u'customSlideEditDialog') customSlideEditDialog.setObjectName(u'customSlideEditDialog')
customSlideEditDialog.resize(474, 442) customSlideEditDialog.resize(350, 300)
self.dialogLayout = QtGui.QVBoxLayout(customSlideEditDialog)
self.slideTextEdit = SpellTextEdit(self)
self.slideTextEdit.setObjectName(u'slideTextEdit')
self.dialogLayout.addWidget(self.slideTextEdit)
self.buttonBox = QtGui.QDialogButtonBox(customSlideEditDialog) self.buttonBox = QtGui.QDialogButtonBox(customSlideEditDialog)
self.buttonBox.setGeometry(QtCore.QRect(8, 407, 458, 32))
self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel | self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel |
QtGui.QDialogButtonBox.Save) QtGui.QDialogButtonBox.Save)
self.buttonBox.setObjectName(u'buttonBox') self.buttonBox.setObjectName(u'buttonBox')
self.slideTextEdit = SpellTextEdit(self)
self.slideTextEdit.setGeometry(QtCore.QRect(8, 8, 458, 349))
self.slideTextEdit.setObjectName(u'slideTextEdit')
self.splitButton = QtGui.QPushButton(customSlideEditDialog) self.splitButton = QtGui.QPushButton(customSlideEditDialog)
self.splitButton.setGeometry(QtCore.QRect(380, 370, 85, 27))
self.splitButton.setObjectName(u'splitButton') self.splitButton.setObjectName(u'splitButton')
self.buttonBox.addButton(self.splitButton,
QtGui.QDialogButtonBox.ActionRole)
self.dialogLayout.addWidget(self.buttonBox)
self.retranslateUi(customSlideEditDialog) self.retranslateUi(customSlideEditDialog)
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(u'accepted()'), QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(u'accepted()'),
customSlideEditDialog.accept) customSlideEditDialog.accept)
@ -56,4 +57,4 @@ class Ui_CustomSlideEditDialog(object):
translate('CustomPlugin.EditCustomForm', 'Split Slide')) translate('CustomPlugin.EditCustomForm', 'Split Slide'))
self.splitButton.setToolTip( self.splitButton.setToolTip(
translate('CustomPlugin.EditCustomForm', 'Split a slide into two ' translate('CustomPlugin.EditCustomForm', 'Split a slide into two '
'by inserting a slide splitter.')) 'by inserting a slide splitter.'))

View File

@ -63,6 +63,14 @@ class ImageMediaItem(MediaManagerItem):
file_formats = get_images_filter() file_formats = get_images_filter()
self.OnNewFileMasks = u'%s;;%s (*.*) (*)' % (file_formats, self.OnNewFileMasks = u'%s;;%s (*.*) (*)' % (file_formats,
unicode(translate('ImagePlugin.MediaItem', 'All Files'))) unicode(translate('ImagePlugin.MediaItem', 'All Files')))
self.replaceAction.setText(
translate('ImagePlugin.MediaItem', 'Replace Background'))
self.replaceAction.setToolTip(
translate('ImagePlugin.MediaItem', 'Replace Live Background'))
self.resetAction.setText(
translate('ImagePlugin.MediaItem', 'Reset Background'))
self.resetAction.setToolTip(
translate('ImagePlugin.MediaItem', 'Reset Live Background'))
def requiredIcons(self): def requiredIcons(self):
MediaManagerItem.requiredIcons(self) MediaManagerItem.requiredIcons(self)
@ -88,35 +96,14 @@ class ImageMediaItem(MediaManagerItem):
def addListViewToToolBar(self): def addListViewToToolBar(self):
MediaManagerItem.addListViewToToolBar(self) MediaManagerItem.addListViewToToolBar(self)
self.listView.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu) self.listView.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu)
self.listView.addAction( self.listView.addAction(self.replaceAction)
context_menu_action(
self.listView, u':/slides/slide_blank.png',
translate('ImagePlugin.MediaItem', 'Replace Live Background'),
self.onReplaceClick))
def addEndHeaderBar(self): def addEndHeaderBar(self):
self.ImageWidget = QtGui.QWidget(self) self.replaceAction = self.addToolbarButton(u'', u'',
sizePolicy = QtGui.QSizePolicy( u':/slides/slide_blank.png', self.onReplaceClick, False)
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.resetAction = self.addToolbarButton(u'', u'',
sizePolicy.setHorizontalStretch(0) u':/system/system_close.png', self.onResetClick, False)
sizePolicy.setVerticalStretch(0) self.resetAction.setVisible(False)
sizePolicy.setHeightForWidth(
self.ImageWidget.sizePolicy().hasHeightForWidth())
self.ImageWidget.setSizePolicy(sizePolicy)
self.ImageWidget.setObjectName(u'ImageWidget')
self.blankButton = self.toolbar.addToolbarButton(
translate('ImagePlugin.MediaItem', 'Replace Background'),
u':/slides/slide_blank.png',
translate('ImagePlugin.MediaItem', 'Replace Live Background'),
self.onReplaceClick, False)
self.resetButton = self.toolbar.addToolbarButton(
translate('ImagePlugin.MediaItem', 'Reset Background'),
u':/system/system_close.png',
translate('ImagePlugin.MediaItem', 'Reset Live Background'),
self.onResetClick, False)
# Add the song widget to the page layout.
self.pageLayout.addWidget(self.ImageWidget)
self.resetButton.setVisible(False)
def onDeleteClick(self): def onDeleteClick(self):
""" """
@ -204,7 +191,7 @@ class ImageMediaItem(MediaManagerItem):
return False return False
def onResetClick(self): def onResetClick(self):
self.resetButton.setVisible(False) self.resetAction.setVisible(False)
self.parent.liveController.display.resetImage() self.parent.liveController.display.resetImage()
def onReplaceClick(self): def onReplaceClick(self):
@ -217,13 +204,13 @@ class ImageMediaItem(MediaManagerItem):
if os.path.exists(filename): if os.path.exists(filename):
(path, name) = os.path.split(filename) (path, name) = os.path.split(filename)
self.parent.liveController.display.directImage(name, filename) self.parent.liveController.display.directImage(name, filename)
self.resetAction.setVisible(True)
else: else:
QtGui.QMessageBox.critical(self, QtGui.QMessageBox.critical(self,
translate('ImagePlugin.MediaItem', 'Live Background Could ' translate('ImagePlugin.MediaItem', 'Live Background Could '
'Not Be Replaced'), 'Not Be Replaced'),
unicode(translate('ImagePlugin.MediaItem', unicode(translate('ImagePlugin.MediaItem',
'The image %s no longer exists.')) % filename) 'The image %s no longer exists.')) % filename)
self.resetButton.setVisible(True)
def onPreviewClick(self): def onPreviewClick(self):
MediaManagerItem.onPreviewClick(self) MediaManagerItem.onPreviewClick(self)

View File

@ -63,6 +63,14 @@ class MediaMediaItem(MediaManagerItem):
self.OnNewFileMasks = unicode(translate('MediaPlugin.MediaItem', self.OnNewFileMasks = unicode(translate('MediaPlugin.MediaItem',
'Videos (%s);;Audio (%s);;All files (*)')) % \ 'Videos (%s);;Audio (%s);;All files (*)')) % \
(self.parent.video_list, self.parent.audio_list) (self.parent.video_list, self.parent.audio_list)
self.replaceAction.setText(
translate('MediaPlugin.MediaItem', 'Replace Background'))
self.replaceAction.setToolTip(
translate('MediaPlugin.MediaItem', 'Replace Live Background'))
self.resetAction.setText(
translate('MediaPlugin.MediaItem', 'Reset Background'))
self.resetAction.setToolTip(
translate('ImagePlugin.MediaItem', 'Reset Live Background'))
def requiredIcons(self): def requiredIcons(self):
MediaManagerItem.requiredIcons(self) MediaManagerItem.requiredIcons(self)
@ -73,37 +81,18 @@ class MediaMediaItem(MediaManagerItem):
def addListViewToToolBar(self): def addListViewToToolBar(self):
MediaManagerItem.addListViewToToolBar(self) MediaManagerItem.addListViewToToolBar(self)
self.listView.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu) self.listView.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu)
self.listView.addAction( self.listView.addAction(self.replaceAction)
context_menu_action(self.listView, u':/slides/slide_blank.png',
translate('MediaPlugin.MediaItem', 'Replace Live Background'),
self.onReplaceClick))
def addEndHeaderBar(self): def addEndHeaderBar(self):
self.ImageWidget = QtGui.QWidget(self)
sizePolicy = QtGui.QSizePolicy(
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(
self.ImageWidget.sizePolicy().hasHeightForWidth())
self.ImageWidget.setSizePolicy(sizePolicy)
self.ImageWidget.setObjectName(u'ImageWidget')
# Replace backgrounds do not work at present so remove functionality. # Replace backgrounds do not work at present so remove functionality.
self.blankButton = self.toolbar.addToolbarButton( self.replaceAction = self.addToolbarButton(u'', u'',
translate('MediaPlugin.MediaItem', 'Replace Background'), u':/slides/slide_blank.png', self.onReplaceClick, False)
u':/slides/slide_blank.png', self.resetAction = self.addToolbarButton(u'', u'',
translate('MediaPlugin.MediaItem', 'Replace Live Background'), u':/system/system_close.png', self.onResetClick, False)
self.onReplaceClick, False) self.resetAction.setVisible(False)
self.resetButton = self.toolbar.addToolbarButton(
u'Reset Background', u':/system/system_close.png',
translate('ImagePlugin.MediaItem', 'Reset Live Background'),
self.onResetClick, False)
# Add the song widget to the page layout
self.pageLayout.addWidget(self.ImageWidget)
self.resetButton.setVisible(False)
def onResetClick(self): def onResetClick(self):
self.resetButton.setVisible(False) self.resetAction.setVisible(False)
self.parent.liveController.display.resetVideo() self.parent.liveController.display.resetVideo()
def onReplaceClick(self): def onReplaceClick(self):
@ -113,7 +102,7 @@ class MediaMediaItem(MediaManagerItem):
item = self.listView.currentItem() item = self.listView.currentItem()
filename = unicode(item.data(QtCore.Qt.UserRole).toString()) filename = unicode(item.data(QtCore.Qt.UserRole).toString())
self.parent.liveController.display.video(filename, 0, True) self.parent.liveController.display.video(filename, 0, True)
self.resetButton.setVisible(True) self.resetAction.setVisible(True)
def generateSlideData(self, service_item, item=None, xmlVersion=False): def generateSlideData(self, service_item, item=None, xmlVersion=False):
if item is None: if item is None:

View File

@ -76,6 +76,8 @@ class PresentationMediaItem(MediaManagerItem):
'Select Presentation(s)') 'Select Presentation(s)')
self.Automatic = translate('PresentationPlugin.MediaItem', self.Automatic = translate('PresentationPlugin.MediaItem',
'Automatic') 'Automatic')
self.displayTypeLabel.setText(
translate('PresentationPlugin.MediaItem', 'Present using:'))
def buildFileMaskString(self): def buildFileMaskString(self):
""" """
@ -106,27 +108,22 @@ class PresentationMediaItem(MediaManagerItem):
""" """
Display custom media manager items for presentations Display custom media manager items for presentations
""" """
self.PresentationWidget = QtGui.QWidget(self) self.presentationWidget = QtGui.QWidget(self)
sizePolicy = QtGui.QSizePolicy( self.presentationWidget.setObjectName(u'presentationWidget')
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.displayLayout = QtGui.QFormLayout(self.presentationWidget)
sizePolicy.setHorizontalStretch(0) self.displayLayout.setMargin(self.displayLayout.spacing())
sizePolicy.setVerticalStretch(0) self.displayLayout.setObjectName(u'displayLayout')
sizePolicy.setHeightForWidth( self.displayTypeLabel = QtGui.QLabel(self.presentationWidget)
self.PresentationWidget.sizePolicy().hasHeightForWidth()) self.displayTypeLabel.setObjectName(u'displayTypeLabel')
self.PresentationWidget.setSizePolicy(sizePolicy) self.displayTypeComboBox = QtGui.QComboBox(self.presentationWidget)
self.PresentationWidget.setObjectName(u'PresentationWidget') self.displayTypeComboBox.setSizePolicy(QtGui.QSizePolicy.Expanding,
self.DisplayLayout = QtGui.QGridLayout(self.PresentationWidget) QtGui.QSizePolicy.Fixed)
self.DisplayLayout.setObjectName(u'DisplayLayout') self.displayTypeComboBox.setObjectName(u'displayTypeComboBox')
self.DisplayTypeComboBox = QtGui.QComboBox(self.PresentationWidget) self.displayTypeLabel.setBuddy(self.displayTypeComboBox)
self.DisplayTypeComboBox.setObjectName(u'DisplayTypeComboBox') self.displayLayout.addRow(self.displayTypeLabel,
self.DisplayLayout.addWidget(self.DisplayTypeComboBox, 0, 1, 1, 2) self.displayTypeComboBox)
self.DisplayTypeLabel = QtGui.QLabel(self.PresentationWidget)
self.DisplayTypeLabel.setObjectName(u'SearchTypeLabel')
self.DisplayLayout.addWidget(self.DisplayTypeLabel, 0, 0, 1, 1)
self.DisplayTypeLabel.setText(
translate('PresentationPlugin.MediaItem', 'Present using:'))
# Add the Presentation widget to the page layout # Add the Presentation widget to the page layout
self.pageLayout.addWidget(self.PresentationWidget) self.pageLayout.addWidget(self.presentationWidget)
def initialise(self): def initialise(self):
""" """
@ -151,19 +148,19 @@ class PresentationMediaItem(MediaManagerItem):
Load the combobox with the enabled presentation controllers, Load the combobox with the enabled presentation controllers,
allowing user to select a specific app if settings allow allowing user to select a specific app if settings allow
""" """
self.DisplayTypeComboBox.clear() self.displayTypeComboBox.clear()
for item in self.controllers: for item in self.controllers:
# load the drop down selection # load the drop down selection
if self.controllers[item].enabled(): if self.controllers[item].enabled():
self.DisplayTypeComboBox.addItem(item) self.displayTypeComboBox.addItem(item)
if self.DisplayTypeComboBox.count() > 1: if self.displayTypeComboBox.count() > 1:
self.DisplayTypeComboBox.insertItem(0, self.Automatic) self.displayTypeComboBox.insertItem(0, self.Automatic)
self.DisplayTypeComboBox.setCurrentIndex(0) self.displayTypeComboBox.setCurrentIndex(0)
if QtCore.QSettings().value(self.settingsSection + u'/override app', if QtCore.QSettings().value(self.settingsSection + u'/override app',
QtCore.QVariant(QtCore.Qt.Unchecked)) == QtCore.Qt.Checked: QtCore.QVariant(QtCore.Qt.Unchecked)) == QtCore.Qt.Checked:
self.PresentationWidget.show() self.presentationWidget.show()
else: else:
self.PresentationWidget.hide() self.presentationWidget.hide()
def loadList(self, list, initialLoad=False): def loadList(self, list, initialLoad=False):
""" """
@ -247,8 +244,8 @@ class PresentationMediaItem(MediaManagerItem):
items = self.listView.selectedIndexes() items = self.listView.selectedIndexes()
if len(items) > 1: if len(items) > 1:
return False return False
service_item.title = unicode(self.DisplayTypeComboBox.currentText()) service_item.title = unicode(self.displayTypeComboBox.currentText())
service_item.shortname = unicode(self.DisplayTypeComboBox.currentText()) service_item.shortname = unicode(self.displayTypeComboBox.currentText())
service_item.add_capability(ItemCapabilities.ProvidesOwnDisplay) service_item.add_capability(ItemCapabilities.ProvidesOwnDisplay)
shortname = service_item.shortname shortname = service_item.shortname
if shortname: if shortname:

View File

@ -29,58 +29,51 @@ from PyQt4 import QtCore, QtGui
from openlp.core.lib import translate from openlp.core.lib import translate
class Ui_AuthorsDialog(object): class Ui_AuthorsDialog(object):
def setupUi(self, AuthorsDialog): def setupUi(self, authorsDialog):
AuthorsDialog.setObjectName(u'AuthorsDialog') authorsDialog.setObjectName(u'AuthorsDialog')
AuthorsDialog.resize(393, 147) authorsDialog.resize(300, 10)
self.AuthorsLayout = QtGui.QFormLayout(AuthorsDialog) self.dialogLayout = QtGui.QVBoxLayout(authorsDialog)
self.AuthorsLayout.setMargin(8) self.dialogLayout.setObjectName(u'dialogLayout')
self.AuthorsLayout.setSpacing(8) self.authorLayout = QtGui.QFormLayout()
self.AuthorsLayout.setObjectName(u'AuthorsLayout') self.authorLayout.setObjectName(u'authorLayout')
self.FirstNameLabel = QtGui.QLabel(AuthorsDialog) self.firstNameLabel = QtGui.QLabel(authorsDialog)
self.FirstNameLabel.setObjectName(u'FirstNameLabel') self.firstNameLabel.setObjectName(u'firstNameLabel')
self.AuthorsLayout.setWidget(0, self.firstNameEdit = QtGui.QLineEdit(authorsDialog)
QtGui.QFormLayout.LabelRole, self.FirstNameLabel) self.firstNameEdit.setObjectName(u'firstNameEdit')
self.FirstNameEdit = QtGui.QLineEdit(AuthorsDialog) self.firstNameLabel.setBuddy(self.firstNameEdit)
self.FirstNameEdit.setObjectName(u'FirstNameEdit') self.authorLayout.addRow(self.firstNameLabel, self.firstNameEdit)
self.AuthorsLayout.setWidget(0, self.lastNameLabel = QtGui.QLabel(authorsDialog)
QtGui.QFormLayout.FieldRole, self.FirstNameEdit) self.lastNameLabel.setObjectName(u'lastNameLabel')
self.LastNameLabel = QtGui.QLabel(AuthorsDialog) self.lastNameEdit = QtGui.QLineEdit(authorsDialog)
self.LastNameLabel.setObjectName(u'LastNameLabel') self.lastNameEdit.setObjectName(u'lastNameEdit')
self.AuthorsLayout.setWidget(1, self.lastNameLabel.setBuddy(self.lastNameEdit)
QtGui.QFormLayout.LabelRole, self.LastNameLabel) self.authorLayout.addRow(self.lastNameLabel, self.lastNameEdit)
self.LastNameEdit = QtGui.QLineEdit(AuthorsDialog) self.displayLabel = QtGui.QLabel(authorsDialog)
self.LastNameEdit.setObjectName(u'LastNameEdit') self.displayLabel.setObjectName(u'displayLabel')
self.AuthorsLayout.setWidget(1, self.displayEdit = QtGui.QLineEdit(authorsDialog)
QtGui.QFormLayout.FieldRole, self.LastNameEdit) self.displayEdit.setObjectName(u'displayEdit')
self.DisplayLabel = QtGui.QLabel(AuthorsDialog) self.displayLabel.setBuddy(self.displayEdit)
self.DisplayLabel.setObjectName(u'DisplayLabel') self.authorLayout.addRow(self.displayLabel, self.displayEdit)
self.AuthorsLayout.setWidget(2, self.dialogLayout.addLayout(self.authorLayout)
QtGui.QFormLayout.LabelRole, self.DisplayLabel) self.buttonBox = QtGui.QDialogButtonBox(authorsDialog)
self.DisplayEdit = QtGui.QLineEdit(AuthorsDialog) self.buttonBox.setStandardButtons(
self.DisplayEdit.setObjectName(u'DisplayEdit') QtGui.QDialogButtonBox.Save | QtGui.QDialogButtonBox.Cancel)
self.AuthorsLayout.setWidget(2, self.buttonBox.setObjectName(u'buttonBox')
QtGui.QFormLayout.FieldRole, self.DisplayEdit) self.dialogLayout.addWidget(self.buttonBox)
self.AuthorButtonBox = QtGui.QDialogButtonBox(AuthorsDialog) self.retranslateUi(authorsDialog)
self.AuthorButtonBox.setOrientation(QtCore.Qt.Horizontal) authorsDialog.setMaximumHeight(authorsDialog.sizeHint().height())
self.AuthorButtonBox.setStandardButtons( QtCore.QObject.connect(self.buttonBox,
QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Save) QtCore.SIGNAL(u'accepted()'), authorsDialog.accept)
self.AuthorButtonBox.setObjectName(u'AuthorButtonBox') QtCore.QObject.connect(self.buttonBox,
self.AuthorsLayout.setWidget(3, QtCore.SIGNAL(u'rejected()'), authorsDialog.reject)
QtGui.QFormLayout.FieldRole, self.AuthorButtonBox) QtCore.QMetaObject.connectSlotsByName(authorsDialog)
self.retranslateUi(AuthorsDialog) def retranslateUi(self, authorsDialog):
QtCore.QObject.connect(self.AuthorButtonBox, authorsDialog.setWindowTitle(
QtCore.SIGNAL(u'accepted()'), AuthorsDialog.accept)
QtCore.QObject.connect(self.AuthorButtonBox,
QtCore.SIGNAL(u'rejected()'), AuthorsDialog.reject)
QtCore.QMetaObject.connectSlotsByName(AuthorsDialog)
def retranslateUi(self, AuthorsDialog):
AuthorsDialog.setWindowTitle(
translate('SongsPlugin.AuthorsForm', 'Author Maintenance')) translate('SongsPlugin.AuthorsForm', 'Author Maintenance'))
self.DisplayLabel.setText( self.displayLabel.setText(
translate('SongsPlugin.AuthorsForm', 'Display name:')) translate('SongsPlugin.AuthorsForm', 'Display name:'))
self.FirstNameLabel.setText( self.firstNameLabel.setText(
translate('SongsPlugin.AuthorsForm', 'First name:')) translate('SongsPlugin.AuthorsForm', 'First name:'))
self.LastNameLabel.setText( self.lastNameLabel.setText(
translate('SongsPlugin.AuthorsForm', 'Last name:')) translate('SongsPlugin.AuthorsForm', 'Last name:'))

View File

@ -40,36 +40,36 @@ class AuthorsForm(QtGui.QDialog, Ui_AuthorsDialog):
QtGui.QDialog.__init__(self, parent) QtGui.QDialog.__init__(self, parent)
self.setupUi(self) self.setupUi(self)
self._autoDisplayName = False self._autoDisplayName = False
QtCore.QObject.connect(self.FirstNameEdit, QtCore.QObject.connect(self.firstNameEdit,
QtCore.SIGNAL(u'textEdited(QString)'), QtCore.SIGNAL(u'textEdited(QString)'),
self.onFirstNameEditTextEdited) self.onFirstNameEditTextEdited)
QtCore.QObject.connect(self.LastNameEdit, QtCore.QObject.connect(self.lastNameEdit,
QtCore.SIGNAL(u'textEdited(QString)'), QtCore.SIGNAL(u'textEdited(QString)'),
self.onLastNameEditTextEdited) self.onLastNameEditTextEdited)
def exec_(self, clear=True): def exec_(self, clear=True):
if clear: if clear:
self.FirstNameEdit.clear() self.firstNameEdit.clear()
self.LastNameEdit.clear() self.lastNameEdit.clear()
self.DisplayEdit.clear() self.displayEdit.clear()
self.FirstNameEdit.setFocus() self.firstNameEdit.setFocus()
return QtGui.QDialog.exec_(self) return QtGui.QDialog.exec_(self)
def onFirstNameEditTextEdited(self, text): def onFirstNameEditTextEdited(self, text):
if not self._autoDisplayName: if not self._autoDisplayName:
return return
display_name = text display_name = text
if self.LastNameEdit.text() != u'': if self.lastNameEdit.text() != u'':
display_name = display_name + u' ' + self.LastNameEdit.text() display_name = display_name + u' ' + self.lastNameEdit.text()
self.DisplayEdit.setText(display_name) self.displayEdit.setText(display_name)
def onLastNameEditTextEdited(self, text): def onLastNameEditTextEdited(self, text):
if not self._autoDisplayName: if not self._autoDisplayName:
return return
display_name = text display_name = text
if self.FirstNameEdit.text() != u'': if self.firstNameEdit.text() != u'':
display_name = self.FirstNameEdit.text() + u' ' + display_name display_name = self.firstNameEdit.text() + u' ' + display_name
self.DisplayEdit.setText(display_name) self.displayEdit.setText(display_name)
def autoDisplayName(self): def autoDisplayName(self):
return self._autoDisplayName return self._autoDisplayName
@ -78,21 +78,21 @@ class AuthorsForm(QtGui.QDialog, Ui_AuthorsDialog):
self._autoDisplayName = on self._autoDisplayName = on
def accept(self): def accept(self):
if not self.FirstNameEdit.text(): if not self.firstNameEdit.text():
QtGui.QMessageBox.critical( QtGui.QMessageBox.critical(
self, translate('SongsPlugin.AuthorsForm', 'Error'), self, translate('SongsPlugin.AuthorsForm', 'Error'),
translate('SongsPlugin.AuthorsForm', translate('SongsPlugin.AuthorsForm',
'You need to type in the first name of the author.')) 'You need to type in the first name of the author.'))
self.FirstNameEdit.setFocus() self.firstNameEdit.setFocus()
return False return False
elif not self.LastNameEdit.text(): elif not self.lastNameEdit.text():
QtGui.QMessageBox.critical( QtGui.QMessageBox.critical(
self, translate('SongsPlugin.AuthorsForm', 'Error'), self, translate('SongsPlugin.AuthorsForm', 'Error'),
translate('SongsPlugin.AuthorsForm', translate('SongsPlugin.AuthorsForm',
'You need to type in the last name of the author.')) 'You need to type in the last name of the author.'))
self.LastNameEdit.setFocus() self.lastNameEdit.setFocus()
return False return False
elif not self.DisplayEdit.text(): elif not self.displayEdit.text():
if QtGui.QMessageBox.critical( if QtGui.QMessageBox.critical(
self, translate('SongsPlugin.AuthorsForm', 'Error'), self, translate('SongsPlugin.AuthorsForm', 'Error'),
translate('SongsPlugin.AuthorsForm', translate('SongsPlugin.AuthorsForm',
@ -101,11 +101,11 @@ class AuthorsForm(QtGui.QDialog, Ui_AuthorsDialog):
QtGui.QMessageBox.StandardButtons( QtGui.QMessageBox.StandardButtons(
QtGui.QMessageBox.Yes | QtGui.QMessageBox.No) QtGui.QMessageBox.Yes | QtGui.QMessageBox.No)
) == QtGui.QMessageBox.Yes: ) == QtGui.QMessageBox.Yes:
self.DisplayEdit.setText(self.FirstNameEdit.text() + \ self.displayEdit.setText(self.firstNameEdit.text() + \
u' ' + self.LastNameEdit.text()) u' ' + self.lastNameEdit.text())
return QtGui.QDialog.accept(self) return QtGui.QDialog.accept(self)
else: else:
self.DisplayEdit.setFocus() self.displayEdit.setFocus()
return False return False
else: else:
return QtGui.QDialog.accept(self) return QtGui.QDialog.accept(self)

View File

@ -29,445 +29,309 @@ from PyQt4 import QtCore, QtGui
from openlp.core.lib import build_icon, translate from openlp.core.lib import build_icon, translate
class Ui_EditSongDialog(object): class Ui_EditSongDialog(object):
def setupUi(self, EditSongDialog): def setupUi(self, editSongDialog):
EditSongDialog.setObjectName(u'EditSongDialog') editSongDialog.setObjectName(u'editSongDialog')
EditSongDialog.resize(645, 417) editSongDialog.resize(650, 400)
icon = build_icon(u':/icon/openlp.org-icon-32.bmp') editSongDialog.setWindowIcon(
EditSongDialog.setWindowIcon(icon) build_icon(u':/icon/openlp.org-icon-32.bmp'))
EditSongDialog.setModal(True) editSongDialog.setModal(True)
self.verticalLayout = QtGui.QVBoxLayout(EditSongDialog) self.dialogLayout = QtGui.QVBoxLayout(editSongDialog)
self.verticalLayout.setMargin(8) self.dialogLayout.setObjectName(u'dialogLayout')
self.verticalLayout.setObjectName(u'verticalLayout') self.songTabWidget = QtGui.QTabWidget(editSongDialog)
self.SongTabWidget = QtGui.QTabWidget(EditSongDialog) self.songTabWidget.setObjectName(u'songTabWidget')
self.SongTabWidget.setObjectName(u'SongTabWidget') # lyrics tab
self.LyricsTab = QtGui.QWidget() self.lyricsTab = QtGui.QWidget()
self.LyricsTab.setObjectName(u'LyricsTab') self.lyricsTab.setObjectName(u'lyricsTab')
self.LyricsTabLayout = QtGui.QGridLayout(self.LyricsTab) self.lyricsTabLayout = QtGui.QGridLayout(self.lyricsTab)
self.LyricsTabLayout.setMargin(8) self.lyricsTabLayout.setObjectName(u'lyricsTabLayout')
self.LyricsTabLayout.setSpacing(8) self.titleLabel = QtGui.QLabel(self.lyricsTab)
self.LyricsTabLayout.setObjectName(u'LyricsTabLayout') self.titleLabel.setObjectName(u'titleLabel')
self.TitleLabel = QtGui.QLabel(self.LyricsTab) self.lyricsTabLayout.addWidget(self.titleLabel, 0, 0)
self.TitleLabel.setObjectName(u'TitleLabel') self.titleEdit = QtGui.QLineEdit(self.lyricsTab)
self.LyricsTabLayout.addWidget(self.TitleLabel, 0, 0, 1, 1) self.titleEdit.setObjectName(u'titleEdit')
self.TitleEditItem = QtGui.QLineEdit(self.LyricsTab) self.titleLabel.setBuddy(self.titleEdit)
self.TitleLabel.setBuddy(self.TitleEditItem) self.lyricsTabLayout.addWidget(self.titleEdit, 0, 1, 1, 2)
sizePolicy = QtGui.QSizePolicy( self.alternativeTitleLabel = QtGui.QLabel(self.lyricsTab)
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed) self.alternativeTitleLabel.setObjectName(u'alternativeTitleLabel')
sizePolicy.setHorizontalStretch(0) self.lyricsTabLayout.addWidget(self.alternativeTitleLabel, 1, 0)
sizePolicy.setVerticalStretch(0) self.alternativeEdit = QtGui.QLineEdit(self.lyricsTab)
sizePolicy.setHeightForWidth( self.alternativeEdit.setObjectName(u'alternativeEdit')
self.TitleEditItem.sizePolicy().hasHeightForWidth()) self.alternativeTitleLabel.setBuddy(self.alternativeEdit)
self.TitleEditItem.setSizePolicy(sizePolicy) self.lyricsTabLayout.addWidget(self.alternativeEdit, 1, 1, 1, 2)
self.TitleEditItem.setObjectName(u'TitleEditItem') self.lyricsLabel = QtGui.QLabel(self.lyricsTab)
self.LyricsTabLayout.addWidget(self.TitleEditItem, 0, 1, 1, 2) self.lyricsLabel.setFixedHeight(self.titleEdit.sizeHint().height())
self.AlternativeTitleLabel = QtGui.QLabel(self.LyricsTab) self.lyricsLabel.setObjectName(u'lyricsLabel')
self.AlternativeTitleLabel.setObjectName(u'AlternativeTitleLabel') self.lyricsTabLayout.addWidget(self.lyricsLabel, 2, 0,
self.LyricsTabLayout.addWidget(self.AlternativeTitleLabel, 1, 0, 1, 1) QtCore.Qt.AlignTop)
self.AlternativeEdit = QtGui.QLineEdit(self.LyricsTab) self.verseListWidget = QtGui.QTableWidget(self.lyricsTab)
self.AlternativeTitleLabel.setBuddy(self.AlternativeEdit) self.verseListWidget.horizontalHeader().setVisible(False)
self.AlternativeEdit.setObjectName(u'AlternativeEdit') self.verseListWidget.setAlternatingRowColors(True)
self.LyricsTabLayout.addWidget(self.AlternativeEdit, 1, 1, 1, 2) self.verseListWidget.setColumnCount(1)
self.LyricsLabel = QtGui.QLabel(self.LyricsTab) self.verseListWidget.setSelectionBehavior(
self.LyricsLabel.setAlignment( QtGui.QAbstractItemView.SelectRows)
QtCore.Qt.AlignLeading | QtCore.Qt.AlignLeft | QtCore.Qt.AlignTop) self.verseListWidget.setEditTriggers(
self.LyricsLabel.setObjectName(u'LyricsLabel')
self.LyricsTabLayout.addWidget(self.LyricsLabel, 2, 0, 1, 1)
self.VerseListWidget = QtGui.QTableWidget(self.LyricsTab)
self.LyricsLabel.setBuddy(self.VerseListWidget)
self.VerseListWidget.setColumnCount(1)
self.VerseListWidget.horizontalHeader().setVisible(False)
self.VerseListWidget.setSelectionBehavior(1)
self.VerseListWidget.setEditTriggers(
QtGui.QAbstractItemView.NoEditTriggers) QtGui.QAbstractItemView.NoEditTriggers)
self.VerseListWidget.setAlternatingRowColors(True) self.verseListWidget.setObjectName(u'verseListWidget')
self.VerseListWidget.setObjectName(u'VerseListWidget') self.lyricsLabel.setBuddy(self.verseListWidget)
self.LyricsTabLayout.addWidget(self.VerseListWidget, 2, 1, 1, 1) self.lyricsTabLayout.addWidget(self.verseListWidget, 2, 1)
self.VerseOrderLabel = QtGui.QLabel(self.LyricsTab) self.verseOrderLabel = QtGui.QLabel(self.lyricsTab)
self.VerseOrderLabel.setObjectName(u'VerseOrderLabel') self.verseOrderLabel.setObjectName(u'verseOrderLabel')
self.LyricsTabLayout.addWidget(self.VerseOrderLabel, 4, 0, 1, 1) self.lyricsTabLayout.addWidget(self.verseOrderLabel, 3, 0)
self.VerseOrderEdit = QtGui.QLineEdit(self.LyricsTab) self.verseOrderEdit = QtGui.QLineEdit(self.lyricsTab)
self.VerseOrderLabel.setBuddy(self.VerseOrderEdit) self.verseOrderEdit.setObjectName(u'verseOrderEdit')
self.VerseOrderEdit.setObjectName(u'VerseOrderEdit') self.verseOrderLabel.setBuddy(self.verseOrderEdit)
self.LyricsTabLayout.addWidget(self.VerseOrderEdit, 4, 1, 1, 2) self.lyricsTabLayout.addWidget(self.verseOrderEdit, 3, 1, 1, 2)
self.VerseButtonWidget = QtGui.QWidget(self.LyricsTab) self.verseButtonsLayout = QtGui.QVBoxLayout()
self.VerseButtonWidget.setObjectName(u'VerseButtonWidget') self.verseButtonsLayout.setObjectName(u'verseButtonsLayout')
self.VerseButtonsLayout = QtGui.QVBoxLayout(self.VerseButtonWidget) self.verseAddButton = QtGui.QPushButton(self.lyricsTab)
self.VerseButtonsLayout.setSpacing(8) self.verseAddButton.setObjectName(u'verseAddButton')
self.VerseButtonsLayout.setMargin(0) self.verseButtonsLayout.addWidget(self.verseAddButton)
self.VerseButtonsLayout.setObjectName(u'VerseButtonsLayout') self.verseEditButton = QtGui.QPushButton(self.lyricsTab)
self.VerseAddButton = QtGui.QPushButton(self.VerseButtonWidget) self.verseEditButton.setObjectName(u'verseEditButton')
self.VerseAddButton.setObjectName(u'VerseAddButton') self.verseButtonsLayout.addWidget(self.verseEditButton)
self.VerseButtonsLayout.addWidget(self.VerseAddButton) self.verseEditAllButton = QtGui.QPushButton(self.lyricsTab)
self.VerseEditButton = QtGui.QPushButton(self.VerseButtonWidget) self.verseEditAllButton.setObjectName(u'verseEditAllButton')
self.VerseEditButton.setObjectName(u'VerseEditButton') self.verseButtonsLayout.addWidget(self.verseEditAllButton)
self.VerseButtonsLayout.addWidget(self.VerseEditButton) self.verseDeleteButton = QtGui.QPushButton(self.lyricsTab)
self.VerseEditAllButton = QtGui.QPushButton(self.VerseButtonWidget) self.verseDeleteButton.setObjectName(u'verseDeleteButton')
self.VerseEditAllButton.setObjectName(u'VerseEditAllButton') self.verseButtonsLayout.addWidget(self.verseDeleteButton)
self.VerseButtonsLayout.addWidget(self.VerseEditAllButton) self.verseButtonsLayout.addStretch()
self.VerseDeleteButton = QtGui.QPushButton(self.VerseButtonWidget) self.lyricsTabLayout.addLayout(self.verseButtonsLayout, 2, 2)
self.VerseDeleteButton.setObjectName(u'VerseDeleteButton') self.songTabWidget.addTab(self.lyricsTab, u'')
self.VerseButtonsLayout.addWidget(self.VerseDeleteButton) # authors tab
spacerItem = QtGui.QSpacerItem(20, 40, self.authorsTab = QtGui.QWidget()
QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) self.authorsTab.setObjectName(u'authorsTab')
self.VerseButtonsLayout.addItem(spacerItem) self.authorsTabLayout = QtGui.QHBoxLayout(self.authorsTab)
self.LyricsTabLayout.addWidget(self.VerseButtonWidget, 2, 2, 1, 1) self.authorsTabLayout.setObjectName(u'authorsTabLayout')
self.SongTabWidget.addTab(self.LyricsTab, u'') self.authorsLeftLayout = QtGui.QVBoxLayout()
self.AuthorsTab = QtGui.QWidget() self.authorsLeftLayout.setObjectName(u'authorsLeftLayout')
self.AuthorsTab.setObjectName(u'AuthorsTab') self.authorsGroupBox = QtGui.QGroupBox(self.authorsTab)
self.AuthorsTabLayout = QtGui.QHBoxLayout(self.AuthorsTab) self.authorsGroupBox.setObjectName(u'authorsGroupBox')
self.AuthorsTabLayout.setSpacing(8) self.authorsLayout = QtGui.QVBoxLayout(self.authorsGroupBox)
self.AuthorsTabLayout.setMargin(8) self.authorsLayout.setObjectName(u'authorsLayout')
self.AuthorsTabLayout.setObjectName(u'AuthorsTabLayout') self.authorAddLayout = QtGui.QHBoxLayout()
self.AuthorsMaintenanceWidget = QtGui.QWidget(self.AuthorsTab) self.authorAddLayout.setObjectName(u'authorAddLayout')
self.AuthorsMaintenanceWidget.setObjectName(u'AuthorsMaintenanceWidget') self.authorsComboBox = QtGui.QComboBox(self.authorsGroupBox)
self.AuthorsMaintenanceLayout = QtGui.QVBoxLayout( self.authorsComboBox.setSizeAdjustPolicy(
self.AuthorsMaintenanceWidget)
self.AuthorsMaintenanceLayout.setSpacing(8)
self.AuthorsMaintenanceLayout.setMargin(0)
self.AuthorsMaintenanceLayout.setObjectName(u'AuthorsMaintenanceLayout')
self.AuthorsGroupBox = QtGui.QGroupBox(self.AuthorsMaintenanceWidget)
self.AuthorsGroupBox.setObjectName(u'AuthorsGroupBox')
self.AuthorsLayout = QtGui.QVBoxLayout(self.AuthorsGroupBox)
self.AuthorsLayout.setSpacing(8)
self.AuthorsLayout.setMargin(8)
self.AuthorsLayout.setObjectName(u'AuthorsLayout')
self.AuthorAddWidget = QtGui.QWidget(self.AuthorsGroupBox)
self.AuthorAddWidget.setObjectName(u'AuthorAddWidget')
self.AuthorAddLayout = QtGui.QHBoxLayout(self.AuthorAddWidget)
self.AuthorAddLayout.setSpacing(8)
self.AuthorAddLayout.setMargin(0)
self.AuthorAddLayout.setObjectName(u'AuthorAddLayout')
self.AuthorsSelectionComboItem = QtGui.QComboBox(self.AuthorAddWidget)
sizePolicy = QtGui.QSizePolicy(
QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(
self.AuthorsSelectionComboItem.sizePolicy().hasHeightForWidth())
self.AuthorsSelectionComboItem.setSizePolicy(sizePolicy)
self.AuthorsSelectionComboItem.setEditable(True)
self.AuthorsSelectionComboItem.setInsertPolicy(QtGui.QComboBox.NoInsert)
self.AuthorsSelectionComboItem.setSizeAdjustPolicy(
QtGui.QComboBox.AdjustToMinimumContentsLength) QtGui.QComboBox.AdjustToMinimumContentsLength)
self.AuthorsSelectionComboItem.setMinimumContentsLength(8) self.authorsComboBox.setSizePolicy(QtGui.QSizePolicy.Expanding,
self.AuthorsSelectionComboItem.setObjectName(
u'AuthorsSelectionComboItem')
self.AuthorAddLayout.addWidget(self.AuthorsSelectionComboItem)
self.AuthorAddButton = QtGui.QPushButton(self.AuthorAddWidget)
self.AuthorAddButton.setMaximumSize(QtCore.QSize(110, 16777215))
self.AuthorAddButton.setObjectName(u'AuthorAddButton')
self.AuthorAddLayout.addWidget(self.AuthorAddButton)
self.AuthorsLayout.addWidget(self.AuthorAddWidget)
self.AuthorsListView = QtGui.QListWidget(self.AuthorsGroupBox)
self.AuthorsListView.setAlternatingRowColors(True)
self.AuthorsListView.setObjectName(u'AuthorsListView')
self.AuthorsLayout.addWidget(self.AuthorsListView)
self.AuthorRemoveWidget = QtGui.QWidget(self.AuthorsGroupBox)
self.AuthorRemoveWidget.setObjectName(u'AuthorRemoveWidget')
self.AuthorRemoveLayout = QtGui.QHBoxLayout(self.AuthorRemoveWidget)
self.AuthorRemoveLayout.setSpacing(8)
self.AuthorRemoveLayout.setMargin(0)
self.AuthorRemoveLayout.setObjectName(u'AuthorRemoveLayout')
spacerItem1 = QtGui.QSpacerItem(40, 20,
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.AuthorRemoveLayout.addItem(spacerItem1)
self.AuthorRemoveButton = QtGui.QPushButton(self.AuthorRemoveWidget)
self.AuthorRemoveButton.setObjectName(u'AuthorRemoveButton')
self.AuthorRemoveLayout.addWidget(self.AuthorRemoveButton)
self.AuthorsLayout.addWidget(self.AuthorRemoveWidget)
self.AuthorsMaintenanceLayout.addWidget(self.AuthorsGroupBox)
self.MaintenanceWidget = QtGui.QWidget(self.AuthorsMaintenanceWidget)
self.MaintenanceWidget.setObjectName(u'MaintenanceWidget')
self.MaintenanceLayout = QtGui.QHBoxLayout(self.MaintenanceWidget)
self.MaintenanceLayout.setSpacing(0)
self.MaintenanceLayout.setMargin(0)
self.MaintenanceLayout.setObjectName(u'MaintenanceLayout')
self.MaintenanceButton = QtGui.QPushButton(self.MaintenanceWidget)
self.MaintenanceButton.setObjectName(u'MaintenanceButton')
self.MaintenanceLayout.addWidget(self.MaintenanceButton)
spacerItem2 = QtGui.QSpacerItem(66, 20,
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.MaintenanceLayout.addItem(spacerItem2)
self.AuthorsMaintenanceLayout.addWidget(self.MaintenanceWidget)
self.AuthorsTabLayout.addWidget(self.AuthorsMaintenanceWidget)
self.TopicBookWidget = QtGui.QWidget(self.AuthorsTab)
self.TopicBookWidget.setObjectName(u'TopicBookWidget')
self.TopicBookLayout = QtGui.QVBoxLayout(self.TopicBookWidget)
self.TopicBookLayout.setSpacing(8)
self.TopicBookLayout.setMargin(0)
self.TopicBookLayout.setObjectName(u'TopicBookLayout')
self.TopicGroupBox = QtGui.QGroupBox(self.TopicBookWidget)
sizePolicy = QtGui.QSizePolicy(
QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(
self.TopicGroupBox.sizePolicy().hasHeightForWidth())
self.TopicGroupBox.setSizePolicy(sizePolicy)
self.TopicGroupBox.setObjectName(u'TopicGroupBox')
self.TopicLayout = QtGui.QVBoxLayout(self.TopicGroupBox)
self.TopicLayout.setSpacing(8)
self.TopicLayout.setMargin(8)
self.TopicLayout.setObjectName(u'TopicLayout')
self.TopicAddWidget = QtGui.QWidget(self.TopicGroupBox)
self.TopicAddWidget.setObjectName(u'TopicAddWidget')
self.TopicAddLayout = QtGui.QHBoxLayout(self.TopicAddWidget)
self.TopicAddLayout.setSpacing(8)
self.TopicAddLayout.setMargin(0)
self.TopicAddLayout.setObjectName(u'TopicAddLayout')
self.SongTopicCombo = QtGui.QComboBox(self.TopicAddWidget)
sizePolicy = QtGui.QSizePolicy(
QtGui.QSizePolicy.MinimumExpanding, QtGui.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(
self.SongTopicCombo.sizePolicy().hasHeightForWidth())
self.SongTopicCombo.setEditable(True)
self.SongTopicCombo.setInsertPolicy(QtGui.QComboBox.NoInsert)
self.SongTopicCombo.setSizePolicy(sizePolicy)
self.SongTopicCombo.setObjectName(u'SongTopicCombo')
self.TopicAddLayout.addWidget(self.SongTopicCombo)
self.TopicAddButton = QtGui.QPushButton(self.TopicAddWidget)
sizePolicy = QtGui.QSizePolicy(
QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(
self.TopicAddButton.sizePolicy().hasHeightForWidth())
self.TopicAddButton.setSizePolicy(sizePolicy)
self.TopicAddButton.setObjectName(u'TopicAddButton')
self.TopicAddLayout.addWidget(self.TopicAddButton)
self.TopicLayout.addWidget(self.TopicAddWidget)
self.TopicsListView = QtGui.QListWidget(self.TopicGroupBox)
self.TopicsListView.setAlternatingRowColors(True)
self.TopicsListView.setObjectName(u'TopicsListView')
self.TopicLayout.addWidget(self.TopicsListView)
self.TopicRemoveWidget = QtGui.QWidget(self.TopicGroupBox)
self.TopicRemoveWidget.setObjectName(u'TopicRemoveWidget')
self.TopicRemoveLayout = QtGui.QHBoxLayout(self.TopicRemoveWidget)
self.TopicRemoveLayout.setSpacing(8)
self.TopicRemoveLayout.setMargin(0)
self.TopicRemoveLayout.setObjectName(u'TopicRemoveLayout')
spacerItem3 = QtGui.QSpacerItem(40, 20,
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.TopicRemoveLayout.addItem(spacerItem3)
self.TopicRemoveButton = QtGui.QPushButton(self.TopicRemoveWidget)
self.TopicRemoveButton.setObjectName(u'TopicRemoveButton')
self.TopicRemoveLayout.addWidget(self.TopicRemoveButton)
self.TopicLayout.addWidget(self.TopicRemoveWidget)
self.TopicBookLayout.addWidget(self.TopicGroupBox)
self.SongBookGroup = QtGui.QGroupBox(self.TopicBookWidget)
self.SongBookGroup.setObjectName(u'SongBookGroup')
self.SongbookLayout = QtGui.QFormLayout(self.SongBookGroup)
self.SongbookLayout.setMargin(8)
self.SongbookLayout.setSpacing(8)
self.SongbookLayout.setObjectName(u'SongbookLayout')
self.SongbookNameLabel = QtGui.QLabel(self.SongBookGroup)
self.SongbookCombo = QtGui.QComboBox(self.SongBookGroup)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.MinimumExpanding,
QtGui.QSizePolicy.Fixed) QtGui.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0) self.authorsComboBox.setEditable(True)
sizePolicy.setVerticalStretch(0) self.authorsComboBox.setInsertPolicy(QtGui.QComboBox.NoInsert)
sizePolicy.setHeightForWidth( self.authorsComboBox.setObjectName(u'authorsComboBox')
self.SongbookCombo.sizePolicy().hasHeightForWidth()) self.authorAddLayout.addWidget(self.authorsComboBox)
self.SongbookCombo.setEditable(True) self.authorAddButton = QtGui.QPushButton(self.authorsGroupBox)
self.SongbookCombo.setInsertPolicy(QtGui.QComboBox.NoInsert) self.authorAddButton.setObjectName(u'authorAddButton')
self.SongbookCombo.setSizePolicy(sizePolicy) self.authorAddLayout.addWidget(self.authorAddButton)
self.SongbookCombo.setObjectName(u'SongbookCombo') self.authorsLayout.addLayout(self.authorAddLayout)
self.SongbookLayout.addRow(self.SongbookNameLabel, self.SongbookCombo) self.authorsListView = QtGui.QListWidget(self.authorsGroupBox)
self.songBookNumberLabel = QtGui.QLabel(self.SongBookGroup) self.authorsListView.setAlternatingRowColors(True)
self.songBookNumberEdit = QtGui.QLineEdit(self.SongBookGroup) self.authorsListView.setObjectName(u'authorsListView')
self.SongbookLayout.addRow(self.songBookNumberLabel, self.authorsLayout.addWidget(self.authorsListView)
self.authorRemoveLayout = QtGui.QHBoxLayout()
self.authorRemoveLayout.setObjectName(u'authorRemoveLayout')
self.authorRemoveLayout.addStretch()
self.authorRemoveButton = QtGui.QPushButton(self.authorsGroupBox)
self.authorRemoveButton.setObjectName(u'authorRemoveButton')
self.authorRemoveLayout.addWidget(self.authorRemoveButton)
self.authorsLayout.addLayout(self.authorRemoveLayout)
self.authorsLeftLayout.addWidget(self.authorsGroupBox)
self.maintenanceLayout = QtGui.QHBoxLayout()
self.maintenanceLayout.setObjectName(u'maintenanceLayout')
self.maintenanceButton = QtGui.QPushButton(self.authorsTab)
self.maintenanceButton.setObjectName(u'maintenanceButton')
self.maintenanceLayout.addWidget(self.maintenanceButton)
self.maintenanceLayout.addStretch()
self.authorsLeftLayout.addLayout(self.maintenanceLayout)
self.authorsTabLayout.addLayout(self.authorsLeftLayout)
self.authorsRightLayout = QtGui.QVBoxLayout()
self.authorsRightLayout.setObjectName(u'authorsRightLayout')
self.topicsGroupBox = QtGui.QGroupBox(self.authorsTab)
self.topicsGroupBox.setObjectName(u'topicsGroupBox')
self.topicsLayout = QtGui.QVBoxLayout(self.topicsGroupBox)
self.topicsLayout.setObjectName(u'topicsLayout')
self.topicAddLayout = QtGui.QHBoxLayout()
self.topicAddLayout.setObjectName(u'topicAddLayout')
self.topicsComboBox = QtGui.QComboBox(self.topicsGroupBox)
self.topicsComboBox.setSizeAdjustPolicy(
QtGui.QComboBox.AdjustToMinimumContentsLength)
self.topicsComboBox.setSizePolicy(QtGui.QSizePolicy.Expanding,
QtGui.QSizePolicy.Fixed)
self.topicsComboBox.setEditable(True)
self.topicsComboBox.setInsertPolicy(QtGui.QComboBox.NoInsert)
self.topicsComboBox.setObjectName(u'topicsComboBox')
self.topicAddLayout.addWidget(self.topicsComboBox)
self.topicAddButton = QtGui.QPushButton(self.topicsGroupBox)
self.topicAddButton.setObjectName(u'topicAddButton')
self.topicAddLayout.addWidget(self.topicAddButton)
self.topicsLayout.addLayout(self.topicAddLayout)
self.topicsListView = QtGui.QListWidget(self.topicsGroupBox)
self.topicsListView.setAlternatingRowColors(True)
self.topicsListView.setObjectName(u'topicsListView')
self.topicsLayout.addWidget(self.topicsListView)
self.topicRemoveLayout = QtGui.QHBoxLayout()
self.topicRemoveLayout.setObjectName(u'topicRemoveLayout')
self.topicRemoveLayout.addStretch()
self.topicRemoveButton = QtGui.QPushButton(self.topicsGroupBox)
self.topicRemoveButton.setObjectName(u'topicRemoveButton')
self.topicRemoveLayout.addWidget(self.topicRemoveButton)
self.topicsLayout.addLayout(self.topicRemoveLayout)
self.authorsRightLayout.addWidget(self.topicsGroupBox)
self.songBookGroupBox = QtGui.QGroupBox(self.authorsTab)
self.songBookGroupBox.setObjectName(u'songBookGroupBox')
self.songBookLayout = QtGui.QFormLayout(self.songBookGroupBox)
self.songBookLayout.setObjectName(u'songBookLayout')
self.songBookNameLabel = QtGui.QLabel(self.songBookGroupBox)
self.songBookNameLabel.setObjectName(u'songBookNameLabel')
self.songBookComboBox = QtGui.QComboBox(self.songBookGroupBox)
self.songBookComboBox.setSizePolicy(QtGui.QSizePolicy.Expanding,
QtGui.QSizePolicy.Fixed)
self.songBookComboBox.setEditable(True)
self.songBookComboBox.setInsertPolicy(QtGui.QComboBox.NoInsert)
self.songBookComboBox.setObjectName(u'songBookComboBox')
self.songBookNameLabel.setBuddy(self.songBookComboBox)
self.songBookLayout.addRow(self.songBookNameLabel,
self.songBookComboBox)
self.songBookNumberLabel = QtGui.QLabel(self.songBookGroupBox)
self.songBookNumberLabel.setObjectName(u'songBookNumberLabel')
self.songBookNumberEdit = QtGui.QLineEdit(self.songBookGroupBox)
self.songBookNumberEdit.setObjectName(u'songBookNumberEdit')
self.songBookNumberLabel.setBuddy(self.songBookNumberEdit)
self.songBookLayout.addRow(self.songBookNumberLabel,
self.songBookNumberEdit) self.songBookNumberEdit)
self.TopicBookLayout.addWidget(self.SongBookGroup) self.authorsRightLayout.addWidget(self.songBookGroupBox)
self.AuthorsTabLayout.addWidget(self.TopicBookWidget) self.authorsTabLayout.addLayout(self.authorsRightLayout)
self.SongTabWidget.addTab(self.AuthorsTab, u'') self.songTabWidget.addTab(self.authorsTab, u'')
self.ThemeTab = QtGui.QWidget() # theme tab
self.ThemeTab.setObjectName(u'ThemeTab') self.themeTab = QtGui.QWidget()
self.ThemeTabLayout = QtGui.QVBoxLayout(self.ThemeTab) self.themeTab.setObjectName(u'themeTab')
self.ThemeTabLayout.setSpacing(8) self.themeTabLayout = QtGui.QHBoxLayout(self.themeTab)
self.ThemeTabLayout.setMargin(8) self.themeTabLayout.setObjectName(u'themeTabLayout')
self.ThemeTabLayout.setObjectName(u'ThemeTabLayout') self.themeLeftLayout = QtGui.QVBoxLayout()
self.ThemeCopyCommentsWidget = QtGui.QWidget(self.ThemeTab) self.themeLeftLayout.setObjectName(u'themeLeftLayout')
self.ThemeCopyCommentsWidget.setObjectName(u'ThemeCopyCommentsWidget') self.themeGroupBox = QtGui.QGroupBox(self.themeTab)
self.ThemeCopyCommentsLayout = QtGui.QHBoxLayout( self.themeGroupBox.setObjectName(u'themeGroupBox')
self.ThemeCopyCommentsWidget) self.themeLayout = QtGui.QHBoxLayout(self.themeGroupBox)
self.ThemeCopyCommentsLayout.setSpacing(8) self.themeLayout.setObjectName(u'themeLayout')
self.ThemeCopyCommentsLayout.setMargin(0) self.themeComboBox = QtGui.QComboBox(self.themeGroupBox)
self.ThemeCopyCommentsLayout.setObjectName(u'ThemeCopyCommentsLayout') self.themeComboBox.setSizeAdjustPolicy(
self.TextWidget = QtGui.QWidget(self.ThemeCopyCommentsWidget) QtGui.QComboBox.AdjustToMinimumContentsLength)
sizePolicy = QtGui.QSizePolicy( self.themeComboBox.setSizePolicy(QtGui.QSizePolicy.Expanding,
QtGui.QSizePolicy.MinimumExpanding, QtGui.QSizePolicy.Preferred) QtGui.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0) self.themeComboBox.setEditable(True)
sizePolicy.setVerticalStretch(0) self.themeComboBox.setInsertPolicy(QtGui.QComboBox.NoInsert)
sizePolicy.setHeightForWidth( self.themeComboBox.setObjectName(u'themeComboBox')
self.TextWidget.sizePolicy().hasHeightForWidth()) self.themeLayout.addWidget(self.themeComboBox)
self.TextWidget.setSizePolicy(sizePolicy) self.themeAddButton = QtGui.QPushButton(self.themeGroupBox)
self.TextWidget.setObjectName(u'TextWidget') self.themeAddButton.setObjectName(u'themeAddButton')
self.DetailsLayout = QtGui.QVBoxLayout(self.TextWidget) self.themeLayout.addWidget(self.themeAddButton)
self.DetailsLayout.setSpacing(8) self.themeLeftLayout.addWidget(self.themeGroupBox)
self.DetailsLayout.setMargin(0) self.rightsGroupBox = QtGui.QGroupBox(self.themeTab)
self.DetailsLayout.setObjectName(u'DetailsLayout') self.rightsGroupBox.setObjectName(u'rightsGroupBox')
self.ThemeGroupBox = QtGui.QGroupBox(self.TextWidget) self.rightsLayout = QtGui.QVBoxLayout(self.rightsGroupBox)
self.ThemeGroupBox.setObjectName(u'ThemeGroupBox') self.rightsLayout.setObjectName(u'rightsLayout')
self.ThemeLayout = QtGui.QHBoxLayout(self.ThemeGroupBox) self.copyrightLayout = QtGui.QHBoxLayout()
self.ThemeLayout.setSpacing(8) self.copyrightLayout.setObjectName(u'copyrightLayout')
self.ThemeLayout.setMargin(8) self.copyrightEdit = QtGui.QLineEdit(self.rightsGroupBox)
self.ThemeLayout.setObjectName(u'ThemeLayout') self.copyrightEdit.setObjectName(u'copyrightEdit')
self.ThemeSelectionComboItem = QtGui.QComboBox(self.ThemeGroupBox) self.copyrightLayout.addWidget(self.copyrightEdit)
self.ThemeSelectionComboItem.setEditable(True) self.copyrightInsertButton = QtGui.QToolButton(self.rightsGroupBox)
self.ThemeSelectionComboItem.setInsertPolicy(QtGui.QComboBox.NoInsert) self.copyrightInsertButton.setObjectName(u'copyrightInsertButton')
self.ThemeSelectionComboItem.setObjectName(u'ThemeSelectionComboItem') self.copyrightLayout.addWidget(self.copyrightInsertButton)
self.ThemeLayout.addWidget(self.ThemeSelectionComboItem) self.rightsLayout.addLayout(self.copyrightLayout)
self.ThemeAddButton = QtGui.QPushButton(self.ThemeGroupBox) self.CCLILayout = QtGui.QHBoxLayout()
self.ThemeAddButton.setMaximumSize(QtCore.QSize(110, 16777215))
self.ThemeAddButton.setObjectName(u'ThemeAddButton')
self.ThemeLayout.addWidget(self.ThemeAddButton)
self.DetailsLayout.addWidget(self.ThemeGroupBox)
self.CopyrightGroupBox = QtGui.QGroupBox(self.TextWidget)
sizePolicy = QtGui.QSizePolicy(
QtGui.QSizePolicy.MinimumExpanding, QtGui.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(
self.CopyrightGroupBox.sizePolicy().hasHeightForWidth())
self.CopyrightGroupBox.setSizePolicy(sizePolicy)
self.CopyrightGroupBox.setObjectName(u'CopyrightGroupBox')
self.CopyrightLayout = QtGui.QVBoxLayout(self.CopyrightGroupBox)
self.CopyrightLayout.setSpacing(8)
self.CopyrightLayout.setMargin(8)
self.CopyrightLayout.setObjectName(u'CopyrightLayout')
self.CopyrightWidget = QtGui.QWidget(self.CopyrightGroupBox)
self.CopyrightWidget.setObjectName(u'CopyrightWidget')
self.CopyLayout = QtGui.QHBoxLayout(self.CopyrightWidget)
self.CopyLayout.setSpacing(8)
self.CopyLayout.setMargin(0)
self.CopyLayout.setObjectName(u'CopyLayout')
self.CopyrightEditItem = QtGui.QLineEdit(self.CopyrightWidget)
self.CopyrightEditItem.setObjectName(u'CopyrightEditItem')
self.CopyLayout.addWidget(self.CopyrightEditItem)
self.CopyrightInsertButton = QtGui.QPushButton(self.CopyrightWidget)
self.CopyrightInsertButton.setMaximumSize(QtCore.QSize(29, 16777215))
self.CopyrightInsertButton.setObjectName(u'CopyrightInsertButton')
self.CopyLayout.addWidget(self.CopyrightInsertButton)
self.CopyrightLayout.addWidget(self.CopyrightWidget)
self.CcliWidget = QtGui.QWidget(self.CopyrightGroupBox)
self.CcliWidget.setObjectName(u'CcliWidget')
self.CCLILayout = QtGui.QHBoxLayout(self.CcliWidget)
self.CCLILayout.setSpacing(8)
self.CCLILayout.setMargin(0)
self.CCLILayout.setObjectName(u'CCLILayout') self.CCLILayout.setObjectName(u'CCLILayout')
self.CCLILabel = QtGui.QLabel(self.CcliWidget) self.CCLILabel = QtGui.QLabel(self.rightsGroupBox)
self.CCLILabel.setObjectName(u'CCLILabel') self.CCLILabel.setObjectName(u'CCLILabel')
self.CCLILayout.addWidget(self.CCLILabel) self.CCLILayout.addWidget(self.CCLILabel)
self.CCLNumberEdit = QtGui.QLineEdit(self.CcliWidget) self.CCLNumberEdit = QtGui.QLineEdit(self.rightsGroupBox)
self.CCLNumberEdit.setObjectName(u'CCLNumberEdit') self.CCLNumberEdit.setObjectName(u'CCLNumberEdit')
self.CCLILayout.addWidget(self.CCLNumberEdit) self.CCLILayout.addWidget(self.CCLNumberEdit)
self.CopyrightLayout.addWidget(self.CcliWidget) self.rightsLayout.addLayout(self.CCLILayout)
self.DetailsLayout.addWidget(self.CopyrightGroupBox) self.themeLeftLayout.addWidget(self.rightsGroupBox)
spacerItem4 = QtGui.QSpacerItem(20, 40, self.themeLeftLayout.addStretch()
QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) self.themeTabLayout.addLayout(self.themeLeftLayout)
self.DetailsLayout.addItem(spacerItem4) self.commentsGroupBox = QtGui.QGroupBox(self.themeTab)
self.ThemeCopyCommentsLayout.addWidget(self.TextWidget) self.commentsGroupBox.setObjectName(u'commentsGroupBox')
self.CommentsGroupBox = QtGui.QGroupBox(self.ThemeCopyCommentsWidget) self.commentsLayout = QtGui.QVBoxLayout(self.commentsGroupBox)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, self.commentsLayout.setObjectName(u'commentsLayout')
QtGui.QSizePolicy.Preferred) self.commentsEdit = QtGui.QTextEdit(self.commentsGroupBox)
sizePolicy.setHorizontalStretch(0) self.commentsEdit.setObjectName(u'commentsEdit')
sizePolicy.setVerticalStretch(0) self.commentsLayout.addWidget(self.commentsEdit)
sizePolicy.setHeightForWidth( self.themeTabLayout.addWidget(self.commentsGroupBox)
self.CommentsGroupBox.sizePolicy().hasHeightForWidth()) self.songTabWidget.addTab(self.themeTab, u'')
self.CommentsGroupBox.setSizePolicy(sizePolicy) self.dialogLayout.addWidget(self.songTabWidget)
self.CommentsGroupBox.setObjectName(u'CommentsGroupBox') self.buttonBox = QtGui.QDialogButtonBox(editSongDialog)
self.CommentsLayout = QtGui.QVBoxLayout(self.CommentsGroupBox) self.buttonBox.setStandardButtons(
self.CommentsLayout.setSpacing(0)
self.CommentsLayout.setMargin(8)
self.CommentsLayout.setObjectName(u'CommentsLayout')
self.CommentsEdit = QtGui.QTextEdit(self.CommentsGroupBox)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding,
QtGui.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(
self.CommentsEdit.sizePolicy().hasHeightForWidth())
self.CommentsEdit.setSizePolicy(sizePolicy)
self.CommentsEdit.setMaximumSize(QtCore.QSize(16777215, 16777215))
self.CommentsEdit.setObjectName(u'CommentsEdit')
self.CommentsLayout.addWidget(self.CommentsEdit)
self.ThemeCopyCommentsLayout.addWidget(self.CommentsGroupBox)
self.ThemeTabLayout.addWidget(self.ThemeCopyCommentsWidget)
self.SongTabWidget.addTab(self.ThemeTab, u'')
self.verticalLayout.addWidget(self.SongTabWidget)
self.ButtonBox = QtGui.QDialogButtonBox(EditSongDialog)
self.ButtonBox.setStandardButtons(
QtGui.QDialogButtonBox.Cancel | QtGui.QDialogButtonBox.Save) QtGui.QDialogButtonBox.Cancel | QtGui.QDialogButtonBox.Save)
self.ButtonBox.setObjectName(u'ButtonBox') self.buttonBox.setObjectName(u'buttonBox')
self.verticalLayout.addWidget(self.ButtonBox) self.dialogLayout.addWidget(self.buttonBox)
self.retranslateUi(EditSongDialog) self.retranslateUi(editSongDialog)
QtCore.QObject.connect(self.ButtonBox, QtCore.QObject.connect(self.buttonBox,
QtCore.SIGNAL(u'rejected()'), EditSongDialog.closePressed) QtCore.SIGNAL(u'rejected()'), editSongDialog.closePressed)
QtCore.QObject.connect(self.ButtonBox, QtCore.QObject.connect(self.buttonBox,
QtCore.SIGNAL(u'accepted()'), EditSongDialog.accept) QtCore.SIGNAL(u'accepted()'), editSongDialog.accept)
QtCore.QMetaObject.connectSlotsByName(EditSongDialog) QtCore.QMetaObject.connectSlotsByName(editSongDialog)
def retranslateUi(self, EditSongDialog): def retranslateUi(self, editSongDialog):
EditSongDialog.setWindowTitle( editSongDialog.setWindowTitle(
translate('SongsPlugin.EditSongForm', 'Song Editor')) translate('SongsPlugin.EditSongForm', 'Song Editor'))
self.TitleLabel.setText( self.titleLabel.setText(
translate('SongsPlugin.EditSongForm', '&Title:')) translate('SongsPlugin.EditSongForm', '&Title:'))
self.AlternativeTitleLabel.setText( self.alternativeTitleLabel.setText(
translate('SongsPlugin.EditSongForm', 'Alt&ernate title:')) translate('SongsPlugin.EditSongForm', 'Alt&ernate title:'))
self.LyricsLabel.setText( self.lyricsLabel.setText(
translate('SongsPlugin.EditSongForm', '&Lyrics:')) translate('SongsPlugin.EditSongForm', '&Lyrics:'))
self.VerseOrderLabel.setText( self.verseOrderLabel.setText(
translate('SongsPlugin.EditSongForm', '&Verse order:')) translate('SongsPlugin.EditSongForm', '&Verse order:'))
self.VerseAddButton.setText( self.verseAddButton.setText(
translate('SongsPlugin.EditSongForm', '&Add')) translate('SongsPlugin.EditSongForm', '&Add'))
self.VerseEditButton.setText( self.verseEditButton.setText(
translate('SongsPlugin.EditSongForm', '&Edit')) translate('SongsPlugin.EditSongForm', '&Edit'))
self.VerseEditAllButton.setText( self.verseEditAllButton.setText(
translate('SongsPlugin.EditSongForm', 'Ed&it All')) translate('SongsPlugin.EditSongForm', 'Ed&it All'))
self.VerseDeleteButton.setText( self.verseDeleteButton.setText(
translate('SongsPlugin.EditSongForm', '&Delete')) translate('SongsPlugin.EditSongForm', '&Delete'))
self.SongTabWidget.setTabText( self.songTabWidget.setTabText(
self.SongTabWidget.indexOf(self.LyricsTab), self.songTabWidget.indexOf(self.lyricsTab),
translate('SongsPlugin.EditSongForm', 'Title && Lyrics')) translate('SongsPlugin.EditSongForm', 'Title && Lyrics'))
self.AuthorsGroupBox.setTitle( self.authorsGroupBox.setTitle(
translate('SongsPlugin.EditSongForm', 'Authors')) translate('SongsPlugin.EditSongForm', 'Authors'))
self.AuthorAddButton.setText( self.authorAddButton.setText(
translate('SongsPlugin.EditSongForm', '&Add to Song')) translate('SongsPlugin.EditSongForm', '&Add to Song'))
self.AuthorRemoveButton.setText( self.authorRemoveButton.setText(
translate('SongsPlugin.EditSongForm', '&Remove')) translate('SongsPlugin.EditSongForm', '&Remove'))
self.MaintenanceButton.setText(translate('SongsPlugin.EditSongForm', self.maintenanceButton.setText(translate('SongsPlugin.EditSongForm',
'&Manage Authors, Topics, Song Books')) '&Manage Authors, Topics, Song Books'))
self.TopicGroupBox.setTitle( self.topicsGroupBox.setTitle(
translate('SongsPlugin.EditSongForm', 'Topic')) translate('SongsPlugin.EditSongForm', 'Topic'))
self.TopicAddButton.setText( self.topicAddButton.setText(
translate('SongsPlugin.EditSongForm', 'A&dd to Song')) translate('SongsPlugin.EditSongForm', 'A&dd to Song'))
self.TopicRemoveButton.setText( self.topicRemoveButton.setText(
translate('SongsPlugin.EditSongForm', 'R&emove')) translate('SongsPlugin.EditSongForm', 'R&emove'))
self.SongBookGroup.setTitle( self.songBookGroupBox.setTitle(
translate('SongsPlugin.EditSongForm', 'Song Book')) translate('SongsPlugin.EditSongForm', 'Song Book'))
self.SongbookNameLabel.setText(translate('SongsPlugin.EditSongForm', self.songBookNameLabel.setText(translate('SongsPlugin.EditSongForm',
'Book:')) 'Book:'))
self.songBookNumberLabel.setText(translate('SongsPlugin.EditSongForm', self.songBookNumberLabel.setText(translate('SongsPlugin.EditSongForm',
'Number:')) 'Number:'))
self.SongTabWidget.setTabText( self.songTabWidget.setTabText(
self.SongTabWidget.indexOf(self.AuthorsTab), self.songTabWidget.indexOf(self.authorsTab),
translate('SongsPlugin.EditSongForm', translate('SongsPlugin.EditSongForm',
'Authors, Topics && Song Book')) 'Authors, Topics && Song Book'))
self.ThemeGroupBox.setTitle( self.themeGroupBox.setTitle(
translate('SongsPlugin.EditSongForm', 'Theme')) translate('SongsPlugin.EditSongForm', 'Theme'))
self.ThemeAddButton.setText( self.themeAddButton.setText(
translate('SongsPlugin.EditSongForm', 'New &Theme')) translate('SongsPlugin.EditSongForm', 'New &Theme'))
self.CopyrightGroupBox.setTitle( self.rightsGroupBox.setTitle(
translate('SongsPlugin.EditSongForm', 'Copyright Information')) translate('SongsPlugin.EditSongForm', 'Copyright Information'))
self.CopyrightInsertButton.setText( self.copyrightInsertButton.setText(
translate('SongsPlugin.EditSongForm', '\xa9')) translate('SongsPlugin.EditSongForm', '\xa9'))
self.CCLILabel.setText( self.CCLILabel.setText(
translate('SongsPlugin.EditSongForm', 'CCLI number:')) translate('SongsPlugin.EditSongForm', 'CCLI number:'))
self.CommentsGroupBox.setTitle( self.commentsGroupBox.setTitle(
translate('SongsPlugin.EditSongForm', 'Comments')) translate('SongsPlugin.EditSongForm', 'Comments'))
self.SongTabWidget.setTabText( self.songTabWidget.setTabText(
self.SongTabWidget.indexOf(self.ThemeTab), self.songTabWidget.indexOf(self.themeTab),
translate('SongsPlugin.EditSongForm', translate('SongsPlugin.EditSongForm',
'Theme, Copyright Info && Comments')) 'Theme, Copyright Info && Comments'))

View File

@ -54,40 +54,40 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
self.width = 400 self.width = 400
self.setupUi(self) self.setupUi(self)
# Connecting signals and slots # Connecting signals and slots
QtCore.QObject.connect(self.AuthorAddButton, QtCore.QObject.connect(self.authorAddButton,
QtCore.SIGNAL(u'clicked()'), self.onAuthorAddButtonClicked) QtCore.SIGNAL(u'clicked()'), self.onAuthorAddButtonClicked)
QtCore.QObject.connect(self.AuthorRemoveButton, QtCore.QObject.connect(self.authorRemoveButton,
QtCore.SIGNAL(u'clicked()'), self.onAuthorRemoveButtonClicked) QtCore.SIGNAL(u'clicked()'), self.onAuthorRemoveButtonClicked)
QtCore.QObject.connect(self.AuthorsListView, QtCore.QObject.connect(self.authorsListView,
QtCore.SIGNAL(u'itemClicked(QListWidgetItem*)'), QtCore.SIGNAL(u'itemClicked(QListWidgetItem*)'),
self.onAuthorsListViewPressed) self.onAuthorsListViewPressed)
QtCore.QObject.connect(self.TopicAddButton, QtCore.QObject.connect(self.topicAddButton,
QtCore.SIGNAL(u'clicked()'), self.onTopicAddButtonClicked) QtCore.SIGNAL(u'clicked()'), self.onTopicAddButtonClicked)
QtCore.QObject.connect(self.TopicRemoveButton, QtCore.QObject.connect(self.topicRemoveButton,
QtCore.SIGNAL(u'clicked()'), self.onTopicRemoveButtonClicked) QtCore.SIGNAL(u'clicked()'), self.onTopicRemoveButtonClicked)
QtCore.QObject.connect(self.TopicsListView, QtCore.QObject.connect(self.topicsListView,
QtCore.SIGNAL(u'itemClicked(QListWidgetItem*)'), QtCore.SIGNAL(u'itemClicked(QListWidgetItem*)'),
self.onTopicListViewPressed) self.onTopicListViewPressed)
QtCore.QObject.connect(self.CopyrightInsertButton, QtCore.QObject.connect(self.copyrightInsertButton,
QtCore.SIGNAL(u'clicked()'), self.onCopyrightInsertButtonTriggered) QtCore.SIGNAL(u'clicked()'), self.onCopyrightInsertButtonTriggered)
QtCore.QObject.connect(self.VerseAddButton, QtCore.QObject.connect(self.verseAddButton,
QtCore.SIGNAL(u'clicked()'), self.onVerseAddButtonClicked) QtCore.SIGNAL(u'clicked()'), self.onVerseAddButtonClicked)
QtCore.QObject.connect(self.VerseListWidget, QtCore.QObject.connect(self.verseListWidget,
QtCore.SIGNAL(u'doubleClicked(QModelIndex)'), QtCore.SIGNAL(u'doubleClicked(QModelIndex)'),
self.onVerseEditButtonClicked) self.onVerseEditButtonClicked)
QtCore.QObject.connect(self.VerseEditButton, QtCore.QObject.connect(self.verseEditButton,
QtCore.SIGNAL(u'clicked()'), self.onVerseEditButtonClicked) QtCore.SIGNAL(u'clicked()'), self.onVerseEditButtonClicked)
QtCore.QObject.connect(self.VerseEditAllButton, QtCore.QObject.connect(self.verseEditAllButton,
QtCore.SIGNAL(u'clicked()'), self.onVerseEditAllButtonClicked) QtCore.SIGNAL(u'clicked()'), self.onVerseEditAllButtonClicked)
QtCore.QObject.connect(self.VerseDeleteButton, QtCore.QObject.connect(self.verseDeleteButton,
QtCore.SIGNAL(u'clicked()'), self.onVerseDeleteButtonClicked) QtCore.SIGNAL(u'clicked()'), self.onVerseDeleteButtonClicked)
QtCore.QObject.connect(self.VerseListWidget, QtCore.QObject.connect(self.verseListWidget,
QtCore.SIGNAL(u'itemClicked(QTableWidgetItem*)'), QtCore.SIGNAL(u'itemClicked(QTableWidgetItem*)'),
self.onVerseListViewPressed) self.onVerseListViewPressed)
QtCore.QObject.connect(self.ThemeAddButton, QtCore.QObject.connect(self.themeAddButton,
QtCore.SIGNAL(u'clicked()'), QtCore.SIGNAL(u'clicked()'),
self.parent.parent.renderManager.theme_manager.onAddTheme) self.parent.parent.renderManager.theme_manager.onAddTheme)
QtCore.QObject.connect(self.MaintenanceButton, QtCore.QObject.connect(self.maintenanceButton,
QtCore.SIGNAL(u'clicked()'), self.onMaintenanceButtonClicked) QtCore.SIGNAL(u'clicked()'), self.onMaintenanceButtonClicked)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'theme_update_list'), self.loadThemes) QtCore.SIGNAL(u'theme_update_list'), self.loadThemes)
@ -95,102 +95,102 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
self.previewButton.setObjectName(u'previewButton') self.previewButton.setObjectName(u'previewButton')
self.previewButton.setText( self.previewButton.setText(
translate('SongsPlugin.EditSongForm', 'Save && Preview')) translate('SongsPlugin.EditSongForm', 'Save && Preview'))
self.ButtonBox.addButton( self.buttonBox.addButton(
self.previewButton, QtGui.QDialogButtonBox.ActionRole) self.previewButton, QtGui.QDialogButtonBox.ActionRole)
QtCore.QObject.connect(self.ButtonBox, QtCore.QObject.connect(self.buttonBox,
QtCore.SIGNAL(u'clicked(QAbstractButton*)'), self.onPreview) QtCore.SIGNAL(u'clicked(QAbstractButton*)'), self.onPreview)
# Create other objects and forms # Create other objects and forms
self.manager = manager self.manager = manager
self.verse_form = EditVerseForm(self) self.verse_form = EditVerseForm(self)
self.initialise() self.initialise()
self.AuthorsListView.setSortingEnabled(False) self.authorsListView.setSortingEnabled(False)
self.AuthorsListView.setAlternatingRowColors(True) self.authorsListView.setAlternatingRowColors(True)
self.TopicsListView.setSortingEnabled(False) self.topicsListView.setSortingEnabled(False)
self.TopicsListView.setAlternatingRowColors(True) self.topicsListView.setAlternatingRowColors(True)
self.findVerseSplit = re.compile(u'---\[\]---\n', re.UNICODE) self.findVerseSplit = re.compile(u'---\[\]---\n', re.UNICODE)
self.whitespace = re.compile(r'\W+', re.UNICODE) self.whitespace = re.compile(r'\W+', re.UNICODE)
def initialise(self): def initialise(self):
self.VerseEditButton.setEnabled(False) self.verseEditButton.setEnabled(False)
self.VerseDeleteButton.setEnabled(False) self.verseDeleteButton.setEnabled(False)
self.AuthorRemoveButton.setEnabled(False) self.authorRemoveButton.setEnabled(False)
self.TopicRemoveButton.setEnabled(False) self.topicRemoveButton.setEnabled(False)
def loadAuthors(self): def loadAuthors(self):
authors = self.manager.get_all_objects(Author, authors = self.manager.get_all_objects(Author,
order_by_ref=Author.display_name) order_by_ref=Author.display_name)
self.AuthorsSelectionComboItem.clear() self.authorsComboBox.clear()
self.AuthorsSelectionComboItem.addItem(u'') self.authorsComboBox.addItem(u'')
self.authors = [] self.authors = []
for author in authors: for author in authors:
row = self.AuthorsSelectionComboItem.count() row = self.authorsComboBox.count()
self.AuthorsSelectionComboItem.addItem(author.display_name) self.authorsComboBox.addItem(author.display_name)
self.AuthorsSelectionComboItem.setItemData( self.authorsComboBox.setItemData(
row, QtCore.QVariant(author.id)) row, QtCore.QVariant(author.id))
self.authors.append(author.display_name) self.authors.append(author.display_name)
completer = QtGui.QCompleter(self.authors) completer = QtGui.QCompleter(self.authors)
completer.setCaseSensitivity(QtCore.Qt.CaseInsensitive) completer.setCaseSensitivity(QtCore.Qt.CaseInsensitive)
self.AuthorsSelectionComboItem.setCompleter(completer) self.authorsComboBox.setCompleter(completer)
def loadTopics(self): def loadTopics(self):
topics = self.manager.get_all_objects(Topic, order_by_ref=Topic.name) topics = self.manager.get_all_objects(Topic, order_by_ref=Topic.name)
self.SongTopicCombo.clear() self.topicsComboBox.clear()
self.SongTopicCombo.addItem(u'') self.topicsComboBox.addItem(u'')
self.topics = [] self.topics = []
for topic in topics: for topic in topics:
row = self.SongTopicCombo.count() row = self.topicsComboBox.count()
self.SongTopicCombo.addItem(topic.name) self.topicsComboBox.addItem(topic.name)
self.topics.append(topic.name) self.topics.append(topic.name)
self.SongTopicCombo.setItemData(row, QtCore.QVariant(topic.id)) self.topicsComboBox.setItemData(row, QtCore.QVariant(topic.id))
completer = QtGui.QCompleter(self.topics) completer = QtGui.QCompleter(self.topics)
completer.setCaseSensitivity(QtCore.Qt.CaseInsensitive) completer.setCaseSensitivity(QtCore.Qt.CaseInsensitive)
self.SongTopicCombo.setCompleter(completer) self.topicsComboBox.setCompleter(completer)
def loadBooks(self): def loadBooks(self):
books = self.manager.get_all_objects(Book, order_by_ref=Book.name) books = self.manager.get_all_objects(Book, order_by_ref=Book.name)
self.SongbookCombo.clear() self.songBookComboBox.clear()
self.SongbookCombo.addItem(u'') self.songBookComboBox.addItem(u'')
self.books = [] self.books = []
for book in books: for book in books:
row = self.SongbookCombo.count() row = self.songBookComboBox.count()
self.SongbookCombo.addItem(book.name) self.songBookComboBox.addItem(book.name)
self.books.append(book.name) self.books.append(book.name)
self.SongbookCombo.setItemData(row, QtCore.QVariant(book.id)) self.songBookComboBox.setItemData(row, QtCore.QVariant(book.id))
completer = QtGui.QCompleter(self.books) completer = QtGui.QCompleter(self.books)
completer.setCaseSensitivity(QtCore.Qt.CaseInsensitive) completer.setCaseSensitivity(QtCore.Qt.CaseInsensitive)
self.SongbookCombo.setCompleter(completer) self.songBookComboBox.setCompleter(completer)
def loadThemes(self, theme_list): def loadThemes(self, theme_list):
self.ThemeSelectionComboItem.clear() self.themeComboBox.clear()
self.ThemeSelectionComboItem.addItem(u'') self.themeComboBox.addItem(u'')
self.themes = [] self.themes = []
for theme in theme_list: for theme in theme_list:
self.ThemeSelectionComboItem.addItem(theme) self.themeComboBox.addItem(theme)
self.themes.append(theme) self.themes.append(theme)
completer = QtGui.QCompleter(self.themes) completer = QtGui.QCompleter(self.themes)
completer.setCaseSensitivity(QtCore.Qt.CaseInsensitive) completer.setCaseSensitivity(QtCore.Qt.CaseInsensitive)
self.ThemeSelectionComboItem.setCompleter(completer) self.themeComboBox.setCompleter(completer)
def newSong(self): def newSong(self):
log.debug(u'New Song') log.debug(u'New Song')
self.initialise() self.initialise()
self.SongTabWidget.setCurrentIndex(0) self.songTabWidget.setCurrentIndex(0)
self.TitleEditItem.setText(u'') self.titleEdit.setText(u'')
self.AlternativeEdit.setText(u'') self.alternativeEdit.setText(u'')
self.CopyrightEditItem.setText(u'') self.copyrightEdit.setText(u'')
self.VerseOrderEdit.setText(u'') self.verseOrderEdit.setText(u'')
self.CommentsEdit.setText(u'') self.commentsEdit.setText(u'')
self.CCLNumberEdit.setText(u'') self.CCLNumberEdit.setText(u'')
self.VerseListWidget.clear() self.verseListWidget.clear()
self.VerseListWidget.setRowCount(0) self.verseListWidget.setRowCount(0)
self.AuthorsListView.clear() self.authorsListView.clear()
self.TopicsListView.clear() self.topicsListView.clear()
self.TitleEditItem.setFocus(QtCore.Qt.OtherFocusReason) self.titleEdit.setFocus(QtCore.Qt.OtherFocusReason)
self.songBookNumberEdit.setText(u'') self.songBookNumberEdit.setText(u'')
self.loadAuthors() self.loadAuthors()
self.loadTopics() self.loadTopics()
self.loadBooks() self.loadBooks()
self.ThemeSelectionComboItem.setCurrentIndex(0) self.themeComboBox.setCurrentIndex(0)
# it's a new song to preview is not possible # it's a new song to preview is not possible
self.previewButton.setVisible(False) self.previewButton.setVisible(False)
@ -206,46 +206,46 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
""" """
log.debug(u'Load Song') log.debug(u'Load Song')
self.initialise() self.initialise()
self.SongTabWidget.setCurrentIndex(0) self.songTabWidget.setCurrentIndex(0)
self.loadAuthors() self.loadAuthors()
self.loadTopics() self.loadTopics()
self.loadBooks() self.loadBooks()
self.song = self.manager.get_object(Song, id) self.song = self.manager.get_object(Song, id)
self.TitleEditItem.setText(self.song.title) self.titleEdit.setText(self.song.title)
if self.song.alternate_title: if self.song.alternate_title:
self.AlternativeEdit.setText(self.song.alternate_title) self.alternativeEdit.setText(self.song.alternate_title)
else: else:
self.AlternativeEdit.setText(u'') self.alternativeEdit.setText(u'')
if self.song.song_book_id != 0: if self.song.song_book_id != 0:
book_name = self.manager.get_object(Book, self.song.song_book_id) book_name = self.manager.get_object(Book, self.song.song_book_id)
id = self.SongbookCombo.findText( id = self.songBookComboBox.findText(
unicode(book_name.name), QtCore.Qt.MatchExactly) unicode(book_name.name), QtCore.Qt.MatchExactly)
if id == -1: if id == -1:
# Not Found # Not Found
id = 0 id = 0
self.SongbookCombo.setCurrentIndex(id) self.songBookComboBox.setCurrentIndex(id)
if self.song.theme_name: if self.song.theme_name:
id = self.ThemeSelectionComboItem.findText( id = self.themeComboBox.findText(
unicode(self.song.theme_name), QtCore.Qt.MatchExactly) unicode(self.song.theme_name), QtCore.Qt.MatchExactly)
if id == -1: if id == -1:
# Not Found # Not Found
id = 0 id = 0
self.song.theme_name = None self.song.theme_name = None
self.ThemeSelectionComboItem.setCurrentIndex(id) self.themeComboBox.setCurrentIndex(id)
if self.song.copyright: if self.song.copyright:
self.CopyrightEditItem.setText(self.song.copyright) self.copyrightEdit.setText(self.song.copyright)
else: else:
self.CopyrightEditItem.setText(u'') self.copyrightEdit.setText(u'')
self.VerseListWidget.clear() self.verseListWidget.clear()
self.VerseListWidget.setRowCount(0) self.verseListWidget.setRowCount(0)
if self.song.verse_order: if self.song.verse_order:
self.VerseOrderEdit.setText(self.song.verse_order) self.verseOrderEdit.setText(self.song.verse_order)
else: else:
self.VerseOrderEdit.setText(u'') self.verseOrderEdit.setText(u'')
if self.song.comments: if self.song.comments:
self.CommentsEdit.setPlainText(self.song.comments) self.commentsEdit.setPlainText(self.song.comments)
else: else:
self.CommentsEdit.setPlainText(u'') self.commentsEdit.setPlainText(u'')
if self.song.ccli_number: if self.song.ccli_number:
self.CCLNumberEdit.setText(self.song.ccli_number) self.CCLNumberEdit.setText(self.song.ccli_number)
else: else:
@ -256,9 +256,9 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
self.songBookNumberEdit.setText(u'') self.songBookNumberEdit.setText(u'')
# lazy xml migration for now # lazy xml migration for now
self.VerseListWidget.clear() self.verseListWidget.clear()
self.VerseListWidget.setRowCount(0) self.verseListWidget.setRowCount(0)
self.VerseListWidget.setColumnWidth(0, self.width) self.verseListWidget.setColumnWidth(0, self.width)
# This is just because occasionally the lyrics come back as a "buffer" # This is just because occasionally the lyrics come back as a "buffer"
if isinstance(self.song.lyrics, buffer): if isinstance(self.song.lyrics, buffer):
self.song.lyrics = unicode(self.song.lyrics) self.song.lyrics = unicode(self.song.lyrics)
@ -266,37 +266,37 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
songXML = SongXMLParser(self.song.lyrics) songXML = SongXMLParser(self.song.lyrics)
verseList = songXML.get_verses() verseList = songXML.get_verses()
for count, verse in enumerate(verseList): for count, verse in enumerate(verseList):
self.VerseListWidget.setRowCount( self.verseListWidget.setRowCount(
self.VerseListWidget.rowCount() + 1) self.verseListWidget.rowCount() + 1)
variant = u'%s:%s' % (verse[0][u'type'], verse[0][u'label']) variant = u'%s:%s' % (verse[0][u'type'], verse[0][u'label'])
item = QtGui.QTableWidgetItem(verse[1]) item = QtGui.QTableWidgetItem(verse[1])
item.setData(QtCore.Qt.UserRole, QtCore.QVariant(variant)) item.setData(QtCore.Qt.UserRole, QtCore.QVariant(variant))
self.VerseListWidget.setItem(count, 0, item) self.verseListWidget.setItem(count, 0, item)
else: else:
verses = self.song.lyrics.split(u'\n\n') verses = self.song.lyrics.split(u'\n\n')
for count, verse in enumerate(verses): for count, verse in enumerate(verses):
self.VerseListWidget.setRowCount( self.verseListWidget.setRowCount(
self.VerseListWidget.rowCount() + 1) self.verseListWidget.rowCount() + 1)
item = QtGui.QTableWidgetItem(verse) item = QtGui.QTableWidgetItem(verse)
variant = u'%s:%s' % \ variant = u'%s:%s' % \
(VerseType.to_string(VerseType.Verse), unicode(count + 1)) (VerseType.to_string(VerseType.Verse), unicode(count + 1))
item.setData(QtCore.Qt.UserRole, QtCore.QVariant(variant)) item.setData(QtCore.Qt.UserRole, QtCore.QVariant(variant))
self.VerseListWidget.setItem(count, 0, item) self.verseListWidget.setItem(count, 0, item)
self.VerseListWidget.resizeRowsToContents() self.verseListWidget.resizeRowsToContents()
self.tagRows() self.tagRows()
# clear the results # clear the results
self.AuthorsListView.clear() self.authorsListView.clear()
for author in self.song.authors: for author in self.song.authors:
author_name = QtGui.QListWidgetItem(unicode(author.display_name)) author_name = QtGui.QListWidgetItem(unicode(author.display_name))
author_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(author.id)) author_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(author.id))
self.AuthorsListView.addItem(author_name) self.authorsListView.addItem(author_name)
# clear the results # clear the results
self.TopicsListView.clear() self.topicsListView.clear()
for topic in self.song.topics: for topic in self.song.topics:
topic_name = QtGui.QListWidgetItem(unicode(topic.name)) topic_name = QtGui.QListWidgetItem(unicode(topic.name))
topic_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(topic.id)) topic_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(topic.id))
self.TopicsListView.addItem(topic_name) self.topicsListView.addItem(topic_name)
self.TitleEditItem.setFocus(QtCore.Qt.OtherFocusReason) self.titleEdit.setFocus(QtCore.Qt.OtherFocusReason)
# if not preview hide the preview button # if not preview hide the preview button
self.previewButton.setVisible(False) self.previewButton.setVisible(False)
if preview: if preview:
@ -307,17 +307,17 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
Tag the Song List rows based on the verse list Tag the Song List rows based on the verse list
""" """
rowLabel = [] rowLabel = []
for row in range(0, self.VerseListWidget.rowCount()): for row in range(0, self.verseListWidget.rowCount()):
item = self.VerseListWidget.item(row, 0) item = self.verseListWidget.item(row, 0)
data = unicode(item.data(QtCore.Qt.UserRole).toString()) data = unicode(item.data(QtCore.Qt.UserRole).toString())
bit = data.split(u':') bit = data.split(u':')
rowTag = u'%s%s' % (bit[0][0:1], bit[1]) rowTag = u'%s%s' % (bit[0][0:1], bit[1])
rowLabel.append(rowTag) rowLabel.append(rowTag)
self.VerseListWidget.setVerticalHeaderLabels(rowLabel) self.verseListWidget.setVerticalHeaderLabels(rowLabel)
def onAuthorAddButtonClicked(self): def onAuthorAddButtonClicked(self):
item = int(self.AuthorsSelectionComboItem.currentIndex()) item = int(self.authorsComboBox.currentIndex())
text = unicode(self.AuthorsSelectionComboItem.currentText()) text = unicode(self.authorsComboBox.currentText())
if item == 0 and text: if item == 0 and text:
if QtGui.QMessageBox.question(self, if QtGui.QMessageBox.question(self,
translate('SongsPlugin.EditSongForm', 'Add Author'), translate('SongsPlugin.EditSongForm', 'Add Author'),
@ -336,15 +336,15 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
unicode(author.display_name)) unicode(author.display_name))
author_item.setData(QtCore.Qt.UserRole, author_item.setData(QtCore.Qt.UserRole,
QtCore.QVariant(author.id)) QtCore.QVariant(author.id))
self.AuthorsListView.addItem(author_item) self.authorsListView.addItem(author_item)
self.loadAuthors() self.loadAuthors()
self.AuthorsSelectionComboItem.setCurrentIndex(0) self.authorsComboBox.setCurrentIndex(0)
else: else:
return return
elif item > 0: elif item > 0:
item_id = (self.AuthorsSelectionComboItem.itemData(item)).toInt()[0] item_id = (self.authorsComboBox.itemData(item)).toInt()[0]
author = self.manager.get_object(Author, item_id) author = self.manager.get_object(Author, item_id)
if self.AuthorsListView.findItems(unicode(author.display_name), if self.authorsListView.findItems(unicode(author.display_name),
QtCore.Qt.MatchExactly): QtCore.Qt.MatchExactly):
QtGui.QMessageBox.warning(self, QtGui.QMessageBox.warning(self,
translate('SongsPlugin.EditSongForm', 'Error'), translate('SongsPlugin.EditSongForm', 'Error'),
@ -355,8 +355,8 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
author.display_name)) author.display_name))
author_item.setData(QtCore.Qt.UserRole, author_item.setData(QtCore.Qt.UserRole,
QtCore.QVariant(author.id)) QtCore.QVariant(author.id))
self.AuthorsListView.addItem(author_item) self.authorsListView.addItem(author_item)
self.AuthorsSelectionComboItem.setCurrentIndex(0) self.authorsComboBox.setCurrentIndex(0)
else: else:
QtGui.QMessageBox.warning(self, QtGui.QMessageBox.warning(self,
translate('SongsPlugin.EditSongForm', 'No Author Selected'), translate('SongsPlugin.EditSongForm', 'No Author Selected'),
@ -366,18 +366,18 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
'Song" button to add the new author.')) 'Song" button to add the new author.'))
def onAuthorsListViewPressed(self): def onAuthorsListViewPressed(self):
if self.AuthorsListView.count() > 1: if self.authorsListView.count() > 1:
self.AuthorRemoveButton.setEnabled(True) self.authorRemoveButton.setEnabled(True)
def onAuthorRemoveButtonClicked(self): def onAuthorRemoveButtonClicked(self):
self.AuthorRemoveButton.setEnabled(False) self.authorRemoveButton.setEnabled(False)
item = self.AuthorsListView.currentItem() item = self.authorsListView.currentItem()
row = self.AuthorsListView.row(item) row = self.authorsListView.row(item)
self.AuthorsListView.takeItem(row) self.authorsListView.takeItem(row)
def onTopicAddButtonClicked(self): def onTopicAddButtonClicked(self):
item = int(self.SongTopicCombo.currentIndex()) item = int(self.topicsComboBox.currentIndex())
text = unicode(self.SongTopicCombo.currentText()) text = unicode(self.topicsComboBox.currentText())
if item == 0 and text: if item == 0 and text:
if QtGui.QMessageBox.question(self, if QtGui.QMessageBox.question(self,
translate('SongsPlugin.EditSongForm', 'Add Topic'), translate('SongsPlugin.EditSongForm', 'Add Topic'),
@ -390,15 +390,15 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
topic_item = QtGui.QListWidgetItem(unicode(topic.name)) topic_item = QtGui.QListWidgetItem(unicode(topic.name))
topic_item.setData(QtCore.Qt.UserRole, topic_item.setData(QtCore.Qt.UserRole,
QtCore.QVariant(topic.id)) QtCore.QVariant(topic.id))
self.TopicsListView.addItem(topic_item) self.topicsListView.addItem(topic_item)
self.loadTopics() self.loadTopics()
self.SongTopicCombo.setCurrentIndex(0) self.topicsComboBox.setCurrentIndex(0)
else: else:
return return
elif item > 0: elif item > 0:
item_id = (self.SongTopicCombo.itemData(item)).toInt()[0] item_id = (self.topicsComboBox.itemData(item)).toInt()[0]
topic = self.manager.get_object(Topic, item_id) topic = self.manager.get_object(Topic, item_id)
if self.TopicsListView.findItems(unicode(topic.name), if self.topicsListView.findItems(unicode(topic.name),
QtCore.Qt.MatchExactly): QtCore.Qt.MatchExactly):
QtGui.QMessageBox.warning(self, QtGui.QMessageBox.warning(self,
translate('SongsPlugin.EditSongForm', 'Error'), translate('SongsPlugin.EditSongForm', 'Error'),
@ -408,8 +408,8 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
topic_item = QtGui.QListWidgetItem(unicode(topic.name)) topic_item = QtGui.QListWidgetItem(unicode(topic.name))
topic_item.setData(QtCore.Qt.UserRole, topic_item.setData(QtCore.Qt.UserRole,
QtCore.QVariant(topic.id)) QtCore.QVariant(topic.id))
self.TopicsListView.addItem(topic_item) self.topicsListView.addItem(topic_item)
self.SongTopicCombo.setCurrentIndex(0) self.topicsComboBox.setCurrentIndex(0)
else: else:
QtGui.QMessageBox.warning(self, QtGui.QMessageBox.warning(self,
translate('SongsPlugin.EditSongForm', 'No Topic Selected'), translate('SongsPlugin.EditSongForm', 'No Topic Selected'),
@ -419,17 +419,17 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
'button to add the new topic.')) 'button to add the new topic.'))
def onTopicListViewPressed(self): def onTopicListViewPressed(self):
self.TopicRemoveButton.setEnabled(True) self.topicRemoveButton.setEnabled(True)
def onTopicRemoveButtonClicked(self): def onTopicRemoveButtonClicked(self):
self.TopicRemoveButton.setEnabled(False) self.topicRemoveButton.setEnabled(False)
item = self.TopicsListView.currentItem() item = self.topicsListView.currentItem()
row = self.TopicsListView.row(item) row = self.topicsListView.row(item)
self.TopicsListView.takeItem(row) self.topicsListView.takeItem(row)
def onVerseListViewPressed(self): def onVerseListViewPressed(self):
self.VerseEditButton.setEnabled(True) self.verseEditButton.setEnabled(True)
self.VerseDeleteButton.setEnabled(True) self.verseDeleteButton.setEnabled(True)
def onVerseAddButtonClicked(self): def onVerseAddButtonClicked(self):
self.verse_form.setVerse(u'', True) self.verse_form.setVerse(u'', True)
@ -439,16 +439,16 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
item = QtGui.QTableWidgetItem(afterText) item = QtGui.QTableWidgetItem(afterText)
item.setData(QtCore.Qt.UserRole, QtCore.QVariant(data)) item.setData(QtCore.Qt.UserRole, QtCore.QVariant(data))
item.setText(afterText) item.setText(afterText)
self.VerseListWidget.setRowCount( self.verseListWidget.setRowCount(
self.VerseListWidget.rowCount() + 1) self.verseListWidget.rowCount() + 1)
self.VerseListWidget.setItem( self.verseListWidget.setItem(
int(self.VerseListWidget.rowCount() - 1), 0, item) int(self.verseListWidget.rowCount() - 1), 0, item)
self.VerseListWidget.setColumnWidth(0, self.width) self.verseListWidget.setColumnWidth(0, self.width)
self.VerseListWidget.resizeRowsToContents() self.verseListWidget.resizeRowsToContents()
self.tagRows() self.tagRows()
def onVerseEditButtonClicked(self): def onVerseEditButtonClicked(self):
item = self.VerseListWidget.currentItem() item = self.verseListWidget.currentItem()
if item: if item:
tempText = item.text() tempText = item.text()
verseId = unicode(item.data(QtCore.Qt.UserRole).toString()) verseId = unicode(item.data(QtCore.Qt.UserRole).toString())
@ -462,24 +462,24 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
if len(tempText.split(u'\n')) != len(afterText.split(u'\n')): if len(tempText.split(u'\n')) != len(afterText.split(u'\n')):
tempList = {} tempList = {}
tempId = {} tempId = {}
for row in range(0, self.VerseListWidget.rowCount()): for row in range(0, self.verseListWidget.rowCount()):
tempList[row] = self.VerseListWidget.item(row, 0).text() tempList[row] = self.verseListWidget.item(row, 0).text()
tempId[row] = self.VerseListWidget.item(row, 0).\ tempId[row] = self.verseListWidget.item(row, 0).\
data(QtCore.Qt.UserRole) data(QtCore.Qt.UserRole)
self.VerseListWidget.clear() self.verseListWidget.clear()
for row in range (0, len(tempList)): for row in range (0, len(tempList)):
item = QtGui.QTableWidgetItem(tempList[row], 0) item = QtGui.QTableWidgetItem(tempList[row], 0)
item.setData(QtCore.Qt.UserRole, tempId[row]) item.setData(QtCore.Qt.UserRole, tempId[row])
self.VerseListWidget.setItem(row, 0, item) self.verseListWidget.setItem(row, 0, item)
self.VerseListWidget.resizeRowsToContents() self.verseListWidget.resizeRowsToContents()
self.VerseListWidget.repaint() self.verseListWidget.repaint()
self.tagRows() self.tagRows()
def onVerseEditAllButtonClicked(self): def onVerseEditAllButtonClicked(self):
verse_list = u'' verse_list = u''
if self.VerseListWidget.rowCount() > 0: if self.verseListWidget.rowCount() > 0:
for row in range(0, self.VerseListWidget.rowCount()): for row in range(0, self.verseListWidget.rowCount()):
item = self.VerseListWidget.item(row, 0) item = self.verseListWidget.item(row, 0)
field = unicode(item.data(QtCore.Qt.UserRole).toString()) field = unicode(item.data(QtCore.Qt.UserRole).toString())
verse_list += u'---[%s]---\n' % field verse_list += u'---[%s]---\n' % field
verse_list += item.text() verse_list += item.text()
@ -490,8 +490,8 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
if self.verse_form.exec_(): if self.verse_form.exec_():
verse_list = self.verse_form.getVerseAll() verse_list = self.verse_form.getVerseAll()
verse_list = unicode(verse_list.replace(u'\r\n', u'\n')) verse_list = unicode(verse_list.replace(u'\r\n', u'\n'))
self.VerseListWidget.clear() self.verseListWidget.clear()
self.VerseListWidget.setRowCount(0) self.verseListWidget.setRowCount(0)
for row in self.findVerseSplit.split(verse_list): for row in self.findVerseSplit.split(verse_list):
for match in row.split(u'---['): for match in row.split(u'---['):
for count, parts in enumerate(match.split(u']---\n')): for count, parts in enumerate(match.split(u']---\n')):
@ -506,22 +506,22 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
item = QtGui.QTableWidgetItem(parts) item = QtGui.QTableWidgetItem(parts)
item.setData(QtCore.Qt.UserRole, item.setData(QtCore.Qt.UserRole,
QtCore.QVariant(variant)) QtCore.QVariant(variant))
self.VerseListWidget.setRowCount( self.verseListWidget.setRowCount(
self.VerseListWidget.rowCount() + 1) self.verseListWidget.rowCount() + 1)
self.VerseListWidget.setItem( self.verseListWidget.setItem(
int(self.VerseListWidget.rowCount() - 1), int(self.verseListWidget.rowCount() - 1),
0, item) 0, item)
self.VerseListWidget.setColumnWidth(0, self.width) self.verseListWidget.setColumnWidth(0, self.width)
self.VerseListWidget.resizeRowsToContents() self.verseListWidget.resizeRowsToContents()
self.VerseListWidget.repaint() self.verseListWidget.repaint()
self.tagRows() self.tagRows()
self.VerseEditButton.setEnabled(False) self.verseEditButton.setEnabled(False)
self.VerseDeleteButton.setEnabled(False) self.verseDeleteButton.setEnabled(False)
def onVerseDeleteButtonClicked(self): def onVerseDeleteButtonClicked(self):
self.VerseListWidget.removeRow(self.VerseListWidget.currentRow()) self.verseListWidget.removeRow(self.verseListWidget.currentRow())
self.VerseEditButton.setEnabled(False) self.verseEditButton.setEnabled(False)
self.VerseDeleteButton.setEnabled(False) self.verseDeleteButton.setEnabled(False)
def _validate_song(self): def _validate_song(self):
""" """
@ -530,25 +530,25 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
""" """
log.debug(u'Validate Song') log.debug(u'Validate Song')
# Lets be nice and assume the data is correct. # Lets be nice and assume the data is correct.
if len(self.TitleEditItem.displayText()) == 0: if len(self.titleEdit.displayText()) == 0:
self.SongTabWidget.setCurrentIndex(0) self.songTabWidget.setCurrentIndex(0)
self.TitleEditItem.setFocus() self.titleEdit.setFocus()
QtGui.QMessageBox.critical(self, QtGui.QMessageBox.critical(self,
translate('SongsPlugin.EditSongForm', 'Error'), translate('SongsPlugin.EditSongForm', 'Error'),
translate('SongsPlugin.EditSongForm', translate('SongsPlugin.EditSongForm',
'You need to type in a song title.')) 'You need to type in a song title.'))
return False return False
if self.VerseListWidget.rowCount() == 0: if self.verseListWidget.rowCount() == 0:
self.SongTabWidget.setCurrentIndex(0) self.songTabWidget.setCurrentIndex(0)
self.VerseListWidget.setFocus() self.verseListWidget.setFocus()
QtGui.QMessageBox.critical(self, QtGui.QMessageBox.critical(self,
translate('SongsPlugin.EditSongForm', 'Error'), translate('SongsPlugin.EditSongForm', 'Error'),
translate('SongsPlugin.EditSongForm', translate('SongsPlugin.EditSongForm',
'You need to type in at least one verse.')) 'You need to type in at least one verse.'))
return False return False
if self.AuthorsListView.count() == 0: if self.authorsListView.count() == 0:
self.SongTabWidget.setCurrentIndex(1) self.songTabWidget.setCurrentIndex(1)
self.AuthorsListView.setFocus() self.authorsListView.setFocus()
QtGui.QMessageBox.critical(self, QtGui.QMessageBox.critical(self,
translate('SongsPlugin.EditSongForm', 'Warning'), translate('SongsPlugin.EditSongForm', 'Warning'),
translate('SongsPlugin.EditSongForm', translate('SongsPlugin.EditSongForm',
@ -564,8 +564,8 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
order.append(item.lower()) order.append(item.lower())
verses = [] verses = []
verse_names = [] verse_names = []
for index in range (0, self.VerseListWidget.rowCount()): for index in range (0, self.verseListWidget.rowCount()):
verse = self.VerseListWidget.item(index, 0) verse = self.verseListWidget.item(index, 0)
verse = unicode(verse.data(QtCore.Qt.UserRole).toString()) verse = unicode(verse.data(QtCore.Qt.UserRole).toString())
if verse not in verse_names: if verse not in verse_names:
verses.append( verses.append(
@ -573,8 +573,8 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
verse_names.append(verse) verse_names.append(verse)
for count, item in enumerate(order): for count, item in enumerate(order):
if item not in verses: if item not in verses:
self.SongTabWidget.setCurrentIndex(0) self.songTabWidget.setCurrentIndex(0)
self.VerseOrderEdit.setFocus() self.verseOrderEdit.setFocus()
valid = verses.pop(0) valid = verses.pop(0)
for verse in verses: for verse in verses:
valid = valid + u', ' + verse valid = valid + u', ' + verse
@ -587,8 +587,8 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
return False return False
for count, verse in enumerate(verses): for count, verse in enumerate(verses):
if verse not in order: if verse not in order:
self.SongTabWidget.setCurrentIndex(0) self.songTabWidget.setCurrentIndex(0)
self.VerseOrderEdit.setFocus() self.verseOrderEdit.setFocus()
answer = QtGui.QMessageBox.warning(self, answer = QtGui.QMessageBox.warning(self,
translate('SongsPlugin.EditSongForm', 'Warning'), translate('SongsPlugin.EditSongForm', 'Warning'),
unicode(translate('SongsPlugin.EditSongForm', unicode(translate('SongsPlugin.EditSongForm',
@ -601,17 +601,18 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
return True return True
def onCopyrightInsertButtonTriggered(self): def onCopyrightInsertButtonTriggered(self):
text = self.CopyrightEditItem.text() text = self.copyrightEdit.text()
pos = self.CopyrightEditItem.cursorPosition() pos = self.copyrightEdit.cursorPosition()
text = text[:pos] + '\xa9' + text[pos:] sign = translate('SongsPlugin.EditSongForm', '\xa9')
self.CopyrightEditItem.setText(text) text = text[:pos] + sign + text[pos:]
self.CopyrightEditItem.setFocus() self.copyrightEdit.setText(text)
self.CopyrightEditItem.setCursorPosition(pos + 1) self.copyrightEdit.setFocus()
self.copyrightEdit.setCursorPosition(pos + len(sign))
def onMaintenanceButtonClicked(self): def onMaintenanceButtonClicked(self):
temp_song_book = None temp_song_book = None
item = int(self.SongbookCombo.currentIndex()) item = int(self.songBookComboBox.currentIndex())
text = unicode(self.SongbookCombo.currentText()) text = unicode(self.songBookComboBox.currentText())
if item == 0 and text: if item == 0 and text:
temp_song_book = text temp_song_book = text
self.parent.song_maintenance_form.exec_() self.parent.song_maintenance_form.exec_()
@ -619,7 +620,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
self.loadBooks() self.loadBooks()
self.loadTopics() self.loadTopics()
if temp_song_book: if temp_song_book:
self.SongbookCombo.setEditText(temp_song_book) self.songBookComboBox.setEditText(temp_song_book)
def onPreview(self, button): def onPreview(self, button):
""" """
@ -659,9 +660,9 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
self.clearCaches() self.clearCaches()
if not self.song: if not self.song:
self.song = Song() self.song = Song()
item = int(self.SongbookCombo.currentIndex()) item = int(self.songBookComboBox.currentIndex())
text = unicode(self.SongbookCombo.currentText()) text = unicode(self.songBookComboBox.currentText())
if self.SongbookCombo.findText(text, QtCore.Qt.MatchExactly) < 0: if self.songBookComboBox.findText(text, QtCore.Qt.MatchExactly) < 0:
if QtGui.QMessageBox.question(self, if QtGui.QMessageBox.question(self,
translate('SongsPlugin.EditSongForm', 'Add Book'), translate('SongsPlugin.EditSongForm', 'Add Book'),
translate('SongsPlugin.EditSongForm', 'This song book does ' translate('SongsPlugin.EditSongForm', 'This song book does '
@ -684,25 +685,25 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
``preview`` ``preview``
Should be ``True`` if the song is also previewed (boolean). Should be ``True`` if the song is also previewed (boolean).
""" """
self.song.title = unicode(self.TitleEditItem.text()) self.song.title = unicode(self.titleEdit.text())
self.song.alternate_title = unicode(self.AlternativeEdit.text()) self.song.alternate_title = unicode(self.alternativeEdit.text())
self.song.copyright = unicode(self.CopyrightEditItem.text()) self.song.copyright = unicode(self.copyrightEdit.text())
if self.song.alternate_title: if self.song.alternate_title:
self.song.search_title = self.song.title + u'@' + \ self.song.search_title = self.song.title + u'@' + \
self.song.alternate_title self.song.alternate_title
else: else:
self.song.search_title = self.song.title self.song.search_title = self.song.title
self.song.comments = unicode(self.CommentsEdit.toPlainText()) self.song.comments = unicode(self.commentsEdit.toPlainText())
self.song.verse_order = unicode(self.VerseOrderEdit.text()) self.song.verse_order = unicode(self.verseOrderEdit.text())
self.song.ccli_number = unicode(self.CCLNumberEdit.text()) self.song.ccli_number = unicode(self.CCLNumberEdit.text())
self.song.song_number = unicode(self.songBookNumberEdit.text()) self.song.song_number = unicode(self.songBookNumberEdit.text())
book_name = unicode(self.SongbookCombo.currentText()) book_name = unicode(self.songBookComboBox.currentText())
if book_name: if book_name:
self.song.book = self.manager.get_object_filtered(Book, self.song.book = self.manager.get_object_filtered(Book,
Book.name == book_name) Book.name == book_name)
else: else:
self.song.book = None self.song.book = None
theme_name = unicode(self.ThemeSelectionComboItem.currentText()) theme_name = unicode(self.themeComboBox.currentText())
if theme_name: if theme_name:
self.song.theme_name = theme_name self.song.theme_name = theme_name
else: else:
@ -711,14 +712,14 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
self.processLyrics() self.processLyrics()
self.processTitle() self.processTitle()
self.song.authors = [] self.song.authors = []
for row in range(self.AuthorsListView.count()): for row in range(self.authorsListView.count()):
item = self.AuthorsListView.item(row) item = self.authorsListView.item(row)
authorId = (item.data(QtCore.Qt.UserRole)).toInt()[0] authorId = (item.data(QtCore.Qt.UserRole)).toInt()[0]
self.song.authors.append(self.manager.get_object(Author, self.song.authors.append(self.manager.get_object(Author,
authorId)) authorId))
self.song.topics = [] self.song.topics = []
for row in range(self.TopicsListView.count()): for row in range(self.topicsListView.count()):
item = self.TopicsListView.item(row) item = self.topicsListView.item(row)
topicId = (item.data(QtCore.Qt.UserRole)).toInt()[0] topicId = (item.data(QtCore.Qt.UserRole)).toInt()[0]
self.song.topics.append(self.manager.get_object(Topic, topicId)) self.song.topics.append(self.manager.get_object(Topic, topicId))
self.manager.save_object(self.song) self.manager.save_object(self.song)
@ -733,13 +734,13 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
sxml = SongXMLBuilder() sxml = SongXMLBuilder()
text = u'' text = u''
multiple = [] multiple = []
for i in range(0, self.VerseListWidget.rowCount()): for i in range(0, self.verseListWidget.rowCount()):
item = self.VerseListWidget.item(i, 0) item = self.verseListWidget.item(i, 0)
verseId = unicode(item.data(QtCore.Qt.UserRole).toString()) verseId = unicode(item.data(QtCore.Qt.UserRole).toString())
bits = verseId.split(u':') bits = verseId.split(u':')
sxml.add_verse_to_lyrics(bits[0], bits[1], unicode(item.text())) sxml.add_verse_to_lyrics(bits[0], bits[1], unicode(item.text()))
text = text + self.whitespace.sub(u' ', text = text + self.whitespace.sub(u' ',
unicode(self.VerseListWidget.item(i, 0).text())) + u' ' unicode(self.verseListWidget.item(i, 0).text())) + u' '
if (bits[1] > u'1') and (bits[0][0] not in multiple): if (bits[1] > u'1') and (bits[0][0] not in multiple):
multiple.append(bits[0][0]) multiple.append(bits[0][0])
self.song.search_lyrics = text.lower() self.song.search_lyrics = text.lower()

View File

@ -32,31 +32,22 @@ from openlp.plugins.songs.lib import VerseType
class Ui_EditVerseDialog(object): class Ui_EditVerseDialog(object):
def setupUi(self, editVerseDialog): def setupUi(self, editVerseDialog):
editVerseDialog.setObjectName(u'editVerseDialog') editVerseDialog.setObjectName(u'editVerseDialog')
editVerseDialog.resize(474, 442) editVerseDialog.resize(400, 400)
editVerseDialog.setModal(True) editVerseDialog.setModal(True)
self.editVerseLayout = QtGui.QVBoxLayout(editVerseDialog) self.dialogLayout = QtGui.QVBoxLayout(editVerseDialog)
self.editVerseLayout.setSpacing(8) self.dialogLayout.setObjectName(u'dialogLayout')
self.editVerseLayout.setMargin(8)
self.editVerseLayout.setObjectName(u'editVerseLayout')
self.verseTextEdit = SpellTextEdit(editVerseDialog) self.verseTextEdit = SpellTextEdit(editVerseDialog)
self.verseTextEdit.setObjectName(u'verseTextEdit') self.verseTextEdit.setObjectName(u'verseTextEdit')
self.editVerseLayout.addWidget(self.verseTextEdit) self.dialogLayout.addWidget(self.verseTextEdit)
self.verseTypeLayout = QtGui.QHBoxLayout() self.verseTypeLayout = QtGui.QHBoxLayout()
self.verseTypeLayout.setSpacing(8)
self.verseTypeLayout.setObjectName(u'verseTypeLayout') self.verseTypeLayout.setObjectName(u'verseTypeLayout')
self.verseTypeLabel = QtGui.QLabel(editVerseDialog) self.verseTypeLabel = QtGui.QLabel(editVerseDialog)
self.verseTypeLabel.setObjectName(u'verseTypeLabel') self.verseTypeLabel.setObjectName(u'verseTypeLabel')
self.verseTypeLayout.addWidget(self.verseTypeLabel) self.verseTypeLayout.addWidget(self.verseTypeLabel)
self.verseTypeComboBox = QtGui.QComboBox(editVerseDialog) self.verseTypeComboBox = QtGui.QComboBox(editVerseDialog)
self.verseTypeComboBox.addItems([u'', u'', u'', u'', u'', u'', u''])
self.verseTypeComboBox.setObjectName(u'verseTypeComboBox') self.verseTypeComboBox.setObjectName(u'verseTypeComboBox')
self.verseTypeLabel.setBuddy(self.verseTypeComboBox) self.verseTypeLabel.setBuddy(self.verseTypeComboBox)
self.verseTypeComboBox.addItem(u'')
self.verseTypeComboBox.addItem(u'')
self.verseTypeComboBox.addItem(u'')
self.verseTypeComboBox.addItem(u'')
self.verseTypeComboBox.addItem(u'')
self.verseTypeComboBox.addItem(u'')
self.verseTypeComboBox.addItem(u'')
self.verseTypeLayout.addWidget(self.verseTypeComboBox) self.verseTypeLayout.addWidget(self.verseTypeComboBox)
self.verseNumberBox = QtGui.QSpinBox(editVerseDialog) self.verseNumberBox = QtGui.QSpinBox(editVerseDialog)
self.verseNumberBox.setMinimum(1) self.verseNumberBox.setMinimum(1)
@ -66,21 +57,18 @@ class Ui_EditVerseDialog(object):
self.insertButton.setIcon(build_icon(u':/general/general_add.png')) self.insertButton.setIcon(build_icon(u':/general/general_add.png'))
self.insertButton.setObjectName(u'insertButton') self.insertButton.setObjectName(u'insertButton')
self.verseTypeLayout.addWidget(self.insertButton) self.verseTypeLayout.addWidget(self.insertButton)
self.verseTypeSpacer = QtGui.QSpacerItem(40, 20, self.verseTypeLayout.addStretch()
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.dialogLayout.addLayout(self.verseTypeLayout)
self.verseTypeLayout.addItem(self.verseTypeSpacer) self.buttonBox = QtGui.QDialogButtonBox(editVerseDialog)
self.editVerseLayout.addLayout(self.verseTypeLayout) self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
self.editButtonBox = QtGui.QDialogButtonBox(editVerseDialog) self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel |
self.editButtonBox.setOrientation(QtCore.Qt.Horizontal)
self.editButtonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel |
QtGui.QDialogButtonBox.Save) QtGui.QDialogButtonBox.Save)
self.editButtonBox.setObjectName(u'editButtonBox') self.buttonBox.setObjectName(u'buttonBox')
self.editVerseLayout.addWidget(self.editButtonBox) self.dialogLayout.addWidget(self.buttonBox)
self.retranslateUi(editVerseDialog) self.retranslateUi(editVerseDialog)
QtCore.QObject.connect(self.editButtonBox, QtCore.SIGNAL(u'accepted()'), QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(u'accepted()'),
editVerseDialog.accept) editVerseDialog.accept)
QtCore.QObject.connect(self.editButtonBox, QtCore.SIGNAL(u'rejected()'), QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(u'rejected()'),
editVerseDialog.reject) editVerseDialog.reject)
QtCore.QMetaObject.connectSlotsByName(editVerseDialog) QtCore.QMetaObject.connectSlotsByName(editVerseDialog)
@ -104,4 +92,4 @@ class Ui_EditVerseDialog(object):
self.verseTypeComboBox.setItemText(6, self.verseTypeComboBox.setItemText(6,
VerseType.to_string(VerseType.Other)) VerseType.to_string(VerseType.Other))
self.insertButton.setText( self.insertButton.setText(
translate('SongsPlugin.EditVerseForm', '&Insert')) translate('SongsPlugin.EditVerseForm', '&Insert'))

View File

@ -172,4 +172,4 @@ class EditVerseForm(QtGui.QDialog, Ui_EditVerseDialog):
translate('SongsPlugin.EditSongForm', translate('SongsPlugin.EditSongForm',
'You need to type some text in to the verse.')) 'You need to type some text in to the verse.'))
return False return False
QtGui.QDialog.accept(self) QtGui.QDialog.accept(self)

View File

@ -29,49 +29,42 @@ from PyQt4 import QtCore, QtGui
from openlp.core.lib import translate from openlp.core.lib import translate
class Ui_SongBookDialog(object): class Ui_SongBookDialog(object):
def setupUi(self, SongBookDialog): def setupUi(self, songBookDialog):
SongBookDialog.setObjectName(u'SongBookDialog') songBookDialog.setObjectName(u'songBookDialog')
SongBookDialog.resize(367, 120) songBookDialog.resize(300, 10)
self.SongBookLayout = QtGui.QFormLayout(SongBookDialog) self.dialogLayout = QtGui.QVBoxLayout(songBookDialog)
self.SongBookLayout.setMargin(8) self.dialogLayout.setObjectName(u'dialogLayout')
self.SongBookLayout.setSpacing(8) self.bookLayout = QtGui.QFormLayout()
self.SongBookLayout.setObjectName(u'SongBookLayout') self.bookLayout.setObjectName(u'bookLayout')
self.NameLabel = QtGui.QLabel(SongBookDialog) self.nameLabel = QtGui.QLabel(songBookDialog)
self.NameLabel.setObjectName(u'NameLabel') self.nameLabel.setObjectName(u'nameLabel')
self.SongBookLayout.setWidget(0, self.nameEdit = QtGui.QLineEdit(songBookDialog)
QtGui.QFormLayout.LabelRole, self.NameLabel) self.nameEdit.setObjectName(u'nameEdit')
self.NameEdit = QtGui.QLineEdit(SongBookDialog) self.nameLabel.setBuddy(self.nameEdit)
self.NameEdit.setObjectName(u'NameEdit') self.bookLayout.addRow(self.nameLabel, self.nameEdit)
self.NameLabel.setBuddy(self.NameEdit) self.publisherLabel = QtGui.QLabel(songBookDialog)
self.SongBookLayout.setWidget(0, self.publisherLabel.setObjectName(u'publisherLabel')
QtGui.QFormLayout.FieldRole, self.NameEdit) self.publisherEdit = QtGui.QLineEdit(songBookDialog)
self.PublisherLabel = QtGui.QLabel(SongBookDialog) self.publisherEdit.setObjectName(u'publisherEdit')
self.PublisherLabel.setObjectName(u'PublisherLabel') self.publisherLabel.setBuddy(self.publisherEdit)
self.SongBookLayout.setWidget(1, self.bookLayout.addRow(self.publisherLabel, self.publisherEdit)
QtGui.QFormLayout.LabelRole, self.PublisherLabel) self.dialogLayout.addLayout(self.bookLayout)
self.PublisherEdit = QtGui.QLineEdit(SongBookDialog) self.buttonBox = QtGui.QDialogButtonBox(songBookDialog)
self.PublisherEdit.setObjectName(u'PublisherEdit') self.buttonBox.setStandardButtons(
self.PublisherLabel.setBuddy(self.PublisherEdit)
self.SongBookLayout.setWidget(1,
QtGui.QFormLayout.FieldRole, self.PublisherEdit)
self.ButtonBox = QtGui.QDialogButtonBox(SongBookDialog)
self.ButtonBox.setOrientation(QtCore.Qt.Horizontal)
self.ButtonBox.setStandardButtons(
QtGui.QDialogButtonBox.Save | QtGui.QDialogButtonBox.Cancel) QtGui.QDialogButtonBox.Save | QtGui.QDialogButtonBox.Cancel)
self.ButtonBox.setObjectName(u'ButtonBox') self.buttonBox.setObjectName(u'buttonBox')
self.SongBookLayout.setWidget(2, self.dialogLayout.addWidget(self.buttonBox)
QtGui.QFormLayout.FieldRole, self.ButtonBox) self.retranslateUi(songBookDialog)
songBookDialog.setMaximumHeight(songBookDialog.sizeHint().height())
QtCore.QObject.connect(self.buttonBox,
QtCore.SIGNAL(u'accepted()'), songBookDialog.accept)
QtCore.QObject.connect(self.buttonBox,
QtCore.SIGNAL(u'rejected()'), songBookDialog.reject)
QtCore.QMetaObject.connectSlotsByName(songBookDialog)
self.retranslateUi(SongBookDialog) def retranslateUi(self, songBookDialog):
QtCore.QObject.connect(self.ButtonBox, songBookDialog.setWindowTitle(
QtCore.SIGNAL(u'accepted()'), SongBookDialog.accept)
QtCore.QObject.connect(self.ButtonBox,
QtCore.SIGNAL(u'rejected()'), SongBookDialog.reject)
QtCore.QMetaObject.connectSlotsByName(SongBookDialog)
def retranslateUi(self, SongBookDialog):
SongBookDialog.setWindowTitle(
translate('SongsPlugin.SongBookForm', 'Song Book Maintenance')) translate('SongsPlugin.SongBookForm', 'Song Book Maintenance'))
self.NameLabel.setText(translate('SongsPlugin.SongBookForm', '&Name:')) self.nameLabel.setText(translate('SongsPlugin.SongBookForm', '&Name:'))
self.PublisherLabel.setText( self.publisherLabel.setText(
translate('SongsPlugin.SongBookForm', '&Publisher:')) translate('SongsPlugin.SongBookForm', '&Publisher:'))

View File

@ -42,18 +42,18 @@ class SongBookForm(QtGui.QDialog, Ui_SongBookDialog):
def exec_(self, clear=True): def exec_(self, clear=True):
if clear: if clear:
self.NameEdit.clear() self.nameEdit.clear()
self.PublisherEdit.clear() self.publisherEdit.clear()
self.NameEdit.setFocus() self.nameEdit.setFocus()
return QtGui.QDialog.exec_(self) return QtGui.QDialog.exec_(self)
def accept(self): def accept(self):
if not self.NameEdit.text(): if not self.nameEdit.text():
QtGui.QMessageBox.critical( QtGui.QMessageBox.critical(
self, translate('SongsPlugin.SongBookForm', 'Error'), self, translate('SongsPlugin.SongBookForm', 'Error'),
translate('SongsPlugin.SongBookForm', translate('SongsPlugin.SongBookForm',
'You need to type in a name for the book.')) 'You need to type in a name for the book.'))
self.NameEdit.setFocus() self.nameEdit.setFocus()
return False return False
else: else:
return QtGui.QDialog.accept(self) return QtGui.QDialog.accept(self)

View File

@ -29,211 +29,145 @@ from PyQt4 import QtCore, QtGui
from openlp.core.lib import build_icon, translate from openlp.core.lib import build_icon, translate
class Ui_SongMaintenanceDialog(object): class Ui_SongMaintenanceDialog(object):
def setupUi(self, SongMaintenanceDialog): def setupUi(self, songMaintenanceDialog):
SongMaintenanceDialog.setObjectName(u'SongMaintenanceDialog') songMaintenanceDialog.setObjectName(u'songMaintenanceDialog')
SongMaintenanceDialog.setWindowModality(QtCore.Qt.ApplicationModal) songMaintenanceDialog.setWindowModality(QtCore.Qt.ApplicationModal)
SongMaintenanceDialog.resize(582, 361) songMaintenanceDialog.resize(10, 350)
self.DialogLayout = QtGui.QVBoxLayout(SongMaintenanceDialog) self.dialogLayout = QtGui.QGridLayout(songMaintenanceDialog)
self.DialogLayout.setSpacing(8) self.dialogLayout.setObjectName(u'dialogLayout')
self.DialogLayout.setMargin(8) self.typeListWidget = QtGui.QListWidget(songMaintenanceDialog)
self.DialogLayout.setObjectName(u'DialogLayout') # Caution: fixed widget width
self.ContentWidget = QtGui.QWidget(SongMaintenanceDialog) self.typeListWidget.setFixedWidth(172)
self.ContentWidget.setObjectName(u'ContentWidget') self.typeListWidget.setIconSize(QtCore.QSize(32, 32))
self.ContentLayout = QtGui.QHBoxLayout(self.ContentWidget) self.typeListWidget.setUniformItemSizes(True)
self.ContentLayout.setSpacing(8) self.typeListWidget.setObjectName(u'typeListWidget')
self.ContentLayout.setMargin(0) self.listItemAuthors = QtGui.QListWidgetItem(self.typeListWidget)
self.ContentLayout.setObjectName(u'ContentLayout') self.listItemAuthors.setIcon(
self.TypeListWidget = QtGui.QListWidget(self.ContentWidget) build_icon(u':/songs/author_maintenance.png'))
sizePolicy = QtGui.QSizePolicy( self.listItemTopics = QtGui.QListWidgetItem(self.typeListWidget)
QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Expanding) self.listItemTopics.setIcon(
sizePolicy.setHorizontalStretch(0) build_icon(u':/songs/topic_maintenance.png'))
sizePolicy.setVerticalStretch(0) self.listItemBooks = QtGui.QListWidgetItem(self.typeListWidget)
sizePolicy.setHeightForWidth( self.listItemBooks.setIcon(
self.TypeListWidget.sizePolicy().hasHeightForWidth()) build_icon(u':/songs/book_maintenance.png'))
self.TypeListWidget.setSizePolicy(sizePolicy) self.dialogLayout.addWidget(self.typeListWidget, 0, 0)
self.TypeListWidget.setViewMode(QtGui.QListView.ListMode) self.stackedLayout = QtGui.QStackedLayout()
self.TypeListWidget.setIconSize(QtCore.QSize(32, 32)) self.stackedLayout.setObjectName(u'stackedLayout')
self.TypeListWidget.setMovement(QtGui.QListView.Static) # authors page
self.TypeListWidget.setMaximumWidth(172) self.authorsPage = QtGui.QWidget(songMaintenanceDialog)
self.TypeListWidget.setSpacing(0) self.authorsPage.setObjectName(u'authorsPage')
self.TypeListWidget.setSortingEnabled(False) self.authorsLayout = QtGui.QVBoxLayout(self.authorsPage)
self.TypeListWidget.setUniformItemSizes(True) self.authorsLayout.setObjectName(u'authorsLayout')
self.TypeListWidget.setObjectName(u'TypeListWidget') self.authorsListWidget = QtGui.QListWidget(self.authorsPage)
icon = build_icon(u':/songs/author_maintenance.png') self.authorsListWidget.setObjectName(u'authorsListWidget')
item = QtGui.QListWidgetItem(self.TypeListWidget) self.authorsLayout.addWidget(self.authorsListWidget)
item.setIcon(icon) self.authorsButtonsLayout = QtGui.QHBoxLayout()
icon1 = build_icon(u':/songs/topic_maintenance.png') self.authorsButtonsLayout.setObjectName(u'authorsButtonsLayout')
item = QtGui.QListWidgetItem(self.TypeListWidget) self.authorsButtonsLayout.addStretch()
item.setIcon(icon1) self.authorsAddButton = QtGui.QPushButton(self.authorsPage)
icon2 = build_icon(u':/songs/book_maintenance.png') self.authorsAddButton.setIcon(build_icon(u':/songs/author_add.png'))
item = QtGui.QListWidgetItem(self.TypeListWidget) self.authorsAddButton.setObjectName(u'authorsAddButton')
item.setIcon(icon2) self.authorsButtonsLayout.addWidget(self.authorsAddButton)
self.ContentLayout.addWidget(self.TypeListWidget) self.authorsEditButton = QtGui.QPushButton(self.authorsPage)
self.TypeStackedWidget = QtGui.QStackedWidget(self.ContentWidget) self.authorsEditButton.setIcon(build_icon(u':/songs/author_edit.png'))
self.TypeStackedWidget.setObjectName(u'TypeStackedWidget') self.authorsEditButton.setObjectName(u'authorsEditButton')
self.AuthorsPage = QtGui.QWidget() self.authorsButtonsLayout.addWidget(self.authorsEditButton)
self.AuthorsPage.setObjectName(u'AuthorsPage') self.authorsDeleteButton = QtGui.QPushButton(self.authorsPage)
self.AuthorsLayout = QtGui.QVBoxLayout(self.AuthorsPage) self.authorsDeleteButton.setIcon(
self.AuthorsLayout.setSpacing(4) build_icon(u':/songs/author_delete.png'))
self.AuthorsLayout.setMargin(0) self.authorsDeleteButton.setObjectName(u'authorsDeleteButton')
self.AuthorsLayout.setObjectName(u'AuthorsLayout') self.authorsButtonsLayout.addWidget(self.authorsDeleteButton)
self.AuthorsListWidget = QtGui.QListWidget(self.AuthorsPage) self.authorsLayout.addLayout(self.authorsButtonsLayout)
self.AuthorsListWidget.setObjectName(u'AuthorsListWidget') self.stackedLayout.addWidget(self.authorsPage)
self.AuthorsLayout.addWidget(self.AuthorsListWidget) # topics page
self.AuthorButtonWidget = QtGui.QWidget(self.AuthorsPage) self.topicsPage = QtGui.QWidget(songMaintenanceDialog)
self.AuthorButtonWidget.setObjectName(u'AuthorButtonWidget') self.topicsPage.setObjectName(u'topicsPage')
self.AuthorButtonsLayout = QtGui.QHBoxLayout(self.AuthorButtonWidget) self.topicsLayout = QtGui.QVBoxLayout(self.topicsPage)
self.AuthorButtonsLayout.setSpacing(8) self.topicsLayout.setObjectName(u'topicsLayout')
self.AuthorButtonsLayout.setMargin(0) self.topicsListWidget = QtGui.QListWidget(self.topicsPage)
self.AuthorButtonsLayout.setObjectName(u'AuthorButtonsLayout') self.topicsListWidget.setObjectName(u'topicsListWidget')
spacerItem = QtGui.QSpacerItem(40, 20, self.topicsLayout.addWidget(self.topicsListWidget)
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.topicsButtonsLayout = QtGui.QHBoxLayout()
self.AuthorButtonsLayout.addItem(spacerItem) self.topicsButtonsLayout.setObjectName(u'topicsButtonLayout')
self.AuthorAddButton = QtGui.QPushButton(self.AuthorButtonWidget) self.topicsButtonsLayout.addStretch()
icon3 = build_icon(u':/songs/author_add.png') self.topicsAddButton = QtGui.QPushButton(self.topicsPage)
self.AuthorAddButton.setIcon(icon3) self.topicsAddButton.setIcon(build_icon(u':/songs/topic_add.png'))
self.AuthorAddButton.setObjectName(u'AuthorAddButton') self.topicsAddButton.setObjectName(u'topicsAddButton')
self.AuthorButtonsLayout.addWidget(self.AuthorAddButton) self.topicsButtonsLayout.addWidget(self.topicsAddButton)
self.AuthorEditButton = QtGui.QPushButton(self.AuthorButtonWidget) self.topicsEditButton = QtGui.QPushButton(self.topicsPage)
icon4 = build_icon(u':/songs/author_edit.png') self.topicsEditButton.setIcon(build_icon(u':/songs/topic_edit.png'))
self.AuthorEditButton.setIcon(icon4) self.topicsEditButton.setObjectName(u'topicsEditButton')
self.AuthorEditButton.setObjectName(u'AuthorEditButton') self.topicsButtonsLayout.addWidget(self.topicsEditButton)
self.AuthorButtonsLayout.addWidget(self.AuthorEditButton) self.topicsDeleteButton = QtGui.QPushButton(self.topicsPage)
self.AuthorDeleteButton = QtGui.QPushButton(self.AuthorButtonWidget) self.topicsDeleteButton.setIcon(build_icon(u':/songs/topic_delete.png'))
icon5 = build_icon(u':/songs/author_delete.png') self.topicsDeleteButton.setObjectName(u'topicsDeleteButton')
self.AuthorDeleteButton.setIcon(icon5) self.topicsButtonsLayout.addWidget(self.topicsDeleteButton)
self.AuthorDeleteButton.setObjectName(u'AuthorDeleteButton') self.topicsLayout.addLayout(self.topicsButtonsLayout)
self.AuthorButtonsLayout.addWidget(self.AuthorDeleteButton) self.stackedLayout.addWidget(self.topicsPage)
self.AuthorsLayout.addWidget(self.AuthorButtonWidget) # song books page
self.AuthorsLine = QtGui.QFrame(self.AuthorsPage) self.booksPage = QtGui.QWidget(songMaintenanceDialog)
self.AuthorsLine.setFrameShape(QtGui.QFrame.HLine) self.booksPage.setObjectName(u'booksPage')
self.AuthorsLine.setFrameShadow(QtGui.QFrame.Sunken) self.booksLayout = QtGui.QVBoxLayout(self.booksPage)
self.AuthorsLine.setObjectName(u'AuthorsLine') self.booksLayout.setObjectName(u'booksLayout')
self.AuthorsLayout.addWidget(self.AuthorsLine) self.booksListWidget = QtGui.QListWidget(self.booksPage)
self.TypeStackedWidget.addWidget(self.AuthorsPage) self.booksListWidget.setObjectName(u'booksListWidget')
self.TopicsPage = QtGui.QWidget() self.booksLayout.addWidget(self.booksListWidget)
self.TopicsPage.setObjectName(u'TopicsPage') self.booksButtonsLayout = QtGui.QHBoxLayout()
self.TopicLayout = QtGui.QVBoxLayout(self.TopicsPage) self.booksButtonsLayout.setObjectName(u'booksButtonLayout')
self.TopicLayout.setSpacing(4) self.booksButtonsLayout.addStretch()
self.TopicLayout.setMargin(0) self.booksAddButton = QtGui.QPushButton(self.booksPage)
self.TopicLayout.setObjectName(u'TopicLayout') self.booksAddButton.setIcon(build_icon(u':/songs/book_add.png'))
self.TopicsListWidget = QtGui.QListWidget(self.TopicsPage) self.booksAddButton.setObjectName(u'booksAddButton')
self.TopicsListWidget.setObjectName(u'TopicsListWidget') self.booksButtonsLayout.addWidget(self.booksAddButton)
self.TopicLayout.addWidget(self.TopicsListWidget) self.booksEditButton = QtGui.QPushButton(self.booksPage)
self.TopicButtonWidget = QtGui.QWidget(self.TopicsPage) self.booksEditButton.setIcon(build_icon(u':/songs/book_edit.png'))
self.TopicButtonWidget.setObjectName(u'TopicButtonWidget') self.booksEditButton.setObjectName(u'booksEditButton')
self.TopicButtonLayout = QtGui.QHBoxLayout(self.TopicButtonWidget) self.booksButtonsLayout.addWidget(self.booksEditButton)
self.TopicButtonLayout.setSpacing(8) self.booksDeleteButton = QtGui.QPushButton(self.booksPage)
self.TopicButtonLayout.setMargin(0) self.booksDeleteButton.setIcon(build_icon(u':/songs/book_delete.png'))
self.TopicButtonLayout.setObjectName(u'TopicButtonLayout') self.booksDeleteButton.setObjectName(u'booksDeleteButton')
TopicSpacerItem = QtGui.QSpacerItem(54, 20, self.booksButtonsLayout.addWidget(self.booksDeleteButton)
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.booksLayout.addLayout(self.booksButtonsLayout)
self.TopicButtonLayout.addItem(TopicSpacerItem) self.stackedLayout.addWidget(self.booksPage)
self.TopicAddButton = QtGui.QPushButton(self.TopicButtonWidget) #
icon6 = build_icon(u':/songs/topic_add.png') self.dialogLayout.addLayout(self.stackedLayout, 0, 1)
self.TopicAddButton.setIcon(icon6) self.buttonBox = QtGui.QDialogButtonBox(songMaintenanceDialog)
self.TopicAddButton.setObjectName(u'TopicAddButton') self.buttonBox.addButton(QtGui.QDialogButtonBox.Close)
self.TopicButtonLayout.addWidget(self.TopicAddButton) self.buttonBox.setObjectName(u'buttonBox')
self.TopicEditButton = QtGui.QPushButton(self.TopicButtonWidget) self.dialogLayout.addWidget(self.buttonBox, 1, 0, 1, 2)
icon7 = build_icon(u':/songs/topic_edit.png') self.retranslateUi(songMaintenanceDialog)
self.TopicEditButton.setIcon(icon7) self.stackedLayout.setCurrentIndex(0)
self.TopicEditButton.setObjectName(u'TopicEditButton') QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(u'rejected()'),
self.TopicButtonLayout.addWidget(self.TopicEditButton) songMaintenanceDialog.accept)
self.TopicDeleteButton = QtGui.QPushButton(self.TopicButtonWidget) QtCore.QObject.connect(self.typeListWidget,
icon8 = build_icon(u':/songs/topic_delete.png')
self.TopicDeleteButton.setIcon(icon8)
self.TopicDeleteButton.setObjectName(u'TopicDeleteButton')
self.TopicButtonLayout.addWidget(self.TopicDeleteButton)
self.TopicLayout.addWidget(self.TopicButtonWidget)
self.TopicsLine = QtGui.QFrame(self.TopicsPage)
self.TopicsLine.setFrameShape(QtGui.QFrame.HLine)
self.TopicsLine.setFrameShadow(QtGui.QFrame.Sunken)
self.TopicsLine.setObjectName(u'TopicsLine')
self.TopicLayout.addWidget(self.TopicsLine)
self.TypeStackedWidget.addWidget(self.TopicsPage)
self.BooksPage = QtGui.QWidget()
self.BooksPage.setObjectName(u'BooksPage')
self.BookLayout = QtGui.QVBoxLayout(self.BooksPage)
self.BookLayout.setSpacing(4)
self.BookLayout.setMargin(0)
self.BookLayout.setObjectName(u'BookLayout')
self.BooksListWidget = QtGui.QListWidget(self.BooksPage)
self.BooksListWidget.setObjectName(u'BooksListWidget')
self.BookLayout.addWidget(self.BooksListWidget)
self.BookButtonWidget = QtGui.QWidget(self.BooksPage)
self.BookButtonWidget.setObjectName(u'BookButtonWidget')
self.BookButtonLayout = QtGui.QHBoxLayout(self.BookButtonWidget)
self.BookButtonLayout.setSpacing(8)
self.BookButtonLayout.setMargin(0)
self.BookButtonLayout.setObjectName(u'BookButtonLayout')
spacerItem2 = QtGui.QSpacerItem(54, 20,
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.BookButtonLayout.addItem(spacerItem2)
self.BookAddButton = QtGui.QPushButton(self.BookButtonWidget)
icon9 = build_icon(u':/songs/book_add.png')
self.BookAddButton.setIcon(icon9)
self.BookAddButton.setObjectName(u'BookAddButton')
self.BookButtonLayout.addWidget(self.BookAddButton)
self.BookEditButton = QtGui.QPushButton(self.BookButtonWidget)
icon10 = build_icon(u':/songs/book_edit.png')
self.BookEditButton.setIcon(icon10)
self.BookEditButton.setObjectName(u'BookEditButton')
self.BookButtonLayout.addWidget(self.BookEditButton)
self.BookDeleteButton = QtGui.QPushButton(self.BookButtonWidget)
icon11 = build_icon(u':/songs/book_delete.png')
self.BookDeleteButton.setIcon(icon11)
self.BookDeleteButton.setObjectName(u'BookDeleteButton')
self.BookButtonLayout.addWidget(self.BookDeleteButton)
self.BookLayout.addWidget(self.BookButtonWidget)
self.BooksLine = QtGui.QFrame(self.BooksPage)
self.BooksLine.setFrameShape(QtGui.QFrame.HLine)
self.BooksLine.setFrameShadow(QtGui.QFrame.Sunken)
self.BooksLine.setObjectName(u'BooksLine')
self.BookLayout.addWidget(self.BooksLine)
self.TypeStackedWidget.addWidget(self.BooksPage)
self.ContentLayout.addWidget(self.TypeStackedWidget)
self.DialogLayout.addWidget(self.ContentWidget)
self.MaintenanceButtonBox = QtGui.QDialogButtonBox(
SongMaintenanceDialog)
self.MaintenanceButtonBox.setOrientation(QtCore.Qt.Horizontal)
self.MaintenanceButtonBox.setStandardButtons(
QtGui.QDialogButtonBox.Close)
self.MaintenanceButtonBox.setObjectName(u'MaintenanceButtonBox')
self.DialogLayout.addWidget(self.MaintenanceButtonBox)
self.retranslateUi(SongMaintenanceDialog)
self.TypeStackedWidget.setCurrentIndex(0)
QtCore.QObject.connect(self.MaintenanceButtonBox,
QtCore.SIGNAL(u'rejected()'), SongMaintenanceDialog.accept)
QtCore.QObject.connect(self.TypeListWidget,
QtCore.SIGNAL(u'currentRowChanged(int)'), QtCore.SIGNAL(u'currentRowChanged(int)'),
self.TypeStackedWidget.setCurrentIndex) self.stackedLayout.setCurrentIndex)
QtCore.QMetaObject.connectSlotsByName(SongMaintenanceDialog) QtCore.QMetaObject.connectSlotsByName(songMaintenanceDialog)
def retranslateUi(self, SongMaintenanceDialog): def retranslateUi(self, songMaintenanceDialog):
SongMaintenanceDialog.setWindowTitle( songMaintenanceDialog.setWindowTitle(
translate('SongsPlugin.SongMaintenanceForm', 'Song Maintenance')) translate('SongsPlugin.SongMaintenanceForm', 'Song Maintenance'))
self.TypeListWidget.item(0).setText( self.listItemAuthors.setText(
translate('SongsPlugin.SongMaintenanceForm', 'Authors')) translate('SongsPlugin.SongMaintenanceForm', 'Authors'))
self.TypeListWidget.item(1).setText( self.listItemTopics.setText(
translate('SongsPlugin.SongMaintenanceForm', 'Topics')) translate('SongsPlugin.SongMaintenanceForm', 'Topics'))
self.TypeListWidget.item(2).setText( self.listItemBooks.setText(
translate('SongsPlugin.SongMaintenanceForm', 'Song Books')) translate('SongsPlugin.SongMaintenanceForm', 'Song Books'))
self.AuthorAddButton.setText( self.authorsAddButton.setText(
translate('SongsPlugin.SongMaintenanceForm', '&Add')) translate('SongsPlugin.SongMaintenanceForm', '&Add'))
self.AuthorEditButton.setText( self.authorsEditButton.setText(
translate('SongsPlugin.SongMaintenanceForm', '&Edit')) translate('SongsPlugin.SongMaintenanceForm', '&Edit'))
self.AuthorDeleteButton.setText( self.authorsDeleteButton.setText(
translate('SongsPlugin.SongMaintenanceForm', '&Delete')) translate('SongsPlugin.SongMaintenanceForm', '&Delete'))
self.TopicAddButton.setText( self.topicsAddButton.setText(
translate('SongsPlugin.SongMaintenanceForm', '&Add')) translate('SongsPlugin.SongMaintenanceForm', '&Add'))
self.TopicEditButton.setText( self.topicsEditButton.setText(
translate('SongsPlugin.SongMaintenanceForm', '&Edit')) translate('SongsPlugin.SongMaintenanceForm', '&Edit'))
self.TopicDeleteButton.setText( self.topicsDeleteButton.setText(
translate('SongsPlugin.SongMaintenanceForm', '&Delete')) translate('SongsPlugin.SongMaintenanceForm', '&Delete'))
self.BookAddButton.setText( self.booksAddButton.setText(
translate('SongsPlugin.SongMaintenanceForm', '&Add')) translate('SongsPlugin.SongMaintenanceForm', '&Add'))
self.BookEditButton.setText( self.booksEditButton.setText(
translate('SongsPlugin.SongMaintenanceForm', '&Edit')) translate('SongsPlugin.SongMaintenanceForm', '&Edit'))
self.BookDeleteButton.setText( self.booksDeleteButton.setText(
translate('SongsPlugin.SongMaintenanceForm', '&Delete')) translate('SongsPlugin.SongMaintenanceForm', '&Delete'))

View File

@ -46,31 +46,31 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
self.authorform = AuthorsForm(self) self.authorform = AuthorsForm(self)
self.topicform = TopicsForm(self) self.topicform = TopicsForm(self)
self.bookform = SongBookForm(self) self.bookform = SongBookForm(self)
QtCore.QObject.connect(self.AuthorAddButton, QtCore.QObject.connect(self.authorsAddButton,
QtCore.SIGNAL(u'pressed()'), self.onAuthorAddButtonClick) QtCore.SIGNAL(u'pressed()'), self.onAuthorAddButtonClick)
QtCore.QObject.connect(self.TopicAddButton, QtCore.QObject.connect(self.topicsAddButton,
QtCore.SIGNAL(u'pressed()'), self.onTopicAddButtonClick) QtCore.SIGNAL(u'pressed()'), self.onTopicAddButtonClick)
QtCore.QObject.connect(self.BookAddButton, QtCore.QObject.connect(self.booksAddButton,
QtCore.SIGNAL(u'pressed()'), self.onBookAddButtonClick) QtCore.SIGNAL(u'pressed()'), self.onBookAddButtonClick)
QtCore.QObject.connect(self.AuthorEditButton, QtCore.QObject.connect(self.authorsEditButton,
QtCore.SIGNAL(u'pressed()'), self.onAuthorEditButtonClick) QtCore.SIGNAL(u'pressed()'), self.onAuthorEditButtonClick)
QtCore.QObject.connect(self.TopicEditButton, QtCore.QObject.connect(self.topicsEditButton,
QtCore.SIGNAL(u'pressed()'), self.onTopicEditButtonClick) QtCore.SIGNAL(u'pressed()'), self.onTopicEditButtonClick)
QtCore.QObject.connect(self.BookEditButton, QtCore.QObject.connect(self.booksEditButton,
QtCore.SIGNAL(u'pressed()'), self.onBookEditButtonClick) QtCore.SIGNAL(u'pressed()'), self.onBookEditButtonClick)
QtCore.QObject.connect(self.AuthorDeleteButton, QtCore.QObject.connect(self.authorsDeleteButton,
QtCore.SIGNAL(u'pressed()'), self.onAuthorDeleteButtonClick) QtCore.SIGNAL(u'pressed()'), self.onAuthorDeleteButtonClick)
QtCore.QObject.connect(self.TopicDeleteButton, QtCore.QObject.connect(self.topicsDeleteButton,
QtCore.SIGNAL(u'pressed()'), self.onTopicDeleteButtonClick) QtCore.SIGNAL(u'pressed()'), self.onTopicDeleteButtonClick)
QtCore.QObject.connect(self.BookDeleteButton, QtCore.QObject.connect(self.booksDeleteButton,
QtCore.SIGNAL(u'pressed()'), self.onBookDeleteButtonClick) QtCore.SIGNAL(u'pressed()'), self.onBookDeleteButtonClick)
def exec_(self): def exec_(self):
self.TypeListWidget.setCurrentRow(0) self.typeListWidget.setCurrentRow(0)
self.resetAuthors() self.resetAuthors()
self.resetTopics() self.resetTopics()
self.resetBooks() self.resetBooks()
self.TypeListWidget.setFocus() self.typeListWidget.setFocus()
return QtGui.QDialog.exec_(self) return QtGui.QDialog.exec_(self)
def _getCurrentItemId(self, ListWidget): def _getCurrentItemId(self, ListWidget):
@ -101,7 +101,7 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
""" """
Reloads the Authors list. Reloads the Authors list.
""" """
self.AuthorsListWidget.clear() self.authorsListWidget.clear()
authors = self.manager.get_all_objects(Author, authors = self.manager.get_all_objects(Author,
order_by_ref=Author.display_name) order_by_ref=Author.display_name)
for author in authors: for author in authors:
@ -109,50 +109,50 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
author_name = QtGui.QListWidgetItem(author.display_name) author_name = QtGui.QListWidgetItem(author.display_name)
else: else:
author_name = QtGui.QListWidgetItem( author_name = QtGui.QListWidgetItem(
u' '.join(author.first_name, author.last_name)) u' '.join([author.first_name, author.last_name]))
author_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(author.id)) author_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(author.id))
self.AuthorsListWidget.addItem(author_name) self.authorsListWidget.addItem(author_name)
if self.AuthorsListWidget.count() == 0: if self.authorsListWidget.count() == 0:
self.AuthorDeleteButton.setEnabled(False) self.authorsDeleteButton.setEnabled(False)
self.AuthorEditButton.setEnabled(False) self.authorsEditButton.setEnabled(False)
else: else:
self.AuthorDeleteButton.setEnabled(True) self.authorsDeleteButton.setEnabled(True)
self.AuthorEditButton.setEnabled(True) self.authorsEditButton.setEnabled(True)
def resetTopics(self): def resetTopics(self):
""" """
Reloads the Topics list. Reloads the Topics list.
""" """
self.TopicsListWidget.clear() self.topicsListWidget.clear()
topics = self.manager.get_all_objects(Topic, order_by_ref=Topic.name) topics = self.manager.get_all_objects(Topic, order_by_ref=Topic.name)
for topic in topics: for topic in topics:
topic_name = QtGui.QListWidgetItem(topic.name) topic_name = QtGui.QListWidgetItem(topic.name)
topic_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(topic.id)) topic_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(topic.id))
self.TopicsListWidget.addItem(topic_name) self.topicsListWidget.addItem(topic_name)
if self.TopicsListWidget.count() == 0: if self.topicsListWidget.count() == 0:
self.TopicDeleteButton.setEnabled(False) self.topicsDeleteButton.setEnabled(False)
self.TopicEditButton.setEnabled(False) self.topicsEditButton.setEnabled(False)
else: else:
self.TopicDeleteButton.setEnabled(True) self.topicsDeleteButton.setEnabled(True)
self.TopicEditButton.setEnabled(True) self.topicsEditButton.setEnabled(True)
def resetBooks(self): def resetBooks(self):
""" """
Reloads the Books list. Reloads the Books list.
""" """
self.BooksListWidget.clear() self.booksListWidget.clear()
books = self.manager.get_all_objects(Book, order_by_ref=Book.name) books = self.manager.get_all_objects(Book, order_by_ref=Book.name)
for book in books: for book in books:
book_name = QtGui.QListWidgetItem(u'%s (%s)' % (book.name, book_name = QtGui.QListWidgetItem(u'%s (%s)' % (book.name,
book.publisher)) book.publisher))
book_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(book.id)) book_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(book.id))
self.BooksListWidget.addItem(book_name) self.booksListWidget.addItem(book_name)
if self.BooksListWidget.count() == 0: if self.booksListWidget.count() == 0:
self.BookDeleteButton.setEnabled(False) self.booksDeleteButton.setEnabled(False)
self.BookEditButton.setEnabled(False) self.booksEditButton.setEnabled(False)
else: else:
self.BookDeleteButton.setEnabled(True) self.booksDeleteButton.setEnabled(True)
self.BookEditButton.setEnabled(True) self.booksEditButton.setEnabled(True)
def checkAuthor(self, new_author, edit=False): def checkAuthor(self, new_author, edit=False):
""" """
@ -222,9 +222,9 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
self.authorform.setAutoDisplayName(True) self.authorform.setAutoDisplayName(True)
if self.authorform.exec_(): if self.authorform.exec_():
author = Author.populate( author = Author.populate(
first_name=unicode(self.authorform.FirstNameEdit.text()), first_name=unicode(self.authorform.firstNameEdit.text()),
last_name=unicode(self.authorform.LastNameEdit.text()), last_name=unicode(self.authorform.lastNameEdit.text()),
display_name=unicode(self.authorform.DisplayEdit.text())) display_name=unicode(self.authorform.displayEdit.text()))
if self.checkAuthor(author): if self.checkAuthor(author):
if self.manager.save_object(author): if self.manager.save_object(author):
self.resetAuthors() self.resetAuthors()
@ -241,7 +241,7 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
def onTopicAddButtonClick(self): def onTopicAddButtonClick(self):
if self.topicform.exec_(): if self.topicform.exec_():
topic = Topic.populate(name=unicode(self.topicform.NameEdit.text())) topic = Topic.populate(name=unicode(self.topicform.nameEdit.text()))
if self.checkTopic(topic): if self.checkTopic(topic):
if self.manager.save_object(topic): if self.manager.save_object(topic):
self.resetTopics() self.resetTopics()
@ -258,8 +258,8 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
def onBookAddButtonClick(self): def onBookAddButtonClick(self):
if self.bookform.exec_(): if self.bookform.exec_():
book = Book.populate(name=unicode(self.bookform.NameEdit.text()), book = Book.populate(name=unicode(self.bookform.nameEdit.text()),
publisher=unicode(self.bookform.PublisherEdit.text())) publisher=unicode(self.bookform.publisherEdit.text()))
if self.checkBook(book): if self.checkBook(book):
if self.manager.save_object(book): if self.manager.save_object(book):
self.resetBooks() self.resetBooks()
@ -275,13 +275,13 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
'This book already exists.')) 'This book already exists.'))
def onAuthorEditButtonClick(self): def onAuthorEditButtonClick(self):
author_id = self._getCurrentItemId(self.AuthorsListWidget) author_id = self._getCurrentItemId(self.authorsListWidget)
if author_id != -1: if author_id != -1:
author = self.manager.get_object(Author, author_id) author = self.manager.get_object(Author, author_id)
self.authorform.setAutoDisplayName(False) self.authorform.setAutoDisplayName(False)
self.authorform.FirstNameEdit.setText(author.first_name) self.authorform.firstNameEdit.setText(author.first_name)
self.authorform.LastNameEdit.setText(author.last_name) self.authorform.lastNameEdit.setText(author.last_name)
self.authorform.DisplayEdit.setText(author.display_name) self.authorform.displayEdit.setText(author.display_name)
# Save the author's first and last name as well as the display name # Save the author's first and last name as well as the display name
# for the case that they have to be restored. # for the case that they have to be restored.
temp_first_name = author.first_name temp_first_name = author.first_name
@ -289,10 +289,10 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
temp_display_name = author.display_name temp_display_name = author.display_name
if self.authorform.exec_(False): if self.authorform.exec_(False):
author.first_name = unicode( author.first_name = unicode(
self.authorform.FirstNameEdit.text()) self.authorform.firstNameEdit.text())
author.last_name = unicode(self.authorform.LastNameEdit.text()) author.last_name = unicode(self.authorform.lastNameEdit.text())
author.display_name = unicode( author.display_name = unicode(
self.authorform.DisplayEdit.text()) self.authorform.displayEdit.text())
if self.checkAuthor(author, True): if self.checkAuthor(author, True):
if self.manager.save_object(author): if self.manager.save_object(author):
self.resetAuthors() self.resetAuthors()
@ -328,14 +328,14 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
'author already exists.')) 'author already exists.'))
def onTopicEditButtonClick(self): def onTopicEditButtonClick(self):
topic_id = self._getCurrentItemId(self.TopicsListWidget) topic_id = self._getCurrentItemId(self.topicsListWidget)
if topic_id != -1: if topic_id != -1:
topic = self.manager.get_object(Topic, topic_id) topic = self.manager.get_object(Topic, topic_id)
self.topicform.NameEdit.setText(topic.name) self.topicform.nameEdit.setText(topic.name)
# Save the topic's name for the case that he has to be restored. # Save the topic's name for the case that he has to be restored.
temp_name = topic.name temp_name = topic.name
if self.topicform.exec_(False): if self.topicform.exec_(False):
topic.name = unicode(self.topicform.NameEdit.text()) topic.name = unicode(self.topicform.nameEdit.text())
if self.checkTopic(topic, True): if self.checkTopic(topic, True):
if self.manager.save_object(topic): if self.manager.save_object(topic):
self.resetTopics() self.resetTopics()
@ -365,20 +365,20 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
'already exists.')) 'already exists.'))
def onBookEditButtonClick(self): def onBookEditButtonClick(self):
book_id = self._getCurrentItemId(self.BooksListWidget) book_id = self._getCurrentItemId(self.booksListWidget)
if book_id != -1: if book_id != -1:
book = self.manager.get_object(Book, book_id) book = self.manager.get_object(Book, book_id)
if book.publisher is None: if book.publisher is None:
book.publisher = u'' book.publisher = u''
self.bookform.NameEdit.setText(book.name) self.bookform.nameEdit.setText(book.name)
self.bookform.PublisherEdit.setText(book.publisher) self.bookform.publisherEdit.setText(book.publisher)
# Save the book's name and publisher for the case that they have to # Save the book's name and publisher for the case that they have to
# be restored. # be restored.
temp_name = book.name temp_name = book.name
temp_publisher = book.publisher temp_publisher = book.publisher
if self.bookform.exec_(False): if self.bookform.exec_(False):
book.name = unicode(self.bookform.NameEdit.text()) book.name = unicode(self.bookform.nameEdit.text())
book.publisher = unicode(self.bookform.PublisherEdit.text()) book.publisher = unicode(self.bookform.publisherEdit.text())
if self.checkBook(book, True): if self.checkBook(book, True):
if self.manager.save_object(book): if self.manager.save_object(book):
self.resetBooks() self.resetBooks()
@ -466,7 +466,7 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
""" """
Delete the author if the author is not attached to any songs. Delete the author if the author is not attached to any songs.
""" """
self._deleteItem(Author, self.AuthorsListWidget, self.resetAuthors, self._deleteItem(Author, self.authorsListWidget, self.resetAuthors,
translate('SongsPlugin.SongMaintenanceForm', 'Delete Author'), translate('SongsPlugin.SongMaintenanceForm', 'Delete Author'),
translate('SongsPlugin.SongMaintenanceForm', translate('SongsPlugin.SongMaintenanceForm',
'Are you sure you want to delete the selected author?'), 'Are you sure you want to delete the selected author?'),
@ -479,7 +479,7 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
""" """
Delete the Book is the Book is not attached to any songs. Delete the Book is the Book is not attached to any songs.
""" """
self._deleteItem(Topic, self.TopicsListWidget, self.resetTopics, self._deleteItem(Topic, self.topicsListWidget, self.resetTopics,
translate('SongsPlugin.SongMaintenanceForm', 'Delete Topic'), translate('SongsPlugin.SongMaintenanceForm', 'Delete Topic'),
translate('SongsPlugin.SongMaintenanceForm', translate('SongsPlugin.SongMaintenanceForm',
'Are you sure you want to delete the selected topic?'), 'Are you sure you want to delete the selected topic?'),
@ -492,7 +492,7 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
""" """
Delete the Book is the Book is not attached to any songs. Delete the Book is the Book is not attached to any songs.
""" """
self._deleteItem(Book, self.BooksListWidget, self.resetBooks, self._deleteItem(Book, self.booksListWidget, self.resetBooks,
translate('SongsPlugin.SongMaintenanceForm', 'Delete Book'), translate('SongsPlugin.SongMaintenanceForm', 'Delete Book'),
translate('SongsPlugin.SongMaintenanceForm', translate('SongsPlugin.SongMaintenanceForm',
'Are you sure you want to delete the selected book?'), 'Are you sure you want to delete the selected book?'),

View File

@ -29,40 +29,35 @@ from PyQt4 import QtCore, QtGui
from openlp.core.lib import translate from openlp.core.lib import translate
class Ui_TopicsDialog(object): class Ui_TopicsDialog(object):
def setupUi(self, TopicsDialog): def setupUi(self, topicsDialog):
TopicsDialog.setObjectName(u'TopicsDialog') topicsDialog.setObjectName(u'topicsDialog')
TopicsDialog.resize(365, 77) topicsDialog.resize(300, 10)
self.TopicLayout = QtGui.QFormLayout(TopicsDialog) self.dialogLayout = QtGui.QVBoxLayout(topicsDialog)
self.TopicLayout.setFieldGrowthPolicy( self.dialogLayout.setObjectName(u'dialogLayout')
QtGui.QFormLayout.ExpandingFieldsGrow) self.nameLayout = QtGui.QFormLayout()
self.TopicLayout.setMargin(8) self.nameLayout.setObjectName(u'nameLayout')
self.TopicLayout.setSpacing(8) self.nameLabel = QtGui.QLabel(topicsDialog)
self.TopicLayout.setObjectName(u'TopicLayout') self.nameLabel.setObjectName(u'nameLabel')
self.NameLabel = QtGui.QLabel(TopicsDialog) self.nameEdit = QtGui.QLineEdit(topicsDialog)
self.NameLabel.setObjectName(u'NameLabel') self.nameEdit.setObjectName(u'nameEdit')
self.TopicLayout.setWidget(0, self.nameLabel.setBuddy(self.nameEdit)
QtGui.QFormLayout.LabelRole, self.NameLabel) self.nameLayout.addRow(self.nameLabel, self.nameEdit)
self.NameEdit = QtGui.QLineEdit(TopicsDialog) self.dialogLayout.addLayout(self.nameLayout)
self.NameEdit.setObjectName(u'NameEdit') self.buttonBox = QtGui.QDialogButtonBox(topicsDialog)
self.TopicLayout.setWidget(0, self.buttonBox.setStandardButtons(
QtGui.QFormLayout.FieldRole, self.NameEdit)
self.TopicButtonBox = QtGui.QDialogButtonBox(TopicsDialog)
self.TopicButtonBox.setOrientation(QtCore.Qt.Horizontal)
self.TopicButtonBox.setStandardButtons(
QtGui.QDialogButtonBox.Save | QtGui.QDialogButtonBox.Cancel) QtGui.QDialogButtonBox.Save | QtGui.QDialogButtonBox.Cancel)
self.TopicButtonBox.setObjectName(u'TopicButtonBox') self.buttonBox.setObjectName(u'buttonBox')
self.TopicLayout.setWidget(1, self.dialogLayout.addWidget(self.buttonBox)
QtGui.QFormLayout.FieldRole, self.TopicButtonBox) self.retranslateUi(topicsDialog)
topicsDialog.setMaximumHeight(topicsDialog.sizeHint().height())
QtCore.QObject.connect(self.buttonBox,
QtCore.SIGNAL(u'accepted()'), topicsDialog.accept)
QtCore.QObject.connect(self.buttonBox,
QtCore.SIGNAL(u'rejected()'), topicsDialog.reject)
QtCore.QMetaObject.connectSlotsByName(topicsDialog)
self.retranslateUi(TopicsDialog) def retranslateUi(self, topicsDialog):
QtCore.QObject.connect(self.TopicButtonBox, topicsDialog.setWindowTitle(
QtCore.SIGNAL(u'accepted()'), TopicsDialog.accept)
QtCore.QObject.connect(self.TopicButtonBox,
QtCore.SIGNAL(u'rejected()'), TopicsDialog.reject)
QtCore.QMetaObject.connectSlotsByName(TopicsDialog)
def retranslateUi(self, TopicsDialog):
TopicsDialog.setWindowTitle(
translate('SongsPlugin.TopicsForm', 'Topic Maintenance')) translate('SongsPlugin.TopicsForm', 'Topic Maintenance'))
self.NameLabel.setText( self.nameLabel.setText(
translate('SongsPlugin.TopicsForm', 'Topic name:')) translate('SongsPlugin.TopicsForm', 'Topic name:'))

View File

@ -42,17 +42,17 @@ class TopicsForm(QtGui.QDialog, Ui_TopicsDialog):
def exec_(self, clear=True): def exec_(self, clear=True):
if clear: if clear:
self.NameEdit.clear() self.nameEdit.clear()
self.NameEdit.setFocus() self.nameEdit.setFocus()
return QtGui.QDialog.exec_(self) return QtGui.QDialog.exec_(self)
def accept(self): def accept(self):
if not self.NameEdit.text(): if not self.nameEdit.text():
QtGui.QMessageBox.critical( QtGui.QMessageBox.critical(
self, translate('SongsPlugin.TopicsForm', 'Error'), self, translate('SongsPlugin.TopicsForm', 'Error'),
translate('SongsPlugin.TopicsForm', translate('SongsPlugin.TopicsForm',
'You need to type in a topic name.')) 'You need to type in a topic name.'))
self.NameEdit.setFocus() self.nameEdit.setFocus()
return False return False
else: else:
return QtGui.QDialog.accept(self) return QtGui.QDialog.accept(self)

View File

@ -24,6 +24,7 @@
# Temple Place, Suite 330, Boston, MA 02111-1307 USA # # Temple Place, Suite 330, Boston, MA 02111-1307 USA #
############################################################################### ###############################################################################
from PyQt4 import QtGui
from openlp.core.lib import translate from openlp.core.lib import translate
class VerseType(object): class VerseType(object):
@ -123,6 +124,57 @@ class VerseType(object):
unicode(VerseType.to_string(VerseType.Other)).lower(): unicode(VerseType.to_string(VerseType.Other)).lower():
return VerseType.Other return VerseType.Other
def retrieve_windows_encoding(recommendation=None):
# map chardet result to compatible windows standard code page
codepage_mapping = {'IBM866': u'cp866', 'TIS-620': u'cp874',
'SHIFT_JIS': u'cp932', 'GB2312': u'cp936', 'HZ-GB-2312': u'cp936',
'EUC-KR': u'cp949', 'Big5': u'cp950', 'ISO-8859-2': u'cp1250',
'windows-1250': u'cp1250', 'windows-1251': u'cp1251',
'windows-1252': u'cp1252', 'ISO-8859-7': u'cp1253',
'windows-1253': u'cp1253', 'ISO-8859-8': u'cp1255',
'windows-1255': u'cp1255'}
if recommendation in codepage_mapping:
recommendation = codepage_mapping[recommendation]
# Show dialog for encoding selection
encodings = [(u'cp1256', translate('SongsPlugin', 'Arabic (CP-1256)')),
(u'cp1257', translate('SongsPlugin', 'Baltic (CP-1257)')),
(u'cp1250', translate('SongsPlugin', 'Central European (CP-1250)')),
(u'cp1251', translate('SongsPlugin', 'Cyrillic (CP-1251)')),
(u'cp1253', translate('SongsPlugin', 'Greek (CP-1253)')),
(u'cp1255', translate('SongsPlugin', 'Hebrew (CP-1255)')),
(u'cp932', translate('SongsPlugin', 'Japanese (CP-932)')),
(u'cp949', translate('SongsPlugin', 'Korean (CP-949)')),
(u'cp936', translate('SongsPlugin', 'Simplified Chinese (CP-936)')),
(u'cp874', translate('SongsPlugin', 'Thai (CP-874)')),
(u'cp950', translate('SongsPlugin', 'Traditional Chinese (CP-950)')),
(u'cp1254', translate('SongsPlugin', 'Turkish (CP-1254)')),
(u'cp1258', translate('SongsPlugin', 'Vietnam (CP-1258)')),
(u'cp1252', translate('SongsPlugin', 'Western European (CP-1252)'))]
recommended_index = -1
if recommendation:
for index in range(len(encodings)):
if recommendation == encodings[index][0]:
recommended_index = index
break
if recommended_index > 0:
choice = QtGui.QInputDialog.getItem(None,
translate('SongsPlugin', 'Character Encoding'),
translate('SongsPlugin', 'The codepage setting is responsible\n'
'for the correct character representation.\n'
'Usually you are fine with the preselected choise.'),
[pair[1] for pair in encodings], recommended_index, False)
else:
choice = QtGui.QInputDialog.getItem(None,
translate('SongsPlugin', 'Character Encoding'),
translate('SongsPlugin', 'Please choose the character encoding.\n'
'The encoding is responsible for the correct character '
'representation.'), [pair[1] for pair in encodings], 0, False)
if not choice[1]:
return None
return filter(lambda item: item[1] == choice[0], encodings)[0][0]
from xml import LyricsXML, SongXMLBuilder, SongXMLParser, OpenLyricsParser from xml import LyricsXML, SongXMLBuilder, SongXMLParser, OpenLyricsParser
from songstab import SongsTab from songstab import SongsTab
from mediaitem import SongMediaItem from mediaitem import SongMediaItem

View File

@ -32,6 +32,7 @@ import os
import struct import struct
from openlp.core.lib import translate from openlp.core.lib import translate
from openlp.plugins.songs.lib import retrieve_windows_encoding
from songimport import SongImport from songimport import SongImport
def strip_rtf(blob, encoding): def strip_rtf(blob, encoding):
@ -163,22 +164,25 @@ class EasyWorshipSongImport(SongImport):
self.encoding = u'cp1250' self.encoding = u'cp1250'
# The following codepage to actual encoding mappings have not been # The following codepage to actual encoding mappings have not been
# observed, but merely guessed. Actual example files are needed. # observed, but merely guessed. Actual example files are needed.
#if code_page == 737: elif code_page == 737:
# self.encoding = u'cp1253' self.encoding = u'cp1253'
#if code_page == 775: elif code_page == 775:
# self.encoding = u'cp1257' self.encoding = u'cp1257'
#if code_page == 855: elif code_page == 855:
# self.encoding = u'cp1251' self.encoding = u'cp1251'
#if code_page == 857: elif code_page == 857:
# self.encoding = u'cp1254' self.encoding = u'cp1254'
#if code_page == 866: elif code_page == 866:
# self.encoding = u'cp1251' self.encoding = u'cp1251'
#if code_page == 869: elif code_page == 869:
# self.encoding = u'cp1253' self.encoding = u'cp1253'
#if code_page == 862: elif code_page == 862:
# self.encoding = u'cp1255' self.encoding = u'cp1255'
#if code_page == 874: elif code_page == 874:
# self.encoding = u'cp874' self.encoding = u'cp874'
self.encoding = retrieve_windows_encoding(self.encoding)
if not self.encoding:
return False
# There does not appear to be a _reliable_ way of getting the number # There does not appear to be a _reliable_ way of getting the number
# of songs/records, so let's use file blocks for measuring progress. # of songs/records, so let's use file blocks for measuring progress.
total_blocks = (db_size - header_size) / (block_size * 1024) total_blocks = (db_size - header_size) / (block_size * 1024)
@ -347,4 +351,4 @@ class EasyWorshipSongImport(SongImport):
return u'' return u''
return self.memo_file.read(blob_size) return self.memo_file.read(blob_size)
else: else:
return 0 return 0

View File

@ -74,46 +74,37 @@ class SongMediaItem(MediaManagerItem):
def addEndHeaderBar(self): def addEndHeaderBar(self):
self.addToolbarSeparator() self.addToolbarSeparator()
## Song Maintenance Button ## ## Song Maintenance Button ##
self.addToolbarButton( self.maintenanceAction = self.addToolbarButton(u'', u'',
translate('SongsPlugin.MediaItem', 'Song Maintenance'),
translate('SongsPlugin.MediaItem',
'Maintain the lists of authors, topics and books'),
':/songs/song_maintenance.png', self.onSongMaintenanceClick) ':/songs/song_maintenance.png', self.onSongMaintenanceClick)
self.pageLayout.setSpacing(4) self.searchWidget = QtGui.QWidget(self)
self.SearchLayout = QtGui.QFormLayout() self.searchWidget.setObjectName(u'searchWidget')
self.SearchLayout.setMargin(0) self.searchLayout = QtGui.QVBoxLayout(self.searchWidget)
self.SearchLayout.setSpacing(4) self.searchLayout.setObjectName(u'searchLayout')
self.SearchLayout.setObjectName(u'SearchLayout') self.searchTextLayout = QtGui.QFormLayout()
self.SearchTextLabel = QtGui.QLabel(self) self.searchTextLayout.setObjectName(u'searchTextLayout')
self.SearchTextLabel.setAlignment( self.searchTextLabel = QtGui.QLabel(self.searchWidget)
QtCore.Qt.AlignBottom|QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft) self.searchTextLabel.setObjectName(u'searchTextLabel')
self.SearchTextLabel.setObjectName(u'SearchTextLabel') self.searchTextEdit = SearchEdit(self.searchWidget)
self.SearchLayout.setWidget( self.searchTextEdit.setObjectName(u'searchTextEdit')
0, QtGui.QFormLayout.LabelRole, self.SearchTextLabel) self.searchTextLabel.setBuddy(self.searchTextEdit)
self.SearchTextEdit = SearchEdit(self) self.searchTextLayout.addRow(self.searchTextLabel, self.searchTextEdit)
self.SearchTextEdit.setObjectName(u'SearchTextEdit') self.searchLayout.addLayout(self.searchTextLayout)
self.SearchLayout.setWidget( self.searchButtonLayout = QtGui.QHBoxLayout()
0, QtGui.QFormLayout.FieldRole, self.SearchTextEdit) self.searchButtonLayout.setObjectName(u'searchButtonLayout')
self.pageLayout.addLayout(self.SearchLayout) self.searchButtonLayout.addStretch()
self.SearchButtonLayout = QtGui.QHBoxLayout() self.searchTextButton = QtGui.QPushButton(self.searchWidget)
self.SearchButtonLayout.setMargin(0) self.searchTextButton.setObjectName(u'searchTextButton')
self.SearchButtonLayout.setSpacing(4) self.searchButtonLayout.addWidget(self.searchTextButton)
self.SearchButtonLayout.setObjectName(u'SearchButtonLayout') self.searchLayout.addLayout(self.searchButtonLayout)
self.SearchButtonSpacer = QtGui.QSpacerItem(40, 20, self.pageLayout.addWidget(self.searchWidget)
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.SearchButtonLayout.addItem(self.SearchButtonSpacer)
self.SearchTextButton = QtGui.QPushButton(self)
self.SearchTextButton.setObjectName(u'SearchTextButton')
self.SearchButtonLayout.addWidget(self.SearchTextButton)
self.pageLayout.addLayout(self.SearchButtonLayout)
# Signals and slots # Signals and slots
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'plugin_list_refresh'), self.onSearchTextButtonClick) QtCore.SIGNAL(u'plugin_list_refresh'), self.onSearchTextButtonClick)
QtCore.QObject.connect(self.SearchTextEdit, QtCore.QObject.connect(self.searchTextEdit,
QtCore.SIGNAL(u'returnPressed()'), self.onSearchTextButtonClick) QtCore.SIGNAL(u'returnPressed()'), self.onSearchTextButtonClick)
QtCore.QObject.connect(self.SearchTextButton, QtCore.QObject.connect(self.searchTextButton,
QtCore.SIGNAL(u'pressed()'), self.onSearchTextButtonClick) QtCore.SIGNAL(u'pressed()'), self.onSearchTextButtonClick)
QtCore.QObject.connect(self.SearchTextEdit, QtCore.QObject.connect(self.searchTextEdit,
QtCore.SIGNAL(u'textChanged(const QString&)'), QtCore.SIGNAL(u'textChanged(const QString&)'),
self.onSearchTextEditChanged) self.onSearchTextEditChanged)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.QObject.connect(Receiver.get_receiver(),
@ -126,9 +117,9 @@ class SongMediaItem(MediaManagerItem):
QtCore.SIGNAL(u'songs_edit'), self.onRemoteEdit) QtCore.SIGNAL(u'songs_edit'), self.onRemoteEdit)
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'songs_edit_clear'), self.onRemoteEditClear) QtCore.SIGNAL(u'songs_edit_clear'), self.onRemoteEditClear)
QtCore.QObject.connect(self.SearchTextEdit, QtCore.QObject.connect(self.searchTextEdit,
QtCore.SIGNAL(u'cleared()'), self.onClearTextButtonClick) QtCore.SIGNAL(u'cleared()'), self.onClearTextButtonClick)
QtCore.QObject.connect(self.SearchTextEdit, QtCore.QObject.connect(self.searchTextEdit,
QtCore.SIGNAL(u'searchTypeChanged(int)'), QtCore.SIGNAL(u'searchTypeChanged(int)'),
self.onSearchTextButtonClick) self.onSearchTextButtonClick)
@ -144,25 +135,32 @@ class SongMediaItem(MediaManagerItem):
QtCore.QVariant(u'True')).toBool() QtCore.QVariant(u'True')).toBool()
def retranslateUi(self): def retranslateUi(self):
self.SearchTextLabel.setText( self.searchTextLabel.setText(
translate('SongsPlugin.MediaItem', 'Search:')) translate('SongsPlugin.MediaItem', 'Search:'))
self.SearchTextButton.setText( self.searchTextButton.setText(
translate('SongsPlugin.MediaItem', 'Search')) translate('SongsPlugin.MediaItem', 'Search'))
self.maintenanceAction.setText(
translate('SongsPlugin.MediaItem', 'Song Maintenance'))
self.maintenanceAction.setToolTip(translate('SongsPlugin.MediaItem',
'Maintain the lists of authors, topics and books'))
def initialise(self): def initialise(self):
self.SearchTextEdit.setSearchTypes([ self.searchTextEdit.setSearchTypes([
(1, u':/songs/song_search_all.png', translate('SongsPlugin.MediaItem', 'Entire Song')), (1, u':/songs/song_search_all.png',
(2, u':/songs/song_search_title.png', translate('SongsPlugin.MediaItem', 'Titles')), translate('SongsPlugin.MediaItem', 'Entire Song')),
(3, u':/songs/song_search_lyrics.png', translate('SongsPlugin.MediaItem', 'Lyrics')), (2, u':/songs/song_search_title.png',
(4, u':/songs/song_search_author.png', translate('SongsPlugin.MediaItem', 'Authors')) translate('SongsPlugin.MediaItem', 'Titles')),
]) (3, u':/songs/song_search_lyrics.png',
translate('SongsPlugin.MediaItem', 'Lyrics')),
(4, u':/songs/song_search_author.png',
translate('SongsPlugin.MediaItem', 'Authors'))])
self.configUpdated() self.configUpdated()
def onSearchTextButtonClick(self): def onSearchTextButtonClick(self):
search_keywords = unicode(self.SearchTextEdit.displayText()) search_keywords = unicode(self.searchTextEdit.displayText())
search_results = [] search_results = []
# search_type = self.SearchTypeComboBox.currentIndex() # search_type = self.searchTypeComboBox.currentIndex()
search_type = self.SearchTextEdit.currentSearchType() search_type = self.searchTextEdit.currentSearchType()
if search_type == 1: if search_type == 1:
log.debug(u'Entire Song Search') log.debug(u'Entire Song Search')
search_results = self.parent.manager.get_all_objects(Song, search_results = self.parent.manager.get_all_objects(Song,
@ -241,7 +239,7 @@ class SongMediaItem(MediaManagerItem):
""" """
Clear the search text. Clear the search text.
""" """
self.SearchTextEdit.clear() self.searchTextEdit.clear()
self.onSearchTextButtonClick() self.onSearchTextButtonClick()
def onSearchTextEditChanged(self, text): def onSearchTextEditChanged(self, text):
@ -252,9 +250,9 @@ class SongMediaItem(MediaManagerItem):
""" """
if self.searchAsYouType: if self.searchAsYouType:
search_length = 1 search_length = 1
if self.SearchTextEdit.currentSearchType() == 1: if self.searchTextEdit.currentSearchType() == 1:
search_length = 3 search_length = 3
elif self.SearchTextEdit.currentSearchType() == 3: elif self.searchTextEdit.currentSearchType() == 3:
search_length = 7 search_length = 7
if len(text) > search_length: if len(text) > search_length:
self.onSearchTextButtonClick() self.onSearchTextButtonClick()

View File

@ -28,13 +28,12 @@ The :mod:`olp1import` module provides the functionality for importing
openlp.org 1.x song databases into the current installation database. openlp.org 1.x song databases into the current installation database.
""" """
from PyQt4 import QtGui
import logging import logging
from chardet.universaldetector import UniversalDetector from chardet.universaldetector import UniversalDetector
import sqlite import sqlite
from openlp.core.lib import translate from openlp.core.lib import translate
from openlp.plugins.songs.lib import retrieve_windows_encoding
from songimport import SongImport from songimport import SongImport
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
@ -185,64 +184,4 @@ class OpenLP1SongImport(SongImport):
detector.close() detector.close()
return detector.result[u'encoding'] return detector.result[u'encoding']
detector.close() detector.close()
guess = detector.result[u'encoding'] return retrieve_windows_encoding(detector.result[u'encoding'])
# map chardet result to compatible windows standard code page
codepage_mapping = {'IBM866': u'cp866', 'TIS-620': u'cp874',
'SHIFT_JIS': u'cp932', 'GB2312': u'cp936', 'HZ-GB-2312': u'cp936',
'EUC-KR': u'cp949', 'Big5': u'cp950', 'ISO-8859-2': u'cp1250',
'windows-1250': u'cp1250', 'windows-1251': u'cp1251',
'windows-1252': u'cp1252', 'ISO-8859-7': u'cp1253',
'windows-1253': u'cp1253', 'ISO-8859-8': u'cp1255',
'windows-1255': u'cp1255'}
if guess in codepage_mapping:
guess = codepage_mapping[guess]
else:
guess = u'cp1252'
# Show dialog for encoding selection
encodings = [(u'cp1256', translate('SongsPlugin.OpenLP1SongImport',
'Arabic (CP-1256)')),
(u'cp1257', translate('SongsPlugin.OpenLP1SongImport',
'Baltic (CP-1257)')),
(u'cp1250', translate('SongsPlugin.OpenLP1SongImport',
'Central European (CP-1250)')),
(u'cp1251', translate('SongsPlugin.OpenLP1SongImport',
'Cyrillic (CP-1251)')),
(u'cp1253', translate('SongsPlugin.OpenLP1SongImport',
'Greek (CP-1253)')),
(u'cp1255', translate('SongsPlugin.OpenLP1SongImport',
'Hebrew (CP-1255)')),
(u'cp932', translate('SongsPlugin.OpenLP1SongImport',
'Japanese (CP-932)')),
(u'cp949', translate('SongsPlugin.OpenLP1SongImport',
'Korean (CP-949)')),
(u'cp936', translate('SongsPlugin.OpenLP1SongImport',
'Simplified Chinese (CP-936)')),
(u'cp874', translate('SongsPlugin.OpenLP1SongImport',
'Thai (CP-874)')),
(u'cp950', translate('SongsPlugin.OpenLP1SongImport',
'Traditional Chinese (CP-950)')),
(u'cp1254', translate('SongsPlugin.OpenLP1SongImport',
'Turkish (CP-1254)')),
(u'cp1258', translate('SongsPlugin.OpenLP1SongImport',
'Vietnam (CP-1258)')),
(u'cp1252', translate('SongsPlugin.OpenLP1SongImport',
'Western European (CP-1252)'))]
encoding_index = 0
for index in range(len(encodings)):
if guess == encodings[index][0]:
encoding_index = index
break
chosen_encoding = QtGui.QInputDialog.getItem(None,
translate('SongsPlugin.OpenLP1SongImport',
'Database Character Encoding'),
translate('SongsPlugin.OpenLP1SongImport',
'The codepage setting is responsible\n'
'for the correct character representation.\n'
'Usually you are fine with the preselected choise.'),
[pair[1] for pair in encodings], encoding_index, False)
if not chosen_encoding[1]:
return None
return filter(lambda item: item[1] == chosen_encoding[0],
encodings)[0][0]