This commit is contained in:
Jonathan Corwin 2010-07-16 21:19:03 +01:00
commit d2734c9934
26 changed files with 719 additions and 606 deletions

View File

@ -27,9 +27,8 @@
import os import os
import sys import sys
import logging import logging
from logging import FileHandler
from optparse import OptionParser from optparse import OptionParser
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
log = logging.getLogger() log = logging.getLogger()
@ -167,7 +166,7 @@ def main():
if not os.path.exists(log_path): if not os.path.exists(log_path):
os.makedirs(log_path) os.makedirs(log_path)
filename = os.path.join(log_path, u'openlp.log') filename = os.path.join(log_path, u'openlp.log')
logfile = FileHandler(filename, u'w') logfile = logging.FileHandler(filename, u'w')
logfile.setFormatter(logging.Formatter( logfile.setFormatter(logging.Formatter(
u'%(asctime)s %(name)-55s %(levelname)-8s %(message)s')) u'%(asctime)s %(name)-55s %(levelname)-8s %(message)s'))
log.addHandler(logfile) log.addHandler(logfile)

View File

@ -323,9 +323,15 @@ class MediaManagerItem(QtGui.QWidget):
translate('MediaManagerItem', translate('MediaManagerItem',
'&Add to selected Service Item'), '&Add to selected Service Item'),
self.onAddEditClick)) self.onAddEditClick))
QtCore.QObject.connect( if QtCore.QSettings().value(u'advanced/double click live',
self.listView, QtCore.SIGNAL(u'doubleClicked(QModelIndex)'), QtCore.QVariant(False)).toBool():
self.onPreviewClick) QtCore.QObject.connect(self.listView,
QtCore.SIGNAL(u'doubleClicked(QModelIndex)'),
self.onLiveClick)
else:
QtCore.QObject.connect(self.listView,
QtCore.SIGNAL(u'doubleClicked(QModelIndex)'),
self.onPreviewClick)
def initialise(self): def initialise(self):
""" """

View File

@ -269,8 +269,22 @@ class Plugin(QtCore.QObject):
if self.settings_tab: if self.settings_tab:
self.settingsForm.insertTab(self.settings_tab, self.weight) self.settingsForm.insertTab(self.settings_tab, self.weight)
def canDeleteTheme(self, theme): def usesTheme(self, theme):
""" """
Called to ask the plugin if a theme can be deleted Called to find out if a plugin is currently using a theme.
Returns True if the theme is being used, otherwise returns False.
""" """
return True return False
def renameTheme(self, oldTheme, newTheme):
"""
Renames a theme a plugin is using making the plugin use the new name.
``oldTheme``
The name of the theme the plugin should stop using.
``newTheme``
The new name the plugin should now use.
"""
pass

View File

@ -46,7 +46,6 @@ from maindisplay import DisplayManager
from amendthemeform import AmendThemeForm from amendthemeform import AmendThemeForm
from slidecontroller import SlideController from slidecontroller import SlideController
from splashscreen import SplashScreen from splashscreen import SplashScreen
from displaytab import DisplayTab
from generaltab import GeneralTab from generaltab import GeneralTab
from themestab import ThemesTab from themestab import ThemesTab
from advancedtab import AdvancedTab from advancedtab import AdvancedTab

View File

@ -53,22 +53,34 @@ class AdvancedTab(SettingsTab):
self.leftLayout = QtGui.QVBoxLayout(self.leftWidget) self.leftLayout = QtGui.QVBoxLayout(self.leftWidget)
self.leftLayout.setSpacing(8) self.leftLayout.setSpacing(8)
self.leftLayout.setMargin(0) self.leftLayout.setMargin(0)
self.recentGroupBox = QtGui.QGroupBox(self.leftWidget) self.uiGroupBox = QtGui.QGroupBox(self.leftWidget)
self.recentGroupBox.setObjectName(u'recentGroupBox') self.uiGroupBox.setObjectName(u'uiGroupBox')
self.recentGroupBox.setGeometry(QtCore.QRect(0, 0, 220, 57)) self.uiLayout = QtGui.QVBoxLayout(self.uiGroupBox)
self.recentGroupBox.setMaximumSize(QtCore.QSize(220, 57)) self.uiLayout.setSpacing(8)
self.recentLayout = QtGui.QHBoxLayout(self.recentGroupBox) self.uiLayout.setMargin(6)
self.uiLayout.setObjectName(u'uiLayout')
self.recentLayout = QtGui.QHBoxLayout()
self.recentLayout.setSpacing(8) self.recentLayout.setSpacing(8)
self.recentLayout.setMargin(6) self.recentLayout.setMargin(0)
self.recentLayout.setObjectName(u'recentLayout') self.recentLayout.setObjectName(u'recentLayout')
self.recentLabel = QtGui.QLabel(self.recentGroupBox) self.recentLabel = QtGui.QLabel(self.uiGroupBox)
self.recentLabel.setObjectName(u'recentLabel') self.recentLabel.setObjectName(u'recentLabel')
self.recentLayout.addWidget(self.recentLabel) self.recentLayout.addWidget(self.recentLabel)
self.recentSpinBox = QtGui.QSpinBox(self.recentGroupBox) self.recentSpinBox = QtGui.QSpinBox(self.uiGroupBox)
self.recentSpinBox.setMinimum(0)
self.recentSpinBox.setObjectName(u'recentSpinBox') self.recentSpinBox.setObjectName(u'recentSpinBox')
self.recentSpinBox.setMinimum(0)
self.recentLayout.addWidget(self.recentSpinBox) self.recentLayout.addWidget(self.recentSpinBox)
self.leftLayout.addWidget(self.recentGroupBox) self.recentSpacer = QtGui.QSpacerItem(50, 20,
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.recentLayout.addItem(self.recentSpacer)
self.uiLayout.addLayout(self.recentLayout)
self.mediaPluginCheckBox = QtGui.QCheckBox(self.uiGroupBox)
self.mediaPluginCheckBox.setObjectName(u'mediaPluginCheckBox')
self.uiLayout.addWidget(self.mediaPluginCheckBox)
self.doubleClickLiveCheckBox = QtGui.QCheckBox(self.uiGroupBox)
self.doubleClickLiveCheckBox.setObjectName(u'doubleClickLiveCheckBox')
self.uiLayout.addWidget(self.doubleClickLiveCheckBox)
self.leftLayout.addWidget(self.uiGroupBox)
# self.sharedDirGroupBox = QtGui.QGroupBox(self.leftWidget) # self.sharedDirGroupBox = QtGui.QGroupBox(self.leftWidget)
# self.sharedDirGroupBox.setObjectName(u'sharedDirGroupBox') # self.sharedDirGroupBox.setObjectName(u'sharedDirGroupBox')
# self.sharedDirGroupBox.setGeometry(QtCore.QRect(0, 65, 500, 85)) # self.sharedDirGroupBox.setGeometry(QtCore.QRect(0, 65, 500, 85))
@ -97,10 +109,10 @@ class AdvancedTab(SettingsTab):
QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
self.leftLayout.addItem(self.leftSpacer) self.leftLayout.addItem(self.leftSpacer)
self.advancedTabLayout.addWidget(self.leftWidget) self.advancedTabLayout.addWidget(self.leftWidget)
# self.rightWidget = QtGui.QWidget(self) self.rightWidget = QtGui.QWidget(self)
# self.rightLayout = QtGui.QVBoxLayout(self.rightWidget) self.rightLayout = QtGui.QVBoxLayout(self.rightWidget)
# self.rightLayout.setSpacing(8) self.rightLayout.setSpacing(8)
# self.rightLayout.setMargin(0) self.rightLayout.setMargin(0)
# self.databaseGroupBox = QtGui.QGroupBox(self.rightWidget) # self.databaseGroupBox = QtGui.QGroupBox(self.rightWidget)
# self.databaseGroupBox.setObjectName(u'databaseGroupBox') # self.databaseGroupBox.setObjectName(u'databaseGroupBox')
# self.databaseGroupBox.setEnabled(False) # self.databaseGroupBox.setEnabled(False)
@ -108,7 +120,10 @@ class AdvancedTab(SettingsTab):
# self.databaseLayout.setSpacing(8) # self.databaseLayout.setSpacing(8)
# self.databaseLayout.setMargin(8) # self.databaseLayout.setMargin(8)
# self.rightLayout.addWidget(self.databaseGroupBox) # self.rightLayout.addWidget(self.databaseGroupBox)
# 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.QObject.connect(self.sharedCheckBox,
# QtCore.SIGNAL(u'stateChanged(int)'), self.onSharedCheckBoxChanged) # QtCore.SIGNAL(u'stateChanged(int)'), self.onSharedCheckBoxChanged)
@ -116,9 +131,13 @@ class AdvancedTab(SettingsTab):
""" """
Setup the interface translation strings. Setup the interface translation strings.
""" """
self.recentGroupBox.setTitle(translate('AdvancedTab', 'Recent Files')) self.uiGroupBox.setTitle(translate('AdvancedTab', 'UI Settings'))
self.recentLabel.setText( self.recentLabel.setText(
translate('AdvancedTab', 'Number of recent files to list:')) translate('AdvancedTab', 'Number of recent files to display:'))
self.mediaPluginCheckBox.setText(translate('AdvancedTab',
'Save currently selected media manager plugin'))
self.doubleClickLiveCheckBox.setText(translate('AdvancedTab',
'Double-click to send items straight to live (requires restart)'))
# self.sharedDirGroupBox.setTitle( # self.sharedDirGroupBox.setTitle(
# translate('AdvancedTab', 'Central Data Store')) # translate('AdvancedTab', 'Central Data Store'))
# self.sharedCheckBox.setText( # self.sharedCheckBox.setText(
@ -140,6 +159,12 @@ class AdvancedTab(SettingsTab):
u'max recent files', QtCore.QVariant(20)).toInt()[0]) u'max recent files', QtCore.QVariant(20)).toInt()[0])
self.recentSpinBox.setValue(settings.value(u'recent file count', self.recentSpinBox.setValue(settings.value(u'recent file count',
QtCore.QVariant(4)).toInt()[0]) QtCore.QVariant(4)).toInt()[0])
self.mediaPluginCheckBox.setChecked(
settings.value(u'save current plugin',
QtCore.QVariant(False)).toBool())
self.doubleClickLiveCheckBox.setChecked(
settings.value(u'double click live',
QtCore.QVariant(False)).toBool())
settings.endGroup() settings.endGroup()
def save(self): def save(self):
@ -150,6 +175,10 @@ class AdvancedTab(SettingsTab):
settings.beginGroup(self.settingsSection) settings.beginGroup(self.settingsSection)
settings.setValue(u'recent file count', settings.setValue(u'recent file count',
QtCore.QVariant(self.recentSpinBox.value())) QtCore.QVariant(self.recentSpinBox.value()))
settings.setValue(u'save current plugin',
QtCore.QVariant(self.mediaPluginCheckBox.isChecked()))
settings.setValue(u'double click live',
QtCore.QVariant(self.doubleClickLiveCheckBox.isChecked()))
settings.endGroup() settings.endGroup()
def onSharedCheckBoxChanged(self, checked): def onSharedCheckBoxChanged(self, checked):
@ -159,4 +188,3 @@ class AdvancedTab(SettingsTab):
self.sharedLabel.setEnabled(checked) self.sharedLabel.setEnabled(checked)
self.sharedTextEdit.setEnabled(checked) self.sharedTextEdit.setEnabled(checked)
self.sharedPushButton.setEnabled(checked) self.sharedPushButton.setEnabled(checked)

View File

@ -130,9 +130,9 @@ class Ui_AmendThemeDialog(object):
self.ImageLineEdit.setObjectName(u'ImageLineEdit') self.ImageLineEdit.setObjectName(u'ImageLineEdit')
self.horizontalLayout_2.addWidget(self.ImageLineEdit) self.horizontalLayout_2.addWidget(self.ImageLineEdit)
self.ImageToolButton = QtGui.QToolButton(self.ImageFilenameWidget) self.ImageToolButton = QtGui.QToolButton(self.ImageFilenameWidget)
icon1 = build_icon(u':/general/general_open.png') self.ImageToolButton.setIcon(build_icon(u':/general/general_open.png'))
self.ImageToolButton.setIcon(icon1)
self.ImageToolButton.setObjectName(u'ImageToolButton') self.ImageToolButton.setObjectName(u'ImageToolButton')
self.ImageToolButton.setAutoRaise(True)
self.horizontalLayout_2.addWidget(self.ImageToolButton) self.horizontalLayout_2.addWidget(self.ImageToolButton)
self.BackgroundLayout.setWidget(4, QtGui.QFormLayout.FieldRole, self.BackgroundLayout.setWidget(4, QtGui.QFormLayout.FieldRole,
self.ImageFilenameWidget) self.ImageFilenameWidget)
@ -654,70 +654,6 @@ class Ui_AmendThemeDialog(object):
QtCore.QObject.connect(self.ThemeButtonBox, QtCore.QObject.connect(self.ThemeButtonBox,
QtCore.SIGNAL(u'rejected()'), AmendThemeDialog.reject) QtCore.SIGNAL(u'rejected()'), AmendThemeDialog.reject)
QtCore.QMetaObject.connectSlotsByName(AmendThemeDialog) QtCore.QMetaObject.connectSlotsByName(AmendThemeDialog)
AmendThemeDialog.setTabOrder(self.ThemeButtonBox, self.ThemeNameEdit)
AmendThemeDialog.setTabOrder(self.ThemeNameEdit, self.ThemeTabWidget)
AmendThemeDialog.setTabOrder(self.ThemeTabWidget,
self.BackgroundComboBox)
AmendThemeDialog.setTabOrder(self.BackgroundComboBox,
self.BackgroundTypeComboBox)
AmendThemeDialog.setTabOrder(self.BackgroundTypeComboBox,
self.Color1PushButton)
AmendThemeDialog.setTabOrder(self.Color1PushButton,
self.Color2PushButton)
AmendThemeDialog.setTabOrder(self.Color2PushButton, self.ImageLineEdit)
AmendThemeDialog.setTabOrder(self.ImageLineEdit, self.ImageToolButton)
AmendThemeDialog.setTabOrder(self.ImageToolButton,
self.GradientComboBox)
AmendThemeDialog.setTabOrder(self.GradientComboBox,
self.FontMainComboBox)
AmendThemeDialog.setTabOrder(self.FontMainComboBox,
self.FontMainColorPushButton)
AmendThemeDialog.setTabOrder(self.FontMainColorPushButton,
self.FontMainSizeSpinBox)
AmendThemeDialog.setTabOrder(self.FontMainSizeSpinBox,
self.FontMainWeightComboBox)
AmendThemeDialog.setTabOrder(self.FontMainWeightComboBox,
self.FontMainLineSpacingSpinBox)
AmendThemeDialog.setTabOrder(self.FontMainLineSpacingSpinBox,
self.FontMainDefaultCheckBox)
AmendThemeDialog.setTabOrder(self.FontMainDefaultCheckBox,
self.FontMainXSpinBox)
AmendThemeDialog.setTabOrder(self.FontMainXSpinBox,
self.FontMainYSpinBox)
AmendThemeDialog.setTabOrder(self.FontMainYSpinBox,
self.FontMainWidthSpinBox)
AmendThemeDialog.setTabOrder(self.FontMainWidthSpinBox,
self.FontMainHeightSpinBox)
AmendThemeDialog.setTabOrder(self.FontMainHeightSpinBox,
self.FontFooterComboBox)
AmendThemeDialog.setTabOrder(self.FontFooterComboBox,
self.FontFooterColorPushButton)
AmendThemeDialog.setTabOrder(self.FontFooterColorPushButton,
self.FontFooterSizeSpinBox)
AmendThemeDialog.setTabOrder(self.FontFooterSizeSpinBox,
self.FontFooterWeightComboBox)
AmendThemeDialog.setTabOrder(self.FontFooterWeightComboBox,
self.FontFooterDefaultCheckBox)
AmendThemeDialog.setTabOrder(self.FontFooterDefaultCheckBox,
self.FontFooterXSpinBox)
AmendThemeDialog.setTabOrder(self.FontFooterXSpinBox,
self.FontFooterYSpinBox)
AmendThemeDialog.setTabOrder(self.FontFooterYSpinBox,
self.FontFooterWidthSpinBox)
AmendThemeDialog.setTabOrder(self.FontFooterWidthSpinBox,
self.FontFooterHeightSpinBox)
AmendThemeDialog.setTabOrder(self.FontFooterHeightSpinBox,
self.OutlineCheckBox)
AmendThemeDialog.setTabOrder(self.OutlineCheckBox,
self.OutlineColorPushButton)
AmendThemeDialog.setTabOrder(self.OutlineColorPushButton,
self.ShadowCheckBox)
AmendThemeDialog.setTabOrder(self.ShadowCheckBox,
self.ShadowColorPushButton)
AmendThemeDialog.setTabOrder(self.ShadowColorPushButton,
self.HorizontalComboBox)
AmendThemeDialog.setTabOrder(self.HorizontalComboBox,
self.VerticalComboBox)
def retranslateUi(self, AmendThemeDialog): def retranslateUi(self, AmendThemeDialog):
AmendThemeDialog.setWindowTitle( AmendThemeDialog.setWindowTitle(

View File

@ -36,15 +36,21 @@ from amendthemedialog import Ui_AmendThemeDialog
log = logging.getLogger(u'AmendThemeForm') log = logging.getLogger(u'AmendThemeForm')
class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog): 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): def __init__(self, parent):
"""
Initialise the theme editor user interface
"""
QtGui.QDialog.__init__(self, parent) QtGui.QDialog.__init__(self, parent)
self.thememanager = parent self.thememanager = parent
self.path = None self.path = None
self.theme = ThemeXML() self.theme = ThemeXML()
self.setupUi(self) self.setupUi(self)
#define signals # define signals
#Buttons # Buttons
QtCore.QObject.connect(self.Color1PushButton, QtCore.QObject.connect(self.Color1PushButton,
QtCore.SIGNAL(u'pressed()'), self.onColor1PushButtonClicked) QtCore.SIGNAL(u'pressed()'), self.onColor1PushButtonClicked)
QtCore.QObject.connect(self.Color2PushButton, QtCore.QObject.connect(self.Color2PushButton,
@ -59,8 +65,8 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
QtCore.QObject.connect(self.ShadowColorPushButton, QtCore.QObject.connect(self.ShadowColorPushButton,
QtCore.SIGNAL(u'pressed()'), self.onShadowColorPushButtonClicked) QtCore.SIGNAL(u'pressed()'), self.onShadowColorPushButtonClicked)
QtCore.QObject.connect(self.ImageToolButton, QtCore.QObject.connect(self.ImageToolButton,
QtCore.SIGNAL(u'pressed()'), self.onImageToolButtonClicked) QtCore.SIGNAL(u'clicked()'), self.onImageToolButtonClicked)
#Combo boxes # Combo boxes
QtCore.QObject.connect(self.BackgroundComboBox, QtCore.QObject.connect(self.BackgroundComboBox,
QtCore.SIGNAL(u'activated(int)'), self.onBackgroundComboBoxSelected) QtCore.SIGNAL(u'activated(int)'), self.onBackgroundComboBoxSelected)
QtCore.QObject.connect(self.BackgroundTypeComboBox, QtCore.QObject.connect(self.BackgroundTypeComboBox,
@ -82,16 +88,13 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
QtCore.SIGNAL(u'activated(int)'), self.onHorizontalComboBoxSelected) QtCore.SIGNAL(u'activated(int)'), self.onHorizontalComboBoxSelected)
QtCore.QObject.connect(self.VerticalComboBox, QtCore.QObject.connect(self.VerticalComboBox,
QtCore.SIGNAL(u'activated(int)'), self.onVerticalComboBoxSelected) QtCore.SIGNAL(u'activated(int)'), self.onVerticalComboBoxSelected)
#Spin boxes # Spin boxes
QtCore.QObject.connect(self.FontMainSizeSpinBox, QtCore.QObject.connect(self.FontMainSizeSpinBox,
QtCore.SIGNAL(u'editingFinished()'), QtCore.SIGNAL(u'editingFinished()'),
self.onFontMainSizeSpinBoxChanged) self.onFontMainSizeSpinBoxChanged)
QtCore.QObject.connect(self.FontFooterSizeSpinBox, QtCore.QObject.connect(self.FontFooterSizeSpinBox,
QtCore.SIGNAL(u'editingFinished()'), QtCore.SIGNAL(u'editingFinished()'),
self.onFontFooterSizeSpinBoxChanged) self.onFontFooterSizeSpinBoxChanged)
QtCore.QObject.connect(self.FontMainDefaultCheckBox,
QtCore.SIGNAL(u'stateChanged(int)'),
self.onFontMainDefaultCheckBoxChanged)
QtCore.QObject.connect(self.FontMainXSpinBox, QtCore.QObject.connect(self.FontMainXSpinBox,
QtCore.SIGNAL(u'editingFinished()'), self.onFontMainXSpinBoxChanged) QtCore.SIGNAL(u'editingFinished()'), self.onFontMainXSpinBoxChanged)
QtCore.QObject.connect(self.FontMainYSpinBox, QtCore.QObject.connect(self.FontMainYSpinBox,
@ -108,9 +111,6 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
QtCore.QObject.connect(self.FontMainLineSpacingSpinBox, QtCore.QObject.connect(self.FontMainLineSpacingSpinBox,
QtCore.SIGNAL(u'editingFinished()'), QtCore.SIGNAL(u'editingFinished()'),
self.onFontMainLineSpacingSpinBoxChanged) self.onFontMainLineSpacingSpinBoxChanged)
QtCore.QObject.connect(self.FontFooterDefaultCheckBox,
QtCore.SIGNAL(u'stateChanged(int)'),
self.onFontFooterDefaultCheckBoxChanged)
QtCore.QObject.connect(self.FontFooterXSpinBox, QtCore.QObject.connect(self.FontFooterXSpinBox,
QtCore.SIGNAL(u'editingFinished()'), QtCore.SIGNAL(u'editingFinished()'),
self.onFontFooterXSpinBoxChanged) self.onFontFooterXSpinBoxChanged)
@ -123,16 +123,23 @@ class AmendThemeForm(QtGui.QDialog, Ui_AmendThemeDialog):
QtCore.QObject.connect(self.FontFooterHeightSpinBox, QtCore.QObject.connect(self.FontFooterHeightSpinBox,
QtCore.SIGNAL(u'editingFinished()'), QtCore.SIGNAL(u'editingFinished()'),
self.onFontFooterHeightSpinBoxChanged) self.onFontFooterHeightSpinBoxChanged)
QtCore.QObject.connect(self.OutlineCheckBox,
QtCore.SIGNAL(u'stateChanged(int)'), self.onOutlineCheckBoxChanged)
QtCore.QObject.connect(self.ShadowSpinBox, QtCore.QObject.connect(self.ShadowSpinBox,
QtCore.SIGNAL(u'editingFinished()'), QtCore.SIGNAL(u'editingFinished()'),
self.onShadowSpinBoxChanged) self.onShadowSpinBoxChanged)
QtCore.QObject.connect(self.ShadowCheckBox,
QtCore.SIGNAL(u'stateChanged(int)'), self.onShadowCheckBoxChanged)
QtCore.QObject.connect(self.OutlineSpinBox, QtCore.QObject.connect(self.OutlineSpinBox,
QtCore.SIGNAL(u'editingFinished()'), QtCore.SIGNAL(u'editingFinished()'),
self.onOutlineSpinBoxChanged) 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.QObject.connect(self.SlideTransitionCheckBox,
QtCore.SIGNAL(u'stateChanged(int)'), QtCore.SIGNAL(u'stateChanged(int)'),
self.onSlideTransitionCheckBoxChanged) self.onSlideTransitionCheckBoxChanged)

View File

@ -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')

View File

@ -36,7 +36,7 @@ class GeneralTab(SettingsTab):
Initialise the general settings tab Initialise the general settings tab
""" """
self.screens = screens self.screens = screens
self.MonitorNumber = 0 self.monitorNumber = 0
SettingsTab.__init__(self, u'General') SettingsTab.__init__(self, u'General')
def preLoad(self): def preLoad(self):
@ -46,10 +46,10 @@ class GeneralTab(SettingsTab):
""" """
settings = QtCore.QSettings() settings = QtCore.QSettings()
settings.beginGroup(self.settingsSection) 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] QtCore.QVariant(self.screens.display_count - 1)).toInt()[0]
self.screens.set_current_display(self.MonitorNumber) self.screens.set_current_display(self.monitorNumber)
self.screens.monitor_number = self.MonitorNumber self.screens.monitor_number = self.monitorNumber
self.screens.display = settings.value( self.screens.display = settings.value(
u'display on monitor', QtCore.QVariant(True)).toBool() u'display on monitor', QtCore.QVariant(True)).toBool()
settings.endGroup() settings.endGroup()
@ -64,13 +64,12 @@ class GeneralTab(SettingsTab):
self.GeneralLayout.setSpacing(8) self.GeneralLayout.setSpacing(8)
self.GeneralLayout.setMargin(8) self.GeneralLayout.setMargin(8)
self.GeneralLayout.setObjectName(u'GeneralLayout') self.GeneralLayout.setObjectName(u'GeneralLayout')
self.GeneralLeftWidget = QtGui.QWidget(self) self.GeneralLeftLayout = QtGui.QVBoxLayout()
self.GeneralLeftWidget.setObjectName(u'GeneralLeftWidget')
self.GeneralLeftLayout = QtGui.QVBoxLayout(self.GeneralLeftWidget)
self.GeneralLeftLayout.setObjectName(u'GeneralLeftLayout') self.GeneralLeftLayout.setObjectName(u'GeneralLeftLayout')
self.GeneralLeftLayout.setSpacing(8) self.GeneralLeftLayout.setSpacing(8)
self.GeneralLeftLayout.setMargin(0) 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.MonitorGroupBox.setObjectName(u'MonitorGroupBox')
self.MonitorLayout = QtGui.QVBoxLayout(self.MonitorGroupBox) self.MonitorLayout = QtGui.QVBoxLayout(self.MonitorGroupBox)
self.MonitorLayout.setSpacing(8) self.MonitorLayout.setSpacing(8)
@ -87,7 +86,7 @@ class GeneralTab(SettingsTab):
self.DisplayOnMonitorCheck.setObjectName(u'MonitorComboBox') self.DisplayOnMonitorCheck.setObjectName(u'MonitorComboBox')
self.MonitorLayout.addWidget(self.DisplayOnMonitorCheck) self.MonitorLayout.addWidget(self.DisplayOnMonitorCheck)
self.GeneralLeftLayout.addWidget(self.MonitorGroupBox) self.GeneralLeftLayout.addWidget(self.MonitorGroupBox)
self.StartupGroupBox = QtGui.QGroupBox(self.GeneralLeftWidget) self.StartupGroupBox = QtGui.QGroupBox(self)
self.StartupGroupBox.setObjectName(u'StartupGroupBox') self.StartupGroupBox.setObjectName(u'StartupGroupBox')
self.StartupLayout = QtGui.QVBoxLayout(self.StartupGroupBox) self.StartupLayout = QtGui.QVBoxLayout(self.StartupGroupBox)
self.StartupLayout.setSpacing(8) self.StartupLayout.setSpacing(8)
@ -103,7 +102,7 @@ class GeneralTab(SettingsTab):
self.ShowSplashCheckBox.setObjectName(u'ShowSplashCheckBox') self.ShowSplashCheckBox.setObjectName(u'ShowSplashCheckBox')
self.StartupLayout.addWidget(self.ShowSplashCheckBox) self.StartupLayout.addWidget(self.ShowSplashCheckBox)
self.GeneralLeftLayout.addWidget(self.StartupGroupBox) self.GeneralLeftLayout.addWidget(self.StartupGroupBox)
self.SettingsGroupBox = QtGui.QGroupBox(self.GeneralLeftWidget) self.SettingsGroupBox = QtGui.QGroupBox(self)
self.SettingsGroupBox.setObjectName(u'SettingsGroupBox') self.SettingsGroupBox.setObjectName(u'SettingsGroupBox')
self.SettingsLayout = QtGui.QVBoxLayout(self.SettingsGroupBox) self.SettingsLayout = QtGui.QVBoxLayout(self.SettingsGroupBox)
self.SettingsLayout.setSpacing(8) self.SettingsLayout.setSpacing(8)
@ -120,14 +119,12 @@ class GeneralTab(SettingsTab):
self.GeneralLeftSpacer = QtGui.QSpacerItem(20, 40, self.GeneralLeftSpacer = QtGui.QSpacerItem(20, 40,
QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
self.GeneralLeftLayout.addItem(self.GeneralLeftSpacer) self.GeneralLeftLayout.addItem(self.GeneralLeftSpacer)
self.GeneralLayout.addWidget(self.GeneralLeftWidget) self.GeneralRightLayout = QtGui.QVBoxLayout()
self.GeneralRightWidget = QtGui.QWidget(self)
self.GeneralRightWidget.setObjectName(u'GeneralRightWidget')
self.GeneralRightLayout = QtGui.QVBoxLayout(self.GeneralRightWidget)
self.GeneralRightLayout.setSpacing(8) self.GeneralRightLayout.setSpacing(8)
self.GeneralRightLayout.setMargin(0) self.GeneralRightLayout.setMargin(0)
self.GeneralRightLayout.setObjectName(u'GeneralRightLayout') 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.CCLIGroupBox.setObjectName(u'CCLIGroupBox')
self.CCLILayout = QtGui.QGridLayout(self.CCLIGroupBox) self.CCLILayout = QtGui.QGridLayout(self.CCLIGroupBox)
self.CCLILayout.setMargin(8) self.CCLILayout.setMargin(8)
@ -153,10 +150,137 @@ class GeneralTab(SettingsTab):
self.PasswordEdit.setObjectName(u'PasswordEdit') self.PasswordEdit.setObjectName(u'PasswordEdit')
self.CCLILayout.addWidget(self.PasswordEdit, 2, 1, 1, 1) self.CCLILayout.addWidget(self.PasswordEdit, 2, 1, 1, 1)
self.GeneralRightLayout.addWidget(self.CCLIGroupBox) 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.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)
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.setSpacing(0)
self.currentYLayout.setMargin(0)
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.setSpacing(0)
self.currentHeightLayout.setMargin(0)
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.setSpacing(0)
self.currentWidthLayout.setMargin(0)
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.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.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.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.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.setAlignment(QtCore.Qt.AlignCenter)
self.customWidthLabel.setObjectName(u'customWidthLabel')
self.customWidthLayout.addWidget(self.customWidthLabel)
self.customWidthValueEdit = QtGui.QLineEdit(self.displayGroupBox)
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, self.GeneralRightSpacer = QtGui.QSpacerItem(20, 40,
QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
self.GeneralRightLayout.addItem(self.GeneralRightSpacer) self.GeneralRightLayout.addItem(self.GeneralRightSpacer)
self.GeneralLayout.addWidget(self.GeneralRightWidget) # Signals and slots
QtCore.QObject.connect(self.overrideCheckBox,
QtCore.SIGNAL(u'toggled(bool)'), self.onOverrideCheckBoxToggled)
def retranslateUi(self): def retranslateUi(self):
""" """
@ -164,30 +288,46 @@ class GeneralTab(SettingsTab):
""" """
self.MonitorGroupBox.setTitle(translate('GeneralTab', 'Monitors')) self.MonitorGroupBox.setTitle(translate('GeneralTab', 'Monitors'))
self.MonitorLabel.setText( self.MonitorLabel.setText(
translate('GeneralTab', 'Select monitor for output display:')) translate('OpenLP.GeneralTab', 'Select monitor for output display:'))
self.DisplayOnMonitorCheck.setText( self.DisplayOnMonitorCheck.setText(
translate('GeneralTab', 'Display if a single screen')) translate('OpenLP.GeneralTab', 'Display if a single screen'))
self.StartupGroupBox.setTitle( self.StartupGroupBox.setTitle(
translate('GeneralTab', 'Application Startup')) translate('OpenLP.GeneralTab', 'Application Startup'))
self.WarningCheckBox.setText( self.WarningCheckBox.setText(
translate('GeneralTab', 'Show blank screen warning')) translate('OpenLP.GeneralTab', 'Show blank screen warning'))
self.AutoOpenCheckBox.setText( self.AutoOpenCheckBox.setText(
translate('GeneralTab', 'Automatically open the last service')) translate('OpenLP.GeneralTab', 'Automatically open the last service'))
self.ShowSplashCheckBox.setText( self.ShowSplashCheckBox.setText(
translate('GeneralTab', 'Show the splash screen')) translate('OpenLP.GeneralTab', 'Show the splash screen'))
self.SettingsGroupBox.setTitle( self.SettingsGroupBox.setTitle(translate('OpenLP.GeneralTab',
translate('GeneralTab', 'Application Settings')) 'Application Settings'))
self.SaveCheckServiceCheckBox.setText( self.SaveCheckServiceCheckBox.setText(translate('OpenLP.GeneralTab',
translate('GeneralTab',
'Prompt to save Service before starting New')) 'Prompt to save Service before starting New'))
self.AutoPreviewCheckBox.setText( self.AutoPreviewCheckBox.setText(translate('OpenLP.GeneralTab',
translate('GeneralTab', 'Preview Next Song from Service Manager')) 'Preview Next Song from Service Manager'))
self.CCLIGroupBox.setTitle(translate('GeneralTab', 'CCLI Details')) self.CCLIGroupBox.setTitle(translate('GeneralTab', 'CCLI Details'))
self.NumberLabel.setText(translate('GeneralTab', 'CCLI Number:')) self.NumberLabel.setText(translate('GeneralTab', 'CCLI Number:'))
self.UsernameLabel.setText( self.UsernameLabel.setText(translate('OpenLP.GeneralTab',
translate('GeneralTab', 'SongSelect Username:')) 'SongSelect Username:'))
self.PasswordLabel.setText( 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): def load(self):
""" """
@ -199,7 +339,7 @@ class GeneralTab(SettingsTab):
screen_name = u'%s %d' % (translate('GeneralTab', 'Screen'), screen_name = u'%s %d' % (translate('GeneralTab', 'Screen'),
screen[u'number'] + 1) screen[u'number'] + 1)
if screen[u'primary']: if screen[u'primary']:
screen_name = u'%s (%s)' % (screen_name, screen_name = u'%s (%s)' % (screen_name,
translate('GeneralTab', 'primary')) translate('GeneralTab', 'primary'))
self.MonitorComboBox.addItem(screen_name) self.MonitorComboBox.addItem(screen_name)
self.NumberEdit.setText(unicode(settings.value( self.NumberEdit.setText(unicode(settings.value(
@ -210,7 +350,7 @@ class GeneralTab(SettingsTab):
u'songselect password', QtCore.QVariant(u'')).toString())) u'songselect password', QtCore.QVariant(u'')).toString()))
self.SaveCheckServiceCheckBox.setChecked(settings.value(u'save prompt', self.SaveCheckServiceCheckBox.setChecked(settings.value(u'save prompt',
QtCore.QVariant(False)).toBool()) QtCore.QVariant(False)).toBool())
self.MonitorComboBox.setCurrentIndex(self.MonitorNumber) self.MonitorComboBox.setCurrentIndex(self.monitorNumber)
self.DisplayOnMonitorCheck.setChecked(self.screens.display) self.DisplayOnMonitorCheck.setChecked(self.screens.display)
self.WarningCheckBox.setChecked(settings.value(u'blank warning', self.WarningCheckBox.setChecked(settings.value(u'blank warning',
QtCore.QVariant(False)).toBool()) QtCore.QVariant(False)).toBool())
@ -220,16 +360,49 @@ class GeneralTab(SettingsTab):
QtCore.QVariant(True)).toBool()) QtCore.QVariant(True)).toBool())
self.AutoPreviewCheckBox.setChecked(settings.value(u'auto preview', self.AutoPreviewCheckBox.setChecked(settings.value(u'auto preview',
QtCore.QVariant(False)).toBool()) 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() 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): def save(self):
""" """
Save the settings from the form Save the settings from the form
""" """
self.MonitorNumber = self.MonitorComboBox.currentIndex() self.monitorNumber = self.MonitorComboBox.currentIndex()
settings = QtCore.QSettings() settings = QtCore.QSettings()
settings.beginGroup(self.settingsSection) settings.beginGroup(self.settingsSection)
settings.setValue(u'monitor', QtCore.QVariant(self.MonitorNumber)) settings.setValue(u'monitor', QtCore.QVariant(self.monitorNumber))
settings.setValue(u'display on monitor', settings.setValue(u'display on monitor',
QtCore.QVariant(self.DisplayOnMonitorCheck.isChecked())) QtCore.QVariant(self.DisplayOnMonitorCheck.isChecked()))
settings.setValue(u'blank warning', settings.setValue(u'blank warning',
@ -248,11 +421,40 @@ class GeneralTab(SettingsTab):
QtCore.QVariant(self.UsernameEdit.displayText())) QtCore.QVariant(self.UsernameEdit.displayText()))
settings.setValue(u'songselect password', settings.setValue(u'songselect password',
QtCore.QVariant(self.PasswordEdit.displayText())) 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() settings.endGroup()
self.screens.display = self.DisplayOnMonitorCheck.isChecked() self.screens.display = self.DisplayOnMonitorCheck.isChecked()
#Monitor Number has changed. #Monitor Number has changed.
if self.screens.monitor_number != self.MonitorNumber: if self.screens.monitor_number != self.monitorNumber:
self.screens.monitor_number = self.MonitorNumber self.screens.monitor_number = self.monitorNumber
self.screens.set_current_display(self.MonitorNumber) self.screens.set_current_display(self.monitorNumber)
Receiver.send_message(u'config_screen_changed') Receiver.send_message(u'config_screen_changed')
Receiver.send_message(u'config_updated') 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()
Receiver.send_message(u'config_screen_changed')
else:
self.screens.reset_current_display()
def onOverrideCheckBoxToggled(self, checked):
self.customXValueEdit.setEnabled(checked)
self.customYValueEdit.setEnabled(checked)
self.customHeightValueEdit.setEnabled(checked)
self.customWidthValueEdit.setEnabled(checked)
self.override_changed = True

View File

@ -358,6 +358,8 @@ class MainDisplay(DisplayWidget):
else: else:
self.displayBlank.setPixmap( self.displayBlank.setPixmap(
QtGui.QPixmap.fromImage(self.blankFrame)) QtGui.QPixmap.fromImage(self.blankFrame))
if mode != HideMode.Screen and self.isHidden():
self.setVisible(True)
def showDisplay(self, message=u''): def showDisplay(self, message=u''):
""" """
@ -367,6 +369,8 @@ class MainDisplay(DisplayWidget):
""" """
log.debug(u'showDisplay') log.debug(u'showDisplay')
self.displayBlank.setPixmap(self.transparent) self.displayBlank.setPixmap(self.transparent)
if self.isHidden():
self.setVisible(True)
#Trigger actions when display is active again #Trigger actions when display is active again
Receiver.send_message(u'maindisplay_active') Receiver.send_message(u'maindisplay_active')

View File

@ -658,6 +658,12 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
log.info(u'Load Themes') log.info(u'Load Themes')
self.ThemeManagerContents.loadThemes() self.ThemeManagerContents.loadThemes()
log.info(u'Load data from Settings') log.info(u'Load data from Settings')
if QtCore.QSettings().value(u'advanced/save current plugin',
QtCore.QVariant(False)).toBool():
savedPlugin = QtCore.QSettings().value(
u'advanced/current media plugin', QtCore.QVariant()).toInt()[0]
if savedPlugin != -1:
self.MediaToolBox.setCurrentIndex(savedPlugin)
self.settingsForm.postSetUp() self.settingsForm.postSetUp()
def setAutoLanguage(self, value): def setAutoLanguage(self, value):
@ -820,6 +826,10 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
""" """
# Clean temporary files used by services # Clean temporary files used by services
self.ServiceManagerContents.cleanUp() self.ServiceManagerContents.cleanUp()
if QtCore.QSettings().value(u'advanced/save current plugin',
QtCore.QVariant(False)).toBool():
QtCore.QSettings().setValue(u'advanced/current media plugin',
QtCore.QVariant(self.MediaToolBox.currentIndex()))
# Call the cleanup method to shutdown plugins. # Call the cleanup method to shutdown plugins.
log.info(u'cleanup plugins') log.info(u'cleanup plugins')
self.plugin_manager.finalise_plugins() self.plugin_manager.finalise_plugins()
@ -974,6 +984,6 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
if position != -1: if position != -1:
self.recentFiles.removeAt(position) self.recentFiles.removeAt(position)
self.recentFiles.insert(0, QtCore.QString(filename)) self.recentFiles.insert(0, QtCore.QString(filename))
while self.recentFiles.count() > recentFileCount: while self.recentFiles.count() > maxRecentFiles:
# Don't care what API says takeLast works, removeLast doesn't! # Don't care what API says takeLast works, removeLast doesn't!
self.recentFiles.takeLast() self.recentFiles.takeLast()

View File

@ -130,7 +130,7 @@ class ServiceManager(QtGui.QWidget):
translate('ServiceManager', 'Save Service'), translate('ServiceManager', 'Save Service'),
u':/general/general_save.png', u':/general/general_save.png',
translate('ServiceManager', 'Save this service'), translate('ServiceManager', 'Save this service'),
self.onSaveService) self.onQuickSaveService)
self.Toolbar.addSeparator() self.Toolbar.addSeparator()
self.ThemeLabel = QtGui.QLabel(translate('ServiceManager', 'Theme:'), self.ThemeLabel = QtGui.QLabel(translate('ServiceManager', 'Theme:'),
self) self)
@ -575,16 +575,16 @@ class ServiceManager(QtGui.QWidget):
SettingsManager.get_last_dir(self.parent.serviceSettingsSection), SettingsManager.get_last_dir(self.parent.serviceSettingsSection),
translate('ServiceManager', 'OpenLP Service Files (*.osz)')) translate('ServiceManager', 'OpenLP Service Files (*.osz)'))
else: else:
filename = SettingsManager.get_last_dir( filename = os.path.join(SettingsManager.get_last_dir(
self.parent.serviceSettingsSection) self.parent.serviceSettingsSection), self.serviceName)
if filename: if filename:
filename = QtCore.QDir.toNativeSeparators(filename)
splittedFile = filename.split(u'.') splittedFile = filename.split(u'.')
if splittedFile[-1] != u'osz': if splittedFile[-1] != u'osz':
filename = filename + u'.osz' filename = filename + u'.osz'
filename = unicode(filename) filename = unicode(filename)
self.isNew = False self.isNew = False
SettingsManager.set_last_dir( SettingsManager.set_last_dir(self.parent.serviceSettingsSection,
self.parent.serviceSettingsSection,
os.path.split(filename)[0]) os.path.split(filename)[0])
service = [] service = []
servicefile = filename + u'.osd' servicefile = filename + u'.osd'

View File

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

View File

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

View File

@ -202,15 +202,21 @@ class SlideController(QtGui.QWidget):
self.Toolbar.addToolbarWidget(u'Hide Menu', self.HideMenu) self.Toolbar.addToolbarWidget(u'Hide Menu', self.HideMenu)
self.HideMenu.setMenu(QtGui.QMenu( self.HideMenu.setMenu(QtGui.QMenu(
translate('SlideController', 'Hide'), self.Toolbar)) translate('SlideController', 'Hide'), self.Toolbar))
self.BlankScreen = QtGui.QAction(QtGui.QIcon( u':/slides/slide_blank.png'), u'Blank Screen', self.HideMenu) self.BlankScreen = QtGui.QAction(QtGui.QIcon(
u':/slides/slide_blank.png'), u'Blank Screen', self.HideMenu)
self.BlankScreen.setCheckable(True) self.BlankScreen.setCheckable(True)
QtCore.QObject.connect(self.BlankScreen, QtCore.SIGNAL("triggered(bool)"), self.onBlankDisplay) QtCore.QObject.connect(self.BlankScreen,
self.ThemeScreen = QtGui.QAction(QtGui.QIcon(u':/slides/slide_theme.png'), u'Blank to Theme', self.HideMenu) QtCore.SIGNAL("triggered(bool)"), self.onBlankDisplay)
self.ThemeScreen = QtGui.QAction(QtGui.QIcon(
u':/slides/slide_theme.png'), u'Blank to Theme', self.HideMenu)
self.ThemeScreen.setCheckable(True) self.ThemeScreen.setCheckable(True)
QtCore.QObject.connect(self.ThemeScreen, QtCore.SIGNAL("triggered(bool)"), self.onThemeDisplay) QtCore.QObject.connect(self.ThemeScreen,
self.DesktopScreen = QtGui.QAction(QtGui.QIcon(u':/slides/slide_desktop.png'), u'Show Desktop', self.HideMenu) QtCore.SIGNAL("triggered(bool)"), self.onThemeDisplay)
self.DesktopScreen = QtGui.QAction(QtGui.QIcon(
u':/slides/slide_desktop.png'), u'Show Desktop', self.HideMenu)
self.DesktopScreen.setCheckable(True) self.DesktopScreen.setCheckable(True)
QtCore.QObject.connect(self.DesktopScreen, QtCore.SIGNAL("triggered(bool)"), self.onHideDisplay) QtCore.QObject.connect(self.DesktopScreen,
QtCore.SIGNAL("triggered(bool)"), self.onHideDisplay)
self.HideMenu.setDefaultAction(self.BlankScreen) self.HideMenu.setDefaultAction(self.BlankScreen)
self.HideMenu.menu().addAction(self.BlankScreen) self.HideMenu.menu().addAction(self.BlankScreen)
self.HideMenu.menu().addAction(self.ThemeScreen) self.HideMenu.menu().addAction(self.ThemeScreen)
@ -241,9 +247,8 @@ class SlideController(QtGui.QWidget):
self.Toolbar.addToolbarWidget( self.Toolbar.addToolbarWidget(
u'Image SpinBox', self.DelaySpinBox) u'Image SpinBox', self.DelaySpinBox)
self.DelaySpinBox.setSuffix(translate('SlideController', 's')) self.DelaySpinBox.setSuffix(translate('SlideController', 's'))
self.DelaySpinBox.setToolTip( self.DelaySpinBox.setToolTip(translate('SlideController',
translate('SlideController', 'Delay between slides in seconds'))
'Delay between slides in seconds'))
self.ControllerLayout.addWidget(self.Toolbar) self.ControllerLayout.addWidget(self.Toolbar)
#Build a Media ToolBar #Build a Media ToolBar
self.Mediabar = OpenLPToolbar(self) self.Mediabar = OpenLPToolbar(self)
@ -268,8 +273,7 @@ class SlideController(QtGui.QWidget):
self.volumeSlider = Phonon.VolumeSlider() self.volumeSlider = Phonon.VolumeSlider()
self.volumeSlider.setGeometry(QtCore.QRect(90, 260, 221, 24)) self.volumeSlider.setGeometry(QtCore.QRect(90, 260, 221, 24))
self.volumeSlider.setObjectName(u'volumeSlider') self.volumeSlider.setObjectName(u'volumeSlider')
self.Mediabar.addToolbarWidget( self.Mediabar.addToolbarWidget(u'Audio Volume', self.volumeSlider)
u'Audio Volume', self.volumeSlider)
self.ControllerLayout.addWidget(self.Mediabar) self.ControllerLayout.addWidget(self.Mediabar)
# Build the Song Toolbar # Build the Song Toolbar
if isLive: if isLive:
@ -328,6 +332,11 @@ class SlideController(QtGui.QWidget):
# Signals # Signals
QtCore.QObject.connect(self.PreviewListWidget, QtCore.QObject.connect(self.PreviewListWidget,
QtCore.SIGNAL(u'clicked(QModelIndex)'), self.onSlideSelected) QtCore.SIGNAL(u'clicked(QModelIndex)'), self.onSlideSelected)
if not self.isLive:
if QtCore.QSettings().value(u'advanced/double click live',
QtCore.QVariant(False)).toBool():
QtCore.QObject.connect(self.PreviewListWidget,
QtCore.SIGNAL(u'doubleClicked(QModelIndex)'), self.onGoLive)
if isLive: if isLive:
QtCore.QObject.connect(Receiver.get_receiver(), QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'slidecontroller_live_spin_delay'), QtCore.SIGNAL(u'slidecontroller_live_spin_delay'),

View File

@ -48,6 +48,7 @@ class ThemeManager(QtGui.QWidget):
QtGui.QWidget.__init__(self, parent) QtGui.QWidget.__init__(self, parent)
self.parent = parent self.parent = parent
self.settingsSection = u'themes' self.settingsSection = u'themes'
self.serviceComboBox = self.parent.ServiceManagerContents.ThemeComboBox
self.Layout = QtGui.QVBoxLayout(self) self.Layout = QtGui.QVBoxLayout(self)
self.Layout.setSpacing(0) self.Layout.setSpacing(0)
self.Layout.setMargin(0) self.Layout.setMargin(0)
@ -116,6 +117,8 @@ class ThemeManager(QtGui.QWidget):
self.thumbPath = os.path.join(self.path, u'thumbnails') self.thumbPath = os.path.join(self.path, u'thumbnails')
self.checkThemesExists(self.thumbPath) self.checkThemesExists(self.thumbPath)
self.amendThemeForm.path = self.path self.amendThemeForm.path = self.path
self.oldBackgroundImage = None
self.editingDefault = False
# Last little bits of setting up # Last little bits of setting up
self.global_theme = unicode(QtCore.QSettings().value( self.global_theme = unicode(QtCore.QSettings().value(
self.settingsSection + u'/global theme', self.settingsSection + u'/global theme',
@ -185,8 +188,13 @@ class ThemeManager(QtGui.QWidget):
if check_item_selected(self.ThemeListWidget, translate('ThemeManager', if check_item_selected(self.ThemeListWidget, translate('ThemeManager',
'You must select a theme to edit.')): 'You must select a theme to edit.')):
item = self.ThemeListWidget.currentItem() item = self.ThemeListWidget.currentItem()
themeName = unicode(item.text())
if themeName != unicode(item.data(QtCore.Qt.UserRole).toString()):
self.editingDefault = True
theme = self.getThemeData( theme = self.getThemeData(
unicode(item.data(QtCore.Qt.UserRole).toString())) unicode(item.data(QtCore.Qt.UserRole).toString()))
if theme.background_type == u'image':
self.oldBackgroundImage = theme.background_filename
self.amendThemeForm.loadTheme(theme) self.amendThemeForm.loadTheme(theme)
self.saveThemeName = unicode( self.saveThemeName = unicode(
item.data(QtCore.Qt.UserRole).toString()) item.data(QtCore.Qt.UserRole).toString())
@ -212,37 +220,44 @@ class ThemeManager(QtGui.QWidget):
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok)) QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok))
else: else:
for plugin in self.parent.plugin_manager.plugins: for plugin in self.parent.plugin_manager.plugins:
if not plugin.canDeleteTheme(theme): if plugin.usesTheme(theme):
QtGui.QMessageBox.critical(self, QtGui.QMessageBox.critical(self,
translate('ThemeManager', 'Error'), translate('ThemeManager', 'Error'),
unicode(translate('ThemeManager', unicode(translate('ThemeManager',
'Theme %s is use in %s plugin.')) % \ 'Theme %s is use in %s plugin.')) % \
(theme, plugin.name)) (theme, plugin.name))
return return
if unicode(self.parent.ServiceManagerContents.ThemeComboBox \ if unicode(self.serviceComboBox.currentText()) == theme:
.currentText()) == theme:
QtGui.QMessageBox.critical(self, QtGui.QMessageBox.critical(self,
translate('ThemeManager', 'Error'), translate('ThemeManager', 'Error'),
unicode(translate('ThemeManager', unicode(translate('ThemeManager',
'Theme %s is use by the service manager.')) % theme) 'Theme %s is use by the service manager.')) % theme)
return return
self.themelist.remove(theme)
th = theme + u'.png'
row = self.ThemeListWidget.row(item) row = self.ThemeListWidget.row(item)
self.ThemeListWidget.takeItem(row) self.ThemeListWidget.takeItem(row)
try: self.deleteTheme(theme)
os.remove(os.path.join(self.path, th))
os.remove(os.path.join(self.thumbPath, th)) def deleteTheme(self, theme):
encoding = get_filesystem_encoding() """
shutil.rmtree( Delete a theme.
os.path.join(self.path, theme).encode(encoding))
except OSError: ``theme``
#if not present do not worry The theme to delete.
pass """
# As we do not reload the themes push out the change self.themelist.remove(theme)
# Reaload the list as the internal lists and events need th = theme + u'.png'
# to be triggered try:
self.pushThemes() os.remove(os.path.join(self.path, th))
os.remove(os.path.join(self.thumbPath, th))
encoding = get_filesystem_encoding()
shutil.rmtree(os.path.join(self.path, theme).encode(encoding))
except OSError:
#if not present do not worry
pass
# As we do not reload the themes push out the change
# Reaload the list as the internal lists and events need
# to be triggered
self.pushThemes()
def onExportTheme(self): def onExportTheme(self):
""" """
@ -532,18 +547,31 @@ class ThemeManager(QtGui.QWidget):
os.mkdir(os.path.join(self.path, name)) os.mkdir(os.path.join(self.path, name))
theme_file = os.path.join(theme_dir, name + u'.xml') theme_file = os.path.join(theme_dir, name + u'.xml')
log.debug(theme_file) log.debug(theme_file)
editedServiceTheme = False
result = QtGui.QMessageBox.Yes result = QtGui.QMessageBox.Yes
if self.saveThemeName != name: if self.saveThemeName != name:
if os.path.exists(theme_file): if os.path.exists(theme_file):
result = QtGui.QMessageBox.question(self, result = QtGui.QMessageBox.question(self,
translate('ThemeManager', 'Theme Exists'), translate('ThemeManager', 'Theme Exists'),
translate('ThemeManager', translate('ThemeManager', 'A theme with this name already '
'A theme with this name already exists. ' 'exists. Would you like to overwrite it?'),
'Would you like to overwrite it?'),
(QtGui.QMessageBox.Yes | QtGui.QMessageBox.No), (QtGui.QMessageBox.Yes | QtGui.QMessageBox.No),
QtGui.QMessageBox.No) QtGui.QMessageBox.No)
if self.saveThemeName != u'':
for plugin in self.parent.plugin_manager.plugins:
if plugin.usesTheme(self.saveThemeName):
plugin.renameTheme(self.saveThemeName, name)
if unicode(self.serviceComboBox.currentText()) == name:
editedServiceTheme = True
self.deleteTheme(self.saveThemeName)
if result == QtGui.QMessageBox.Yes: if result == QtGui.QMessageBox.Yes:
# Save the theme, overwriting the existing theme if necessary. # Save the theme, overwriting the existing theme if necessary.
if image_to and self.oldBackgroundImage and \
image_to != self.oldBackgroundImage:
try:
os.remove(self.oldBackgroundImage)
except OSError:
log.exception(u'Unable to remove old theme background')
outfile = None outfile = None
try: try:
outfile = open(theme_file, u'w') outfile = open(theme_file, u'w')
@ -563,6 +591,27 @@ class ThemeManager(QtGui.QWidget):
log.exception(u'Failed to save theme image') log.exception(u'Failed to save theme image')
self.generateAndSaveImage(self.path, name, theme_xml) self.generateAndSaveImage(self.path, name, theme_xml)
self.loadThemes() self.loadThemes()
# Check if we need to set a new service theme
if editedServiceTheme:
newThemeIndex = self.serviceComboBox.findText(name)
if newThemeIndex != -1:
self.serviceComboBox.setCurrentIndex(newThemeIndex)
if self.editingDefault:
newThemeItem = self.ThemeListWidget.findItems(name,
QtCore.Qt.MatchExactly)[0]
newThemeIndex = self.ThemeListWidget.indexFromItem(
newThemeItem).row()
self.global_theme = unicode(
self.ThemeListWidget.item(newThemeIndex).text())
newName = unicode(translate('ThemeManager', '%s (default)')) % \
self.global_theme
self.ThemeListWidget.item(newThemeIndex).setText(newName)
QtCore.QSettings().setValue(
self.settingsSection + u'/global theme',
QtCore.QVariant(self.global_theme))
Receiver.send_message(u'theme_update_global', self.global_theme)
self.editingDefault = False
self.pushThemes()
else: else:
# Don't close the dialog - allow the user to change the name of # Don't close the dialog - allow the user to change the name of
# the theme or to cancel the theme dialog completely. # the theme or to cancel the theme dialog completely.

View File

@ -120,14 +120,6 @@ class Ui_AlertDialog(object):
QtCore.QObject.connect(self.CloseButton, QtCore.SIGNAL(u'clicked()'), QtCore.QObject.connect(self.CloseButton, QtCore.SIGNAL(u'clicked()'),
AlertDialog.close) AlertDialog.close)
QtCore.QMetaObject.connectSlotsByName(AlertDialog) QtCore.QMetaObject.connectSlotsByName(AlertDialog)
AlertDialog.setTabOrder(self.AlertTextEdit, self.ParameterEdit)
AlertDialog.setTabOrder(self.ParameterEdit, self.AlertListWidget)
AlertDialog.setTabOrder(self.AlertListWidget, self.NewButton)
AlertDialog.setTabOrder(self.NewButton, self.SaveButton)
AlertDialog.setTabOrder(self.SaveButton, self.DeleteButton)
AlertDialog.setTabOrder(self.DeleteButton, self.DisplayButton)
AlertDialog.setTabOrder(self.DisplayButton, self.DisplayCloseButton)
AlertDialog.setTabOrder(self.DisplayCloseButton, self.CloseButton)
def retranslateUi(self, AlertDialog): def retranslateUi(self, AlertDialog):
AlertDialog.setWindowTitle( AlertDialog.setWindowTitle(

View File

@ -95,7 +95,26 @@ class BiblePlugin(Plugin):
'displayed on the screen during the service.') 'displayed on the screen during the service.')
return about_text return about_text
def canDeleteTheme(self, theme): def usesTheme(self, theme):
"""
Called to find out if the bible plugin is currently using a theme.
Returns True if the theme is being used, otherwise returns False.
"""
if self.settings_tab.bible_theme == theme: if self.settings_tab.bible_theme == theme:
return False return True
return True return False
def renameTheme(self, oldTheme, newTheme):
"""
Rename the theme the bible plugin is using making the plugin use the
new name.
``oldTheme``
The name of the theme the plugin should stop using. Unused for
this particular plugin.
``newTheme``
The new name the plugin should now use.
"""
self.settings_tab.bible_theme = newTheme

View File

@ -69,8 +69,30 @@ class CustomPlugin(Plugin):
'songs plugin.<br>') 'songs plugin.<br>')
return about_text return about_text
def canDeleteTheme(self, theme): def usesTheme(self, theme):
if not self.custommanager.get_all_objects_filtered(CustomSlide, """
Called to find out if the custom plugin is currently using a theme.
Returns True if the theme is being used, otherwise returns False.
"""
if self.custommanager.get_all_objects_filtered(CustomSlide,
CustomSlide.theme_name == theme): CustomSlide.theme_name == theme):
return True return True
return False return False
def renameTheme(self, oldTheme, newTheme):
"""
Renames a theme the custom plugin is using making the plugin use the
new name.
``oldTheme``
The name of the theme the plugin should stop using.
``newTheme``
The new name the plugin should now use.
"""
customsUsingTheme = self.custommanager.get_all_objects_filtered(
CustomSlide, CustomSlide.theme_name == oldTheme)
for custom in customsUsingTheme:
custom.theme_name = newTheme
self.custommanager.save_object(custom)

View File

@ -136,17 +136,6 @@ class Ui_customEditDialog(object):
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(u'rejected()'), QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(u'rejected()'),
customEditDialog.closePressed) customEditDialog.closePressed)
QtCore.QMetaObject.connectSlotsByName(customEditDialog) QtCore.QMetaObject.connectSlotsByName(customEditDialog)
customEditDialog.setTabOrder(self.TitleEdit, self.VerseTextEdit)
customEditDialog.setTabOrder(self.VerseTextEdit, self.AddButton)
customEditDialog.setTabOrder(self.AddButton, self.VerseListView)
customEditDialog.setTabOrder(self.VerseListView, self.EditButton)
customEditDialog.setTabOrder(self.EditButton, self.EditAllButton)
customEditDialog.setTabOrder(self.EditAllButton, self.SaveButton)
customEditDialog.setTabOrder(self.SaveButton, self.DeleteButton)
customEditDialog.setTabOrder(self.DeleteButton, self.CreditEdit)
customEditDialog.setTabOrder(self.CreditEdit, self.UpButton)
customEditDialog.setTabOrder(self.UpButton, self.DownButton)
customEditDialog.setTabOrder(self.DownButton, self.ThemeComboBox)
def retranslateUi(self, customEditDialog): def retranslateUi(self, customEditDialog):
customEditDialog.setWindowTitle( customEditDialog.setWindowTitle(

View File

@ -37,8 +37,6 @@ import logging
import os import os
import time import time
from openlp.core.lib import resize_image
if os.name == u'nt': if os.name == u'nt':
from win32com.client import Dispatch from win32com.client import Dispatch
import pywintypes import pywintypes

View File

@ -30,7 +30,6 @@ from PyQt4 import QtCore, QtGui
from openlp.core.lib import MediaManagerItem, BaseListWithDnD, build_icon, \ from openlp.core.lib import MediaManagerItem, BaseListWithDnD, build_icon, \
SettingsManager, translate, check_item_selected SettingsManager, translate, check_item_selected
from openlp.core.utils import AppLocation
from openlp.plugins.presentations.lib import MessageListener from openlp.plugins.presentations.lib import MessageListener
log = logging.getLogger(__name__) log = logging.getLogger(__name__)

View File

@ -394,48 +394,12 @@ class Ui_EditSongDialog(object):
QtGui.QDialogButtonBox.Cancel | QtGui.QDialogButtonBox.Save) QtGui.QDialogButtonBox.Cancel | QtGui.QDialogButtonBox.Save)
self.ButtonBox.setObjectName(u'ButtonBox') self.ButtonBox.setObjectName(u'ButtonBox')
self.verticalLayout.addWidget(self.ButtonBox) self.verticalLayout.addWidget(self.ButtonBox)
self.retranslateUi(EditSongDialog) self.retranslateUi(EditSongDialog)
QtCore.QObject.connect(self.ButtonBox, QtCore.QObject.connect(self.ButtonBox,
QtCore.SIGNAL(u'rejected()'), EditSongDialog.closePressed) QtCore.SIGNAL(u'rejected()'), EditSongDialog.closePressed)
QtCore.QObject.connect(self.ButtonBox, QtCore.QObject.connect(self.ButtonBox,
QtCore.SIGNAL(u'accepted()'), EditSongDialog.accept) QtCore.SIGNAL(u'accepted()'), EditSongDialog.accept)
QtCore.QMetaObject.connectSlotsByName(EditSongDialog) QtCore.QMetaObject.connectSlotsByName(EditSongDialog)
EditSongDialog.setTabOrder(self.SongTabWidget, self.TitleEditItem)
EditSongDialog.setTabOrder(self.TitleEditItem, self.AlternativeEdit)
EditSongDialog.setTabOrder(self.AlternativeEdit, self.VerseListWidget)
EditSongDialog.setTabOrder(self.VerseListWidget, self.VerseAddButton)
EditSongDialog.setTabOrder(self.VerseAddButton, self.VerseEditButton)
EditSongDialog.setTabOrder(self.VerseEditButton,
self.VerseEditAllButton)
EditSongDialog.setTabOrder(self.VerseEditAllButton,
self.VerseDeleteButton)
EditSongDialog.setTabOrder(self.VerseDeleteButton, self.VerseOrderEdit)
EditSongDialog.setTabOrder(self.VerseOrderEdit,
self.AuthorsSelectionComboItem)
EditSongDialog.setTabOrder(self.AuthorsSelectionComboItem,
self.AuthorAddButton)
EditSongDialog.setTabOrder(self.AuthorAddButton, self.AuthorsListView)
EditSongDialog.setTabOrder(self.AuthorsListView,
self.AuthorRemoveButton)
EditSongDialog.setTabOrder(self.AuthorRemoveButton,
self.MaintenanceButton)
EditSongDialog.setTabOrder(self.MaintenanceButton, self.SongTopicCombo)
EditSongDialog.setTabOrder(self.SongTopicCombo, self.TopicAddButton)
EditSongDialog.setTabOrder(self.TopicAddButton, self.TopicsListView)
EditSongDialog.setTabOrder(self.TopicsListView, self.TopicRemoveButton)
EditSongDialog.setTabOrder(self.TopicRemoveButton, self.SongbookCombo)
EditSongDialog.setTabOrder(self.SongbookCombo,
self.ThemeSelectionComboItem)
EditSongDialog.setTabOrder(self.ThemeSelectionComboItem,
self.ThemeAddButton)
EditSongDialog.setTabOrder(self.ThemeAddButton, self.CopyrightEditItem)
EditSongDialog.setTabOrder(self.CopyrightEditItem,
self.CopyrightInsertButton)
EditSongDialog.setTabOrder(self.CopyrightInsertButton,
self.CCLNumberEdit)
EditSongDialog.setTabOrder(self.CCLNumberEdit, self.CommentsEdit)
EditSongDialog.setTabOrder(self.CommentsEdit, self.ButtonBox)
def retranslateUi(self, EditSongDialog): def retranslateUi(self, EditSongDialog):
EditSongDialog.setWindowTitle( EditSongDialog.setWindowTitle(

View File

@ -24,6 +24,7 @@
############################################################################### ###############################################################################
from PyQt4 import QtGui, QtCore from PyQt4 import QtGui, QtCore
from sqlalchemy.sql import and_
from openlp.core.lib import translate from openlp.core.lib import translate
from openlp.plugins.songs.forms import AuthorsForm, TopicsForm, SongBookForm from openlp.plugins.songs.forms import AuthorsForm, TopicsForm, SongBookForm
@ -97,6 +98,9 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
QtGui.QMessageBox.critical(self, dlg_title, sel_text) QtGui.QMessageBox.critical(self, dlg_title, sel_text)
def resetAuthors(self): def resetAuthors(self):
"""
Reloads the Authors list.
"""
self.AuthorsListWidget.clear() self.AuthorsListWidget.clear()
authors = self.songmanager.get_all_objects(Author, Author.display_name) authors = self.songmanager.get_all_objects(Author, Author.display_name)
for author in authors: for author in authors:
@ -109,6 +113,9 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
self.AuthorsListWidget.addItem(author_name) self.AuthorsListWidget.addItem(author_name)
def resetTopics(self): def resetTopics(self):
"""
Reloads the Topics list.
"""
self.TopicsListWidget.clear() self.TopicsListWidget.clear()
topics = self.songmanager.get_all_objects(Topic, Topic.name) topics = self.songmanager.get_all_objects(Topic, Topic.name)
for topic in topics: for topic in topics:
@ -117,13 +124,88 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
self.TopicsListWidget.addItem(topic_name) self.TopicsListWidget.addItem(topic_name)
def resetBooks(self): def resetBooks(self):
"""
Reloads the Books list.
"""
self.BooksListWidget.clear() self.BooksListWidget.clear()
books = self.songmanager.get_all_objects(Book, Book.name) books = self.songmanager.get_all_objects(Book, Book.name)
for book in books: for book in books:
book_name = QtGui.QListWidgetItem(book.name) book_name = QtGui.QListWidgetItem(u'%s (%s)' % (book.name,
book.publisher))
book_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(book.id)) book_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(book.id))
self.BooksListWidget.addItem(book_name) self.BooksListWidget.addItem(book_name)
def checkAuthor(self, new_author, edit=False):
"""
Returns False when the given Author is already in the list elsewise
True.
"""
authors = self.songmanager.get_all_objects_filtered(Author,
and_(
Author.first_name == new_author.first_name,
Author.last_name == new_author.last_name,
Author.display_name == new_author.display_name
)
)
if len(authors) > 0:
# If we edit an existing Author, we need to make sure that we do
# not return False when nothing has changed (because this would
# cause an error message later on).
if edit:
if authors[0].id == new_author.id:
return True
else:
return False
else:
return False
else:
return True
def checkTopic(self, new_topic, edit=False):
"""
Returns False when the given Topic is already in the list elsewise True.
"""
topics = self.songmanager.get_all_objects_filtered(Topic,
Topic.name == new_topic.name
)
if len(topics) > 0:
# If we edit an existing Topic, we need to make sure that we do
# not return False when nothing has changed (because this would
# cause an error message later on).
if edit:
if topics[0].id == new_topic.id:
return True
else:
return False
else:
return False
else:
return True
def checkBook(self, new_book, edit=False):
"""
Returns False when the given Book is already in the list elsewise True.
"""
books = self.songmanager.get_all_objects_filtered(Book,
and_(
Book.name == new_book.name,
Book.publisher == new_book.publisher
)
)
if len(books) > 0:
# If we edit an existing Book, we need to make sure that we do
# not return False when nothing has changed (because this would
# cause an error message later on).
if edit:
if books[0].id == new_book.id:
return True
else:
return False
else:
return False
else:
return True
def onAuthorAddButtonClick(self): def onAuthorAddButtonClick(self):
self.authorform.setAutoDisplayName(True) self.authorform.setAutoDisplayName(True)
if self.authorform.exec_(): if self.authorform.exec_():
@ -131,86 +213,93 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
first_name=unicode(self.authorform.FirstNameEdit.text()), first_name=unicode(self.authorform.FirstNameEdit.text()),
last_name=unicode(self.authorform.LastNameEdit.text()), last_name=unicode(self.authorform.LastNameEdit.text()),
display_name=unicode(self.authorform.DisplayEdit.text())) display_name=unicode(self.authorform.DisplayEdit.text()))
if self.songmanager.save_object(author): if self.checkAuthor(author):
self.resetAuthors() if self.songmanager.save_object(author):
self.resetAuthors()
else: else:
QtGui.QMessageBox.critical( QtGui.QMessageBox.critical(self,
self, translate('SongsPlugin.SongMaintenanceForm', translate('SongsPlugin.SongMaintenanceForm', 'Error'),
'Error'),
translate('SongsPlugin.SongMaintenanceForm', translate('SongsPlugin.SongMaintenanceForm',
'Couldn\'t add your author.')) 'Could not add your author.'))
def onTopicAddButtonClick(self): def onTopicAddButtonClick(self):
if self.topicform.exec_(): if self.topicform.exec_():
topic = Topic.populate(name=unicode(self.topicform.NameEdit.text())) topic = Topic.populate(name=unicode(self.topicform.NameEdit.text()))
if self.songmanager.save_object(topic): if self.checkTopic(topic):
self.resetTopics() if self.songmanager.save_object(topic):
self.resetTopics()
else: else:
QtGui.QMessageBox.critical( QtGui.QMessageBox.critical(self,
self, translate('SongsPlugin.SongMaintenanceForm', translate('SongsPlugin.SongMaintenanceForm', 'Error'),
'Error'),
translate('SongsPlugin.SongMaintenanceForm', translate('SongsPlugin.SongMaintenanceForm',
'Couldn\'t add your topic.')) 'Could not add your topic.'))
def onBookAddButtonClick(self): def onBookAddButtonClick(self):
if self.bookform.exec_(): if self.bookform.exec_():
book = Book.populate( book = Book.populate(
name=unicode(self.bookform.NameEdit.text()), name=unicode(self.bookform.NameEdit.text()),
publisher=unicode(self.bookform.PublisherEdit.text())) publisher=unicode(self.bookform.PublisherEdit.text()))
if self.songmanager.save_object(book): if self.checkBook(book):
self.resetBooks() if self.songmanager.save_object(book):
self.resetBooks()
else: else:
QtGui.QMessageBox.critical( QtGui.QMessageBox.critical(self,
self, translate('SongsPlugin.SongMaintenanceForm', translate('SongsPlugin.SongMaintenanceForm', 'Error'),
'Error'),
translate('SongsPlugin.SongMaintenanceForm', translate('SongsPlugin.SongMaintenanceForm',
'Couldn\'t add your book.')) 'Could not add your book.'))
def onAuthorEditButtonClick(self): def onAuthorEditButtonClick(self):
author_id = self._getCurrentItemId(self.AuthorsListWidget) author_id = self._getCurrentItemId(self.AuthorsListWidget)
if author_id != -1: if author_id != -1:
author = self.songmanager.get_object(Author, author_id) author = self.songmanager.get_object(Author, author_id)
# Just make sure none of the fields is None
if author.first_name is None:
author.first_name = u''
if author.last_name is None:
author.last_name = u''
if author.display_name is None:
author.display_name = u''
self.authorform.setAutoDisplayName(False) self.authorform.setAutoDisplayName(False)
self.authorform.FirstNameEdit.setText(author.first_name) self.authorform.FirstNameEdit.setText(author.first_name)
self.authorform.LastNameEdit.setText(author.last_name) self.authorform.LastNameEdit.setText(author.last_name)
self.authorform.DisplayEdit.setText(author.display_name) self.authorform.DisplayEdit.setText(author.display_name)
# Save the author's first and last name as well as the display name
# for the case that they have to be restored.
temp_first_name = author.first_name
temp_last_name = author.last_name
temp_display_name = author.display_name
if self.authorform.exec_(False): if self.authorform.exec_(False):
author.first_name = unicode( author.first_name = unicode(
self.authorform.FirstNameEdit.text()) self.authorform.FirstNameEdit.text())
author.last_name = unicode(self.authorform.LastNameEdit.text()) author.last_name = unicode(self.authorform.LastNameEdit.text())
author.display_name = unicode( author.display_name = unicode(
self.authorform.DisplayEdit.text()) self.authorform.DisplayEdit.text())
if self.songmanager.save_object(author): if self.checkAuthor(author, True):
self.resetAuthors() if self.songmanager.save_object(author):
self.resetAuthors()
else: else:
QtGui.QMessageBox.critical( # We restore the author's old first and last name as well as
self, translate('SongsPlugin.SongMaintenanceForm', # his display name.
'Error'), author.first_name = temp_first_name
author.last_name = temp_last_name
author.display_name = temp_display_name
QtGui.QMessageBox.critical(self,
translate('SongsPlugin.SongMaintenanceForm', 'Error'),
translate('SongsPlugin.SongMaintenanceForm', translate('SongsPlugin.SongMaintenanceForm',
'Couldn\'t save your author.')) 'Could not save your author.'))
def onTopicEditButtonClick(self): def onTopicEditButtonClick(self):
topic_id = self._getCurrentItemId(self.TopicsListWidget) topic_id = self._getCurrentItemId(self.TopicsListWidget)
if topic_id != -1: if topic_id != -1:
topic = self.songmanager.get_object(Topic, topic_id) topic = self.songmanager.get_object(Topic, topic_id)
self.topicform.NameEdit.setText(topic.name) self.topicform.NameEdit.setText(topic.name)
# Save the topic's name for the case that he has to be restored.
temp_name = topic.name
if self.topicform.exec_(False): if self.topicform.exec_(False):
topic.name = unicode(self.topicform.NameEdit.text()) topic.name = unicode(self.topicform.NameEdit.text())
if self.songmanager.save_object(topic): if self.checkTopic(topic, True):
self.resetTopics() if self.songmanager.save_object(topic):
self.resetTopics()
else: else:
QtGui.QMessageBox.critical( # We restore the topics's old name.
self, translate('SongsPlugin.SongMaintenanceForm', topic.name = temp_name
'Error'), QtGui.QMessageBox.critical(self,
translate('SongsPlugin.SongMaintenanceForm', 'Error'),
translate('SongsPlugin.SongMaintenanceForm', translate('SongsPlugin.SongMaintenanceForm',
'Couldn\'t save your topic.')) 'Could not save your topic.'))
def onBookEditButtonClick(self): def onBookEditButtonClick(self):
book_id = self._getCurrentItemId(self.BooksListWidget) book_id = self._getCurrentItemId(self.BooksListWidget)
@ -218,17 +307,24 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
book = self.songmanager.get_object(Book, book_id) book = self.songmanager.get_object(Book, book_id)
self.bookform.NameEdit.setText(book.name) self.bookform.NameEdit.setText(book.name)
self.bookform.PublisherEdit.setText(book.publisher) self.bookform.PublisherEdit.setText(book.publisher)
# Save the book's name and publisher for the case that they have to
# be restored.
temp_name = book.name
temp_publisher = book.publisher
if self.bookform.exec_(False): if self.bookform.exec_(False):
book.name = unicode(self.bookform.NameEdit.text()) book.name = unicode(self.bookform.NameEdit.text())
book.publisher = unicode(self.bookform.PublisherEdit.text()) book.publisher = unicode(self.bookform.PublisherEdit.text())
if self.songmanager.save_object(book): if self.checkBook(book, True):
self.resetBooks() if self.songmanager.save_object(book):
self.resetBooks()
else: else:
QtGui.QMessageBox.critical( # We restore the book's old name and publisher.
self, translate('SongsPlugin.SongMaintenanceForm', book.name = temp_name
'Error'), book.publisher = temp_publisher
QtGui.QMessageBox.critical(self,
translate('SongsPlugin.SongMaintenanceForm', 'Error'),
translate('SongsPlugin.SongMaintenanceForm', translate('SongsPlugin.SongMaintenanceForm',
'Couldn\'t save your book.')) 'Could not save your book.'))
def onAuthorDeleteButtonClick(self): def onAuthorDeleteButtonClick(self):
""" """
@ -236,13 +332,12 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
""" """
self._deleteItem(Author, self.AuthorsListWidget, self.resetAuthors, self._deleteItem(Author, self.AuthorsListWidget, self.resetAuthors,
translate('SongsPlugin.SongMaintenanceForm', 'Delete Author'), translate('SongsPlugin.SongMaintenanceForm', 'Delete Author'),
translate('SongsPlugin.SongMaintenanceForm', translate('SongsPlugin.SongMaintenanceForm',
'Are you sure you want to delete the selected author?'), 'Are you sure you want to delete the selected author?'),
translate('SongsPlugin.SongMaintenanceForm', translate('SongsPlugin.SongMaintenanceForm',
'This author can\'t be deleted, they are currently ' 'This author cannot be deleted, they are currently '
'assigned to at least one song.'), 'assigned to at least one song.'),
translate('SongsPlugin.SongMaintenanceForm', translate('SongsPlugin.SongMaintenanceForm', 'No author selected!'))
'No author selected!'))
def onTopicDeleteButtonClick(self): def onTopicDeleteButtonClick(self):
""" """
@ -250,13 +345,12 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
""" """
self._deleteItem(Topic, self.TopicsListWidget, self.resetTopics, self._deleteItem(Topic, self.TopicsListWidget, self.resetTopics,
translate('SongsPlugin.SongMaintenanceForm', 'Delete Topic'), translate('SongsPlugin.SongMaintenanceForm', 'Delete Topic'),
translate('SongsPlugin.SongMaintenanceForm',
'Are you sure you want to delete the selected topic?'),
translate('SongsPlugin.SongMaintenanceForm',
'This topic can\'t be deleted, it is currently '
'assigned to at least one song.'),
translate('SongsPlugin.SongMaintenanceForm', translate('SongsPlugin.SongMaintenanceForm',
'No topic selected!')) 'Are you sure you want to delete the selected topic?'),
translate('SongsPlugin.SongMaintenanceForm',
'This topic cannot be deleted, it is currently '
'assigned to at least one song.'),
translate('SongsPlugin.SongMaintenanceForm', 'No topic selected!'))
def onBookDeleteButtonClick(self): def onBookDeleteButtonClick(self):
""" """
@ -266,7 +360,7 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog):
translate('SongsPlugin.SongMaintenanceForm', 'Delete Book'), translate('SongsPlugin.SongMaintenanceForm', 'Delete Book'),
translate('SongsPlugin.SongMaintenanceForm', translate('SongsPlugin.SongMaintenanceForm',
'Are you sure you want to delete the selected book?'), 'Are you sure you want to delete the selected book?'),
translate('SongsPlugin.SongMaintenanceForm', translate('SongsPlugin.SongMaintenanceForm',
'This book can\'t be deleted, it is currently ' 'This book cannot be deleted, it is currently '
'assigned to at least one song.'), 'assigned to at least one song.'),
translate('SongsPlugin.SongMaintenanceForm', u'No book selected!')) translate('SongsPlugin.SongMaintenanceForm', 'No book selected!'))

View File

@ -303,28 +303,22 @@ class SongImport(object):
author = self.manager.get_object_filtered(Author, author = self.manager.get_object_filtered(Author,
Author.display_name == authortext) Author.display_name == authortext)
if author is None: if author is None:
author = Author() author = Author.populate(display_name = authortext,
author.display_name = authortext last_name=authortext.split(u' ')[-1],
author.last_name = authortext.split(u' ')[-1] first_name=u' '.join(authortext.split(u' ')[:-1]))
author.first_name = u' '.join(authortext.split(u' ')[:-1])
self.manager.save_object(author)
song.authors.append(author) song.authors.append(author)
if self.song_book_name: if self.song_book_name:
song_book = self.manager.get_object_filtered(Book, song_book = self.manager.get_object_filtered(Book,
Book.name == self.song_book_name) Book.name == self.song_book_name)
if song_book is None: if song_book is None:
song_book = Book() song_book = Book.populate(name=self.song_book_name,
song_book.name = self.song_book_name publisher=self.song_book_pub)
song_book.publisher = self.song_book_pub song.book = song_book
self.manager.save_object(song_book)
song.song_book_id = song_book.id
for topictext in self.topics: for topictext in self.topics:
topic = self.manager.get_object_filtered(Topic, topic = self.manager.get_object_filtered(Topic,
Topic.name == topictext) Topic.name == topictext)
if topic is None: if topic is None:
topic = Topic() topic = Topic.populate(name=topictext)
topic.name = topictext
self.manager.save_object(topic)
song.topics.append(topictext) song.topics.append(topictext)
self.manager.save_object(song) self.manager.save_object(song)

View File

@ -192,8 +192,30 @@ class SongsPlugin(Plugin):
'This plugin allows songs to be managed and displayed.') 'This plugin allows songs to be managed and displayed.')
return about_text return about_text
def canDeleteTheme(self, theme): def usesTheme(self, theme):
if not self.manager.get_all_objects_filtered(Song, """
Called to find out if the song plugin is currently using a theme.
Returns True if the theme is being used, otherwise returns False.
"""
if self.manager.get_all_objects_filtered(Song,
Song.theme_name == theme): Song.theme_name == theme):
return True return True
return False return False
def renameTheme(self, oldTheme, newTheme):
"""
Renames a theme the song plugin is using making the plugin use the new
name.
``oldTheme``
The name of the theme the plugin should stop using.
``newTheme``
The new name the plugin should now use.
"""
songsUsingTheme = self.manager.get_all_objects_filtered(Song,
Song.theme_name == oldTheme)
for song in songsUsingTheme:
song.theme_name = newTheme
self.custommanager.save_object(song)