diff --git a/openlp/core/ui/themewizard.py b/openlp/core/ui/themewizard.py index 8b89f802c..da25b0f37 100644 --- a/openlp/core/ui/themewizard.py +++ b/openlp/core/ui/themewizard.py @@ -36,7 +36,7 @@ class Ui_ThemeWizard(object): ThemeWizard.setOptions( QtGui.QWizard.IndependentPages | QtGui.QWizard.NoBackButtonOnStartPage) - # welcome page + # Welcome Page self.welcomePage = QtGui.QWizardPage() self.welcomePage.setPixmap(QtGui.QWizard.WatermarkPixmap, QtGui.QPixmap(u':/wizards/wizard_createtheme.bmp')) @@ -53,7 +53,7 @@ class Ui_ThemeWizard(object): self.welcomeLayout.addWidget(self.informationLabel) self.welcomeLayout.addStretch() ThemeWizard.addPage(self.welcomePage) - # background page + # Background Page self.backgroundPage = QtGui.QWizardPage() self.backgroundPage.setObjectName(u'BackgroundPage') self.backgroundLayout = QtGui.QVBoxLayout(self.backgroundPage) @@ -143,7 +143,7 @@ class Ui_ThemeWizard(object): self.backgroundStack.addWidget(self.imageWidget) self.backgroundLayout.addLayout(self.backgroundStack) ThemeWizard.addPage(self.backgroundPage) - # main area page + # Main Area Page self.mainAreaPage = QtGui.QWizardPage() self.mainAreaPage.setObjectName(u'MainAreaPage') self.mainAreaLayout = QtGui.QFormLayout(self.mainAreaPage) @@ -226,7 +226,7 @@ class Ui_ThemeWizard(object): self.shadowLayout.addWidget(self.shadowSizeSpinBox) self.mainAreaLayout.addRow(self.shadowCheckBox, self.shadowLayout) ThemeWizard.addPage(self.mainAreaPage) - # footer area page + # Footer Area Page self.footerAreaPage = QtGui.QWizardPage() self.footerAreaPage.setObjectName(u'FooterAreaPage') self.footerAreaLayout = QtGui.QFormLayout(self.footerAreaPage) @@ -251,7 +251,7 @@ class Ui_ThemeWizard(object): self.footerSizeSpinBox.setObjectName(u'FooterSizeSpinBox') self.footerAreaLayout.addRow(self.footerSizeLabel, self.footerSizeSpinBox) ThemeWizard.addPage(self.footerAreaPage) - # alignment page + # Alignment Page self.alignmentPage = QtGui.QWizardPage() self.alignmentPage.setObjectName(u'AlignmentPage') self.alignmentLayout = QtGui.QFormLayout(self.alignmentPage) @@ -273,7 +273,7 @@ class Ui_ThemeWizard(object): self.transitionsCheckBox.setObjectName(u'TransitionsCheckBox') self.alignmentLayout.addRow(self.transitionsCheckBox) ThemeWizard.addPage(self.alignmentPage) - # area position page + # Area Position Page self.areaPositionPage = QtGui.QWizardPage() self.areaPositionPage.setObjectName(u'AreaPositionPage') self.areaPositionLayout = QtGui.QHBoxLayout(self.areaPositionPage) @@ -347,7 +347,7 @@ class Ui_ThemeWizard(object): self.footerHeightSpinBox) self.areaPositionLayout.addWidget(self.footerPositionGroupBox) ThemeWizard.addPage(self.areaPositionPage) - # preview page + # Preview Page self.previewPage = QtGui.QWizardPage() self.previewPage.setObjectName(u'PreviewPage') self.previewLayout = QtGui.QVBoxLayout(self.previewPage) @@ -564,7 +564,7 @@ class Ui_ThemeWizard(object): 'new theme')) self.themeNameLabel.setText( translate('OpenLP.ThemeWizard', 'Theme name:')) - # Align all QFormLayouts towards each other + # Align all QFormLayouts towards each other. width = max(self.backgroundLabel.minimumSizeHint().width(), self.colorLabel.minimumSizeHint().width()) width = max(width, self.gradientStartLabel.minimumSizeHint().width()) diff --git a/openlp/plugins/bibles/forms/bibleimportwizard.py b/openlp/plugins/bibles/forms/bibleimportwizard.py index af6bae842..a8d324cf1 100644 --- a/openlp/plugins/bibles/forms/bibleimportwizard.py +++ b/openlp/plugins/bibles/forms/bibleimportwizard.py @@ -37,7 +37,7 @@ class Ui_BibleImportWizard(object): QtGui.QWizard.IndependentPages | QtGui.QWizard.NoBackButtonOnStartPage | QtGui.QWizard.NoBackButtonOnLastPage) - # Welcome page + # Welcome Page self.welcomePage = QtGui.QWizardPage() self.welcomePage.setPixmap(QtGui.QWizard.WatermarkPixmap, QtGui.QPixmap(u':/wizards/wizard_importbible.bmp')) @@ -54,29 +54,26 @@ class Ui_BibleImportWizard(object): self.welcomeLayout.addWidget(self.informationLabel) self.welcomeLayout.addStretch() bibleImportWizard.addPage(self.welcomePage) - # Select page + # Select Page self.selectPage = QtGui.QWizardPage() self.selectPage.setObjectName(u'SelectPage') self.selectPageLayout = QtGui.QVBoxLayout(self.selectPage) - self.selectPageLayout.setObjectName(u'SelectFormLayout') + self.selectPageLayout.setObjectName(u'SelectPageLayout') self.formatLayout = QtGui.QFormLayout() self.formatLayout.setObjectName(u'FormatLayout') self.formatLabel = QtGui.QLabel(self.selectPage) self.formatLabel.setObjectName(u'FormatLabel') self.formatComboBox = QtGui.QComboBox(self.selectPage) - self.formatComboBox.addItem(u'') - self.formatComboBox.addItem(u'') - self.formatComboBox.addItem(u'') - self.formatComboBox.addItem(u'') - self.formatComboBox.addItem(u'') + self.formatComboBox.addItems([u'', u'', u'', u'', u'']) self.formatComboBox.setObjectName(u'FormatComboBox') self.formatLayout.addRow(self.formatLabel, self.formatComboBox) - self.formatSpacer = QtGui.QSpacerItem(10, 0, - QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Minimum) + self.formatSpacer = QtGui.QSpacerItem(10, 0, QtGui.QSizePolicy.Fixed, + QtGui.QSizePolicy.Minimum) self.formatLayout.setItem(1, QtGui.QFormLayout.LabelRole, self.formatSpacer) self.selectPageLayout.addLayout(self.formatLayout) self.selectStack = QtGui.QStackedLayout() + self.selectStack.setObjectName(u'SelectStack') self.osisWidget = QtGui.QWidget(self.selectPage) self.osisWidget.setObjectName(u'OsisWidget') self.osisLayout = QtGui.QFormLayout(self.osisWidget) @@ -167,9 +164,7 @@ class Ui_BibleImportWizard(object): self.webSourceLabel) self.webSourceComboBox = QtGui.QComboBox(self.webBibleTab) self.webSourceComboBox.setObjectName(u'WebSourceComboBox') - self.webSourceComboBox.addItem(u'') - self.webSourceComboBox.addItem(u'') - self.webSourceComboBox.addItem(u'') + self.webSourceComboBox.addItems([u'', u'', u'']) self.webBibleLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.webSourceComboBox) self.webTranslationLabel = QtGui.QLabel(self.webBibleTab) @@ -242,7 +237,7 @@ class Ui_BibleImportWizard(object): self.selectStack.addWidget(self.openlp1Widget) self.selectPageLayout.addLayout(self.selectStack) bibleImportWizard.addPage(self.selectPage) - # License page + # License Page self.licenseDetailsPage = QtGui.QWizardPage() self.licenseDetailsPage.setObjectName(u'LicenseDetailsPage') self.licenseDetailsLayout = QtGui.QFormLayout(self.licenseDetailsPage) @@ -272,7 +267,7 @@ class Ui_BibleImportWizard(object): self.licenseDetailsLayout.setWidget(2, QtGui.QFormLayout.FieldRole, self.permissionsEdit) bibleImportWizard.addPage(self.licenseDetailsPage) - # Progress page + # Progress Page self.importPage = QtGui.QWizardPage() self.importPage.setObjectName(u'ImportPage') self.importLayout = QtGui.QVBoxLayout(self.importPage) @@ -377,7 +372,7 @@ class Ui_BibleImportWizard(object): 'importer has been disabled due to a missing Python module. If ' 'you want to use this importer, you will need to install the ' '"python-sqlite" module.')) - # Align all QFormLayouts towards each other + # Align all QFormLayouts towards each other. width = max(self.formatLabel.minimumSizeHint().width(), self.osisFileLabel.minimumSizeHint().width()) width = max(width, self.csvBooksLabel.minimumSizeHint().width()) diff --git a/openlp/plugins/songs/forms/songimportform.py b/openlp/plugins/songs/forms/songimportform.py index e49334b7a..ecb4fd3e1 100644 --- a/openlp/plugins/songs/forms/songimportform.py +++ b/openlp/plugins/songs/forms/songimportform.py @@ -134,7 +134,7 @@ class SongImportForm(QtGui.QWizard, Ui_SongImportWizard): Stop the import on cancel button, close button or ESC key. """ log.debug('Import canceled by user.') - if self.currentId() == 2: + if self.currentPage() == self.importPage: Receiver.send_message(u'songs_stop_import') self.done(QtGui.QDialog.Rejected) @@ -142,11 +142,9 @@ class SongImportForm(QtGui.QWizard, Ui_SongImportWizard): """ Validate the current page before moving on to the next page. """ - if self.currentId() == 0: - # Welcome page + if self.currentPage() == self.welcomePage: return True - elif self.currentId() == 1: - # Select page + elif self.currentId() == self.sourcePage: source_format = self.formatComboBox.currentIndex() if source_format == SongFormat.OpenLP2: if self.openLP2FilenameEdit.text().isEmpty(): @@ -250,8 +248,7 @@ class SongImportForm(QtGui.QWizard, Ui_SongImportWizard): self.songBeamerAddButton.setFocus() return False return True - elif self.currentId() == 2: - # Progress page + elif self.currentPage() == self.importPage: return True def getFileName(self, title, editbox, filters=u''): @@ -423,7 +420,7 @@ class SongImportForm(QtGui.QWizard, Ui_SongImportWizard): self.removeSelectedItems(self.songBeamerFileListWidget) def onCurrentIdChanged(self, id): - if id == 2: + if self.page(id) == self.importPage: self.preImport() self.performImport() self.postImport() @@ -540,4 +537,4 @@ class SongImportForm(QtGui.QWizard, Ui_SongImportWizard): self.importProgressBar.setValue(self.importProgressBar.maximum()) self.finishButton.setVisible(True) self.cancelButton.setVisible(False) - Receiver.send_message(u'openlp_process_events') \ No newline at end of file + Receiver.send_message(u'openlp_process_events') diff --git a/openlp/plugins/songs/forms/songimportwizard.py b/openlp/plugins/songs/forms/songimportwizard.py index 809427037..85fbb07fe 100644 --- a/openlp/plugins/songs/forms/songimportwizard.py +++ b/openlp/plugins/songs/forms/songimportwizard.py @@ -33,68 +33,48 @@ class Ui_SongImportWizard(object): 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) songImportWizard.setWizardStyle(QtGui.QWizard.ModernStyle) songImportWizard.setOptions( QtGui.QWizard.IndependentPages | QtGui.QWizard.NoBackButtonOnStartPage | QtGui.QWizard.NoBackButtonOnLastPage) + # Welcome Page self.welcomePage = QtGui.QWizardPage() - self.welcomePage.setObjectName(u'welcomePage') self.welcomePage.setPixmap(QtGui.QWizard.WatermarkPixmap, QtGui.QPixmap(u':/wizards/wizard_importsong.bmp')) - self.welcomeLayout = QtGui.QHBoxLayout(self.welcomePage) - self.welcomeLayout.setSpacing(8) - self.welcomeLayout.setMargin(0) - self.welcomeLayout.setObjectName(u'welcomeLayout') - self.welcomeTextLayout = QtGui.QVBoxLayout() - self.welcomeTextLayout.setSpacing(8) - self.welcomeTextLayout.setObjectName(u'welcomeTextLayout') + self.welcomePage.setObjectName(u'WelcomePage') + self.welcomeLayout = QtGui.QVBoxLayout(self.welcomePage) + self.welcomeLayout.setObjectName(u'WelcomeLayout') self.titleLabel = QtGui.QLabel(self.welcomePage) self.titleLabel.setObjectName(u'TitleLabel') - self.welcomeTextLayout.addWidget(self.titleLabel) - self.welcomeTopSpacer = QtGui.QSpacerItem(20, 40, - QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed) - self.welcomeTextLayout.addItem(self.welcomeTopSpacer) + self.welcomeLayout.addWidget(self.titleLabel) + self.welcomeLayout.addSpacing(40) self.informationLabel = QtGui.QLabel(self.welcomePage) self.informationLabel.setWordWrap(True) - self.informationLabel.setMargin(10) self.informationLabel.setObjectName(u'InformationLabel') - self.welcomeTextLayout.addWidget(self.informationLabel) - self.welcomeBottomSpacer = QtGui.QSpacerItem(20, 40, - QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) - self.welcomeTextLayout.addItem(self.welcomeBottomSpacer) - self.welcomeLayout.addLayout(self.welcomeTextLayout) + self.welcomeLayout.addWidget(self.informationLabel) + self.welcomeLayout.addStretch() songImportWizard.addPage(self.welcomePage) + # Source Page self.sourcePage = QtGui.QWizardPage() self.sourcePage.setObjectName(u'SourcePage') self.sourceLayout = QtGui.QVBoxLayout(self.sourcePage) - self.sourceLayout.setSpacing(8) - self.sourceLayout.setMargin(20) self.sourceLayout.setObjectName(u'SourceLayout') - self.formatLayout = QtGui.QHBoxLayout() - self.formatLayout.setSpacing(8) + self.formatLayout = QtGui.QFormLayout() self.formatLayout.setObjectName(u'FormatLayout') self.formatLabel = QtGui.QLabel(self.sourcePage) self.formatLabel.setObjectName(u'FormatLabel') - self.formatLayout.addWidget(self.formatLabel) self.formatComboBox = QtGui.QComboBox(self.sourcePage) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.MinimumExpanding, - QtGui.QSizePolicy.Fixed) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth( - self.formatComboBox.sizePolicy().hasHeightForWidth()) - self.formatComboBox.setSizePolicy(sizePolicy) - self.formatComboBox.setObjectName(u'formatComboBox') - self.formatLayout.addWidget(self.formatComboBox) - self.formatSpacer = QtGui.QSpacerItem(40, 20, - QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) - self.formatLayout.addItem(self.formatSpacer) + self.formatComboBox.setObjectName(u'FormatComboBox') + self.formatLayout.addRow(self.formatLabel, self.formatComboBox) + self.formatSpacer = QtGui.QSpacerItem(10, 0, QtGui.QSizePolicy.Fixed, + QtGui.QSizePolicy.Minimum) + self.formatLayout.setItem(1, QtGui.QFormLayout.LabelRole, + self.formatSpacer) self.sourceLayout.addLayout(self.formatLayout) - self.formatStackedWidget = QtGui.QStackedWidget(self.sourcePage) - self.formatStackedWidget.setObjectName(u'FormatStackedWidget') + self.formatStack = QtGui.QStackedLayout() + self.formatStack.setObjectName(u'FormatStack') # OpenLP 2.0 self.addSingleFileSelectItem(u'openLP2') # openlp.org 1.x @@ -120,28 +100,26 @@ class Ui_SongImportWizard(object): self.addMultiFileSelectItem(u'songBeamer') # Commented out for future use. # self.addSingleFileSelectItem(u'csv', u'CSV') - self.sourceLayout.addWidget(self.formatStackedWidget) + self.sourceLayout.addLayout(self.formatStack) songImportWizard.addPage(self.sourcePage) + # Import Page self.importPage = QtGui.QWizardPage() - self.importPage.setObjectName(u'importPage') + self.importPage.setObjectName(u'ImportPage') self.importLayout = QtGui.QVBoxLayout(self.importPage) - self.importLayout.setSpacing(8) - self.importLayout.setMargin(50) - self.importLayout.setObjectName(u'importLayout') + self.importLayout.setMargin(48) + self.importLayout.setObjectName(u'ImportLayout') self.importProgressLabel = QtGui.QLabel(self.importPage) - self.importProgressLabel.setObjectName(u'importProgressLabel') + self.importProgressLabel.setObjectName(u'ImportProgressLabel') self.importLayout.addWidget(self.importProgressLabel) self.importProgressBar = QtGui.QProgressBar(self.importPage) - self.importProgressBar.setProperty(u'value', 0) - self.importProgressBar.setInvertedAppearance(False) - self.importProgressBar.setObjectName(u'importProgressBar') + self.importProgressBar.setObjectName(u'ImportProgressBar') self.importLayout.addWidget(self.importProgressBar) songImportWizard.addPage(self.importPage) self.retranslateUi(songImportWizard) - self.formatStackedWidget.setCurrentIndex(0) + self.formatStack.setCurrentIndex(0) QtCore.QObject.connect(self.formatComboBox, QtCore.SIGNAL(u'currentIndexChanged(int)'), - self.formatStackedWidget.setCurrentIndex) + self.formatStack.setCurrentIndex) QtCore.QMetaObject.connectSlotsByName(songImportWizard) def retranslateUi(self, songImportWizard): @@ -257,6 +235,19 @@ class Ui_SongImportWizard(object): translate('SongsPlugin.ImportWizardForm', 'Ready.')) self.importProgressBar.setFormat( translate('SongsPlugin.ImportWizardForm', '%p%')) + # Align all QFormLayouts towards each other. + width = max(self.formatLabel.minimumSizeHint().width(), + 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.ewFormLabelSpacer.changeSize(width, 0, QtGui.QSizePolicy.Fixed, + QtGui.QSizePolicy.Fixed) +# self.csvFormLabelSpacer.changeSize(width, 0, QtGui.QSizePolicy.Fixed, +# QtGui.QSizePolicy.Fixed) def addSingleFileSelectItem(self, prefix, obj_prefix=None, can_disable=False): @@ -270,16 +261,13 @@ class Ui_SongImportWizard(object): 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') @@ -288,10 +276,14 @@ class Ui_SongImportWizard(object): browseButton.setIcon(self.openIcon) browseButton.setObjectName(obj_prefix + u'BrowseButton') fileLayout.addWidget(browseButton) - importLayout.setLayout(0, QtGui.QFormLayout.FieldRole, fileLayout) - self.formatStackedWidget.addWidget(page) + 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) @@ -313,7 +305,6 @@ class Ui_SongImportWizard(object): importWidget = page importLayout = QtGui.QVBoxLayout(importWidget) importLayout.setMargin(0) - importLayout.setSpacing(8) if can_disable: importLayout.setObjectName(obj_prefix + u'ImportLayout') else: @@ -324,25 +315,21 @@ class Ui_SongImportWizard(object): 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) + buttonLayout.addStretch() removeButton = QtGui.QPushButton(importWidget) removeButton.setIcon(self.deleteIcon) removeButton.setObjectName(obj_prefix + u'RemoveButton') buttonLayout.addWidget(removeButton) importLayout.addLayout(buttonLayout) - self.formatStackedWidget.addWidget(page) + self.formatStack.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: @@ -361,7 +348,6 @@ class Ui_SongImportWizard(object): 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) @@ -376,4 +362,4 @@ class Ui_SongImportWizard(object): setattr(self, prefix + u'DisabledLayout', disabledLayout) setattr(self, prefix + u'DisabledLabel', disabledLabel) setattr(self, prefix + u'ImportWidget', importWidget) - return importWidget \ No newline at end of file + return importWidget