From eac602389c1d31fac35c5d0585b4149d76721588 Mon Sep 17 00:00:00 2001 From: Jon Tibble Date: Mon, 12 Jul 2010 15:45:55 +0100 Subject: [PATCH 01/12] Code layout tweaks --- openlp/core/ui/amendthemeform.py | 37 +++++++++++++++++++------------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/openlp/core/ui/amendthemeform.py b/openlp/core/ui/amendthemeform.py index 1c2658dc3..64c6a4021 100644 --- a/openlp/core/ui/amendthemeform.py +++ b/openlp/core/ui/amendthemeform.py @@ -36,15 +36,21 @@ from amendthemedialog import Ui_AmendThemeDialog log = logging.getLogger(u'AmendThemeForm') class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog): - + """ + The :class:`AmendThemeForm` class provides the user interface to set up + new and edit existing themes. + """ def __init__(self, parent): + """ + Initialise the theme editor user interface + """ QtGui.QDialog.__init__(self, parent) self.thememanager = parent 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 +66,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,16 +88,13 @@ 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()'), self.onFontMainSizeSpinBoxChanged) QtCore.QObject.connect(self.FontFooterSizeSpinBox, QtCore.SIGNAL(u'editingFinished()'), self.onFontFooterSizeSpinBoxChanged) - 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, @@ -108,9 +111,6 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog): 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) @@ -123,16 +123,23 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog): 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) + # CheckBoxes + QtCore.QObject.connect(self.FontMainDefaultCheckBox, + QtCore.SIGNAL(u'stateChanged(int)'), + self.onFontMainDefaultCheckBoxChanged) + QtCore.QObject.connect(self.FontFooterDefaultCheckBox, + QtCore.SIGNAL(u'stateChanged(int)'), + self.onFontFooterDefaultCheckBoxChanged) + QtCore.QObject.connect(self.OutlineCheckBox, + QtCore.SIGNAL(u'stateChanged(int)'), self.onOutlineCheckBoxChanged) + QtCore.QObject.connect(self.ShadowCheckBox, + QtCore.SIGNAL(u'stateChanged(int)'), self.onShadowCheckBoxChanged) QtCore.QObject.connect(self.SlideTransitionCheckBox, QtCore.SIGNAL(u'stateChanged(int)'), self.onSlideTransitionCheckBoxChanged) From e1c8aabe0a0baff68db7dcef820efbf4e9348daa Mon Sep 17 00:00:00 2001 From: Jon Tibble Date: Tue, 13 Jul 2010 19:45:40 +0100 Subject: [PATCH 02/12] Fix AdvancedTab layout --- openlp/core/ui/advancedtab.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/openlp/core/ui/advancedtab.py b/openlp/core/ui/advancedtab.py index 8a6edef20..c0c5a6109 100644 --- a/openlp/core/ui/advancedtab.py +++ b/openlp/core/ui/advancedtab.py @@ -55,7 +55,6 @@ class AdvancedTab(SettingsTab): self.leftLayout.setMargin(0) self.uiGroupBox = QtGui.QGroupBox(self.leftWidget) self.uiGroupBox.setObjectName(u'uiGroupBox') - self.uiGroupBox.setMaximumWidth(320) self.uiLayout = QtGui.QVBoxLayout(self.uiGroupBox) self.uiLayout.setSpacing(8) self.uiLayout.setMargin(6) @@ -110,10 +109,10 @@ class AdvancedTab(SettingsTab): QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) self.leftLayout.addItem(self.leftSpacer) self.advancedTabLayout.addWidget(self.leftWidget) -# self.rightWidget = QtGui.QWidget(self) -# self.rightLayout = QtGui.QVBoxLayout(self.rightWidget) -# self.rightLayout.setSpacing(8) -# self.rightLayout.setMargin(0) + self.rightWidget = QtGui.QWidget(self) + self.rightLayout = QtGui.QVBoxLayout(self.rightWidget) + self.rightLayout.setSpacing(8) + self.rightLayout.setMargin(0) # self.databaseGroupBox = QtGui.QGroupBox(self.rightWidget) # self.databaseGroupBox.setObjectName(u'databaseGroupBox') # self.databaseGroupBox.setEnabled(False) @@ -121,9 +120,10 @@ class AdvancedTab(SettingsTab): # 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.advancedTabLayout.addWidget(self.rightWidget) + self.rightSpacer = QtGui.QSpacerItem(20, 40, + QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding) + self.rightLayout.addItem(self.rightSpacer) + self.advancedTabLayout.addWidget(self.rightWidget) # QtCore.QObject.connect(self.sharedCheckBox, # QtCore.SIGNAL(u'stateChanged(int)'), self.onSharedCheckBoxChanged) From 0cf1acf97b535465ed324fbcc7db6031a0879e08 Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Wed, 14 Jul 2010 17:58:28 +0200 Subject: [PATCH 03/12] Removed an unnecessary import. Fixed margins. Moved the "display" tab into the general tab. --- openlp.pyw | 5 +- openlp/core/ui/advancedtab.py | 2 +- openlp/core/ui/generaltab.py | 266 +++++++++++++++++++++++++++++----- 3 files changed, 231 insertions(+), 42 deletions(-) diff --git a/openlp.pyw b/openlp.pyw index fd8bfb41e..81ae3e47f 100755 --- a/openlp.pyw +++ b/openlp.pyw @@ -27,9 +27,8 @@ import os import sys import logging - -from logging import FileHandler from optparse import OptionParser + from PyQt4 import QtCore, QtGui log = logging.getLogger() @@ -167,7 +166,7 @@ def main(): if not os.path.exists(log_path): os.makedirs(log_path) filename = os.path.join(log_path, u'openlp.log') - logfile = FileHandler(filename, u'w') + logfile = logging.FileHandler(filename, u'w') logfile.setFormatter(logging.Formatter( u'%(asctime)s %(name)-55s %(levelname)-8s %(message)s')) log.addHandler(logfile) diff --git a/openlp/core/ui/advancedtab.py b/openlp/core/ui/advancedtab.py index d2f0c22b5..5b02d0593 100644 --- a/openlp/core/ui/advancedtab.py +++ b/openlp/core/ui/advancedtab.py @@ -59,7 +59,7 @@ class AdvancedTab(SettingsTab): self.recentGroupBox.setMaximumSize(QtCore.QSize(220, 57)) self.recentLayout = QtGui.QHBoxLayout(self.recentGroupBox) self.recentLayout.setSpacing(8) - self.recentLayout.setMargin(6) + self.recentLayout.setMargin(0) self.recentLayout.setObjectName(u'recentLayout') self.recentLabel = QtGui.QLabel(self.recentGroupBox) self.recentLabel.setObjectName(u'recentLabel') diff --git a/openlp/core/ui/generaltab.py b/openlp/core/ui/generaltab.py index 340753707..5c409f0d7 100644 --- a/openlp/core/ui/generaltab.py +++ b/openlp/core/ui/generaltab.py @@ -36,7 +36,7 @@ class GeneralTab(SettingsTab): Initialise the general settings tab """ self.screens = screens - self.MonitorNumber = 0 + self.monitorNumber = 0 SettingsTab.__init__(self, u'General') def preLoad(self): @@ -46,10 +46,10 @@ class GeneralTab(SettingsTab): """ settings = QtCore.QSettings() settings.beginGroup(self.settingsSection) - self.MonitorNumber = settings.value(u'monitor', + self.monitorNumber = settings.value(u'monitor', QtCore.QVariant(self.screens.display_count - 1)).toInt()[0] - self.screens.set_current_display(self.MonitorNumber) - self.screens.monitor_number = self.MonitorNumber + self.screens.set_current_display(self.monitorNumber) + self.screens.monitor_number = self.monitorNumber self.screens.display = settings.value( u'display on monitor', QtCore.QVariant(True)).toBool() settings.endGroup() @@ -64,13 +64,12 @@ class GeneralTab(SettingsTab): self.GeneralLayout.setSpacing(8) self.GeneralLayout.setMargin(8) self.GeneralLayout.setObjectName(u'GeneralLayout') - self.GeneralLeftWidget = QtGui.QWidget(self) - self.GeneralLeftWidget.setObjectName(u'GeneralLeftWidget') - self.GeneralLeftLayout = QtGui.QVBoxLayout(self.GeneralLeftWidget) + self.GeneralLeftLayout = QtGui.QVBoxLayout() self.GeneralLeftLayout.setObjectName(u'GeneralLeftLayout') self.GeneralLeftLayout.setSpacing(8) self.GeneralLeftLayout.setMargin(0) - self.MonitorGroupBox = QtGui.QGroupBox(self.GeneralLeftWidget) + self.GeneralLayout.addLayout(self.GeneralLeftLayout) + self.MonitorGroupBox = QtGui.QGroupBox(self) self.MonitorGroupBox.setObjectName(u'MonitorGroupBox') self.MonitorLayout = QtGui.QVBoxLayout(self.MonitorGroupBox) self.MonitorLayout.setSpacing(8) @@ -87,7 +86,7 @@ class GeneralTab(SettingsTab): self.DisplayOnMonitorCheck.setObjectName(u'MonitorComboBox') self.MonitorLayout.addWidget(self.DisplayOnMonitorCheck) self.GeneralLeftLayout.addWidget(self.MonitorGroupBox) - self.StartupGroupBox = QtGui.QGroupBox(self.GeneralLeftWidget) + self.StartupGroupBox = QtGui.QGroupBox(self) self.StartupGroupBox.setObjectName(u'StartupGroupBox') self.StartupLayout = QtGui.QVBoxLayout(self.StartupGroupBox) self.StartupLayout.setSpacing(8) @@ -103,7 +102,7 @@ class GeneralTab(SettingsTab): self.ShowSplashCheckBox.setObjectName(u'ShowSplashCheckBox') self.StartupLayout.addWidget(self.ShowSplashCheckBox) self.GeneralLeftLayout.addWidget(self.StartupGroupBox) - self.SettingsGroupBox = QtGui.QGroupBox(self.GeneralLeftWidget) + self.SettingsGroupBox = QtGui.QGroupBox(self) self.SettingsGroupBox.setObjectName(u'SettingsGroupBox') self.SettingsLayout = QtGui.QVBoxLayout(self.SettingsGroupBox) self.SettingsLayout.setSpacing(8) @@ -120,14 +119,12 @@ class GeneralTab(SettingsTab): self.GeneralLeftSpacer = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) self.GeneralLeftLayout.addItem(self.GeneralLeftSpacer) - self.GeneralLayout.addWidget(self.GeneralLeftWidget) - self.GeneralRightWidget = QtGui.QWidget(self) - self.GeneralRightWidget.setObjectName(u'GeneralRightWidget') - self.GeneralRightLayout = QtGui.QVBoxLayout(self.GeneralRightWidget) + self.GeneralRightLayout = QtGui.QVBoxLayout() self.GeneralRightLayout.setSpacing(8) self.GeneralRightLayout.setMargin(0) self.GeneralRightLayout.setObjectName(u'GeneralRightLayout') - self.CCLIGroupBox = QtGui.QGroupBox(self.GeneralRightWidget) + self.GeneralLayout.addLayout(self.GeneralRightLayout) + self.CCLIGroupBox = QtGui.QGroupBox(self) self.CCLIGroupBox.setObjectName(u'CCLIGroupBox') self.CCLILayout = QtGui.QGridLayout(self.CCLIGroupBox) self.CCLILayout.setMargin(8) @@ -153,10 +150,123 @@ class GeneralTab(SettingsTab): self.PasswordEdit.setObjectName(u'PasswordEdit') self.CCLILayout.addWidget(self.PasswordEdit, 2, 1, 1, 1) self.GeneralRightLayout.addWidget(self.CCLIGroupBox) + # Moved here from display tab + self.displayGroupBox = QtGui.QGroupBox(self) + self.displayGroupBox.setObjectName(u'displayGroupBox') + self.displayLayout = QtGui.QVBoxLayout(self.displayGroupBox) + self.displayLayout.setObjectName(u'displayLayout') + self.currentLayout = QtGui.QHBoxLayout() + self.currentLayout.setObjectName(u'currentLayout') + self.currentXLayout = QtGui.QVBoxLayout() + 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.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.setObjectName(u'currentYLayout') + self.currentYLabel = QtGui.QLabel(self.displayGroupBox) + self.currentYLabel.setAlignment(QtCore.Qt.AlignCenter) + self.currentYLabel.setObjectName(u'currentYLabel') + self.currentYLayout.addWidget(self.currentYLabel) + 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.currentHeightLayout = QtGui.QVBoxLayout() + self.currentHeightLayout.setObjectName(u'currentHeightLayout') + 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.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.currentWidthLayout = QtGui.QVBoxLayout() + self.currentWidthLayout.setObjectName(u'currentWidthLayout') + self.currentWidthLabel = QtGui.QLabel(self.displayGroupBox) + self.currentWidthLabel.setAlignment(QtCore.Qt.AlignCenter) + self.currentWidthLabel.setObjectName(u'currentWidthLabel') + self.currentWidthLayout.addWidget(self.currentWidthLabel) + 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.displayLayout.addLayout(self.currentLayout) + self.overrideCheckBox = QtGui.QCheckBox(self.displayGroupBox) + self.overrideCheckBox.setObjectName(u'overrideCheckBox') + self.displayLayout.addWidget(self.overrideCheckBox) + self.GeneralRightLayout.addWidget(self.displayGroupBox) + # Custom position + self.customLayout = QtGui.QHBoxLayout() + self.customLayout.setObjectName(u'customLayout') + self.customXLayout = QtGui.QVBoxLayout() + 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.setObjectName(u'customXValueEdit') + self.customXLayout.addWidget(self.customXValueEdit) + self.customLayout.addLayout(self.customXLayout) + self.customYLayout = QtGui.QVBoxLayout() + 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.setObjectName(u'customYValueEdit') + self.customYLayout.addWidget(self.customYValueEdit) + self.customLayout.addLayout(self.customYLayout) + self.customHeightLayout = QtGui.QVBoxLayout() + 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.setObjectName(u'customHeightValueEdit') + self.customHeightLayout.addWidget(self.customHeightValueEdit) + self.customLayout.addLayout(self.customHeightLayout) + self.customWidthLayout = QtGui.QVBoxLayout() + 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.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.setObjectName(u'customWidthValueEdit') + self.customWidthLayout.addWidget(self.customWidthValueEdit) + self.customLayout.addLayout(self.customWidthLayout) + 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.GeneralLayout.addWidget(self.GeneralRightWidget) + # Signals and slots + QtCore.QObject.connect(self.overrideCheckBox, + QtCore.SIGNAL(u'toggled(bool)'), self.onOverrideCheckBoxToggled) def retranslateUi(self): """ @@ -164,30 +274,46 @@ class GeneralTab(SettingsTab): """ self.MonitorGroupBox.setTitle(translate('GeneralTab', 'Monitors')) self.MonitorLabel.setText( - translate('GeneralTab', 'Select monitor for output display:')) + translate('OpenLP.GeneralTab', 'Select monitor for output display:')) self.DisplayOnMonitorCheck.setText( - translate('GeneralTab', 'Display if a single screen')) + translate('OpenLP.GeneralTab', 'Display if a single screen')) self.StartupGroupBox.setTitle( - translate('GeneralTab', 'Application Startup')) + translate('OpenLP.GeneralTab', 'Application Startup')) self.WarningCheckBox.setText( - translate('GeneralTab', 'Show blank screen warning')) + translate('OpenLP.GeneralTab', 'Show blank screen warning')) self.AutoOpenCheckBox.setText( - translate('GeneralTab', 'Automatically open the last service')) + translate('OpenLP.GeneralTab', 'Automatically open the last service')) self.ShowSplashCheckBox.setText( - translate('GeneralTab', 'Show the splash screen')) - self.SettingsGroupBox.setTitle( - translate('GeneralTab', 'Application Settings')) - self.SaveCheckServiceCheckBox.setText( - translate('GeneralTab', + translate('OpenLP.GeneralTab', 'Show the splash screen')) + self.SettingsGroupBox.setTitle(translate('OpenLP.GeneralTab', + 'Application Settings')) + self.SaveCheckServiceCheckBox.setText(translate('OpenLP.GeneralTab', 'Prompt to save Service before starting New')) - self.AutoPreviewCheckBox.setText( - translate('GeneralTab', 'Preview Next Song from Service Manager')) + self.AutoPreviewCheckBox.setText(translate('OpenLP.GeneralTab', + 'Preview Next Song from Service Manager')) self.CCLIGroupBox.setTitle(translate('GeneralTab', 'CCLI Details')) self.NumberLabel.setText(translate('GeneralTab', 'CCLI Number:')) - self.UsernameLabel.setText( - translate('GeneralTab', 'SongSelect Username:')) + self.UsernameLabel.setText(translate('OpenLP.GeneralTab', + 'SongSelect Username:')) self.PasswordLabel.setText( - translate('GeneralTab', 'SongSelect Password:')) + translate('OpenLP.GeneralTab', 'SongSelect Password:')) + # Moved from display tab + self.displayGroupBox.setTitle( + translate('OpenLP.GeneralTab', 'Display Position')) + self.currentXLabel.setText(translate('OpenLP.GeneralTab', 'X')) + self.currentXValueLabel.setText(u'0') + self.currentYLabel.setText(translate('OpenLP.GeneralTab', 'Y')) + self.currentYValueLabel.setText(u'0') + self.currentHeightLabel.setText(translate('OpenLP.GeneralTab', 'Height')) + self.currentHeightValueLabel.setText(u'0') + self.currentWidthLabel.setText(translate('OpenLP.GeneralTab', 'Width')) + self.currentWidthValueLabel.setText(u'0') + self.overrideCheckBox.setText(translate('OpenLP.GeneralTab', + 'Override display position')) + self.customXLabel.setText(translate('DisplayTab', 'X')) + self.customYLabel.setText(translate('DisplayTab', 'Y')) + self.customHeightLabel.setText(translate('DisplayTab', 'Height')) + self.customWidthLabel.setText(translate('DisplayTab', 'Width')) def load(self): """ @@ -199,7 +325,7 @@ class GeneralTab(SettingsTab): screen_name = u'%s %d' % (translate('GeneralTab', 'Screen'), screen[u'number'] + 1) if screen[u'primary']: - screen_name = u'%s (%s)' % (screen_name, + screen_name = u'%s (%s)' % (screen_name, translate('GeneralTab', 'primary')) self.MonitorComboBox.addItem(screen_name) self.NumberEdit.setText(unicode(settings.value( @@ -210,7 +336,7 @@ class GeneralTab(SettingsTab): 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.MonitorComboBox.setCurrentIndex(self.monitorNumber) self.DisplayOnMonitorCheck.setChecked(self.screens.display) self.WarningCheckBox.setChecked(settings.value(u'blank warning', QtCore.QVariant(False)).toBool()) @@ -220,16 +346,49 @@ class GeneralTab(SettingsTab): QtCore.QVariant(True)).toBool()) self.AutoPreviewCheckBox.setChecked(settings.value(u'auto preview', QtCore.QVariant(False)).toBool()) + self.currentXValueLabel.setText( + unicode(self.screens.current[u'size'].x())) + self.currentYValueLabel.setText( + unicode(self.screens.current[u'size'].y())) + self.currentHeightValueLabel.setText( + unicode(self.screens.current[u'size'].height())) + self.currentWidthValueLabel.setText( + unicode(self.screens.current[u'size'].width())) + self.overrideCheckBox.setChecked(settings.value(u'override position', + QtCore.QVariant(False)).toBool()) + if self.overrideCheckBox.isChecked(): + self.customXValueEdit.setText(settings.value(u'x position', + QtCore.QVariant(self.screens.current[u'size'].x())).toString()) + self.customYValueEdit.setText(settings.value(u'y position', + QtCore.QVariant(self.screens.current[u'size'].y())).toString()) + self.customHeightValueEdit.setText(settings.value(u'height', + QtCore.QVariant(self.screens.current[u'size'].height())).toString()) + self.customWidthValueEdit.setText(settings.value(u'width', + QtCore.QVariant(self.screens.current[u'size'].width())).toString()) + else: + self.customXValueEdit.setText( + unicode(self.screens.current[u'size'].x())) + self.customYValueEdit.setText( + unicode(self.screens.current[u'size'].y())) + self.customHeightValueEdit.setText( + unicode(self.screens.current[u'size'].height())) + self.customWidthValueEdit.setText( + unicode(self.screens.current[u'size'].width())) settings.endGroup() + self.customXValueEdit.setEnabled(self.overrideCheckBox.isChecked()) + self.customYValueEdit.setEnabled(self.overrideCheckBox.isChecked()) + self.customHeightValueEdit.setEnabled(self.overrideCheckBox.isChecked()) + self.customWidthValueEdit.setEnabled(self.overrideCheckBox.isChecked()) + self.override_changed = False def save(self): """ Save the settings from the form """ - self.MonitorNumber = self.MonitorComboBox.currentIndex() + self.monitorNumber = self.MonitorComboBox.currentIndex() settings = QtCore.QSettings() 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', QtCore.QVariant(self.DisplayOnMonitorCheck.isChecked())) settings.setValue(u'blank warning', @@ -248,11 +407,42 @@ class GeneralTab(SettingsTab): QtCore.QVariant(self.UsernameEdit.displayText())) settings.setValue(u'songselect password', QtCore.QVariant(self.PasswordEdit.displayText())) + settings.setValue(u'x position', + QtCore.QVariant(self.customXValueEdit.text())) + settings.setValue(u'y position', + QtCore.QVariant(self.customYValueEdit.text())) + settings.setValue(u'height', + QtCore.QVariant(self.customHeightValueEdit.text())) + settings.setValue(u'width', + QtCore.QVariant(self.customWidthValueEdit.text())) + settings.setValue(u'override position', + QtCore.QVariant(self.overrideCheckBox.isChecked())) settings.endGroup() self.screens.display = self.DisplayOnMonitorCheck.isChecked() #Monitor Number has changed. - if self.screens.monitor_number != self.MonitorNumber: - self.screens.monitor_number = self.MonitorNumber - self.screens.set_current_display(self.MonitorNumber) + if self.screens.monitor_number != self.monitorNumber: + self.screens.monitor_number = self.monitorNumber + self.screens.set_current_display(self.monitorNumber) Receiver.send_message(u'config_screen_changed') Receiver.send_message(u'config_updated') + + def postSetUp(self): + self.screens.override[u'size'] = QtCore.QRect( + int(self.customXValueEdit.text()), + int(self.customYValueEdit.text()), + int(self.customWidthValueEdit.text()), + int(self.customHeightValueEdit.text())) + if self.overrideCheckBox.isChecked(): + self.screens.set_override_display() + 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) + self.customYValueEdit.setEnabled(checked) + self.customHeightValueEdit.setEnabled(checked) + self.customWidthValueEdit.setEnabled(checked) + self.override_changed = True From 484b1c227ea1a2d54c5603b2bf347342b0869488 Mon Sep 17 00:00:00 2001 From: Phill Ridout Date: Wed, 14 Jul 2010 21:34:14 +0100 Subject: [PATCH 04/12] Finally got round to sorting out the show/hide desktop. --- openlp/core/ui/maindisplay.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/openlp/core/ui/maindisplay.py b/openlp/core/ui/maindisplay.py index b0ef8eaf4..2a573c554 100644 --- a/openlp/core/ui/maindisplay.py +++ b/openlp/core/ui/maindisplay.py @@ -358,6 +358,9 @@ class MainDisplay(DisplayWidget): else: self.displayBlank.setPixmap( QtGui.QPixmap.fromImage(self.blankFrame)) + if mode != HideMode.Screen and self.isHidden(): + self.setVisible(True) + def showDisplay(self, message=u''): """ @@ -367,6 +370,8 @@ class MainDisplay(DisplayWidget): """ log.debug(u'showDisplay') self.displayBlank.setPixmap(self.transparent) + if self.isHidden(): + self.setVisible(True) #Trigger actions when display is active again Receiver.send_message(u'maindisplay_active') From dc4f60516fb32053895ec86df33945e7f026436b Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Wed, 14 Jul 2010 22:37:54 +0200 Subject: [PATCH 05/12] Some modifications to the Configure dialog: - Moved single display option to General tab - Removed Display tab - Renamed variables to be Qt compliant --- openlp/core/ui/generaltab.py | 42 +++++++++++++++++++++-------- openlp/core/ui/settingsdialog.py | 46 +++++++++++++++++--------------- openlp/core/ui/settingsform.py | 34 +++++++++++------------ 3 files changed, 73 insertions(+), 49 deletions(-) diff --git a/openlp/core/ui/generaltab.py b/openlp/core/ui/generaltab.py index 5c409f0d7..8988f1836 100644 --- a/openlp/core/ui/generaltab.py +++ b/openlp/core/ui/generaltab.py @@ -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) diff --git a/openlp/core/ui/settingsdialog.py b/openlp/core/ui/settingsdialog.py index 66501e380..c337ccc48 100644 --- a/openlp/core/ui/settingsdialog.py +++ b/openlp/core/ui/settingsdialog.py @@ -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')) diff --git a/openlp/core/ui/settingsform.py b/openlp/core/ui/settingsform.py index aa463f725..b7a8a8909 100644 --- a/openlp/core/ui/settingsform.py +++ b/openlp/core/ui/settingsform.py @@ -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() From 1d65cc4e6f38e6a0f00110cac23392d974c48f39 Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Wed, 14 Jul 2010 23:28:20 +0200 Subject: [PATCH 06/12] Renamed "tab_index" to "tabIndex" as well. --- openlp/core/ui/settingsform.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/openlp/core/ui/settingsform.py b/openlp/core/ui/settingsform.py index b7a8a8909..55e5d6218 100644 --- a/openlp/core/ui/settingsform.py +++ b/openlp/core/ui/settingsform.py @@ -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 tabIndex in range(0, self.settingsTabWidget.count()): + if self.settingsTabWidget.widget(tabIndex): + if self.settingsTabWidget.widget(tabIndex).tabTitle == name: + self.settingsTabWidget.removeTab(tabIndex) 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 tabIndex in range(0, self.settingsTabWidget.count()): + self.settingsTabWidget.widget(tabIndex).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 tabIndex in range(0, self.settingsTabWidget.count()): + self.settingsTabWidget.widget(tabIndex).postSetUp() From afd28025a5ff57393ac6ccb6b0e3440745f397a2 Mon Sep 17 00:00:00 2001 From: Jon Tibble Date: Wed, 14 Jul 2010 23:16:59 +0100 Subject: [PATCH 07/12] Fix service save icon save method --- openlp/core/ui/servicemanager.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index 5da6deb8a..a69d02711 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -130,7 +130,7 @@ class ServiceManager(QtGui.QWidget): translate('ServiceManager', 'Save Service'), u':/general/general_save.png', translate('ServiceManager', 'Save this service'), - self.onSaveService) + self.onQuickSaveService) self.Toolbar.addSeparator() self.ThemeLabel = QtGui.QLabel(translate('ServiceManager', 'Theme:'), self) From c15fb864ec06f535993526a8d3c4b93d8d9fa376 Mon Sep 17 00:00:00 2001 From: Jon Tibble Date: Thu, 15 Jul 2010 01:06:20 +0100 Subject: [PATCH 08/12] Fix service save location (Bug #605649) --- openlp/core/ui/servicemanager.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index a69d02711..cf9afe066 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -575,16 +575,16 @@ class ServiceManager(QtGui.QWidget): SettingsManager.get_last_dir(self.parent.serviceSettingsSection), translate('ServiceManager', 'OpenLP Service Files (*.osz)')) else: - filename = SettingsManager.get_last_dir( - self.parent.serviceSettingsSection) + filename = os.path.join(SettingsManager.get_last_dir( + self.parent.serviceSettingsSection), self.serviceName) if filename: + filename = QtCore.QDir.toNativeSeparators(filename) splittedFile = filename.split(u'.') if splittedFile[-1] != u'osz': filename = filename + u'.osz' filename = unicode(filename) self.isNew = False - SettingsManager.set_last_dir( - self.parent.serviceSettingsSection, + SettingsManager.set_last_dir(self.parent.serviceSettingsSection, os.path.split(filename)[0]) service = [] servicefile = filename + u'.osd' From cce709218f16a6bd00ab0bc5ef106fac02d78f72 Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Thu, 15 Jul 2010 07:38:23 +0200 Subject: [PATCH 09/12] Removed comments and now-defunct display tab. --- openlp/core/ui/displaytab.py | 244 --------------------------------- openlp/core/ui/generaltab.py | 8 -- openlp/core/ui/settingsform.py | 5 +- 3 files changed, 1 insertion(+), 256 deletions(-) delete mode 100644 openlp/core/ui/displaytab.py diff --git a/openlp/core/ui/displaytab.py b/openlp/core/ui/displaytab.py deleted file mode 100644 index 32dad1c2b..000000000 --- a/openlp/core/ui/displaytab.py +++ /dev/null @@ -1,244 +0,0 @@ -# -*- coding: utf-8 -*- -# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 - -############################################################################### -# OpenLP - Open Source Lyrics Projection # -# --------------------------------------------------------------------------- # -# Copyright (c) 2008-2010 Raoul Snyman # -# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # -# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin # -# Thompson, Jon Tibble, Carsten Tinggaard # -# --------------------------------------------------------------------------- # -# This program is free software; you can redistribute it and/or modify it # -# under the terms of the GNU General Public License as published by the Free # -# Software Foundation; version 2 of the License. # -# # -# This program is distributed in the hope that it will be useful, but WITHOUT # -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for # -# more details. # -# # -# You should have received a copy of the GNU General Public License along # -# with this program; if not, write to the Free Software Foundation, Inc., 59 # -# Temple Place, Suite 330, Boston, MA 02111-1307 USA # -############################################################################### - -from PyQt4 import QtGui, QtCore - -from openlp.core.lib import SettingsTab, Receiver, translate - -class DisplayTab(SettingsTab): - """ - Provide the UI for managing display related settings - """ - def __init__(self, screens): - """ - Initialise the display tab from a SettingsTab - """ - self.screens = screens - SettingsTab.__init__(self, u'Display') - - def setupUi(self): - """ - Set up the UI widgets to show the settings - """ - self.tabTitleVisible = translate('DisplayTab', 'Displays') - self.layoutWidget = QtGui.QWidget(self) - self.layoutWidget.setObjectName(u'layoutWidget') - self.verticalLayout = QtGui.QVBoxLayout(self.layoutWidget) - self.verticalLayout.setObjectName(u'verticalLayout') - self.OverrideCheckBox = QtGui.QCheckBox(self.layoutWidget) - self.OverrideCheckBox.setObjectName(u'OverrideCheckBox') - self.verticalLayout.addWidget(self.OverrideCheckBox) - self.CurrentGroupBox = QtGui.QGroupBox(self.layoutWidget) - self.CurrentGroupBox.setObjectName(u'CurrentGroupBox') - self.horizontalLayout = QtGui.QHBoxLayout(self.CurrentGroupBox) - self.horizontalLayout.setObjectName(u'horizontalLayout') - self.verticalLayout_6 = QtGui.QVBoxLayout() - self.verticalLayout_6.setObjectName(u'verticalLayout_6') - self.XLabel = QtGui.QLabel(self.CurrentGroupBox) - self.XLabel.setAlignment(QtCore.Qt.AlignCenter) - self.XLabel.setObjectName(u'XLabel') - self.verticalLayout_6.addWidget(self.XLabel) - self.Xpos = QtGui.QLabel(self.CurrentGroupBox) - self.Xpos.setAlignment(QtCore.Qt.AlignCenter) - self.Xpos.setObjectName(u'Xpos') - self.verticalLayout_6.addWidget(self.Xpos) - self.horizontalLayout.addLayout(self.verticalLayout_6) - self.verticalLayout_7 = QtGui.QVBoxLayout() - self.verticalLayout_7.setObjectName(u'verticalLayout_7') - self.YLabel = QtGui.QLabel(self.CurrentGroupBox) - self.YLabel.setAlignment(QtCore.Qt.AlignCenter) - self.YLabel.setObjectName(u'YLabel') - self.verticalLayout_7.addWidget(self.YLabel) - self.Ypos = QtGui.QLabel(self.CurrentGroupBox) - self.Ypos.setAlignment(QtCore.Qt.AlignCenter) - self.Ypos.setObjectName(u'Ypos') - self.verticalLayout_7.addWidget(self.Ypos) - self.horizontalLayout.addLayout(self.verticalLayout_7) - self.verticalLayout_9 = QtGui.QVBoxLayout() - self.verticalLayout_9.setObjectName(u'verticalLayout_9') - self.HeightLabel = QtGui.QLabel(self.CurrentGroupBox) - self.HeightLabel.setMaximumSize(QtCore.QSize(100, 16777215)) - self.HeightLabel.setAlignment(QtCore.Qt.AlignCenter) - self.HeightLabel.setObjectName(u'HeightLabel') - self.verticalLayout_9.addWidget(self.HeightLabel) - self.Height = QtGui.QLabel(self.CurrentGroupBox) - self.Height.setAlignment(QtCore.Qt.AlignCenter) - self.Height.setObjectName(u'Height') - self.verticalLayout_9.addWidget(self.Height) - self.horizontalLayout.addLayout(self.verticalLayout_9) - self.verticalLayout_8 = QtGui.QVBoxLayout() - self.verticalLayout_8.setObjectName(u'verticalLayout_8') - self.WidthLabel = QtGui.QLabel(self.CurrentGroupBox) - self.WidthLabel.setAlignment(QtCore.Qt.AlignCenter) - self.WidthLabel.setObjectName(u'WidthLabel') - self.verticalLayout_8.addWidget(self.WidthLabel) - self.Width = QtGui.QLabel(self.CurrentGroupBox) - self.Width.setAlignment(QtCore.Qt.AlignCenter) - self.Width.setObjectName(u'Width') - self.verticalLayout_8.addWidget(self.Width) - self.horizontalLayout.addLayout(self.verticalLayout_8) - self.verticalLayout.addWidget(self.CurrentGroupBox) - self.CurrentGroupBox_2 = QtGui.QGroupBox(self) - self.CurrentGroupBox_2.setGeometry(QtCore.QRect(0, 130, 248, 87)) - self.CurrentGroupBox_2.setMaximumSize(QtCore.QSize(500, 16777215)) - self.CurrentGroupBox_2.setObjectName(u'CurrentGroupBox_2') - self.horizontalLayout_2 = QtGui.QHBoxLayout(self.CurrentGroupBox_2) - self.horizontalLayout_2.setObjectName(u'horizontalLayout_2') - self.verticalLayout_2 = QtGui.QVBoxLayout() - self.verticalLayout_2.setObjectName(u'verticalLayout_2') - self.XAmendLabel = QtGui.QLabel(self.CurrentGroupBox_2) - self.XAmendLabel.setAlignment(QtCore.Qt.AlignCenter) - self.XAmendLabel.setObjectName(u'XAmendLabel') - self.verticalLayout_2.addWidget(self.XAmendLabel) - self.XposEdit = QtGui.QLineEdit(self.CurrentGroupBox_2) - self.XposEdit.setMaximumSize(QtCore.QSize(50, 16777215)) - self.XposEdit.setMaxLength(4) - self.XposEdit.setObjectName(u'XposEdit') - self.verticalLayout_2.addWidget(self.XposEdit) - self.horizontalLayout_2.addLayout(self.verticalLayout_2) - self.verticalLayout_3 = QtGui.QVBoxLayout() - self.verticalLayout_3.setObjectName(u'verticalLayout_3') - self.YAmendLabel = QtGui.QLabel(self.CurrentGroupBox_2) - self.YAmendLabel.setAlignment(QtCore.Qt.AlignCenter) - self.YAmendLabel.setObjectName(u'YAmendLabel') - self.verticalLayout_3.addWidget(self.YAmendLabel) - self.YposEdit = QtGui.QLineEdit(self.CurrentGroupBox_2) - self.YposEdit.setMaximumSize(QtCore.QSize(50, 16777215)) - self.YposEdit.setMaxLength(4) - self.YposEdit.setObjectName(u'YposEdit') - self.verticalLayout_3.addWidget(self.YposEdit) - self.horizontalLayout_2.addLayout(self.verticalLayout_3) - self.verticalLayout_4 = QtGui.QVBoxLayout() - self.verticalLayout_4.setObjectName(u'verticalLayout_4') - self.HeightAmendLabel = QtGui.QLabel(self.CurrentGroupBox_2) - self.HeightAmendLabel.setAlignment(QtCore.Qt.AlignCenter) - self.HeightAmendLabel.setObjectName(u'HeightAmendLabel') - self.verticalLayout_4.addWidget(self.HeightAmendLabel) - self.HeightEdit = QtGui.QLineEdit(self.CurrentGroupBox_2) - self.HeightEdit.setMaximumSize(QtCore.QSize(50, 16777215)) - self.HeightEdit.setMaxLength(4) - self.HeightEdit.setObjectName(u'HeightEdit') - self.verticalLayout_4.addWidget(self.HeightEdit) - self.horizontalLayout_2.addLayout(self.verticalLayout_4) - self.verticalLayout_5 = QtGui.QVBoxLayout() - self.verticalLayout_5.setSizeConstraint(QtGui.QLayout.SetMinimumSize) - self.verticalLayout_5.setObjectName(u'verticalLayout_5') - self.WidthAmendLabel = QtGui.QLabel(self.CurrentGroupBox_2) - self.WidthAmendLabel.setMaximumSize(QtCore.QSize(100, 16777215)) - self.WidthAmendLabel.setAlignment(QtCore.Qt.AlignCenter) - self.WidthAmendLabel.setObjectName(u'WidthAmendLabel') - self.verticalLayout_5.addWidget(self.WidthAmendLabel) - self.WidthEdit = QtGui.QLineEdit(self.CurrentGroupBox_2) - self.WidthEdit.setMaximumSize(QtCore.QSize(60, 16777215)) - self.WidthEdit.setObjectName(u'WidthEdit') - self.verticalLayout_5.addWidget(self.WidthEdit) - self.horizontalLayout_2.addLayout(self.verticalLayout_5) - self.verticalLayout.addWidget(self.CurrentGroupBox_2) - QtCore.QMetaObject.connectSlotsByName(self) - QtCore.QObject.connect(self.OverrideCheckBox, - QtCore.SIGNAL(u'stateChanged(int)'), self.onOverrideCheckBoxChanged) - - def retranslateUi(self): - """ - Provide i18n support for this UI - """ - self.setWindowTitle(translate('DisplayTab', 'Amend Display Settings')) - self.CurrentGroupBox.setTitle( - translate('DisplayTab', 'Default Settings')) - self.XLabel.setText(translate('DisplayTab', 'X')) - self.Xpos.setText(u'0') - self.YLabel.setText(translate('DisplayTab', 'Y')) - self.Ypos.setText(u'0') - self.HeightLabel.setText(translate('DisplayTab', 'Height')) - self.Height.setText(u'0') - self.WidthLabel.setText(translate('DisplayTab', 'Width')) - self.Width.setText(u'0') - self.CurrentGroupBox_2.setTitle( - translate('DisplayTab', 'Amend Settings')) - self.XAmendLabel.setText(translate('DisplayTab', 'X')) - self.YAmendLabel.setText(translate('DisplayTab', 'Y')) - self.HeightAmendLabel.setText(translate('DisplayTab', 'Height')) - self.WidthAmendLabel.setText(translate('DisplayTab', 'Width')) - self.OverrideCheckBox.setText( - translate('DisplayTab', 'Override Output Display')) - - def load(self): - """ - Load current display settings - """ - settings = QtCore.QSettings() - settings.beginGroup(self.settingsSection) - self.Xpos.setText(unicode(self.screens.current[u'size'].x())) - self.Ypos.setText(unicode(self.screens.current[u'size'].y())) - self.Height.setText(unicode(self.screens.current[u'size'].height())) - self.Width.setText(unicode(self.screens.current[u'size'].width())) - xpos = settings.value(u'x position', - QtCore.QVariant(self.screens.current[u'size'].x())).toString() - self.XposEdit.setText(xpos) - ypos = settings.value(u'y position', - QtCore.QVariant(self.screens.current[u'size'].y())).toString() - self.YposEdit.setText(ypos) - height = settings.value(u'height', - QtCore.QVariant(self.screens.current[u'size'].height())).toString() - self.HeightEdit.setText(height) - width = settings.value(u'width', - QtCore.QVariant(self.screens.current[u'size'].width())).toString() - self.WidthEdit.setText(width) - self.amend_display = settings.value(u'amend display', - QtCore.QVariant(False)).toBool() - self.OverrideCheckBox.setChecked(self.amend_display) - self.amend_display_start = self.amend_display - - def onOverrideCheckBoxChanged(self, check_state): - self.amend_display = False - # we have a set value convert to True/False - if check_state == QtCore.Qt.Checked: - self.amend_display = True - - def save(self): - """ - Save chosen settings - """ - settings = QtCore.QSettings() - settings.beginGroup(self.settingsSection) - settings.setValue('x position', QtCore.QVariant(self.XposEdit.text())) - settings.setValue('y position', QtCore.QVariant(self.YposEdit.text())) - settings.setValue('height', QtCore.QVariant(self.HeightEdit.text())) - settings.setValue('width', QtCore.QVariant(self.WidthEdit.text())) - settings.setValue('amend display', QtCore.QVariant(self.amend_display)) - self.postSetUp() - - def postSetUp(self): - self.screens.override[u'size'] = QtCore.QRect(int(self.XposEdit.text()), - int(self.YposEdit.text()), int(self.WidthEdit.text()), - int(self.HeightEdit.text())) - if self.amend_display: - self.screens.set_override_display() - else: - self.screens.reset_current_display() - #only trigger event if data has changed in this edit session - 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 8988f1836..72718bb2c 100644 --- a/openlp/core/ui/generaltab.py +++ b/openlp/core/ui/generaltab.py @@ -233,8 +233,6 @@ class GeneralTab(SettingsTab): 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.setObjectName(u'customXValueEdit') self.customXLayout.addWidget(self.customXValueEdit) self.customLayout.addLayout(self.customXLayout) @@ -247,8 +245,6 @@ class GeneralTab(SettingsTab): 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.setObjectName(u'customYValueEdit') self.customYLayout.addWidget(self.customYValueEdit) self.customLayout.addLayout(self.customYLayout) @@ -261,8 +257,6 @@ class GeneralTab(SettingsTab): 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.setObjectName(u'customHeightValueEdit') self.customHeightLayout.addWidget(self.customHeightValueEdit) self.customLayout.addLayout(self.customHeightLayout) @@ -272,12 +266,10 @@ class GeneralTab(SettingsTab): 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.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.setObjectName(u'customWidthValueEdit') self.customWidthLayout.addWidget(self.customWidthValueEdit) self.customLayout.addLayout(self.customWidthLayout) diff --git a/openlp/core/ui/settingsform.py b/openlp/core/ui/settingsform.py index 55e5d6218..540568fb6 100644 --- a/openlp/core/ui/settingsform.py +++ b/openlp/core/ui/settingsform.py @@ -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 from settingsdialog import Ui_SettingsDialog log = logging.getLogger(__name__) @@ -50,9 +50,6 @@ class SettingsForm(QtGui.QDialog, Ui_SettingsDialog): # Themes tab self.themesTab = ThemesTab(mainWindow) self.addTab(u'Themes', self.themesTab) - # Display tab - #self.DisplayTab = DisplayTab(screens) - #self.addTab(u'Display', self.DisplayTab) # Advanced tab self.advancedTab = AdvancedTab() self.addTab(u'Advanced', self.advancedTab) From dd2137bf07266f45a049e87b46d1a35f13a03c74 Mon Sep 17 00:00:00 2001 From: andreas Date: Thu, 15 Jul 2010 11:34:03 +0200 Subject: [PATCH 10/12] fixed import --- openlp/core/ui/__init__.py | 1 - 1 file changed, 1 deletion(-) diff --git a/openlp/core/ui/__init__.py b/openlp/core/ui/__init__.py index e93108da7..4e92da6ca 100644 --- a/openlp/core/ui/__init__.py +++ b/openlp/core/ui/__init__.py @@ -46,7 +46,6 @@ from maindisplay import DisplayManager from amendthemeform import AmendThemeForm from slidecontroller import SlideController from splashscreen import SplashScreen -from displaytab import DisplayTab from generaltab import GeneralTab from themestab import ThemesTab from advancedtab import AdvancedTab From 42d627ec5b4c8c1fa9abd512137023658ab580c6 Mon Sep 17 00:00:00 2001 From: Phill Ridout Date: Thu, 15 Jul 2010 19:07:23 +0100 Subject: [PATCH 11/12] Extra line removed --- openlp/core/ui/maindisplay.py | 1 - 1 file changed, 1 deletion(-) diff --git a/openlp/core/ui/maindisplay.py b/openlp/core/ui/maindisplay.py index 2a573c554..d449342ef 100644 --- a/openlp/core/ui/maindisplay.py +++ b/openlp/core/ui/maindisplay.py @@ -361,7 +361,6 @@ class MainDisplay(DisplayWidget): if mode != HideMode.Screen and self.isHidden(): self.setVisible(True) - def showDisplay(self, message=u''): """ Show the stored layers so the screen reappears as it was From 96ed86a13a57d5c11a08656ce1a7b618efd27741 Mon Sep 17 00:00:00 2001 From: Jon Tibble Date: Thu, 15 Jul 2010 23:45:55 +0100 Subject: [PATCH 12/12] Use populate() for DB objects --- openlp/plugins/songs/lib/songimport.py | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/openlp/plugins/songs/lib/songimport.py b/openlp/plugins/songs/lib/songimport.py index 0e950f18c..bf3b404cd 100644 --- a/openlp/plugins/songs/lib/songimport.py +++ b/openlp/plugins/songs/lib/songimport.py @@ -303,28 +303,22 @@ class SongImport(object): author = self.manager.get_object_filtered(Author, Author.display_name == authortext) if author is None: - author = Author() - author.display_name = authortext - author.last_name = authortext.split(u' ')[-1] - author.first_name = u' '.join(authortext.split(u' ')[:-1]) - self.manager.save_object(author) + author = Author.populate(display_name = authortext, + last_name=authortext.split(u' ')[-1], + first_name=u' '.join(authortext.split(u' ')[:-1])) song.authors.append(author) if self.song_book_name: song_book = self.manager.get_object_filtered(Book, Book.name == self.song_book_name) if song_book is None: - song_book = Book() - song_book.name = self.song_book_name - song_book.publisher = self.song_book_pub - self.manager.save_object(song_book) - song.song_book_id = song_book.id + song_book = Book.populate(name=self.song_book_name, + publisher=self.song_book_pub) + song.book = song_book for topictext in self.topics: topic = self.manager.get_object_filtered(Topic, Topic.name == topictext) if topic is None: - topic = Topic() - topic.name = topictext - self.manager.save_object(topic) + topic = Topic.populate(name=topictext) song.topics.append(topictext) self.manager.save_object(song)