forked from openlp/openlp
HEAD
This commit is contained in:
commit
c016067a4f
|
@ -57,7 +57,7 @@ __all__ = [u'OpenLP', u'main']
|
|||
|
||||
|
||||
log = logging.getLogger()
|
||||
NT_REPARI_STYLESHEET = u"""
|
||||
NT_REPAIR_STYLESHEET = u"""
|
||||
QMainWindow::separator
|
||||
{
|
||||
border: none;
|
||||
|
@ -123,7 +123,7 @@ class OpenLP(QtGui.QApplication):
|
|||
u'QTableWidget, QListWidget, QTreeWidget {alternate-background-color: ' + base_color.name() + ';}\n'
|
||||
application_stylesheet += alternate_rows_repair_stylesheet
|
||||
if os.name == u'nt':
|
||||
application_stylesheet += NT_REPARI_STYLESHEET
|
||||
application_stylesheet += NT_REPAIR_STYLESHEET
|
||||
if application_stylesheet:
|
||||
self.setStyleSheet(application_stylesheet)
|
||||
show_splash = Settings().value(u'general/show splash')
|
||||
|
|
|
@ -419,7 +419,7 @@ class MediaManagerItem(QtGui.QWidget):
|
|||
pass
|
||||
|
||||
def generateSlideData(self, service_item, item=None, xml_version=False, remote=False,
|
||||
context=ServiceItemContext.Live):
|
||||
context=ServiceItemContext.Live):
|
||||
"""
|
||||
Generate the slide data. Needs to be implemented by the plugin.
|
||||
"""
|
||||
|
|
|
@ -43,16 +43,16 @@ class Ui_FileRenameDialog(object):
|
|||
"""
|
||||
Set up the UI
|
||||
"""
|
||||
file_rename_dialog.setObjectName(u'fileRenameDialog')
|
||||
file_rename_dialog.setObjectName(u'file_rename_dialog')
|
||||
file_rename_dialog.resize(300, 10)
|
||||
self.dialog_layout = QtGui.QGridLayout(file_rename_dialog)
|
||||
self.dialog_layout.setObjectName(u'dialogLayout')
|
||||
self.dialog_layout.setObjectName(u'dialog_layout')
|
||||
self.file_name_label = QtGui.QLabel(file_rename_dialog)
|
||||
self.file_name_label.setObjectName(u'fileNameLabel')
|
||||
self.file_name_label.setObjectName(u'file_name_label')
|
||||
self.dialog_layout.addWidget(self.file_name_label, 0, 0)
|
||||
self.file_name_edit = QtGui.QLineEdit(file_rename_dialog)
|
||||
self.file_name_edit.setValidator(QtGui.QRegExpValidator(QtCore.QRegExp(r'[^/\\?*|<>\[\]":+%]+'), self))
|
||||
self.file_name_edit.setObjectName(u'fileNameEdit')
|
||||
self.file_name_edit.setObjectName(u'file_name_edit')
|
||||
self.dialog_layout.addWidget(self.file_name_edit, 0, 1)
|
||||
self.button_box = create_button_box(file_rename_dialog, u'button_box', [u'cancel', u'ok'])
|
||||
self.dialog_layout.addWidget(self.button_box, 1, 0, 1, 2)
|
||||
|
|
|
@ -191,15 +191,15 @@ class Ui_FirstTimeWizard(object):
|
|||
FirstTimeWizard.setPage(FirstTimePage.Defaults, self.defaultsPage)
|
||||
# Progress page
|
||||
self.progressPage = QtGui.QWizardPage()
|
||||
self.progressPage.setObjectName(u'progress_page')
|
||||
self.progressPage.setObjectName(u'progressPage')
|
||||
self.progressLayout = QtGui.QVBoxLayout(self.progressPage)
|
||||
self.progressLayout.setMargin(48)
|
||||
self.progressLayout.setObjectName(u'progress_layout')
|
||||
self.progressLayout.setObjectName(u'progressLayout')
|
||||
self.progressLabel = QtGui.QLabel(self.progressPage)
|
||||
self.progressLabel.setObjectName(u'progress_label')
|
||||
self.progressLabel.setObjectName(u'progressLabel')
|
||||
self.progressLayout.addWidget(self.progressLabel)
|
||||
self.progressBar = QtGui.QProgressBar(self.progressPage)
|
||||
self.progressBar.setObjectName(u'progress_bar')
|
||||
self.progressBar.setObjectName(u'progressBar')
|
||||
self.progressLayout.addWidget(self.progressBar)
|
||||
FirstTimeWizard.setPage(FirstTimePage.Progress, self.progressPage)
|
||||
self.retranslateUi(FirstTimeWizard)
|
||||
|
|
|
@ -885,7 +885,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
|||
export_file_name += u'.conf'
|
||||
temp_file = os.path.join(unicode(gettempdir(),
|
||||
get_filesystem_encoding()), u'openlp', u'exportConf.tmp')
|
||||
self.saveSettings()
|
||||
self.save_settings()
|
||||
setting_sections = []
|
||||
# Add main sections.
|
||||
setting_sections.extend([self.generalSettingsSection])
|
||||
|
@ -1051,7 +1051,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
|||
self.plugin_manager.finalise_plugins()
|
||||
if save_settings:
|
||||
# Save settings
|
||||
self.saveSettings()
|
||||
self.save_settings()
|
||||
# Check if we need to change the data directory
|
||||
if self.new_data_path:
|
||||
self.changeDataDirectory()
|
||||
|
@ -1202,7 +1202,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
|||
self.controlSplitter.restoreState(settings.value(u'main window splitter geometry'))
|
||||
settings.endGroup()
|
||||
|
||||
def saveSettings(self):
|
||||
def save_settings(self):
|
||||
"""
|
||||
Save the main window settings.
|
||||
"""
|
||||
|
|
|
@ -58,9 +58,9 @@ class Ui_ServiceItemEditDialog(object):
|
|||
click=serviceItemEditDialog.on_delete_button_clicked)
|
||||
self.button_layout.addWidget(self.delete_button)
|
||||
self.button_layout.addStretch()
|
||||
self.up_button = create_button(serviceItemEditDialog, u'upButton', role=u'up',
|
||||
self.up_button = create_button(serviceItemEditDialog, u'up_button', role=u'up',
|
||||
click=serviceItemEditDialog.on_up_button_clicked)
|
||||
self.down_button = create_button(serviceItemEditDialog, u'downButton', role=u'down',
|
||||
self.down_button = create_button(serviceItemEditDialog, u'down_button', role=u'down',
|
||||
click=serviceItemEditDialog.on_down_button_clicked)
|
||||
self.button_layout.addWidget(self.up_button)
|
||||
self.button_layout.addWidget(self.down_button)
|
||||
|
|
|
@ -136,7 +136,7 @@ class OpenLPWizard(QtGui.QWizard):
|
|||
# Add a QTextEdit and a copy to file and copy to clipboard button to be
|
||||
# able to provide feedback to the user. Hidden by default.
|
||||
self.error_report_text_edit = QtGui.QTextEdit(self.progress_page)
|
||||
self.error_report_text_edit.setObjectName(u'progresserrorReportTextEdit')
|
||||
self.error_report_text_edit.setObjectName(u'error_report_text_edit')
|
||||
self.error_report_text_edit.setHidden(True)
|
||||
self.error_report_text_edit.setReadOnly(True)
|
||||
self.progress_layout.addWidget(self.error_report_text_edit)
|
||||
|
|
|
@ -65,7 +65,7 @@ class Ui_EditBibleDialog(object):
|
|||
self.copyrightLabel = QtGui.QLabel(self.licenseDetailsGroupBox)
|
||||
self.copyrightLabel.setObjectName(u'copyrightLabel')
|
||||
self.copyrightEdit = QtGui.QLineEdit(self.licenseDetailsGroupBox)
|
||||
self.copyrightEdit.setObjectName(u'copyrightEdit')
|
||||
self.copyrightEdit.setObjectName(u'copyright_edit')
|
||||
self.copyrightLabel.setBuddy(self.copyrightEdit)
|
||||
self.licenseDetailsLayout.addRow(self.copyrightLabel, self.copyrightEdit)
|
||||
self.permissionsLabel = QtGui.QLabel(self.licenseDetailsGroupBox)
|
||||
|
|
|
@ -55,7 +55,7 @@ There are two acceptable formats of the verses file. They are:
|
|||
or
|
||||
"Genesis",1,2,"And the earth was without form, and void; and...."
|
||||
|
||||
All CSV files are expected to use a comma (',') as the delimeter and double
|
||||
All CSV files are expected to use a comma (',') as the delimiter and double
|
||||
quotes ('"') as the quote symbol.
|
||||
"""
|
||||
import logging
|
||||
|
|
|
@ -52,14 +52,3 @@ This allows OpenLP to use ``self.object`` for all the GUI elements while keeping
|
|||
them separate from the functionality, so that it is easier to recreate the GUI
|
||||
from the .ui files later if necessary.
|
||||
"""
|
||||
|
||||
from mediafilesform import MediaFilesForm
|
||||
from authorsform import AuthorsForm
|
||||
from topicsform import TopicsForm
|
||||
from songbookform import SongBookForm
|
||||
from editverseform import EditVerseForm
|
||||
from editsongform import EditSongForm
|
||||
from songmaintenanceform import SongMaintenanceForm
|
||||
from songimportform import SongImportForm
|
||||
from songexportform import SongExportForm
|
||||
|
||||
|
|
|
@ -29,43 +29,56 @@
|
|||
|
||||
from PyQt4 import QtGui
|
||||
|
||||
from openlp.core.lib import translate
|
||||
from openlp.core.lib import translate, build_icon
|
||||
from openlp.core.lib.ui import create_button_box
|
||||
|
||||
class Ui_AuthorsDialog(object):
|
||||
def setupUi(self, authorsDialog):
|
||||
authorsDialog.setObjectName(u'AuthorsDialog')
|
||||
authorsDialog.resize(300, 10)
|
||||
self.dialogLayout = QtGui.QVBoxLayout(authorsDialog)
|
||||
self.dialogLayout.setObjectName(u'dialog_layout')
|
||||
self.authorLayout = QtGui.QFormLayout()
|
||||
self.authorLayout.setObjectName(u'authorLayout')
|
||||
self.firstNameLabel = QtGui.QLabel(authorsDialog)
|
||||
self.firstNameLabel.setObjectName(u'firstNameLabel')
|
||||
self.firstNameEdit = QtGui.QLineEdit(authorsDialog)
|
||||
self.firstNameEdit.setObjectName(u'firstNameEdit')
|
||||
self.firstNameLabel.setBuddy(self.firstNameEdit)
|
||||
self.authorLayout.addRow(self.firstNameLabel, self.firstNameEdit)
|
||||
self.lastNameLabel = QtGui.QLabel(authorsDialog)
|
||||
self.lastNameLabel.setObjectName(u'lastNameLabel')
|
||||
self.lastNameEdit = QtGui.QLineEdit(authorsDialog)
|
||||
self.lastNameEdit.setObjectName(u'lastNameEdit')
|
||||
self.lastNameLabel.setBuddy(self.lastNameEdit)
|
||||
self.authorLayout.addRow(self.lastNameLabel, self.lastNameEdit)
|
||||
self.displayLabel = QtGui.QLabel(authorsDialog)
|
||||
self.displayLabel.setObjectName(u'displayLabel')
|
||||
self.displayEdit = QtGui.QLineEdit(authorsDialog)
|
||||
self.displayEdit.setObjectName(u'displayEdit')
|
||||
self.displayLabel.setBuddy(self.displayEdit)
|
||||
self.authorLayout.addRow(self.displayLabel, self.displayEdit)
|
||||
self.dialogLayout.addLayout(self.authorLayout)
|
||||
self.button_box = create_button_box(authorsDialog, u'button_box', [u'cancel', u'save'])
|
||||
self.dialogLayout.addWidget(self.button_box)
|
||||
self.retranslateUi(authorsDialog)
|
||||
authorsDialog.setMaximumHeight(authorsDialog.sizeHint().height())
|
||||
|
||||
def retranslateUi(self, authorsDialog):
|
||||
authorsDialog.setWindowTitle(translate('SongsPlugin.AuthorsForm', 'Author Maintenance'))
|
||||
self.displayLabel.setText(translate('SongsPlugin.AuthorsForm', 'Display name:'))
|
||||
self.firstNameLabel.setText(translate('SongsPlugin.AuthorsForm', 'First name:'))
|
||||
self.lastNameLabel.setText(translate('SongsPlugin.AuthorsForm', 'Last name:'))
|
||||
class Ui_AuthorsDialog(object):
|
||||
"""
|
||||
The :class:`~openlp.plugins.songs.forms.authorsdialog.Ui_AuthorsDialog` class defines the user interface for the
|
||||
AuthorsForm dialog.
|
||||
"""
|
||||
def setupUi(self, authors_dialog):
|
||||
"""
|
||||
Set up the UI for the dialog.
|
||||
"""
|
||||
authors_dialog.setObjectName(u'authors_dialog')
|
||||
authors_dialog.resize(300, 10)
|
||||
authors_dialog.setWindowIcon(build_icon(u':/icon/openlp-logo-16x16.png'))
|
||||
authors_dialog.setModal(True)
|
||||
self.dialog_layout = QtGui.QVBoxLayout(authors_dialog)
|
||||
self.dialog_layout.setObjectName(u'dialog_layout')
|
||||
self.author_layout = QtGui.QFormLayout()
|
||||
self.author_layout.setObjectName(u'authorLayout')
|
||||
self.first_name_label = QtGui.QLabel(authors_dialog)
|
||||
self.first_name_label.setObjectName(u'first_name_label')
|
||||
self.first_name_edit = QtGui.QLineEdit(authors_dialog)
|
||||
self.first_name_edit.setObjectName(u'first_name_edit')
|
||||
self.first_name_label.setBuddy(self.first_name_edit)
|
||||
self.author_layout.addRow(self.first_name_label, self.first_name_edit)
|
||||
self.last_name_label = QtGui.QLabel(authors_dialog)
|
||||
self.last_name_label.setObjectName(u'last_name_label')
|
||||
self.last_name_edit = QtGui.QLineEdit(authors_dialog)
|
||||
self.last_name_edit.setObjectName(u'last_name_edit')
|
||||
self.last_name_label.setBuddy(self.last_name_edit)
|
||||
self.author_layout.addRow(self.last_name_label, self.last_name_edit)
|
||||
self.display_label = QtGui.QLabel(authors_dialog)
|
||||
self.display_label.setObjectName(u'display_label')
|
||||
self.display_edit = QtGui.QLineEdit(authors_dialog)
|
||||
self.display_edit.setObjectName(u'display_edit')
|
||||
self.display_label.setBuddy(self.display_edit)
|
||||
self.author_layout.addRow(self.display_label, self.display_edit)
|
||||
self.dialog_layout.addLayout(self.author_layout)
|
||||
self.button_box = create_button_box(authors_dialog, u'button_box', [u'cancel', u'save'])
|
||||
self.dialog_layout.addWidget(self.button_box)
|
||||
self.retranslateUi(authors_dialog)
|
||||
authors_dialog.setMaximumHeight(authors_dialog.sizeHint().height())
|
||||
|
||||
def retranslateUi(self, authors_dialog):
|
||||
"""
|
||||
Translate the UI on the fly.
|
||||
"""
|
||||
authors_dialog.setWindowTitle(translate('SongsPlugin.AuthorsForm', 'Author Maintenance'))
|
||||
self.display_label.setText(translate('SongsPlugin.AuthorsForm', 'Display name:'))
|
||||
self.first_name_label.setText(translate('SongsPlugin.AuthorsForm', 'First name:'))
|
||||
self.last_name_label.setText(translate('SongsPlugin.AuthorsForm', 'Last name:'))
|
||||
|
|
|
@ -27,12 +27,13 @@
|
|||
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
||||
###############################################################################
|
||||
|
||||
from PyQt4 import QtGui, QtCore
|
||||
from PyQt4 import QtGui
|
||||
|
||||
from openlp.core.lib import translate
|
||||
from openlp.core.lib.ui import critical_error_message_box
|
||||
from openlp.plugins.songs.forms.authorsdialog import Ui_AuthorsDialog
|
||||
|
||||
|
||||
class AuthorsForm(QtGui.QDialog, Ui_AuthorsDialog):
|
||||
"""
|
||||
Class to control the Maintenance of Authors Dialog
|
||||
|
@ -43,58 +44,115 @@ class AuthorsForm(QtGui.QDialog, Ui_AuthorsDialog):
|
|||
"""
|
||||
QtGui.QDialog.__init__(self, parent)
|
||||
self.setupUi(self)
|
||||
self._autoDisplayName = False
|
||||
self.firstNameEdit.textEdited.connect(self.onFirstNameEditTextEdited)
|
||||
self.lastNameEdit.textEdited.connect(self.onLastNameEditTextEdited)
|
||||
self.auto_display_name = False
|
||||
self.first_name_edit.textEdited.connect(self.on_first_name_edited)
|
||||
self.last_name_edit.textEdited.connect(self.on_last_name_edited)
|
||||
|
||||
def exec_(self, clear=True):
|
||||
"""
|
||||
Execute the dialog.
|
||||
|
||||
``clear``
|
||||
Clear the form fields before displaying the dialog.
|
||||
"""
|
||||
if clear:
|
||||
self.firstNameEdit.clear()
|
||||
self.lastNameEdit.clear()
|
||||
self.displayEdit.clear()
|
||||
self.firstNameEdit.setFocus()
|
||||
self.first_name_edit.clear()
|
||||
self.last_name_edit.clear()
|
||||
self.display_edit.clear()
|
||||
self.first_name_edit.setFocus()
|
||||
return QtGui.QDialog.exec_(self)
|
||||
|
||||
def onFirstNameEditTextEdited(self, display_name):
|
||||
if not self._autoDisplayName:
|
||||
def on_first_name_edited(self, display_name):
|
||||
"""
|
||||
Slot for when the first name is edited.
|
||||
|
||||
When the first name is edited and the setting to automatically create a display name is True, then try to create
|
||||
a display name from the first and last names.
|
||||
|
||||
``display_name``
|
||||
The text from the first_name_edit widget.
|
||||
"""
|
||||
if not self.auto_display_name:
|
||||
return
|
||||
if self.lastNameEdit.text():
|
||||
display_name = display_name + u' ' + self.lastNameEdit.text()
|
||||
self.displayEdit.setText(display_name)
|
||||
if self.last_name_edit.text():
|
||||
display_name = display_name + u' ' + self.last_name_edit.text()
|
||||
self.display_edit.setText(display_name)
|
||||
|
||||
def onLastNameEditTextEdited(self, display_name):
|
||||
if not self._autoDisplayName:
|
||||
def on_last_name_edited(self, display_name):
|
||||
"""
|
||||
Slot for when the last name is edited.
|
||||
|
||||
When the last name is edited and the setting to automatically create a display name is True, then try to create
|
||||
a display name from the first and last names.
|
||||
|
||||
``display_name``
|
||||
The text from the last_name_edit widget.
|
||||
"""
|
||||
if not self.auto_display_name:
|
||||
return
|
||||
if self.firstNameEdit.text():
|
||||
display_name = self.firstNameEdit.text() + u' ' + display_name
|
||||
self.displayEdit.setText(display_name)
|
||||
|
||||
def autoDisplayName(self):
|
||||
return self._autoDisplayName
|
||||
|
||||
def setAutoDisplayName(self, on):
|
||||
self._autoDisplayName = on
|
||||
if self.first_name_edit.text():
|
||||
display_name = self.first_name_edit.text() + u' ' + display_name
|
||||
self.display_edit.setText(display_name)
|
||||
|
||||
def accept(self):
|
||||
if not self.firstNameEdit.text():
|
||||
"""
|
||||
Override the QDialog's accept() method to do some validation before the dialog can be closed.
|
||||
"""
|
||||
if not self.first_name_edit.text():
|
||||
critical_error_message_box(
|
||||
message=translate('SongsPlugin.AuthorsForm', 'You need to type in the first name of the author.'))
|
||||
self.firstNameEdit.setFocus()
|
||||
self.first_name_edit.setFocus()
|
||||
return False
|
||||
elif not self.lastNameEdit.text():
|
||||
elif not self.last_name_edit.text():
|
||||
critical_error_message_box(
|
||||
message=translate('SongsPlugin.AuthorsForm', 'You need to type in the last name of the author.'))
|
||||
self.lastNameEdit.setFocus()
|
||||
self.last_name_edit.setFocus()
|
||||
return False
|
||||
elif not self.displayEdit.text():
|
||||
elif not self.display_edit.text():
|
||||
if critical_error_message_box(
|
||||
message=translate('SongsPlugin.AuthorsForm',
|
||||
'You have not set a display name for the author, combine the first and last names?'),
|
||||
parent=self, question=True) == QtGui.QMessageBox.Yes:
|
||||
self.displayEdit.setText(self.firstNameEdit.text() + u' ' + self.lastNameEdit.text())
|
||||
self.display_edit.setText(self.first_name_edit.text() + u' ' + self.last_name_edit.text())
|
||||
return QtGui.QDialog.accept(self)
|
||||
else:
|
||||
self.displayEdit.setFocus()
|
||||
self.display_edit.setFocus()
|
||||
return False
|
||||
else:
|
||||
return QtGui.QDialog.accept(self)
|
||||
|
||||
def _get_first_name(self):
|
||||
"""
|
||||
Get the value of the first name from the UI widget.
|
||||
"""
|
||||
return self.first_name_edit.text()
|
||||
|
||||
def _set_first_name(self, value):
|
||||
"""
|
||||
Set the value of the first name in the UI widget.
|
||||
"""
|
||||
self.first_name_edit.setText(value)
|
||||
|
||||
first_name = property(_get_first_name, _set_first_name)
|
||||
|
||||
def _get_last_name(self):
|
||||
"""
|
||||
Get the value of the last name from the UI widget.
|
||||
"""
|
||||
return self.last_name_edit.text()
|
||||
|
||||
def _set_last_name(self, value):
|
||||
"""
|
||||
Set the value of the last name in the UI widget.
|
||||
"""
|
||||
self.last_name_edit.setText(value)
|
||||
|
||||
last_name = property(_get_last_name, _set_last_name)
|
||||
|
||||
def _get_display_name(self):
|
||||
return self.display_edit.text()
|
||||
|
||||
def _set_display_name(self, value):
|
||||
self.display_edit.setText(value)
|
||||
|
||||
display_name = property(_get_display_name, _set_display_name)
|
||||
|
|
|
@ -33,302 +33,318 @@ from openlp.core.lib import UiStrings, build_icon, translate
|
|||
from openlp.core.lib.ui import create_button_box, create_button
|
||||
from openlp.plugins.songs.lib.ui import SongStrings
|
||||
|
||||
class Ui_EditSongDialog(object):
|
||||
def setupUi(self, editSongDialog):
|
||||
editSongDialog.setObjectName(u'editSongDialog')
|
||||
editSongDialog.resize(650, 400)
|
||||
editSongDialog.setWindowIcon(build_icon(u':/icon/openlp-logo-16x16.png'))
|
||||
editSongDialog.setModal(True)
|
||||
self.dialogLayout = QtGui.QVBoxLayout(editSongDialog)
|
||||
self.dialogLayout.setSpacing(8)
|
||||
self.dialogLayout.setContentsMargins(8, 8, 8, 8)
|
||||
self.dialogLayout.setObjectName(u'dialog_layout')
|
||||
self.songTabWidget = QtGui.QTabWidget(editSongDialog)
|
||||
self.songTabWidget.setObjectName(u'songTabWidget')
|
||||
# lyrics tab
|
||||
self.lyricsTab = QtGui.QWidget()
|
||||
self.lyricsTab.setObjectName(u'lyricsTab')
|
||||
self.lyricsTabLayout = QtGui.QGridLayout(self.lyricsTab)
|
||||
self.lyricsTabLayout.setObjectName(u'lyricsTabLayout')
|
||||
self.title_label = QtGui.QLabel(self.lyricsTab)
|
||||
self.title_label.setObjectName(u'title_label')
|
||||
self.lyricsTabLayout.addWidget(self.title_label, 0, 0)
|
||||
self.titleEdit = QtGui.QLineEdit(self.lyricsTab)
|
||||
self.titleEdit.setObjectName(u'titleEdit')
|
||||
self.title_label.setBuddy(self.titleEdit)
|
||||
self.lyricsTabLayout.addWidget(self.titleEdit, 0, 1, 1, 2)
|
||||
self.alternativetitle_label = QtGui.QLabel(self.lyricsTab)
|
||||
self.alternativetitle_label.setObjectName(u'alternativetitle_label')
|
||||
self.lyricsTabLayout.addWidget(self.alternativetitle_label, 1, 0)
|
||||
self.alternativeEdit = QtGui.QLineEdit(self.lyricsTab)
|
||||
self.alternativeEdit.setObjectName(u'alternativeEdit')
|
||||
self.alternativetitle_label.setBuddy(self.alternativeEdit)
|
||||
self.lyricsTabLayout.addWidget(self.alternativeEdit, 1, 1, 1, 2)
|
||||
self.lyricsLabel = QtGui.QLabel(self.lyricsTab)
|
||||
self.lyricsLabel.setFixedHeight(self.titleEdit.sizeHint().height())
|
||||
self.lyricsLabel.setObjectName(u'lyricsLabel')
|
||||
self.lyricsTabLayout.addWidget(self.lyricsLabel, 2, 0, QtCore.Qt.AlignTop)
|
||||
self.verseListWidget = SingleColumnTableWidget(self.lyricsTab)
|
||||
self.verseListWidget.setAlternatingRowColors(True)
|
||||
self.verseListWidget.setSelectionBehavior(QtGui.QAbstractItemView.SelectRows)
|
||||
self.verseListWidget.setSelectionMode(QtGui.QAbstractItemView.SingleSelection)
|
||||
self.verseListWidget.setEditTriggers(QtGui.QAbstractItemView.NoEditTriggers)
|
||||
self.verseListWidget.setObjectName(u'verseListWidget')
|
||||
self.lyricsLabel.setBuddy(self.verseListWidget)
|
||||
self.lyricsTabLayout.addWidget(self.verseListWidget, 2, 1)
|
||||
self.verseOrderLabel = QtGui.QLabel(self.lyricsTab)
|
||||
self.verseOrderLabel.setObjectName(u'verseOrderLabel')
|
||||
self.lyricsTabLayout.addWidget(self.verseOrderLabel, 3, 0)
|
||||
self.verseOrderEdit = QtGui.QLineEdit(self.lyricsTab)
|
||||
self.verseOrderEdit.setObjectName(u'verseOrderEdit')
|
||||
self.verseOrderLabel.setBuddy(self.verseOrderEdit)
|
||||
self.lyricsTabLayout.addWidget(self.verseOrderEdit, 3, 1, 1, 2)
|
||||
self.verseButtonsLayout = QtGui.QVBoxLayout()
|
||||
self.verseButtonsLayout.setObjectName(u'verseButtonsLayout')
|
||||
self.verseAddButton = QtGui.QPushButton(self.lyricsTab)
|
||||
self.verseAddButton.setObjectName(u'verseAddButton')
|
||||
self.verseButtonsLayout.addWidget(self.verseAddButton)
|
||||
self.verseEditButton = QtGui.QPushButton(self.lyricsTab)
|
||||
self.verseEditButton.setObjectName(u'verseEditButton')
|
||||
self.verseButtonsLayout.addWidget(self.verseEditButton)
|
||||
self.verseEditAllButton = QtGui.QPushButton(self.lyricsTab)
|
||||
self.verseEditAllButton.setObjectName(u'verseEditAllButton')
|
||||
self.verseButtonsLayout.addWidget(self.verseEditAllButton)
|
||||
self.verseDeleteButton = QtGui.QPushButton(self.lyricsTab)
|
||||
self.verseDeleteButton.setObjectName(u'verseDeleteButton')
|
||||
self.verseButtonsLayout.addWidget(self.verseDeleteButton)
|
||||
self.verseButtonsLayout.addStretch()
|
||||
self.lyricsTabLayout.addLayout(self.verseButtonsLayout, 2, 2)
|
||||
self.songTabWidget.addTab(self.lyricsTab, u'')
|
||||
# authors tab
|
||||
self.authorsTab = QtGui.QWidget()
|
||||
self.authorsTab.setObjectName(u'authorsTab')
|
||||
self.authorsTabLayout = QtGui.QHBoxLayout(self.authorsTab)
|
||||
self.authorsTabLayout.setObjectName(u'authorsTabLayout')
|
||||
self.authorsLeftLayout = QtGui.QVBoxLayout()
|
||||
self.authorsLeftLayout.setObjectName(u'authorsLeftLayout')
|
||||
self.authorsGroupBox = QtGui.QGroupBox(self.authorsTab)
|
||||
self.authorsGroupBox.setObjectName(u'authorsGroupBox')
|
||||
self.authorsLayout = QtGui.QVBoxLayout(self.authorsGroupBox)
|
||||
self.authorsLayout.setObjectName(u'authorsLayout')
|
||||
self.authorAddLayout = QtGui.QHBoxLayout()
|
||||
self.authorAddLayout.setObjectName(u'authorAddLayout')
|
||||
self.authorsComboBox = editSongDialogComboBox(self.authorsGroupBox, u'authorsComboBox')
|
||||
self.authorAddLayout.addWidget(self.authorsComboBox)
|
||||
self.authorAddButton = QtGui.QPushButton(self.authorsGroupBox)
|
||||
self.authorAddButton.setObjectName(u'authorAddButton')
|
||||
self.authorAddLayout.addWidget(self.authorAddButton)
|
||||
self.authorsLayout.addLayout(self.authorAddLayout)
|
||||
self.authorsListView = QtGui.QListWidget(self.authorsGroupBox)
|
||||
self.authorsListView.setAlternatingRowColors(True)
|
||||
self.authorsListView.setObjectName(u'authorsListView')
|
||||
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 = editSongDialogComboBox(self.topicsGroupBox, 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 = editSongDialogComboBox(self.songBookGroupBox, 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.authorsRightLayout.addWidget(self.songBookGroupBox)
|
||||
self.authorsTabLayout.addLayout(self.authorsRightLayout)
|
||||
self.songTabWidget.addTab(self.authorsTab, u'')
|
||||
# theme tab
|
||||
self.themeTab = QtGui.QWidget()
|
||||
self.themeTab.setObjectName(u'themeTab')
|
||||
self.themeTabLayout = QtGui.QHBoxLayout(self.themeTab)
|
||||
self.themeTabLayout.setObjectName(u'themeTabLayout')
|
||||
self.themeLeftLayout = QtGui.QVBoxLayout()
|
||||
self.themeLeftLayout.setObjectName(u'themeLeftLayout')
|
||||
self.themeGroupBox = QtGui.QGroupBox(self.themeTab)
|
||||
self.themeGroupBox.setObjectName(u'themeGroupBox')
|
||||
self.themeLayout = QtGui.QHBoxLayout(self.themeGroupBox)
|
||||
self.themeLayout.setObjectName(u'themeLayout')
|
||||
self.themeComboBox = editSongDialogComboBox(self.themeGroupBox, u'themeComboBox')
|
||||
self.themeLayout.addWidget(self.themeComboBox)
|
||||
self.themeAddButton = QtGui.QPushButton(self.themeGroupBox)
|
||||
self.themeAddButton.setObjectName(u'themeAddButton')
|
||||
self.themeLayout.addWidget(self.themeAddButton)
|
||||
self.themeLeftLayout.addWidget(self.themeGroupBox)
|
||||
self.rightsGroupBox = QtGui.QGroupBox(self.themeTab)
|
||||
self.rightsGroupBox.setObjectName(u'rightsGroupBox')
|
||||
self.rightsLayout = QtGui.QVBoxLayout(self.rightsGroupBox)
|
||||
self.rightsLayout.setObjectName(u'rightsLayout')
|
||||
self.copyrightLayout = QtGui.QHBoxLayout()
|
||||
self.copyrightLayout.setObjectName(u'copyrightLayout')
|
||||
self.copyrightEdit = QtGui.QLineEdit(self.rightsGroupBox)
|
||||
self.copyrightEdit.setObjectName(u'copyrightEdit')
|
||||
self.copyrightLayout.addWidget(self.copyrightEdit)
|
||||
self.copyrightInsertButton = QtGui.QToolButton(self.rightsGroupBox)
|
||||
self.copyrightInsertButton.setObjectName(u'copyrightInsertButton')
|
||||
self.copyrightLayout.addWidget(self.copyrightInsertButton)
|
||||
self.rightsLayout.addLayout(self.copyrightLayout)
|
||||
self.CCLILayout = QtGui.QHBoxLayout()
|
||||
self.CCLILayout.setObjectName(u'CCLILayout')
|
||||
self.CCLILabel = QtGui.QLabel(self.rightsGroupBox)
|
||||
self.CCLILabel.setObjectName(u'CCLILabel')
|
||||
self.CCLILayout.addWidget(self.CCLILabel)
|
||||
self.CCLNumberEdit = QtGui.QLineEdit(self.rightsGroupBox)
|
||||
self.CCLNumberEdit.setValidator(QtGui.QIntValidator())
|
||||
self.CCLNumberEdit.setObjectName(u'CCLNumberEdit')
|
||||
self.CCLILayout.addWidget(self.CCLNumberEdit)
|
||||
self.rightsLayout.addLayout(self.CCLILayout)
|
||||
self.themeLeftLayout.addWidget(self.rightsGroupBox)
|
||||
self.themeLeftLayout.addStretch()
|
||||
self.themeTabLayout.addLayout(self.themeLeftLayout)
|
||||
self.commentsGroupBox = QtGui.QGroupBox(self.themeTab)
|
||||
self.commentsGroupBox.setObjectName(u'commentsGroupBox')
|
||||
self.commentsLayout = QtGui.QVBoxLayout(self.commentsGroupBox)
|
||||
self.commentsLayout.setObjectName(u'commentsLayout')
|
||||
self.commentsEdit = QtGui.QTextEdit(self.commentsGroupBox)
|
||||
self.commentsEdit.setObjectName(u'commentsEdit')
|
||||
self.commentsLayout.addWidget(self.commentsEdit)
|
||||
self.themeTabLayout.addWidget(self.commentsGroupBox)
|
||||
self.songTabWidget.addTab(self.themeTab, u'')
|
||||
# audio tab
|
||||
self.audioTab = QtGui.QWidget()
|
||||
self.audioTab.setObjectName(u'audioTab')
|
||||
self.audioLayout = QtGui.QHBoxLayout(self.audioTab)
|
||||
self.audioLayout.setObjectName(u'audioLayout')
|
||||
self.audioListWidget = QtGui.QListWidget(self.audioTab)
|
||||
self.audioListWidget.setObjectName(u'audioListWidget')
|
||||
self.audioLayout.addWidget(self.audioListWidget)
|
||||
self.audioButtonsLayout = QtGui.QVBoxLayout()
|
||||
self.audioButtonsLayout.setObjectName(u'audioButtonsLayout')
|
||||
self.audioAddFromFileButton = QtGui.QPushButton(self.audioTab)
|
||||
self.audioAddFromFileButton.setObjectName(u'audioAddFromFileButton')
|
||||
self.audioButtonsLayout.addWidget(self.audioAddFromFileButton)
|
||||
self.audioAddFromMediaButton = QtGui.QPushButton(self.audioTab)
|
||||
self.audioAddFromMediaButton.setObjectName(u'audioAddFromMediaButton')
|
||||
self.audioButtonsLayout.addWidget(self.audioAddFromMediaButton)
|
||||
self.audioRemoveButton = QtGui.QPushButton(self.audioTab)
|
||||
self.audioRemoveButton.setObjectName(u'audioRemoveButton')
|
||||
self.audioButtonsLayout.addWidget(self.audioRemoveButton)
|
||||
self.audioRemoveAllButton = QtGui.QPushButton(self.audioTab)
|
||||
self.audioRemoveAllButton.setObjectName(u'audioRemoveAllButton')
|
||||
self.audioButtonsLayout.addWidget(self.audioRemoveAllButton)
|
||||
self.audioButtonsLayout.addStretch(1)
|
||||
self.upButton = create_button(self, u'upButton', role=u'up', click=self.onUpButtonClicked)
|
||||
self.downButton = create_button(self, u'downButton', role=u'down', click=self.onDownButtonClicked)
|
||||
self.audioButtonsLayout.addWidget(self.upButton)
|
||||
self.audioButtonsLayout.addWidget(self.downButton)
|
||||
self.audioLayout.addLayout(self.audioButtonsLayout)
|
||||
self.songTabWidget.addTab(self.audioTab, u'')
|
||||
# Last few bits
|
||||
self.dialogLayout.addWidget(self.songTabWidget)
|
||||
self.bottomLayout = QtGui.QHBoxLayout()
|
||||
self.bottomLayout.setObjectName(u'bottomLayout')
|
||||
self.warningLabel = QtGui.QLabel(editSongDialog)
|
||||
self.warningLabel.setObjectName(u'warningLabel')
|
||||
self.warningLabel.setVisible(False)
|
||||
self.bottomLayout.addWidget(self.warningLabel)
|
||||
self.button_box = create_button_box(editSongDialog, u'button_box', [u'cancel', u'save'])
|
||||
self.bottomLayout.addWidget(self.button_box)
|
||||
self.dialogLayout.addLayout(self.bottomLayout)
|
||||
self.retranslateUi(editSongDialog)
|
||||
|
||||
def retranslateUi(self, editSongDialog):
|
||||
editSongDialog.setWindowTitle(translate('SongsPlugin.EditSongForm', 'Song Editor'))
|
||||
class Ui_EditSongDialog(object):
|
||||
"""
|
||||
The :class:`~openlp.plugins.songs.forms.editsongdialog.Ui_EditSongDialog` class defines the user interface for the
|
||||
EditSongForm dialog.
|
||||
"""
|
||||
def setupUi(self, edit_song_dialog):
|
||||
edit_song_dialog.setObjectName(u'edit_song_dialog')
|
||||
edit_song_dialog.resize(650, 400)
|
||||
edit_song_dialog.setWindowIcon(build_icon(u':/icon/openlp-logo-16x16.png'))
|
||||
edit_song_dialog.setModal(True)
|
||||
self.dialog_layout = QtGui.QVBoxLayout(edit_song_dialog)
|
||||
self.dialog_layout.setSpacing(8)
|
||||
self.dialog_layout.setContentsMargins(8, 8, 8, 8)
|
||||
self.dialog_layout.setObjectName(u'dialog_layout')
|
||||
self.song_tab_widget = QtGui.QTabWidget(edit_song_dialog)
|
||||
self.song_tab_widget.setObjectName(u'song_tab_widget')
|
||||
# lyrics tab
|
||||
self.lyrics_tab = QtGui.QWidget()
|
||||
self.lyrics_tab.setObjectName(u'lyrics_tab')
|
||||
self.lyrics_tab_layout = QtGui.QGridLayout(self.lyrics_tab)
|
||||
self.lyrics_tab_layout.setObjectName(u'lyrics_tab_layout')
|
||||
self.title_label = QtGui.QLabel(self.lyrics_tab)
|
||||
self.title_label.setObjectName(u'title_label')
|
||||
self.lyrics_tab_layout.addWidget(self.title_label, 0, 0)
|
||||
self.title_edit = QtGui.QLineEdit(self.lyrics_tab)
|
||||
self.title_edit.setObjectName(u'title_edit')
|
||||
self.title_label.setBuddy(self.title_edit)
|
||||
self.lyrics_tab_layout.addWidget(self.title_edit, 0, 1, 1, 2)
|
||||
self.alternative_title_label = QtGui.QLabel(self.lyrics_tab)
|
||||
self.alternative_title_label.setObjectName(u'alternative_title_label')
|
||||
self.lyrics_tab_layout.addWidget(self.alternative_title_label, 1, 0)
|
||||
self.alternative_edit = QtGui.QLineEdit(self.lyrics_tab)
|
||||
self.alternative_edit.setObjectName(u'alternative_edit')
|
||||
self.alternative_title_label.setBuddy(self.alternative_edit)
|
||||
self.lyrics_tab_layout.addWidget(self.alternative_edit, 1, 1, 1, 2)
|
||||
self.lyrics_label = QtGui.QLabel(self.lyrics_tab)
|
||||
self.lyrics_label.setFixedHeight(self.title_edit.sizeHint().height())
|
||||
self.lyrics_label.setObjectName(u'lyrics_label')
|
||||
self.lyrics_tab_layout.addWidget(self.lyrics_label, 2, 0, QtCore.Qt.AlignTop)
|
||||
self.verse_list_widget = SingleColumnTableWidget(self.lyrics_tab)
|
||||
self.verse_list_widget.setAlternatingRowColors(True)
|
||||
self.verse_list_widget.setSelectionBehavior(QtGui.QAbstractItemView.SelectRows)
|
||||
self.verse_list_widget.setSelectionMode(QtGui.QAbstractItemView.SingleSelection)
|
||||
self.verse_list_widget.setEditTriggers(QtGui.QAbstractItemView.NoEditTriggers)
|
||||
self.verse_list_widget.setObjectName(u'verse_list_widget')
|
||||
self.lyrics_label.setBuddy(self.verse_list_widget)
|
||||
self.lyrics_tab_layout.addWidget(self.verse_list_widget, 2, 1)
|
||||
self.verse_order_label = QtGui.QLabel(self.lyrics_tab)
|
||||
self.verse_order_label.setObjectName(u'verse_order_label')
|
||||
self.lyrics_tab_layout.addWidget(self.verse_order_label, 3, 0)
|
||||
self.verse_order_edit = QtGui.QLineEdit(self.lyrics_tab)
|
||||
self.verse_order_edit.setObjectName(u'verse_order_edit')
|
||||
self.verse_order_label.setBuddy(self.verse_order_edit)
|
||||
self.lyrics_tab_layout.addWidget(self.verse_order_edit, 3, 1, 1, 2)
|
||||
self.verse_buttons_layout = QtGui.QVBoxLayout()
|
||||
self.verse_buttons_layout.setObjectName(u'verse_buttons_layout')
|
||||
self.verse_add_button = QtGui.QPushButton(self.lyrics_tab)
|
||||
self.verse_add_button.setObjectName(u'verse_add_button')
|
||||
self.verse_buttons_layout.addWidget(self.verse_add_button)
|
||||
self.verse_edit_button = QtGui.QPushButton(self.lyrics_tab)
|
||||
self.verse_edit_button.setObjectName(u'verse_edit_button')
|
||||
self.verse_buttons_layout.addWidget(self.verse_edit_button)
|
||||
self.verse_edit_all_button = QtGui.QPushButton(self.lyrics_tab)
|
||||
self.verse_edit_all_button.setObjectName(u'verse_edit_all_button')
|
||||
self.verse_buttons_layout.addWidget(self.verse_edit_all_button)
|
||||
self.verse_delete_button = QtGui.QPushButton(self.lyrics_tab)
|
||||
self.verse_delete_button.setObjectName(u'verse_delete_button')
|
||||
self.verse_buttons_layout.addWidget(self.verse_delete_button)
|
||||
self.verse_buttons_layout.addStretch()
|
||||
self.lyrics_tab_layout.addLayout(self.verse_buttons_layout, 2, 2)
|
||||
self.song_tab_widget.addTab(self.lyrics_tab, u'')
|
||||
# authors tab
|
||||
self.authors_tab = QtGui.QWidget()
|
||||
self.authors_tab.setObjectName(u'authors_tab')
|
||||
self.authors_tab_layout = QtGui.QHBoxLayout(self.authors_tab)
|
||||
self.authors_tab_layout.setObjectName(u'authors_tab_layout')
|
||||
self.authors_left_layout = QtGui.QVBoxLayout()
|
||||
self.authors_left_layout.setObjectName(u'authors_left_layout')
|
||||
self.authors_group_box = QtGui.QGroupBox(self.authors_tab)
|
||||
self.authors_group_box.setObjectName(u'authors_group_box')
|
||||
self.authors_layout = QtGui.QVBoxLayout(self.authors_group_box)
|
||||
self.authors_layout.setObjectName(u'authors_layout')
|
||||
self.author_add_layout = QtGui.QHBoxLayout()
|
||||
self.author_add_layout.setObjectName(u'author_add_layout')
|
||||
self.authors_combo_box = create_combo_box(self.authors_group_box, u'authors_combo_box')
|
||||
self.author_add_layout.addWidget(self.authors_combo_box)
|
||||
self.author_add_button = QtGui.QPushButton(self.authors_group_box)
|
||||
self.author_add_button.setObjectName(u'author_add_button')
|
||||
self.author_add_layout.addWidget(self.author_add_button)
|
||||
self.authors_layout.addLayout(self.author_add_layout)
|
||||
self.authors_list_view = QtGui.QListWidget(self.authors_group_box)
|
||||
self.authors_list_view.setAlternatingRowColors(True)
|
||||
self.authors_list_view.setObjectName(u'authors_list_view')
|
||||
self.authors_layout.addWidget(self.authors_list_view)
|
||||
self.author_remove_layout = QtGui.QHBoxLayout()
|
||||
self.author_remove_layout.setObjectName(u'author_remove_layout')
|
||||
self.author_remove_layout.addStretch()
|
||||
self.author_remove_button = QtGui.QPushButton(self.authors_group_box)
|
||||
self.author_remove_button.setObjectName(u'author_remove_button')
|
||||
self.author_remove_layout.addWidget(self.author_remove_button)
|
||||
self.authors_layout.addLayout(self.author_remove_layout)
|
||||
self.authors_left_layout.addWidget(self.authors_group_box)
|
||||
self.maintenance_layout = QtGui.QHBoxLayout()
|
||||
self.maintenance_layout.setObjectName(u'maintenance_layout')
|
||||
self.maintenance_button = QtGui.QPushButton(self.authors_tab)
|
||||
self.maintenance_button.setObjectName(u'maintenance_button')
|
||||
self.maintenance_layout.addWidget(self.maintenance_button)
|
||||
self.maintenance_layout.addStretch()
|
||||
self.authors_left_layout.addLayout(self.maintenance_layout)
|
||||
self.authors_tab_layout.addLayout(self.authors_left_layout)
|
||||
self.authors_right_layout = QtGui.QVBoxLayout()
|
||||
self.authors_right_layout.setObjectName(u'authors_right_layout')
|
||||
self.topics_group_box = QtGui.QGroupBox(self.authors_tab)
|
||||
self.topics_group_box.setObjectName(u'topics_group_box')
|
||||
self.topics_layout = QtGui.QVBoxLayout(self.topics_group_box)
|
||||
self.topics_layout.setObjectName(u'topics_layout')
|
||||
self.topic_add_layout = QtGui.QHBoxLayout()
|
||||
self.topic_add_layout.setObjectName(u'topic_add_layout')
|
||||
self.topicsComboBox = create_combo_box(self.topics_group_box, u'topicsComboBox')
|
||||
self.topic_add_layout.addWidget(self.topicsComboBox)
|
||||
self.topic_add_button = QtGui.QPushButton(self.topics_group_box)
|
||||
self.topic_add_button.setObjectName(u'topic_add_button')
|
||||
self.topic_add_layout.addWidget(self.topic_add_button)
|
||||
self.topics_layout.addLayout(self.topic_add_layout)
|
||||
self.topics_list_view = QtGui.QListWidget(self.topics_group_box)
|
||||
self.topics_list_view.setAlternatingRowColors(True)
|
||||
self.topics_list_view.setObjectName(u'topics_list_view')
|
||||
self.topics_layout.addWidget(self.topics_list_view)
|
||||
self.topic_remove_layout = QtGui.QHBoxLayout()
|
||||
self.topic_remove_layout.setObjectName(u'topic_remove_layout')
|
||||
self.topic_remove_layout.addStretch()
|
||||
self.topic_remove_button = QtGui.QPushButton(self.topics_group_box)
|
||||
self.topic_remove_button.setObjectName(u'topic_remove_button')
|
||||
self.topic_remove_layout.addWidget(self.topic_remove_button)
|
||||
self.topics_layout.addLayout(self.topic_remove_layout)
|
||||
self.authors_right_layout.addWidget(self.topics_group_box)
|
||||
self.song_book_group_box = QtGui.QGroupBox(self.authors_tab)
|
||||
self.song_book_group_box.setObjectName(u'song_book_group_box')
|
||||
self.song_book_layout = QtGui.QFormLayout(self.song_book_group_box)
|
||||
self.song_book_layout.setObjectName(u'song_book_layout')
|
||||
self.song_book_name_label = QtGui.QLabel(self.song_book_group_box)
|
||||
self.song_book_name_label.setObjectName(u'song_book_name_label')
|
||||
self.song_book_combo_box = create_combo_box(self.song_book_group_box, u'song_book_combo_box')
|
||||
self.song_book_name_label.setBuddy(self.song_book_combo_box)
|
||||
self.song_book_layout.addRow(self.song_book_name_label, self.song_book_combo_box)
|
||||
self.song_book_number_label = QtGui.QLabel(self.song_book_group_box)
|
||||
self.song_book_number_label.setObjectName(u'song_book_number_label')
|
||||
self.song_book_number_edit = QtGui.QLineEdit(self.song_book_group_box)
|
||||
self.song_book_number_edit.setObjectName(u'song_book_number_edit')
|
||||
self.song_book_number_label.setBuddy(self.song_book_number_edit)
|
||||
self.song_book_layout.addRow(self.song_book_number_label, self.song_book_number_edit)
|
||||
self.authors_right_layout.addWidget(self.song_book_group_box)
|
||||
self.authors_tab_layout.addLayout(self.authors_right_layout)
|
||||
self.song_tab_widget.addTab(self.authors_tab, u'')
|
||||
# theme tab
|
||||
self.theme_tab = QtGui.QWidget()
|
||||
self.theme_tab.setObjectName(u'theme_tab')
|
||||
self.theme_tab_layout = QtGui.QHBoxLayout(self.theme_tab)
|
||||
self.theme_tab_layout.setObjectName(u'theme_tab_layout')
|
||||
self.theme_left_layout = QtGui.QVBoxLayout()
|
||||
self.theme_left_layout.setObjectName(u'theme_left_layout')
|
||||
self.theme_group_box = QtGui.QGroupBox(self.theme_tab)
|
||||
self.theme_group_box.setObjectName(u'theme_group_box')
|
||||
self.theme_layout = QtGui.QHBoxLayout(self.theme_group_box)
|
||||
self.theme_layout.setObjectName(u'theme_layout')
|
||||
self.theme_combo_box = create_combo_box(self.theme_group_box, u'theme_combo_box')
|
||||
self.theme_layout.addWidget(self.theme_combo_box)
|
||||
self.theme_add_button = QtGui.QPushButton(self.theme_group_box)
|
||||
self.theme_add_button.setObjectName(u'theme_add_button')
|
||||
self.theme_layout.addWidget(self.theme_add_button)
|
||||
self.theme_left_layout.addWidget(self.theme_group_box)
|
||||
self.rights_group_box = QtGui.QGroupBox(self.theme_tab)
|
||||
self.rights_group_box.setObjectName(u'rights_group_box')
|
||||
self.rights_layout = QtGui.QVBoxLayout(self.rights_group_box)
|
||||
self.rights_layout.setObjectName(u'rights_layout')
|
||||
self.copyright_layout = QtGui.QHBoxLayout()
|
||||
self.copyright_layout.setObjectName(u'copyright_layout')
|
||||
self.copyright_edit = QtGui.QLineEdit(self.rights_group_box)
|
||||
self.copyright_edit.setObjectName(u'copyright_edit')
|
||||
self.copyright_layout.addWidget(self.copyright_edit)
|
||||
self.copyright_insert_button = QtGui.QToolButton(self.rights_group_box)
|
||||
self.copyright_insert_button.setObjectName(u'copyright_insert_button')
|
||||
self.copyright_layout.addWidget(self.copyright_insert_button)
|
||||
self.rights_layout.addLayout(self.copyright_layout)
|
||||
self.ccli_layout = QtGui.QHBoxLayout()
|
||||
self.ccli_layout.setObjectName(u'ccli_layout')
|
||||
self.ccli_label = QtGui.QLabel(self.rights_group_box)
|
||||
self.ccli_label.setObjectName(u'ccli_label')
|
||||
self.ccli_layout.addWidget(self.ccli_label)
|
||||
self.ccli_number_edit = QtGui.QLineEdit(self.rights_group_box)
|
||||
self.ccli_number_edit.setValidator(QtGui.QIntValidator())
|
||||
self.ccli_number_edit.setObjectName(u'ccli_number_edit')
|
||||
self.ccli_layout.addWidget(self.ccli_number_edit)
|
||||
self.rights_layout.addLayout(self.ccli_layout)
|
||||
self.theme_left_layout.addWidget(self.rights_group_box)
|
||||
self.theme_left_layout.addStretch()
|
||||
self.theme_tab_layout.addLayout(self.theme_left_layout)
|
||||
self.comments_group_box = QtGui.QGroupBox(self.theme_tab)
|
||||
self.comments_group_box.setObjectName(u'comments_group_box')
|
||||
self.comments_layout = QtGui.QVBoxLayout(self.comments_group_box)
|
||||
self.comments_layout.setObjectName(u'comments_layout')
|
||||
self.comments_edit = QtGui.QTextEdit(self.comments_group_box)
|
||||
self.comments_edit.setObjectName(u'comments_edit')
|
||||
self.comments_layout.addWidget(self.comments_edit)
|
||||
self.theme_tab_layout.addWidget(self.comments_group_box)
|
||||
self.song_tab_widget.addTab(self.theme_tab, u'')
|
||||
# audio tab
|
||||
self.audio_tab = QtGui.QWidget()
|
||||
self.audio_tab.setObjectName(u'audio_tab')
|
||||
self.audio_layout = QtGui.QHBoxLayout(self.audio_tab)
|
||||
self.audio_layout.setObjectName(u'audio_layout')
|
||||
self.audio_list_widget = QtGui.QListWidget(self.audio_tab)
|
||||
self.audio_list_widget.setObjectName(u'audio_list_widget')
|
||||
self.audio_layout.addWidget(self.audio_list_widget)
|
||||
self.audio_buttons_layout = QtGui.QVBoxLayout()
|
||||
self.audio_buttons_layout.setObjectName(u'audio_buttons_layout')
|
||||
self.from_file_button = QtGui.QPushButton(self.audio_tab)
|
||||
self.from_file_button.setObjectName(u'from_file_button')
|
||||
self.audio_buttons_layout.addWidget(self.from_file_button)
|
||||
self.from_media_button = QtGui.QPushButton(self.audio_tab)
|
||||
self.from_media_button.setObjectName(u'from_media_button')
|
||||
self.audio_buttons_layout.addWidget(self.from_media_button)
|
||||
self.audio_remove_button = QtGui.QPushButton(self.audio_tab)
|
||||
self.audio_remove_button.setObjectName(u'audio_remove_button')
|
||||
self.audio_buttons_layout.addWidget(self.audio_remove_button)
|
||||
self.audio_remove_all_button = QtGui.QPushButton(self.audio_tab)
|
||||
self.audio_remove_all_button.setObjectName(u'audio_remove_all_button')
|
||||
self.audio_buttons_layout.addWidget(self.audio_remove_all_button)
|
||||
self.audio_buttons_layout.addStretch(1)
|
||||
self.up_button = create_button(self, u'up_button', role=u'up', click=self.on_up_button_clicked)
|
||||
self.down_button = create_button(self, u'down_button', role=u'down', click=self.on_down_button_clicked)
|
||||
self.audio_buttons_layout.addWidget(self.up_button)
|
||||
self.audio_buttons_layout.addWidget(self.down_button)
|
||||
self.audio_layout.addLayout(self.audio_buttons_layout)
|
||||
self.song_tab_widget.addTab(self.audio_tab, u'')
|
||||
# Last few bits
|
||||
self.dialog_layout.addWidget(self.song_tab_widget)
|
||||
self.bottom_layout = QtGui.QHBoxLayout()
|
||||
self.bottom_layout.setObjectName(u'bottom_layout')
|
||||
self.warning_label = QtGui.QLabel(edit_song_dialog)
|
||||
self.warning_label.setObjectName(u'warning_label')
|
||||
self.warning_label.setVisible(False)
|
||||
self.bottom_layout.addWidget(self.warning_label)
|
||||
self.button_box = create_button_box(edit_song_dialog, u'button_box', [u'cancel', u'save'])
|
||||
self.bottom_layout.addWidget(self.button_box)
|
||||
self.dialog_layout.addLayout(self.bottom_layout)
|
||||
self.retranslateUi(edit_song_dialog)
|
||||
|
||||
def retranslateUi(self, edit_song_dialog):
|
||||
"""
|
||||
Translate the UI on the fly.
|
||||
"""
|
||||
edit_song_dialog.setWindowTitle(translate('SongsPlugin.EditSongForm', 'Song Editor'))
|
||||
self.title_label.setText(translate('SongsPlugin.EditSongForm', '&Title:'))
|
||||
self.alternativetitle_label.setText(translate('SongsPlugin.EditSongForm', 'Alt&ernate title:'))
|
||||
self.lyricsLabel.setText(translate('SongsPlugin.EditSongForm', '&Lyrics:'))
|
||||
self.verseOrderLabel.setText(translate('SongsPlugin.EditSongForm', '&Verse order:'))
|
||||
self.verseAddButton.setText(UiStrings().Add)
|
||||
self.verseEditButton.setText(UiStrings().Edit)
|
||||
self.verseEditAllButton.setText(translate('SongsPlugin.EditSongForm', 'Ed&it All'))
|
||||
self.verseDeleteButton.setText(UiStrings().Delete)
|
||||
self.songTabWidget.setTabText(self.songTabWidget.indexOf(self.lyricsTab),
|
||||
self.alternative_title_label.setText(translate('SongsPlugin.EditSongForm', 'Alt&ernate title:'))
|
||||
self.lyrics_label.setText(translate('SongsPlugin.EditSongForm', '&Lyrics:'))
|
||||
self.verse_order_label.setText(translate('SongsPlugin.EditSongForm', '&Verse order:'))
|
||||
self.verse_add_button.setText(UiStrings().Add)
|
||||
self.verse_edit_button.setText(UiStrings().Edit)
|
||||
self.verse_edit_all_button.setText(translate('SongsPlugin.EditSongForm', 'Ed&it All'))
|
||||
self.verse_delete_button.setText(UiStrings().Delete)
|
||||
self.song_tab_widget.setTabText(self.song_tab_widget.indexOf(self.lyrics_tab),
|
||||
translate('SongsPlugin.EditSongForm', 'Title && Lyrics'))
|
||||
self.authorsGroupBox.setTitle(SongStrings.Authors)
|
||||
self.authorAddButton.setText(translate('SongsPlugin.EditSongForm', '&Add to Song'))
|
||||
self.authorRemoveButton.setText(translate('SongsPlugin.EditSongForm', '&Remove'))
|
||||
self.maintenanceButton.setText(translate('SongsPlugin.EditSongForm', '&Manage Authors, Topics, Song Books'))
|
||||
self.topicsGroupBox.setTitle(SongStrings.Topic)
|
||||
self.topicAddButton.setText(translate('SongsPlugin.EditSongForm', 'A&dd to Song'))
|
||||
self.topicRemoveButton.setText(translate('SongsPlugin.EditSongForm', 'R&emove'))
|
||||
self.songBookGroupBox.setTitle(SongStrings.SongBook)
|
||||
self.songBookNameLabel.setText(translate('SongsPlugin.EditSongForm', 'Book:'))
|
||||
self.songBookNumberLabel.setText(translate('SongsPlugin.EditSongForm', 'Number:'))
|
||||
self.songTabWidget.setTabText(self.songTabWidget.indexOf(self.authorsTab),
|
||||
self.authors_group_box.setTitle(SongStrings.Authors)
|
||||
self.author_add_button.setText(translate('SongsPlugin.EditSongForm', '&Add to Song'))
|
||||
self.author_remove_button.setText(translate('SongsPlugin.EditSongForm', '&Remove'))
|
||||
self.maintenance_button.setText(translate('SongsPlugin.EditSongForm', '&Manage Authors, Topics, Song Books'))
|
||||
self.topics_group_box.setTitle(SongStrings.Topic)
|
||||
self.topic_add_button.setText(translate('SongsPlugin.EditSongForm', 'A&dd to Song'))
|
||||
self.topic_remove_button.setText(translate('SongsPlugin.EditSongForm', 'R&emove'))
|
||||
self.song_book_group_box.setTitle(SongStrings.SongBook)
|
||||
self.song_book_name_label.setText(translate('SongsPlugin.EditSongForm', 'Book:'))
|
||||
self.song_book_number_label.setText(translate('SongsPlugin.EditSongForm', 'Number:'))
|
||||
self.song_tab_widget.setTabText(self.song_tab_widget.indexOf(self.authors_tab),
|
||||
translate('SongsPlugin.EditSongForm', 'Authors, Topics && Song Book'))
|
||||
self.themeGroupBox.setTitle(UiStrings().Theme)
|
||||
self.themeAddButton.setText(translate('SongsPlugin.EditSongForm', 'New &Theme'))
|
||||
self.rightsGroupBox.setTitle(translate('SongsPlugin.EditSongForm', 'Copyright Information'))
|
||||
self.copyrightInsertButton.setText(SongStrings.CopyrightSymbol)
|
||||
self.CCLILabel.setText(UiStrings().CCLINumberLabel)
|
||||
self.commentsGroupBox.setTitle(translate('SongsPlugin.EditSongForm', 'Comments'))
|
||||
self.songTabWidget.setTabText(self.songTabWidget.indexOf(self.themeTab),
|
||||
self.theme_group_box.setTitle(UiStrings().Theme)
|
||||
self.theme_add_button.setText(translate('SongsPlugin.EditSongForm', 'New &Theme'))
|
||||
self.rights_group_box.setTitle(translate('SongsPlugin.EditSongForm', 'Copyright Information'))
|
||||
self.copyright_insert_button.setText(SongStrings.CopyrightSymbol)
|
||||
self.ccli_label.setText(UiStrings().CCLINumberLabel)
|
||||
self.comments_group_box.setTitle(translate('SongsPlugin.EditSongForm', 'Comments'))
|
||||
self.song_tab_widget.setTabText(self.song_tab_widget.indexOf(self.theme_tab),
|
||||
translate('SongsPlugin.EditSongForm', 'Theme, Copyright Info && Comments'))
|
||||
self.songTabWidget.setTabText(self.songTabWidget.indexOf(self.audioTab),
|
||||
self.song_tab_widget.setTabText(self.song_tab_widget.indexOf(self.audio_tab),
|
||||
translate('SongsPlugin.EditSongForm', 'Linked Audio'))
|
||||
self.audioAddFromFileButton.setText(translate('SongsPlugin.EditSongForm', 'Add &File(s)'))
|
||||
self.audioAddFromMediaButton.setText(translate('SongsPlugin.EditSongForm', 'Add &Media'))
|
||||
self.audioRemoveButton.setText(translate('SongsPlugin.EditSongForm', '&Remove'))
|
||||
self.audioRemoveAllButton.setText(translate('SongsPlugin.EditSongForm', 'Remove &All'))
|
||||
self.warningLabel.setText(
|
||||
self.from_file_button.setText(translate('SongsPlugin.EditSongForm', 'Add &File(s)'))
|
||||
self.from_media_button.setText(translate('SongsPlugin.EditSongForm', 'Add &Media'))
|
||||
self.audio_remove_button.setText(translate('SongsPlugin.EditSongForm', '&Remove'))
|
||||
self.audio_remove_all_button.setText(translate('SongsPlugin.EditSongForm', 'Remove &All'))
|
||||
self.warning_label.setText(
|
||||
translate('SongsPlugin.EditSongForm', '<strong>Warning:</strong> Not all of the verses are in use.'))
|
||||
|
||||
def editSongDialogComboBox(parent, name):
|
||||
|
||||
def create_combo_box(parent, name):
|
||||
"""
|
||||
Utility method to generate a standard combo box for this dialog.
|
||||
|
||||
``parent``
|
||||
The parent widget for this combo box.
|
||||
|
||||
``name``
|
||||
The object name.
|
||||
"""
|
||||
comboBox = QtGui.QComboBox(parent)
|
||||
comboBox.setSizeAdjustPolicy(QtGui.QComboBox.AdjustToMinimumContentsLength)
|
||||
comboBox.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
|
||||
comboBox.setEditable(True)
|
||||
comboBox.setInsertPolicy(QtGui.QComboBox.NoInsert)
|
||||
comboBox.setObjectName(name)
|
||||
return comboBox
|
||||
combo_box = QtGui.QComboBox(parent)
|
||||
combo_box.setSizeAdjustPolicy(QtGui.QComboBox.AdjustToMinimumContentsLength)
|
||||
combo_box.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
|
||||
combo_box.setEditable(True)
|
||||
combo_box.setInsertPolicy(QtGui.QComboBox.NoInsert)
|
||||
combo_box.setObjectName(name)
|
||||
return combo_box
|
||||
|
||||
|
||||
class SingleColumnTableWidget(QtGui.QTableWidget):
|
||||
"""
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -33,13 +33,13 @@ import logging
|
|||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from openlp.plugins.songs.lib import VerseType
|
||||
|
||||
from editversedialog import Ui_EditVerseDialog
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
VERSE_REGEX = re.compile(r'---\[(.+):\D*(\d*)\D*.*\]---')
|
||||
|
||||
|
||||
class EditVerseForm(QtGui.QDialog, Ui_EditVerseDialog):
|
||||
"""
|
||||
This is the form that is used to edit the verses of the song.
|
||||
|
|
|
@ -36,6 +36,7 @@ from mediafilesdialog import Ui_MediaFilesDialog
|
|||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class MediaFilesForm(QtGui.QDialog, Ui_MediaFilesDialog):
|
||||
"""
|
||||
Class to show a list of files from the
|
||||
|
|
|
@ -108,7 +108,7 @@ class SongExportForm(OpenLPWizard):
|
|||
self.availableListWidget.setObjectName(u'availableListWidget')
|
||||
self.verticalLayout.addWidget(self.availableListWidget)
|
||||
self.horizontalLayout = QtGui.QHBoxLayout()
|
||||
self.horizontalLayout.setObjectName(u'horizontal_layout')
|
||||
self.horizontalLayout.setObjectName(u'horizontalLayout')
|
||||
self.searchLabel = QtGui.QLabel(self.availableSongsPage)
|
||||
self.searchLabel.setObjectName(u'searchLabel')
|
||||
self.horizontalLayout.addWidget(self.searchLabel)
|
||||
|
@ -136,8 +136,9 @@ class SongExportForm(OpenLPWizard):
|
|||
self.selectedListWidget = QtGui.QListWidget(self.exportSongPage)
|
||||
self.selectedListWidget.setObjectName(u'selectedListWidget')
|
||||
self.gridLayout.addWidget(self.selectedListWidget, 1, 0, 1, 1)
|
||||
# FIXME: self.horizontalLayout is already defined above?!?!?
|
||||
self.horizontalLayout = QtGui.QHBoxLayout()
|
||||
self.horizontalLayout.setObjectName(u'horizontal_layout')
|
||||
self.horizontalLayout.setObjectName(u'horizontalLayout')
|
||||
self.directoryLabel = QtGui.QLabel(self.exportSongPage)
|
||||
self.directoryLabel.setObjectName(u'directoryLabel')
|
||||
self.horizontalLayout.addWidget(self.directoryLabel)
|
||||
|
|
|
@ -109,15 +109,15 @@ class SongImportForm(OpenLPWizard):
|
|||
"""
|
||||
# Source Page
|
||||
self.source_page = SongImportSourcePage()
|
||||
self.source_page.setObjectName(u'SourcePage')
|
||||
self.source_page.setObjectName(u'source_page')
|
||||
self.source_layout = QtGui.QVBoxLayout(self.source_page)
|
||||
self.source_layout.setObjectName(u'SourceLayout')
|
||||
self.source_layout.setObjectName(u'source_layout')
|
||||
self.format_layout = QtGui.QFormLayout()
|
||||
self.format_layout.setObjectName(u'FormatLayout')
|
||||
self.format_layout.setObjectName(u'format_layout')
|
||||
self.format_label = QtGui.QLabel(self.source_page)
|
||||
self.format_label.setObjectName(u'FormatLabel')
|
||||
self.format_label.setObjectName(u'format_label')
|
||||
self.format_combo_box = QtGui.QComboBox(self.source_page)
|
||||
self.format_combo_box.setObjectName(u'FormatComboBox')
|
||||
self.format_combo_box.setObjectName(u'format_combo_box')
|
||||
self.format_layout.addRow(self.format_label, self.format_combo_box)
|
||||
self.format_spacer = QtGui.QSpacerItem(10, 0, QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Minimum)
|
||||
self.format_layout.setItem(1, QtGui.QFormLayout.LabelRole, self.format_spacer)
|
||||
|
@ -127,7 +127,7 @@ class SongImportForm(OpenLPWizard):
|
|||
self.format_layout.setVerticalSpacing(0)
|
||||
self.stack_spacer = QtGui.QSpacerItem(10, 0, QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Expanding)
|
||||
self.format_stack = QtGui.QStackedLayout()
|
||||
self.format_stack.setObjectName(u'FormatStack')
|
||||
self.format_stack.setObjectName(u'format_stack')
|
||||
self.disablable_formats = []
|
||||
for self.current_format in SongFormat.get_format_list():
|
||||
self.addFileSelectItem()
|
||||
|
@ -395,14 +395,14 @@ class SongImportForm(OpenLPWizard):
|
|||
description_label = QtGui.QLabel(importWidget)
|
||||
description_label.setWordWrap(True)
|
||||
description_label.setOpenExternalLinks(True)
|
||||
description_label.setObjectName(prefix + u'DescriptionLabel')
|
||||
description_label.setObjectName(prefix + u'_description_label')
|
||||
descriptionLayout.addWidget(description_label)
|
||||
importLayout.addLayout(descriptionLayout)
|
||||
self.format_widgets[this_format][u'description_label'] = description_label
|
||||
self.format_widgets[this_format][u'descriptionSpacer'] = descriptionSpacer
|
||||
if select_mode == SongFormatSelect.SingleFile or select_mode == SongFormatSelect.SingleFolder:
|
||||
file_path_layout = QtGui.QHBoxLayout()
|
||||
file_path_layout.setObjectName(prefix + u'FilepathLayout')
|
||||
file_path_layout.setObjectName(prefix + u'_file_path_layout')
|
||||
file_path_layout.setContentsMargins(0, self.format_v_spacing, 0, 0)
|
||||
filepathLabel = QtGui.QLabel(importWidget)
|
||||
filepathLabel.setObjectName(prefix + u'FilepathLabel')
|
||||
|
@ -410,7 +410,7 @@ class SongImportForm(OpenLPWizard):
|
|||
filepathSpacer = QtGui.QSpacerItem(0, 0, QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
|
||||
file_path_layout.addSpacerItem(filepathSpacer)
|
||||
file_path_edit = QtGui.QLineEdit(importWidget)
|
||||
file_path_edit.setObjectName(prefix + u'FilepathEdit')
|
||||
file_path_edit.setObjectName(prefix + u'_file_path_edit')
|
||||
file_path_layout.addWidget(file_path_edit)
|
||||
browseButton = QtGui.QToolButton(importWidget)
|
||||
browseButton.setIcon(self.open_icon)
|
||||
|
@ -429,7 +429,7 @@ class SongImportForm(OpenLPWizard):
|
|||
fileListWidget.setObjectName(prefix + u'FileListWidget')
|
||||
importLayout.addWidget(fileListWidget)
|
||||
button_layout = QtGui.QHBoxLayout()
|
||||
button_layout.setObjectName(prefix + u'ButtonLayout')
|
||||
button_layout.setObjectName(prefix + u'_button_layout')
|
||||
addButton = QtGui.QPushButton(importWidget)
|
||||
addButton.setIcon(self.open_icon)
|
||||
addButton.setObjectName(prefix + u'AddButton')
|
||||
|
@ -458,21 +458,21 @@ class SongImportForm(OpenLPWizard):
|
|||
layout = QtGui.QVBoxLayout(page)
|
||||
layout.setMargin(0)
|
||||
layout.setSpacing(0)
|
||||
layout.setObjectName(prefix + u'Layout')
|
||||
layout.setObjectName(prefix + u'_layout')
|
||||
disabled_widget = QtGui.QWidget(page)
|
||||
disabled_widget.setVisible(False)
|
||||
disabled_widget.setObjectName(prefix + u'DisabledWidget')
|
||||
disabled_widget.setObjectName(prefix + u'_disabled_widget')
|
||||
disabled_layout = QtGui.QVBoxLayout(disabled_widget)
|
||||
disabled_layout.setMargin(0)
|
||||
disabled_layout.setObjectName(prefix + u'DisabledLayout')
|
||||
disabled_layout.setObjectName(prefix + u'_disabled_layout')
|
||||
disabled_label = QtGui.QLabel(disabled_widget)
|
||||
disabled_label.setWordWrap(True)
|
||||
disabled_label.setObjectName(prefix + u'DisabledLabel')
|
||||
disabled_label.setObjectName(prefix + u'_disabled_label')
|
||||
disabled_layout.addWidget(disabled_label)
|
||||
disabled_layout.addSpacerItem(self.stack_spacer)
|
||||
layout.addWidget(disabled_widget)
|
||||
import_widget = QtGui.QWidget(page)
|
||||
import_widget.setObjectName(prefix + u'ImportWidget')
|
||||
import_widget.setObjectName(prefix + u'_import_widget')
|
||||
layout.addWidget(import_widget)
|
||||
self.format_widgets[this_format][u'layout'] = layout
|
||||
self.format_widgets[this_format][u'disabled_widget'] = disabled_widget
|
||||
|
|
|
@ -57,7 +57,7 @@ class Ui_SongMaintenanceDialog(object):
|
|||
self.authorsPage = QtGui.QWidget(songMaintenanceDialog)
|
||||
self.authorsPage.setObjectName(u'authorsPage')
|
||||
self.authorsLayout = QtGui.QVBoxLayout(self.authorsPage)
|
||||
self.authorsLayout.setObjectName(u'authorsLayout')
|
||||
self.authorsLayout.setObjectName(u'authors_layout')
|
||||
self.authorsListWidget = QtGui.QListWidget(self.authorsPage)
|
||||
self.authorsListWidget.setObjectName(u'authorsListWidget')
|
||||
self.authorsLayout.addWidget(self.authorsListWidget)
|
||||
|
@ -82,7 +82,7 @@ class Ui_SongMaintenanceDialog(object):
|
|||
self.topicsPage = QtGui.QWidget(songMaintenanceDialog)
|
||||
self.topicsPage.setObjectName(u'topicsPage')
|
||||
self.topicsLayout = QtGui.QVBoxLayout(self.topicsPage)
|
||||
self.topicsLayout.setObjectName(u'topicsLayout')
|
||||
self.topicsLayout.setObjectName(u'topics_layout')
|
||||
self.topicsListWidget = QtGui.QListWidget(self.topicsPage)
|
||||
self.topicsListWidget.setObjectName(u'topicsListWidget')
|
||||
self.topicsLayout.addWidget(self.topicsListWidget)
|
||||
|
|
|
@ -33,7 +33,9 @@ from sqlalchemy.sql import and_
|
|||
|
||||
from openlp.core.lib import Registry, UiStrings, translate
|
||||
from openlp.core.lib.ui import critical_error_message_box
|
||||
from openlp.plugins.songs.forms import AuthorsForm, TopicsForm, SongBookForm
|
||||
from openlp.plugins.songs.forms.authorsform import AuthorsForm
|
||||
from openlp.plugins.songs.forms.topicsform import TopicsForm
|
||||
from openlp.plugins.songs.forms.songbookform import SongBookForm
|
||||
from openlp.plugins.songs.lib.db import Author, Book, Topic, Song
|
||||
from songmaintenancedialog import Ui_SongMaintenanceDialog
|
||||
|
||||
|
@ -206,12 +208,13 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
|
|||
"""
|
||||
Add an author to the list.
|
||||
"""
|
||||
self.authorform.setAutoDisplayName(True)
|
||||
self.authorform.auto_display_name = True
|
||||
if self.authorform.exec_():
|
||||
author = Author.populate(
|
||||
first_name=self.authorform.firstNameEdit.text(),
|
||||
last_name=self.authorform.lastNameEdit.text(),
|
||||
display_name=self.authorform.displayEdit.text())
|
||||
first_name=self.authorform.first_name,
|
||||
last_name=self.authorform.last_name,
|
||||
display_name=self.authorform.display_name
|
||||
)
|
||||
if self.checkAuthor(author):
|
||||
if self.manager.save_object(author):
|
||||
self.resetAuthors()
|
||||
|
@ -263,19 +266,19 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
|
|||
if author_id == -1:
|
||||
return
|
||||
author = self.manager.get_object(Author, author_id)
|
||||
self.authorform.setAutoDisplayName(False)
|
||||
self.authorform.firstNameEdit.setText(author.first_name)
|
||||
self.authorform.lastNameEdit.setText(author.last_name)
|
||||
self.authorform.displayEdit.setText(author.display_name)
|
||||
self.authorform.auto_display_name = False
|
||||
self.authorform.first_name_edit.setText(author.first_name)
|
||||
self.authorform.last_name_edit.setText(author.last_name)
|
||||
self.authorform.display_edit.setText(author.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.
|
||||
temp_first_name = author.first_name
|
||||
temp_last_name = author.last_name
|
||||
temp_display_name = author.display_name
|
||||
if self.authorform.exec_(False):
|
||||
author.first_name = self.authorform.firstNameEdit.text()
|
||||
author.last_name = self.authorform.lastNameEdit.text()
|
||||
author.display_name = self.authorform.displayEdit.text()
|
||||
author.first_name = self.authorform.first_name_edit.text()
|
||||
author.last_name = self.authorform.last_name_edit.text()
|
||||
author.display_name = self.authorform.display_edit.text()
|
||||
if self.checkAuthor(author, True):
|
||||
if self.manager.save_object(author):
|
||||
self.resetAuthors()
|
||||
|
|
|
@ -26,6 +26,9 @@
|
|||
# with this program; if not, write to the Free Software Foundation, Inc., 59 #
|
||||
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
||||
###############################################################################
|
||||
"""
|
||||
The :mod:`~openlp.plugins.songs.lib` module contains a number of library functions and classes used in the Songs plugin.
|
||||
"""
|
||||
import re
|
||||
|
||||
from PyQt4 import QtGui
|
||||
|
@ -182,8 +185,10 @@ class VerseType(object):
|
|||
for num, tag in enumerate(VerseType.tags):
|
||||
if verse_tag == tag:
|
||||
return VerseType.translated_tags[num].upper()
|
||||
if default in VerseType.translated_tags:
|
||||
if len(VerseType.names) > default:
|
||||
return VerseType.translated_tags[default].upper()
|
||||
else:
|
||||
return VerseType.translated_tags[VerseType.Other].upper()
|
||||
|
||||
@staticmethod
|
||||
def translated_name(verse_tag, default=Other):
|
||||
|
@ -200,8 +205,10 @@ class VerseType(object):
|
|||
for num, tag in enumerate(VerseType.tags):
|
||||
if verse_tag == tag:
|
||||
return VerseType.translated_names[num]
|
||||
if default in VerseType.translated_names:
|
||||
if len(VerseType.names) > default:
|
||||
return VerseType.translated_names[default]
|
||||
else:
|
||||
return VerseType.translated_names[VerseType.Other]
|
||||
|
||||
@staticmethod
|
||||
def from_tag(verse_tag, default=Other):
|
||||
|
@ -218,7 +225,10 @@ class VerseType(object):
|
|||
for num, tag in enumerate(VerseType.tags):
|
||||
if verse_tag == tag:
|
||||
return num
|
||||
return default
|
||||
if len(VerseType.names) > default:
|
||||
return default
|
||||
else:
|
||||
return VerseType.Other
|
||||
|
||||
@staticmethod
|
||||
def from_translated_tag(verse_tag, default=Other):
|
||||
|
@ -235,7 +245,10 @@ class VerseType(object):
|
|||
for num, tag in enumerate(VerseType.translated_tags):
|
||||
if verse_tag == tag:
|
||||
return num
|
||||
return default
|
||||
if len(VerseType.names) > default:
|
||||
return default
|
||||
else:
|
||||
return VerseType.Other
|
||||
|
||||
@staticmethod
|
||||
def from_string(verse_name, default=Other):
|
||||
|
@ -611,7 +624,3 @@ def natcmp(a, b):
|
|||
if result != 0:
|
||||
return result
|
||||
return 1
|
||||
|
||||
from xml import OpenLyrics, SongXML
|
||||
from songstab import SongsTab
|
||||
from mediaitem import SongMediaItem
|
||||
|
|
|
@ -39,10 +39,14 @@ from openlp.core.lib import Registry, MediaManagerItem, ItemCapabilities, Plugin
|
|||
UiStrings, translate, check_item_selected, create_separated_list, check_directory_exists
|
||||
from openlp.core.lib.ui import create_widget_action
|
||||
from openlp.core.utils import AppLocation
|
||||
from openlp.plugins.songs.forms import EditSongForm, SongMaintenanceForm, SongImportForm, SongExportForm
|
||||
from openlp.plugins.songs.lib import OpenLyrics, SongXML, VerseType, clean_string, natcmp
|
||||
from openlp.plugins.songs.forms.editsongform import EditSongForm
|
||||
from openlp.plugins.songs.forms.songmaintenanceform import SongMaintenanceForm
|
||||
from openlp.plugins.songs.forms.songimportform import SongImportForm
|
||||
from openlp.plugins.songs.forms.songexportform import SongExportForm
|
||||
from openlp.plugins.songs.lib import VerseType, clean_string, natcmp
|
||||
from openlp.plugins.songs.lib.db import Author, Song, Book, MediaFile
|
||||
from openlp.plugins.songs.lib.ui import SongStrings
|
||||
from openlp.plugins.songs.lib.xml import OpenLyrics, SongXML
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
@ -302,7 +306,7 @@ class SongMediaItem(MediaManagerItem):
|
|||
|
||||
def onNewClick(self):
|
||||
log.debug(u'onNewClick')
|
||||
self.editSongForm.newSong()
|
||||
self.editSongForm.new_song()
|
||||
self.editSongForm.exec_()
|
||||
self.onClearTextButtonClick()
|
||||
self.onSelectionChange()
|
||||
|
@ -321,7 +325,7 @@ class SongMediaItem(MediaManagerItem):
|
|||
song_id = int(song_id)
|
||||
valid = self.plugin.manager.get_object(Song, song_id)
|
||||
if valid:
|
||||
self.editSongForm.loadSong(song_id, preview)
|
||||
self.editSongForm.load_song(song_id, preview)
|
||||
if self.editSongForm.exec_() == QtGui.QDialog.Accepted:
|
||||
self.autoSelectId = -1
|
||||
self.on_song_list_load()
|
||||
|
@ -342,7 +346,7 @@ class SongMediaItem(MediaManagerItem):
|
|||
if check_item_selected(self.listView, UiStrings().SelectEdit):
|
||||
self.editItem = self.listView.currentItem()
|
||||
item_id = self.editItem.data(QtCore.Qt.UserRole)
|
||||
self.editSongForm.loadSong(item_id, False)
|
||||
self.editSongForm.load_song(item_id, False)
|
||||
self.editSongForm.exec_()
|
||||
self.autoSelectId = -1
|
||||
self.on_song_list_load()
|
||||
|
|
|
@ -37,10 +37,11 @@ from lxml import etree
|
|||
|
||||
from openlp.core.lib import Registry, check_directory_exists, translate
|
||||
from openlp.core.utils import clean_filename
|
||||
from openlp.plugins.songs.lib import OpenLyrics
|
||||
from openlp.plugins.songs.lib.xml import OpenLyrics
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class OpenLyricsExport(object):
|
||||
"""
|
||||
This provides the Openlyrics export.
|
||||
|
|
|
@ -39,11 +39,11 @@ from lxml import etree
|
|||
from openlp.core.ui.wizard import WizardStrings
|
||||
from openlp.plugins.songs.lib.songimport import SongImport
|
||||
from openlp.plugins.songs.lib.ui import SongStrings
|
||||
from openlp.plugins.songs.lib import OpenLyrics
|
||||
from openlp.plugins.songs.lib.xml import OpenLyricsError
|
||||
from openlp.plugins.songs.lib.xml import OpenLyrics, OpenLyricsError
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class OpenLyricsImport(SongImport):
|
||||
"""
|
||||
This provides the Openlyrics import.
|
||||
|
|
|
@ -43,11 +43,13 @@ from openlp.core.lib.db import Manager
|
|||
from openlp.core.lib.ui import create_action
|
||||
from openlp.core.utils import get_filesystem_encoding
|
||||
from openlp.core.utils.actions import ActionList
|
||||
from openlp.plugins.songs.lib import clean_song, upgrade, SongMediaItem, SongsTab
|
||||
from openlp.plugins.songs.lib import clean_song, upgrade
|
||||
from openlp.plugins.songs.lib.db import init_schema, Song
|
||||
from openlp.plugins.songs.lib.mediaitem import SongSearch
|
||||
from openlp.plugins.songs.lib.importer import SongFormat
|
||||
from openlp.plugins.songs.lib.olpimport import OpenLPSongImport
|
||||
from openlp.plugins.songs.lib.mediaitem import SongMediaItem
|
||||
from openlp.plugins.songs.lib.songstab import SongsTab
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
__default_settings__ = {
|
||||
|
|
|
@ -23,11 +23,17 @@ class TestScreenList(TestCase):
|
|||
"""
|
||||
Set up the components need for all tests.
|
||||
"""
|
||||
# Mocked out desktop object
|
||||
self.desktop = MagicMock()
|
||||
self.desktop.primaryScreen.return_value = SCREEN[u'primary']
|
||||
self.desktop.screenCount.return_value = SCREEN[u'number']
|
||||
self.desktop.screenGeometry.return_value = SCREEN[u'size']
|
||||
|
||||
self.application = QtGui.QApplication.instance()
|
||||
Registry.create()
|
||||
self.application.setOrganizationName(u'OpenLP-tests')
|
||||
self.application.setOrganizationDomain(u'openlp.org')
|
||||
self.screens = ScreenList.create(self.application.desktop())
|
||||
self.screens = ScreenList.create(self.desktop)
|
||||
|
||||
def tearDown(self):
|
||||
"""
|
||||
|
@ -38,21 +44,16 @@ class TestScreenList(TestCase):
|
|||
|
||||
def add_desktop_test(self):
|
||||
"""
|
||||
Test the ScreenList class' - screen_count_changed method to check if new monitors are detected by OpenLP.
|
||||
Test the ScreenList.screen_count_changed method to check if new monitors are detected by OpenLP.
|
||||
"""
|
||||
# GIVEN: The screen list.
|
||||
old_screens = copy.deepcopy(self.screens.screen_list)
|
||||
# Mock the attributes.
|
||||
self.screens.desktop.primaryScreen = MagicMock(return_value=SCREEN[u'primary'])
|
||||
self.screens.desktop.screenCount = MagicMock(return_value=SCREEN[u'number'] + 1)
|
||||
self.screens.desktop.screenGeometry = MagicMock(return_value=SCREEN[u'size'])
|
||||
# GIVEN: The screen list at its current size
|
||||
old_screen_count = len(self.screens.screen_list)
|
||||
|
||||
# WHEN: Add a new screen.
|
||||
self.screens.screen_count_changed(len(old_screens))
|
||||
# WHEN: We add a new screen
|
||||
self.desktop.screenCount.return_value = SCREEN[u'number'] + 1
|
||||
self.screens.screen_count_changed(old_screen_count)
|
||||
|
||||
# THEN: The screen should have been added.
|
||||
new_screens = self.screens.screen_list
|
||||
assert len(old_screens) + 1 == len(new_screens), u'The new_screens list should be bigger.'
|
||||
|
||||
# THEN: The screens should be identical.
|
||||
assert SCREEN == new_screens.pop(), u'The new screen should be identical to the screen defined above.'
|
||||
# THEN: The screen should have been added and the screens should be identical
|
||||
new_screen_count = len(self.screens.screen_list)
|
||||
assert old_screen_count + 1 == new_screen_count, u'The new_screens list should be bigger'
|
||||
assert SCREEN == self.screens.screen_list.pop(), u'The 2nd screen should be identical to the first screen'
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
__author__ = 'raoul'
|
|
@ -0,0 +1 @@
|
|||
__author__ = 'raoul'
|
|
@ -0,0 +1,226 @@
|
|||
"""
|
||||
This module contains tests for the lib submodule of the Songs plugin.
|
||||
"""
|
||||
|
||||
from unittest import TestCase
|
||||
|
||||
from mock import patch
|
||||
|
||||
from openlp.plugins.songs.lib import VerseType, clean_string, clean_title
|
||||
|
||||
|
||||
class TestLib(TestCase):
|
||||
"""
|
||||
Test the functions in the :mod:`lib` module.
|
||||
"""
|
||||
def clean_string_test(self):
|
||||
"""
|
||||
Test the clean_string() function
|
||||
"""
|
||||
# GIVEN: A "dirty" string
|
||||
dirty_string = u'Ain\'t gonna find\t you there.'
|
||||
|
||||
# WHEN: We run the string through the function
|
||||
result = clean_string(dirty_string)
|
||||
|
||||
# THEN: The string should be cleaned up and lower-cased
|
||||
self.assertEqual(result, u'aint gonna find you there ', u'The string should be cleaned up properly')
|
||||
|
||||
def clean_title_test(self):
|
||||
"""
|
||||
Test the clean_title() function
|
||||
"""
|
||||
# GIVEN: A "dirty" string
|
||||
dirty_string = u'This\u0000 is a\u0014 dirty \u007Fstring\u009F'
|
||||
|
||||
# WHEN: We run the string through the function
|
||||
result = clean_title(dirty_string)
|
||||
|
||||
# THEN: The string should be cleaned up
|
||||
self.assertEqual(result, u'This is a dirty string', u'The title should be cleaned up properly: "%s"' % result)
|
||||
|
||||
|
||||
class TestVerseType(TestCase):
|
||||
"""
|
||||
This is a test case to test various methods in the VerseType enumeration class.
|
||||
"""
|
||||
|
||||
def translated_tag_test(self):
|
||||
"""
|
||||
Test that the translated_tag() method returns the correct tags
|
||||
"""
|
||||
# GIVEN: A mocked out translate() function that just returns what it was given
|
||||
with patch(u'openlp.plugins.songs.lib.translate') as mocked_translate:
|
||||
mocked_translate.side_effect = lambda x, y: y
|
||||
|
||||
# WHEN: We run the translated_tag() method with a "verse"
|
||||
result = VerseType.translated_tag(u'v')
|
||||
|
||||
# THEN: The result should be "V"
|
||||
self.assertEqual(result, u'V', u'The result should be "V"')
|
||||
|
||||
# WHEN: We run the translated_tag() method with a "chorus"
|
||||
result = VerseType.translated_tag(u'c')
|
||||
|
||||
# THEN: The result should be "C"
|
||||
self.assertEqual(result, u'C', u'The result should be "C"')
|
||||
|
||||
def translated_invalid_tag_test(self):
|
||||
"""
|
||||
Test that the translated_tag() method returns the default tag when passed an invalid tag
|
||||
"""
|
||||
# GIVEN: A mocked out translate() function that just returns what it was given
|
||||
with patch(u'openlp.plugins.songs.lib.translate') as mocked_translate:
|
||||
mocked_translate.side_effect = lambda x, y: y
|
||||
|
||||
# WHEN: We run the translated_tag() method with an invalid verse type
|
||||
result = VerseType.translated_tag(u'z')
|
||||
|
||||
# THEN: The result should be "O"
|
||||
self.assertEqual(result, u'O', u'The result should be "O", but was "%s"' % result)
|
||||
|
||||
def translated_invalid_tag_with_specified_default_test(self):
|
||||
"""
|
||||
Test that the translated_tag() method returns the specified default tag when passed an invalid tag
|
||||
"""
|
||||
# GIVEN: A mocked out translate() function that just returns what it was given
|
||||
with patch(u'openlp.plugins.songs.lib.translate') as mocked_translate:
|
||||
mocked_translate.side_effect = lambda x, y: y
|
||||
|
||||
# WHEN: We run the translated_tag() method with an invalid verse type and specify a default
|
||||
result = VerseType.translated_tag(u'q', VerseType.Bridge)
|
||||
|
||||
# THEN: The result should be "B"
|
||||
self.assertEqual(result, u'B', u'The result should be "B", but was "%s"' % result)
|
||||
|
||||
def translated_invalid_tag_with_invalid_default_test(self):
|
||||
"""
|
||||
Test that the translated_tag() method returns a sane default tag when passed an invalid default
|
||||
"""
|
||||
# GIVEN: A mocked out translate() function that just returns what it was given
|
||||
with patch(u'openlp.plugins.songs.lib.translate') as mocked_translate:
|
||||
mocked_translate.side_effect = lambda x, y: y
|
||||
|
||||
# WHEN: We run the translated_tag() method with an invalid verse type and an invalid default
|
||||
result = VerseType.translated_tag(u'q', 29)
|
||||
|
||||
# THEN: The result should be "O"
|
||||
self.assertEqual(result, u'O', u'The result should be "O", but was "%s"' % result)
|
||||
|
||||
def translated_name_test(self):
|
||||
"""
|
||||
Test that the translated_name() method returns the correct name
|
||||
"""
|
||||
# GIVEN: A mocked out translate() function that just returns what it was given
|
||||
with patch(u'openlp.plugins.songs.lib.translate') as mocked_translate:
|
||||
mocked_translate.side_effect = lambda x, y: y
|
||||
|
||||
# WHEN: We run the translated_name() method with a "verse"
|
||||
result = VerseType.translated_name(u'v')
|
||||
|
||||
# THEN: The result should be "Verse"
|
||||
self.assertEqual(result, u'Verse', u'The result should be "Verse"')
|
||||
|
||||
# WHEN: We run the translated_name() method with a "chorus"
|
||||
result = VerseType.translated_name(u'c')
|
||||
|
||||
# THEN: The result should be "Chorus"
|
||||
self.assertEqual(result, u'Chorus', u'The result should be "Chorus"')
|
||||
|
||||
def translated_invalid_name_test(self):
|
||||
"""
|
||||
Test that the translated_name() method returns the default name when passed an invalid tag
|
||||
"""
|
||||
# GIVEN: A mocked out translate() function that just returns what it was given
|
||||
with patch(u'openlp.plugins.songs.lib.translate') as mocked_translate:
|
||||
mocked_translate.side_effect = lambda x, y: y
|
||||
|
||||
# WHEN: We run the translated_name() method with an invalid verse type
|
||||
result = VerseType.translated_name(u'z')
|
||||
|
||||
# THEN: The result should be "Other"
|
||||
self.assertEqual(result, u'Other', u'The result should be "Other", but was "%s"' % result)
|
||||
|
||||
def translated_invalid_name_with_specified_default_test(self):
|
||||
"""
|
||||
Test that the translated_name() method returns the specified default name when passed an invalid tag
|
||||
"""
|
||||
# GIVEN: A mocked out translate() function that just returns what it was given
|
||||
with patch(u'openlp.plugins.songs.lib.translate') as mocked_translate:
|
||||
mocked_translate.side_effect = lambda x, y: y
|
||||
|
||||
# WHEN: We run the translated_name() method with an invalid verse type and specify a default
|
||||
result = VerseType.translated_name(u'q', VerseType.Bridge)
|
||||
|
||||
# THEN: The result should be "Bridge"
|
||||
self.assertEqual(result, u'Bridge', u'The result should be "Bridge", but was "%s"' % result)
|
||||
|
||||
def translated_invalid_name_with_invalid_default_test(self):
|
||||
"""
|
||||
Test that the translated_name() method returns the specified default tag when passed an invalid tag
|
||||
"""
|
||||
# GIVEN: A mocked out translate() function that just returns what it was given
|
||||
with patch(u'openlp.plugins.songs.lib.translate') as mocked_translate:
|
||||
mocked_translate.side_effect = lambda x, y: y
|
||||
|
||||
# WHEN: We run the translated_name() method with an invalid verse type and specify an invalid default
|
||||
result = VerseType.translated_name(u'q', 29)
|
||||
|
||||
# THEN: The result should be "Other"
|
||||
self.assertEqual(result, u'Other', u'The result should be "Other", but was "%s"' % result)
|
||||
|
||||
def from_tag_test(self):
|
||||
"""
|
||||
Test that the from_tag() method returns the correct VerseType.
|
||||
"""
|
||||
# GIVEN: A mocked out translate() function that just returns what it was given
|
||||
with patch(u'openlp.plugins.songs.lib.translate') as mocked_translate:
|
||||
mocked_translate.side_effect = lambda x, y: y
|
||||
|
||||
# WHEN: We run the from_tag() method with a valid verse type, we get the name back
|
||||
result = VerseType.from_tag(u'v')
|
||||
|
||||
# THEN: The result should be VerseType.Verse
|
||||
self.assertEqual(result, VerseType.Verse, u'The result should be VerseType.Verse, but was "%s"' % result)
|
||||
|
||||
def from_tag_with_invalid_tag_test(self):
|
||||
"""
|
||||
Test that the from_tag() method returns the default VerseType when it is passed an invalid tag.
|
||||
"""
|
||||
# GIVEN: A mocked out translate() function that just returns what it was given
|
||||
with patch(u'openlp.plugins.songs.lib.translate') as mocked_translate:
|
||||
mocked_translate.side_effect = lambda x, y: y
|
||||
|
||||
# WHEN: We run the from_tag() method with a valid verse type, we get the name back
|
||||
result = VerseType.from_tag(u'w')
|
||||
|
||||
# THEN: The result should be VerseType.Other
|
||||
self.assertEqual(result, VerseType.Other, u'The result should be VerseType.Other, but was "%s"' % result)
|
||||
|
||||
def from_tag_with_specified_default_test(self):
|
||||
"""
|
||||
Test that the from_tag() method returns the specified default when passed an invalid tag.
|
||||
"""
|
||||
# GIVEN: A mocked out translate() function that just returns what it was given
|
||||
with patch(u'openlp.plugins.songs.lib.translate') as mocked_translate:
|
||||
mocked_translate.side_effect = lambda x, y: y
|
||||
|
||||
# WHEN: We run the from_tag() method with an invalid verse type, we get the specified default back
|
||||
result = VerseType.from_tag(u'x', VerseType.Chorus)
|
||||
|
||||
# THEN: The result should be VerseType.Chorus
|
||||
self.assertEqual(result, VerseType.Chorus, u'The result should be VerseType.Chorus, but was "%s"' % result)
|
||||
|
||||
def from_tag_with_invalid_default_test(self):
|
||||
"""
|
||||
Test that the from_tag() method returns a sane default when passed an invalid tag and an invalid default.
|
||||
"""
|
||||
# GIVEN: A mocked out translate() function that just returns what it was given
|
||||
with patch(u'openlp.plugins.songs.lib.translate') as mocked_translate:
|
||||
mocked_translate.side_effect = lambda x, y: y
|
||||
|
||||
# WHEN: We run the from_tag() method with an invalid verse type, we get the specified default back
|
||||
result = VerseType.from_tag(u'm', 29)
|
||||
|
||||
# THEN: The result should be VerseType.Other
|
||||
self.assertEqual(result, VerseType.Other, u'The result should be VerseType.Other, but was "%s"' % result)
|
|
@ -9,5 +9,5 @@ sip.setapi(u'QVariant', 2)
|
|||
|
||||
from PyQt4 import QtGui
|
||||
|
||||
# Only one QApplication can be created. Use QtGui.QApplication.instance() when you need to "create" a QApplication.
|
||||
# Only one QApplication can be created. Use QtGui.QApplication.instance() when you need to "create" an QApplication.
|
||||
application = QtGui.QApplication([])
|
||||
|
|
|
@ -3,7 +3,8 @@ Package to test the openlp.core.lib.pluginmanager package.
|
|||
"""
|
||||
import os
|
||||
import sys
|
||||
from tempfile import mkstemp
|
||||
import shutil
|
||||
from tempfile import mkstemp, mkdtemp
|
||||
from unittest import TestCase
|
||||
|
||||
from mock import MagicMock
|
||||
|
@ -23,7 +24,9 @@ class TestPluginManager(TestCase):
|
|||
Some pre-test setup required.
|
||||
"""
|
||||
fd, self.ini_file = mkstemp(u'.ini')
|
||||
self.temp_dir = mkdtemp(u'openlp')
|
||||
Settings().set_filename(self.ini_file)
|
||||
Settings().setValue(u'advanced/data path', self.temp_dir)
|
||||
Registry.create()
|
||||
Registry().register(u'service_list', MagicMock())
|
||||
self.app = QtGui.QApplication.instance()
|
||||
|
@ -31,9 +34,11 @@ class TestPluginManager(TestCase):
|
|||
Registry().register(u'main_window', self.main_window)
|
||||
|
||||
def tearDown(self):
|
||||
os.unlink(self.ini_file)
|
||||
del self.app
|
||||
del self.main_window
|
||||
Settings().remove(u'advanced/data path')
|
||||
shutil.rmtree(self.temp_dir)
|
||||
os.unlink(self.ini_file)
|
||||
|
||||
def find_plugins_test(self):
|
||||
"""
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
"""
|
||||
Package to test the openlp.core.ui package.
|
||||
Package to test the openlp.core.ui package.
|
||||
"""
|
||||
from unittest import TestCase
|
||||
from mock import patch
|
||||
|
@ -10,6 +10,7 @@ from openlp.core.lib import Registry
|
|||
from openlp.core.ui import servicenoteform
|
||||
|
||||
|
||||
|
||||
class TestStartNoteDialog(TestCase):
|
||||
|
||||
def setUp(self):
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
"""
|
||||
Package to test the openlp.core.ui package.
|
||||
Package to test the openlp.core.ui package.
|
||||
"""
|
||||
from unittest import TestCase
|
||||
from mock import MagicMock, patch
|
||||
|
@ -10,6 +10,7 @@ from openlp.core.lib import Registry
|
|||
from openlp.core.ui import starttimeform
|
||||
|
||||
|
||||
|
||||
class TestStartTimeDialog(TestCase):
|
||||
|
||||
def setUp(self):
|
||||
|
|
|
@ -0,0 +1,117 @@
|
|||
"""
|
||||
Package to test the openlp.plugins.songs.forms.authorsform package.
|
||||
"""
|
||||
from unittest import TestCase
|
||||
|
||||
from PyQt4 import QtGui
|
||||
|
||||
from openlp.core.lib import Registry
|
||||
from openlp.plugins.songs.forms.authorsform import AuthorsForm
|
||||
|
||||
|
||||
class TestAuthorsForm(TestCase):
|
||||
|
||||
def setUp(self):
|
||||
"""
|
||||
Create the UI
|
||||
"""
|
||||
Registry.create()
|
||||
self.app = QtGui.QApplication.instance()
|
||||
self.main_window = QtGui.QMainWindow()
|
||||
Registry().register(u'main_window', self.main_window)
|
||||
self.form = AuthorsForm()
|
||||
|
||||
def tearDown(self):
|
||||
"""
|
||||
Delete all the C++ objects at the end so that we don't have a segfault
|
||||
"""
|
||||
del self.form
|
||||
del self.main_window
|
||||
del self.app
|
||||
|
||||
def ui_defaults_test(self):
|
||||
"""
|
||||
Test the AuthorForm defaults are correct
|
||||
"""
|
||||
self.assertEqual(self.form.first_name_edit.text(), u'', u'The first name edit should be empty')
|
||||
self.assertEqual(self.form.last_name_edit.text(), u'', u'The last name edit should be empty')
|
||||
self.assertEqual(self.form.display_edit.text(), u'', u'The display name edit should be empty')
|
||||
|
||||
def get_first_name_property_test(self):
|
||||
"""
|
||||
Test that getting the first name property on the AuthorForm works correctly.
|
||||
"""
|
||||
# GIVEN: A first name to set
|
||||
first_name = u'John'
|
||||
|
||||
# WHEN: The first_name_edit's text is set
|
||||
self.form.first_name_edit.setText(first_name)
|
||||
|
||||
# THEN: The first_name property should have the correct value
|
||||
self.assertEqual(self.form.first_name, first_name, u'The first name property should be correct')
|
||||
|
||||
def set_first_name_property_test(self):
|
||||
"""
|
||||
Test that setting the first name property on the AuthorForm works correctly.
|
||||
"""
|
||||
# GIVEN: A first name to set
|
||||
first_name = u'James'
|
||||
|
||||
# WHEN: The first_name property is set
|
||||
self.form.first_name = first_name
|
||||
|
||||
# THEN: The first_name_edit should have the correct value
|
||||
self.assertEqual(self.form.first_name_edit.text(), first_name, u'The first name should be set correctly')
|
||||
|
||||
def get_last_name_property_test(self):
|
||||
"""
|
||||
Test that getting the last name property on the AuthorForm works correctly.
|
||||
"""
|
||||
# GIVEN: A last name to set
|
||||
last_name = u'Smith'
|
||||
|
||||
# WHEN: The last_name_edit's text is set
|
||||
self.form.last_name_edit.setText(last_name)
|
||||
|
||||
# THEN: The last_name property should have the correct value
|
||||
self.assertEqual(self.form.last_name, last_name, u'The last name property should be correct')
|
||||
|
||||
def set_last_name_property_test(self):
|
||||
"""
|
||||
Test that setting the last name property on the AuthorForm works correctly.
|
||||
"""
|
||||
# GIVEN: A last name to set
|
||||
last_name = u'Potter'
|
||||
|
||||
# WHEN: The last_name property is set
|
||||
self.form.last_name = last_name
|
||||
|
||||
# THEN: The last_name_edit should have the correct value
|
||||
self.assertEqual(self.form.last_name_edit.text(), last_name, u'The last name should be set correctly')
|
||||
|
||||
def get_display_name_property_test(self):
|
||||
"""
|
||||
Test that getting the display name property on the AuthorForm works correctly.
|
||||
"""
|
||||
# GIVEN: A display name to set
|
||||
display_name = u'John'
|
||||
|
||||
# WHEN: The display_name_edit's text is set
|
||||
self.form.display_edit.setText(display_name)
|
||||
|
||||
# THEN: The display_name property should have the correct value
|
||||
self.assertEqual(self.form.display_name, display_name, u'The display name property should be correct')
|
||||
|
||||
def set_display_name_property_test(self):
|
||||
"""
|
||||
Test that setting the display name property on the AuthorForm works correctly.
|
||||
"""
|
||||
# GIVEN: A display name to set
|
||||
display_name = u'John'
|
||||
|
||||
# WHEN: The display_name property is set
|
||||
self.form.display_name = display_name
|
||||
|
||||
# THEN: The display_name_edit should have the correct value
|
||||
self.assertEqual(self.form.display_edit.text(), display_name, u'The display name should be set correctly')
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
"""
|
||||
Package to test the openlp.plugins.songs.forms.editsongform package.
|
||||
"""
|
||||
from mock import MagicMock
|
||||
from unittest import TestCase
|
||||
|
||||
from PyQt4 import QtGui
|
||||
|
||||
from openlp.core.lib import Registry
|
||||
from openlp.plugins.songs.forms.editsongform import EditSongForm
|
||||
|
||||
|
||||
class TestEditSongForm(TestCase):
|
||||
def setUp(self):
|
||||
"""
|
||||
Create the UI
|
||||
"""
|
||||
Registry.create()
|
||||
self.app = QtGui.QApplication.instance()
|
||||
self.main_window = QtGui.QMainWindow()
|
||||
Registry().register(u'main_window', self.main_window)
|
||||
Registry().register(u'theme_manager', MagicMock())
|
||||
self.form = EditSongForm(MagicMock(), self.main_window, MagicMock())
|
||||
|
||||
def tearDown(self):
|
||||
"""
|
||||
Delete all the C++ objects at the end so that we don't have a segfault
|
||||
"""
|
||||
del self.form
|
||||
del self.main_window
|
||||
del self.app
|
||||
|
||||
def ui_defaults_test(self):
|
||||
"""
|
||||
Test that the EditSongForm defaults are correct
|
||||
"""
|
||||
self.assertFalse(self.form.verse_edit_button.isEnabled(), u'The verse edit button should not be enabled')
|
||||
self.assertFalse(self.form.verse_delete_button.isEnabled(), u'The verse delete button should not be enabled')
|
||||
self.assertFalse(self.form.author_remove_button.isEnabled(), u'The author remove button should not be enabled')
|
||||
self.assertFalse(self.form.topic_remove_button.isEnabled(), u'The topic remove button should not be enabled')
|
|
@ -0,0 +1,35 @@
|
|||
"""
|
||||
Package to test the openlp.plugins.songs.forms.editverseform package.
|
||||
"""
|
||||
from unittest import TestCase
|
||||
|
||||
from PyQt4 import QtGui
|
||||
|
||||
from openlp.core.lib import Registry
|
||||
from openlp.plugins.songs.forms.editverseform import EditVerseForm
|
||||
|
||||
|
||||
class TestEditVerseForm(TestCase):
|
||||
def setUp(self):
|
||||
"""
|
||||
Create the UI
|
||||
"""
|
||||
Registry.create()
|
||||
self.app = QtGui.QApplication.instance()
|
||||
self.main_window = QtGui.QMainWindow()
|
||||
Registry().register(u'main_window', self.main_window)
|
||||
self.form = EditVerseForm()
|
||||
|
||||
def tearDown(self):
|
||||
"""
|
||||
Delete all the C++ objects at the end so that we don't have a segfault
|
||||
"""
|
||||
del self.form
|
||||
del self.main_window
|
||||
del self.app
|
||||
|
||||
def ui_defaults_test(self):
|
||||
"""
|
||||
Test the EditVerseForm defaults are correct
|
||||
"""
|
||||
self.assertEqual(self.form.verseTextEdit.toPlainText(), u'', u'The verse edit box is empty.')
|
Loading…
Reference in New Issue