From 254ac02561c936ccb087c9aab1996d6d47a096de Mon Sep 17 00:00:00 2001 From: Jon Tibble Date: Thu, 1 Jul 2010 13:56:02 +0100 Subject: [PATCH 1/5] Alerts: Import and long lines --- openlp/plugins/alerts/lib/alertsmanager.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/openlp/plugins/alerts/lib/alertsmanager.py b/openlp/plugins/alerts/lib/alertsmanager.py index 10565a3d1..aac3eccb9 100644 --- a/openlp/plugins/alerts/lib/alertsmanager.py +++ b/openlp/plugins/alerts/lib/alertsmanager.py @@ -25,7 +25,7 @@ import logging -from PyQt4 import QtCore, QtGui +from PyQt4 import QtCore from openlp.core.lib import Receiver, translate @@ -95,7 +95,8 @@ class AlertsManager(QtCore.QObject): alertTab = self.parent.alertsTab text = HTMLCODE % (alertTab.font_color, alertTab.bg_color, alertTab.font_face, alertTab.font_size, text) - self.parent.preview_controller.parent.displayManager.addAlert(text, alertTab.location) + self.parent.preview_controller.parent.displayManager.addAlert(text, + alertTab.location) # check to see if we have a timer running if self.timer_id == 0: self.timer_id = self.startTimer(int(alertTab.timeout) * 1000) @@ -111,7 +112,8 @@ class AlertsManager(QtCore.QObject): log.debug(u'timer event') alertTab = self.parent.alertsTab if event.timerId() == self.timer_id: - self.parent.preview_controller.parent.displayManager.addAlert(u'', alertTab.location) + self.parent.preview_controller.parent.displayManager.addAlert(u'', + alertTab.location) self.killTimer(self.timer_id) self.timer_id = 0 self.generateAlert() From d939a39895b47e29349db948ea40ff2962abe6ab Mon Sep 17 00:00:00 2001 From: Jon Tibble Date: Thu, 1 Jul 2010 16:46:51 +0100 Subject: [PATCH 2/5] Cleanup signals (Bug #599146) --- openlp/core/ui/amendthemedialog.py | 70 ++++---------- openlp/core/ui/amendthemeform.py | 85 ++++++++--------- openlp/core/ui/displaytab.py | 1 - openlp/core/ui/generaltab.py | 147 ++++++++++------------------- 4 files changed, 114 insertions(+), 189 deletions(-) diff --git a/openlp/core/ui/amendthemedialog.py b/openlp/core/ui/amendthemedialog.py index a75f5e686..2bb202964 100644 --- a/openlp/core/ui/amendthemedialog.py +++ b/openlp/core/ui/amendthemedialog.py @@ -178,13 +178,11 @@ class Ui_AmendThemeDialog(object): self.MainFontLayout.setWidget(2, QtGui.QFormLayout.LabelRole, self.FontMainSize) self.FontMainSizeSpinBox = QtGui.QSpinBox(self.FontMainGroupBox) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, + defaultSizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth( + defaultSizePolicy.setHeightForWidth( self.FontMainSizeSpinBox.sizePolicy().hasHeightForWidth()) - self.FontMainSizeSpinBox.setSizePolicy(sizePolicy) + self.FontMainSizeSpinBox.setSizePolicy(defaultSizePolicy) self.FontMainSizeSpinBox.setMinimumSize(QtCore.QSize(70, 0)) self.FontMainSizeSpinBox.setProperty(u'value', QtCore.QVariant(16)) self.FontMainSizeSpinBox.setMaximum(999) @@ -230,8 +228,7 @@ class Ui_AmendThemeDialog(object): self.FontMainLineSpacingSpinBox) self.FontMainLinesPageLabel = QtGui.QLabel(self.FontMainGroupBox) self.FontMainLinesPageLabel.setObjectName(u'FontMainLinesPageLabel') - self.MainFontLayout.setWidget(6, QtGui.QFormLayout.LabelRole, - self.FontMainLinesPageLabel) + self.MainFontLayout.addRow(self.FontMainLinesPageLabel) spacerItem1 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) self.MainLeftLayout.addItem(spacerItem1) @@ -275,13 +272,9 @@ class Ui_AmendThemeDialog(object): self.MainLocationLayout.setWidget(4, QtGui.QFormLayout.LabelRole, self.FontMainHeightLabel) self.FontMainXSpinBox = QtGui.QSpinBox(self.MainLocationGroupBox) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, - QtGui.QSizePolicy.Fixed) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth( + defaultSizePolicy.setHeightForWidth( self.FontMainXSpinBox.sizePolicy().hasHeightForWidth()) - self.FontMainXSpinBox.setSizePolicy(sizePolicy) + self.FontMainXSpinBox.setSizePolicy(defaultSizePolicy) self.FontMainXSpinBox.setMinimumSize(QtCore.QSize(78, 0)) self.FontMainXSpinBox.setProperty(u'value', QtCore.QVariant(0)) self.FontMainXSpinBox.setMaximum(9999) @@ -289,39 +282,27 @@ class Ui_AmendThemeDialog(object): self.MainLocationLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.FontMainXSpinBox) self.FontMainYSpinBox = QtGui.QSpinBox(self.MainLocationGroupBox) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, - QtGui.QSizePolicy.Fixed) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth( + defaultSizePolicy.setHeightForWidth( self.FontMainYSpinBox.sizePolicy().hasHeightForWidth()) - self.FontMainYSpinBox.setSizePolicy(sizePolicy) + self.FontMainYSpinBox.setSizePolicy(defaultSizePolicy) self.FontMainYSpinBox.setMinimumSize(QtCore.QSize(78, 0)) self.FontMainYSpinBox.setMaximum(9999) self.FontMainYSpinBox.setObjectName(u'FontMainYSpinBox') self.MainLocationLayout.setWidget(2, QtGui.QFormLayout.FieldRole, self.FontMainYSpinBox) self.FontMainWidthSpinBox = QtGui.QSpinBox(self.MainLocationGroupBox) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, - QtGui.QSizePolicy.Fixed) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth( + defaultSizePolicy.setHeightForWidth( self.FontMainWidthSpinBox.sizePolicy().hasHeightForWidth()) - self.FontMainWidthSpinBox.setSizePolicy(sizePolicy) + self.FontMainWidthSpinBox.setSizePolicy(defaultSizePolicy) self.FontMainWidthSpinBox.setMinimumSize(QtCore.QSize(78, 0)) self.FontMainWidthSpinBox.setMaximum(9999) self.FontMainWidthSpinBox.setObjectName(u'FontMainWidthSpinBox') self.MainLocationLayout.setWidget(3, QtGui.QFormLayout.FieldRole, self.FontMainWidthSpinBox) self.FontMainHeightSpinBox = QtGui.QSpinBox(self.MainLocationGroupBox) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, - QtGui.QSizePolicy.Fixed) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth( + defaultSizePolicy.setHeightForWidth( self.FontMainHeightSpinBox.sizePolicy().hasHeightForWidth()) - self.FontMainHeightSpinBox.setSizePolicy(sizePolicy) + self.FontMainHeightSpinBox.setSizePolicy(defaultSizePolicy) self.FontMainHeightSpinBox.setMinimumSize(QtCore.QSize(78, 0)) self.FontMainHeightSpinBox.setMaximum(9999) self.FontMainHeightSpinBox.setObjectName(u'FontMainHeightSpinBox') @@ -378,13 +359,9 @@ class Ui_AmendThemeDialog(object): self.FooterFontLayout.setWidget(2, QtGui.QFormLayout.LabelRole, self.FontFooterSizeLabel) self.FontFooterSizeSpinBox = QtGui.QSpinBox(self.FooterFontGroupBox) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, - QtGui.QSizePolicy.Fixed) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth( + defaultSizePolicy.setHeightForWidth( self.FontFooterSizeSpinBox.sizePolicy().hasHeightForWidth()) - self.FontFooterSizeSpinBox.setSizePolicy(sizePolicy) + self.FontFooterSizeSpinBox.setSizePolicy(defaultSizePolicy) self.FontFooterSizeSpinBox.setMinimumSize(QtCore.QSize(70, 0)) self.FontFooterSizeSpinBox.setProperty(u'value', QtCore.QVariant(10)) self.FontFooterSizeSpinBox.setMaximum(999) @@ -453,13 +430,9 @@ class Ui_AmendThemeDialog(object): self.LocationFooterLayout.setWidget(4, QtGui.QFormLayout.LabelRole, self.FontFooterHeightLabel) self.FontFooterXSpinBox = QtGui.QSpinBox(self.LocationFooterGroupBox) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, - QtGui.QSizePolicy.Fixed) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth( + defaultSizePolicy.setHeightForWidth( self.FontFooterXSpinBox.sizePolicy().hasHeightForWidth()) - self.FontFooterXSpinBox.setSizePolicy(sizePolicy) + self.FontFooterXSpinBox.setSizePolicy(defaultSizePolicy) self.FontFooterXSpinBox.setMinimumSize(QtCore.QSize(78, 0)) self.FontFooterXSpinBox.setProperty(u'value', QtCore.QVariant(0)) self.FontFooterXSpinBox.setMaximum(9999) @@ -467,13 +440,9 @@ class Ui_AmendThemeDialog(object): self.LocationFooterLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.FontFooterXSpinBox) self.FontFooterYSpinBox = QtGui.QSpinBox(self.LocationFooterGroupBox) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, - QtGui.QSizePolicy.Fixed) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth( - self.FontFooterYSpinBox.sizePolicy().hasHeightForWidth()) - self.FontFooterYSpinBox.setSizePolicy(sizePolicy) + defaultSizePolicy.setHeightForWidth( + self.FontFooterXSpinBox.sizePolicy().hasHeightForWidth()) + self.FontFooterYSpinBox.setSizePolicy(defaultSizePolicy) self.FontFooterYSpinBox.setMinimumSize(QtCore.QSize(78, 0)) self.FontFooterYSpinBox.setProperty(u'value', QtCore.QVariant(0)) self.FontFooterYSpinBox.setMaximum(9999) @@ -901,4 +870,3 @@ class Ui_AmendThemeDialog(object): self.ThemeTabWidget.indexOf(self.OtherOptionsTab), translate('AmendThemeForm', '&Other Options')) self.PreviewGroupBox.setTitle(translate('AmendThemeForm', 'Preview')) - diff --git a/openlp/core/ui/amendthemeform.py b/openlp/core/ui/amendthemeform.py index c85eff4b8..6333d7146 100644 --- a/openlp/core/ui/amendthemeform.py +++ b/openlp/core/ui/amendthemeform.py @@ -43,8 +43,8 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog): self.path = None self.theme = ThemeXML() self.setupUi(self) - #define signals - #Buttons + # Define signals + # Buttons QtCore.QObject.connect(self.Color1PushButton, QtCore.SIGNAL(u'pressed()'), self.onColor1PushButtonClicked) QtCore.QObject.connect(self.Color2PushButton, @@ -60,7 +60,7 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog): QtCore.SIGNAL(u'pressed()'), self.onShadowColorPushButtonClicked) QtCore.QObject.connect(self.ImageToolButton, QtCore.SIGNAL(u'pressed()'), self.onImageToolButtonClicked) - #Combo boxes + # Combo boxes QtCore.QObject.connect(self.BackgroundComboBox, QtCore.SIGNAL(u'activated(int)'), self.onBackgroundComboBoxSelected) QtCore.QObject.connect(self.BackgroundTypeComboBox, @@ -82,57 +82,58 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog): QtCore.SIGNAL(u'activated(int)'), self.onHorizontalComboBoxSelected) QtCore.QObject.connect(self.VerticalComboBox, QtCore.SIGNAL(u'activated(int)'), self.onVerticalComboBoxSelected) - #Spin boxes + # Spin boxes QtCore.QObject.connect(self.FontMainSizeSpinBox, - QtCore.SIGNAL(u'editingFinished()'), + QtCore.SIGNAL(u'valueChanged(int)'), self.onFontMainSizeSpinBoxChanged) QtCore.QObject.connect(self.FontFooterSizeSpinBox, - QtCore.SIGNAL(u'editingFinished()'), + QtCore.SIGNAL(u'valueChanged(int)'), 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.SIGNAL(u'stateChanged(int)'), 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.SIGNAL(u'stateChanged(int)'), 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.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.SIGNAL(u'stateChanged(int)'), self.onSlideTransitionCheckedBoxChanged) diff --git a/openlp/core/ui/displaytab.py b/openlp/core/ui/displaytab.py index 8a028bbc8..0fb16a9f7 100644 --- a/openlp/core/ui/displaytab.py +++ b/openlp/core/ui/displaytab.py @@ -242,4 +242,3 @@ class DisplayTab(SettingsTab): if self.amend_display_start != self.amend_display: self.amend_display_start = self.amend_display Receiver.send_message(u'config_screen_changed') - diff --git a/openlp/core/ui/generaltab.py b/openlp/core/ui/generaltab.py index 4c42bf90c..340753707 100644 --- a/openlp/core/ui/generaltab.py +++ b/openlp/core/ui/generaltab.py @@ -32,13 +32,16 @@ class GeneralTab(SettingsTab): GeneralTab is the general settings tab in the settings dialog. """ def __init__(self, screens): + """ + Initialise the general settings tab + """ self.screens = screens + self.MonitorNumber = 0 SettingsTab.__init__(self, u'General') def preLoad(self): """ - Set up the display screen and set correct screen - values. + Set up the display screen and set correct screen values. If not set before default to last screen. """ settings = QtCore.QSettings() @@ -47,12 +50,14 @@ class GeneralTab(SettingsTab): QtCore.QVariant(self.screens.display_count - 1)).toInt()[0] self.screens.set_current_display(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() - self.screens.display = self.DisplayOnMonitor settings.endGroup() def setupUi(self): + """ + Create the user interface for the general settings tab + """ self.setObjectName(u'GeneralTab') self.tabTitleVisible = translate('GeneralTab', 'General') self.GeneralLayout = QtGui.QHBoxLayout(self) @@ -152,31 +157,11 @@ class GeneralTab(SettingsTab): QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) self.GeneralRightLayout.addItem(self.GeneralRightSpacer) 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): + """ + Translate the general settings tab to the currently selected language + """ self.MonitorGroupBox.setTitle(translate('GeneralTab', 'Monitors')) self.MonitorLabel.setText( translate('GeneralTab', 'Select monitor for output display:')) @@ -204,37 +189,10 @@ class GeneralTab(SettingsTab): self.PasswordLabel.setText( 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): + """ + Load the settings to populate the form + """ settings = QtCore.QSettings() settings.beginGroup(self.settingsSection) for screen in self.screens.screen_list: @@ -244,55 +202,54 @@ class GeneralTab(SettingsTab): screen_name = u'%s (%s)' % (screen_name, translate('GeneralTab', 'primary')) self.MonitorComboBox.addItem(screen_name) - # Get the configs - self.Warning = settings.value( - u'blank warning', QtCore.QVariant(False)).toBool() - self.AutoOpen = settings.value( - u'auto open', QtCore.QVariant(False)).toBool() - self.ShowSplash = settings.value( - u'show splash', QtCore.QVariant(True)).toBool() - self.PromptSaveService = settings.value( - 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.NumberEdit.setText(unicode(settings.value( + u'ccli number', QtCore.QVariant(u'')).toString())) + self.UsernameEdit.setText(unicode(settings.value( + u'songselect username', QtCore.QVariant(u'')).toString())) + self.PasswordEdit.setText(unicode(settings.value( + u'songselect password', QtCore.QVariant(u'')).toString())) + self.SaveCheckServiceCheckBox.setChecked(settings.value(u'save prompt', + QtCore.QVariant(False)).toBool()) self.MonitorComboBox.setCurrentIndex(self.MonitorNumber) - self.DisplayOnMonitorCheck.setChecked(self.DisplayOnMonitor) - self.WarningCheckBox.setChecked(self.Warning) - self.AutoOpenCheckBox.setChecked(self.AutoOpen) - self.ShowSplashCheckBox.setChecked(self.ShowSplash) - self.AutoPreviewCheckBox.setChecked(self.AutoPreview) - self.NumberEdit.setText(self.CCLINumber) - self.UsernameEdit.setText(self.Username) - self.PasswordEdit.setText(self.Password) + self.DisplayOnMonitorCheck.setChecked(self.screens.display) + self.WarningCheckBox.setChecked(settings.value(u'blank warning', + QtCore.QVariant(False)).toBool()) + self.AutoOpenCheckBox.setChecked(settings.value(u'auto open', + QtCore.QVariant(False)).toBool()) + self.ShowSplashCheckBox.setChecked(settings.value(u'show splash', + QtCore.QVariant(True)).toBool()) + self.AutoPreviewCheckBox.setChecked(settings.value(u'auto preview', + QtCore.QVariant(False)).toBool()) + settings.endGroup() def save(self): + """ + Save the settings from the form + """ + self.MonitorNumber = self.MonitorComboBox.currentIndex() settings = QtCore.QSettings() settings.beginGroup(self.settingsSection) settings.setValue(u'monitor', QtCore.QVariant(self.MonitorNumber)) settings.setValue(u'display on monitor', - QtCore.QVariant(self.DisplayOnMonitor)) - settings.setValue(u'blank warning', QtCore.QVariant(self.Warning)) - settings.setValue(u'auto open', QtCore.QVariant(self.AutoOpen)) - settings.setValue(u'show splash', QtCore.QVariant(self.ShowSplash)) + QtCore.QVariant(self.DisplayOnMonitorCheck.isChecked())) + settings.setValue(u'blank warning', + QtCore.QVariant(self.WarningCheckBox.isChecked())) + 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', - QtCore.QVariant(self.PromptSaveService)) - settings.setValue(u'auto preview', QtCore.QVariant(self.AutoPreview)) - settings.setValue(u'ccli number', QtCore.QVariant(self.CCLINumber)) + QtCore.QVariant(self.SaveCheckServiceCheckBox.isChecked())) + settings.setValue(u'auto preview', + QtCore.QVariant(self.AutoPreviewCheckBox.isChecked())) + settings.setValue(u'ccli number', + QtCore.QVariant(self.NumberEdit.displayText())) settings.setValue(u'songselect username', - QtCore.QVariant(self.Username)) + QtCore.QVariant(self.UsernameEdit.displayText())) settings.setValue(u'songselect password', - QtCore.QVariant(self.Password)) + QtCore.QVariant(self.PasswordEdit.displayText())) settings.endGroup() - self.screens.display = self.DisplayOnMonitor + self.screens.display = self.DisplayOnMonitorCheck.isChecked() #Monitor Number has changed. if self.screens.monitor_number != self.MonitorNumber: self.screens.monitor_number = self.MonitorNumber From f67457c3785bd3e809b23bcc1dcb576cd94b016a Mon Sep 17 00:00:00 2001 From: Jon Tibble Date: Thu, 1 Jul 2010 20:34:48 +0100 Subject: [PATCH 3/5] Revert bug fix --- openlp/core/ui/amendthemeform.py | 85 ++++++++++++++++---------------- 1 file changed, 42 insertions(+), 43 deletions(-) diff --git a/openlp/core/ui/amendthemeform.py b/openlp/core/ui/amendthemeform.py index 6333d7146..c85eff4b8 100644 --- a/openlp/core/ui/amendthemeform.py +++ b/openlp/core/ui/amendthemeform.py @@ -43,8 +43,8 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog): self.path = None self.theme = ThemeXML() self.setupUi(self) - # Define signals - # Buttons + #define signals + #Buttons QtCore.QObject.connect(self.Color1PushButton, QtCore.SIGNAL(u'pressed()'), self.onColor1PushButtonClicked) QtCore.QObject.connect(self.Color2PushButton, @@ -60,7 +60,7 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog): QtCore.SIGNAL(u'pressed()'), self.onShadowColorPushButtonClicked) QtCore.QObject.connect(self.ImageToolButton, QtCore.SIGNAL(u'pressed()'), self.onImageToolButtonClicked) - # Combo boxes + #Combo boxes QtCore.QObject.connect(self.BackgroundComboBox, QtCore.SIGNAL(u'activated(int)'), self.onBackgroundComboBoxSelected) QtCore.QObject.connect(self.BackgroundTypeComboBox, @@ -82,58 +82,57 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog): QtCore.SIGNAL(u'activated(int)'), self.onHorizontalComboBoxSelected) QtCore.QObject.connect(self.VerticalComboBox, QtCore.SIGNAL(u'activated(int)'), self.onVerticalComboBoxSelected) - # Spin boxes + #Spin boxes QtCore.QObject.connect(self.FontMainSizeSpinBox, - QtCore.SIGNAL(u'valueChanged(int)'), + QtCore.SIGNAL(u'editingFinished()'), self.onFontMainSizeSpinBoxChanged) QtCore.QObject.connect(self.FontFooterSizeSpinBox, - QtCore.SIGNAL(u'valueChanged(int)'), + QtCore.SIGNAL(u'editingFinished()'), 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.SIGNAL(u'stateChanged(int)'), 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.SIGNAL(u'stateChanged(int)'), 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.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.SIGNAL(u'stateChanged(int)'), self.onSlideTransitionCheckedBoxChanged) From 9e1474e851bee30888410a5c91768b4410d28c3e Mon Sep 17 00:00:00 2001 From: Jon Tibble Date: Fri, 2 Jul 2010 11:29:36 +0100 Subject: [PATCH 4/5] Fix songs and wildcard import --- openlp/plugins/presentations/lib/pptviewcontroller.py | 2 +- openlp/plugins/songs/lib/mediaitem.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/openlp/plugins/presentations/lib/pptviewcontroller.py b/openlp/plugins/presentations/lib/pptviewcontroller.py index 10ab41fd0..e8f0d9390 100644 --- a/openlp/plugins/presentations/lib/pptviewcontroller.py +++ b/openlp/plugins/presentations/lib/pptviewcontroller.py @@ -27,7 +27,7 @@ import os import logging if os.name == u'nt': - from ctypes import * + from ctypes import cdll from ctypes.wintypes import RECT from presentationcontroller import PresentationController, PresentationDocument diff --git a/openlp/plugins/songs/lib/mediaitem.py b/openlp/plugins/songs/lib/mediaitem.py index 7ed30e5e0..c3aef65fd 100644 --- a/openlp/plugins/songs/lib/mediaitem.py +++ b/openlp/plugins/songs/lib/mediaitem.py @@ -371,7 +371,8 @@ class SongMediaItem(MediaManagerItem): author_list = author_list + unicode(author.display_name) author_audit.append(unicode(author.display_name)) if song.ccli_number is None or len(song.ccli_number) == 0: - ccli = self.parent.settings_form.GeneralTab.CCLINumber + ccli = QtCore.QSettings().value(u'general/ccli number', + QtCore.QVariant(u'')).toString() else: ccli = unicode(song.ccli_number) raw_footer.append(song.title) From 45375e74422522c82d546dd130f22a21760bfda6 Mon Sep 17 00:00:00 2001 From: Jon Tibble Date: Fri, 2 Jul 2010 13:13:46 +0100 Subject: [PATCH 5/5] Cleanup plugins (Bug #600996) --- openlp/core/lib/plugin.py | 9 ++++++--- openlp/plugins/alerts/alertsplugin.py | 2 +- openlp/plugins/bibles/bibleplugin.py | 2 -- openlp/plugins/custom/customplugin.py | 9 --------- openlp/plugins/images/imageplugin.py | 9 --------- openlp/plugins/media/mediaplugin.py | 9 --------- openlp/plugins/presentations/presentationplugin.py | 2 +- openlp/plugins/remotes/remoteplugin.py | 2 +- openlp/plugins/songs/lib/mediaitem.py | 4 ++-- openlp/plugins/songs/songsplugin.py | 6 ------ 10 files changed, 11 insertions(+), 43 deletions(-) diff --git a/openlp/core/lib/plugin.py b/openlp/core/lib/plugin.py index a5d712dfb..1450ef1fe 100644 --- a/openlp/core/lib/plugin.py +++ b/openlp/core/lib/plugin.py @@ -242,19 +242,22 @@ class Plugin(QtCore.QObject): """ if self.media_item: self.media_item.initialise() + self.insert_toolbox_item() def finalise(self): """ Called by the plugin Manager to cleanup things. """ - pass + self.remove_toolbox_item() def remove_toolbox_item(self): """ Called by the plugin to remove toolbar """ - self.mediadock.remove_dock(self.name) - self.settings_form.removeTab(self.name) + if self.media_item: + self.mediadock.remove_dock(self.name) + if self.settings_tab: + self.settings_form.removeTab(self.name) def insert_toolbox_item(self): """ diff --git a/openlp/plugins/alerts/alertsplugin.py b/openlp/plugins/alerts/alertsplugin.py index 46d4e8cb7..57388c538 100644 --- a/openlp/plugins/alerts/alertsplugin.py +++ b/openlp/plugins/alerts/alertsplugin.py @@ -85,8 +85,8 @@ class alertsPlugin(Plugin): def finalise(self): log.info(u'Plugin Finalise') + Plugin.finalise(self) self.toolsAlertItem.setVisible(False) - #stop any events being processed def togglealertsState(self): self.alertsActive = not self.alertsActive diff --git a/openlp/plugins/bibles/bibleplugin.py b/openlp/plugins/bibles/bibleplugin.py index b891b14ad..9f4f034ab 100644 --- a/openlp/plugins/bibles/bibleplugin.py +++ b/openlp/plugins/bibles/bibleplugin.py @@ -48,14 +48,12 @@ class BiblePlugin(Plugin): if self.manager is None: self.manager = BibleManager(self) Plugin.initialise(self) - self.insert_toolbox_item() self.ImportBibleItem.setVisible(True) self.ExportBibleItem.setVisible(True) def finalise(self): log.info(u'Plugin Finalise') Plugin.finalise(self) - self.remove_toolbox_item() self.ImportBibleItem.setVisible(False) self.ExportBibleItem.setVisible(False) diff --git a/openlp/plugins/custom/customplugin.py b/openlp/plugins/custom/customplugin.py index e65205351..60a0b312c 100644 --- a/openlp/plugins/custom/customplugin.py +++ b/openlp/plugins/custom/customplugin.py @@ -60,15 +60,6 @@ class CustomPlugin(Plugin): # Create the CustomManagerItem object return CustomMediaItem(self, self.icon, self.name) - def initialise(self): - log.info(u'Plugin Initialising') - Plugin.initialise(self) - self.insert_toolbox_item() - - def finalise(self): - log.info(u'Plugin Finalise') - self.remove_toolbox_item() - def about(self): about_text = translate('CustomPlugin', 'Custom Plugin
This plugin ' diff --git a/openlp/plugins/images/imageplugin.py b/openlp/plugins/images/imageplugin.py index 9ebaa128f..be3863bda 100644 --- a/openlp/plugins/images/imageplugin.py +++ b/openlp/plugins/images/imageplugin.py @@ -39,15 +39,6 @@ class ImagePlugin(Plugin): self.icon = build_icon(u':/plugins/plugin_images.png') self.status = PluginStatus.Active - def initialise(self): - log.info(u'Plugin Initialising') - Plugin.initialise(self) - self.insert_toolbox_item() - - def finalise(self): - log.info(u'Plugin Finalise') - self.remove_toolbox_item() - def get_settings_tab(self): return ImageTab(self.name) diff --git a/openlp/plugins/media/mediaplugin.py b/openlp/plugins/media/mediaplugin.py index 33261f1e2..24138a0f5 100644 --- a/openlp/plugins/media/mediaplugin.py +++ b/openlp/plugins/media/mediaplugin.py @@ -67,15 +67,6 @@ class MediaPlugin(Plugin): type = u'' return list, type - def initialise(self): - log.info(u'Plugin Initialising') - Plugin.initialise(self) - self.insert_toolbox_item() - - def finalise(self): - log.info(u'Plugin Finalise') - self.remove_toolbox_item() - def get_media_manager_item(self): # Create the MediaManagerItem object return MediaMediaItem(self, self.icon, self.name) diff --git a/openlp/plugins/presentations/presentationplugin.py b/openlp/plugins/presentations/presentationplugin.py index d92483b88..22c7c554e 100644 --- a/openlp/plugins/presentations/presentationplugin.py +++ b/openlp/plugins/presentations/presentationplugin.py @@ -64,7 +64,7 @@ class PresentationPlugin(Plugin): controller = self.controllers[key] if controller.enabled: controller.kill() - self.remove_toolbox_item() + Plugin.finalise(self) def get_media_manager_item(self): """ diff --git a/openlp/plugins/remotes/remoteplugin.py b/openlp/plugins/remotes/remoteplugin.py index fad7ecbe8..808714fb3 100644 --- a/openlp/plugins/remotes/remoteplugin.py +++ b/openlp/plugins/remotes/remoteplugin.py @@ -56,7 +56,7 @@ class RemotesPlugin(Plugin): Tidy up and close down the http server """ log.debug(u'finalise') - self.remove_toolbox_item() + Plugin.finalise(self) if self.server: self.server.close() diff --git a/openlp/plugins/songs/lib/mediaitem.py b/openlp/plugins/songs/lib/mediaitem.py index c3aef65fd..4557f53fa 100644 --- a/openlp/plugins/songs/lib/mediaitem.py +++ b/openlp/plugins/songs/lib/mediaitem.py @@ -166,13 +166,13 @@ class SongMediaItem(MediaManagerItem): if search_type == 0: log.debug(u'Titles Search') search_results = self.parent.manager.get_all_objects_filtered(Song, - Song.search_title.like(u'%' + keywords + u'%'), + Song.search_title.like(u'%' + search_keywords + u'%'), Song.search_title.asc()) self.displayResultsSong(search_results) elif search_type == 1: log.debug(u'Lyrics Search') search_results = self.parent.manager.get_all_objects_filtered(Song, - Song.search_lyrics.like(u'%' + keywords + u'%'), + Song.search_lyrics.like(u'%' + search_keywords + u'%'), Song.search_lyrics.asc()) self.displayResultsSong(search_results) elif search_type == 2: diff --git a/openlp/plugins/songs/songsplugin.py b/openlp/plugins/songs/songsplugin.py index e2740748b..d9f9bb95f 100644 --- a/openlp/plugins/songs/songsplugin.py +++ b/openlp/plugins/songs/songsplugin.py @@ -67,15 +67,9 @@ class SongsPlugin(Plugin): def initialise(self): log.info(u'Songs Initialising') Plugin.initialise(self) - self.insert_toolbox_item() self.media_item.displayResultsSong( self.manager.get_all_objects(Song, Song.title)) - def finalise(self): - log.info(u'Plugin Finalise') - Plugin.finalise(self) - self.remove_toolbox_item() - def get_media_manager_item(self): """ Create the MediaManagerItem object, which is displaed in the