Some modifications to the Configure dialog:

- Moved single display option to General tab
- Removed Display tab
- Renamed variables to be Qt compliant
This commit is contained in:
Raoul Snyman 2010-07-14 22:37:54 +02:00
parent 38afbbdd5b
commit dc4f60516f
3 changed files with 73 additions and 49 deletions

View File

@ -154,10 +154,16 @@ class GeneralTab(SettingsTab):
self.displayGroupBox = QtGui.QGroupBox(self)
self.displayGroupBox.setObjectName(u'displayGroupBox')
self.displayLayout = QtGui.QVBoxLayout(self.displayGroupBox)
self.displayLayout.setSpacing(8)
self.displayLayout.setMargin(8)
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)
@ -169,6 +175,8 @@ class GeneralTab(SettingsTab):
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.currentYLabel = QtGui.QLabel(self.displayGroupBox)
self.currentYLabel.setAlignment(QtCore.Qt.AlignCenter)
@ -180,6 +188,8 @@ class GeneralTab(SettingsTab):
self.currentYLayout.addWidget(self.currentYValueLabel)
self.currentLayout.addLayout(self.currentYLayout)
self.currentHeightLayout = QtGui.QVBoxLayout()
self.currentHeightLayout.setSpacing(0)
self.currentHeightLayout.setMargin(0)
self.currentHeightLayout.setObjectName(u'currentHeightLayout')
self.currentHeightLabel = QtGui.QLabel(self.displayGroupBox)
self.currentHeightLabel.setMaximumSize(QtCore.QSize(100, 16777215))
@ -192,6 +202,8 @@ class GeneralTab(SettingsTab):
self.currentHeightLayout.addWidget(self.currentHeightValueLabel)
self.currentLayout.addLayout(self.currentHeightLayout)
self.currentWidthLayout = QtGui.QVBoxLayout()
self.currentWidthLayout.setSpacing(0)
self.currentWidthLayout.setMargin(0)
self.currentWidthLayout.setObjectName(u'currentWidthLayout')
self.currentWidthLabel = QtGui.QLabel(self.displayGroupBox)
self.currentWidthLabel.setAlignment(QtCore.Qt.AlignCenter)
@ -209,53 +221,63 @@ class GeneralTab(SettingsTab):
self.GeneralRightLayout.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.customXValueEdit = QtGui.QLineEdit(self.displayGroupBox)
self.customXValueEdit.setMaximumSize(QtCore.QSize(50, 16777215))
self.customXValueEdit.setMaxLength(4)
#self.customXValueEdit.setMaximumSize(QtCore.QSize(50, 16777215))
#self.customXValueEdit.setMaxLength(4)
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.customYLabel = QtGui.QLabel(self.displayGroupBox)
self.customYLabel.setAlignment(QtCore.Qt.AlignCenter)
self.customYLabel.setObjectName(u'customYLabel')
self.customYLayout.addWidget(self.customYLabel)
self.customYValueEdit = QtGui.QLineEdit(self.displayGroupBox)
self.customYValueEdit.setMaximumSize(QtCore.QSize(50, 16777215))
self.customYValueEdit.setMaxLength(4)
#self.customYValueEdit.setMaximumSize(QtCore.QSize(50, 16777215))
#self.customYValueEdit.setMaxLength(4)
self.customYValueEdit.setObjectName(u'customYValueEdit')
self.customYLayout.addWidget(self.customYValueEdit)
self.customLayout.addLayout(self.customYLayout)
self.customHeightLayout = QtGui.QVBoxLayout()
self.customHeightLayout.setSpacing(0)
self.customHeightLayout.setMargin(0)
self.customHeightLayout.setObjectName(u'customHeightLayout')
self.customHeightLabel = QtGui.QLabel(self.displayGroupBox)
self.customHeightLabel.setAlignment(QtCore.Qt.AlignCenter)
self.customHeightLabel.setObjectName(u'customHeightLabel')
self.customHeightLayout.addWidget(self.customHeightLabel)
self.customHeightValueEdit = QtGui.QLineEdit(self.displayGroupBox)
self.customHeightValueEdit.setMaximumSize(QtCore.QSize(50, 16777215))
self.customHeightValueEdit.setMaxLength(4)
#self.customHeightValueEdit.setMaximumSize(QtCore.QSize(50, 16777215))
#self.customHeightValueEdit.setMaxLength(4)
self.customHeightValueEdit.setObjectName(u'customHeightValueEdit')
self.customHeightLayout.addWidget(self.customHeightValueEdit)
self.customLayout.addLayout(self.customHeightLayout)
self.customWidthLayout = QtGui.QVBoxLayout()
self.customWidthLayout.setSpacing(0)
self.customWidthLayout.setMargin(0)
self.customWidthLayout.setSizeConstraint(QtGui.QLayout.SetMinimumSize)
self.customWidthLayout.setObjectName(u'customWidthLayout')
self.customWidthLabel = QtGui.QLabel(self.displayGroupBox)
self.customWidthLabel.setMaximumSize(QtCore.QSize(100, 16777215))
#self.customWidthLabel.setMaximumSize(QtCore.QSize(100, 16777215))
self.customWidthLabel.setAlignment(QtCore.Qt.AlignCenter)
self.customWidthLabel.setObjectName(u'customWidthLabel')
self.customWidthLayout.addWidget(self.customWidthLabel)
self.customWidthValueEdit = QtGui.QLineEdit(self.displayGroupBox)
self.customWidthValueEdit.setMaximumSize(QtCore.QSize(60, 16777215))
#self.customWidthValueEdit.setMaximumSize(QtCore.QSize(60, 16777215))
self.customWidthValueEdit.setObjectName(u'customWidthValueEdit')
self.customWidthLayout.addWidget(self.customWidthValueEdit)
self.customLayout.addLayout(self.customWidthLayout)
@ -434,11 +456,9 @@ class GeneralTab(SettingsTab):
int(self.customHeightValueEdit.text()))
if self.overrideCheckBox.isChecked():
self.screens.set_override_display()
Receiver.send_message(u'config_screen_changed')
else:
self.screens.reset_current_display()
#only trigger event if data has changed in this edit session
if self.override_changed:
Receiver.send_message(u'config_screen_changed')
def onOverrideCheckBoxToggled(self, checked):
self.customXValueEdit.setEnabled(checked)

View File

@ -24,40 +24,44 @@
###############################################################################
from PyQt4 import QtCore, QtGui
from openlp.core.lib import translate
from openlp.core.lib import translate, build_icon
class Ui_SettingsDialog(object):
def setupUi(self, SettingsDialog):
SettingsDialog.setObjectName(u'SettingsDialog')
SettingsDialog.resize(724, 502)
self.SettingsLayout = QtGui.QVBoxLayout(SettingsDialog)
self.SettingsLayout.setSpacing(8)
self.SettingsLayout.setMargin(8)
self.SettingsLayout.setObjectName(u'SettingsLayout')
self.SettingsTabWidget = QtGui.QTabWidget(SettingsDialog)
self.SettingsTabWidget.setObjectName(u'SettingsTabWidget')
self.SettingsLayout.addWidget(self.SettingsTabWidget)
self.ButtonsBox = QtGui.QDialogButtonBox(SettingsDialog)
SettingsDialog.setWindowIcon(
build_icon(u':/system/system_settings.png'))
self.settingsLayout = QtGui.QVBoxLayout(SettingsDialog)
self.settingsLayout.setSpacing(8)
self.settingsLayout.setMargin(8)
self.settingsLayout.setObjectName(u'settingsLayout')
self.settingsTabWidget = QtGui.QTabWidget(SettingsDialog)
self.settingsTabWidget.setObjectName(u'settingsTabWidget')
self.settingsLayout.addWidget(self.settingsTabWidget)
self.buttonBox = QtGui.QDialogButtonBox(SettingsDialog)
sizePolicy = QtGui.QSizePolicy(
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(
self.ButtonsBox.sizePolicy().hasHeightForWidth())
self.ButtonsBox.setSizePolicy(sizePolicy)
self.ButtonsBox.setMaximumSize(QtCore.QSize(16777215, 16777215))
self.ButtonsBox.setOrientation(QtCore.Qt.Horizontal)
self.ButtonsBox.setStandardButtons(
QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok)
self.ButtonsBox.setObjectName(u'ButtonsBox')
self.SettingsLayout.addWidget(self.ButtonsBox)
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.retranslateUi(SettingsDialog)
self.SettingsTabWidget.setCurrentIndex(0)
QtCore.QObject.connect(self.ButtonsBox,
self.settingsTabWidget.setCurrentIndex(0)
QtCore.QObject.connect(self.buttonBox,
QtCore.SIGNAL(u'accepted()'), SettingsDialog.accept)
QtCore.QObject.connect(self.ButtonsBox,
QtCore.QObject.connect(self.buttonBox,
QtCore.SIGNAL(u'rejected()'), SettingsDialog.reject)
QtCore.QMetaObject.connectSlotsByName(SettingsDialog)
def retranslateUi(self, SettingsDialog):
SettingsDialog.setWindowTitle(translate('SettingsForm', 'Settings'))
SettingsDialog.setWindowTitle(translate('SettingsForm',
'Configure OpenLP'))

View File

@ -29,7 +29,7 @@ import logging
from PyQt4 import QtGui
from openlp.core.ui import AdvancedTab, GeneralTab, ThemesTab, DisplayTab
from openlp.core.ui import AdvancedTab, GeneralTab, ThemesTab #, DisplayTab
from settingsdialog import Ui_SettingsDialog
log = logging.getLogger(__name__)
@ -45,14 +45,14 @@ class SettingsForm(QtGui.QDialog, Ui_SettingsDialog):
QtGui.QDialog.__init__(self, parent)
self.setupUi(self)
# General tab
self.GeneralTab = GeneralTab(screens)
self.addTab(u'General', self.GeneralTab)
self.generalTab = GeneralTab(screens)
self.addTab(u'General', self.generalTab)
# Themes tab
self.ThemesTab = ThemesTab(mainWindow)
self.addTab(u'Themes', self.ThemesTab)
self.themesTab = ThemesTab(mainWindow)
self.addTab(u'Themes', self.themesTab)
# Display tab
self.DisplayTab = DisplayTab(screens)
self.addTab(u'Display', self.DisplayTab)
#self.DisplayTab = DisplayTab(screens)
#self.addTab(u'Display', self.DisplayTab)
# Advanced tab
self.advancedTab = AdvancedTab()
self.addTab(u'Advanced', self.advancedTab)
@ -62,7 +62,7 @@ class SettingsForm(QtGui.QDialog, Ui_SettingsDialog):
Add a tab to the form
"""
log.info(u'Adding %s tab' % tab.tabTitle)
self.SettingsTabWidget.addTab(tab, tab.tabTitleVisible)
self.settingsTabWidget.addTab(tab, tab.tabTitleVisible)
def insertTab(self, tab, location):
"""
@ -70,7 +70,7 @@ class SettingsForm(QtGui.QDialog, Ui_SettingsDialog):
"""
log.debug(u'Inserting %s tab' % tab.tabTitle)
# 14 : There are 3 tables currently and locations starts at -10
self.SettingsTabWidget.insertTab(
self.settingsTabWidget.insertTab(
location + 14, tab, tab.tabTitleVisible)
def removeTab(self, name):
@ -78,22 +78,22 @@ class SettingsForm(QtGui.QDialog, Ui_SettingsDialog):
Remove a tab from the form
"""
log.debug(u'remove %s tab' % name)
for tab_index in range(0, self.SettingsTabWidget.count()):
if self.SettingsTabWidget.widget(tab_index):
if self.SettingsTabWidget.widget(tab_index).tabTitle == name:
self.SettingsTabWidget.removeTab(tab_index)
for tab_index in range(0, self.settingsTabWidget.count()):
if self.settingsTabWidget.widget(tab_index):
if self.settingsTabWidget.widget(tab_index).tabTitle == name:
self.settingsTabWidget.removeTab(tab_index)
def accept(self):
"""
Process the form saving the settings
"""
for tab_index in range(0, self.SettingsTabWidget.count()):
self.SettingsTabWidget.widget(tab_index).save()
for tab_index in range(0, self.settingsTabWidget.count()):
self.settingsTabWidget.widget(tab_index).save()
return QtGui.QDialog.accept(self)
def postSetUp(self):
"""
Run any post-setup code for the tabs on the form
"""
for tab_index in range(0, self.SettingsTabWidget.count()):
self.SettingsTabWidget.widget(tab_index).postSetUp()
for tab_index in range(0, self.settingsTabWidget.count()):
self.settingsTabWidget.widget(tab_index).postSetUp()