openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #03810
[Merge] lp:~whydoubt/openlp/codecleanup into lp:openlp
Jeffrey Smith has proposed merging lp:~whydoubt/openlp/codecleanup into lp:openlp.
Requested reviews:
Tim Bentley (trb143)
Most of the pages for the song imports wizard came down
to two different layouts, and the ability to disable some
plugins. This branch factorizes that out into three
methods.
--
https://code.launchpad.net/~whydoubt/openlp/codecleanup/+merge/36496
Your team OpenLP Core is subscribed to branch lp:openlp.
=== modified file 'openlp/plugins/songs/forms/songimportwizard.py'
--- openlp/plugins/songs/forms/songimportwizard.py 2010-09-20 18:22:57 +0000
+++ openlp/plugins/songs/forms/songimportwizard.py 2010-09-23 19:34:54 +0000
@@ -30,8 +30,8 @@
class Ui_SongImportWizard(object):
def setupUi(self, songImportWizard):
- openIcon = build_icon(u':/general/general_open.png')
- deleteIcon = build_icon(u':/general/general_delete.png')
+ self.openIcon = build_icon(u':/general/general_open.png')
+ self.deleteIcon = build_icon(u':/general/general_delete.png')
songImportWizard.setObjectName(u'songImportWizard')
songImportWizard.resize(550, 386)
songImportWizard.setModal(True)
@@ -88,16 +88,6 @@
self.formatComboBox.sizePolicy().hasHeightForWidth())
self.formatComboBox.setSizePolicy(sizePolicy)
self.formatComboBox.setObjectName(u'formatComboBox')
- self.formatComboBox.addItem(u'')
- self.formatComboBox.addItem(u'')
- self.formatComboBox.addItem(u'')
- self.formatComboBox.addItem(u'')
- self.formatComboBox.addItem(u'')
- self.formatComboBox.addItem(u'')
- self.formatComboBox.addItem(u'')
- self.formatComboBox.addItem(u'')
- self.formatComboBox.addItem(u'')
-# self.formatComboBox.addItem(u'')
self.formatLayout.addWidget(self.formatComboBox)
self.formatSpacer = QtGui.QSpacerItem(40, 20,
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
@@ -106,362 +96,28 @@
self.formatStackedWidget = QtGui.QStackedWidget(self.sourcePage)
self.formatStackedWidget.setObjectName(u'FormatStackedWidget')
# OpenLP 2.0
- self.openLP2Page = QtGui.QWidget()
- self.openLP2Page.setObjectName(u'openLP2Page')
- self.openLP2Layout = QtGui.QFormLayout(self.openLP2Page)
- self.openLP2Layout.setMargin(0)
- self.openLP2Layout.setSpacing(8)
- self.openLP2Layout.setObjectName(u'openLP2Layout')
- self.openLP2FilenameLabel = QtGui.QLabel(self.openLP2Page)
- self.openLP2FilenameLabel.setObjectName(u'openLP2FilenameLabel')
- self.openLP2Layout.setWidget(0, QtGui.QFormLayout.LabelRole,
- self.openLP2FilenameLabel)
- self.openLP2FileLayout = QtGui.QHBoxLayout()
- self.openLP2FileLayout.setSpacing(8)
- self.openLP2FileLayout.setObjectName(u'openLP2FileLayout')
- self.openLP2FilenameEdit = QtGui.QLineEdit(self.openLP2Page)
- self.openLP2FilenameEdit.setObjectName(u'openLP2FilenameEdit')
- self.openLP2FileLayout.addWidget(self.openLP2FilenameEdit)
- self.openLP2BrowseButton = QtGui.QToolButton(self.openLP2Page)
- self.openLP2BrowseButton.setIcon(openIcon)
- self.openLP2BrowseButton.setObjectName(u'openLP2BrowseButton')
- self.openLP2FileLayout.addWidget(self.openLP2BrowseButton)
- self.openLP2Layout.setLayout(0, QtGui.QFormLayout.FieldRole,
- self.openLP2FileLayout)
- self.formatStackedWidget.addWidget(self.openLP2Page)
+ self.addSingleFileSelectItem(u'openLP2')
# openlp.org 1.x
- self.openLP1Page = QtGui.QWidget()
- self.openLP1Page.setObjectName(u'openLP1Page')
- self.openLP1Layout = QtGui.QVBoxLayout(self.openLP1Page)
- self.openLP1Layout.setMargin(0)
- self.openLP1Layout.setSpacing(0)
- self.openLP1Layout.setObjectName(u'openLP1Layout')
- self.openLP1DisabledWidget = QtGui.QWidget(self.openLP1Page)
- self.openLP1DisabledLayout = QtGui.QVBoxLayout(self.openLP1DisabledWidget)
- self.openLP1DisabledLayout.setMargin(0)
- self.openLP1DisabledLayout.setSpacing(8)
- self.openLP1DisabledLayout.setObjectName(u'openLP1DisabledLayout')
- self.openLP1DisabledLabel = QtGui.QLabel(self.openLP1DisabledWidget)
- self.openLP1DisabledLabel.setWordWrap(True)
- self.openLP1DisabledLabel.setObjectName(u'openLP1DisabledLabel')
- self.openLP1DisabledLayout.addWidget(self.openLP1DisabledLabel)
- self.openLP1DisabledWidget.setVisible(False)
- self.openLP1Layout.addWidget(self.openLP1DisabledWidget)
- self.openLP1ImportWidget = QtGui.QWidget(self.openLP1Page)
- self.openLP1ImportLayout = QtGui.QFormLayout(self.openLP1ImportWidget)
- self.openLP1ImportLayout.setMargin(0)
- self.openLP1ImportLayout.setSpacing(8)
- self.openLP1ImportLayout.setObjectName(u'openLP1ImportLayout')
- self.openLP1FilenameLabel = QtGui.QLabel(self.openLP1ImportWidget)
- self.openLP1FilenameLabel.setObjectName(u'openLP1FilenameLabel')
- self.openLP1ImportLayout.setWidget(0, QtGui.QFormLayout.LabelRole,
- self.openLP1FilenameLabel)
- self.openLP1FileLayout = QtGui.QHBoxLayout()
- self.openLP1FileLayout.setSpacing(8)
- self.openLP1FileLayout.setObjectName(u'openLP1FileLayout')
- self.openLP1FilenameEdit = QtGui.QLineEdit(self.openLP1ImportWidget)
- self.openLP1FilenameEdit.setObjectName(u'openLP1FilenameEdit')
- self.openLP1FileLayout.addWidget(self.openLP1FilenameEdit)
- self.openLP1BrowseButton = QtGui.QToolButton(self.openLP1ImportWidget)
- self.openLP1BrowseButton.setIcon(openIcon)
- self.openLP1BrowseButton.setObjectName(u'openLP1BrowseButton')
- self.openLP1FileLayout.addWidget(self.openLP1BrowseButton)
- self.openLP1ImportLayout.setLayout(0, QtGui.QFormLayout.FieldRole,
- self.openLP1FileLayout)
- self.openLP1Layout.addWidget(self.openLP1ImportWidget)
- self.formatStackedWidget.addWidget(self.openLP1Page)
+ self.addSingleFileSelectItem(u'openLP1', None, True)
# OpenLyrics
- self.openLyricsPage = QtGui.QWidget()
- self.openLyricsPage.setObjectName(u'OpenLyricsPage')
- self.openLyricsLayout = QtGui.QVBoxLayout(self.openLyricsPage)
- self.openLyricsLayout.setSpacing(8)
- self.openLyricsLayout.setMargin(0)
- self.openLyricsLayout.setObjectName(u'OpenLyricsLayout')
- self.openLyricsDisabledLabel = QtGui.QLabel(self.openLyricsPage)
- self.openLyricsDisabledLabel.setWordWrap(True)
- self.openLyricsDisabledLabel.setObjectName(u'openLyricsDisabledLabel')
- self.openLyricsLayout.addWidget(self.openLyricsDisabledLabel)
- # Commented out for future use.
- #self.openLyricsFileListWidget = QtGui.QListWidget(self.openLyricsPage)
- #self.openLyricsFileListWidget.setSelectionMode(
- # QtGui.QAbstractItemView.ExtendedSelection)
- #self.openLyricsFileListWidget.setObjectName(u'OpenLyricsFileListWidget')
- #self.openLyricsLayout.addWidget(self.openLyricsFileListWidget)
- #self.openLyricsButtonLayout = QtGui.QHBoxLayout()
- #self.openLyricsButtonLayout.setSpacing(8)
- #self.openLyricsButtonLayout.setObjectName(u'OpenLyricsButtonLayout')
- #self.openLyricsAddButton = QtGui.QPushButton(self.openLyricsPage)
- #self.openLyricsAddButton.setIcon(openIcon)
- #self.openLyricsAddButton.setObjectName(u'OpenLyricsAddButton')
- #self.openLyricsButtonLayout.addWidget(self.openLyricsAddButton)
- #self.openLyricsButtonSpacer = QtGui.QSpacerItem(40, 20,
- # QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
- #self.openLyricsButtonLayout.addItem(self.openLyricsButtonSpacer)
- #self.openLyricsRemoveButton = QtGui.QPushButton(self.openLyricsPage)
- #self.openLyricsRemoveButton.setIcon(deleteIcon)
- #self.openLyricsRemoveButton.setObjectName(u'OpenLyricsRemoveButton')
- #self.openLyricsButtonLayout.addWidget(self.openLyricsRemoveButton)
- #self.openLyricsLayout.addLayout(self.openLyricsButtonLayout)
- self.formatStackedWidget.addWidget(self.openLyricsPage)
+ self.addMultiFileSelectItem(u'openLyrics', u'OpenLyrics', True)
+ # set OpenLyrics to disabled by default
+ self.openLyricsDisabledWidget.setVisible(True)
+ self.openLyricsImportWidget.setVisible(False)
# Open Song
- self.openSongPage = QtGui.QWidget()
- self.openSongPage.setObjectName(u'OpenSongPage')
- self.openSongLayout = QtGui.QVBoxLayout(self.openSongPage)
- self.openSongLayout.setSpacing(8)
- self.openSongLayout.setMargin(0)
- self.openSongLayout.setObjectName(u'OpenSongLayout')
- self.openSongFileListWidget = QtGui.QListWidget(self.openSongPage)
- self.openSongFileListWidget.setSelectionMode(
- QtGui.QAbstractItemView.ExtendedSelection)
- self.openSongFileListWidget.setObjectName(u'OpenSongFileListWidget')
- self.openSongLayout.addWidget(self.openSongFileListWidget)
- self.openSongButtonLayout = QtGui.QHBoxLayout()
- self.openSongButtonLayout.setSpacing(8)
- self.openSongButtonLayout.setObjectName(u'OpenSongButtonLayout')
- self.openSongAddButton = QtGui.QPushButton(self.openSongPage)
- self.openSongAddButton.setIcon(openIcon)
- self.openSongAddButton.setObjectName(u'OpenSongAddButton')
- self.openSongButtonLayout.addWidget(self.openSongAddButton)
- self.openSongButtonSpacer = QtGui.QSpacerItem(40, 20,
- QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
- self.openSongButtonLayout.addItem(self.openSongButtonSpacer)
- self.openSongRemoveButton = QtGui.QPushButton(self.openSongPage)
- self.openSongRemoveButton.setIcon(deleteIcon)
- self.openSongRemoveButton.setObjectName(u'OpenSongRemoveButton')
- self.openSongButtonLayout.addWidget(self.openSongRemoveButton)
- self.openSongLayout.addLayout(self.openSongButtonLayout)
- self.formatStackedWidget.addWidget(self.openSongPage)
+ self.addMultiFileSelectItem(u'openSong', u'OpenSong')
# Words of Worship
- self.wordsOfWorshipPage = QtGui.QWidget()
- self.wordsOfWorshipPage.setObjectName(u'wordsOfWorshipPage')
- self.wordsOfWorshipLayout = QtGui.QVBoxLayout(self.wordsOfWorshipPage)
- self.wordsOfWorshipLayout.setSpacing(8)
- self.wordsOfWorshipLayout.setMargin(0)
- self.wordsOfWorshipLayout.setObjectName(u'wordsOfWorshipLayout')
- self.wordsOfWorshipFileListWidget = QtGui.QListWidget(
- self.wordsOfWorshipPage)
- self.wordsOfWorshipFileListWidget.setSelectionMode(
- QtGui.QAbstractItemView.ExtendedSelection)
- self.wordsOfWorshipFileListWidget.setObjectName(
- u'wordsOfWorshipFileListWidget')
- self.wordsOfWorshipLayout.addWidget(self.wordsOfWorshipFileListWidget)
- self.wordsOfWorshipButtonLayout = QtGui.QHBoxLayout()
- self.wordsOfWorshipButtonLayout.setSpacing(8)
- self.wordsOfWorshipButtonLayout.setObjectName(
- u'wordsOfWorshipButtonLayout')
- self.wordsOfWorshipAddButton = QtGui.QPushButton(
- self.wordsOfWorshipPage)
- self.wordsOfWorshipAddButton.setIcon(openIcon)
- self.wordsOfWorshipAddButton.setObjectName(u'wordsOfWorshipAddButton')
- self.wordsOfWorshipButtonLayout.addWidget(self.wordsOfWorshipAddButton)
- self.wordsOfWorshipButtonSpacer = QtGui.QSpacerItem(40, 20,
- QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
- self.wordsOfWorshipButtonLayout.addItem(self.wordsOfWorshipButtonSpacer)
- self.wordsOfWorshipRemoveButton = QtGui.QPushButton(
- self.wordsOfWorshipPage)
- self.wordsOfWorshipRemoveButton.setIcon(deleteIcon)
- self.wordsOfWorshipRemoveButton.setObjectName(
- u'wordsOfWorshipRemoveButton')
- self.wordsOfWorshipButtonLayout.addWidget(
- self.wordsOfWorshipRemoveButton)
- self.wordsOfWorshipLayout.addLayout(self.wordsOfWorshipButtonLayout)
- self.formatStackedWidget.addWidget(self.wordsOfWorshipPage)
+ self.addMultiFileSelectItem(u'wordsOfWorship')
# CCLI File import
- self.ccliPage = QtGui.QWidget()
- self.ccliPage.setObjectName(u'ccliPage')
- self.ccliLayout = QtGui.QVBoxLayout(self.ccliPage)
- self.ccliLayout.setSpacing(8)
- self.ccliLayout.setMargin(0)
- self.ccliLayout.setObjectName(u'ccliLayout')
- self.ccliFileListWidget = QtGui.QListWidget(self.ccliPage)
- self.ccliFileListWidget.setSelectionMode(
- QtGui.QAbstractItemView.ExtendedSelection)
- self.ccliFileListWidget.setObjectName(u'ccliFileListWidget')
- self.ccliLayout.addWidget(self.ccliFileListWidget)
- self.ccliButtonLayout = QtGui.QHBoxLayout()
- self.ccliButtonLayout.setSpacing(8)
- self.ccliButtonLayout.setObjectName(u'ccliButtonLayout')
- self.ccliAddButton = QtGui.QPushButton(self.ccliPage)
- self.ccliAddButton.setIcon(openIcon)
- self.ccliAddButton.setObjectName(u'ccliAddButton')
- self.ccliButtonLayout.addWidget(self.ccliAddButton)
- self.ccliButtonSpacer = QtGui.QSpacerItem(40, 20,
- QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
- self.ccliButtonLayout.addItem(self.ccliButtonSpacer)
- self.ccliRemoveButton = QtGui.QPushButton(self.ccliPage)
- self.ccliRemoveButton.setIcon(deleteIcon)
- self.ccliRemoveButton.setObjectName(u'ccliRemoveButton')
- self.ccliButtonLayout.addWidget(self.ccliRemoveButton)
- self.ccliLayout.addLayout(self.ccliButtonLayout)
- self.formatStackedWidget.addWidget(self.ccliPage)
+ self.addMultiFileSelectItem(u'ccli')
# Songs of Fellowship
- self.songsOfFellowshipPage = QtGui.QWidget()
- self.songsOfFellowshipPage.setObjectName(u'songsOfFellowshipPage')
- self.songsOfFellowshipLayout = QtGui.QVBoxLayout(
- self.songsOfFellowshipPage)
- self.songsOfFellowshipLayout.setMargin(0)
- self.songsOfFellowshipLayout.setSpacing(0)
- self.songsOfFellowshipLayout.setObjectName(u'songsOfFellowshipLayout')
- self.songsOfFellowshipDisabledWidget = QtGui.QWidget(
- self.songsOfFellowshipPage)
- self.songsOfFellowshipDisabledWidget.setVisible(False)
- self.songsOfFellowshipDisabledWidget.setObjectName(
- u'songsOfFellowshipDisabledWidget')
- self.songsOfFellowshipDisabledLayout = QtGui.QVBoxLayout(
- self.songsOfFellowshipDisabledWidget)
- self.songsOfFellowshipDisabledLayout.setMargin(0)
- self.songsOfFellowshipDisabledLayout.setSpacing(8)
- self.songsOfFellowshipDisabledLayout.setObjectName(
- u'songsOfFellowshipDisabledLayout')
- self.songsOfFellowshipDisabledLabel = QtGui.QLabel(
- self.songsOfFellowshipDisabledWidget)
- self.songsOfFellowshipDisabledLabel.setWordWrap(True)
- self.songsOfFellowshipDisabledLabel.setObjectName(
- u'songsOfFellowshipDisabledLabel')
- self.songsOfFellowshipDisabledLayout.addWidget(
- self.songsOfFellowshipDisabledLabel)
- self.songsOfFellowshipLayout.addWidget(
- self.songsOfFellowshipDisabledWidget)
- self.songsOfFellowshipImportWidget = QtGui.QWidget(
- self.songsOfFellowshipPage)
- self.songsOfFellowshipImportWidget.setObjectName(
- u'songsOfFellowshipImportWidget')
- self.songsOfFellowshipImportLayout = QtGui.QVBoxLayout(
- self.songsOfFellowshipImportWidget)
- self.songsOfFellowshipImportLayout.setMargin(0)
- self.songsOfFellowshipImportLayout.setSpacing(8)
- self.songsOfFellowshipImportLayout.setObjectName(
- u'songsOfFellowshipImportLayout')
- self.songsOfFellowshipFileListWidget = QtGui.QListWidget(
- self.songsOfFellowshipImportWidget)
- self.songsOfFellowshipFileListWidget.setSelectionMode(
- QtGui.QAbstractItemView.ExtendedSelection)
- self.songsOfFellowshipFileListWidget.setObjectName(
- u'songsOfFellowshipFileListWidget')
- self.songsOfFellowshipImportLayout.addWidget(
- self.songsOfFellowshipFileListWidget)
- self.songsOfFellowshipButtonLayout = QtGui.QHBoxLayout()
- self.songsOfFellowshipButtonLayout.setSpacing(8)
- self.songsOfFellowshipButtonLayout.setObjectName(
- u'songsOfFellowshipButtonLayout')
- self.songsOfFellowshipAddButton = QtGui.QPushButton(
- self.songsOfFellowshipImportWidget)
- self.songsOfFellowshipAddButton.setIcon(openIcon)
- self.songsOfFellowshipAddButton.setObjectName(
- u'songsOfFellowshipAddButton')
- self.songsOfFellowshipButtonLayout.addWidget(
- self.songsOfFellowshipAddButton)
- self.songsOfFellowshipButtonSpacer = QtGui.QSpacerItem(40, 20,
- QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
- self.songsOfFellowshipButtonLayout.addItem(
- self.songsOfFellowshipButtonSpacer)
- self.songsOfFellowshipRemoveButton = QtGui.QPushButton(
- self.songsOfFellowshipImportWidget)
- self.songsOfFellowshipRemoveButton.setIcon(deleteIcon)
- self.songsOfFellowshipRemoveButton.setObjectName(
- u'songsOfFellowshipRemoveButton')
- self.songsOfFellowshipButtonLayout.addWidget(
- self.songsOfFellowshipRemoveButton)
- self.songsOfFellowshipImportLayout.addLayout(
- self.songsOfFellowshipButtonLayout)
- self.songsOfFellowshipLayout.addWidget(
- self.songsOfFellowshipImportWidget)
- self.formatStackedWidget.addWidget(self.songsOfFellowshipPage)
+ self.addMultiFileSelectItem(u'songsOfFellowship', None, True)
# Generic Document/Presentation import
- self.genericPage = QtGui.QWidget()
- self.genericPage.setObjectName(u'genericPage')
- self.genericLayout = QtGui.QVBoxLayout(self.genericPage)
- self.genericLayout.setMargin(0)
- self.genericLayout.setSpacing(0)
- self.genericLayout.setObjectName(u'genericLayout')
- self.genericDisabledWidget = QtGui.QWidget(self.genericPage)
- self.genericDisabledWidget.setObjectName(u'genericDisabledWidget')
- self.genericDisabledLayout = QtGui.QVBoxLayout(self.genericDisabledWidget)
- self.genericDisabledLayout.setMargin(0)
- self.genericDisabledLayout.setSpacing(8)
- self.genericDisabledLayout.setObjectName(u'genericDisabledLayout')
- self.genericDisabledLabel = QtGui.QLabel(self.genericDisabledWidget)
- self.genericDisabledLabel.setWordWrap(True)
- self.genericDisabledLabel.setObjectName(u'genericDisabledLabel')
- self.genericDisabledWidget.setVisible(False)
- self.genericDisabledLayout.addWidget(self.genericDisabledLabel)
- self.genericLayout.addWidget(self.genericDisabledWidget)
- self.genericImportWidget = QtGui.QWidget(self.genericPage)
- self.genericImportWidget.setObjectName(u'genericImportWidget')
- self.genericImportLayout = QtGui.QVBoxLayout(self.genericImportWidget)
- self.genericImportLayout.setMargin(0)
- self.genericImportLayout.setSpacing(8)
- self.genericImportLayout.setObjectName(u'genericImportLayout')
- self.genericFileListWidget = QtGui.QListWidget(self.genericImportWidget)
- self.genericFileListWidget.setSelectionMode(
- QtGui.QAbstractItemView.ExtendedSelection)
- self.genericFileListWidget.setObjectName(u'genericFileListWidget')
- self.genericImportLayout.addWidget(self.genericFileListWidget)
- self.genericButtonLayout = QtGui.QHBoxLayout()
- self.genericButtonLayout.setSpacing(8)
- self.genericButtonLayout.setObjectName(u'genericButtonLayout')
- self.genericAddButton = QtGui.QPushButton(self.genericImportWidget)
- self.genericAddButton.setIcon(openIcon)
- self.genericAddButton.setObjectName(u'genericAddButton')
- self.genericButtonLayout.addWidget(self.genericAddButton)
- self.genericButtonSpacer = QtGui.QSpacerItem(40, 20,
- QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
- self.genericButtonLayout.addItem(self.genericButtonSpacer)
- self.genericRemoveButton = QtGui.QPushButton(self.genericImportWidget)
- self.genericRemoveButton.setIcon(deleteIcon)
- self.genericRemoveButton.setObjectName(u'genericRemoveButton')
- self.genericButtonLayout.addWidget(self.genericRemoveButton)
- self.genericImportLayout.addLayout(self.genericButtonLayout)
- self.genericLayout.addWidget(self.genericImportWidget)
- self.formatStackedWidget.addWidget(self.genericPage)
+ self.addMultiFileSelectItem(u'generic', None, True)
# EasyWorship
- self.ewPage = QtGui.QWidget()
- self.ewPage.setObjectName(u'ewPage')
- self.ewLayout = QtGui.QFormLayout(self.ewPage)
- self.ewLayout.setMargin(0)
- self.ewLayout.setSpacing(8)
- self.ewLayout.setObjectName(u'ewLayout')
- self.ewFilenameLabel = QtGui.QLabel(self.ewPage)
- self.ewFilenameLabel.setObjectName(u'ewFilenameLabel')
- self.ewLayout.setWidget(0, QtGui.QFormLayout.LabelRole,
- self.ewFilenameLabel)
- self.ewFileLayout = QtGui.QHBoxLayout()
- self.ewFileLayout.setSpacing(8)
- self.ewFileLayout.setObjectName(u'ewFileLayout')
- self.ewFilenameEdit = QtGui.QLineEdit(self.ewPage)
- self.ewFilenameEdit.setObjectName(u'ewFilenameEdit')
- self.ewFileLayout.addWidget(self.ewFilenameEdit)
- self.ewBrowseButton = QtGui.QToolButton(self.ewPage)
- self.ewBrowseButton.setIcon(openIcon)
- self.ewBrowseButton.setObjectName(u'ewBrowseButton')
- self.ewFileLayout.addWidget(self.ewBrowseButton)
- self.ewLayout.setLayout(0, QtGui.QFormLayout.FieldRole,
- self.ewFileLayout)
- self.formatStackedWidget.addWidget(self.ewPage)
+ self.addSingleFileSelectItem(u'ew')
# Commented out for future use.
-# self.csvPage = QtGui.QWidget()
-# self.csvPage.setObjectName(u'CSVPage')
-# self.csvLayout = QtGui.QFormLayout(self.csvPage)
-# self.csvLayout.setMargin(0)
-# self.csvLayout.setSpacing(8)
-# self.csvLayout.setObjectName(u'CSVLayout')
-# self.csvFilenameLabel = QtGui.QLabel(self.csvPage)
-# self.csvFilenameLabel.setObjectName(u'CSVFilenameLabel')
-# self.csvLayout.setWidget(0, QtGui.QFormLayout.LabelRole,
-# self.csvFilenameLabel)
-# self.csvFileLayout = QtGui.QHBoxLayout()
-# self.csvFileLayout.setSpacing(8)
-# self.csvFileLayout.setObjectName(u'CSVFileLayout')
-# self.csvFilenameEdit = QtGui.QLineEdit(self.csvPage)
-# self.csvFilenameEdit.setObjectName(u'CSVFilenameEdit')
-# self.csvFileLayout.addWidget(self.csvFilenameEdit)
-# self.csvBrowseButton = QtGui.QToolButton(self.csvPage)
-# self.csvBrowseButton.setIcon(openIcon)
-# self.csvBrowseButton.setObjectName(u'CSVBrowseButton')
-# self.csvFileLayout.addWidget(self.csvBrowseButton)
-# self.csvLayout.setLayout(0, QtGui.QFormLayout.FieldRole,
-# self.csvFileLayout)
-# self.formatStackedWidget.addWidget(self.csvPage)
+# self.addSingleFileSelectItem(u'csv', u'CSV')
self.sourceLayout.addWidget(self.formatStackedWidget)
songImportWizard.addPage(self.sourcePage)
self.importPage = QtGui.QWizardPage()
@@ -593,3 +249,123 @@
translate('SongsPlugin.ImportWizardForm', 'Ready.'))
self.importProgressBar.setFormat(
translate('SongsPlugin.ImportWizardForm', '%p%'))
+
+ 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)
+ importLayout.setSpacing(8)
+ 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')
+ importLayout.setWidget(0, QtGui.QFormLayout.LabelRole, filenameLabel)
+ fileLayout = QtGui.QHBoxLayout()
+ fileLayout.setSpacing(8)
+ 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.setLayout(0, QtGui.QFormLayout.FieldRole, fileLayout)
+ self.formatStackedWidget.addWidget(page)
+ setattr(self, prefix + u'Page', page)
+ setattr(self, prefix + u'FilenameLabel', filenameLabel)
+ 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:
+ 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.QVBoxLayout(importWidget)
+ importLayout.setMargin(0)
+ importLayout.setSpacing(8)
+ if can_disable:
+ importLayout.setObjectName(obj_prefix + u'ImportLayout')
+ else:
+ importLayout.setObjectName(obj_prefix + u'Layout')
+ fileListWidget = QtGui.QListWidget(importWidget)
+ fileListWidget.setSelectionMode(
+ QtGui.QAbstractItemView.ExtendedSelection)
+ fileListWidget.setObjectName(obj_prefix + u'FileListWidget')
+ importLayout.addWidget(fileListWidget)
+ buttonLayout = QtGui.QHBoxLayout()
+ buttonLayout.setSpacing(8)
+ buttonLayout.setObjectName(obj_prefix + u'ButtonLayout')
+ addButton = QtGui.QPushButton(importWidget)
+ addButton.setIcon(self.openIcon)
+ addButton.setObjectName(obj_prefix + u'AddButton')
+ buttonLayout.addWidget(addButton)
+ buttonSpacer = QtGui.QSpacerItem(40, 20,
+ QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+ buttonLayout.addItem(buttonSpacer)
+ removeButton = QtGui.QPushButton(importWidget)
+ removeButton.setIcon(self.deleteIcon)
+ removeButton.setObjectName(obj_prefix + u'RemoveButton')
+ buttonLayout.addWidget(removeButton)
+ importLayout.addLayout(buttonLayout)
+ self.formatStackedWidget.addWidget(page)
+ setattr(self, prefix + u'Page', page)
+ setattr(self, prefix + u'FileListWidget', fileListWidget)
+ setattr(self, prefix + u'ButtonLayout', buttonLayout)
+ setattr(self, prefix + u'ButtonSpacer', buttonSpacer)
+ 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):
+ layout = QtGui.QVBoxLayout(page)
+ layout.setMargin(0)
+ layout.setSpacing(0)
+ layout.setObjectName(obj_prefix + u'Layout')
+ disabledWidget = QtGui.QWidget(page)
+ disabledWidget.setVisible(False)
+ disabledWidget.setObjectName(obj_prefix + u'DisabledWidget')
+ disabledLayout = QtGui.QVBoxLayout(disabledWidget)
+ disabledLayout.setMargin(0)
+ disabledLayout.setSpacing(8)
+ disabledLayout.setObjectName(obj_prefix + u'DisabledLayout')
+ disabledLabel = QtGui.QLabel(disabledWidget)
+ disabledLabel.setWordWrap(True)
+ disabledLabel.setObjectName(obj_prefix + u'DisabledLabel')
+ disabledLayout.addWidget(disabledLabel)
+ layout.addWidget(disabledWidget)
+ importWidget = QtGui.QWidget(page)
+ importWidget.setObjectName(obj_prefix + u'ImportWidget')
+ layout.addWidget(importWidget)
+ setattr(self, prefix + u'Layout', layout)
+ setattr(self, prefix + u'DisabledWidget', disabledWidget)
+ setattr(self, prefix + u'DisabledLayout', disabledLayout)
+ setattr(self, prefix + u'DisabledLabel', disabledLabel)
+ setattr(self, prefix + u'ImportWidget', importWidget)
+ return importWidget
Follow ups