From 73650e65365c0e924afda8ebe9a044202d17ef31 Mon Sep 17 00:00:00 2001 From: Philip Ridout Date: Tue, 27 Jul 2010 21:35:50 +0100 Subject: [PATCH] Moved loop delay on to the general tab from the image tab, as it was being used in songs and custom slides as well. Deleted image tab, as the loop delay was the only setting on it! --- openlp/core/ui/generaltab.py | 29 +++++++-- openlp/plugins/images/imageplugin.py | 5 +- openlp/plugins/images/lib/__init__.py | 1 - openlp/plugins/images/lib/imagetab.py | 93 --------------------------- 4 files changed, 25 insertions(+), 103 deletions(-) delete mode 100644 openlp/plugins/images/lib/imagetab.py diff --git a/openlp/core/ui/generaltab.py b/openlp/core/ui/generaltab.py index a47743c63..ce33c65f0 100644 --- a/openlp/core/ui/generaltab.py +++ b/openlp/core/ui/generaltab.py @@ -104,17 +104,23 @@ class GeneralTab(SettingsTab): self.generalLeftLayout.addWidget(self.startupGroupBox) self.settingsGroupBox = QtGui.QGroupBox(self) self.settingsGroupBox.setObjectName(u'settingsGroupBox') - self.settingsLayout = QtGui.QVBoxLayout(self.settingsGroupBox) + self.settingsLayout = QtGui.QGridLayout(self.settingsGroupBox) self.settingsLayout.setSpacing(8) self.settingsLayout.setMargin(8) self.settingsLayout.setObjectName(u'settingsLayout') self.saveCheckServiceCheckBox = QtGui.QCheckBox(self.settingsGroupBox) self.saveCheckServiceCheckBox.setObjectName(u'saveCheckServiceCheckBox') - self.settingsLayout.addWidget(self.saveCheckServiceCheckBox) - self.generalLeftLayout.addWidget(self.settingsGroupBox) + self.settingsLayout.addWidget(self.saveCheckServiceCheckBox, 0, 0, 1, 2) self.autoPreviewCheckBox = QtGui.QCheckBox(self.settingsGroupBox) self.autoPreviewCheckBox.setObjectName(u'autoPreviewCheckBox') - self.settingsLayout.addWidget(self.autoPreviewCheckBox) + self.settingsLayout.addWidget(self.autoPreviewCheckBox, 1, 0, 1, 2) + # Moved here from image tab + self.timeoutLabel = QtGui.QLabel(self.settingsGroupBox) + self.timeoutLabel.setObjectName("timeoutLabel") + self.settingsLayout.addWidget(self.timeoutLabel, 2, 0, 1, 1) + self.timeoutSpinBox = QtGui.QSpinBox(self.settingsGroupBox) + self.timeoutSpinBox.setObjectName("timeoutSpinBox") + self.settingsLayout.addWidget(self.timeoutSpinBox, 2,1, 1, 1) self.generalLeftLayout.addWidget(self.settingsGroupBox) self.generalLeftSpacer = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) @@ -306,6 +312,10 @@ class GeneralTab(SettingsTab): 'Prompt to save before starting a new service')) self.autoPreviewCheckBox.setText(translate('OpenLP.GeneralTab', 'Automatically preview next item in service')) + self.timeoutLabel.setText(translate('OpenLP.GeneralTab', + 'Slide loop delay:')) + self.timeoutSpinBox.setSuffix( + translate('OpenLP.GeneralTab', ' sec')) self.ccliGroupBox.setTitle( translate('OpenLP.GeneralTab', 'CCLI Details')) self.numberLabel.setText( @@ -366,6 +376,8 @@ class GeneralTab(SettingsTab): QtCore.QVariant(True)).toBool()) self.autoPreviewCheckBox.setChecked(settings.value(u'auto preview', QtCore.QVariant(False)).toBool()) + self.timeoutSpinBox.setValue(settings.value(u'loop delay', + QtCore.QVariant(5)).toInt()[0]) self.currentXValueLabel.setText( unicode(self.screens.current[u'size'].x())) self.currentYValueLabel.setText( @@ -423,6 +435,10 @@ class GeneralTab(SettingsTab): QtCore.QVariant(self.saveCheckServiceCheckBox.isChecked())) settings.setValue(u'auto preview', QtCore.QVariant(self.autoPreviewCheckBox.isChecked())) + settings.setValue(u'loop delay', + QtCore.QVariant(self.timeoutSpinBox.value())) + Receiver.send_message(u'slidecontroller_live_spin_delay', + self.timeoutSpinBox.value()) settings.setValue(u'ccli number', QtCore.QVariant(self.numberEdit.displayText())) settings.setValue(u'songselect username', @@ -452,8 +468,11 @@ class GeneralTab(SettingsTab): def postSetUp(self): """ - Reset screens after initial definition + Apply settings after settings tab has loaded """ + Receiver.send_message(u'slidecontroller_live_spin_delay', + self.timeoutSpinBox.value()) + # Reset screens after initial definition self.screens.override[u'size'] = QtCore.QRect( int(self.customXValueEdit.text()), int(self.customYValueEdit.text()), diff --git a/openlp/plugins/images/imageplugin.py b/openlp/plugins/images/imageplugin.py index b94c3ce9b..909defd6b 100644 --- a/openlp/plugins/images/imageplugin.py +++ b/openlp/plugins/images/imageplugin.py @@ -27,7 +27,7 @@ import logging from openlp.core.lib import Plugin, build_icon, PluginStatus, translate -from openlp.plugins.images.lib import ImageMediaItem, ImageTab +from openlp.plugins.images.lib import ImageMediaItem log = logging.getLogger(__name__) @@ -41,9 +41,6 @@ class ImagePlugin(Plugin): self.icon = build_icon(self.icon_path) self.status = PluginStatus.Active - def getSettingsTab(self): - return ImageTab(self.name) - def getMediaManagerItem(self): # Create the MediaManagerItem object return ImageMediaItem(self, self.icon, self.name) diff --git a/openlp/plugins/images/lib/__init__.py b/openlp/plugins/images/lib/__init__.py index b2ab22faf..fb7b0a249 100644 --- a/openlp/plugins/images/lib/__init__.py +++ b/openlp/plugins/images/lib/__init__.py @@ -25,4 +25,3 @@ ############################################################################### from mediaitem import ImageMediaItem -from imagetab import ImageTab diff --git a/openlp/plugins/images/lib/imagetab.py b/openlp/plugins/images/lib/imagetab.py deleted file mode 100644 index 73274a39c..000000000 --- a/openlp/plugins/images/lib/imagetab.py +++ /dev/null @@ -1,93 +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, Meinert Jordan, Andreas Preikschat, Christian # -# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # -# Carsten Tinggaard, Frode Woldsund # -# --------------------------------------------------------------------------- # -# 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 QtCore, QtGui - -from openlp.core.lib import SettingsTab, Receiver, translate - -class ImageTab(SettingsTab): - """ - ImageTab is the Image settings tab in the settings dialog. - """ - def __init__(self, title): - SettingsTab.__init__(self, title) - - def setupUi(self): - self.setObjectName(u'ImageTab') - self.tabTitleVisible = translate('ImagePlugin.ImageTab', 'Images') - self.ImageLayout = QtGui.QFormLayout(self) - self.ImageLayout.setSpacing(8) - self.ImageLayout.setMargin(8) - self.ImageLayout.setObjectName(u'ImageLayout') - self.ImageSettingsGroupBox = QtGui.QGroupBox(self) - self.ImageSettingsGroupBox.setObjectName(u'ImageSettingsGroupBox') - self.TimeoutLayout = QtGui.QHBoxLayout(self.ImageSettingsGroupBox) - self.TimeoutLayout.setSpacing(8) - self.TimeoutLayout.setMargin(8) - self.TimeoutLayout.setObjectName(u'TimeoutLayout') - self.TimeoutLabel = QtGui.QLabel(self.ImageSettingsGroupBox) - self.TimeoutLabel.setObjectName(u'TimeoutLabel') - self.TimeoutLayout.addWidget(self.TimeoutLabel) - self.TimeoutSpinBox = QtGui.QSpinBox(self.ImageSettingsGroupBox) - self.TimeoutSpinBox.setMinimum(1) - self.TimeoutSpinBox.setMaximum(180) - self.TimeoutSpinBox.setObjectName(u'TimeoutSpinBox') - self.TimeoutLayout.addWidget(self.TimeoutSpinBox) - self.TimeoutSpacer = QtGui.QSpacerItem(147, 20, - QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) - self.TimeoutLayout.addItem(self.TimeoutSpacer) - self.ImageLayout.setWidget( - 0, QtGui.QFormLayout.LabelRole, self.ImageSettingsGroupBox) - # Signals and slots - QtCore.QObject.connect(self.TimeoutSpinBox, - QtCore.SIGNAL(u'valueChanged(int)'), self.onTimeoutSpinBoxChanged) - - def retranslateUi(self): - self.ImageSettingsGroupBox.setTitle( - translate('ImagePlugin.ImageTab', 'Image Settings')) - self.TimeoutLabel.setText( - translate('ImagePlugin.ImageTab', 'Slide loop delay:')) - self.TimeoutSpinBox.setSuffix( - translate('ImagePlugin.ImageTab', 'sec')) - - def onTimeoutSpinBoxChanged(self): - self.loop_delay = self.TimeoutSpinBox.value() - - def load(self): - self.loop_delay = QtCore.QSettings().value( - self.settingsSection + u'/loop delay', - QtCore.QVariant(5)).toInt()[0] - self.TimeoutSpinBox.setValue(self.loop_delay) - - def save(self): - QtCore.QSettings().setValue(self.settingsSection + u'/loop delay', - QtCore.QVariant(self.loop_delay)) - Receiver.send_message(u'slidecontroller_live_spin_delay', - self.loop_delay) - - def postSetUp(self): - Receiver.send_message(u'slidecontroller_live_spin_delay', - self.loop_delay)