forked from openlp/openlp
Added optional descriptionLabel for song format to import wizard
This commit is contained in:
parent
837fc1c726
commit
cc90096534
|
@ -133,6 +133,9 @@ class SongImportForm(OpenLPWizard):
|
||||||
self.formatLayout.setItem(1, QtGui.QFormLayout.LabelRole,
|
self.formatLayout.setItem(1, QtGui.QFormLayout.LabelRole,
|
||||||
self.formatSpacer)
|
self.formatSpacer)
|
||||||
self.sourceLayout.addLayout(self.formatLayout)
|
self.sourceLayout.addLayout(self.formatLayout)
|
||||||
|
self.formatHSpacing = self.formatLayout.horizontalSpacing()
|
||||||
|
self.formatVSpacing = self.formatLayout.verticalSpacing()
|
||||||
|
self.formatLayout.setVerticalSpacing(0)
|
||||||
self.stackSpacer = QtGui.QSpacerItem(10, 0, QtGui.QSizePolicy.Fixed,
|
self.stackSpacer = QtGui.QSpacerItem(10, 0, QtGui.QSizePolicy.Fixed,
|
||||||
QtGui.QSizePolicy.Expanding)
|
QtGui.QSizePolicy.Expanding)
|
||||||
self.formatStack = QtGui.QStackedLayout()
|
self.formatStack = QtGui.QStackedLayout()
|
||||||
|
@ -160,12 +163,15 @@ class SongImportForm(OpenLPWizard):
|
||||||
self.sourcePage.setSubTitle(WizardStrings.ImportSelectLong)
|
self.sourcePage.setSubTitle(WizardStrings.ImportSelectLong)
|
||||||
self.formatLabel.setText(WizardStrings.FormatLabel)
|
self.formatLabel.setText(WizardStrings.FormatLabel)
|
||||||
for format in SongFormat.get_format_list():
|
for format in SongFormat.get_format_list():
|
||||||
format_name, custom_combo_text, select_mode = SongFormat.get(
|
format_name, custom_combo_text, description_text, select_mode = SongFormat.get(
|
||||||
format, SongFormat.Name, SongFormat.ComboBoxText,
|
format, SongFormat.Name, SongFormat.ComboBoxText, SongFormat.DescriptionText,
|
||||||
SongFormat.SelectMode)
|
SongFormat.SelectMode)
|
||||||
combo_box_text = custom_combo_text if custom_combo_text \
|
combo_box_text = custom_combo_text if custom_combo_text \
|
||||||
else format_name
|
else format_name
|
||||||
self.formatComboBox.setItemText(format, combo_box_text)
|
self.formatComboBox.setItemText(format, combo_box_text)
|
||||||
|
if description_text is not None:
|
||||||
|
self.formatWidgets[format][u'descriptionLabel'].setText(
|
||||||
|
description_text)
|
||||||
if select_mode == SongFormatSelect.MultipleFiles:
|
if select_mode == SongFormatSelect.MultipleFiles:
|
||||||
self.formatWidgets[format][u'addButton'].setText(
|
self.formatWidgets[format][u'addButton'].setText(
|
||||||
translate('SongsPlugin.ImportWizardForm', 'Add Files...'))
|
translate('SongsPlugin.ImportWizardForm', 'Add Files...'))
|
||||||
|
@ -206,6 +212,12 @@ class SongImportForm(OpenLPWizard):
|
||||||
spacer.changeSize(
|
spacer.changeSize(
|
||||||
max_label_width - labels[index].minimumSizeHint().width(), 0,
|
max_label_width - labels[index].minimumSizeHint().width(), 0,
|
||||||
QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
|
QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
|
||||||
|
# Align descriptionLabels with rest of layout
|
||||||
|
for format in SongFormat.get_format_list():
|
||||||
|
if SongFormat.get(format, SongFormat.DescriptionText) is not None:
|
||||||
|
self.formatWidgets[format][u'descriptionSpacer'].changeSize(
|
||||||
|
max_label_width + self.formatHSpacing, 0,
|
||||||
|
QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
|
||||||
|
|
||||||
def customPageChanged(self, pageId):
|
def customPageChanged(self, pageId):
|
||||||
"""
|
"""
|
||||||
|
@ -397,8 +409,9 @@ class SongImportForm(OpenLPWizard):
|
||||||
|
|
||||||
def addFileSelectItem(self):
|
def addFileSelectItem(self):
|
||||||
format = self.currentFormat
|
format = self.currentFormat
|
||||||
prefix, can_disable, select_mode = SongFormat.get(format,
|
prefix, can_disable, description_text, select_mode = SongFormat.get(
|
||||||
SongFormat.Prefix, SongFormat.CanDisable, SongFormat.SelectMode)
|
format, SongFormat.Prefix, SongFormat.CanDisable,
|
||||||
|
SongFormat.DescriptionText, SongFormat.SelectMode)
|
||||||
page = QtGui.QWidget()
|
page = QtGui.QWidget()
|
||||||
page.setObjectName(prefix + u'Page')
|
page.setObjectName(prefix + u'Page')
|
||||||
if can_disable:
|
if can_disable:
|
||||||
|
@ -408,10 +421,24 @@ class SongImportForm(OpenLPWizard):
|
||||||
importLayout = QtGui.QVBoxLayout(importWidget)
|
importLayout = QtGui.QVBoxLayout(importWidget)
|
||||||
importLayout.setMargin(0)
|
importLayout.setMargin(0)
|
||||||
importLayout.setObjectName(prefix + u'ImportLayout')
|
importLayout.setObjectName(prefix + u'ImportLayout')
|
||||||
|
if description_text is not None:
|
||||||
|
descriptionLayout = QtGui.QHBoxLayout()
|
||||||
|
descriptionLayout.setObjectName(prefix + u'DescriptionLayout')
|
||||||
|
descriptionSpacer = QtGui.QSpacerItem(0, 0, QtGui.QSizePolicy.Fixed,
|
||||||
|
QtGui.QSizePolicy.Fixed)
|
||||||
|
descriptionLayout.addSpacerItem(descriptionSpacer)
|
||||||
|
descriptionLabel = QtGui.QLabel(importWidget)
|
||||||
|
descriptionLabel.setWordWrap(True)
|
||||||
|
descriptionLabel.setObjectName(prefix + u'DescriptionLabel')
|
||||||
|
descriptionLayout.addWidget(descriptionLabel)
|
||||||
|
importLayout.addLayout(descriptionLayout)
|
||||||
|
self.formatWidgets[format][u'descriptionLabel'] = descriptionLabel
|
||||||
|
self.formatWidgets[format][u'descriptionSpacer'] = descriptionSpacer
|
||||||
if select_mode == SongFormatSelect.SingleFile or \
|
if select_mode == SongFormatSelect.SingleFile or \
|
||||||
select_mode == SongFormatSelect.SingleFolder:
|
select_mode == SongFormatSelect.SingleFolder:
|
||||||
filepathLayout = QtGui.QHBoxLayout()
|
filepathLayout = QtGui.QHBoxLayout()
|
||||||
filepathLayout.setObjectName(prefix + u'FilepathLayout')
|
filepathLayout.setObjectName(prefix + u'FilepathLayout')
|
||||||
|
filepathLayout.setContentsMargins(0, self.formatVSpacing, 0, 0)
|
||||||
filepathLabel = QtGui.QLabel(importWidget)
|
filepathLabel = QtGui.QLabel(importWidget)
|
||||||
filepathLabel.setObjectName(prefix + u'FilepathLabel')
|
filepathLabel.setObjectName(prefix + u'FilepathLabel')
|
||||||
filepathLayout.addWidget(filepathLabel)
|
filepathLayout.addWidget(filepathLabel)
|
||||||
|
|
|
@ -112,6 +112,8 @@ class SongFormat(object):
|
||||||
Title for ``QFileDialog`` (default includes the format's ``Name``).
|
Title for ``QFileDialog`` (default includes the format's ``Name``).
|
||||||
``InvalidSourceMsg``
|
``InvalidSourceMsg``
|
||||||
Message displayed if ``Class.isValidSource()`` returns ``False``.
|
Message displayed if ``Class.isValidSource()`` returns ``False``.
|
||||||
|
``DescriptionText``
|
||||||
|
Short description (1-2 lines) about the song format.
|
||||||
"""
|
"""
|
||||||
# Enumeration of song formats and their attributes
|
# Enumeration of song formats and their attributes
|
||||||
# * Numerical order of song formats is significant as it determines the
|
# * Numerical order of song formats is significant as it determines the
|
||||||
|
@ -154,6 +156,7 @@ class SongFormat(object):
|
||||||
DisabledLabelText = -31
|
DisabledLabelText = -31
|
||||||
GetFilesTitle = -32
|
GetFilesTitle = -32
|
||||||
InvalidSourceMsg = -33
|
InvalidSourceMsg = -33
|
||||||
|
DescriptionText = -34
|
||||||
|
|
||||||
# Set optional attribute defaults
|
# Set optional attribute defaults
|
||||||
_defaults = {
|
_defaults = {
|
||||||
|
@ -164,7 +167,8 @@ class SongFormat(object):
|
||||||
ComboBoxText: None,
|
ComboBoxText: None,
|
||||||
DisabledLabelText: u'',
|
DisabledLabelText: u'',
|
||||||
GetFilesTitle: None,
|
GetFilesTitle: None,
|
||||||
InvalidSourceMsg: None
|
InvalidSourceMsg: None,
|
||||||
|
DescriptionText: None
|
||||||
}
|
}
|
||||||
|
|
||||||
# Set attribute values for each Song Format
|
# Set attribute values for each Song Format
|
||||||
|
@ -293,7 +297,11 @@ class SongFormat(object):
|
||||||
Prefix: u'zionWorx',
|
Prefix: u'zionWorx',
|
||||||
SelectMode: SongFormatSelect.SingleFile,
|
SelectMode: SongFormatSelect.SingleFile,
|
||||||
ComboBoxText: translate('SongsPlugin.ImportWizardForm',
|
ComboBoxText: translate('SongsPlugin.ImportWizardForm',
|
||||||
'ZionWorx (CSV database dump)')
|
'ZionWorx (CSV)'),
|
||||||
|
DescriptionText: translate('SongsPlugin.ImportWizardForm',
|
||||||
|
'First dump your ZionWorx database to a CSV file, using '
|
||||||
|
'freeware tool "TurboDB Data Exchange" (TdbDataX) from dataWeb '
|
||||||
|
'(see the User Manual).')
|
||||||
# },
|
# },
|
||||||
# CSV: {
|
# CSV: {
|
||||||
# class_: CSVImport,
|
# class_: CSVImport,
|
||||||
|
|
Loading…
Reference in New Issue