forked from openlp/openlp
Slim down song importer UI
This commit is contained in:
parent
6568bd5039
commit
0b36143ac2
@ -165,29 +165,29 @@ class SongImportForm(OpenLPWizard):
|
|||||||
self.formatStack = QtGui.QStackedLayout()
|
self.formatStack = QtGui.QStackedLayout()
|
||||||
self.formatStack.setObjectName(u'FormatStack')
|
self.formatStack.setObjectName(u'FormatStack')
|
||||||
# OpenLP 2.0
|
# OpenLP 2.0
|
||||||
self.addSingleFileSelectItem(u'openLP2')
|
self.addFileSelectItem(u'openLP2', single_select=True)
|
||||||
# openlp.org 1.x
|
# openlp.org 1.x
|
||||||
self.addSingleFileSelectItem(u'openLP1', None, True)
|
self.addFileSelectItem(u'openLP1', None, True, True)
|
||||||
# OpenLyrics
|
# OpenLyrics
|
||||||
self.addMultiFileSelectItem(u'openLyrics', u'OpenLyrics', True)
|
self.addFileSelectItem(u'openLyrics', u'OpenLyrics', True)
|
||||||
# Open Song
|
# Open Song
|
||||||
self.addMultiFileSelectItem(u'openSong', u'OpenSong')
|
self.addFileSelectItem(u'openSong', u'OpenSong')
|
||||||
# Words of Worship
|
# Words of Worship
|
||||||
self.addMultiFileSelectItem(u'wordsOfWorship')
|
self.addFileSelectItem(u'wordsOfWorship')
|
||||||
# CCLI File import
|
# CCLI File import
|
||||||
self.addMultiFileSelectItem(u'ccli')
|
self.addFileSelectItem(u'ccli')
|
||||||
# Songs of Fellowship
|
# Songs of Fellowship
|
||||||
self.addMultiFileSelectItem(u'songsOfFellowship', None, True)
|
self.addFileSelectItem(u'songsOfFellowship', None, True)
|
||||||
# Generic Document/Presentation import
|
# Generic Document/Presentation import
|
||||||
self.addMultiFileSelectItem(u'generic', None, True)
|
self.addFileSelectItem(u'generic', None, True)
|
||||||
# EasySlides
|
# EasySlides
|
||||||
self.addSingleFileSelectItem(u'easiSlides')
|
self.addFileSelectItem(u'easiSlides', single_select=True)
|
||||||
# EasyWorship
|
# EasyWorship
|
||||||
self.addSingleFileSelectItem(u'ew')
|
self.addFileSelectItem(u'ew', single_select=True)
|
||||||
# Words of Worship
|
# Words of Worship
|
||||||
self.addMultiFileSelectItem(u'songBeamer')
|
self.addFileSelectItem(u'songBeamer')
|
||||||
# Commented out for future use.
|
# Commented out for future use.
|
||||||
# self.addSingleFileSelectItem(u'csv', u'CSV')
|
# self.addFileSelectItem(u'csv', u'CSV', single_select=True)
|
||||||
self.sourceLayout.addLayout(self.formatStack)
|
self.sourceLayout.addLayout(self.formatStack)
|
||||||
self.addPage(self.sourcePage)
|
self.addPage(self.sourcePage)
|
||||||
|
|
||||||
@ -318,16 +318,6 @@ class SongImportForm(OpenLPWizard):
|
|||||||
self.openLP2FilenameLabel.minimumSizeHint().width())
|
self.openLP2FilenameLabel.minimumSizeHint().width())
|
||||||
self.formatSpacer.changeSize(width, 0, QtGui.QSizePolicy.Fixed,
|
self.formatSpacer.changeSize(width, 0, QtGui.QSizePolicy.Fixed,
|
||||||
QtGui.QSizePolicy.Fixed)
|
QtGui.QSizePolicy.Fixed)
|
||||||
self.openLP2FormLabelSpacer.changeSize(width, 0,
|
|
||||||
QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
|
|
||||||
self.openLP1FormLabelSpacer.changeSize(width, 0,
|
|
||||||
QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
|
|
||||||
self.easiSlidesFormLabelSpacer.changeSize(width, 0,
|
|
||||||
QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
|
|
||||||
self.ewFormLabelSpacer.changeSize(width, 0, QtGui.QSizePolicy.Fixed,
|
|
||||||
QtGui.QSizePolicy.Fixed)
|
|
||||||
# self.csvFormLabelSpacer.changeSize(width, 0, QtGui.QSizePolicy.Fixed,
|
|
||||||
# QtGui.QSizePolicy.Fixed)
|
|
||||||
|
|
||||||
def validateCurrentPage(self):
|
def validateCurrentPage(self):
|
||||||
"""
|
"""
|
||||||
@ -791,52 +781,8 @@ class SongImportForm(OpenLPWizard):
|
|||||||
translate('SongsPlugin.SongImportForm',
|
translate('SongsPlugin.SongImportForm',
|
||||||
'Your song import failed.'))
|
'Your song import failed.'))
|
||||||
|
|
||||||
def addSingleFileSelectItem(self, prefix, obj_prefix=None,
|
def addFileSelectItem(self, prefix, obj_prefix=None, can_disable=False,
|
||||||
can_disable=False):
|
single_select=False):
|
||||||
if not obj_prefix:
|
|
||||||
obj_prefix = prefix
|
|
||||||
page = QtGui.QWidget()
|
|
||||||
page.setObjectName(obj_prefix + u'Page')
|
|
||||||
if can_disable:
|
|
||||||
importWidget = self.disablableWidget(page, prefix, obj_prefix)
|
|
||||||
else:
|
|
||||||
importWidget = page
|
|
||||||
importLayout = QtGui.QFormLayout(importWidget)
|
|
||||||
importLayout.setMargin(0)
|
|
||||||
if can_disable:
|
|
||||||
importLayout.setObjectName(obj_prefix + u'ImportLayout')
|
|
||||||
else:
|
|
||||||
importLayout.setObjectName(obj_prefix + u'Layout')
|
|
||||||
filenameLabel = QtGui.QLabel(importWidget)
|
|
||||||
filenameLabel.setObjectName(obj_prefix + u'FilenameLabel')
|
|
||||||
fileLayout = QtGui.QHBoxLayout()
|
|
||||||
fileLayout.setObjectName(obj_prefix + u'FileLayout')
|
|
||||||
filenameEdit = QtGui.QLineEdit(importWidget)
|
|
||||||
filenameEdit.setObjectName(obj_prefix + u'FilenameEdit')
|
|
||||||
fileLayout.addWidget(filenameEdit)
|
|
||||||
browseButton = QtGui.QToolButton(importWidget)
|
|
||||||
browseButton.setIcon(self.openIcon)
|
|
||||||
browseButton.setObjectName(obj_prefix + u'BrowseButton')
|
|
||||||
fileLayout.addWidget(browseButton)
|
|
||||||
importLayout.addRow(filenameLabel, fileLayout)
|
|
||||||
formSpacer = QtGui.QSpacerItem(10, 0, QtGui.QSizePolicy.Fixed,
|
|
||||||
QtGui.QSizePolicy.Minimum)
|
|
||||||
importLayout.setItem(1, QtGui.QFormLayout.LabelRole, formSpacer)
|
|
||||||
self.formatStack.addWidget(page)
|
|
||||||
setattr(self, prefix + u'Page', page)
|
|
||||||
setattr(self, prefix + u'FilenameLabel', filenameLabel)
|
|
||||||
setattr(self, prefix + u'FormLabelSpacer', formSpacer)
|
|
||||||
setattr(self, prefix + u'FileLayout', fileLayout)
|
|
||||||
setattr(self, prefix + u'FilenameEdit', filenameEdit)
|
|
||||||
setattr(self, prefix + u'BrowseButton', browseButton)
|
|
||||||
if can_disable:
|
|
||||||
setattr(self, prefix + u'ImportLayout', importLayout)
|
|
||||||
else:
|
|
||||||
setattr(self, prefix + u'Layout', importLayout)
|
|
||||||
self.formatComboBox.addItem(u'')
|
|
||||||
|
|
||||||
def addMultiFileSelectItem(self, prefix, obj_prefix=None,
|
|
||||||
can_disable=False):
|
|
||||||
if not obj_prefix:
|
if not obj_prefix:
|
||||||
obj_prefix = prefix
|
obj_prefix = prefix
|
||||||
page = QtGui.QWidget()
|
page = QtGui.QWidget()
|
||||||
@ -847,37 +793,55 @@ class SongImportForm(OpenLPWizard):
|
|||||||
importWidget = page
|
importWidget = page
|
||||||
importLayout = QtGui.QVBoxLayout(importWidget)
|
importLayout = QtGui.QVBoxLayout(importWidget)
|
||||||
importLayout.setMargin(0)
|
importLayout.setMargin(0)
|
||||||
if can_disable:
|
importLayout.setObjectName(obj_prefix + u'ImportLayout')
|
||||||
importLayout.setObjectName(obj_prefix + u'ImportLayout')
|
if single_select:
|
||||||
|
fileLayout = QtGui.QHBoxLayout()
|
||||||
|
fileLayout.setObjectName(obj_prefix + u'FileLayout')
|
||||||
|
filenameLabel = QtGui.QLabel(importWidget)
|
||||||
|
filenameLabel.setObjectName(obj_prefix + u'FilenameLabel')
|
||||||
|
fileLayout.addWidget(filenameLabel)
|
||||||
|
filenameEdit = QtGui.QLineEdit(importWidget)
|
||||||
|
filenameEdit.setObjectName(obj_prefix + u'FilenameEdit')
|
||||||
|
fileLayout.addWidget(filenameEdit)
|
||||||
|
browseButton = QtGui.QToolButton(importWidget)
|
||||||
|
browseButton.setIcon(self.openIcon)
|
||||||
|
browseButton.setObjectName(obj_prefix + u'BrowseButton')
|
||||||
|
fileLayout.addWidget(browseButton)
|
||||||
|
formSpacer = QtGui.QSpacerItem(10, 0, QtGui.QSizePolicy.Fixed,
|
||||||
|
QtGui.QSizePolicy.Expanding)
|
||||||
|
importLayout.addLayout(fileLayout)
|
||||||
|
importLayout.addSpacerItem(formSpacer)
|
||||||
else:
|
else:
|
||||||
importLayout.setObjectName(obj_prefix + u'Layout')
|
fileListWidget = QtGui.QListWidget(importWidget)
|
||||||
fileListWidget = QtGui.QListWidget(importWidget)
|
fileListWidget.setSelectionMode(
|
||||||
fileListWidget.setSelectionMode(
|
QtGui.QAbstractItemView.ExtendedSelection)
|
||||||
QtGui.QAbstractItemView.ExtendedSelection)
|
fileListWidget.setObjectName(obj_prefix + u'FileListWidget')
|
||||||
fileListWidget.setObjectName(obj_prefix + u'FileListWidget')
|
importLayout.addWidget(fileListWidget)
|
||||||
importLayout.addWidget(fileListWidget)
|
buttonLayout = QtGui.QHBoxLayout()
|
||||||
buttonLayout = QtGui.QHBoxLayout()
|
buttonLayout.setObjectName(obj_prefix + u'ButtonLayout')
|
||||||
buttonLayout.setObjectName(obj_prefix + u'ButtonLayout')
|
addButton = QtGui.QPushButton(importWidget)
|
||||||
addButton = QtGui.QPushButton(importWidget)
|
addButton.setIcon(self.openIcon)
|
||||||
addButton.setIcon(self.openIcon)
|
addButton.setObjectName(obj_prefix + u'AddButton')
|
||||||
addButton.setObjectName(obj_prefix + u'AddButton')
|
buttonLayout.addWidget(addButton)
|
||||||
buttonLayout.addWidget(addButton)
|
buttonLayout.addStretch()
|
||||||
buttonLayout.addStretch()
|
removeButton = QtGui.QPushButton(importWidget)
|
||||||
removeButton = QtGui.QPushButton(importWidget)
|
removeButton.setIcon(self.deleteIcon)
|
||||||
removeButton.setIcon(self.deleteIcon)
|
removeButton.setObjectName(obj_prefix + u'RemoveButton')
|
||||||
removeButton.setObjectName(obj_prefix + u'RemoveButton')
|
buttonLayout.addWidget(removeButton)
|
||||||
buttonLayout.addWidget(removeButton)
|
importLayout.addLayout(buttonLayout)
|
||||||
importLayout.addLayout(buttonLayout)
|
|
||||||
self.formatStack.addWidget(page)
|
self.formatStack.addWidget(page)
|
||||||
setattr(self, prefix + u'Page', page)
|
setattr(self, prefix + u'Page', page)
|
||||||
setattr(self, prefix + u'FileListWidget', fileListWidget)
|
if single_select:
|
||||||
setattr(self, prefix + u'ButtonLayout', buttonLayout)
|
setattr(self, prefix + u'FilenameLabel', filenameLabel)
|
||||||
setattr(self, prefix + u'AddButton', addButton)
|
setattr(self, prefix + u'FileLayout', fileLayout)
|
||||||
setattr(self, prefix + u'RemoveButton', removeButton)
|
setattr(self, prefix + u'FilenameEdit', filenameEdit)
|
||||||
if can_disable:
|
setattr(self, prefix + u'BrowseButton', browseButton)
|
||||||
setattr(self, prefix + u'ImportLayout', importLayout)
|
|
||||||
else:
|
else:
|
||||||
setattr(self, prefix + u'Layout', importLayout)
|
setattr(self, prefix + u'FileListWidget', fileListWidget)
|
||||||
|
setattr(self, prefix + u'ButtonLayout', buttonLayout)
|
||||||
|
setattr(self, prefix + u'AddButton', addButton)
|
||||||
|
setattr(self, prefix + u'RemoveButton', removeButton)
|
||||||
|
setattr(self, prefix + u'ImportLayout', importLayout)
|
||||||
self.formatComboBox.addItem(u'')
|
self.formatComboBox.addItem(u'')
|
||||||
|
|
||||||
def disablableWidget(self, page, prefix, obj_prefix):
|
def disablableWidget(self, page, prefix, obj_prefix):
|
||||||
|
Loading…
Reference in New Issue
Block a user