Cleanup signals (Bug #599146)

This commit is contained in:
Jon Tibble 2010-07-01 16:46:51 +01:00
parent 254ac02561
commit d939a39895
4 changed files with 114 additions and 189 deletions

View File

@ -178,13 +178,11 @@ class Ui_AmendThemeDialog(object):
self.MainFontLayout.setWidget(2, QtGui.QFormLayout.LabelRole, self.MainFontLayout.setWidget(2, QtGui.QFormLayout.LabelRole,
self.FontMainSize) self.FontMainSize)
self.FontMainSizeSpinBox = QtGui.QSpinBox(self.FontMainGroupBox) self.FontMainSizeSpinBox = QtGui.QSpinBox(self.FontMainGroupBox)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, defaultSizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum,
QtGui.QSizePolicy.Fixed) QtGui.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0) defaultSizePolicy.setHeightForWidth(
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(
self.FontMainSizeSpinBox.sizePolicy().hasHeightForWidth()) self.FontMainSizeSpinBox.sizePolicy().hasHeightForWidth())
self.FontMainSizeSpinBox.setSizePolicy(sizePolicy) self.FontMainSizeSpinBox.setSizePolicy(defaultSizePolicy)
self.FontMainSizeSpinBox.setMinimumSize(QtCore.QSize(70, 0)) self.FontMainSizeSpinBox.setMinimumSize(QtCore.QSize(70, 0))
self.FontMainSizeSpinBox.setProperty(u'value', QtCore.QVariant(16)) self.FontMainSizeSpinBox.setProperty(u'value', QtCore.QVariant(16))
self.FontMainSizeSpinBox.setMaximum(999) self.FontMainSizeSpinBox.setMaximum(999)
@ -230,8 +228,7 @@ class Ui_AmendThemeDialog(object):
self.FontMainLineSpacingSpinBox) self.FontMainLineSpacingSpinBox)
self.FontMainLinesPageLabel = QtGui.QLabel(self.FontMainGroupBox) self.FontMainLinesPageLabel = QtGui.QLabel(self.FontMainGroupBox)
self.FontMainLinesPageLabel.setObjectName(u'FontMainLinesPageLabel') self.FontMainLinesPageLabel.setObjectName(u'FontMainLinesPageLabel')
self.MainFontLayout.setWidget(6, QtGui.QFormLayout.LabelRole, self.MainFontLayout.addRow(self.FontMainLinesPageLabel)
self.FontMainLinesPageLabel)
spacerItem1 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, spacerItem1 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum,
QtGui.QSizePolicy.Expanding) QtGui.QSizePolicy.Expanding)
self.MainLeftLayout.addItem(spacerItem1) self.MainLeftLayout.addItem(spacerItem1)
@ -275,13 +272,9 @@ class Ui_AmendThemeDialog(object):
self.MainLocationLayout.setWidget(4, QtGui.QFormLayout.LabelRole, self.MainLocationLayout.setWidget(4, QtGui.QFormLayout.LabelRole,
self.FontMainHeightLabel) self.FontMainHeightLabel)
self.FontMainXSpinBox = QtGui.QSpinBox(self.MainLocationGroupBox) self.FontMainXSpinBox = QtGui.QSpinBox(self.MainLocationGroupBox)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, defaultSizePolicy.setHeightForWidth(
QtGui.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(
self.FontMainXSpinBox.sizePolicy().hasHeightForWidth()) self.FontMainXSpinBox.sizePolicy().hasHeightForWidth())
self.FontMainXSpinBox.setSizePolicy(sizePolicy) self.FontMainXSpinBox.setSizePolicy(defaultSizePolicy)
self.FontMainXSpinBox.setMinimumSize(QtCore.QSize(78, 0)) self.FontMainXSpinBox.setMinimumSize(QtCore.QSize(78, 0))
self.FontMainXSpinBox.setProperty(u'value', QtCore.QVariant(0)) self.FontMainXSpinBox.setProperty(u'value', QtCore.QVariant(0))
self.FontMainXSpinBox.setMaximum(9999) self.FontMainXSpinBox.setMaximum(9999)
@ -289,39 +282,27 @@ class Ui_AmendThemeDialog(object):
self.MainLocationLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.MainLocationLayout.setWidget(1, QtGui.QFormLayout.FieldRole,
self.FontMainXSpinBox) self.FontMainXSpinBox)
self.FontMainYSpinBox = QtGui.QSpinBox(self.MainLocationGroupBox) self.FontMainYSpinBox = QtGui.QSpinBox(self.MainLocationGroupBox)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, defaultSizePolicy.setHeightForWidth(
QtGui.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(
self.FontMainYSpinBox.sizePolicy().hasHeightForWidth()) self.FontMainYSpinBox.sizePolicy().hasHeightForWidth())
self.FontMainYSpinBox.setSizePolicy(sizePolicy) self.FontMainYSpinBox.setSizePolicy(defaultSizePolicy)
self.FontMainYSpinBox.setMinimumSize(QtCore.QSize(78, 0)) self.FontMainYSpinBox.setMinimumSize(QtCore.QSize(78, 0))
self.FontMainYSpinBox.setMaximum(9999) self.FontMainYSpinBox.setMaximum(9999)
self.FontMainYSpinBox.setObjectName(u'FontMainYSpinBox') self.FontMainYSpinBox.setObjectName(u'FontMainYSpinBox')
self.MainLocationLayout.setWidget(2, QtGui.QFormLayout.FieldRole, self.MainLocationLayout.setWidget(2, QtGui.QFormLayout.FieldRole,
self.FontMainYSpinBox) self.FontMainYSpinBox)
self.FontMainWidthSpinBox = QtGui.QSpinBox(self.MainLocationGroupBox) self.FontMainWidthSpinBox = QtGui.QSpinBox(self.MainLocationGroupBox)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, defaultSizePolicy.setHeightForWidth(
QtGui.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(
self.FontMainWidthSpinBox.sizePolicy().hasHeightForWidth()) self.FontMainWidthSpinBox.sizePolicy().hasHeightForWidth())
self.FontMainWidthSpinBox.setSizePolicy(sizePolicy) self.FontMainWidthSpinBox.setSizePolicy(defaultSizePolicy)
self.FontMainWidthSpinBox.setMinimumSize(QtCore.QSize(78, 0)) self.FontMainWidthSpinBox.setMinimumSize(QtCore.QSize(78, 0))
self.FontMainWidthSpinBox.setMaximum(9999) self.FontMainWidthSpinBox.setMaximum(9999)
self.FontMainWidthSpinBox.setObjectName(u'FontMainWidthSpinBox') self.FontMainWidthSpinBox.setObjectName(u'FontMainWidthSpinBox')
self.MainLocationLayout.setWidget(3, QtGui.QFormLayout.FieldRole, self.MainLocationLayout.setWidget(3, QtGui.QFormLayout.FieldRole,
self.FontMainWidthSpinBox) self.FontMainWidthSpinBox)
self.FontMainHeightSpinBox = QtGui.QSpinBox(self.MainLocationGroupBox) self.FontMainHeightSpinBox = QtGui.QSpinBox(self.MainLocationGroupBox)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, defaultSizePolicy.setHeightForWidth(
QtGui.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(
self.FontMainHeightSpinBox.sizePolicy().hasHeightForWidth()) self.FontMainHeightSpinBox.sizePolicy().hasHeightForWidth())
self.FontMainHeightSpinBox.setSizePolicy(sizePolicy) self.FontMainHeightSpinBox.setSizePolicy(defaultSizePolicy)
self.FontMainHeightSpinBox.setMinimumSize(QtCore.QSize(78, 0)) self.FontMainHeightSpinBox.setMinimumSize(QtCore.QSize(78, 0))
self.FontMainHeightSpinBox.setMaximum(9999) self.FontMainHeightSpinBox.setMaximum(9999)
self.FontMainHeightSpinBox.setObjectName(u'FontMainHeightSpinBox') self.FontMainHeightSpinBox.setObjectName(u'FontMainHeightSpinBox')
@ -378,13 +359,9 @@ class Ui_AmendThemeDialog(object):
self.FooterFontLayout.setWidget(2, QtGui.QFormLayout.LabelRole, self.FooterFontLayout.setWidget(2, QtGui.QFormLayout.LabelRole,
self.FontFooterSizeLabel) self.FontFooterSizeLabel)
self.FontFooterSizeSpinBox = QtGui.QSpinBox(self.FooterFontGroupBox) self.FontFooterSizeSpinBox = QtGui.QSpinBox(self.FooterFontGroupBox)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, defaultSizePolicy.setHeightForWidth(
QtGui.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(
self.FontFooterSizeSpinBox.sizePolicy().hasHeightForWidth()) self.FontFooterSizeSpinBox.sizePolicy().hasHeightForWidth())
self.FontFooterSizeSpinBox.setSizePolicy(sizePolicy) self.FontFooterSizeSpinBox.setSizePolicy(defaultSizePolicy)
self.FontFooterSizeSpinBox.setMinimumSize(QtCore.QSize(70, 0)) self.FontFooterSizeSpinBox.setMinimumSize(QtCore.QSize(70, 0))
self.FontFooterSizeSpinBox.setProperty(u'value', QtCore.QVariant(10)) self.FontFooterSizeSpinBox.setProperty(u'value', QtCore.QVariant(10))
self.FontFooterSizeSpinBox.setMaximum(999) self.FontFooterSizeSpinBox.setMaximum(999)
@ -453,13 +430,9 @@ class Ui_AmendThemeDialog(object):
self.LocationFooterLayout.setWidget(4, QtGui.QFormLayout.LabelRole, self.LocationFooterLayout.setWidget(4, QtGui.QFormLayout.LabelRole,
self.FontFooterHeightLabel) self.FontFooterHeightLabel)
self.FontFooterXSpinBox = QtGui.QSpinBox(self.LocationFooterGroupBox) self.FontFooterXSpinBox = QtGui.QSpinBox(self.LocationFooterGroupBox)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, defaultSizePolicy.setHeightForWidth(
QtGui.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(
self.FontFooterXSpinBox.sizePolicy().hasHeightForWidth()) self.FontFooterXSpinBox.sizePolicy().hasHeightForWidth())
self.FontFooterXSpinBox.setSizePolicy(sizePolicy) self.FontFooterXSpinBox.setSizePolicy(defaultSizePolicy)
self.FontFooterXSpinBox.setMinimumSize(QtCore.QSize(78, 0)) self.FontFooterXSpinBox.setMinimumSize(QtCore.QSize(78, 0))
self.FontFooterXSpinBox.setProperty(u'value', QtCore.QVariant(0)) self.FontFooterXSpinBox.setProperty(u'value', QtCore.QVariant(0))
self.FontFooterXSpinBox.setMaximum(9999) self.FontFooterXSpinBox.setMaximum(9999)
@ -467,13 +440,9 @@ class Ui_AmendThemeDialog(object):
self.LocationFooterLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.LocationFooterLayout.setWidget(1, QtGui.QFormLayout.FieldRole,
self.FontFooterXSpinBox) self.FontFooterXSpinBox)
self.FontFooterYSpinBox = QtGui.QSpinBox(self.LocationFooterGroupBox) self.FontFooterYSpinBox = QtGui.QSpinBox(self.LocationFooterGroupBox)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, defaultSizePolicy.setHeightForWidth(
QtGui.QSizePolicy.Fixed) self.FontFooterXSpinBox.sizePolicy().hasHeightForWidth())
sizePolicy.setHorizontalStretch(0) self.FontFooterYSpinBox.setSizePolicy(defaultSizePolicy)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(
self.FontFooterYSpinBox.sizePolicy().hasHeightForWidth())
self.FontFooterYSpinBox.setSizePolicy(sizePolicy)
self.FontFooterYSpinBox.setMinimumSize(QtCore.QSize(78, 0)) self.FontFooterYSpinBox.setMinimumSize(QtCore.QSize(78, 0))
self.FontFooterYSpinBox.setProperty(u'value', QtCore.QVariant(0)) self.FontFooterYSpinBox.setProperty(u'value', QtCore.QVariant(0))
self.FontFooterYSpinBox.setMaximum(9999) self.FontFooterYSpinBox.setMaximum(9999)
@ -901,4 +870,3 @@ class Ui_AmendThemeDialog(object):
self.ThemeTabWidget.indexOf(self.OtherOptionsTab), self.ThemeTabWidget.indexOf(self.OtherOptionsTab),
translate('AmendThemeForm', '&Other Options')) translate('AmendThemeForm', '&Other Options'))
self.PreviewGroupBox.setTitle(translate('AmendThemeForm', 'Preview')) self.PreviewGroupBox.setTitle(translate('AmendThemeForm', 'Preview'))

View File

@ -43,7 +43,7 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
self.path = None self.path = None
self.theme = ThemeXML() self.theme = ThemeXML()
self.setupUi(self) self.setupUi(self)
#define signals # Define signals
# Buttons # Buttons
QtCore.QObject.connect(self.Color1PushButton, QtCore.QObject.connect(self.Color1PushButton,
QtCore.SIGNAL(u'pressed()'), self.onColor1PushButtonClicked) QtCore.SIGNAL(u'pressed()'), self.onColor1PushButtonClicked)
@ -84,55 +84,56 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
QtCore.SIGNAL(u'activated(int)'), self.onVerticalComboBoxSelected) QtCore.SIGNAL(u'activated(int)'), self.onVerticalComboBoxSelected)
# Spin boxes # Spin boxes
QtCore.QObject.connect(self.FontMainSizeSpinBox, QtCore.QObject.connect(self.FontMainSizeSpinBox,
QtCore.SIGNAL(u'editingFinished()'), QtCore.SIGNAL(u'valueChanged(int)'),
self.onFontMainSizeSpinBoxChanged) self.onFontMainSizeSpinBoxChanged)
QtCore.QObject.connect(self.FontFooterSizeSpinBox, QtCore.QObject.connect(self.FontFooterSizeSpinBox,
QtCore.SIGNAL(u'editingFinished()'), QtCore.SIGNAL(u'valueChanged(int)'),
self.onFontFooterSizeSpinBoxChanged) self.onFontFooterSizeSpinBoxChanged)
QtCore.QObject.connect(self.FontMainXSpinBox,
QtCore.SIGNAL(u'valueChanged(int)'), self.onFontMainXSpinBoxChanged)
QtCore.QObject.connect(self.FontMainYSpinBox,
QtCore.SIGNAL(u'valueChanged(int)'), self.onFontMainYSpinBoxChanged)
QtCore.QObject.connect(self.FontMainWidthSpinBox,
QtCore.SIGNAL(u'valueChanged(int)'),
self.onFontMainWidthSpinBoxChanged)
QtCore.QObject.connect(self.FontMainHeightSpinBox,
QtCore.SIGNAL(u'valueChanged(int)'),
self.onFontMainHeightSpinBoxChanged)
QtCore.QObject.connect(self.FontMainLineAdjustmentSpinBox,
QtCore.SIGNAL(u'valueChanged(int)'),
self.onFontMainLineAdjustmentSpinBoxChanged)
QtCore.QObject.connect(self.FontMainLineSpacingSpinBox,
QtCore.SIGNAL(u'valueChanged(int)'),
self.onFontMainLineSpacingSpinBoxChanged)
QtCore.QObject.connect(self.FontFooterXSpinBox,
QtCore.SIGNAL(u'valueChanged(int)'),
self.onFontFooterXSpinBoxChanged)
QtCore.QObject.connect(self.FontFooterYSpinBox,
QtCore.SIGNAL(u'valueChanged(int)'),
self.onFontFooterYSpinBoxChanged)
QtCore.QObject.connect(self.FontFooterWidthSpinBox,
QtCore.SIGNAL(u'valueChanged(int)'),
self.onFontFooterWidthSpinBoxChanged)
QtCore.QObject.connect(self.FontFooterHeightSpinBox,
QtCore.SIGNAL(u'valueChanged(int)'),
self.onFontFooterHeightSpinBoxChanged)
QtCore.QObject.connect(self.ShadowSpinBox,
QtCore.SIGNAL(u'valueChanged(int)'),
self.onShadowSpinBoxChanged)
QtCore.QObject.connect(self.ShadowCheckBox,
QtCore.SIGNAL(u'valueChanged(int)'), self.onShadowCheckBoxChanged)
QtCore.QObject.connect(self.OutlineSpinBox,
QtCore.SIGNAL(u'valueChanged(int)'),
self.onOutlineSpinBoxChanged)
# Checkboxes
QtCore.QObject.connect(self.FontMainDefaultCheckBox, QtCore.QObject.connect(self.FontMainDefaultCheckBox,
QtCore.SIGNAL(u'stateChanged(int)'), QtCore.SIGNAL(u'stateChanged(int)'),
self.onFontMainDefaultCheckBoxChanged) self.onFontMainDefaultCheckBoxChanged)
QtCore.QObject.connect(self.FontMainXSpinBox,
QtCore.SIGNAL(u'editingFinished()'), self.onFontMainXSpinBoxChanged)
QtCore.QObject.connect(self.FontMainYSpinBox,
QtCore.SIGNAL(u'editingFinished()'), self.onFontMainYSpinBoxChanged)
QtCore.QObject.connect(self.FontMainWidthSpinBox,
QtCore.SIGNAL(u'editingFinished()'),
self.onFontMainWidthSpinBoxChanged)
QtCore.QObject.connect(self.FontMainHeightSpinBox,
QtCore.SIGNAL(u'editingFinished()'),
self.onFontMainHeightSpinBoxChanged)
QtCore.QObject.connect(self.FontMainLineAdjustmentSpinBox,
QtCore.SIGNAL(u'editingFinished()'),
self.onFontMainLineAdjustmentSpinBoxChanged)
QtCore.QObject.connect(self.FontMainLineSpacingSpinBox,
QtCore.SIGNAL(u'editingFinished()'),
self.onFontMainLineSpacingSpinBoxChanged)
QtCore.QObject.connect(self.FontFooterDefaultCheckBox, QtCore.QObject.connect(self.FontFooterDefaultCheckBox,
QtCore.SIGNAL(u'stateChanged(int)'), QtCore.SIGNAL(u'stateChanged(int)'),
self.onFontFooterDefaultCheckBoxChanged) self.onFontFooterDefaultCheckBoxChanged)
QtCore.QObject.connect(self.FontFooterXSpinBox,
QtCore.SIGNAL(u'editingFinished()'),
self.onFontFooterXSpinBoxChanged)
QtCore.QObject.connect(self.FontFooterYSpinBox,
QtCore.SIGNAL(u'editingFinished()'),
self.onFontFooterYSpinBoxChanged)
QtCore.QObject.connect(self.FontFooterWidthSpinBox,
QtCore.SIGNAL(u'editingFinished()'),
self.onFontFooterWidthSpinBoxChanged)
QtCore.QObject.connect(self.FontFooterHeightSpinBox,
QtCore.SIGNAL(u'editingFinished()'),
self.onFontFooterHeightSpinBoxChanged)
QtCore.QObject.connect(self.OutlineCheckBox, QtCore.QObject.connect(self.OutlineCheckBox,
QtCore.SIGNAL(u'stateChanged(int)'), self.onOutlineCheckBoxChanged) QtCore.SIGNAL(u'stateChanged(int)'), self.onOutlineCheckBoxChanged)
QtCore.QObject.connect(self.ShadowSpinBox,
QtCore.SIGNAL(u'editingFinished()'),
self.onShadowSpinBoxChanged)
QtCore.QObject.connect(self.ShadowCheckBox,
QtCore.SIGNAL(u'stateChanged(int)'), self.onShadowCheckBoxChanged)
QtCore.QObject.connect(self.OutlineSpinBox,
QtCore.SIGNAL(u'editingFinished()'),
self.onOutlineSpinBoxChanged)
QtCore.QObject.connect(self.SlideTransitionCheckedBox, QtCore.QObject.connect(self.SlideTransitionCheckedBox,
QtCore.SIGNAL(u'stateChanged(int)'), QtCore.SIGNAL(u'stateChanged(int)'),
self.onSlideTransitionCheckedBoxChanged) self.onSlideTransitionCheckedBoxChanged)

View File

@ -242,4 +242,3 @@ class DisplayTab(SettingsTab):
if self.amend_display_start != self.amend_display: if self.amend_display_start != self.amend_display:
self.amend_display_start = self.amend_display self.amend_display_start = self.amend_display
Receiver.send_message(u'config_screen_changed') Receiver.send_message(u'config_screen_changed')

View File

@ -32,13 +32,16 @@ class GeneralTab(SettingsTab):
GeneralTab is the general settings tab in the settings dialog. GeneralTab is the general settings tab in the settings dialog.
""" """
def __init__(self, screens): def __init__(self, screens):
"""
Initialise the general settings tab
"""
self.screens = screens self.screens = screens
self.MonitorNumber = 0
SettingsTab.__init__(self, u'General') SettingsTab.__init__(self, u'General')
def preLoad(self): def preLoad(self):
""" """
Set up the display screen and set correct screen Set up the display screen and set correct screen values.
values.
If not set before default to last screen. If not set before default to last screen.
""" """
settings = QtCore.QSettings() settings = QtCore.QSettings()
@ -47,12 +50,14 @@ class GeneralTab(SettingsTab):
QtCore.QVariant(self.screens.display_count - 1)).toInt()[0] QtCore.QVariant(self.screens.display_count - 1)).toInt()[0]
self.screens.set_current_display(self.MonitorNumber) self.screens.set_current_display(self.MonitorNumber)
self.screens.monitor_number = self.MonitorNumber self.screens.monitor_number = self.MonitorNumber
self.DisplayOnMonitor = settings.value( self.screens.display = settings.value(
u'display on monitor', QtCore.QVariant(True)).toBool() u'display on monitor', QtCore.QVariant(True)).toBool()
self.screens.display = self.DisplayOnMonitor
settings.endGroup() settings.endGroup()
def setupUi(self): def setupUi(self):
"""
Create the user interface for the general settings tab
"""
self.setObjectName(u'GeneralTab') self.setObjectName(u'GeneralTab')
self.tabTitleVisible = translate('GeneralTab', 'General') self.tabTitleVisible = translate('GeneralTab', 'General')
self.GeneralLayout = QtGui.QHBoxLayout(self) self.GeneralLayout = QtGui.QHBoxLayout(self)
@ -152,31 +157,11 @@ class GeneralTab(SettingsTab):
QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
self.GeneralRightLayout.addItem(self.GeneralRightSpacer) self.GeneralRightLayout.addItem(self.GeneralRightSpacer)
self.GeneralLayout.addWidget(self.GeneralRightWidget) self.GeneralLayout.addWidget(self.GeneralRightWidget)
QtCore.QObject.connect(self.MonitorComboBox,
QtCore.SIGNAL(u'activated(int)'), self.onMonitorComboBoxChanged)
QtCore.QObject.connect(self.DisplayOnMonitorCheck,
QtCore.SIGNAL(u'stateChanged(int)'),
self.onDisplayOnMonitorCheckChanged)
QtCore.QObject.connect(self.WarningCheckBox,
QtCore.SIGNAL(u'stateChanged(int)'), self.onWarningCheckBoxChanged)
QtCore.QObject.connect(self.AutoOpenCheckBox,
QtCore.SIGNAL(u'stateChanged(int)'), self.onAutoOpenCheckBoxChanged)
QtCore.QObject.connect(self.ShowSplashCheckBox,
QtCore.SIGNAL(u'stateChanged(int)'),
self.onShowSplashCheckBoxChanged)
QtCore.QObject.connect(self.SaveCheckServiceCheckBox,
QtCore.SIGNAL(u'stateChanged(int)'),
self.onSaveCheckServiceCheckBox)
QtCore.QObject.connect(self.AutoPreviewCheckBox,
QtCore.SIGNAL(u'stateChanged(int)'), self.onAutoPreviewCheckBox)
QtCore.QObject.connect(self.NumberEdit,
QtCore.SIGNAL(u'editingFinished()'), self.onNumberEditLostFocus)
QtCore.QObject.connect(self.UsernameEdit,
QtCore.SIGNAL(u'editingFinished()'), self.onUsernameEditLostFocus)
QtCore.QObject.connect(self.PasswordEdit,
QtCore.SIGNAL(u'editingFinished()'), self.onPasswordEditLostFocus)
def retranslateUi(self): def retranslateUi(self):
"""
Translate the general settings tab to the currently selected language
"""
self.MonitorGroupBox.setTitle(translate('GeneralTab', 'Monitors')) self.MonitorGroupBox.setTitle(translate('GeneralTab', 'Monitors'))
self.MonitorLabel.setText( self.MonitorLabel.setText(
translate('GeneralTab', 'Select monitor for output display:')) translate('GeneralTab', 'Select monitor for output display:'))
@ -204,37 +189,10 @@ class GeneralTab(SettingsTab):
self.PasswordLabel.setText( self.PasswordLabel.setText(
translate('GeneralTab', 'SongSelect Password:')) translate('GeneralTab', 'SongSelect Password:'))
def onMonitorComboBoxChanged(self):
self.MonitorNumber = self.MonitorComboBox.currentIndex()
def onDisplayOnMonitorCheckChanged(self, value):
self.DisplayOnMonitor = (value == QtCore.Qt.Checked)
def onAutoOpenCheckBoxChanged(self, value):
self.AutoOpen = (value == QtCore.Qt.Checked)
def onShowSplashCheckBoxChanged(self, value):
self.ShowSplash = (value == QtCore.Qt.Checked)
def onWarningCheckBoxChanged(self, value):
self.Warning = (value == QtCore.Qt.Checked)
def onSaveCheckServiceCheckBox(self, value):
self.PromptSaveService = (value == QtCore.Qt.Checked)
def onAutoPreviewCheckBox(self, value):
self.AutoPreview = (value == QtCore.Qt.Checked)
def onNumberEditLostFocus(self):
self.CCLINumber = self.NumberEdit.displayText()
def onUsernameEditLostFocus(self):
self.Username = self.UsernameEdit.displayText()
def onPasswordEditLostFocus(self):
self.Password = self.PasswordEdit.displayText()
def load(self): def load(self):
"""
Load the settings to populate the form
"""
settings = QtCore.QSettings() settings = QtCore.QSettings()
settings.beginGroup(self.settingsSection) settings.beginGroup(self.settingsSection)
for screen in self.screens.screen_list: for screen in self.screens.screen_list:
@ -244,55 +202,54 @@ class GeneralTab(SettingsTab):
screen_name = u'%s (%s)' % (screen_name, screen_name = u'%s (%s)' % (screen_name,
translate('GeneralTab', 'primary')) translate('GeneralTab', 'primary'))
self.MonitorComboBox.addItem(screen_name) self.MonitorComboBox.addItem(screen_name)
# Get the configs self.NumberEdit.setText(unicode(settings.value(
self.Warning = settings.value( u'ccli number', QtCore.QVariant(u'')).toString()))
u'blank warning', QtCore.QVariant(False)).toBool() self.UsernameEdit.setText(unicode(settings.value(
self.AutoOpen = settings.value( u'songselect username', QtCore.QVariant(u'')).toString()))
u'auto open', QtCore.QVariant(False)).toBool() self.PasswordEdit.setText(unicode(settings.value(
self.ShowSplash = settings.value( u'songselect password', QtCore.QVariant(u'')).toString()))
u'show splash', QtCore.QVariant(True)).toBool() self.SaveCheckServiceCheckBox.setChecked(settings.value(u'save prompt',
self.PromptSaveService = settings.value( QtCore.QVariant(False)).toBool())
u'save prompt', QtCore.QVariant(False)).toBool()
self.AutoPreview = settings.value(
u'auto preview', QtCore.QVariant(False)).toBool()
self.CCLINumber = unicode(settings.value(
u'ccli number', QtCore.QVariant(u'')).toString())
self.Username = unicode(settings.value(
u'songselect username', QtCore.QVariant(u'')).toString())
self.Password = unicode(settings.value(
u'songselect password', QtCore.QVariant(u'')).toString())
settings.endGroup()
self.SaveCheckServiceCheckBox.setChecked(self.PromptSaveService)
# Set a few things up
self.MonitorComboBox.setCurrentIndex(self.MonitorNumber) self.MonitorComboBox.setCurrentIndex(self.MonitorNumber)
self.DisplayOnMonitorCheck.setChecked(self.DisplayOnMonitor) self.DisplayOnMonitorCheck.setChecked(self.screens.display)
self.WarningCheckBox.setChecked(self.Warning) self.WarningCheckBox.setChecked(settings.value(u'blank warning',
self.AutoOpenCheckBox.setChecked(self.AutoOpen) QtCore.QVariant(False)).toBool())
self.ShowSplashCheckBox.setChecked(self.ShowSplash) self.AutoOpenCheckBox.setChecked(settings.value(u'auto open',
self.AutoPreviewCheckBox.setChecked(self.AutoPreview) QtCore.QVariant(False)).toBool())
self.NumberEdit.setText(self.CCLINumber) self.ShowSplashCheckBox.setChecked(settings.value(u'show splash',
self.UsernameEdit.setText(self.Username) QtCore.QVariant(True)).toBool())
self.PasswordEdit.setText(self.Password) self.AutoPreviewCheckBox.setChecked(settings.value(u'auto preview',
QtCore.QVariant(False)).toBool())
settings.endGroup()
def save(self): def save(self):
"""
Save the settings from the form
"""
self.MonitorNumber = self.MonitorComboBox.currentIndex()
settings = QtCore.QSettings() settings = QtCore.QSettings()
settings.beginGroup(self.settingsSection) settings.beginGroup(self.settingsSection)
settings.setValue(u'monitor', QtCore.QVariant(self.MonitorNumber)) settings.setValue(u'monitor', QtCore.QVariant(self.MonitorNumber))
settings.setValue(u'display on monitor', settings.setValue(u'display on monitor',
QtCore.QVariant(self.DisplayOnMonitor)) QtCore.QVariant(self.DisplayOnMonitorCheck.isChecked()))
settings.setValue(u'blank warning', QtCore.QVariant(self.Warning)) settings.setValue(u'blank warning',
settings.setValue(u'auto open', QtCore.QVariant(self.AutoOpen)) QtCore.QVariant(self.WarningCheckBox.isChecked()))
settings.setValue(u'show splash', QtCore.QVariant(self.ShowSplash)) settings.setValue(u'auto open',
QtCore.QVariant(self.AutoOpenCheckBox.isChecked()))
settings.setValue(u'show splash',
QtCore.QVariant(self.ShowSplashCheckBox.isChecked()))
settings.setValue(u'save prompt', settings.setValue(u'save prompt',
QtCore.QVariant(self.PromptSaveService)) QtCore.QVariant(self.SaveCheckServiceCheckBox.isChecked()))
settings.setValue(u'auto preview', QtCore.QVariant(self.AutoPreview)) settings.setValue(u'auto preview',
settings.setValue(u'ccli number', QtCore.QVariant(self.CCLINumber)) QtCore.QVariant(self.AutoPreviewCheckBox.isChecked()))
settings.setValue(u'ccli number',
QtCore.QVariant(self.NumberEdit.displayText()))
settings.setValue(u'songselect username', settings.setValue(u'songselect username',
QtCore.QVariant(self.Username)) QtCore.QVariant(self.UsernameEdit.displayText()))
settings.setValue(u'songselect password', settings.setValue(u'songselect password',
QtCore.QVariant(self.Password)) QtCore.QVariant(self.PasswordEdit.displayText()))
settings.endGroup() settings.endGroup()
self.screens.display = self.DisplayOnMonitor self.screens.display = self.DisplayOnMonitorCheck.isChecked()
#Monitor Number has changed. #Monitor Number has changed.
if self.screens.monitor_number != self.MonitorNumber: if self.screens.monitor_number != self.MonitorNumber:
self.screens.monitor_number = self.MonitorNumber self.screens.monitor_number = self.MonitorNumber