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.setObjectName(u'FormatStack')
|
||||
# OpenLP 2.0
|
||||
self.addSingleFileSelectItem(u'openLP2')
|
||||
self.addFileSelectItem(u'openLP2', single_select=True)
|
||||
# openlp.org 1.x
|
||||
self.addSingleFileSelectItem(u'openLP1', None, True)
|
||||
self.addFileSelectItem(u'openLP1', None, True, True)
|
||||
# OpenLyrics
|
||||
self.addMultiFileSelectItem(u'openLyrics', u'OpenLyrics', True)
|
||||
self.addFileSelectItem(u'openLyrics', u'OpenLyrics', True)
|
||||
# Open Song
|
||||
self.addMultiFileSelectItem(u'openSong', u'OpenSong')
|
||||
self.addFileSelectItem(u'openSong', u'OpenSong')
|
||||
# Words of Worship
|
||||
self.addMultiFileSelectItem(u'wordsOfWorship')
|
||||
self.addFileSelectItem(u'wordsOfWorship')
|
||||
# CCLI File import
|
||||
self.addMultiFileSelectItem(u'ccli')
|
||||
self.addFileSelectItem(u'ccli')
|
||||
# Songs of Fellowship
|
||||
self.addMultiFileSelectItem(u'songsOfFellowship', None, True)
|
||||
self.addFileSelectItem(u'songsOfFellowship', None, True)
|
||||
# Generic Document/Presentation import
|
||||
self.addMultiFileSelectItem(u'generic', None, True)
|
||||
self.addFileSelectItem(u'generic', None, True)
|
||||
# EasySlides
|
||||
self.addSingleFileSelectItem(u'easiSlides')
|
||||
self.addFileSelectItem(u'easiSlides', single_select=True)
|
||||
# EasyWorship
|
||||
self.addSingleFileSelectItem(u'ew')
|
||||
self.addFileSelectItem(u'ew', single_select=True)
|
||||
# Words of Worship
|
||||
self.addMultiFileSelectItem(u'songBeamer')
|
||||
self.addFileSelectItem(u'songBeamer')
|
||||
# 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.addPage(self.sourcePage)
|
||||
|
||||
@ -318,16 +318,6 @@ class SongImportForm(OpenLPWizard):
|
||||
self.openLP2FilenameLabel.minimumSizeHint().width())
|
||||
self.formatSpacer.changeSize(width, 0, 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):
|
||||
"""
|
||||
@ -791,52 +781,8 @@ class SongImportForm(OpenLPWizard):
|
||||
translate('SongsPlugin.SongImportForm',
|
||||
'Your song import failed.'))
|
||||
|
||||
def addSingleFileSelectItem(self, prefix, obj_prefix=None,
|
||||
can_disable=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):
|
||||
def addFileSelectItem(self, prefix, obj_prefix=None, can_disable=False,
|
||||
single_select=False):
|
||||
if not obj_prefix:
|
||||
obj_prefix = prefix
|
||||
page = QtGui.QWidget()
|
||||
@ -847,10 +793,25 @@ class SongImportForm(OpenLPWizard):
|
||||
importWidget = page
|
||||
importLayout = QtGui.QVBoxLayout(importWidget)
|
||||
importLayout.setMargin(0)
|
||||
if can_disable:
|
||||
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:
|
||||
importLayout.setObjectName(obj_prefix + u'Layout')
|
||||
fileListWidget = QtGui.QListWidget(importWidget)
|
||||
fileListWidget.setSelectionMode(
|
||||
QtGui.QAbstractItemView.ExtendedSelection)
|
||||
@ -870,14 +831,17 @@ class SongImportForm(OpenLPWizard):
|
||||
importLayout.addLayout(buttonLayout)
|
||||
self.formatStack.addWidget(page)
|
||||
setattr(self, prefix + u'Page', page)
|
||||
if single_select:
|
||||
setattr(self, prefix + u'FilenameLabel', filenameLabel)
|
||||
setattr(self, prefix + u'FileLayout', fileLayout)
|
||||
setattr(self, prefix + u'FilenameEdit', filenameEdit)
|
||||
setattr(self, prefix + u'BrowseButton', browseButton)
|
||||
else:
|
||||
setattr(self, prefix + u'FileListWidget', fileListWidget)
|
||||
setattr(self, prefix + u'ButtonLayout', buttonLayout)
|
||||
setattr(self, prefix + u'AddButton', addButton)
|
||||
setattr(self, prefix + u'RemoveButton', removeButton)
|
||||
if can_disable:
|
||||
setattr(self, prefix + u'ImportLayout', importLayout)
|
||||
else:
|
||||
setattr(self, prefix + u'Layout', importLayout)
|
||||
self.formatComboBox.addItem(u'')
|
||||
|
||||
def disablableWidget(self, page, prefix, obj_prefix):
|
||||
|
Loading…
Reference in New Issue
Block a user