From e6a24cf08cf1a26758cc996dc44713d57df7d890 Mon Sep 17 00:00:00 2001 From: M2j Date: Fri, 31 Dec 2010 19:10:45 +0100 Subject: [PATCH 1/7] rewritten setupUI for AboutDialog, AdvancedTab, ExceptionDialog, FilerenameDialog and GeneralTab --- openlp/core/ui/aboutdialog.py | 43 ++---- openlp/core/ui/advancedtab.py | 79 +++++------- openlp/core/ui/exceptiondialog.py | 17 +-- openlp/core/ui/filerenamedialog.py | 30 ++--- openlp/core/ui/filerenameform.py | 2 +- openlp/core/ui/generaltab.py | 201 +++++++++-------------------- 6 files changed, 124 insertions(+), 248 deletions(-) diff --git a/openlp/core/ui/aboutdialog.py b/openlp/core/ui/aboutdialog.py index 430ca406d..597d3fb24 100644 --- a/openlp/core/ui/aboutdialog.py +++ b/openlp/core/ui/aboutdialog.py @@ -31,17 +31,12 @@ from openlp.core.lib import build_icon, translate class Ui_AboutDialog(object): def setupUi(self, aboutDialog): aboutDialog.setObjectName(u'aboutDialog') - aboutDialog.resize(516, 481) aboutDialog.setWindowIcon(build_icon(u':/icon/openlp-logo-16x16.png')) self.aboutDialogLayout = QtGui.QVBoxLayout(aboutDialog) - self.aboutDialogLayout.setSpacing(8) - self.aboutDialogLayout.setMargin(8) self.aboutDialogLayout.setObjectName(u'aboutDialogLayout') self.logoLabel = QtGui.QLabel(aboutDialog) self.logoLabel.setPixmap( QtGui.QPixmap(u':/graphics/openlp-about-logo.png')) - self.logoLabel.setScaledContents(False) - self.logoLabel.setIndent(0) self.logoLabel.setObjectName(u'logoLabel') self.aboutDialogLayout.addWidget(self.logoLabel) self.aboutNotebook = QtGui.QTabWidget(aboutDialog) @@ -49,59 +44,44 @@ class Ui_AboutDialog(object): self.aboutTab = QtGui.QWidget() self.aboutTab.setObjectName(u'aboutTab') self.aboutTabLayout = QtGui.QVBoxLayout(self.aboutTab) - self.aboutTabLayout.setSpacing(0) - self.aboutTabLayout.setMargin(8) self.aboutTabLayout.setObjectName(u'aboutTabLayout') self.aboutTextEdit = QtGui.QPlainTextEdit(self.aboutTab) self.aboutTextEdit.setReadOnly(True) self.aboutTextEdit.setObjectName(u'aboutTextEdit') self.aboutTabLayout.addWidget(self.aboutTextEdit) - self.aboutNotebook.addTab(self.aboutTab, '') + self.aboutNotebook.addTab(self.aboutTab, u'') self.creditsTab = QtGui.QWidget() self.creditsTab.setObjectName(u'creditsTab') self.creditsTabLayout = QtGui.QVBoxLayout(self.creditsTab) - self.creditsTabLayout.setSpacing(0) - self.creditsTabLayout.setMargin(8) self.creditsTabLayout.setObjectName(u'creditsTabLayout') self.creditsTextEdit = QtGui.QPlainTextEdit(self.creditsTab) self.creditsTextEdit.setReadOnly(True) self.creditsTextEdit.setObjectName(u'creditsTextEdit') self.creditsTabLayout.addWidget(self.creditsTextEdit) - self.aboutNotebook.addTab(self.creditsTab, '') + self.aboutNotebook.addTab(self.creditsTab, u'') self.licenseTab = QtGui.QWidget() self.licenseTab.setObjectName(u'licenseTab') self.licenseTabLayout = QtGui.QVBoxLayout(self.licenseTab) - self.licenseTabLayout.setSpacing(8) - self.licenseTabLayout.setMargin(8) self.licenseTabLayout.setObjectName(u'licenseTabLayout') self.licenseTextEdit = QtGui.QPlainTextEdit(self.licenseTab) self.licenseTextEdit.setReadOnly(True) self.licenseTextEdit.setObjectName(u'licenseTextEdit') self.licenseTabLayout.addWidget(self.licenseTextEdit) - self.aboutNotebook.addTab(self.licenseTab, '') + self.aboutNotebook.addTab(self.licenseTab, u'') self.aboutDialogLayout.addWidget(self.aboutNotebook) - self.buttonWidget = QtGui.QWidget(aboutDialog) - self.buttonWidget.setObjectName(u'buttonWidget') - self.buttonWidgetLayout = QtGui.QHBoxLayout(self.buttonWidget) - self.buttonWidgetLayout.setSpacing(8) - self.buttonWidgetLayout.setMargin(0) - self.buttonWidgetLayout.setObjectName(u'buttonWidgetLayout') - buttonSpacer = QtGui.QSpacerItem(275, 20, - QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) - self.buttonWidgetLayout.addItem(buttonSpacer) - self.contributeButton = QtGui.QPushButton(self.buttonWidget) + self.buttonBox = QtGui.QDialogButtonBox(aboutDialog) + self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Close) + self.buttonBox.setObjectName(u'buttonBox') + self.contributeButton = QtGui.QPushButton() self.contributeButton.setIcon( build_icon(u':/system/system_contribute.png')) self.contributeButton.setObjectName(u'contributeButton') - self.buttonWidgetLayout.addWidget(self.contributeButton) - self.closeButton = QtGui.QPushButton(self.buttonWidget) - self.closeButton.setIcon(build_icon(u':/system/system_close.png')) - self.closeButton.setObjectName(u'closeButton') - self.buttonWidgetLayout.addWidget(self.closeButton) - self.aboutDialogLayout.addWidget(self.buttonWidget) + self.buttonBox.addButton(self.contributeButton, + QtGui.QDialogButtonBox.ActionRole) + self.aboutDialogLayout.addWidget(self.buttonBox) self.retranslateUi(aboutDialog) self.aboutNotebook.setCurrentIndex(0) - QtCore.QObject.connect(self.closeButton, QtCore.SIGNAL(u'clicked()'), + QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(u'rejected()'), aboutDialog.close) QtCore.QMetaObject.connectSlotsByName(aboutDialog) @@ -575,4 +555,3 @@ class Ui_AboutDialog(object): translate('OpenLP.AboutForm', 'License')) self.contributeButton.setText(translate('OpenLP.AboutForm', 'Contribute')) - self.closeButton.setText(translate('OpenLP.AboutForm', 'Close')) \ No newline at end of file diff --git a/openlp/core/ui/advancedtab.py b/openlp/core/ui/advancedtab.py index 0a8547837..0e2a4e88d 100644 --- a/openlp/core/ui/advancedtab.py +++ b/openlp/core/ui/advancedtab.py @@ -46,92 +46,64 @@ class AdvancedTab(SettingsTab): Configure the UI elements for the tab. """ self.setObjectName(u'AdvancedTab') - self.tabTitleVisible = translate('OpenLP.AdvancedTab', 'Advanced') self.advancedTabLayout = QtGui.QHBoxLayout(self) - self.advancedTabLayout.setSpacing(8) - self.advancedTabLayout.setMargin(8) + self.advancedTabLayout.setSpacing(0) + self.advancedTabLayout.setObjectName(u'advancedTabLayout') self.leftWidget = QtGui.QWidget(self) + self.leftWidget.setObjectName(u'leftWidget') self.leftLayout = QtGui.QVBoxLayout(self.leftWidget) - self.leftLayout.setSpacing(8) - self.leftLayout.setMargin(0) + self.leftLayout.setObjectName(u'leftLayout') self.uiGroupBox = QtGui.QGroupBox(self.leftWidget) self.uiGroupBox.setObjectName(u'uiGroupBox') - self.uiLayout = QtGui.QVBoxLayout(self.uiGroupBox) - self.uiLayout.setSpacing(8) - self.uiLayout.setMargin(6) + self.uiLayout = QtGui.QFormLayout(self.uiGroupBox) self.uiLayout.setObjectName(u'uiLayout') - self.recentLayout = QtGui.QHBoxLayout() - self.recentLayout.setSpacing(8) - self.recentLayout.setMargin(0) - self.recentLayout.setObjectName(u'recentLayout') self.recentLabel = QtGui.QLabel(self.uiGroupBox) self.recentLabel.setObjectName(u'recentLabel') - self.recentLayout.addWidget(self.recentLabel) self.recentSpinBox = QtGui.QSpinBox(self.uiGroupBox) self.recentSpinBox.setObjectName(u'recentSpinBox') self.recentSpinBox.setMinimum(0) - self.recentLayout.addWidget(self.recentSpinBox) - self.recentSpacer = QtGui.QSpacerItem(50, 20, - QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) - self.recentLayout.addItem(self.recentSpacer) - self.uiLayout.addLayout(self.recentLayout) + self.uiLayout.addRow(self.recentLabel, self.recentSpinBox) self.mediaPluginCheckBox = QtGui.QCheckBox(self.uiGroupBox) self.mediaPluginCheckBox.setObjectName(u'mediaPluginCheckBox') - self.uiLayout.addWidget(self.mediaPluginCheckBox) + self.uiLayout.addRow(self.mediaPluginCheckBox) self.doubleClickLiveCheckBox = QtGui.QCheckBox(self.uiGroupBox) self.doubleClickLiveCheckBox.setObjectName(u'doubleClickLiveCheckBox') - self.uiLayout.addWidget(self.doubleClickLiveCheckBox) -# self.expandServiceItemCheckBox = QtGui.QCheckBox(self.uiGroupBox) -# self.expandServiceItemCheckBox.setObjectName( -# u'expandServiceItemCheckBox') -# self.uiLayout.addWidget(self.expandServiceItemCheckBox) - self.leftLayout.addWidget(self.uiGroupBox) + self.uiLayout.addRow(self.doubleClickLiveCheckBox) self.expandServiceItemCheckBox = QtGui.QCheckBox(self.uiGroupBox) self.expandServiceItemCheckBox.setObjectName( u'expandServiceItemCheckBox') - self.uiLayout.addWidget(self.expandServiceItemCheckBox) + self.uiLayout.addRow(self.expandServiceItemCheckBox) + self.leftLayout.addWidget(self.uiGroupBox) # self.sharedDirGroupBox = QtGui.QGroupBox(self.leftWidget) # self.sharedDirGroupBox.setObjectName(u'sharedDirGroupBox') -# self.sharedDirGroupBox.setGeometry(QtCore.QRect(0, 65, 500, 85)) -# self.sharedDirGroupBox.setMaximumSize(QtCore.QSize(500, 85)) -# self.sharedDirLayout = QtGui.QVBoxLayout(self.sharedDirGroupBox) -# self.sharedDirLayout.setSpacing(8) -# self.sharedDirLayout.setMargin(8) +# self.sharedDirLayout = QtGui.QFormLayout(self.sharedDirGroupBox) # self.sharedCheckBox = QtGui.QCheckBox(self.sharedDirGroupBox) # self.sharedCheckBox.setObjectName(u'sharedCheckBox') -# self.sharedDirLayout.addWidget(self.sharedCheckBox) -# self.sharedSubLayout = QtGui.QHBoxLayout() -# self.sharedSubLayout.setSpacing(8) -# self.sharedSubLayout.setMargin(0) +# self.sharedDirLayout.addRow(self.sharedCheckBox) # self.sharedLabel = QtGui.QLabel(self.sharedDirGroupBox) # self.sharedLabel.setObjectName(u'sharedLabel') -# self.sharedSubLayout.addWidget(self.sharedLabel) +# self.sharedSubLayout = QtGui.QHBoxLayout() +# self.sharedSubLayout.setObjectName(u'sharedSubLayout') # self.sharedLineEdit = QtGui.QLineEdit(self.sharedDirGroupBox) # self.sharedLineEdit.setObjectName(u'sharedLineEdit') # self.sharedSubLayout.addWidget(self.sharedLineEdit) # self.sharedPushButton = QtGui.QPushButton(self.sharedDirGroupBox) # self.sharedPushButton.setObjectName(u'sharedPushButton') # self.sharedSubLayout.addWidget(self.sharedPushButton) -# self.sharedDirLayout.addLayout(self.sharedSubLayout) +# self.sharedDirLayout.addRow(self.sharedLabel, self.sharedSubLayout) # self.leftLayout.addWidget(self.sharedDirGroupBox) - self.leftSpacer = QtGui.QSpacerItem(20, 40, - QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) - self.leftLayout.addItem(self.leftSpacer) + self.leftLayout.addStretch() self.advancedTabLayout.addWidget(self.leftWidget) self.rightWidget = QtGui.QWidget(self) + self.rightWidget.setObjectName(u'rightWidget') self.rightLayout = QtGui.QVBoxLayout(self.rightWidget) - self.rightLayout.setSpacing(8) - self.rightLayout.setMargin(0) + self.rightLayout.setObjectName(u'rightLayout') # self.databaseGroupBox = QtGui.QGroupBox(self.rightWidget) # self.databaseGroupBox.setObjectName(u'databaseGroupBox') # self.databaseGroupBox.setEnabled(False) # self.databaseLayout = QtGui.QVBoxLayout(self.databaseGroupBox) -# self.databaseLayout.setSpacing(8) -# self.databaseLayout.setMargin(8) # self.rightLayout.addWidget(self.databaseGroupBox) - self.rightSpacer = QtGui.QSpacerItem(20, 40, - QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding) - self.rightLayout.addItem(self.rightSpacer) + self.rightLayout.addStretch() self.advancedTabLayout.addWidget(self.rightWidget) # QtCore.QObject.connect(self.sharedCheckBox, # QtCore.SIGNAL(u'stateChanged(int)'), self.onSharedCheckBoxChanged) @@ -140,6 +112,7 @@ class AdvancedTab(SettingsTab): """ Setup the interface translation strings. """ + self.tabTitleVisible = translate('OpenLP.AdvancedTab', 'Advanced') self.uiGroupBox.setTitle(translate('OpenLP.AdvancedTab', 'UI Settings')) self.recentLabel.setText( translate('OpenLP.AdvancedTab', @@ -158,6 +131,16 @@ class AdvancedTab(SettingsTab): # self.sharedPushButton.setText(translate('AdvancedTab', 'Browse...')) # self.databaseGroupBox.setTitle(translate('AdvancedTab', 'Databases')) + def resizeEvent(self, event=None): + """ + Rescale the theme preview thumbnail on resize events. + """ + if event: + SettingsTab.resizeEvent(self, event) + self.leftWidget.setMinimumWidth(max( + self.width() / 2 - self.advancedTabLayout.contentsMargins().left(), + self.leftWidget.minimumSizeHint().width())) + def load(self): """ Load settings from disk. @@ -204,4 +187,4 @@ class AdvancedTab(SettingsTab): """ self.sharedLabel.setEnabled(checked) self.sharedTextEdit.setEnabled(checked) - self.sharedPushButton.setEnabled(checked) \ No newline at end of file + self.sharedPushButton.setEnabled(checked) diff --git a/openlp/core/ui/exceptiondialog.py b/openlp/core/ui/exceptiondialog.py index eaed502b3..69035dc4d 100644 --- a/openlp/core/ui/exceptiondialog.py +++ b/openlp/core/ui/exceptiondialog.py @@ -31,23 +31,16 @@ from openlp.core.lib import translate, build_icon class Ui_ExceptionDialog(object): def setupUi(self, exceptionDialog): exceptionDialog.setObjectName(u'exceptionDialog') - exceptionDialog.resize(580, 407) self.exceptionLayout = QtGui.QVBoxLayout(exceptionDialog) - self.exceptionLayout.setSpacing(8) - self.exceptionLayout.setMargin(8) self.exceptionLayout.setObjectName(u'exceptionLayout') self.messageLayout = QtGui.QHBoxLayout() - self.messageLayout.setSpacing(0) - self.messageLayout.setContentsMargins(0, -1, 0, -1) self.messageLayout.setObjectName(u'messageLayout') + self.messageLayout.addSpacing(12) self.bugLabel = QtGui.QLabel(exceptionDialog) - self.bugLabel.setMinimumSize(QtCore.QSize(64, 64)) - self.bugLabel.setMaximumSize(QtCore.QSize(64, 64)) - self.bugLabel.setText(u'') self.bugLabel.setPixmap(QtGui.QPixmap(u':/graphics/exception.png')) - self.bugLabel.setAlignment(QtCore.Qt.AlignCenter) self.bugLabel.setObjectName(u'bugLabel') self.messageLayout.addWidget(self.bugLabel) + self.messageLayout.addSpacing(12) self.messageLabel = QtGui.QLabel(exceptionDialog) self.messageLabel.setWordWrap(True) self.messageLabel.setObjectName(u'messageLabel') @@ -55,11 +48,9 @@ class Ui_ExceptionDialog(object): self.exceptionLayout.addLayout(self.messageLayout) self.exceptionTextEdit = QtGui.QPlainTextEdit(exceptionDialog) self.exceptionTextEdit.setReadOnly(True) - self.exceptionTextEdit.setBackgroundVisible(False) self.exceptionTextEdit.setObjectName(u'exceptionTextEdit') self.exceptionLayout.addWidget(self.exceptionTextEdit) self.exceptionButtonBox = QtGui.QDialogButtonBox(exceptionDialog) - self.exceptionButtonBox.setOrientation(QtCore.Qt.Horizontal) self.exceptionButtonBox.setStandardButtons(QtGui.QDialogButtonBox.Close) self.exceptionButtonBox.setObjectName(u'exceptionButtonBox') self.exceptionLayout.addWidget(self.exceptionButtonBox) @@ -76,8 +67,6 @@ class Ui_ExceptionDialog(object): QtGui.QDialogButtonBox.ActionRole) self.retranslateUi(exceptionDialog) - QtCore.QObject.connect(self.exceptionButtonBox, - QtCore.SIGNAL(u'accepted()'), exceptionDialog.accept) QtCore.QObject.connect(self.exceptionButtonBox, QtCore.SIGNAL(u'rejected()'), exceptionDialog.reject) QtCore.QObject.connect(self.sendReportButton, @@ -98,4 +87,4 @@ class Ui_ExceptionDialog(object): self.sendReportButton.setText(translate('OpenLP.ExceptionDialog', 'Send E-Mail')) self.saveReportButton.setText(translate('OpenLP.ExceptionDialog', - 'Save to File')) \ No newline at end of file + 'Save to File')) diff --git a/openlp/core/ui/filerenamedialog.py b/openlp/core/ui/filerenamedialog.py index 47d301dd9..f5190aa16 100644 --- a/openlp/core/ui/filerenamedialog.py +++ b/openlp/core/ui/filerenamedialog.py @@ -31,27 +31,25 @@ from openlp.core.lib import translate class Ui_FileRenameDialog(object): def setupUi(self, FileRenameDialog): FileRenameDialog.setObjectName(u'FileRenameDialog') - FileRenameDialog.resize(400, 87) + self.dialogLayout = QtGui.QGridLayout(FileRenameDialog) + self.dialogLayout.setObjectName(u'dialogLayout') + self.fileNameLabel = QtGui.QLabel(FileRenameDialog) + self.fileNameLabel.setObjectName(u'fileNameLabel') + self.dialogLayout.addWidget(self.fileNameLabel, 0, 0) + self.fileNameEdit = QtGui.QLineEdit(FileRenameDialog) + self.fileNameEdit.resize(self.fileNameEdit.sizeHint().width() * 2, + self.fileNameEdit.sizeHint().height()) + self.fileNameEdit.setObjectName(u'fileNameEdit') + self.dialogLayout.addWidget(self.fileNameEdit, 0, 1) self.buttonBox = QtGui.QDialogButtonBox(FileRenameDialog) - self.buttonBox.setGeometry(QtCore.QRect(210, 50, 171, 25)) self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel | QtGui.QDialogButtonBox.Ok) self.buttonBox.setObjectName(u'buttonBox') - self.widget = QtGui.QWidget(FileRenameDialog) - self.widget.setGeometry(QtCore.QRect(10, 10, 381, 35)) - self.widget.setObjectName(u'widget') - self.horizontalLayout = QtGui.QHBoxLayout(self.widget) - self.horizontalLayout.setObjectName(u'horizontalLayout') - self.fileRenameLabel = QtGui.QLabel(self.widget) - self.fileRenameLabel.setObjectName(u'fileRenameLabel') - self.horizontalLayout.addWidget(self.fileRenameLabel) - self.fileNameEdit = QtGui.QLineEdit(self.widget) - self.fileNameEdit.setObjectName(u'fileNameEdit') - self.horizontalLayout.addWidget(self.fileNameEdit) - + self.dialogLayout.addWidget(self.buttonBox, 1, 0, 1, 2) self.retranslateUi(FileRenameDialog) + self.setMaximumHeight(self.sizeHint().height()) QtCore.QMetaObject.connectSlotsByName(FileRenameDialog) def retranslateUi(self, FileRenameDialog): - self.fileRenameLabel.setText(translate('OpenLP.FileRenameForm', - 'New File Name:')) \ No newline at end of file + self.fileNameLabel.setText(translate('OpenLP.FileRenameForm', + 'New File Name:')) diff --git a/openlp/core/ui/filerenameform.py b/openlp/core/ui/filerenameform.py index 9ff310030..86634e3b1 100644 --- a/openlp/core/ui/filerenameform.py +++ b/openlp/core/ui/filerenameform.py @@ -52,4 +52,4 @@ class FileRenameForm(QtGui.QDialog, Ui_FileRenameDialog): else: self.setWindowTitle(translate('OpenLP.FileRenameForm', 'File Rename')) - return QtGui.QDialog.exec_(self) \ No newline at end of file + return QtGui.QDialog.exec_(self) diff --git a/openlp/core/ui/generaltab.py b/openlp/core/ui/generaltab.py index 1dd6607ed..6a54d9636 100644 --- a/openlp/core/ui/generaltab.py +++ b/openlp/core/ui/generaltab.py @@ -87,35 +87,29 @@ class GeneralTab(SettingsTab): self.setObjectName(u'GeneralTab') self.tabTitleVisible = translate('OpenLP.GeneralTab', 'General') self.generalLayout = QtGui.QHBoxLayout(self) - self.generalLayout.setSpacing(8) - self.generalLayout.setMargin(8) + self.generalLayout.setSpacing(0) self.generalLayout.setObjectName(u'generalLayout') - self.generalLeftLayout = QtGui.QVBoxLayout() - self.generalLeftLayout.setObjectName(u'generalLeftLayout') - self.generalLeftLayout.setSpacing(8) - self.generalLeftLayout.setMargin(0) - self.generalLayout.addLayout(self.generalLeftLayout) - self.monitorGroupBox = QtGui.QGroupBox(self) + self.leftWidget = QtGui.QWidget(self) + self.leftWidget.setObjectName(u'leftWidget') + self.leftLayout = QtGui.QVBoxLayout(self.leftWidget) + self.leftLayout.setObjectName(u'leftLayout') + self.monitorGroupBox = QtGui.QGroupBox(self.leftWidget) self.monitorGroupBox.setObjectName(u'monitorGroupBox') - self.monitorLayout = QtGui.QVBoxLayout(self.monitorGroupBox) - self.monitorLayout.setSpacing(8) - self.monitorLayout.setMargin(8) + self.monitorLayout = QtGui.QFormLayout(self.monitorGroupBox) self.monitorLayout.setObjectName(u'monitorLayout') self.monitorLabel = QtGui.QLabel(self.monitorGroupBox) self.monitorLabel.setObjectName(u'monitorLabel') - self.monitorLayout.addWidget(self.monitorLabel) + self.monitorLayout.addRow(self.monitorLabel) self.monitorComboBox = QtGui.QComboBox(self.monitorGroupBox) self.monitorComboBox.setObjectName(u'monitorComboBox') - self.monitorLayout.addWidget(self.monitorComboBox) + self.monitorLayout.addRow(self.monitorComboBox) self.displayOnMonitorCheck = QtGui.QCheckBox(self.monitorGroupBox) self.displayOnMonitorCheck.setObjectName(u'monitorComboBox') - self.monitorLayout.addWidget(self.displayOnMonitorCheck) - self.generalLeftLayout.addWidget(self.monitorGroupBox) - self.startupGroupBox = QtGui.QGroupBox(self) + self.monitorLayout.addRow(self.displayOnMonitorCheck) + self.leftLayout.addWidget(self.monitorGroupBox) + self.startupGroupBox = QtGui.QGroupBox(self.leftWidget) self.startupGroupBox.setObjectName(u'startupGroupBox') self.startupLayout = QtGui.QVBoxLayout(self.startupGroupBox) - self.startupLayout.setSpacing(8) - self.startupLayout.setMargin(8) self.startupLayout.setObjectName(u'startupLayout') self.warningCheckBox = QtGui.QCheckBox(self.startupGroupBox) self.warningCheckBox.setObjectName(u'warningCheckBox') @@ -126,189 +120,112 @@ class GeneralTab(SettingsTab): self.showSplashCheckBox = QtGui.QCheckBox(self.startupGroupBox) self.showSplashCheckBox.setObjectName(u'showSplashCheckBox') self.startupLayout.addWidget(self.showSplashCheckBox) - self.generalLeftLayout.addWidget(self.startupGroupBox) - self.settingsGroupBox = QtGui.QGroupBox(self) + self.leftLayout.addWidget(self.startupGroupBox) + self.settingsGroupBox = QtGui.QGroupBox(self.leftWidget) self.settingsGroupBox.setObjectName(u'settingsGroupBox') - self.settingsLayout = QtGui.QGridLayout(self.settingsGroupBox) - self.settingsLayout.setSpacing(8) - self.settingsLayout.setMargin(8) + self.settingsLayout = QtGui.QFormLayout(self.settingsGroupBox) self.settingsLayout.setObjectName(u'settingsLayout') self.saveCheckServiceCheckBox = QtGui.QCheckBox(self.settingsGroupBox) self.saveCheckServiceCheckBox.setObjectName(u'saveCheckServiceCheckBox') - self.settingsLayout.addWidget(self.saveCheckServiceCheckBox, 0, 0, 1, 2) + self.settingsLayout.addRow(self.saveCheckServiceCheckBox) self.autoPreviewCheckBox = QtGui.QCheckBox(self.settingsGroupBox) self.autoPreviewCheckBox.setObjectName(u'autoPreviewCheckBox') - self.settingsLayout.addWidget(self.autoPreviewCheckBox, 1, 0, 1, 2) + self.settingsLayout.addRow(self.autoPreviewCheckBox) # Moved here from image tab self.timeoutLabel = QtGui.QLabel(self.settingsGroupBox) self.timeoutLabel.setObjectName(u'timeoutLabel') - self.settingsLayout.addWidget(self.timeoutLabel, 2, 0, 1, 1) self.timeoutSpinBox = QtGui.QSpinBox(self.settingsGroupBox) self.timeoutSpinBox.setObjectName(u'timeoutSpinBox') - self.settingsLayout.addWidget(self.timeoutSpinBox, 2, 1, 1, 1) - self.generalLeftLayout.addWidget(self.settingsGroupBox) - self.generalLeftSpacer = QtGui.QSpacerItem(20, 40, - QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) - self.generalLeftLayout.addItem(self.generalLeftSpacer) - self.generalRightLayout = QtGui.QVBoxLayout() - self.generalRightLayout.setSpacing(8) - self.generalRightLayout.setMargin(0) - self.generalRightLayout.setObjectName(u'generalRightLayout') - self.generalLayout.addLayout(self.generalRightLayout) - self.ccliGroupBox = QtGui.QGroupBox(self) + self.settingsLayout.addRow(self.timeoutLabel, self.timeoutSpinBox) + self.leftLayout.addWidget(self.settingsGroupBox) + self.leftLayout.addStretch() + self.generalLayout.addWidget(self.leftWidget) + self.rightWidget = QtGui.QWidget(self) + self.rightWidget.setObjectName(u'rightWidget') + self.rightLayout = QtGui.QVBoxLayout(self.rightWidget) + self.rightLayout.setObjectName(u'rightLayout') + self.ccliGroupBox = QtGui.QGroupBox(self.rightWidget) self.ccliGroupBox.setObjectName(u'ccliGroupBox') - self.ccliLayout = QtGui.QGridLayout(self.ccliGroupBox) - self.ccliLayout.setMargin(8) - self.ccliLayout.setSpacing(8) + self.ccliLayout = QtGui.QFormLayout(self.ccliGroupBox) self.ccliLayout.setObjectName(u'ccliLayout') self.numberLabel = QtGui.QLabel(self.ccliGroupBox) self.numberLabel.setObjectName(u'numberLabel') - self.ccliLayout.addWidget(self.numberLabel, 0, 0, 1, 1) self.numberEdit = QtGui.QLineEdit(self.ccliGroupBox) self.numberEdit.setObjectName(u'numberEdit') - self.ccliLayout.addWidget(self.numberEdit, 0, 1, 1, 1) + self.ccliLayout.addRow(self.numberLabel, self.numberEdit) self.usernameLabel = QtGui.QLabel(self.ccliGroupBox) self.usernameLabel.setObjectName(u'usernameLabel') - self.ccliLayout.addWidget(self.usernameLabel, 1, 0, 1, 1) self.usernameEdit = QtGui.QLineEdit(self.ccliGroupBox) self.usernameEdit.setObjectName(u'usernameEdit') - self.ccliLayout.addWidget(self.usernameEdit, 1, 1, 1, 1) + self.ccliLayout.addRow(self.usernameLabel, self.usernameEdit) self.passwordLabel = QtGui.QLabel(self.ccliGroupBox) self.passwordLabel.setObjectName(u'passwordLabel') - self.ccliLayout.addWidget(self.passwordLabel, 2, 0, 1, 1) self.passwordEdit = QtGui.QLineEdit(self.ccliGroupBox) self.passwordEdit.setEchoMode(QtGui.QLineEdit.Password) self.passwordEdit.setObjectName(u'passwordEdit') - self.ccliLayout.addWidget(self.passwordEdit, 2, 1, 1, 1) - self.generalRightLayout.addWidget(self.ccliGroupBox) + self.ccliLayout.addRow(self.passwordLabel, self.passwordEdit) + self.rightLayout.addWidget(self.ccliGroupBox) # Moved here from display tab - self.displayGroupBox = QtGui.QGroupBox(self) + self.displayGroupBox = QtGui.QGroupBox(self.rightWidget) self.displayGroupBox.setObjectName(u'displayGroupBox') - self.displayLayout = QtGui.QVBoxLayout(self.displayGroupBox) - self.displayLayout.setSpacing(8) - self.displayLayout.setMargin(8) + self.displayLayout = QtGui.QGridLayout(self.displayGroupBox) self.displayLayout.setObjectName(u'displayLayout') - self.currentLayout = QtGui.QHBoxLayout() - self.currentLayout.setSpacing(8) - self.currentLayout.setMargin(0) - self.currentLayout.setObjectName(u'currentLayout') - self.currentXLayout = QtGui.QVBoxLayout() - self.currentXLayout.setSpacing(0) - self.currentXLayout.setMargin(0) - self.currentXLayout.setObjectName(u'currentXLayout') self.currentXLabel = QtGui.QLabel(self.displayGroupBox) - self.currentXLabel.setAlignment(QtCore.Qt.AlignCenter) self.currentXLabel.setObjectName(u'currentXLabel') - self.currentXLayout.addWidget(self.currentXLabel) + self.displayLayout.addWidget(self.currentXLabel, 0, 0) self.currentXValueLabel = QtGui.QLabel(self.displayGroupBox) - self.currentXValueLabel.setAlignment(QtCore.Qt.AlignCenter) self.currentXValueLabel.setObjectName(u'currentXValueLabel') - self.currentXLayout.addWidget(self.currentXValueLabel) - self.currentLayout.addLayout(self.currentXLayout) - self.currentYLayout = QtGui.QVBoxLayout() - self.currentYLayout.setSpacing(0) - self.currentYLayout.setMargin(0) - self.currentYLayout.setObjectName(u'currentYLayout') + self.displayLayout.addWidget(self.currentXValueLabel, 1, 0) self.currentYLabel = QtGui.QLabel(self.displayGroupBox) - self.currentYLabel.setAlignment(QtCore.Qt.AlignCenter) self.currentYLabel.setObjectName(u'currentYLabel') - self.currentYLayout.addWidget(self.currentYLabel) + self.displayLayout.addWidget(self.currentYLabel, 0, 1) self.currentYValueLabel = QtGui.QLabel(self.displayGroupBox) - self.currentYValueLabel.setAlignment(QtCore.Qt.AlignCenter) self.currentYValueLabel.setObjectName(u'currentYValueLabel') - self.currentYLayout.addWidget(self.currentYValueLabel) - self.currentLayout.addLayout(self.currentYLayout) - self.currentWidthLayout = QtGui.QVBoxLayout() - self.currentWidthLayout.setSpacing(0) - self.currentWidthLayout.setMargin(0) - self.currentWidthLayout.setObjectName(u'currentWidthLayout') + self.displayLayout.addWidget(self.currentYValueLabel, 1, 1) self.currentWidthLabel = QtGui.QLabel(self.displayGroupBox) - self.currentWidthLabel.setAlignment(QtCore.Qt.AlignCenter) self.currentWidthLabel.setObjectName(u'currentWidthLabel') - self.currentWidthLayout.addWidget(self.currentWidthLabel) + self.displayLayout.addWidget(self.currentWidthLabel, 0, 2) self.currentWidthValueLabel = QtGui.QLabel(self.displayGroupBox) - self.currentWidthValueLabel.setAlignment(QtCore.Qt.AlignCenter) self.currentWidthValueLabel.setObjectName(u'currentWidthValueLabel') - self.currentWidthLayout.addWidget(self.currentWidthValueLabel) - self.currentLayout.addLayout(self.currentWidthLayout) - self.currentHeightLayout = QtGui.QVBoxLayout() - self.currentHeightLayout.setSpacing(0) - self.currentHeightLayout.setMargin(0) - self.currentHeightLayout.setObjectName(u'currentHeightLayout') + self.displayLayout.addWidget(self.currentWidthValueLabel, 1, 2) self.currentHeightLabel = QtGui.QLabel(self.displayGroupBox) - self.currentHeightLabel.setMaximumSize(QtCore.QSize(100, 16777215)) - self.currentHeightLabel.setAlignment(QtCore.Qt.AlignCenter) self.currentHeightLabel.setObjectName(u'currentHeightLabel') - self.currentHeightLayout.addWidget(self.currentHeightLabel) + self.displayLayout.addWidget(self.currentHeightLabel, 0, 3) self.currentHeightValueLabel = QtGui.QLabel(self.displayGroupBox) - self.currentHeightValueLabel.setAlignment(QtCore.Qt.AlignCenter) self.currentHeightValueLabel.setObjectName(u'Height') - self.currentHeightLayout.addWidget(self.currentHeightValueLabel) - self.currentLayout.addLayout(self.currentHeightLayout) - self.displayLayout.addLayout(self.currentLayout) + self.displayLayout.addWidget(self.currentHeightValueLabel, 1, 3) self.overrideCheckBox = QtGui.QCheckBox(self.displayGroupBox) self.overrideCheckBox.setObjectName(u'overrideCheckBox') - self.displayLayout.addWidget(self.overrideCheckBox) - self.generalRightLayout.addWidget(self.displayGroupBox) + self.displayLayout.addWidget(self.overrideCheckBox, 2, 0, 1, 4) + self.rightLayout.addWidget(self.displayGroupBox) # Custom position - self.customLayout = QtGui.QHBoxLayout() - self.customLayout.setSpacing(8) - self.customLayout.setMargin(0) - self.customLayout.setObjectName(u'customLayout') - self.customXLayout = QtGui.QVBoxLayout() - self.customXLayout.setSpacing(0) - self.customXLayout.setMargin(0) - self.customXLayout.setObjectName(u'customXLayout') self.customXLabel = QtGui.QLabel(self.displayGroupBox) - self.customXLabel.setAlignment(QtCore.Qt.AlignCenter) self.customXLabel.setObjectName(u'customXLabel') - self.customXLayout.addWidget(self.customXLabel) + self.displayLayout.addWidget(self.customXLabel, 3, 0) self.customXValueEdit = ValidEdit(self.displayGroupBox) self.customXValueEdit.setObjectName(u'customXValueEdit') - self.customXLayout.addWidget(self.customXValueEdit) - self.customLayout.addLayout(self.customXLayout) - self.customYLayout = QtGui.QVBoxLayout() - self.customYLayout.setSpacing(0) - self.customYLayout.setMargin(0) - self.customYLayout.setObjectName(u'customYLayout') + self.displayLayout.addWidget(self.customXValueEdit, 4, 0) self.customYLabel = QtGui.QLabel(self.displayGroupBox) - self.customYLabel.setAlignment(QtCore.Qt.AlignCenter) self.customYLabel.setObjectName(u'customYLabel') - self.customYLayout.addWidget(self.customYLabel) + self.displayLayout.addWidget(self.customYLabel, 3, 1) self.customYValueEdit = ValidEdit(self.displayGroupBox) self.customYValueEdit.setObjectName(u'customYValueEdit') - self.customYLayout.addWidget(self.customYValueEdit) - self.customLayout.addLayout(self.customYLayout) - self.customWidthLayout = QtGui.QVBoxLayout() - self.customWidthLayout.setSpacing(0) - self.customWidthLayout.setMargin(0) - self.customWidthLayout.setSizeConstraint(QtGui.QLayout.SetMinimumSize) - self.customWidthLayout.setObjectName(u'customWidthLayout') + self.displayLayout.addWidget(self.customYValueEdit, 4, 1) self.customWidthLabel = QtGui.QLabel(self.displayGroupBox) - self.customWidthLabel.setAlignment(QtCore.Qt.AlignCenter) self.customWidthLabel.setObjectName(u'customWidthLabel') - self.customWidthLayout.addWidget(self.customWidthLabel) + self.displayLayout.addWidget(self.customWidthLabel, 3, 2) self.customWidthValueEdit = ValidEdit(self.displayGroupBox) self.customWidthValueEdit.setObjectName(u'customWidthValueEdit') - self.customWidthLayout.addWidget(self.customWidthValueEdit) - self.customLayout.addLayout(self.customWidthLayout) - self.customHeightLayout = QtGui.QVBoxLayout() - self.customHeightLayout.setSpacing(0) - self.customHeightLayout.setMargin(0) - self.customHeightLayout.setObjectName(u'customHeightLayout') + self.displayLayout.addWidget(self.customWidthValueEdit, 4, 2) self.customHeightLabel = QtGui.QLabel(self.displayGroupBox) - self.customHeightLabel.setAlignment(QtCore.Qt.AlignCenter) self.customHeightLabel.setObjectName(u'customHeightLabel') - self.customHeightLayout.addWidget(self.customHeightLabel) + self.displayLayout.addWidget(self.customHeightLabel, 3, 3) self.customHeightValueEdit = ValidEdit(self.displayGroupBox) self.customHeightValueEdit.setObjectName(u'customHeightValueEdit') - self.customHeightLayout.addWidget(self.customHeightValueEdit) - self.customLayout.addLayout(self.customHeightLayout) - self.displayLayout.addLayout(self.customLayout) - # Bottom spacer - self.generalRightSpacer = QtGui.QSpacerItem(20, 40, - QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) - self.generalRightLayout.addItem(self.generalRightSpacer) + self.displayLayout.addWidget(self.customHeightValueEdit, 4, 3) + self.rightLayout.addWidget(self.displayGroupBox) + self.rightLayout.addStretch() + self.generalLayout.addWidget(self.rightWidget) # Signals and slots QtCore.QObject.connect(self.overrideCheckBox, QtCore.SIGNAL(u'toggled(bool)'), self.onOverrideCheckBoxToggled) @@ -382,6 +299,16 @@ class GeneralTab(SettingsTab): translate('OpenLP.GeneralTab', 'Height')) self.customWidthLabel.setText(translate('OpenLP.GeneralTab', 'Width')) + def resizeEvent(self, event=None): + """ + Rescale the theme preview thumbnail on resize events. + """ + if event: + SettingsTab.resizeEvent(self, event) + self.leftWidget.setMinimumWidth(max( + self.width() / 2 - self.generalLayout.contentsMargins().left(), + self.leftWidget.minimumSizeHint().width())) + def load(self): """ Load the settings to populate the form From 49e852b7e399bded6834de5a22da6518f4a7965a Mon Sep 17 00:00:00 2001 From: M2j Date: Sat, 1 Jan 2011 14:22:12 +0100 Subject: [PATCH 2/7] worked on setupUI for MainDisplay, MainWindow and PluginForm --- openlp/core/lib/dockwidget.py | 1 - openlp/core/ui/__init__.py | 9 +++-- openlp/core/ui/advancedtab.py | 11 ++++-- openlp/core/ui/generaltab.py | 13 ++++--- openlp/core/ui/maindisplay.py | 11 +++++- openlp/core/ui/mainwindow.py | 70 ++++++++++++---------------------- openlp/core/ui/plugindialog.py | 48 +++++------------------ openlp/core/ui/pluginform.py | 19 ++++----- 8 files changed, 73 insertions(+), 109 deletions(-) diff --git a/openlp/core/lib/dockwidget.py b/openlp/core/lib/dockwidget.py index 9c4187337..24841ec33 100644 --- a/openlp/core/lib/dockwidget.py +++ b/openlp/core/lib/dockwidget.py @@ -48,4 +48,3 @@ class OpenLPDockWidget(QtGui.QDockWidget): self.setObjectName(name) if icon: self.setWindowIcon(icon) - self.setFloating(False) diff --git a/openlp/core/ui/__init__.py b/openlp/core/ui/__init__.py index c806730c8..adb0d5679 100644 --- a/openlp/core/ui/__init__.py +++ b/openlp/core/ui/__init__.py @@ -29,9 +29,10 @@ The :mod:`ui` module provides the core user interface for OpenLP class HideMode(object): """ - This is basically an enumeration class which specifies the mode of a Bible. - Mode refers to whether or not a Bible in OpenLP is a full Bible or needs to - be downloaded from the Internet on an as-needed basis. + This is basically an enumeration class which specifies differnt hiding modes + for the display. The option ``Blank`` to cover the display black. The option + ``Theme`` removes the content from the theme. ``Screen`` finally hides the + output, so that the users desktop is usually shown. """ Blank = 1 Theme = 2 @@ -58,4 +59,4 @@ from thememanager import ThemeManager __all__ = ['SplashScreen', 'AboutForm', 'SettingsForm', 'MainDisplay', 'SlideController', 'ServiceManager', 'ThemeManager', - 'MediaDockManager', 'ServiceItemEditForm'] \ No newline at end of file + 'MediaDockManager', 'ServiceItemEditForm'] diff --git a/openlp/core/ui/advancedtab.py b/openlp/core/ui/advancedtab.py index 0e2a4e88d..da68956cb 100644 --- a/openlp/core/ui/advancedtab.py +++ b/openlp/core/ui/advancedtab.py @@ -133,13 +133,16 @@ class AdvancedTab(SettingsTab): def resizeEvent(self, event=None): """ - Rescale the theme preview thumbnail on resize events. + Resize the sides in two equal halves if the layout allows this. """ if event: SettingsTab.resizeEvent(self, event) - self.leftWidget.setMinimumWidth(max( - self.width() / 2 - self.advancedTabLayout.contentsMargins().left(), - self.leftWidget.minimumSizeHint().width())) + width = self.width() - self.advancedTabLayout.contentsMargins().left() \ + - self.advancedTabLayout.contentsMargins().right() + left_width = min(width - self.rightWidget.minimumSizeHint().width(), + width / 2) + left_width = max(left_width, self.leftWidget.minimumSizeHint().width()) + self.leftWidget.setMinimumWidth(left_width) def load(self): """ diff --git a/openlp/core/ui/generaltab.py b/openlp/core/ui/generaltab.py index 6a54d9636..dfb876597 100644 --- a/openlp/core/ui/generaltab.py +++ b/openlp/core/ui/generaltab.py @@ -85,7 +85,6 @@ class GeneralTab(SettingsTab): Create the user interface for the general settings tab """ self.setObjectName(u'GeneralTab') - self.tabTitleVisible = translate('OpenLP.GeneralTab', 'General') self.generalLayout = QtGui.QHBoxLayout(self) self.generalLayout.setSpacing(0) self.generalLayout.setObjectName(u'generalLayout') @@ -246,6 +245,7 @@ class GeneralTab(SettingsTab): """ Translate the general settings tab to the currently selected language """ + self.tabTitleVisible = translate('OpenLP.GeneralTab', 'General') self.monitorGroupBox.setTitle(translate('OpenLP.GeneralTab', 'Monitors')) self.monitorLabel.setText(translate('OpenLP.GeneralTab', @@ -301,13 +301,16 @@ class GeneralTab(SettingsTab): def resizeEvent(self, event=None): """ - Rescale the theme preview thumbnail on resize events. + Resize the sides in two equal halves if the layout allows this. """ if event: SettingsTab.resizeEvent(self, event) - self.leftWidget.setMinimumWidth(max( - self.width() / 2 - self.generalLayout.contentsMargins().left(), - self.leftWidget.minimumSizeHint().width())) + width = self.width() - self.generalLayout.contentsMargins().left() - \ + self.generalLayout.contentsMargins().right() + left_width = min(width - self.rightWidget.minimumSizeHint().width(), + width / 2) + left_width = max(left_width, self.leftWidget.minimumSizeHint().width()) + self.leftWidget.setMinimumWidth(left_width) def load(self): """ diff --git a/openlp/core/ui/maindisplay.py b/openlp/core/ui/maindisplay.py index dd24f172d..ef10b866a 100644 --- a/openlp/core/ui/maindisplay.py +++ b/openlp/core/ui/maindisplay.py @@ -31,7 +31,8 @@ import os from PyQt4 import QtCore, QtGui, QtWebKit from PyQt4.phonon import Phonon -from openlp.core.lib import Receiver, build_html, ServiceItem, image_to_byte +from openlp.core.lib import Receiver, build_html, ServiceItem, image_to_byte, \ + translate from openlp.core.ui import HideMode log = logging.getLogger(__name__) @@ -102,7 +103,7 @@ class MainDisplay(DisplayWidget): self.isLive = live self.alertTab = None self.hideMode = None - self.setWindowTitle(u'OpenLP Display') + self.retranslateUi() self.setStyleSheet(u'border: 0px; margin: 0px; padding: 0px;') self.setWindowFlags(QtCore.Qt.FramelessWindowHint | QtCore.Qt.WindowStaysOnTopHint) @@ -112,6 +113,12 @@ class MainDisplay(DisplayWidget): QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'maindisplay_show'), self.showDisplay) + def retranslateUi(self): + """ + Setup the interface translation strings. + """ + self.setWindowTitle(translate('OpenLP.MainDisplay', 'OpenLP Display')) + def setup(self): """ Set up and build the output screen diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index a378dd633..ff2692566 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -66,25 +66,10 @@ class Ui_MainWindow(object): MainWindow.setObjectName(u'MainWindow') MainWindow.resize(self.settingsmanager.width, self.settingsmanager.height) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, - QtGui.QSizePolicy.Expanding) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth( - MainWindow.sizePolicy().hasHeightForWidth()) - MainWindow.setSizePolicy(sizePolicy) - MainIcon = build_icon(u':/icon/openlp-logo-16x16.png') - MainWindow.setWindowIcon(MainIcon) - self.setDockNestingEnabled(True) + MainWindow.setWindowIcon(build_icon(u':/icon/openlp-logo-16x16.png')) + MainWindow.setDockNestingEnabled(True) # Set up the main container, which contains all the other form widgets. self.MainContent = QtGui.QWidget(MainWindow) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, - QtGui.QSizePolicy.Expanding) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth( - self.MainContent.sizePolicy().hasHeightForWidth()) - self.MainContent.setSizePolicy(sizePolicy) self.MainContent.setObjectName(u'MainContent') self.MainContentLayout = QtGui.QHBoxLayout(self.MainContent) self.MainContentLayout.setSpacing(0) @@ -93,7 +78,6 @@ class Ui_MainWindow(object): MainWindow.setCentralWidget(self.MainContent) self.ControlSplitter = QtGui.QSplitter(self.MainContent) self.ControlSplitter.setOrientation(QtCore.Qt.Horizontal) - self.ControlSplitter.setOpaqueResize(False) self.ControlSplitter.setObjectName(u'ControlSplitter') self.MainContentLayout.addWidget(self.ControlSplitter) # Create slide controllers @@ -109,7 +93,6 @@ class Ui_MainWindow(object): self.liveController.Panel.setVisible(liveVisible) # Create menu self.MenuBar = QtGui.QMenuBar(MainWindow) - self.MenuBar.setGeometry(QtCore.QRect(0, 0, 1087, 27)) self.MenuBar.setObjectName(u'MenuBar') self.FileMenu = QtGui.QMenu(self.MenuBar) self.FileMenu.setObjectName(u'FileMenu') @@ -147,38 +130,33 @@ class Ui_MainWindow(object): self.MediaManagerDock.setStyleSheet(MEDIA_MANAGER_STYLE) self.MediaManagerDock.setMinimumWidth( self.settingsmanager.mainwindow_left) - self.MediaManagerContents = QtGui.QWidget(MainWindow) - self.MediaManagerContents.setObjectName(u'MediaManagerContents') - self.MediaManagerLayout = QtGui.QHBoxLayout(self.MediaManagerContents) - self.MediaManagerLayout.setContentsMargins(0, 2, 0, 0) - self.MediaManagerLayout.setObjectName(u'MediaManagerLayout') # Create the media toolbox - self.MediaToolBox = QtGui.QToolBox(self.MediaManagerContents) + self.MediaToolBox = QtGui.QToolBox(self.MediaManagerDock) self.MediaToolBox.setObjectName(u'MediaToolBox') - self.MediaManagerLayout.addWidget(self.MediaToolBox) - self.MediaManagerDock.setWidget(self.MediaManagerContents) - MainWindow.addDockWidget( - QtCore.Qt.DockWidgetArea(1), self.MediaManagerDock) + self.MediaManagerDock.setWidget(self.MediaToolBox) + MainWindow.addDockWidget(QtCore.Qt.LeftDockWidgetArea, + self.MediaManagerDock) # Create the service manager self.ServiceManagerDock = OpenLPDockWidget( MainWindow, u'ServiceManagerDock', build_icon(u':/system/system_servicemanager.png')) self.ServiceManagerDock.setMinimumWidth( self.settingsmanager.mainwindow_right) - self.ServiceManagerContents = ServiceManager(self) + self.ServiceManagerContents = ServiceManager(MainWindow) self.ServiceManagerDock.setWidget(self.ServiceManagerContents) - MainWindow.addDockWidget( - QtCore.Qt.DockWidgetArea(2), self.ServiceManagerDock) + MainWindow.addDockWidget(QtCore.Qt.RightDockWidgetArea, + self.ServiceManagerDock) # Create the theme manager self.ThemeManagerDock = OpenLPDockWidget( MainWindow, u'ThemeManagerDock', build_icon(u':/system/system_thememanager.png')) self.ThemeManagerDock.setMinimumWidth( self.settingsmanager.mainwindow_right) - self.ThemeManagerContents = ThemeManager(self) + self.ThemeManagerContents = ThemeManager(MainWindow) + self.ThemeManagerContents.setObjectName(u'ThemeManagerContents') self.ThemeManagerDock.setWidget(self.ThemeManagerContents) - MainWindow.addDockWidget( - QtCore.Qt.DockWidgetArea(2), self.ThemeManagerDock) + MainWindow.addDockWidget(QtCore.Qt.RightDockWidgetArea, + self.ThemeManagerDock) # Create the menu items self.FileNewItem = QtGui.QAction(MainWindow) self.FileNewItem.setIcon(build_icon(u':/general/general_new.png')) @@ -275,9 +253,12 @@ class Ui_MainWindow(object): self.AutoLanguageItem.setCheckable(True) MainWindow.actionList.add_action(self.AutoLanguageItem, u'Settings') self.LanguageGroup = QtGui.QActionGroup(MainWindow) + self.LanguageGroup.setExclusive(True) + self.LanguageGroup.setObjectName(u'LanguageGroup') + self.AutoLanguageItem.setChecked(LanguageManager.auto_language) + self.LanguageGroup.setDisabled(LanguageManager.auto_language) qmList = LanguageManager.get_qm_list() savedLanguage = LanguageManager.get_language() - self.AutoLanguageItem.setChecked(LanguageManager.auto_language) for key in sorted(qmList.keys()): languageItem = QtGui.QAction(MainWindow) languageItem.setObjectName(key) @@ -285,7 +266,6 @@ class Ui_MainWindow(object): if qmList[key] == savedLanguage: languageItem.setChecked(True) add_actions(self.LanguageGroup, [languageItem]) - self.LanguageGroup.setDisabled(LanguageManager.auto_language) self.SettingsShortcutsItem = QtGui.QAction(MainWindow) self.SettingsShortcutsItem.setIcon( build_icon(u':/system/system_configure_shortcuts.png')) @@ -334,15 +314,13 @@ class Ui_MainWindow(object): add_actions(self.SettingsMenu, (self.SettingsPluginListItem, self.SettingsLanguageMenu.menuAction(), None, self.SettingsShortcutsItem, self.SettingsConfigureItem)) - add_actions(self.ToolsMenu, - (self.ToolsAddToolItem, None)) - add_actions(self.HelpMenu, - (self.HelpDocumentationItem, self.HelpOnlineHelpItem, None, - self.HelpWebSiteItem, self.HelpAboutItem)) - add_actions(self.MenuBar, - (self.FileMenu.menuAction(), self.ViewMenu.menuAction(), - self.ToolsMenu.menuAction(), self.SettingsMenu.menuAction(), - self.HelpMenu.menuAction())) + add_actions(self.ToolsMenu, (self.ToolsAddToolItem, None)) + add_actions(self.HelpMenu, (self.HelpDocumentationItem, + self.HelpOnlineHelpItem, None, self.HelpWebSiteItem, + self.HelpAboutItem)) + add_actions(self.MenuBar, (self.FileMenu.menuAction(), + self.ViewMenu.menuAction(), self.ToolsMenu.menuAction(), + self.SettingsMenu.menuAction(), self.HelpMenu.menuAction())) # Initialise the translation self.retranslateUi(MainWindow) self.MediaToolBox.setCurrentIndex(0) diff --git a/openlp/core/ui/plugindialog.py b/openlp/core/ui/plugindialog.py index 63d7ae014..74b2d36c0 100644 --- a/openlp/core/ui/plugindialog.py +++ b/openlp/core/ui/plugindialog.py @@ -31,69 +31,41 @@ class Ui_PluginViewDialog(object): def setupUi(self, pluginViewDialog): pluginViewDialog.setObjectName(u'pluginViewDialog') pluginViewDialog.setWindowModality(QtCore.Qt.ApplicationModal) - pluginViewDialog.resize(554, 344) self.pluginLayout = QtGui.QVBoxLayout(pluginViewDialog) - self.pluginLayout.setSpacing(8) - self.pluginLayout.setMargin(8) self.pluginLayout.setObjectName(u'pluginLayout') self.listLayout = QtGui.QHBoxLayout() - self.listLayout.setSpacing(8) self.listLayout.setObjectName(u'listLayout') self.pluginListWidget = QtGui.QListWidget(pluginViewDialog) - sizePolicy = QtGui.QSizePolicy( - QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Expanding) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth( - self.pluginListWidget.sizePolicy().hasHeightForWidth()) - self.pluginListWidget.setSizePolicy(sizePolicy) - self.pluginListWidget.setMaximumSize(QtCore.QSize(192, 16777215)) self.pluginListWidget.setObjectName(u'pluginListWidget') self.listLayout.addWidget(self.pluginListWidget) self.pluginInfoGroupBox = QtGui.QGroupBox(pluginViewDialog) - self.pluginInfoGroupBox.setAlignment( - QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter) - self.pluginInfoGroupBox.setFlat(False) self.pluginInfoGroupBox.setObjectName(u'pluginInfoGroupBox') self.pluginInfoLayout = QtGui.QFormLayout(self.pluginInfoGroupBox) - self.pluginInfoLayout.setMargin(8) - self.pluginInfoLayout.setSpacing(8) self.pluginInfoLayout.setObjectName(u'pluginInfoLayout') - self.versionLabel = QtGui.QLabel(self.pluginInfoGroupBox) - self.versionLabel.setObjectName(u'versionLabel') - self.pluginInfoLayout.setWidget( - 1, QtGui.QFormLayout.LabelRole, self.versionLabel) - self.versionNumberLabel = QtGui.QLabel(self.pluginInfoGroupBox) - self.versionNumberLabel.setObjectName(u'versionNumberLabel') - self.pluginInfoLayout.setWidget( - 1, QtGui.QFormLayout.FieldRole, self.versionNumberLabel) - self.aboutLabel = QtGui.QLabel(self.pluginInfoGroupBox) - self.aboutLabel.setObjectName(u'aboutLabel') - self.pluginInfoLayout.setWidget( - 2, QtGui.QFormLayout.LabelRole, self.aboutLabel) self.statusLabel = QtGui.QLabel(self.pluginInfoGroupBox) self.statusLabel.setObjectName(u'statusLabel') - self.pluginInfoLayout.setWidget( - 0, QtGui.QFormLayout.LabelRole, self.statusLabel) self.statusComboBox = QtGui.QComboBox(self.pluginInfoGroupBox) + self.statusComboBox.addItems((u'', u'')) self.statusComboBox.setObjectName(u'statusComboBox') - self.statusComboBox.addItem(QtCore.QString()) - self.statusComboBox.addItem(QtCore.QString()) - self.pluginInfoLayout.setWidget( - 0, QtGui.QFormLayout.FieldRole, self.statusComboBox) + self.pluginInfoLayout.addRow(self.statusLabel, self.statusComboBox) + self.versionLabel = QtGui.QLabel(self.pluginInfoGroupBox) + self.versionLabel.setObjectName(u'versionLabel') + self.versionNumberLabel = QtGui.QLabel(self.pluginInfoGroupBox) + self.versionNumberLabel.setObjectName(u'versionNumberLabel') + self.pluginInfoLayout.addRow(self.versionLabel, self.versionNumberLabel) + self.aboutLabel = QtGui.QLabel(self.pluginInfoGroupBox) + self.aboutLabel.setObjectName(u'aboutLabel') self.aboutTextBrowser = QtGui.QTextBrowser(self.pluginInfoGroupBox) self.aboutTextBrowser.setTextInteractionFlags( QtCore.Qt.LinksAccessibleByMouse) self.aboutTextBrowser.setObjectName(u'aboutTextBrowser') - self.pluginInfoLayout.setWidget( - 2, QtGui.QFormLayout.FieldRole, self.aboutTextBrowser) + self.pluginInfoLayout.addRow(self.aboutLabel, self.aboutTextBrowser) self.listLayout.addWidget(self.pluginInfoGroupBox) self.pluginLayout.addLayout(self.listLayout) self.pluginListButtonBox = QtGui.QDialogButtonBox(pluginViewDialog) self.pluginListButtonBox.setStandardButtons(QtGui.QDialogButtonBox.Ok) self.pluginListButtonBox.setObjectName(u'pluginListButtonBox') self.pluginLayout.addWidget(self.pluginListButtonBox) - self.versionNumberLabel.setText(u'') self.retranslateUi(pluginViewDialog) QtCore.QObject.connect(self.pluginListButtonBox, QtCore.SIGNAL(u'accepted()'), pluginViewDialog.close) diff --git a/openlp/core/ui/pluginform.py b/openlp/core/ui/pluginform.py index 4d3177ef3..26e6cf06c 100644 --- a/openlp/core/ui/pluginform.py +++ b/openlp/core/ui/pluginform.py @@ -67,23 +67,24 @@ class PluginForm(QtGui.QDialog, Ui_PluginViewDialog): # sometimes when it's loaded from the config, it isn't cast to int. plugin.status = int(plugin.status) # Set the little status text in brackets next to the plugin name. - status_text = unicode( - translate('OpenLP.PluginForm', '%s (Inactive)')) - if plugin.status == PluginStatus.Active: - status_text = unicode( - translate('OpenLP.PluginForm', '%s (Active)')) - elif plugin.status == PluginStatus.Inactive: - status_text = unicode( - translate('OpenLP.PluginForm', '%s (Inactive)')) - elif plugin.status == PluginStatus.Disabled: + if plugin.status == PluginStatus.Disabled: status_text = unicode( translate('OpenLP.PluginForm', '%s (Disabled)')) + elif plugin.status == PluginStatus.Active: + status_text = unicode( + translate('OpenLP.PluginForm', '%s (Active)')) + else: + # PluginStatus.Inactive + status_text = unicode( + translate('OpenLP.PluginForm', '%s (Inactive)')) name_string = plugin.getString(StringContent.Name) item.setText(status_text % name_string[u'singular']) # If the plugin has an icon, set it! if plugin.icon: item.setIcon(plugin.icon) self.pluginListWidget.addItem(item) + self.pluginListWidget.setFixedWidth( + self.pluginListWidget.sizeHint().width()) def _clearDetails(self): self.statusComboBox.setCurrentIndex(-1) From 2e6613edf493ce5bcf155646ab49af11f2b80917 Mon Sep 17 00:00:00 2001 From: M2j Date: Sun, 2 Jan 2011 23:24:14 +0100 Subject: [PATCH 3/7] simplified all setupUi() in openlp.core.ui and the setting tabs of the plugins --- openlp/core/ui/advancedtab.py | 8 +- openlp/core/ui/generaltab.py | 6 +- openlp/core/ui/serviceitemeditdialog.py | 51 ++---- openlp/core/ui/servicemanager.py | 9 +- openlp/core/ui/servicenotedialog.py | 19 +-- openlp/core/ui/settingsdialog.py | 26 ++- openlp/core/ui/shortcutlistdialog.py | 111 +++++------- openlp/core/ui/shortcutlistform.py | 17 +- openlp/core/ui/slidecontroller.py | 1 - openlp/core/ui/splashscreen.py | 34 +--- openlp/core/ui/themeform.py | 4 +- openlp/core/ui/thememanager.py | 17 +- openlp/core/ui/themestab.py | 39 ++--- openlp/plugins/alerts/lib/alertstab.py | 159 ++++++------------ openlp/plugins/bibles/lib/biblestab.py | 123 ++++++-------- openlp/plugins/bibles/lib/http.py | 2 +- openlp/plugins/custom/lib/customtab.py | 45 +++-- openlp/plugins/media/lib/mediatab.py | 47 ++++-- .../presentations/lib/presentationtab.py | 85 +++++----- openlp/plugins/remotes/lib/remotetab.py | 61 +++++-- openlp/plugins/songs/lib/songstab.py | 41 ++++- 21 files changed, 434 insertions(+), 471 deletions(-) diff --git a/openlp/core/ui/advancedtab.py b/openlp/core/ui/advancedtab.py index da68956cb..3ca7024e4 100644 --- a/openlp/core/ui/advancedtab.py +++ b/openlp/core/ui/advancedtab.py @@ -47,11 +47,11 @@ class AdvancedTab(SettingsTab): """ self.setObjectName(u'AdvancedTab') self.advancedTabLayout = QtGui.QHBoxLayout(self) - self.advancedTabLayout.setSpacing(0) self.advancedTabLayout.setObjectName(u'advancedTabLayout') self.leftWidget = QtGui.QWidget(self) self.leftWidget.setObjectName(u'leftWidget') self.leftLayout = QtGui.QVBoxLayout(self.leftWidget) + self.leftLayout.setMargin(0) self.leftLayout.setObjectName(u'leftLayout') self.uiGroupBox = QtGui.QGroupBox(self.leftWidget) self.uiGroupBox.setObjectName(u'uiGroupBox') @@ -97,6 +97,7 @@ class AdvancedTab(SettingsTab): self.rightWidget = QtGui.QWidget(self) self.rightWidget.setObjectName(u'rightWidget') self.rightLayout = QtGui.QVBoxLayout(self.rightWidget) + self.rightLayout.setMargin(0) self.rightLayout.setObjectName(u'rightLayout') # self.databaseGroupBox = QtGui.QGroupBox(self.rightWidget) # self.databaseGroupBox.setObjectName(u'databaseGroupBox') @@ -137,8 +138,9 @@ class AdvancedTab(SettingsTab): """ if event: SettingsTab.resizeEvent(self, event) - width = self.width() - self.advancedTabLayout.contentsMargins().left() \ - - self.advancedTabLayout.contentsMargins().right() + width = self.width() - self.advancedTabLayout.spacing() - \ + self.advancedTabLayout.contentsMargins().left() - \ + self.advancedTabLayout.contentsMargins().right() left_width = min(width - self.rightWidget.minimumSizeHint().width(), width / 2) left_width = max(left_width, self.leftWidget.minimumSizeHint().width()) diff --git a/openlp/core/ui/generaltab.py b/openlp/core/ui/generaltab.py index dfb876597..be3463e06 100644 --- a/openlp/core/ui/generaltab.py +++ b/openlp/core/ui/generaltab.py @@ -86,11 +86,11 @@ class GeneralTab(SettingsTab): """ self.setObjectName(u'GeneralTab') self.generalLayout = QtGui.QHBoxLayout(self) - self.generalLayout.setSpacing(0) self.generalLayout.setObjectName(u'generalLayout') self.leftWidget = QtGui.QWidget(self) self.leftWidget.setObjectName(u'leftWidget') self.leftLayout = QtGui.QVBoxLayout(self.leftWidget) + self.leftLayout.setMargin(0) self.leftLayout.setObjectName(u'leftLayout') self.monitorGroupBox = QtGui.QGroupBox(self.leftWidget) self.monitorGroupBox.setObjectName(u'monitorGroupBox') @@ -142,6 +142,7 @@ class GeneralTab(SettingsTab): self.rightWidget = QtGui.QWidget(self) self.rightWidget.setObjectName(u'rightWidget') self.rightLayout = QtGui.QVBoxLayout(self.rightWidget) + self.rightLayout.setMargin(0) self.rightLayout.setObjectName(u'rightLayout') self.ccliGroupBox = QtGui.QGroupBox(self.rightWidget) self.ccliGroupBox.setObjectName(u'ccliGroupBox') @@ -305,7 +306,8 @@ class GeneralTab(SettingsTab): """ if event: SettingsTab.resizeEvent(self, event) - width = self.width() - self.generalLayout.contentsMargins().left() - \ + width = self.width() - self.generalLayout.spacing() - \ + self.generalLayout.contentsMargins().left() - \ self.generalLayout.contentsMargins().right() left_width = min(width - self.rightWidget.minimumSizeHint().width(), width / 2) diff --git a/openlp/core/ui/serviceitemeditdialog.py b/openlp/core/ui/serviceitemeditdialog.py index 19639a7c2..3e1079ded 100644 --- a/openlp/core/ui/serviceitemeditdialog.py +++ b/openlp/core/ui/serviceitemeditdialog.py @@ -26,54 +26,37 @@ from PyQt4 import QtCore, QtGui -from openlp.core.lib import translate +from openlp.core.lib import translate, build_icon class Ui_ServiceItemEditDialog(object): def setupUi(self, serviceItemEditDialog): serviceItemEditDialog.setObjectName(u'serviceItemEditDialog') - serviceItemEditDialog.resize(386, 272) - self.layoutWidget = QtGui.QWidget(serviceItemEditDialog) - self.layoutWidget.setGeometry(QtCore.QRect(20, 20, 351, 241)) - self.layoutWidget.setObjectName(u'layoutWidget') - self.outerLayout = QtGui.QVBoxLayout(self.layoutWidget) - self.outerLayout.setObjectName(u'outerLayout') - self.topLayout = QtGui.QHBoxLayout() - self.topLayout.setObjectName(u'topLayout') - self.listWidget = QtGui.QListWidget(self.layoutWidget) + self.dialogLayout = QtGui.QGridLayout(serviceItemEditDialog) + self.dialogLayout.setObjectName(u'dialogLayout') + self.listWidget = QtGui.QListWidget(serviceItemEditDialog) self.listWidget.setAlternatingRowColors(True) self.listWidget.setObjectName(u'listWidget') - self.topLayout.addWidget(self.listWidget) + self.dialogLayout.addWidget(self.listWidget, 0, 0) self.buttonLayout = QtGui.QVBoxLayout() self.buttonLayout.setObjectName(u'buttonLayout') - self.deleteButton = QtGui.QPushButton(self.layoutWidget) + self.deleteButton = QtGui.QPushButton(serviceItemEditDialog) self.deleteButton.setObjectName(u'deleteButton') self.buttonLayout.addWidget(self.deleteButton) - spacerItem = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, - QtGui.QSizePolicy.Expanding) - self.buttonLayout.addItem(spacerItem) - self.upButton = QtGui.QPushButton(self.layoutWidget) - self.upButton.setText(u'') - icon = QtGui.QIcon() - icon.addPixmap(QtGui.QPixmap(u':/services/service_up.png'), - QtGui.QIcon.Normal, QtGui.QIcon.Off) - self.upButton.setIcon(icon) + self.buttonLayout.addStretch() + self.upButton = QtGui.QPushButton(serviceItemEditDialog) + self.upButton.setIcon(build_icon(u':/services/service_up.png')) self.upButton.setObjectName(u'upButton') self.buttonLayout.addWidget(self.upButton) - self.downButton = QtGui.QPushButton(self.layoutWidget) - self.downButton.setText(u'') - icon = QtGui.QIcon() - icon.addPixmap(QtGui.QPixmap(u':/services/service_down.png'), - QtGui.QIcon.Normal, QtGui.QIcon.Off) - self.downButton.setIcon(icon) + self.downButton = QtGui.QPushButton(serviceItemEditDialog) + self.downButton.setIcon(build_icon(u':/services/service_down.png')) self.downButton.setObjectName(u'downButton') self.buttonLayout.addWidget(self.downButton) - self.topLayout.addLayout(self.buttonLayout) - self.outerLayout.addLayout(self.topLayout) - self.buttonBox = QtGui.QDialogButtonBox(self.layoutWidget) - self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel | - QtGui.QDialogButtonBox.Save) + self.dialogLayout.addLayout(self.buttonLayout, 0, 1) + self.buttonBox = QtGui.QDialogButtonBox(serviceItemEditDialog) + self.buttonBox.setStandardButtons( + QtGui.QDialogButtonBox.Cancel | QtGui.QDialogButtonBox.Save) self.buttonBox.setObjectName(u'buttonBox') - self.outerLayout.addWidget(self.buttonBox) + self.dialogLayout.addWidget(self.buttonBox, 1, 0, 1, 2) self.retranslateUi(serviceItemEditDialog) QtCore.QMetaObject.connectSlotsByName(serviceItemEditDialog) @@ -82,4 +65,4 @@ class Ui_ServiceItemEditDialog(object): serviceItemEditDialog.setWindowTitle( translate('OpenLP.ServiceItemEditForm', 'Reorder Service Item')) self.deleteButton.setText(translate('OpenLP.ServiceItemEditForm', - 'Delete')) \ No newline at end of file + 'Delete')) diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index 9d7bada14..c81b44f69 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -118,7 +118,6 @@ class ServiceManager(QtGui.QWidget): self.layout = QtGui.QVBoxLayout(self) self.layout.setSpacing(0) self.layout.setMargin(0) - self.expandTabs = False # Create the top toolbar self.toolbar = OpenLPToolbar(self) self.toolbar.addToolbarButton( @@ -140,13 +139,16 @@ class ServiceManager(QtGui.QWidget): self.themeLabel = QtGui.QLabel(translate('OpenLP.ServiceManager', 'Theme:'), self) self.themeLabel.setMargin(3) + self.themeLabel.setObjectName(u'themeLabel') self.toolbar.addToolbarWidget(u'ThemeLabel', self.themeLabel) self.themeComboBox = QtGui.QComboBox(self.toolbar) self.themeComboBox.setToolTip(translate('OpenLP.ServiceManager', 'Select a theme for the service')) - self.themeComboBox.setSizeAdjustPolicy( - QtGui.QComboBox.AdjustToContents) + self.themeComboBox.setSizePolicy(QtGui.QSizePolicy.Expanding, + QtGui.QSizePolicy.Fixed) + self.themeComboBox.setObjectName(u'themeComboBox') self.toolbar.addToolbarWidget(u'ThemeWidget', self.themeComboBox) + self.toolbar.setObjectName(u'toolbar') self.layout.addWidget(self.toolbar) # Create the service manager list self.serviceManagerList = ServiceManagerList(self) @@ -216,6 +218,7 @@ class ServiceManager(QtGui.QWidget): translate('OpenLP.ServiceManager', 'Collapse all the service items.'), self.onCollapseAll) + self.orderToolbar.setObjectName(u'orderToolbar') self.layout.addWidget(self.orderToolbar) # Connect up our signals and slots QtCore.QObject.connect(self.themeComboBox, diff --git a/openlp/core/ui/servicenotedialog.py b/openlp/core/ui/servicenotedialog.py index eb3aba9d4..9a45dae7c 100644 --- a/openlp/core/ui/servicenotedialog.py +++ b/openlp/core/ui/servicenotedialog.py @@ -30,24 +30,19 @@ from openlp.core.lib import translate class Ui_ServiceNoteEdit(object): def setupUi(self, serviceNoteEdit): serviceNoteEdit.setObjectName(u'serviceNoteEdit') - serviceNoteEdit.resize(400, 243) - self.widget = QtGui.QWidget(serviceNoteEdit) - self.widget.setGeometry(QtCore.QRect(20, 10, 361, 223)) - self.widget.setObjectName(u'widget') - self.verticalLayout = QtGui.QVBoxLayout(self.widget) - self.verticalLayout.setObjectName(u'verticalLayout') - self.textEdit = QtGui.QTextEdit(self.widget) + self.dialogLayout = QtGui.QVBoxLayout(serviceNoteEdit) + self.dialogLayout.setObjectName(u'verticalLayout') + self.textEdit = QtGui.QTextEdit(serviceNoteEdit) self.textEdit.setObjectName(u'textEdit') - self.verticalLayout.addWidget(self.textEdit) - self.buttonBox = QtGui.QDialogButtonBox(self.widget) + self.dialogLayout.addWidget(self.textEdit) + self.buttonBox = QtGui.QDialogButtonBox(serviceNoteEdit) self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel | QtGui.QDialogButtonBox.Save) self.buttonBox.setObjectName(u'buttonBox') - self.verticalLayout.addWidget(self.buttonBox) - + self.dialogLayout.addWidget(self.buttonBox) self.retranslateUi(serviceNoteEdit) QtCore.QMetaObject.connectSlotsByName(serviceNoteEdit) def retranslateUi(self, serviceNoteEdit): serviceNoteEdit.setWindowTitle( - translate('OpenLP.ServiceNoteForm', 'Service Item Notes')) \ No newline at end of file + translate('OpenLP.ServiceNoteForm', 'Service Item Notes')) diff --git a/openlp/core/ui/settingsdialog.py b/openlp/core/ui/settingsdialog.py index d4bc8e110..29518f078 100644 --- a/openlp/core/ui/settingsdialog.py +++ b/openlp/core/ui/settingsdialog.py @@ -31,32 +31,28 @@ from openlp.core.lib import translate, build_icon class Ui_SettingsDialog(object): def setupUi(self, settingsDialog): settingsDialog.setObjectName(u'settingsDialog') - settingsDialog.resize(724, 502) + settingsDialog.resize(700, 300) settingsDialog.setWindowIcon( build_icon(u':/system/system_settings.png')) self.settingsLayout = QtGui.QVBoxLayout(settingsDialog) - self.settingsLayout.setSpacing(8) - self.settingsLayout.setMargin(8) + margins = self.settingsLayout.contentsMargins() + self.settingsLayout.setContentsMargins(0, margins.top(), 0, 0) self.settingsLayout.setObjectName(u'settingsLayout') self.settingsTabWidget = QtGui.QTabWidget(settingsDialog) + self.settingsTabWidget.setDocumentMode(True) self.settingsTabWidget.setObjectName(u'settingsTabWidget') self.settingsLayout.addWidget(self.settingsTabWidget) + self.buttonBoxLayout = QtGui.QGridLayout() + self.buttonBoxLayout.setContentsMargins(margins.left(), 0, + margins.right(), margins.bottom()) + self.buttonBoxLayout.setObjectName(u'buttonBoxLayout') self.buttonBox = QtGui.QDialogButtonBox(settingsDialog) - sizePolicy = QtGui.QSizePolicy( - QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth( - self.buttonBox.sizePolicy().hasHeightForWidth()) - self.buttonBox.setSizePolicy(sizePolicy) - self.buttonBox.setMaximumSize(QtCore.QSize(16777215, 16777215)) - self.buttonBox.setOrientation(QtCore.Qt.Horizontal) self.buttonBox.setStandardButtons( QtGui.QDialogButtonBox.Cancel | QtGui.QDialogButtonBox.Ok) self.buttonBox.setObjectName(u'buttonBox') - self.settingsLayout.addWidget(self.buttonBox) + self.buttonBoxLayout.addWidget(self.buttonBox) + self.settingsLayout.addLayout(self.buttonBoxLayout) self.retranslateUi(settingsDialog) - self.settingsTabWidget.setCurrentIndex(0) QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(u'accepted()'), settingsDialog.accept) QtCore.QObject.connect(self.buttonBox, @@ -65,4 +61,4 @@ class Ui_SettingsDialog(object): def retranslateUi(self, settingsDialog): settingsDialog.setWindowTitle(translate('OpenLP.SettingsForm', - 'Configure OpenLP')) \ No newline at end of file + 'Configure OpenLP')) diff --git a/openlp/core/ui/shortcutlistdialog.py b/openlp/core/ui/shortcutlistdialog.py index f66772d9b..32c50fe88 100644 --- a/openlp/core/ui/shortcutlistdialog.py +++ b/openlp/core/ui/shortcutlistdialog.py @@ -31,83 +31,58 @@ from openlp.core.lib import translate, build_icon class Ui_ShortcutListDialog(object): def setupUi(self, shortcutListDialog): shortcutListDialog.setObjectName(u'shortcutListDialog') - shortcutListDialog.resize(500, 438) - self.shortcutListLayout = QtGui.QVBoxLayout(shortcutListDialog) - self.shortcutListLayout.setSpacing(8) - self.shortcutListLayout.setMargin(8) - self.shortcutListLayout.setObjectName(u'shortcutListLayout') - self.shortcutListTreeWidget = QtGui.QTreeWidget(shortcutListDialog) - self.shortcutListTreeWidget.setAlternatingRowColors(True) - self.shortcutListTreeWidget.setObjectName(u'shortcutListTreeWidget') - self.shortcutListTreeWidget.setColumnCount(2) - self.shortcutListTreeWidget.setSelectionBehavior( - QtGui.QAbstractItemView.SelectRows) - self.shortcutListLayout.addWidget(self.shortcutListTreeWidget) - self.shortcutLayout = QtGui.QVBoxLayout() - self.shortcutLayout.setSpacing(8) - self.shortcutLayout.setContentsMargins(0, -1, -1, -1) - self.shortcutLayout.setObjectName(u'shortcutLayout') - self.defaultRadioButton = QtGui.QRadioButton(shortcutListDialog) - self.defaultRadioButton.setChecked(True) - self.defaultRadioButton.setObjectName(u'defaultRadioButton') - self.shortcutLayout.addWidget(self.defaultRadioButton) - self.customShortcutLayout = QtGui.QHBoxLayout() - self.customShortcutLayout.setSpacing(8) - self.customShortcutLayout.setObjectName(u'customShortcutLayout') - self.customRadioButton = QtGui.QRadioButton(shortcutListDialog) - self.customRadioButton.setObjectName(u'customRadioButton') - self.customShortcutLayout.addWidget(self.customRadioButton) - self.shortcutPushButton = QtGui.QPushButton(shortcutListDialog) - self.shortcutPushButton.setMinimumSize(QtCore.QSize(84, 0)) - self.shortcutPushButton.setIcon( +# shortcutListDialog.resize(500, 438) + self.dialogLayout = QtGui.QVBoxLayout(shortcutListDialog) + self.dialogLayout.setObjectName(u'dialogLayout') + self.treeWidget = QtGui.QTreeWidget(shortcutListDialog) + self.treeWidget.setAlternatingRowColors(True) + self.treeWidget.setObjectName(u'treeWidget') + self.treeWidget.setColumnCount(2) + self.dialogLayout.addWidget(self.treeWidget) + self.defaultButton = QtGui.QRadioButton(shortcutListDialog) + self.defaultButton.setChecked(True) + self.defaultButton.setObjectName(u'defaultButton') + self.dialogLayout.addWidget(self.defaultButton) + self.customLayout = QtGui.QHBoxLayout() + self.customLayout.setObjectName(u'customLayout') + self.customButton = QtGui.QRadioButton(shortcutListDialog) + self.customButton.setObjectName(u'customButton') + self.customLayout.addWidget(self.customButton) + self.shortcutButton = QtGui.QPushButton(shortcutListDialog) + self.shortcutButton.setIcon( build_icon(u':/system/system_configure_shortcuts.png')) - self.shortcutPushButton.setCheckable(True) - self.shortcutPushButton.setChecked(False) - self.shortcutPushButton.setObjectName(u'shortcutPushButton') - self.customShortcutLayout.addWidget(self.shortcutPushButton) - self.clearShortcutToolButton = QtGui.QToolButton(shortcutListDialog) - self.clearShortcutToolButton.setMinimumSize(QtCore.QSize(0, 16)) - self.clearShortcutToolButton.setText(u'') - self.clearShortcutToolButton.setIcon( + self.shortcutButton.setCheckable(True) + self.shortcutButton.setObjectName(u'shortcutButton') + self.customLayout.addWidget(self.shortcutButton) + self.clearShortcutButton = QtGui.QToolButton(shortcutListDialog) + self.clearShortcutButton.setIcon( build_icon(u':/system/clear_shortcut.png')) - self.clearShortcutToolButton.setObjectName(u'clearShortcutToolButton') - self.customShortcutLayout.addWidget(self.clearShortcutToolButton) - self.customShortcutSpacer = QtGui.QSpacerItem(40, 20, - QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) - self.customShortcutLayout.addItem(self.customShortcutSpacer) - self.shortcutLayout.addLayout(self.customShortcutLayout) - self.shortcutListLayout.addLayout(self.shortcutLayout) - self.shortcutListButtonBox = QtGui.QDialogButtonBox(shortcutListDialog) - self.shortcutListButtonBox.setOrientation(QtCore.Qt.Horizontal) - self.shortcutListButtonBox.setStandardButtons( - QtGui.QDialogButtonBox.Cancel | QtGui.QDialogButtonBox.Ok | - QtGui.QDialogButtonBox.Reset) - self.shortcutListButtonBox.setObjectName(u'shortcutListButtonBox') - self.shortcutListLayout.addWidget(self.shortcutListButtonBox) - + self.clearShortcutButton.setAutoRaise(True) + self.clearShortcutButton.setObjectName(u'clearShortcutButton') + self.customLayout.addWidget(self.clearShortcutButton) + self.customLayout.addStretch() + self.dialogLayout.addLayout(self.customLayout) + self.buttonBox = QtGui.QDialogButtonBox(shortcutListDialog) + self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel | + QtGui.QDialogButtonBox.Ok | QtGui.QDialogButtonBox.Reset) + self.buttonBox.setObjectName(u'buttonBox') + self.dialogLayout.addWidget(self.buttonBox) self.retranslateUi(shortcutListDialog) - QtCore.QObject.connect( - self.shortcutListButtonBox, - QtCore.SIGNAL(u'accepted()'), - shortcutListDialog.accept - ) - QtCore.QObject.connect( - self.shortcutListButtonBox, - QtCore.SIGNAL(u'rejected()'), - shortcutListDialog.reject - ) + QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(u'accepted()'), + shortcutListDialog.accept) + QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(u'rejected()'), + shortcutListDialog.reject) QtCore.QMetaObject.connectSlotsByName(shortcutListDialog) def retranslateUi(self, shortcutListDialog): shortcutListDialog.setWindowTitle( translate('OpenLP.ShortcutListDialog', 'Customize Shortcuts')) - self.shortcutListTreeWidget.setHeaderLabels([ + self.treeWidget.setHeaderLabels([ translate('OpenLP.ShortcutListDialog', 'Action'), - translate('OpenLP.ShortcutListDialog', 'Shortcut') - ]) - self.defaultRadioButton.setText( + translate('OpenLP.ShortcutListDialog', 'Shortcut')]) + self.defaultButton.setText( translate('OpenLP.ShortcutListDialog', 'Default: %s')) - self.customRadioButton.setText( + self.customButton.setText( translate('OpenLP.ShortcutListDialog', 'Custom:')) - self.shortcutPushButton.setText( + self.shortcutButton.setText( translate('OpenLP.ShortcutListDialog', 'None')) diff --git a/openlp/core/ui/shortcutlistform.py b/openlp/core/ui/shortcutlistform.py index 053f2347f..9d2b31853 100644 --- a/openlp/core/ui/shortcutlistform.py +++ b/openlp/core/ui/shortcutlistform.py @@ -49,11 +49,8 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog): self.setupUi(self) self.actionList = None self.captureShortcut = False - QtCore.QObject.connect( - self.shortcutPushButton, - QtCore.SIGNAL(u'toggled(bool)'), - self.onShortcutPushButtonClicked - ) + QtCore.QObject.connect(self.shortcutButton, + QtCore.SIGNAL(u'toggled(bool)'), self.onShortcutButtonClicked) def keyReleaseEvent(self, event): Qt = QtCore.Qt @@ -83,8 +80,8 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog): QtGui.QMessageBox.Ok ) else: - self.shortcutPushButton.setText(key_sequence.toString()) - self.shortcutPushButton.setChecked(False) + self.shortcutButton.setText(key_sequence.toString()) + self.shortcutButton.setChecked(False) self.captureShortcut = False def exec_(self, actionList): @@ -93,7 +90,7 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog): return QtGui.QDialog.exec_(self) def refreshActions(self): - self.shortcutListTreeWidget.clear() + self.treeWidget.clear() for category in self.actionList.categories: item = QtGui.QTreeWidgetItem([category.name]) for action in category.actions: @@ -103,7 +100,7 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog): actionItem.setIcon(0, action.icon()) item.addChild(actionItem) item.setExpanded(True) - self.shortcutListTreeWidget.addTopLevelItem(item) + self.treeWidget.addTopLevelItem(item) - def onShortcutPushButtonClicked(self, toggled): + def onShortcutButtonClicked(self, toggled): self.captureShortcut = toggled diff --git a/openlp/core/ui/slidecontroller.py b/openlp/core/ui/slidecontroller.py index 6a5e313f0..760bb002f 100644 --- a/openlp/core/ui/slidecontroller.py +++ b/openlp/core/ui/slidecontroller.py @@ -128,7 +128,6 @@ class SlideController(QtGui.QWidget): # Splitter self.Splitter = QtGui.QSplitter(self.Panel) self.Splitter.setOrientation(QtCore.Qt.Vertical) - self.Splitter.setOpaqueResize(False) self.PanelLayout.addWidget(self.Splitter) # Actual controller section self.Controller = QtGui.QWidget(self.Splitter) diff --git a/openlp/core/ui/splashscreen.py b/openlp/core/ui/splashscreen.py index 53546a6dd..8c2364ec2 100644 --- a/openlp/core/ui/splashscreen.py +++ b/openlp/core/ui/splashscreen.py @@ -26,33 +26,17 @@ from PyQt4 import QtCore, QtGui -class SplashScreen(object): +class SplashScreen(QtGui.QSplashScreen): def __init__(self): - self.splash_screen = QtGui.QSplashScreen() + QtGui.QSplashScreen.__init__(self) self.setupUi() def setupUi(self): - self.splash_screen.setObjectName(u'splash_screen') - self.splash_screen.setWindowModality(QtCore.Qt.NonModal) - self.splash_screen.setEnabled(True) - self.splash_screen.resize(370, 370) - sizePolicy = QtGui.QSizePolicy( - QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth( - self.splash_screen.sizePolicy().hasHeightForWidth()) - self.splash_screen.setSizePolicy(sizePolicy) - self.splash_screen.setContextMenuPolicy(QtCore.Qt.PreventContextMenu) + self.setObjectName(u'splash_screen') + self.setWindowFlags(self.windowFlags() | QtCore.Qt.WindowStaysOnTopHint) + self.setContextMenuPolicy(QtCore.Qt.PreventContextMenu) splash_image = QtGui.QPixmap(u':/graphics/openlp-splash-screen.png') - self.splash_screen.setPixmap(splash_image) - self.splash_screen.setMask(splash_image.mask()) - self.splash_screen.setWindowFlags( - QtCore.Qt.SplashScreen | QtCore.Qt.WindowStaysOnTopHint) - QtCore.QMetaObject.connectSlotsByName(self.splash_screen) - - def show(self): - self.splash_screen.show() - - def finish(self, widget): - self.splash_screen.finish(widget) \ No newline at end of file + self.setPixmap(splash_image) + self.setMask(splash_image.mask()) + self.resize(370, 370) + QtCore.QMetaObject.connectSlotsByName(self) diff --git a/openlp/core/ui/themeform.py b/openlp/core/ui/themeform.py index 5c9517b0e..310b34095 100644 --- a/openlp/core/ui/themeform.py +++ b/openlp/core/ui/themeform.py @@ -38,8 +38,8 @@ log = logging.getLogger(__name__) class ThemeForm(QtGui.QWizard, Ui_ThemeWizard): """ - This is the Bible Import Wizard, which allows easy importing of Bibles - into OpenLP from other formats like OSIS, CSV and OpenSong. + This is the Theme Import Wizard, which allows easy creation and editing of + OpenLP themes. """ log.info(u'ThemeWizardForm loaded') diff --git a/openlp/core/ui/thememanager.py b/openlp/core/ui/thememanager.py index 61216c161..0703402fd 100644 --- a/openlp/core/ui/thememanager.py +++ b/openlp/core/ui/thememanager.py @@ -49,12 +49,14 @@ class ThemeManager(QtGui.QWidget): QtGui.QWidget.__init__(self, parent) self.parent = parent self.settingsSection = u'themes' + self.themeForm = ThemeForm(self) + self.fileRenameForm = FileRenameForm(self) self.serviceComboBox = self.parent.ServiceManagerContents.themeComboBox + # start with the layout self.layout = QtGui.QVBoxLayout(self) self.layout.setSpacing(0) self.layout.setMargin(0) - self.themeForm = ThemeForm(self) - self.fileRenameForm = FileRenameForm(self) + self.layout.setObjectName(u'layout') self.toolbar = OpenLPToolbar(self) self.toolbar.addToolbarButton( translate('OpenLP.ThemeManager', 'New Theme'), @@ -82,13 +84,17 @@ class ThemeManager(QtGui.QWidget): u':/general/general_export.png', translate('OpenLP.ThemeManager', 'Export a theme.'), self.onExportTheme) - self.themeWidget = QtGui.QWidgetAction(self.toolbar) + self.toolbar.setObjectName(u'toolbar') self.layout.addWidget(self.toolbar) + self.themeWidget = QtGui.QWidgetAction(self.toolbar) + self.themeWidget.setObjectName(u'themeWidget') + # create theme manager list self.themeListWidget = QtGui.QListWidget(self) self.themeListWidget.setAlternatingRowColors(True) self.themeListWidget.setIconSize(QtCore.QSize(88, 50)) - self.layout.addWidget(self.themeListWidget) self.themeListWidget.setContextMenuPolicy(QtCore.Qt.CustomContextMenu) + self.themeListWidget.setObjectName(u'themeListWidget') + self.layout.addWidget(self.themeListWidget) QtCore.QObject.connect(self.themeListWidget, QtCore.SIGNAL('customContextMenuRequested(QPoint)'), self.contextMenu) @@ -106,8 +112,7 @@ class ThemeManager(QtGui.QWidget): self.deleteAction = self.menu.addAction( translate('OpenLP.ThemeManager', '&Delete Theme')) self.deleteAction.setIcon(build_icon(u':/general/general_delete.png')) - self.sep1 = self.menu.addAction(u'') - self.sep1.setSeparator(True) + self.separator = self.menu.addSeparator() self.globalAction = self.menu.addAction( translate('OpenLP.ThemeManager', 'Set As &Global Default')) self.globalAction.setIcon(build_icon(u':/general/general_export.png')) diff --git a/openlp/core/ui/themestab.py b/openlp/core/ui/themestab.py index 21df94d9d..3c3a51f43 100644 --- a/openlp/core/ui/themestab.py +++ b/openlp/core/ui/themestab.py @@ -40,14 +40,10 @@ class ThemesTab(SettingsTab): self.setObjectName(u'ThemesTab') self.tabTitleVisible = translate('OpenLP.ThemesTab', 'Themes') self.ThemesTabLayout = QtGui.QHBoxLayout(self) - self.ThemesTabLayout.setSpacing(8) - self.ThemesTabLayout.setMargin(8) self.ThemesTabLayout.setObjectName(u'ThemesTabLayout') self.GlobalGroupBox = QtGui.QGroupBox(self) self.GlobalGroupBox.setObjectName(u'GlobalGroupBox') self.GlobalGroupBoxLayout = QtGui.QVBoxLayout(self.GlobalGroupBox) - self.GlobalGroupBoxLayout.setSpacing(8) - self.GlobalGroupBoxLayout.setMargin(8) self.GlobalGroupBoxLayout.setObjectName(u'GlobalGroupBoxLayout') self.DefaultComboBox = QtGui.QComboBox(self.GlobalGroupBox) self.DefaultComboBox.setObjectName(u'DefaultComboBox') @@ -60,39 +56,30 @@ class ThemesTab(SettingsTab): self.LevelGroupBox.setObjectName(u'LevelGroupBox') self.LevelLayout = QtGui.QFormLayout(self.LevelGroupBox) self.LevelLayout.setLabelAlignment( - QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop) + QtCore.Qt.AlignLeft | QtCore.Qt.AlignTop) self.LevelLayout.setFormAlignment( - QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop) - self.LevelLayout.setMargin(8) - self.LevelLayout.setSpacing(8) + QtCore.Qt.AlignLeft | QtCore.Qt.AlignTop) self.LevelLayout.setObjectName(u'LevelLayout') self.SongLevelRadioButton = QtGui.QRadioButton(self.LevelGroupBox) self.SongLevelRadioButton.setObjectName(u'SongLevelRadioButton') - self.LevelLayout.setWidget(0, QtGui.QFormLayout.LabelRole, - self.SongLevelRadioButton) self.SongLevelLabel = QtGui.QLabel(self.LevelGroupBox) self.SongLevelLabel.setWordWrap(True) self.SongLevelLabel.setObjectName(u'SongLevelLabel') - self.LevelLayout.setWidget(0, QtGui.QFormLayout.FieldRole, - self.SongLevelLabel) + self.LevelLayout.addRow(self.SongLevelRadioButton, self.SongLevelLabel) self.ServiceLevelRadioButton = QtGui.QRadioButton(self.LevelGroupBox) self.ServiceLevelRadioButton.setObjectName(u'ServiceLevelRadioButton') - self.LevelLayout.setWidget(1, QtGui.QFormLayout.LabelRole, - self.ServiceLevelRadioButton) self.ServiceLevelLabel = QtGui.QLabel(self.LevelGroupBox) self.ServiceLevelLabel.setWordWrap(True) self.ServiceLevelLabel.setObjectName(u'ServiceLevelLabel') - self.LevelLayout.setWidget(1, QtGui.QFormLayout.FieldRole, + self.LevelLayout.addRow(self.ServiceLevelRadioButton, self.ServiceLevelLabel) self.GlobalLevelRadioButton = QtGui.QRadioButton(self.LevelGroupBox) self.GlobalLevelRadioButton.setChecked(True) self.GlobalLevelRadioButton.setObjectName(u'GlobalLevelRadioButton') - self.LevelLayout.setWidget(2, QtGui.QFormLayout.LabelRole, - self.GlobalLevelRadioButton) self.GlobalLevelLabel = QtGui.QLabel(self.LevelGroupBox) self.GlobalLevelLabel.setWordWrap(True) self.GlobalLevelLabel.setObjectName(u'GlobalLevelLabel') - self.LevelLayout.setWidget(2, QtGui.QFormLayout.FieldRole, + self.LevelLayout.addRow(self.GlobalLevelRadioButton, self.GlobalLevelLabel) self.ThemesTabLayout.addWidget(self.LevelGroupBox) QtCore.QObject.connect(self.SongLevelRadioButton, @@ -130,6 +117,20 @@ class ThemesTab(SettingsTab): translate('OpenLP.ThemesTab', 'Use the global theme, overriding ' 'any themes associated with either the service or the songs.')) + def resizeEvent(self, event=None): + """ + Resize the sides in two equal halves if the layout allows this. + """ + if event: + SettingsTab.resizeEvent(self, event) + width = self.width() - self.ThemesTabLayout.spacing() - \ + self.ThemesTabLayout.contentsMargins().left() - \ + self.ThemesTabLayout.contentsMargins().right() + left_width = min(width - self.LevelGroupBox.minimumSizeHint().width(), + width / 2) + left_width = max(left_width, self.GlobalGroupBox.minimumSizeHint().width()) + self.GlobalGroupBox.setMinimumWidth(left_width) + def load(self): settings = QtCore.QSettings() settings.beginGroup(self.settingsSection) @@ -212,4 +213,4 @@ class ThemesTab(SettingsTab): if not preview.isNull(): preview = preview.scaled(300, 255, QtCore.Qt.KeepAspectRatio, QtCore.Qt.SmoothTransformation) - self.DefaultListView.setPixmap(preview) \ No newline at end of file + self.DefaultListView.setPixmap(preview) diff --git a/openlp/plugins/alerts/lib/alertstab.py b/openlp/plugins/alerts/lib/alertstab.py index 4186627d8..80a824e3c 100644 --- a/openlp/plugins/alerts/lib/alertstab.py +++ b/openlp/plugins/alerts/lib/alertstab.py @@ -40,138 +40,71 @@ class AlertsTab(SettingsTab): def setupUi(self): self.setObjectName(u'AlertsTab') self.AlertsLayout = QtGui.QHBoxLayout(self) - self.AlertsLayout.setSpacing(8) - self.AlertsLayout.setMargin(8) self.AlertsLayout.setObjectName(u'AlertsLayout') - self.AlertLeftColumn = QtGui.QWidget(self) - self.AlertLeftColumn.setObjectName(u'AlertLeftColumn') - self.SlideLeftLayout = QtGui.QVBoxLayout(self.AlertLeftColumn) - self.SlideLeftLayout.setSpacing(8) - self.SlideLeftLayout.setMargin(0) - self.SlideLeftLayout.setObjectName(u'SlideLeftLayout') - self.FontGroupBox = QtGui.QGroupBox(self.AlertLeftColumn) + self.LeftColumn = QtGui.QWidget(self) + self.LeftColumn.setObjectName(u'LeftColumn') + self.LeftLayout = QtGui.QVBoxLayout(self.LeftColumn) + self.LeftLayout.setMargin(0) + self.LeftLayout.setObjectName(u'LeftLayout') + self.FontGroupBox = QtGui.QGroupBox(self.LeftColumn) self.FontGroupBox.setObjectName(u'FontGroupBox') - self.FontLayout = QtGui.QVBoxLayout(self.FontGroupBox) - self.FontLayout.setSpacing(8) - self.FontLayout.setMargin(8) + self.FontLayout = QtGui.QFormLayout(self.FontGroupBox) self.FontLayout.setObjectName(u'FontLayout') self.FontLabel = QtGui.QLabel(self.FontGroupBox) self.FontLabel.setObjectName(u'FontLabel') - self.FontLayout.addWidget(self.FontLabel) self.FontComboBox = QtGui.QFontComboBox(self.FontGroupBox) self.FontComboBox.setObjectName(u'FontComboBox') - self.FontLayout.addWidget(self.FontComboBox) - self.ColorWidget = QtGui.QWidget(self.FontGroupBox) - self.ColorWidget.setObjectName(u'ColorWidget') - self.ColorLayout = QtGui.QHBoxLayout(self.ColorWidget) - self.ColorLayout.setSpacing(8) - self.ColorLayout.setMargin(0) - self.ColorLayout.setObjectName(u'ColorLayout') - self.FontColorLabel = QtGui.QLabel(self.ColorWidget) + self.FontLayout.addRow(self.FontLabel, self.FontComboBox) + self.FontColorLabel = QtGui.QLabel(self.FontGroupBox) self.FontColorLabel.setObjectName(u'FontColorLabel') - self.ColorLayout.addWidget(self.FontColorLabel) - self.FontColorButton = QtGui.QPushButton(self.ColorWidget) + self.ColorLayout = QtGui.QHBoxLayout() + self.ColorLayout.setObjectName(u'ColorLayout') + self.FontColorButton = QtGui.QPushButton(self.FontGroupBox) self.FontColorButton.setObjectName(u'FontColorButton') self.ColorLayout.addWidget(self.FontColorButton) - self.ColorSpacerItem = QtGui.QSpacerItem(40, 20, - QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) - self.ColorLayout.addItem(self.ColorSpacerItem) - self.BackgroundColorLabel = QtGui.QLabel(self.ColorWidget) + self.ColorLayout.addSpacing(20) + self.BackgroundColorLabel = QtGui.QLabel(self.FontGroupBox) self.BackgroundColorLabel.setObjectName(u'BackgroundColorLabel') self.ColorLayout.addWidget(self.BackgroundColorLabel) - self.BackgroundColorButton = QtGui.QPushButton(self.ColorWidget) + self.BackgroundColorButton = QtGui.QPushButton(self.FontGroupBox) self.BackgroundColorButton.setObjectName(u'BackgroundColorButton') self.ColorLayout.addWidget(self.BackgroundColorButton) - self.FontLayout.addWidget(self.ColorWidget) - self.FontSizeWidget = QtGui.QWidget(self.FontGroupBox) - self.FontSizeWidget.setObjectName(u'FontSizeWidget') - self.FontSizeLayout = QtGui.QHBoxLayout(self.FontSizeWidget) - self.FontSizeLayout.setSpacing(8) - self.FontSizeLayout.setMargin(0) - self.FontSizeLayout.setObjectName(u'FontSizeLayout') - self.FontSizeLabel = QtGui.QLabel(self.FontSizeWidget) + self.FontLayout.addRow(self.FontColorLabel, self.ColorLayout) + self.FontSizeLabel = QtGui.QLabel(self.FontGroupBox) self.FontSizeLabel.setObjectName(u'FontSizeLabel') - self.FontSizeLayout.addWidget(self.FontSizeLabel) - self.FontSizeSpinBox = QtGui.QSpinBox(self.FontSizeWidget) + self.FontSizeSpinBox = QtGui.QSpinBox(self.FontGroupBox) self.FontSizeSpinBox.setObjectName(u'FontSizeSpinBox') - self.FontSizeLayout.addWidget(self.FontSizeSpinBox) - self.FontSizeSpacer = QtGui.QSpacerItem(147, 20, - QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) - self.FontSizeLayout.addItem(self.FontSizeSpacer) - self.FontLayout.addWidget(self.FontSizeWidget) - self.TimeoutWidget = QtGui.QWidget(self.FontGroupBox) - self.TimeoutWidget.setObjectName(u'TimeoutWidget') - self.TimeoutLayout = QtGui.QHBoxLayout(self.TimeoutWidget) - self.TimeoutLayout.setSpacing(8) - self.TimeoutLayout.setMargin(0) - self.TimeoutLayout.setObjectName(u'TimeoutLayout') - self.TimeoutLabel = QtGui.QLabel(self.TimeoutWidget) + self.FontLayout.addRow(self.FontSizeLabel, self.FontSizeSpinBox) + self.TimeoutLabel = QtGui.QLabel(self.FontGroupBox) self.TimeoutLabel.setObjectName(u'TimeoutLabel') - self.TimeoutLayout.addWidget(self.TimeoutLabel) - self.TimeoutSpinBox = QtGui.QSpinBox(self.TimeoutWidget) + self.TimeoutSpinBox = QtGui.QSpinBox(self.FontGroupBox) self.TimeoutSpinBox.setMaximum(180) self.TimeoutSpinBox.setObjectName(u'TimeoutSpinBox') - self.TimeoutLayout.addWidget(self.TimeoutSpinBox) - self.TimeoutSpacer = QtGui.QSpacerItem(147, 20, - QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) - self.TimeoutLayout.addItem(self.TimeoutSpacer) - self.FontLayout.addWidget(self.TimeoutWidget) - self.LocationWidget = QtGui.QWidget(self.FontGroupBox) - self.LocationWidget.setObjectName(u'LocationWidget') - self.LocationLayout = QtGui.QHBoxLayout(self.LocationWidget) - self.LocationLayout.setSpacing(8) - self.LocationLayout.setMargin(0) - self.LocationLayout.setObjectName(u'LocationLayout') - self.LocationLabel = QtGui.QLabel(self.LocationWidget) + self.FontLayout.addRow(self.TimeoutLabel, self.TimeoutSpinBox) + self.LocationLabel = QtGui.QLabel(self.FontGroupBox) self.LocationLabel.setObjectName(u'LocationLabel') - self.LocationLayout.addWidget(self.LocationLabel) - self.LocationComboBox = QtGui.QComboBox(self.LocationWidget) - self.LocationComboBox.addItem(QtCore.QString()) - self.LocationComboBox.addItem(QtCore.QString()) - self.LocationComboBox.addItem(QtCore.QString()) + self.LocationComboBox = QtGui.QComboBox(self.FontGroupBox) + self.LocationComboBox.addItems([u'', u'', u'']) self.LocationComboBox.setObjectName(u'LocationComboBox') - self.LocationLayout.addWidget(self.LocationComboBox) - self.LocationSpacer = QtGui.QSpacerItem(147, 20, - QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) - self.LocationLayout.addItem(self.LocationSpacer) - self.FontLayout.addWidget(self.LocationWidget) - self.SlideLeftLayout.addWidget(self.FontGroupBox) - self.SlideLeftSpacer = QtGui.QSpacerItem(20, 94, - QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) - self.SlideLeftLayout.addItem(self.SlideLeftSpacer) - self.AlertsLayout.addWidget(self.AlertLeftColumn) - self.AlertRightColumn = QtGui.QWidget(self) - self.AlertRightColumn.setObjectName(u'AlertRightColumn') - self.SlideRightLayout = QtGui.QVBoxLayout(self.AlertRightColumn) - self.SlideRightLayout.setSpacing(8) - self.SlideRightLayout.setMargin(0) - self.SlideRightLayout.setObjectName(u'SlideRightLayout') - self.PreviewGroupBox = QtGui.QGroupBox(self.AlertRightColumn) - sizePolicy = QtGui.QSizePolicy( - QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Minimum) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth( - self.PreviewGroupBox.sizePolicy().hasHeightForWidth()) - self.PreviewGroupBox.setSizePolicy(sizePolicy) + self.FontLayout.addRow(self.LocationLabel, self.LocationComboBox) + self.LeftLayout.addWidget(self.FontGroupBox) + self.LeftLayout.addStretch() + self.AlertsLayout.addWidget(self.LeftColumn) + self.RightColumn = QtGui.QWidget(self) + self.RightColumn.setObjectName(u'RightColumn') + self.RightLayout = QtGui.QVBoxLayout(self.RightColumn) + self.RightLayout.setMargin(0) + self.RightLayout.setObjectName(u'RightLayout') + self.PreviewGroupBox = QtGui.QGroupBox(self.RightColumn) self.PreviewGroupBox.setObjectName(u'PreviewGroupBox') self.PreviewLayout = QtGui.QVBoxLayout(self.PreviewGroupBox) - self.PreviewLayout.setSpacing(8) - self.PreviewLayout.setMargin(8) self.PreviewLayout.setObjectName(u'PreviewLayout') self.FontPreview = QtGui.QLineEdit(self.PreviewGroupBox) - self.FontPreview.setFixedSize(QtCore.QSize(350, 100)) - self.FontPreview.setReadOnly(True) - self.FontPreview.setFocusPolicy(QtCore.Qt.NoFocus) - self.FontPreview.setAlignment( - QtCore.Qt.AlignHCenter|QtCore.Qt.AlignVCenter) self.FontPreview.setObjectName(u'FontPreview') self.PreviewLayout.addWidget(self.FontPreview) - self.SlideRightLayout.addWidget(self.PreviewGroupBox) - self.SlideRightSpacer = QtGui.QSpacerItem(20, 40, - QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) - self.SlideRightLayout.addItem(self.SlideRightSpacer) - self.AlertsLayout.addWidget(self.AlertRightColumn) + self.RightLayout.addWidget(self.PreviewGroupBox) + self.RightLayout.addStretch() + self.AlertsLayout.addWidget(self.RightColumn) # Signals and slots QtCore.QObject.connect(self.BackgroundColorButton, QtCore.SIGNAL(u'pressed()'), self.onBackgroundColorButtonClicked) @@ -216,6 +149,20 @@ class AlertsTab(SettingsTab): self.LocationComboBox.setItemText(2, translate('AlertsPlugin.AlertsTab', 'Bottom')) + def resizeEvent(self, event=None): + """ + Resize the sides in two equal halves if the layout allows this. + """ + if event: + SettingsTab.resizeEvent(self, event) + width = self.width() - self.AlertsLayout.spacing() - \ + self.AlertsLayout.contentsMargins().left() - \ + self.AlertsLayout.contentsMargins().right() + left_width = min(width - self.RightColumn.minimumSizeHint().width(), + width / 2) + left_width = max(left_width, self.LeftColumn.minimumSizeHint().width()) + self.LeftColumn.setMinimumWidth(left_width) + def onBackgroundColorButtonClicked(self): new_color = QtGui.QColorDialog.getColor( QtGui.QColor(self.bg_color), self) @@ -294,4 +241,4 @@ class AlertsTab(SettingsTab): font.setPointSize(self.font_size) self.FontPreview.setFont(font) self.FontPreview.setStyleSheet(u'background-color: %s; color: %s' % - (self.bg_color, self.font_color)) \ No newline at end of file + (self.bg_color, self.font_color)) diff --git a/openlp/plugins/bibles/lib/biblestab.py b/openlp/plugins/bibles/lib/biblestab.py index c4815f2aa..adc451862 100644 --- a/openlp/plugins/bibles/lib/biblestab.py +++ b/openlp/plugins/bibles/lib/biblestab.py @@ -47,88 +47,57 @@ class BiblesTab(SettingsTab): def setupUi(self): self.setObjectName(u'BiblesTab') self.BibleLayout = QtGui.QHBoxLayout(self) - self.BibleLayout.setSpacing(8) - self.BibleLayout.setMargin(8) self.BibleLayout.setObjectName(u'BibleLayout') - self.BibleLeftWidget = QtGui.QWidget(self) - self.BibleLeftWidget.setObjectName(u'BibleLeftWidget') - self.BibleLeftLayout = QtGui.QVBoxLayout(self.BibleLeftWidget) - self.BibleLeftLayout.setObjectName(u'BibleLeftLayout') - self.BibleLeftLayout.setSpacing(8) - self.BibleLeftLayout.setMargin(0) - self.VerseDisplayGroupBox = QtGui.QGroupBox(self) + self.LeftWidget = QtGui.QWidget(self) + self.LeftWidget.setObjectName(u'LeftWidget') + self.LeftLayout = QtGui.QVBoxLayout(self.LeftWidget) + self.LeftLayout.setMargin(0) + self.LeftLayout.setObjectName(u'LeftLayout') + self.VerseDisplayGroupBox = QtGui.QGroupBox(self.LeftWidget) self.VerseDisplayGroupBox.setObjectName(u'VerseDisplayGroupBox') - self.VerseDisplayLayout = QtGui.QGridLayout(self.VerseDisplayGroupBox) - self.VerseDisplayLayout.setMargin(8) + self.VerseDisplayLayout = QtGui.QFormLayout(self.VerseDisplayGroupBox) self.VerseDisplayLayout.setObjectName(u'VerseDisplayLayout') self.NewChaptersCheckBox = QtGui.QCheckBox(self.VerseDisplayGroupBox) self.NewChaptersCheckBox.setObjectName(u'NewChaptersCheckBox') - self.VerseDisplayLayout.addWidget(self.NewChaptersCheckBox, 0, 0, 1, 1) - self.DisplayStyleWidget = QtGui.QWidget(self.VerseDisplayGroupBox) - self.DisplayStyleWidget.setObjectName(u'DisplayStyleWidget') - self.DisplayStyleLayout = QtGui.QHBoxLayout(self.DisplayStyleWidget) - self.DisplayStyleLayout.setSpacing(8) - self.DisplayStyleLayout.setMargin(0) - self.DisplayStyleLayout.setObjectName(u'DisplayStyleLayout') - self.DisplayStyleLabel = QtGui.QLabel(self.DisplayStyleWidget) + self.VerseDisplayLayout.addRow(self.NewChaptersCheckBox) + self.DisplayStyleLabel = QtGui.QLabel(self.VerseDisplayGroupBox) self.DisplayStyleLabel.setObjectName(u'DisplayStyleLabel') - self.DisplayStyleLayout.addWidget(self.DisplayStyleLabel) - self.DisplayStyleComboBox = QtGui.QComboBox(self.DisplayStyleWidget) + self.DisplayStyleComboBox = QtGui.QComboBox(self.VerseDisplayGroupBox) + self.DisplayStyleComboBox.addItems([u'', u'', u'', u'']) self.DisplayStyleComboBox.setObjectName(u'DisplayStyleComboBox') - self.DisplayStyleComboBox.addItem(QtCore.QString()) - self.DisplayStyleComboBox.addItem(QtCore.QString()) - self.DisplayStyleComboBox.addItem(QtCore.QString()) - self.DisplayStyleComboBox.addItem(QtCore.QString()) - self.DisplayStyleLayout.addWidget(self.DisplayStyleComboBox) - self.VerseDisplayLayout.addWidget(self.DisplayStyleWidget, 1, 0, 1, 1) - self.LayoutStyleWidget = QtGui.QWidget(self.VerseDisplayGroupBox) - self.LayoutStyleWidget.setObjectName(u'LayoutStyleWidget') - self.LayoutStyleLayout = QtGui.QHBoxLayout(self.LayoutStyleWidget) - self.LayoutStyleLayout.setSpacing(8) - self.LayoutStyleLayout.setMargin(0) - self.LayoutStyleLayout.setObjectName(u'LayoutStyleLayout') - self.LayoutStyleLabel = QtGui.QLabel(self.LayoutStyleWidget) + self.VerseDisplayLayout.addRow(self.DisplayStyleLabel, + self.DisplayStyleComboBox) + self.LayoutStyleLabel = QtGui.QLabel(self.VerseDisplayGroupBox) self.LayoutStyleLabel.setObjectName(u'LayoutStyleLabel') - self.LayoutStyleLayout.addWidget(self.LayoutStyleLabel) - self.LayoutStyleComboBox = QtGui.QComboBox(self.LayoutStyleWidget) + self.LayoutStyleComboBox = QtGui.QComboBox(self.VerseDisplayGroupBox) self.LayoutStyleComboBox.setObjectName(u'LayoutStyleComboBox') - self.LayoutStyleComboBox.addItem(QtCore.QString()) - self.LayoutStyleComboBox.addItem(QtCore.QString()) - self.LayoutStyleComboBox.addItem(QtCore.QString()) - self.LayoutStyleLayout.addWidget(self.LayoutStyleComboBox) - self.VerseDisplayLayout.addWidget(self.LayoutStyleWidget, 2, 0, 1, 1) - self.BibleThemeWidget = QtGui.QWidget(self.VerseDisplayGroupBox) - self.BibleThemeWidget.setObjectName(u'BibleThemeWidget') - self.BibleThemeLayout = QtGui.QHBoxLayout(self.BibleThemeWidget) - self.BibleThemeLayout.setSpacing(8) - self.BibleThemeLayout.setMargin(0) - self.BibleThemeLayout.setObjectName(u'BibleThemeLayout') - self.BibleThemeLabel = QtGui.QLabel(self.BibleThemeWidget) - self.BibleThemeLabel.setObjectName(u'BibleThemeLabel') - self.BibleThemeLayout.addWidget(self.BibleThemeLabel) - self.BibleThemeComboBox = QtGui.QComboBox(self.BibleThemeWidget) - self.BibleThemeComboBox.setObjectName(u'BibleThemeComboBox') - self.BibleThemeComboBox.addItem(QtCore.QString()) - self.BibleThemeLayout.addWidget(self.BibleThemeComboBox) + self.LayoutStyleComboBox.addItems([u'', u'', u'']) + self.VerseDisplayLayout.addRow(self.LayoutStyleLabel, + self.LayoutStyleComboBox) self.BibleSecondCheckBox = QtGui.QCheckBox(self.VerseDisplayGroupBox) self.BibleSecondCheckBox.setObjectName(u'BibleSecondCheckBox') - self.VerseDisplayLayout.addWidget(self.BibleSecondCheckBox, 3, 0, 1, 1) - self.VerseDisplayLayout.addWidget(self.BibleThemeWidget, 4, 0, 1, 1) + self.VerseDisplayLayout.addRow(self.BibleSecondCheckBox) + self.BibleThemeLabel = QtGui.QLabel(self.VerseDisplayGroupBox) + self.BibleThemeLabel.setObjectName(u'BibleThemeLabel') + self.BibleThemeComboBox = QtGui.QComboBox(self.VerseDisplayGroupBox) + self.BibleThemeComboBox.addItem(u'') + self.BibleThemeComboBox.setObjectName(u'BibleThemeComboBox') + self.VerseDisplayLayout.addRow(self.BibleThemeLabel, + self.BibleThemeComboBox) self.ChangeNoteLabel = QtGui.QLabel(self.VerseDisplayGroupBox) + self.ChangeNoteLabel.setWordWrap(True) self.ChangeNoteLabel.setObjectName(u'ChangeNoteLabel') - self.VerseDisplayLayout.addWidget(self.ChangeNoteLabel, 5, 0, 1, 1) - self.BibleLeftLayout.addWidget(self.VerseDisplayGroupBox) - self.BibleLeftSpacer = QtGui.QSpacerItem(40, 20, - QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) - self.BibleLeftLayout.addItem(self.BibleLeftSpacer) - self.BibleLayout.addWidget(self.BibleLeftWidget) - self.BibleRightWidget = QtGui.QWidget(self) - self.BibleRightWidget.setObjectName(u'BibleRightWidget') - self.BibleRightLayout = QtGui.QVBoxLayout(self.BibleRightWidget) - self.BibleRightLayout.setObjectName(u'BibleRightLayout') - self.BibleRightLayout.setSpacing(8) - self.BibleRightLayout.setMargin(0) - self.BibleLayout.addWidget(self.BibleRightWidget) + self.VerseDisplayLayout.addRow(self.ChangeNoteLabel) + self.LeftLayout.addWidget(self.VerseDisplayGroupBox) + self.LeftLayout.addStretch() + self.BibleLayout.addWidget(self.LeftWidget) + self.RightWidget = QtGui.QWidget(self) + self.RightWidget.setObjectName(u'RightWidget') + self.RightLayout = QtGui.QVBoxLayout(self.RightWidget) + self.RightLayout.setMargin(0) + self.RightLayout.setObjectName(u'RightLayout') + self.RightLayout.addStretch() + self.BibleLayout.addWidget(self.RightWidget) # Signals and slots QtCore.QObject.connect( self.NewChaptersCheckBox, QtCore.SIGNAL(u'stateChanged(int)'), @@ -179,6 +148,20 @@ class BiblesTab(SettingsTab): self.BibleSecondCheckBox.setText( translate('BiblesPlugin.BiblesTab', 'Display second Bible verses')) + def resizeEvent(self, event=None): + """ + Resize the sides in two equal halves if the layout allows this. + """ + if event: + SettingsTab.resizeEvent(self, event) + width = self.width() - self.BibleLayout.spacing() - \ + self.BibleLayout.contentsMargins().left() - \ + self.BibleLayout.contentsMargins().right() + left_width = min(width - self.RightWidget.minimumSizeHint().width(), + width / 2) + left_width = max(left_width, self.LeftWidget.minimumSizeHint().width()) + self.LeftWidget.setMinimumWidth(left_width) + def onBibleThemeComboBoxChanged(self): self.bible_theme = self.BibleThemeComboBox.currentText() @@ -251,4 +234,4 @@ class BiblesTab(SettingsTab): # Not Found. index = 0 self.bible_theme = u'' - self.BibleThemeComboBox.setCurrentIndex(index) \ No newline at end of file + self.BibleThemeComboBox.setCurrentIndex(index) diff --git a/openlp/plugins/bibles/lib/http.py b/openlp/plugins/bibles/lib/http.py index a4f93f929..f728b9e5c 100644 --- a/openlp/plugins/bibles/lib/http.py +++ b/openlp/plugins/bibles/lib/http.py @@ -488,7 +488,7 @@ class HTTPBible(BibleDB): Receiver.send_message(u'openlp_error_message', { u'title': translate('BiblesPlugin', 'No Book Found'), u'message': translate('BiblesPlugin', 'No matching ' - 'book could be found in this Bible. Check that you' + 'book could be found in this Bible. Check that you ' 'have spelled the name of the book correctly.') }) return [] diff --git a/openlp/plugins/custom/lib/customtab.py b/openlp/plugins/custom/lib/customtab.py index 5063ee995..9fce7a007 100644 --- a/openlp/plugins/custom/lib/customtab.py +++ b/openlp/plugins/custom/lib/customtab.py @@ -37,21 +37,30 @@ class CustomTab(SettingsTab): def setupUi(self): self.setObjectName(u'CustomTab') - self.customLayout = QtGui.QFormLayout(self) - self.customLayout.setSpacing(8) - self.customLayout.setMargin(8) + self.customLayout = QtGui.QHBoxLayout(self) self.customLayout.setObjectName(u'customLayout') - self.customModeGroupBox = QtGui.QGroupBox(self) + self.leftWidget = QtGui.QWidget(self) + self.leftWidget.setObjectName(u'leftWidget') + self.leftLayout = QtGui.QVBoxLayout(self.leftWidget) + self.leftLayout.setMargin(0) + self.leftLayout.setObjectName(u'leftLayout') + self.customModeGroupBox = QtGui.QGroupBox(self.leftWidget) self.customModeGroupBox.setObjectName(u'customModeGroupBox') - self.customModeLayout = QtGui.QVBoxLayout(self.customModeGroupBox) - self.customModeLayout.setSpacing(8) - self.customModeLayout.setMargin(8) + self.customModeLayout = QtGui.QFormLayout(self.customModeGroupBox) self.customModeLayout.setObjectName(u'customModeLayout') self.displayFooterCheckBox = QtGui.QCheckBox(self.customModeGroupBox) self.displayFooterCheckBox.setObjectName(u'displayFooterCheckBox') - self.customModeLayout.addWidget(self.displayFooterCheckBox) - self.customLayout.setWidget( - 0, QtGui.QFormLayout.LabelRole, self.customModeGroupBox) + self.customModeLayout.addRow(self.displayFooterCheckBox) + self.leftLayout.addWidget(self.customModeGroupBox) + self.leftLayout.addStretch() + self.customLayout.addWidget(self.leftWidget) + self.rightWidget = QtGui.QWidget(self) + self.rightWidget.setObjectName(u'rightWidget') + self.rightLayout = QtGui.QVBoxLayout(self.rightWidget) + self.rightLayout.setMargin(0) + self.rightLayout.setObjectName(u'rightLayout') + self.rightLayout.addStretch() + self.customLayout.addWidget(self.rightWidget) QtCore.QObject.connect(self.displayFooterCheckBox, QtCore.SIGNAL(u'stateChanged(int)'), self.onDisplayFooterCheckBoxChanged) @@ -62,6 +71,20 @@ class CustomTab(SettingsTab): self.displayFooterCheckBox.setText( translate('CustomPlugin.CustomTab', 'Display footer')) + def resizeEvent(self, event=None): + """ + Resize the sides in two equal halves if the layout allows this. + """ + if event: + SettingsTab.resizeEvent(self, event) + width = self.width() - self.customLayout.spacing() - \ + self.customLayout.contentsMargins().left() - \ + self.customLayout.contentsMargins().right() + left_width = min(width - self.rightWidget.minimumSizeHint().width(), + width / 2) + left_width = max(left_width, self.leftWidget.minimumSizeHint().width()) + self.leftWidget.setMinimumWidth(left_width) + def onDisplayFooterCheckBoxChanged(self, check_state): self.displayFooter = False # we have a set value convert to True/False @@ -76,4 +99,4 @@ class CustomTab(SettingsTab): def save(self): QtCore.QSettings().setValue(self.settingsSection + u'/display footer', - QtCore.QVariant(self.displayFooter)) \ No newline at end of file + QtCore.QVariant(self.displayFooter)) diff --git a/openlp/plugins/media/lib/mediatab.py b/openlp/plugins/media/lib/mediatab.py index 2fc372070..8b54afb89 100644 --- a/openlp/plugins/media/lib/mediatab.py +++ b/openlp/plugins/media/lib/mediatab.py @@ -37,32 +37,55 @@ class MediaTab(SettingsTab): def setupUi(self): self.setObjectName(u'MediaTab') - self.tabTitleVisible = translate('MediaPlugin.MediaTab', 'Media') - self.mediaLayout = QtGui.QFormLayout(self) - self.mediaLayout.setSpacing(8) - self.mediaLayout.setMargin(8) + self.mediaLayout = QtGui.QHBoxLayout(self) self.mediaLayout.setObjectName(u'mediaLayout') - self.mediaModeGroupBox = QtGui.QGroupBox(self) + self.leftWidget = QtGui.QWidget(self) + self.leftWidget.setObjectName(u'leftWidget') + self.leftLayout = QtGui.QVBoxLayout(self.leftWidget) + self.leftLayout.setMargin(0) + self.leftLayout.setObjectName(u'leftLayout') + self.mediaModeGroupBox = QtGui.QGroupBox(self.leftWidget) self.mediaModeGroupBox.setObjectName(u'mediaModeGroupBox') - self.mediaModeLayout = QtGui.QVBoxLayout(self.mediaModeGroupBox) - self.mediaModeLayout.setSpacing(8) - self.mediaModeLayout.setMargin(8) + self.mediaModeLayout = QtGui.QFormLayout(self.mediaModeGroupBox) self.mediaModeLayout.setObjectName(u'mediaModeLayout') self.usePhononCheckBox = QtGui.QCheckBox(self.mediaModeGroupBox) self.usePhononCheckBox.setObjectName(u'usePhononCheckBox') - self.mediaModeLayout.addWidget(self.usePhononCheckBox) - self.mediaLayout.setWidget( - 0, QtGui.QFormLayout.LabelRole, self.mediaModeGroupBox) + self.mediaModeLayout.addRow(self.usePhononCheckBox) + self.leftLayout.addWidget(self.mediaModeGroupBox) + self.leftLayout.addStretch() + self.mediaLayout.addWidget(self.leftWidget) + self.rightWidget = QtGui.QWidget(self) + self.rightWidget.setObjectName(u'rightWidget') + self.rightLayout = QtGui.QVBoxLayout(self.rightWidget) + self.rightLayout.setMargin(0) + self.rightLayout.setObjectName(u'rightLayout') + self.rightLayout.addStretch() + self.mediaLayout.addWidget(self.rightWidget) QtCore.QObject.connect(self.usePhononCheckBox, QtCore.SIGNAL(u'stateChanged(int)'), self.onUsePhononCheckBoxChanged) def retranslateUi(self): + self.tabTitleVisible = translate('MediaPlugin.MediaTab', 'Media') self.mediaModeGroupBox.setTitle(translate('MediaPlugin.MediaTab', 'Media Display')) self.usePhononCheckBox.setText( translate('MediaPlugin.MediaTab', 'Use Phonon for video playback')) + def resizeEvent(self, event=None): + """ + Resize the sides in two equal halves if the layout allows this. + """ + if event: + SettingsTab.resizeEvent(self, event) + width = self.width() - self.mediaLayout.spacing() - \ + self.mediaLayout.contentsMargins().left() - \ + self.mediaLayout.contentsMargins().right() + left_width = min(width - self.rightWidget.minimumSizeHint().width(), + width / 2) + left_width = max(left_width, self.leftWidget.minimumSizeHint().width()) + self.leftWidget.setMinimumWidth(left_width) + def onUsePhononCheckBoxChanged(self, check_state): self.usePhonon = (check_state == QtCore.Qt.Checked) self.usePhononChanged = True @@ -79,4 +102,4 @@ class MediaTab(SettingsTab): if oldUsePhonon != self.usePhonon: QtCore.QSettings().setValue(self.settingsSection + u'/use phonon', QtCore.QVariant(self.usePhonon)) - Receiver.send_message(u'config_screen_changed') \ No newline at end of file + Receiver.send_message(u'config_screen_changed') diff --git a/openlp/plugins/presentations/lib/presentationtab.py b/openlp/plugins/presentations/lib/presentationtab.py index cd4dd7901..066577006 100644 --- a/openlp/plugins/presentations/lib/presentationtab.py +++ b/openlp/plugins/presentations/lib/presentationtab.py @@ -45,69 +45,48 @@ class PresentationTab(SettingsTab): """ self.setObjectName(u'PresentationTab') self.PresentationLayout = QtGui.QHBoxLayout(self) - self.PresentationLayout.setSpacing(8) - self.PresentationLayout.setMargin(8) self.PresentationLayout.setObjectName(u'PresentationLayout') - self.PresentationLeftWidget = QtGui.QWidget(self) - self.PresentationLeftWidget.setObjectName(u'PresentationLeftWidget') - self.PresentationLeftLayout = QtGui.QVBoxLayout( - self.PresentationLeftWidget) - self.PresentationLeftLayout.setObjectName(u'PresentationLeftLayout') - self.PresentationLeftLayout.setSpacing(8) - self.PresentationLeftLayout.setMargin(0) - self.VerseDisplayGroupBox = QtGui.QGroupBox(self) - self.VerseDisplayGroupBox.setObjectName(u'VerseDisplayGroupBox') - self.VerseDisplayLayout = QtGui.QVBoxLayout(self.VerseDisplayGroupBox) - self.VerseDisplayLayout.setMargin(8) - self.VerseDisplayLayout.setObjectName(u'VerseDisplayLayout') + self.LeftWidget = QtGui.QWidget(self) + self.LeftWidget.setObjectName(u'LeftWidget') + self.LeftLayout = QtGui.QVBoxLayout(self.LeftWidget) + self.LeftLayout.setMargin(0) + self.LeftLayout.setObjectName(u'LeftLayout') + self.ControllersGroupBox = QtGui.QGroupBox(self.LeftWidget) + self.ControllersGroupBox.setObjectName(u'ControllersGroupBox') + self.ControllersLayout = QtGui.QVBoxLayout(self.ControllersGroupBox) + self.ControllersLayout.setObjectName(u'ControllersLayout') self.PresenterCheckboxes = {} for key in self.controllers: controller = self.controllers[key] - checkbox = QtGui.QCheckBox(self.VerseDisplayGroupBox) - checkbox.setTristate(False) + checkbox = QtGui.QCheckBox(self.ControllersGroupBox) checkbox.setEnabled(controller.available) checkbox.setObjectName(controller.name + u'CheckBox') self.PresenterCheckboxes[controller.name] = checkbox - self.VerseDisplayLayout.addWidget(checkbox) - self.PresentationThemeWidget = QtGui.QWidget(self.VerseDisplayGroupBox) - self.PresentationThemeWidget.setObjectName(u'PresentationThemeWidget') - self.PresentationThemeLayout = QtGui.QHBoxLayout( - self.PresentationThemeWidget) - self.PresentationThemeLayout.setSpacing(8) - self.PresentationThemeLayout.setMargin(0) - self.PresentationThemeLayout.setObjectName(u'PresentationThemeLayout') - self.AdvancedGroupBox = QtGui.QGroupBox(self) + self.ControllersLayout.addWidget(checkbox) + self.LeftLayout.addWidget(self.ControllersGroupBox) + self.AdvancedGroupBox = QtGui.QGroupBox(self.LeftWidget) self.AdvancedGroupBox.setObjectName(u'AdvancedGroupBox') self.AdvancedLayout = QtGui.QVBoxLayout(self.AdvancedGroupBox) - self.AdvancedLayout.setSpacing(8) - self.AdvancedLayout.setMargin(8) self.AdvancedLayout.setObjectName(u'AdvancedLayout') self.OverrideAppCheckBox = QtGui.QCheckBox(self.AdvancedGroupBox) self.OverrideAppCheckBox.setObjectName(u'OverrideAppCheckBox') self.AdvancedLayout.addWidget(self.OverrideAppCheckBox) - self.PresentationLeftLayout.addWidget(self.VerseDisplayGroupBox) - self.PresentationLeftLayout.addWidget(self.AdvancedGroupBox) - self.PresentationLeftSpacer = QtGui.QSpacerItem(40, 20, - QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) - self.PresentationLeftLayout.addItem(self.PresentationLeftSpacer) - self.PresentationLayout.addWidget(self.PresentationLeftWidget) - self.PresentationRightWidget = QtGui.QWidget(self) - self.PresentationRightWidget.setObjectName(u'PresentationRightWidget') - self.PresentationRightLayout = QtGui.QVBoxLayout( - self.PresentationRightWidget) - self.PresentationRightLayout.setObjectName(u'PresentationRightLayout') - self.PresentationRightLayout.setSpacing(8) - self.PresentationRightLayout.setMargin(0) - self.PresentationRightSpacer = QtGui.QSpacerItem(50, 20, - QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) - self.PresentationRightLayout.addItem(self.PresentationRightSpacer) - self.PresentationLayout.addWidget(self.PresentationRightWidget) + self.LeftLayout.addWidget(self.AdvancedGroupBox) + self.LeftLayout.addStretch() + self.PresentationLayout.addWidget(self.LeftWidget) + self.RightWidget = QtGui.QWidget(self) + self.RightWidget.setObjectName(u'RightWidget') + self.RightLayout = QtGui.QVBoxLayout(self.RightWidget) + self.RightLayout.setMargin(0) + self.RightLayout.setObjectName(u'RightLayout') + self.RightLayout.addStretch() + self.PresentationLayout.addWidget(self.RightWidget) def retranslateUi(self): """ Make any translation changes """ - self.VerseDisplayGroupBox.setTitle( + self.ControllersGroupBox.setTitle( translate('PresentationPlugin.PresentationTab', 'Available Controllers')) for key in self.controllers: @@ -121,6 +100,20 @@ class PresentationTab(SettingsTab): translate('PresentationPlugin.PresentationTab', 'Allow presentation application to be overriden')) + def resizeEvent(self, event=None): + """ + Resize the sides in two equal halves if the layout allows this. + """ + if event: + SettingsTab.resizeEvent(self, event) + width = self.width() - self.PresentationLayout.spacing() - \ + self.PresentationLayout.contentsMargins().left() - \ + self.PresentationLayout.contentsMargins().right() + left_width = min(width - self.RightWidget.minimumSizeHint().width(), + width / 2) + left_width = max(left_width, self.LeftWidget.minimumSizeHint().width()) + self.LeftWidget.setMinimumWidth(left_width) + def load(self): """ Load the settings. @@ -160,4 +153,4 @@ class PresentationTab(SettingsTab): QtCore.QVariant(self.OverrideAppCheckBox.checkState())) changed = True if changed: - Receiver.send_message(u'mediaitem_presentation_rebuild') \ No newline at end of file + Receiver.send_message(u'mediaitem_presentation_rebuild') diff --git a/openlp/plugins/remotes/lib/remotetab.py b/openlp/plugins/remotes/lib/remotetab.py index e81cc99ae..4fc66e30e 100644 --- a/openlp/plugins/remotes/lib/remotetab.py +++ b/openlp/plugins/remotes/lib/remotetab.py @@ -37,34 +37,63 @@ class RemoteTab(SettingsTab): def setupUi(self): self.setObjectName(u'RemoteTab') - self.remoteLayout = QtGui.QFormLayout(self) - self.remoteLayout.setSpacing(8) - self.remoteLayout.setMargin(8) + self.remoteLayout = QtGui.QHBoxLayout(self) self.remoteLayout.setObjectName(u'remoteLayout') - self.serverSettingsGroupBox = QtGui.QGroupBox(self) + self.leftWidget = QtGui.QWidget(self) + self.leftWidget.setSizePolicy(QtGui.QSizePolicy.Fixed, + QtGui.QSizePolicy.Preferred) + self.leftWidget.setObjectName(u'leftWidget') + self.leftLayout = QtGui.QVBoxLayout(self.leftWidget) + self.leftLayout.setMargin(0) + self.leftLayout.setObjectName(u'leftLayout') + self.serverSettingsGroupBox = QtGui.QGroupBox(self.leftWidget) self.serverSettingsGroupBox.setObjectName(u'serverSettingsGroupBox') self.serverSettingsLayout = QtGui.QFormLayout( self.serverSettingsGroupBox) - self.serverSettingsLayout.setSpacing(8) - self.serverSettingsLayout.setMargin(8) self.serverSettingsLayout.setObjectName(u'serverSettingsLayout') + self.addressLabel = QtGui.QLabel(self.serverSettingsGroupBox) + self.addressLabel.setObjectName(u'addressLabel') self.addressEdit = QtGui.QLineEdit(self.serverSettingsGroupBox) self.addressEdit.setObjectName(u'addressEdit') - self.serverSettingsLayout.addRow( - translate('RemotePlugin.RemoteTab', 'Serve on IP address:'), - self.addressEdit) + self.serverSettingsLayout.addRow(self.addressLabel, self.addressEdit) + self.portLabel = QtGui.QLabel(self.serverSettingsGroupBox) + self.portLabel.setObjectName(u'portLabel') self.portSpinBox = QtGui.QSpinBox(self.serverSettingsGroupBox) - self.portSpinBox.setObjectName(u'portSpinBox') self.portSpinBox.setMaximum(32767) - self.serverSettingsLayout.addRow( - translate('RemotePlugin.RemoteTab', 'Port number:'), - self.portSpinBox) - self.remoteLayout.setWidget( - 0, QtGui.QFormLayout.LabelRole, self.serverSettingsGroupBox) + self.portSpinBox.setObjectName(u'portSpinBox') + self.serverSettingsLayout.addRow(self.portLabel, self.portSpinBox) + self.leftLayout.addWidget(self.serverSettingsGroupBox) + self.leftLayout.addStretch() + self.remoteLayout.addWidget(self.leftWidget) + self.rightWidget = QtGui.QWidget(self) + self.rightWidget.setObjectName(u'rightWidget') + self.rightLayout = QtGui.QVBoxLayout(self.rightWidget) + self.rightLayout.setMargin(0) + self.rightLayout.setObjectName(u'rightLayout') + self.rightLayout.addStretch() + self.remoteLayout.addWidget(self.rightWidget) def retranslateUi(self): self.serverSettingsGroupBox.setTitle( translate('RemotePlugin.RemoteTab', 'Server Settings')) + self.addressLabel.setText(translate('RemotePlugin.RemoteTab', + 'Serve on IP address:')) + self.portLabel.setText(translate('RemotePlugin.RemoteTab', + 'Port number:')) + + def resizeEvent(self, event=None): + """ + Resize the sides in two equal halves if the layout allows this. + """ + if event: + SettingsTab.resizeEvent(self, event) + width = self.width() - self.remoteLayout.spacing() - \ + self.remoteLayout.contentsMargins().left() - \ + self.remoteLayout.contentsMargins().right() + left_width = min(width - self.rightWidget.minimumSizeHint().width(), + width / 2) + left_width = max(left_width, self.leftWidget.minimumSizeHint().width()) + self.leftWidget.setMinimumWidth(left_width) def load(self): self.portSpinBox.setValue( @@ -78,4 +107,4 @@ class RemoteTab(SettingsTab): QtCore.QSettings().setValue(self.settingsSection + u'/port', QtCore.QVariant(self.portSpinBox.value())) QtCore.QSettings().setValue(self.settingsSection + u'/ip address', - QtCore.QVariant(self.addressEdit.text())) \ No newline at end of file + QtCore.QVariant(self.addressEdit.text())) diff --git a/openlp/plugins/songs/lib/songstab.py b/openlp/plugins/songs/lib/songstab.py index 25c7ba6df..b1647bf64 100644 --- a/openlp/plugins/songs/lib/songstab.py +++ b/openlp/plugins/songs/lib/songstab.py @@ -37,15 +37,16 @@ class SongsTab(SettingsTab): def setupUi(self): self.setObjectName(u'SongsTab') - self.SongsLayout = QtGui.QFormLayout(self) - self.SongsLayout.setSpacing(8) - self.SongsLayout.setMargin(8) + self.SongsLayout = QtGui.QHBoxLayout(self) self.SongsLayout.setObjectName(u'SongsLayout') - self.SongsModeGroupBox = QtGui.QGroupBox(self) + self.LeftWidget = QtGui.QWidget(self) + self.LeftWidget.setObjectName(u'LeftWidget') + self.LeftLayout = QtGui.QVBoxLayout(self.LeftWidget) + self.LeftLayout.setMargin(0) + self.LeftLayout.setObjectName(u'LeftLayout') + self.SongsModeGroupBox = QtGui.QGroupBox(self.LeftWidget) self.SongsModeGroupBox.setObjectName(u'SongsModeGroupBox') self.SongsModeLayout = QtGui.QVBoxLayout(self.SongsModeGroupBox) - self.SongsModeLayout.setSpacing(8) - self.SongsModeLayout.setMargin(8) self.SongsModeLayout.setObjectName(u'SongsModeLayout') self.SearchAsTypeCheckBox = QtGui.QCheckBox(self.SongsModeGroupBox) self.SearchAsTypeCheckBox.setObjectName(u'SearchAsTypeCheckBox') @@ -61,8 +62,16 @@ class SongsTab(SettingsTab): self.SongAddFromServiceCheckBox.setObjectName( u'SongAddFromServiceCheckBox') self.SongsModeLayout.addWidget(self.SongAddFromServiceCheckBox) - self.SongsLayout.setWidget( - 0, QtGui.QFormLayout.LabelRole, self.SongsModeGroupBox) + self.LeftLayout.addWidget(self.SongsModeGroupBox) + self.LeftLayout.addStretch() + self.SongsLayout.addWidget(self.LeftWidget) + self.RightWidget = QtGui.QWidget(self) + self.RightWidget.setObjectName(u'RightWidget') + self.RightLayout = QtGui.QVBoxLayout(self.RightWidget) + self.RightLayout.setMargin(0) + self.RightLayout.setObjectName(u'RightLayout') + self.RightLayout.addStretch() + self.SongsLayout.addWidget(self.RightWidget) QtCore.QObject.connect(self.SearchAsTypeCheckBox, QtCore.SIGNAL(u'stateChanged(int)'), self.onSearchAsTypeCheckBoxChanged) @@ -89,6 +98,20 @@ class SongsTab(SettingsTab): translate('SongsPlugin.SongsTab', 'Add missing songs when opening service')) + def resizeEvent(self, event=None): + """ + Resize the sides in two equal halves if the layout allows this. + """ + if event: + SettingsTab.resizeEvent(self, event) + width = self.width() - self.SongsLayout.spacing() - \ + self.SongsLayout.contentsMargins().left() - \ + self.SongsLayout.contentsMargins().right() + left_width = min(width - self.RightWidget.minimumSizeHint().width(), + width / 2) + left_width = max(left_width, self.LeftWidget.minimumSizeHint().width()) + self.LeftWidget.setMinimumWidth(left_width) + def onSearchAsTypeCheckBoxChanged(self, check_state): self.song_search = False # we have a set value convert to True/False @@ -139,4 +162,4 @@ class SongsTab(SettingsTab): QtCore.QVariant(self.update_edit)) settings.setValue(u'add song from service', QtCore.QVariant(self.update_load)) - settings.endGroup() \ No newline at end of file + settings.endGroup() From b0c9b3f07777eadbd4fb7ae38a9f462f74cec495 Mon Sep 17 00:00:00 2001 From: M2j Date: Mon, 3 Jan 2011 12:25:30 +0100 Subject: [PATCH 4/7] integrated 'split layout' in the SettingsTab class remove the documentMode from the TabWidget in the SettingsDialog replace comment for HideMode class --- openlp/core/lib/settingstab.py | 29 ++++++++++++- openlp/core/ui/__init__.py | 12 ++++-- openlp/core/ui/advancedtab.py | 35 ++-------------- openlp/core/ui/generaltab.py | 39 +++--------------- openlp/core/ui/settingsdialog.py | 9 +--- openlp/core/ui/shortcutlistdialog.py | 1 - openlp/core/ui/themestab.py | 29 ++++--------- openlp/plugins/alerts/lib/alertstab.py | 41 ++++--------------- openlp/plugins/bibles/lib/biblestab.py | 37 +++-------------- openlp/plugins/custom/lib/customtab.py | 31 +------------- openlp/plugins/media/lib/mediatab.py | 31 +------------- .../presentations/lib/presentationtab.py | 41 ++++--------------- openlp/plugins/remotes/lib/remotetab.py | 37 +++-------------- openlp/plugins/songs/lib/songstab.py | 37 +++-------------- 14 files changed, 89 insertions(+), 320 deletions(-) diff --git a/openlp/core/lib/settingstab.py b/openlp/core/lib/settingstab.py index 6586a50f2..5081d9769 100644 --- a/openlp/core/lib/settingstab.py +++ b/openlp/core/lib/settingstab.py @@ -55,7 +55,34 @@ class SettingsTab(QtGui.QWidget): """ Setup the tab's interface. """ - pass + self.tabLayout = QtGui.QHBoxLayout(self) + self.tabLayout.setObjectName(u'tabLayout') + self.leftColumn = QtGui.QWidget(self) + self.leftColumn.setObjectName(u'leftColumn') + self.leftLayout = QtGui.QVBoxLayout(self.leftColumn) + self.leftLayout.setMargin(0) + self.leftLayout.setObjectName(u'leftLayout') + self.tabLayout.addWidget(self.leftColumn) + self.rightColumn = QtGui.QWidget(self) + self.rightColumn.setObjectName(u'rightColumn') + self.rightLayout = QtGui.QVBoxLayout(self.rightColumn) + self.rightLayout.setMargin(0) + self.rightLayout.setObjectName(u'rightLayout') + self.tabLayout.addWidget(self.rightColumn) + + def resizeEvent(self, event=None): + """ + Resize the sides in two equal halves if the layout allows this. + """ + if event: + QtGui.QWidget.resizeEvent(self, event) + width = self.width() - self.tabLayout.spacing() - \ + self.tabLayout.contentsMargins().left() - \ + self.tabLayout.contentsMargins().right() + left_width = min(width - self.rightColumn.minimumSizeHint().width(), + width / 2) + left_width = max(left_width, self.leftColumn.minimumSizeHint().width()) + self.leftColumn.setFixedWidth(left_width) def preLoad(self): """ diff --git a/openlp/core/ui/__init__.py b/openlp/core/ui/__init__.py index adb0d5679..206b9a37d 100644 --- a/openlp/core/ui/__init__.py +++ b/openlp/core/ui/__init__.py @@ -29,10 +29,14 @@ The :mod:`ui` module provides the core user interface for OpenLP class HideMode(object): """ - This is basically an enumeration class which specifies differnt hiding modes - for the display. The option ``Blank`` to cover the display black. The option - ``Theme`` removes the content from the theme. ``Screen`` finally hides the - output, so that the users desktop is usually shown. + This is an enumeration class which specifies the different modes of hiding + the display. + The ``Blank`` option is used to hide all output, specifically by covering + the display with a black screen. + The ``Theme`` option is used to hide all output, but covers the display with + the current theme background, as opposed to black. + Lastly, the ``Desktop`` mode hides all output by minimising the display, + leaving the user's desktop showing. """ Blank = 1 Theme = 2 diff --git a/openlp/core/ui/advancedtab.py b/openlp/core/ui/advancedtab.py index 3ca7024e4..6de985ae7 100644 --- a/openlp/core/ui/advancedtab.py +++ b/openlp/core/ui/advancedtab.py @@ -46,14 +46,8 @@ class AdvancedTab(SettingsTab): Configure the UI elements for the tab. """ self.setObjectName(u'AdvancedTab') - self.advancedTabLayout = QtGui.QHBoxLayout(self) - self.advancedTabLayout.setObjectName(u'advancedTabLayout') - self.leftWidget = QtGui.QWidget(self) - self.leftWidget.setObjectName(u'leftWidget') - self.leftLayout = QtGui.QVBoxLayout(self.leftWidget) - self.leftLayout.setMargin(0) - self.leftLayout.setObjectName(u'leftLayout') - self.uiGroupBox = QtGui.QGroupBox(self.leftWidget) + SettingsTab.setupUi(self) + self.uiGroupBox = QtGui.QGroupBox(self.leftColumn) self.uiGroupBox.setObjectName(u'uiGroupBox') self.uiLayout = QtGui.QFormLayout(self.uiGroupBox) self.uiLayout.setObjectName(u'uiLayout') @@ -74,7 +68,7 @@ class AdvancedTab(SettingsTab): u'expandServiceItemCheckBox') self.uiLayout.addRow(self.expandServiceItemCheckBox) self.leftLayout.addWidget(self.uiGroupBox) -# self.sharedDirGroupBox = QtGui.QGroupBox(self.leftWidget) +# self.sharedDirGroupBox = QtGui.QGroupBox(self.leftColumn) # self.sharedDirGroupBox.setObjectName(u'sharedDirGroupBox') # self.sharedDirLayout = QtGui.QFormLayout(self.sharedDirGroupBox) # self.sharedCheckBox = QtGui.QCheckBox(self.sharedDirGroupBox) @@ -93,19 +87,12 @@ class AdvancedTab(SettingsTab): # self.sharedDirLayout.addRow(self.sharedLabel, self.sharedSubLayout) # self.leftLayout.addWidget(self.sharedDirGroupBox) self.leftLayout.addStretch() - self.advancedTabLayout.addWidget(self.leftWidget) - self.rightWidget = QtGui.QWidget(self) - self.rightWidget.setObjectName(u'rightWidget') - self.rightLayout = QtGui.QVBoxLayout(self.rightWidget) - self.rightLayout.setMargin(0) - self.rightLayout.setObjectName(u'rightLayout') -# self.databaseGroupBox = QtGui.QGroupBox(self.rightWidget) +# self.databaseGroupBox = QtGui.QGroupBox(self.rightColumn) # self.databaseGroupBox.setObjectName(u'databaseGroupBox') # self.databaseGroupBox.setEnabled(False) # self.databaseLayout = QtGui.QVBoxLayout(self.databaseGroupBox) # self.rightLayout.addWidget(self.databaseGroupBox) self.rightLayout.addStretch() - self.advancedTabLayout.addWidget(self.rightWidget) # QtCore.QObject.connect(self.sharedCheckBox, # QtCore.SIGNAL(u'stateChanged(int)'), self.onSharedCheckBoxChanged) @@ -132,20 +119,6 @@ class AdvancedTab(SettingsTab): # self.sharedPushButton.setText(translate('AdvancedTab', 'Browse...')) # self.databaseGroupBox.setTitle(translate('AdvancedTab', 'Databases')) - def resizeEvent(self, event=None): - """ - Resize the sides in two equal halves if the layout allows this. - """ - if event: - SettingsTab.resizeEvent(self, event) - width = self.width() - self.advancedTabLayout.spacing() - \ - self.advancedTabLayout.contentsMargins().left() - \ - self.advancedTabLayout.contentsMargins().right() - left_width = min(width - self.rightWidget.minimumSizeHint().width(), - width / 2) - left_width = max(left_width, self.leftWidget.minimumSizeHint().width()) - self.leftWidget.setMinimumWidth(left_width) - def load(self): """ Load settings from disk. diff --git a/openlp/core/ui/generaltab.py b/openlp/core/ui/generaltab.py index be3463e06..15789b0d6 100644 --- a/openlp/core/ui/generaltab.py +++ b/openlp/core/ui/generaltab.py @@ -85,14 +85,8 @@ class GeneralTab(SettingsTab): Create the user interface for the general settings tab """ self.setObjectName(u'GeneralTab') - self.generalLayout = QtGui.QHBoxLayout(self) - self.generalLayout.setObjectName(u'generalLayout') - self.leftWidget = QtGui.QWidget(self) - self.leftWidget.setObjectName(u'leftWidget') - self.leftLayout = QtGui.QVBoxLayout(self.leftWidget) - self.leftLayout.setMargin(0) - self.leftLayout.setObjectName(u'leftLayout') - self.monitorGroupBox = QtGui.QGroupBox(self.leftWidget) + SettingsTab.setupUi(self) + self.monitorGroupBox = QtGui.QGroupBox(self.leftColumn) self.monitorGroupBox.setObjectName(u'monitorGroupBox') self.monitorLayout = QtGui.QFormLayout(self.monitorGroupBox) self.monitorLayout.setObjectName(u'monitorLayout') @@ -106,7 +100,7 @@ class GeneralTab(SettingsTab): self.displayOnMonitorCheck.setObjectName(u'monitorComboBox') self.monitorLayout.addRow(self.displayOnMonitorCheck) self.leftLayout.addWidget(self.monitorGroupBox) - self.startupGroupBox = QtGui.QGroupBox(self.leftWidget) + self.startupGroupBox = QtGui.QGroupBox(self.leftColumn) self.startupGroupBox.setObjectName(u'startupGroupBox') self.startupLayout = QtGui.QVBoxLayout(self.startupGroupBox) self.startupLayout.setObjectName(u'startupLayout') @@ -120,7 +114,7 @@ class GeneralTab(SettingsTab): self.showSplashCheckBox.setObjectName(u'showSplashCheckBox') self.startupLayout.addWidget(self.showSplashCheckBox) self.leftLayout.addWidget(self.startupGroupBox) - self.settingsGroupBox = QtGui.QGroupBox(self.leftWidget) + self.settingsGroupBox = QtGui.QGroupBox(self.leftColumn) self.settingsGroupBox.setObjectName(u'settingsGroupBox') self.settingsLayout = QtGui.QFormLayout(self.settingsGroupBox) self.settingsLayout.setObjectName(u'settingsLayout') @@ -138,13 +132,7 @@ class GeneralTab(SettingsTab): self.settingsLayout.addRow(self.timeoutLabel, self.timeoutSpinBox) self.leftLayout.addWidget(self.settingsGroupBox) self.leftLayout.addStretch() - self.generalLayout.addWidget(self.leftWidget) - self.rightWidget = QtGui.QWidget(self) - self.rightWidget.setObjectName(u'rightWidget') - self.rightLayout = QtGui.QVBoxLayout(self.rightWidget) - self.rightLayout.setMargin(0) - self.rightLayout.setObjectName(u'rightLayout') - self.ccliGroupBox = QtGui.QGroupBox(self.rightWidget) + self.ccliGroupBox = QtGui.QGroupBox(self.rightColumn) self.ccliGroupBox.setObjectName(u'ccliGroupBox') self.ccliLayout = QtGui.QFormLayout(self.ccliGroupBox) self.ccliLayout.setObjectName(u'ccliLayout') @@ -166,7 +154,7 @@ class GeneralTab(SettingsTab): self.ccliLayout.addRow(self.passwordLabel, self.passwordEdit) self.rightLayout.addWidget(self.ccliGroupBox) # Moved here from display tab - self.displayGroupBox = QtGui.QGroupBox(self.rightWidget) + self.displayGroupBox = QtGui.QGroupBox(self.rightColumn) self.displayGroupBox.setObjectName(u'displayGroupBox') self.displayLayout = QtGui.QGridLayout(self.displayGroupBox) self.displayLayout.setObjectName(u'displayLayout') @@ -225,7 +213,6 @@ class GeneralTab(SettingsTab): self.displayLayout.addWidget(self.customHeightValueEdit, 4, 3) self.rightLayout.addWidget(self.displayGroupBox) self.rightLayout.addStretch() - self.generalLayout.addWidget(self.rightWidget) # Signals and slots QtCore.QObject.connect(self.overrideCheckBox, QtCore.SIGNAL(u'toggled(bool)'), self.onOverrideCheckBoxToggled) @@ -300,20 +287,6 @@ class GeneralTab(SettingsTab): translate('OpenLP.GeneralTab', 'Height')) self.customWidthLabel.setText(translate('OpenLP.GeneralTab', 'Width')) - def resizeEvent(self, event=None): - """ - Resize the sides in two equal halves if the layout allows this. - """ - if event: - SettingsTab.resizeEvent(self, event) - width = self.width() - self.generalLayout.spacing() - \ - self.generalLayout.contentsMargins().left() - \ - self.generalLayout.contentsMargins().right() - left_width = min(width - self.rightWidget.minimumSizeHint().width(), - width / 2) - left_width = max(left_width, self.leftWidget.minimumSizeHint().width()) - self.leftWidget.setMinimumWidth(left_width) - def load(self): """ Load the settings to populate the form diff --git a/openlp/core/ui/settingsdialog.py b/openlp/core/ui/settingsdialog.py index 29518f078..537e99cc2 100644 --- a/openlp/core/ui/settingsdialog.py +++ b/openlp/core/ui/settingsdialog.py @@ -36,22 +36,15 @@ class Ui_SettingsDialog(object): build_icon(u':/system/system_settings.png')) self.settingsLayout = QtGui.QVBoxLayout(settingsDialog) margins = self.settingsLayout.contentsMargins() - self.settingsLayout.setContentsMargins(0, margins.top(), 0, 0) self.settingsLayout.setObjectName(u'settingsLayout') self.settingsTabWidget = QtGui.QTabWidget(settingsDialog) - self.settingsTabWidget.setDocumentMode(True) self.settingsTabWidget.setObjectName(u'settingsTabWidget') self.settingsLayout.addWidget(self.settingsTabWidget) - self.buttonBoxLayout = QtGui.QGridLayout() - self.buttonBoxLayout.setContentsMargins(margins.left(), 0, - margins.right(), margins.bottom()) - self.buttonBoxLayout.setObjectName(u'buttonBoxLayout') self.buttonBox = QtGui.QDialogButtonBox(settingsDialog) self.buttonBox.setStandardButtons( QtGui.QDialogButtonBox.Cancel | QtGui.QDialogButtonBox.Ok) self.buttonBox.setObjectName(u'buttonBox') - self.buttonBoxLayout.addWidget(self.buttonBox) - self.settingsLayout.addLayout(self.buttonBoxLayout) + self.settingsLayout.addWidget(self.buttonBox) self.retranslateUi(settingsDialog) QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(u'accepted()'), settingsDialog.accept) diff --git a/openlp/core/ui/shortcutlistdialog.py b/openlp/core/ui/shortcutlistdialog.py index 32c50fe88..3f41d377a 100644 --- a/openlp/core/ui/shortcutlistdialog.py +++ b/openlp/core/ui/shortcutlistdialog.py @@ -31,7 +31,6 @@ from openlp.core.lib import translate, build_icon class Ui_ShortcutListDialog(object): def setupUi(self, shortcutListDialog): shortcutListDialog.setObjectName(u'shortcutListDialog') -# shortcutListDialog.resize(500, 438) self.dialogLayout = QtGui.QVBoxLayout(shortcutListDialog) self.dialogLayout.setObjectName(u'dialogLayout') self.treeWidget = QtGui.QTreeWidget(shortcutListDialog) diff --git a/openlp/core/ui/themestab.py b/openlp/core/ui/themestab.py index 3c3a51f43..adeb03794 100644 --- a/openlp/core/ui/themestab.py +++ b/openlp/core/ui/themestab.py @@ -38,10 +38,8 @@ class ThemesTab(SettingsTab): def setupUi(self): self.setObjectName(u'ThemesTab') - self.tabTitleVisible = translate('OpenLP.ThemesTab', 'Themes') - self.ThemesTabLayout = QtGui.QHBoxLayout(self) - self.ThemesTabLayout.setObjectName(u'ThemesTabLayout') - self.GlobalGroupBox = QtGui.QGroupBox(self) + SettingsTab.setupUi(self) + self.GlobalGroupBox = QtGui.QGroupBox(self.leftColumn) self.GlobalGroupBox.setObjectName(u'GlobalGroupBox') self.GlobalGroupBoxLayout = QtGui.QVBoxLayout(self.GlobalGroupBox) self.GlobalGroupBoxLayout.setObjectName(u'GlobalGroupBoxLayout') @@ -51,8 +49,9 @@ class ThemesTab(SettingsTab): self.DefaultListView = QtGui.QLabel(self.GlobalGroupBox) self.DefaultListView.setObjectName(u'DefaultListView') self.GlobalGroupBoxLayout.addWidget(self.DefaultListView) - self.ThemesTabLayout.addWidget(self.GlobalGroupBox) - self.LevelGroupBox = QtGui.QGroupBox(self) + self.leftLayout.addWidget(self.GlobalGroupBox) + self.leftLayout.addStretch() + self.LevelGroupBox = QtGui.QGroupBox(self.rightColumn) self.LevelGroupBox.setObjectName(u'LevelGroupBox') self.LevelLayout = QtGui.QFormLayout(self.LevelGroupBox) self.LevelLayout.setLabelAlignment( @@ -81,7 +80,8 @@ class ThemesTab(SettingsTab): self.GlobalLevelLabel.setObjectName(u'GlobalLevelLabel') self.LevelLayout.addRow(self.GlobalLevelRadioButton, self.GlobalLevelLabel) - self.ThemesTabLayout.addWidget(self.LevelGroupBox) + self.rightLayout.addWidget(self.LevelGroupBox) + self.rightLayout.addStretch() QtCore.QObject.connect(self.SongLevelRadioButton, QtCore.SIGNAL(u'pressed()'), self.onSongLevelButtonPressed) QtCore.QObject.connect(self.ServiceLevelRadioButton, @@ -94,6 +94,7 @@ class ThemesTab(SettingsTab): QtCore.SIGNAL(u'theme_update_list'), self.updateThemeList) def retranslateUi(self): + self.tabTitleVisible = translate('OpenLP.ThemesTab', 'Themes') self.GlobalGroupBox.setTitle( translate('OpenLP.ThemesTab', 'Global Theme')) self.LevelGroupBox.setTitle( @@ -117,20 +118,6 @@ class ThemesTab(SettingsTab): translate('OpenLP.ThemesTab', 'Use the global theme, overriding ' 'any themes associated with either the service or the songs.')) - def resizeEvent(self, event=None): - """ - Resize the sides in two equal halves if the layout allows this. - """ - if event: - SettingsTab.resizeEvent(self, event) - width = self.width() - self.ThemesTabLayout.spacing() - \ - self.ThemesTabLayout.contentsMargins().left() - \ - self.ThemesTabLayout.contentsMargins().right() - left_width = min(width - self.LevelGroupBox.minimumSizeHint().width(), - width / 2) - left_width = max(left_width, self.GlobalGroupBox.minimumSizeHint().width()) - self.GlobalGroupBox.setMinimumWidth(left_width) - def load(self): settings = QtCore.QSettings() settings.beginGroup(self.settingsSection) diff --git a/openlp/plugins/alerts/lib/alertstab.py b/openlp/plugins/alerts/lib/alertstab.py index 80a824e3c..96870d94c 100644 --- a/openlp/plugins/alerts/lib/alertstab.py +++ b/openlp/plugins/alerts/lib/alertstab.py @@ -39,14 +39,8 @@ class AlertsTab(SettingsTab): def setupUi(self): self.setObjectName(u'AlertsTab') - self.AlertsLayout = QtGui.QHBoxLayout(self) - self.AlertsLayout.setObjectName(u'AlertsLayout') - self.LeftColumn = QtGui.QWidget(self) - self.LeftColumn.setObjectName(u'LeftColumn') - self.LeftLayout = QtGui.QVBoxLayout(self.LeftColumn) - self.LeftLayout.setMargin(0) - self.LeftLayout.setObjectName(u'LeftLayout') - self.FontGroupBox = QtGui.QGroupBox(self.LeftColumn) + SettingsTab.setupUi(self) + self.FontGroupBox = QtGui.QGroupBox(self.leftColumn) self.FontGroupBox.setObjectName(u'FontGroupBox') self.FontLayout = QtGui.QFormLayout(self.FontGroupBox) self.FontLayout.setObjectName(u'FontLayout') @@ -87,24 +81,17 @@ class AlertsTab(SettingsTab): self.LocationComboBox.addItems([u'', u'', u'']) self.LocationComboBox.setObjectName(u'LocationComboBox') self.FontLayout.addRow(self.LocationLabel, self.LocationComboBox) - self.LeftLayout.addWidget(self.FontGroupBox) - self.LeftLayout.addStretch() - self.AlertsLayout.addWidget(self.LeftColumn) - self.RightColumn = QtGui.QWidget(self) - self.RightColumn.setObjectName(u'RightColumn') - self.RightLayout = QtGui.QVBoxLayout(self.RightColumn) - self.RightLayout.setMargin(0) - self.RightLayout.setObjectName(u'RightLayout') - self.PreviewGroupBox = QtGui.QGroupBox(self.RightColumn) + self.leftLayout.addWidget(self.FontGroupBox) + self.leftLayout.addStretch() + self.PreviewGroupBox = QtGui.QGroupBox(self.rightColumn) self.PreviewGroupBox.setObjectName(u'PreviewGroupBox') self.PreviewLayout = QtGui.QVBoxLayout(self.PreviewGroupBox) self.PreviewLayout.setObjectName(u'PreviewLayout') self.FontPreview = QtGui.QLineEdit(self.PreviewGroupBox) self.FontPreview.setObjectName(u'FontPreview') self.PreviewLayout.addWidget(self.FontPreview) - self.RightLayout.addWidget(self.PreviewGroupBox) - self.RightLayout.addStretch() - self.AlertsLayout.addWidget(self.RightColumn) + self.rightLayout.addWidget(self.PreviewGroupBox) + self.rightLayout.addStretch() # Signals and slots QtCore.QObject.connect(self.BackgroundColorButton, QtCore.SIGNAL(u'pressed()'), self.onBackgroundColorButtonClicked) @@ -149,20 +136,6 @@ class AlertsTab(SettingsTab): self.LocationComboBox.setItemText(2, translate('AlertsPlugin.AlertsTab', 'Bottom')) - def resizeEvent(self, event=None): - """ - Resize the sides in two equal halves if the layout allows this. - """ - if event: - SettingsTab.resizeEvent(self, event) - width = self.width() - self.AlertsLayout.spacing() - \ - self.AlertsLayout.contentsMargins().left() - \ - self.AlertsLayout.contentsMargins().right() - left_width = min(width - self.RightColumn.minimumSizeHint().width(), - width / 2) - left_width = max(left_width, self.LeftColumn.minimumSizeHint().width()) - self.LeftColumn.setMinimumWidth(left_width) - def onBackgroundColorButtonClicked(self): new_color = QtGui.QColorDialog.getColor( QtGui.QColor(self.bg_color), self) diff --git a/openlp/plugins/bibles/lib/biblestab.py b/openlp/plugins/bibles/lib/biblestab.py index adc451862..4010b89a1 100644 --- a/openlp/plugins/bibles/lib/biblestab.py +++ b/openlp/plugins/bibles/lib/biblestab.py @@ -46,14 +46,8 @@ class BiblesTab(SettingsTab): def setupUi(self): self.setObjectName(u'BiblesTab') - self.BibleLayout = QtGui.QHBoxLayout(self) - self.BibleLayout.setObjectName(u'BibleLayout') - self.LeftWidget = QtGui.QWidget(self) - self.LeftWidget.setObjectName(u'LeftWidget') - self.LeftLayout = QtGui.QVBoxLayout(self.LeftWidget) - self.LeftLayout.setMargin(0) - self.LeftLayout.setObjectName(u'LeftLayout') - self.VerseDisplayGroupBox = QtGui.QGroupBox(self.LeftWidget) + SettingsTab.setupUi(self) + self.VerseDisplayGroupBox = QtGui.QGroupBox(self.leftColumn) self.VerseDisplayGroupBox.setObjectName(u'VerseDisplayGroupBox') self.VerseDisplayLayout = QtGui.QFormLayout(self.VerseDisplayGroupBox) self.VerseDisplayLayout.setObjectName(u'VerseDisplayLayout') @@ -88,16 +82,9 @@ class BiblesTab(SettingsTab): self.ChangeNoteLabel.setWordWrap(True) self.ChangeNoteLabel.setObjectName(u'ChangeNoteLabel') self.VerseDisplayLayout.addRow(self.ChangeNoteLabel) - self.LeftLayout.addWidget(self.VerseDisplayGroupBox) - self.LeftLayout.addStretch() - self.BibleLayout.addWidget(self.LeftWidget) - self.RightWidget = QtGui.QWidget(self) - self.RightWidget.setObjectName(u'RightWidget') - self.RightLayout = QtGui.QVBoxLayout(self.RightWidget) - self.RightLayout.setMargin(0) - self.RightLayout.setObjectName(u'RightLayout') - self.RightLayout.addStretch() - self.BibleLayout.addWidget(self.RightWidget) + self.leftLayout.addWidget(self.VerseDisplayGroupBox) + self.leftLayout.addStretch() + self.rightLayout.addStretch() # Signals and slots QtCore.QObject.connect( self.NewChaptersCheckBox, QtCore.SIGNAL(u'stateChanged(int)'), @@ -148,20 +135,6 @@ class BiblesTab(SettingsTab): self.BibleSecondCheckBox.setText( translate('BiblesPlugin.BiblesTab', 'Display second Bible verses')) - def resizeEvent(self, event=None): - """ - Resize the sides in two equal halves if the layout allows this. - """ - if event: - SettingsTab.resizeEvent(self, event) - width = self.width() - self.BibleLayout.spacing() - \ - self.BibleLayout.contentsMargins().left() - \ - self.BibleLayout.contentsMargins().right() - left_width = min(width - self.RightWidget.minimumSizeHint().width(), - width / 2) - left_width = max(left_width, self.LeftWidget.minimumSizeHint().width()) - self.LeftWidget.setMinimumWidth(left_width) - def onBibleThemeComboBoxChanged(self): self.bible_theme = self.BibleThemeComboBox.currentText() diff --git a/openlp/plugins/custom/lib/customtab.py b/openlp/plugins/custom/lib/customtab.py index 9fce7a007..3c1b848aa 100644 --- a/openlp/plugins/custom/lib/customtab.py +++ b/openlp/plugins/custom/lib/customtab.py @@ -37,14 +37,8 @@ class CustomTab(SettingsTab): def setupUi(self): self.setObjectName(u'CustomTab') - self.customLayout = QtGui.QHBoxLayout(self) - self.customLayout.setObjectName(u'customLayout') - self.leftWidget = QtGui.QWidget(self) - self.leftWidget.setObjectName(u'leftWidget') - self.leftLayout = QtGui.QVBoxLayout(self.leftWidget) - self.leftLayout.setMargin(0) - self.leftLayout.setObjectName(u'leftLayout') - self.customModeGroupBox = QtGui.QGroupBox(self.leftWidget) + SettingsTab.setupUi(self) + self.customModeGroupBox = QtGui.QGroupBox(self.leftColumn) self.customModeGroupBox.setObjectName(u'customModeGroupBox') self.customModeLayout = QtGui.QFormLayout(self.customModeGroupBox) self.customModeLayout.setObjectName(u'customModeLayout') @@ -53,14 +47,7 @@ class CustomTab(SettingsTab): self.customModeLayout.addRow(self.displayFooterCheckBox) self.leftLayout.addWidget(self.customModeGroupBox) self.leftLayout.addStretch() - self.customLayout.addWidget(self.leftWidget) - self.rightWidget = QtGui.QWidget(self) - self.rightWidget.setObjectName(u'rightWidget') - self.rightLayout = QtGui.QVBoxLayout(self.rightWidget) - self.rightLayout.setMargin(0) - self.rightLayout.setObjectName(u'rightLayout') self.rightLayout.addStretch() - self.customLayout.addWidget(self.rightWidget) QtCore.QObject.connect(self.displayFooterCheckBox, QtCore.SIGNAL(u'stateChanged(int)'), self.onDisplayFooterCheckBoxChanged) @@ -71,20 +58,6 @@ class CustomTab(SettingsTab): self.displayFooterCheckBox.setText( translate('CustomPlugin.CustomTab', 'Display footer')) - def resizeEvent(self, event=None): - """ - Resize the sides in two equal halves if the layout allows this. - """ - if event: - SettingsTab.resizeEvent(self, event) - width = self.width() - self.customLayout.spacing() - \ - self.customLayout.contentsMargins().left() - \ - self.customLayout.contentsMargins().right() - left_width = min(width - self.rightWidget.minimumSizeHint().width(), - width / 2) - left_width = max(left_width, self.leftWidget.minimumSizeHint().width()) - self.leftWidget.setMinimumWidth(left_width) - def onDisplayFooterCheckBoxChanged(self, check_state): self.displayFooter = False # we have a set value convert to True/False diff --git a/openlp/plugins/media/lib/mediatab.py b/openlp/plugins/media/lib/mediatab.py index 8b54afb89..461fbf4ae 100644 --- a/openlp/plugins/media/lib/mediatab.py +++ b/openlp/plugins/media/lib/mediatab.py @@ -37,14 +37,8 @@ class MediaTab(SettingsTab): def setupUi(self): self.setObjectName(u'MediaTab') - self.mediaLayout = QtGui.QHBoxLayout(self) - self.mediaLayout.setObjectName(u'mediaLayout') - self.leftWidget = QtGui.QWidget(self) - self.leftWidget.setObjectName(u'leftWidget') - self.leftLayout = QtGui.QVBoxLayout(self.leftWidget) - self.leftLayout.setMargin(0) - self.leftLayout.setObjectName(u'leftLayout') - self.mediaModeGroupBox = QtGui.QGroupBox(self.leftWidget) + SettingsTab.setupUi(self) + self.mediaModeGroupBox = QtGui.QGroupBox(self.leftColumn) self.mediaModeGroupBox.setObjectName(u'mediaModeGroupBox') self.mediaModeLayout = QtGui.QFormLayout(self.mediaModeGroupBox) self.mediaModeLayout.setObjectName(u'mediaModeLayout') @@ -53,14 +47,7 @@ class MediaTab(SettingsTab): self.mediaModeLayout.addRow(self.usePhononCheckBox) self.leftLayout.addWidget(self.mediaModeGroupBox) self.leftLayout.addStretch() - self.mediaLayout.addWidget(self.leftWidget) - self.rightWidget = QtGui.QWidget(self) - self.rightWidget.setObjectName(u'rightWidget') - self.rightLayout = QtGui.QVBoxLayout(self.rightWidget) - self.rightLayout.setMargin(0) - self.rightLayout.setObjectName(u'rightLayout') self.rightLayout.addStretch() - self.mediaLayout.addWidget(self.rightWidget) QtCore.QObject.connect(self.usePhononCheckBox, QtCore.SIGNAL(u'stateChanged(int)'), self.onUsePhononCheckBoxChanged) @@ -72,20 +59,6 @@ class MediaTab(SettingsTab): self.usePhononCheckBox.setText( translate('MediaPlugin.MediaTab', 'Use Phonon for video playback')) - def resizeEvent(self, event=None): - """ - Resize the sides in two equal halves if the layout allows this. - """ - if event: - SettingsTab.resizeEvent(self, event) - width = self.width() - self.mediaLayout.spacing() - \ - self.mediaLayout.contentsMargins().left() - \ - self.mediaLayout.contentsMargins().right() - left_width = min(width - self.rightWidget.minimumSizeHint().width(), - width / 2) - left_width = max(left_width, self.leftWidget.minimumSizeHint().width()) - self.leftWidget.setMinimumWidth(left_width) - def onUsePhononCheckBoxChanged(self, check_state): self.usePhonon = (check_state == QtCore.Qt.Checked) self.usePhononChanged = True diff --git a/openlp/plugins/presentations/lib/presentationtab.py b/openlp/plugins/presentations/lib/presentationtab.py index 066577006..fef3bcba1 100644 --- a/openlp/plugins/presentations/lib/presentationtab.py +++ b/openlp/plugins/presentations/lib/presentationtab.py @@ -44,14 +44,8 @@ class PresentationTab(SettingsTab): Create the controls for the settings tab """ self.setObjectName(u'PresentationTab') - self.PresentationLayout = QtGui.QHBoxLayout(self) - self.PresentationLayout.setObjectName(u'PresentationLayout') - self.LeftWidget = QtGui.QWidget(self) - self.LeftWidget.setObjectName(u'LeftWidget') - self.LeftLayout = QtGui.QVBoxLayout(self.LeftWidget) - self.LeftLayout.setMargin(0) - self.LeftLayout.setObjectName(u'LeftLayout') - self.ControllersGroupBox = QtGui.QGroupBox(self.LeftWidget) + SettingsTab.setupUi(self) + self.ControllersGroupBox = QtGui.QGroupBox(self.leftColumn) self.ControllersGroupBox.setObjectName(u'ControllersGroupBox') self.ControllersLayout = QtGui.QVBoxLayout(self.ControllersGroupBox) self.ControllersLayout.setObjectName(u'ControllersLayout') @@ -63,24 +57,17 @@ class PresentationTab(SettingsTab): checkbox.setObjectName(controller.name + u'CheckBox') self.PresenterCheckboxes[controller.name] = checkbox self.ControllersLayout.addWidget(checkbox) - self.LeftLayout.addWidget(self.ControllersGroupBox) - self.AdvancedGroupBox = QtGui.QGroupBox(self.LeftWidget) + self.leftLayout.addWidget(self.ControllersGroupBox) + self.AdvancedGroupBox = QtGui.QGroupBox(self.leftColumn) self.AdvancedGroupBox.setObjectName(u'AdvancedGroupBox') self.AdvancedLayout = QtGui.QVBoxLayout(self.AdvancedGroupBox) self.AdvancedLayout.setObjectName(u'AdvancedLayout') self.OverrideAppCheckBox = QtGui.QCheckBox(self.AdvancedGroupBox) self.OverrideAppCheckBox.setObjectName(u'OverrideAppCheckBox') self.AdvancedLayout.addWidget(self.OverrideAppCheckBox) - self.LeftLayout.addWidget(self.AdvancedGroupBox) - self.LeftLayout.addStretch() - self.PresentationLayout.addWidget(self.LeftWidget) - self.RightWidget = QtGui.QWidget(self) - self.RightWidget.setObjectName(u'RightWidget') - self.RightLayout = QtGui.QVBoxLayout(self.RightWidget) - self.RightLayout.setMargin(0) - self.RightLayout.setObjectName(u'RightLayout') - self.RightLayout.addStretch() - self.PresentationLayout.addWidget(self.RightWidget) + self.leftLayout.addWidget(self.AdvancedGroupBox) + self.leftLayout.addStretch() + self.rightLayout.addStretch() def retranslateUi(self): """ @@ -100,20 +87,6 @@ class PresentationTab(SettingsTab): translate('PresentationPlugin.PresentationTab', 'Allow presentation application to be overriden')) - def resizeEvent(self, event=None): - """ - Resize the sides in two equal halves if the layout allows this. - """ - if event: - SettingsTab.resizeEvent(self, event) - width = self.width() - self.PresentationLayout.spacing() - \ - self.PresentationLayout.contentsMargins().left() - \ - self.PresentationLayout.contentsMargins().right() - left_width = min(width - self.RightWidget.minimumSizeHint().width(), - width / 2) - left_width = max(left_width, self.LeftWidget.minimumSizeHint().width()) - self.LeftWidget.setMinimumWidth(left_width) - def load(self): """ Load the settings. diff --git a/openlp/plugins/remotes/lib/remotetab.py b/openlp/plugins/remotes/lib/remotetab.py index 4fc66e30e..e97d33762 100644 --- a/openlp/plugins/remotes/lib/remotetab.py +++ b/openlp/plugins/remotes/lib/remotetab.py @@ -37,16 +37,8 @@ class RemoteTab(SettingsTab): def setupUi(self): self.setObjectName(u'RemoteTab') - self.remoteLayout = QtGui.QHBoxLayout(self) - self.remoteLayout.setObjectName(u'remoteLayout') - self.leftWidget = QtGui.QWidget(self) - self.leftWidget.setSizePolicy(QtGui.QSizePolicy.Fixed, - QtGui.QSizePolicy.Preferred) - self.leftWidget.setObjectName(u'leftWidget') - self.leftLayout = QtGui.QVBoxLayout(self.leftWidget) - self.leftLayout.setMargin(0) - self.leftLayout.setObjectName(u'leftLayout') - self.serverSettingsGroupBox = QtGui.QGroupBox(self.leftWidget) + SettingsTab.setupUi(self) + self.serverSettingsGroupBox = QtGui.QGroupBox(self.leftColumn) self.serverSettingsGroupBox.setObjectName(u'serverSettingsGroupBox') self.serverSettingsLayout = QtGui.QFormLayout( self.serverSettingsGroupBox) @@ -54,6 +46,10 @@ class RemoteTab(SettingsTab): self.addressLabel = QtGui.QLabel(self.serverSettingsGroupBox) self.addressLabel.setObjectName(u'addressLabel') self.addressEdit = QtGui.QLineEdit(self.serverSettingsGroupBox) + self.addressEdit.setSizePolicy(QtGui.QSizePolicy.Preferred, + QtGui.QSizePolicy.Fixed) + self.addressEdit.setValidator(QtGui.QRegExpValidator(QtCore.QRegExp( + u'\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}'), self)) self.addressEdit.setObjectName(u'addressEdit') self.serverSettingsLayout.addRow(self.addressLabel, self.addressEdit) self.portLabel = QtGui.QLabel(self.serverSettingsGroupBox) @@ -64,14 +60,7 @@ class RemoteTab(SettingsTab): self.serverSettingsLayout.addRow(self.portLabel, self.portSpinBox) self.leftLayout.addWidget(self.serverSettingsGroupBox) self.leftLayout.addStretch() - self.remoteLayout.addWidget(self.leftWidget) - self.rightWidget = QtGui.QWidget(self) - self.rightWidget.setObjectName(u'rightWidget') - self.rightLayout = QtGui.QVBoxLayout(self.rightWidget) - self.rightLayout.setMargin(0) - self.rightLayout.setObjectName(u'rightLayout') self.rightLayout.addStretch() - self.remoteLayout.addWidget(self.rightWidget) def retranslateUi(self): self.serverSettingsGroupBox.setTitle( @@ -81,20 +70,6 @@ class RemoteTab(SettingsTab): self.portLabel.setText(translate('RemotePlugin.RemoteTab', 'Port number:')) - def resizeEvent(self, event=None): - """ - Resize the sides in two equal halves if the layout allows this. - """ - if event: - SettingsTab.resizeEvent(self, event) - width = self.width() - self.remoteLayout.spacing() - \ - self.remoteLayout.contentsMargins().left() - \ - self.remoteLayout.contentsMargins().right() - left_width = min(width - self.rightWidget.minimumSizeHint().width(), - width / 2) - left_width = max(left_width, self.leftWidget.minimumSizeHint().width()) - self.leftWidget.setMinimumWidth(left_width) - def load(self): self.portSpinBox.setValue( QtCore.QSettings().value(self.settingsSection + u'/port', diff --git a/openlp/plugins/songs/lib/songstab.py b/openlp/plugins/songs/lib/songstab.py index b1647bf64..9ed8ace94 100644 --- a/openlp/plugins/songs/lib/songstab.py +++ b/openlp/plugins/songs/lib/songstab.py @@ -37,14 +37,8 @@ class SongsTab(SettingsTab): def setupUi(self): self.setObjectName(u'SongsTab') - self.SongsLayout = QtGui.QHBoxLayout(self) - self.SongsLayout.setObjectName(u'SongsLayout') - self.LeftWidget = QtGui.QWidget(self) - self.LeftWidget.setObjectName(u'LeftWidget') - self.LeftLayout = QtGui.QVBoxLayout(self.LeftWidget) - self.LeftLayout.setMargin(0) - self.LeftLayout.setObjectName(u'LeftLayout') - self.SongsModeGroupBox = QtGui.QGroupBox(self.LeftWidget) + SettingsTab.setupUi(self) + self.SongsModeGroupBox = QtGui.QGroupBox(self.leftColumn) self.SongsModeGroupBox.setObjectName(u'SongsModeGroupBox') self.SongsModeLayout = QtGui.QVBoxLayout(self.SongsModeGroupBox) self.SongsModeLayout.setObjectName(u'SongsModeLayout') @@ -62,16 +56,9 @@ class SongsTab(SettingsTab): self.SongAddFromServiceCheckBox.setObjectName( u'SongAddFromServiceCheckBox') self.SongsModeLayout.addWidget(self.SongAddFromServiceCheckBox) - self.LeftLayout.addWidget(self.SongsModeGroupBox) - self.LeftLayout.addStretch() - self.SongsLayout.addWidget(self.LeftWidget) - self.RightWidget = QtGui.QWidget(self) - self.RightWidget.setObjectName(u'RightWidget') - self.RightLayout = QtGui.QVBoxLayout(self.RightWidget) - self.RightLayout.setMargin(0) - self.RightLayout.setObjectName(u'RightLayout') - self.RightLayout.addStretch() - self.SongsLayout.addWidget(self.RightWidget) + self.leftLayout.addWidget(self.SongsModeGroupBox) + self.leftLayout.addStretch() + self.rightLayout.addStretch() QtCore.QObject.connect(self.SearchAsTypeCheckBox, QtCore.SIGNAL(u'stateChanged(int)'), self.onSearchAsTypeCheckBoxChanged) @@ -98,20 +85,6 @@ class SongsTab(SettingsTab): translate('SongsPlugin.SongsTab', 'Add missing songs when opening service')) - def resizeEvent(self, event=None): - """ - Resize the sides in two equal halves if the layout allows this. - """ - if event: - SettingsTab.resizeEvent(self, event) - width = self.width() - self.SongsLayout.spacing() - \ - self.SongsLayout.contentsMargins().left() - \ - self.SongsLayout.contentsMargins().right() - left_width = min(width - self.RightWidget.minimumSizeHint().width(), - width / 2) - left_width = max(left_width, self.LeftWidget.minimumSizeHint().width()) - self.LeftWidget.setMinimumWidth(left_width) - def onSearchAsTypeCheckBoxChanged(self, check_state): self.song_search = False # we have a set value convert to True/False From 411a60c6c5f689d03cfc6b83d029c1248cafd291 Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Tue, 4 Jan 2011 18:04:55 +0200 Subject: [PATCH 5/7] Fix for bug #697271 --- openlp/plugins/songs/forms/songmaintenanceform.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlp/plugins/songs/forms/songmaintenanceform.py b/openlp/plugins/songs/forms/songmaintenanceform.py index 0364a4df4..eda8b6170 100644 --- a/openlp/plugins/songs/forms/songmaintenanceform.py +++ b/openlp/plugins/songs/forms/songmaintenanceform.py @@ -109,7 +109,7 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog): author_name = QtGui.QListWidgetItem(author.display_name) else: author_name = QtGui.QListWidgetItem( - u' '.join(author.first_name, author.last_name)) + u' '.join([author.first_name, author.last_name])) author_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(author.id)) self.AuthorsListWidget.addItem(author_name) if self.AuthorsListWidget.count() == 0: From 85c6ba2ee49944ccdeebd070b9e8ef83600baf29 Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Tue, 4 Jan 2011 19:26:37 +0200 Subject: [PATCH 6/7] Fix for bug #696979 --- openlp/core/ui/servicemanager.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index 8f4e17a0c..8e98e0365 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -367,7 +367,7 @@ class ServiceManager(QtGui.QWidget): translate('OpenLP.ServiceManager', 'Open File'), SettingsManager.get_last_dir(self.parent.serviceSettingsSection), translate('OpenLP.ServiceManager', - 'OpenLP Service Files (*.osz) (*.osz)'))) + 'OpenLP Service Files (*.osz)'))) if not fileName: return False SettingsManager.set_last_dir(self.parent.serviceSettingsSection, @@ -457,7 +457,7 @@ class ServiceManager(QtGui.QWidget): translate('OpenLP.ServiceManager', 'Save Service'), SettingsManager.get_last_dir(self.parent.serviceSettingsSection), translate('OpenLP.ServiceManager', - 'OpenLP Service Files (*.osz) (*.osz)'))) + 'OpenLP Service Files (*.osz)'))) if not fileName: return False if os.path.splitext(fileName)[1] == u'': From d7ff9d37d2925a7d1aec7b6a07bd96ff629e9533 Mon Sep 17 00:00:00 2001 From: M2j Date: Wed, 5 Jan 2011 10:37:11 +0100 Subject: [PATCH 7/7] formating of a comment --- openlp/core/ui/__init__.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/openlp/core/ui/__init__.py b/openlp/core/ui/__init__.py index 206b9a37d..26c59ed0f 100644 --- a/openlp/core/ui/__init__.py +++ b/openlp/core/ui/__init__.py @@ -31,12 +31,18 @@ class HideMode(object): """ This is an enumeration class which specifies the different modes of hiding the display. - The ``Blank`` option is used to hide all output, specifically by covering - the display with a black screen. - The ``Theme`` option is used to hide all output, but covers the display with - the current theme background, as opposed to black. - Lastly, the ``Desktop`` mode hides all output by minimising the display, - leaving the user's desktop showing. + + ``Blank`` + This mode is used to hide all output, specifically by covering the + display with a black screen. + + ``Theme`` + This mode is used to hide all output, but covers the display with the + current theme background, as opposed to black. + + ``Desktop`` + This mode hides all output by minimising the display, leaving the user's + desktop showing. """ Blank = 1 Theme = 2