forked from openlp/openlp
Removed obj_prefix (old code from r1055 and even < r990)
This commit is contained in:
parent
606da7ab76
commit
d9ed9aaa5c
@ -401,36 +401,34 @@ class SongImportForm(OpenLPWizard):
|
||||
|
||||
def addFileSelectItem(self):
|
||||
format = self.currentFormat
|
||||
prefix, obj_prefix, can_disable, select_mode = SongFormatAttr.get(
|
||||
format, SongFormatAttr.prefix, SongFormatAttr.obj_prefix,
|
||||
SongFormatAttr.can_disable, SongFormatAttr.select_mode)
|
||||
if not obj_prefix:
|
||||
obj_prefix = prefix
|
||||
prefix, can_disable, select_mode = SongFormatAttr.get(
|
||||
format, SongFormatAttr.prefix, SongFormatAttr.can_disable,
|
||||
SongFormatAttr.select_mode)
|
||||
page = QtGui.QWidget()
|
||||
page.setObjectName(obj_prefix + u'Page')
|
||||
page.setObjectName(prefix + u'Page')
|
||||
if can_disable:
|
||||
importWidget = self.disablableWidget(page, obj_prefix)
|
||||
importWidget = self.disablableWidget(page, prefix)
|
||||
else:
|
||||
importWidget = page
|
||||
importLayout = QtGui.QVBoxLayout(importWidget)
|
||||
importLayout.setMargin(0)
|
||||
importLayout.setObjectName(obj_prefix + u'ImportLayout')
|
||||
importLayout.setObjectName(prefix + u'ImportLayout')
|
||||
if select_mode == SongFormatSelect.SingleFile or \
|
||||
select_mode == SongFormatSelect.SingleFolder:
|
||||
filepathLayout = QtGui.QHBoxLayout()
|
||||
filepathLayout.setObjectName(obj_prefix + u'FilepathLayout')
|
||||
filepathLayout.setObjectName(prefix + u'FilepathLayout')
|
||||
filepathLabel = QtGui.QLabel(importWidget)
|
||||
filepathLabel.setObjectName(obj_prefix + u'FilepathLabel')
|
||||
filepathLabel.setObjectName(prefix + u'FilepathLabel')
|
||||
filepathLayout.addWidget(filepathLabel)
|
||||
filepathSpacer = QtGui.QSpacerItem(0, 0, QtGui.QSizePolicy.Fixed,
|
||||
QtGui.QSizePolicy.Fixed)
|
||||
filepathLayout.addSpacerItem(filepathSpacer)
|
||||
filepathEdit = QtGui.QLineEdit(importWidget)
|
||||
filepathEdit.setObjectName(obj_prefix + u'FilepathEdit')
|
||||
filepathEdit.setObjectName(prefix + u'FilepathEdit')
|
||||
filepathLayout.addWidget(filepathEdit)
|
||||
browseButton = QtGui.QToolButton(importWidget)
|
||||
browseButton.setIcon(self.openIcon)
|
||||
browseButton.setObjectName(obj_prefix + u'BrowseButton')
|
||||
browseButton.setObjectName(prefix + u'BrowseButton')
|
||||
filepathLayout.addWidget(browseButton)
|
||||
importLayout.addLayout(filepathLayout)
|
||||
importLayout.addSpacerItem(self.stackSpacer)
|
||||
@ -443,18 +441,18 @@ class SongImportForm(OpenLPWizard):
|
||||
fileListWidget = QtGui.QListWidget(importWidget)
|
||||
fileListWidget.setSelectionMode(
|
||||
QtGui.QAbstractItemView.ExtendedSelection)
|
||||
fileListWidget.setObjectName(obj_prefix + u'FileListWidget')
|
||||
fileListWidget.setObjectName(prefix + u'FileListWidget')
|
||||
importLayout.addWidget(fileListWidget)
|
||||
buttonLayout = QtGui.QHBoxLayout()
|
||||
buttonLayout.setObjectName(obj_prefix + u'ButtonLayout')
|
||||
buttonLayout.setObjectName(prefix + u'ButtonLayout')
|
||||
addButton = QtGui.QPushButton(importWidget)
|
||||
addButton.setIcon(self.openIcon)
|
||||
addButton.setObjectName(obj_prefix + u'AddButton')
|
||||
addButton.setObjectName(prefix + u'AddButton')
|
||||
buttonLayout.addWidget(addButton)
|
||||
buttonLayout.addStretch()
|
||||
removeButton = QtGui.QPushButton(importWidget)
|
||||
removeButton.setIcon(self.deleteIcon)
|
||||
removeButton.setObjectName(obj_prefix + u'RemoveButton')
|
||||
removeButton.setObjectName(prefix + u'RemoveButton')
|
||||
buttonLayout.addWidget(removeButton)
|
||||
importLayout.addLayout(buttonLayout)
|
||||
self.formatWidgets[format][u'fileListWidget'] = fileListWidget
|
||||
@ -466,27 +464,27 @@ class SongImportForm(OpenLPWizard):
|
||||
self.formatWidgets[format][u'importLayout'] = importLayout
|
||||
self.formatComboBox.addItem(u'')
|
||||
|
||||
def disablableWidget(self, page, obj_prefix):
|
||||
def disablableWidget(self, page, prefix):
|
||||
format = self.currentFormat
|
||||
self.disablableFormats.append(format)
|
||||
layout = QtGui.QVBoxLayout(page)
|
||||
layout.setMargin(0)
|
||||
layout.setSpacing(0)
|
||||
layout.setObjectName(obj_prefix + u'Layout')
|
||||
layout.setObjectName(prefix + u'Layout')
|
||||
disabledWidget = QtGui.QWidget(page)
|
||||
disabledWidget.setVisible(False)
|
||||
disabledWidget.setObjectName(obj_prefix + u'DisabledWidget')
|
||||
disabledWidget.setObjectName(prefix + u'DisabledWidget')
|
||||
disabledLayout = QtGui.QVBoxLayout(disabledWidget)
|
||||
disabledLayout.setMargin(0)
|
||||
disabledLayout.setObjectName(obj_prefix + u'DisabledLayout')
|
||||
disabledLayout.setObjectName(prefix + u'DisabledLayout')
|
||||
disabledLabel = QtGui.QLabel(disabledWidget)
|
||||
disabledLabel.setWordWrap(True)
|
||||
disabledLabel.setObjectName(obj_prefix + u'DisabledLabel')
|
||||
disabledLabel.setObjectName(prefix + u'DisabledLabel')
|
||||
disabledLayout.addWidget(disabledLabel)
|
||||
disabledLayout.addSpacerItem(self.stackSpacer)
|
||||
layout.addWidget(disabledWidget)
|
||||
importWidget = QtGui.QWidget(page)
|
||||
importWidget.setObjectName(obj_prefix + u'ImportWidget')
|
||||
importWidget.setObjectName(prefix + u'ImportWidget')
|
||||
layout.addWidget(importWidget)
|
||||
self.formatWidgets[format][u'layout'] = layout
|
||||
self.formatWidgets[format][u'disabledWidget'] = disabledWidget
|
||||
|
@ -133,8 +133,6 @@ class SongFormatAttr(object):
|
||||
See ``SongImportForm.addFileSelectItem()``.
|
||||
|
||||
Optional attributes for each song format:
|
||||
* ``obj_prefix`` Alternate prefix for objects.
|
||||
See ``SongImportForm.addFileSelectItem()``.
|
||||
* ``can_disable`` Whether song format is disablable.
|
||||
* ``availability`` Whether song format is available.
|
||||
* ``select_mode`` Whether format accepts single file, multiple files, or
|
||||
@ -154,11 +152,10 @@ class SongFormatAttr(object):
|
||||
name = 1
|
||||
prefix = 2
|
||||
# Optional attributes
|
||||
obj_prefix = 10
|
||||
can_disable = 11
|
||||
availability = 12
|
||||
select_mode = 13
|
||||
filter = 14
|
||||
can_disable = 10
|
||||
availability = 11
|
||||
select_mode = 12
|
||||
filter = 13
|
||||
# Optional/custom text values
|
||||
combo_box_text = 20
|
||||
disabled_label_text = 21
|
||||
@ -167,7 +164,6 @@ class SongFormatAttr(object):
|
||||
|
||||
# Set optional attribute defaults
|
||||
_defaults = {
|
||||
obj_prefix: None,
|
||||
can_disable: False,
|
||||
availability: True,
|
||||
select_mode: SongFormatSelect.MultipleFiles,
|
||||
@ -184,16 +180,10 @@ class SongFormatAttr(object):
|
||||
class_: OpenLyricsImport,
|
||||
name: u'OpenLyrics',
|
||||
prefix: u'openLyrics',
|
||||
obj_prefix: u'OpenLyrics',
|
||||
can_disable: True,
|
||||
filter: u'%s (*.xml)' % translate('SongsPlugin.ImportWizardForm',
|
||||
'OpenLyrics Files'),
|
||||
combo_box_text: translate('SongsPlugin.ImportWizardForm',
|
||||
'OpenLyrics or OpenLP 2.0 Exported Song'),
|
||||
disabled_label_text: translate('SongsPlugin.ImportWizardForm',
|
||||
'The OpenLyrics importer has not yet been developed, but as '
|
||||
'you can see, we are still intending to do so. Hopefully it '
|
||||
'will be in the next release.')
|
||||
'OpenLyrics or OpenLP 2.0 Exported Song')
|
||||
},
|
||||
SongFormat.OpenLP2: {
|
||||
class_: OpenLPSongImport,
|
||||
@ -263,8 +253,7 @@ class SongFormatAttr(object):
|
||||
SongFormat.OpenSong: {
|
||||
class_: OpenSongImport,
|
||||
name: WizardStrings.OS,
|
||||
prefix: u'openSong',
|
||||
obj_prefix: u'OpenSong'
|
||||
prefix: u'openSong'
|
||||
},
|
||||
SongFormat.PowerSong: {
|
||||
class_: PowerSongImport,
|
||||
@ -309,7 +298,6 @@ class SongFormatAttr(object):
|
||||
# class_: CSVImport,
|
||||
# name: WizardStrings.CSV,
|
||||
# prefix: u'csv',
|
||||
# obj_prefix: u'CSV',
|
||||
# select_mode: SongFormatSelect.SingleFile
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user