openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #06504
[Merge] lp:~raoul-snyman/openlp/default-image into lp:openlp
Raoul Snyman has proposed merging lp:~raoul-snyman/openlp/default-image into lp:openlp.
Requested reviews:
OpenLP Core (openlp-core)
For more details, see:
https://code.launchpad.net/~raoul-snyman/openlp/default-image/+merge/51010
Add the option to change the default display.
--
https://code.launchpad.net/~raoul-snyman/openlp/default-image/+merge/51010
Your team OpenLP Core is requested to review the proposed merge of lp:~raoul-snyman/openlp/default-image into lp:openlp.
=== modified file 'openlp/core/ui/advancedtab.py'
--- openlp/core/ui/advancedtab.py 2011-02-12 04:09:03 +0000
+++ openlp/core/ui/advancedtab.py 2011-02-23 21:20:24 +0000
@@ -28,8 +28,9 @@
"""
from PyQt4 import QtCore, QtGui
-from openlp.core.lib import SettingsTab, translate
+from openlp.core.lib import SettingsTab, translate, build_icon
from openlp.core.lib.ui import UiStrings
+from openlp.core.utils import get_images_filter
class AdvancedTab(SettingsTab):
"""
@@ -41,6 +42,8 @@
Initialise the settings tab
"""
SettingsTab.__init__(self, u'Advanced')
+ self.default_image = u':/graphics/openlp-splash-screen.png'
+ self.default_color = u'#ffffff'
def setupUi(self):
"""
@@ -81,33 +84,38 @@
self.hideMouseCheckBox.setObjectName(u'hideMouseCheckBox')
self.hideMouseLayout.addWidget(self.hideMouseCheckBox)
self.leftLayout.addWidget(self.hideMouseGroupBox)
-# self.sharedDirGroupBox = QtGui.QGroupBox(self.leftColumn)
-# self.sharedDirGroupBox.setObjectName(u'sharedDirGroupBox')
-# self.sharedDirLayout = QtGui.QFormLayout(self.sharedDirGroupBox)
-# self.sharedCheckBox = QtGui.QCheckBox(self.sharedDirGroupBox)
-# self.sharedCheckBox.setObjectName(u'sharedCheckBox')
-# self.sharedDirLayout.addRow(self.sharedCheckBox)
-# self.sharedLabel = QtGui.QLabel(self.sharedDirGroupBox)
-# self.sharedLabel.setObjectName(u'sharedLabel')
-# self.sharedSubLayout = QtGui.QHBoxLayout()
-# self.sharedSubLayout.setObjectName(u'sharedSubLayout')
-# self.sharedLineEdit = QtGui.QLineEdit(self.sharedDirGroupBox)
-# self.sharedLineEdit.setObjectName(u'sharedLineEdit')
-# self.sharedSubLayout.addWidget(self.sharedLineEdit)
-# self.sharedPushButton = QtGui.QPushButton(self.sharedDirGroupBox)
-# self.sharedPushButton.setObjectName(u'sharedPushButton')
-# self.sharedSubLayout.addWidget(self.sharedPushButton)
-# self.sharedDirLayout.addRow(self.sharedLabel, self.sharedSubLayout)
-# self.leftLayout.addWidget(self.sharedDirGroupBox)
self.leftLayout.addStretch()
-# self.databaseGroupBox = QtGui.QGroupBox(self.rightColumn)
-# self.databaseGroupBox.setObjectName(u'databaseGroupBox')
-# self.databaseGroupBox.setEnabled(False)
-# self.databaseLayout = QtGui.QVBoxLayout(self.databaseGroupBox)
-# self.rightLayout.addWidget(self.databaseGroupBox)
+ self.defaultImageGroupBox = QtGui.QGroupBox(self.rightColumn)
+ self.defaultImageGroupBox.setObjectName(u'defaultImageGroupBox')
+ self.defaultImageLayout = QtGui.QFormLayout(self.defaultImageGroupBox)
+ self.defaultImageLayout.setObjectName(u'defaultImageLayout')
+ self.defaultColorLabel = QtGui.QLabel(self.defaultImageGroupBox)
+ self.defaultColorLabel.setObjectName(u'defaultColorLabel')
+ self.defaultColorButton = QtGui.QPushButton(self.defaultImageGroupBox)
+ self.defaultColorButton.setObjectName(u'defaultColorButton')
+ self.defaultImageLayout.addRow(self.defaultColorLabel,
+ self.defaultColorButton)
+ self.defaultFileLabel = QtGui.QLabel(self.defaultImageGroupBox)
+ self.defaultFileLabel.setObjectName(u'defaultFileLabel')
+ self.defaultFileEdit = QtGui.QLineEdit(self.defaultImageGroupBox)
+ self.defaultFileEdit.setObjectName(u'defaultFileEdit')
+ self.defaultBrowseButton = QtGui.QToolButton(self.defaultImageGroupBox)
+ self.defaultBrowseButton.setObjectName(u'defaultBrowseButton')
+ self.defaultBrowseButton.setIcon(
+ build_icon(u':/general/general_open.png'))
+ self.defaultFileLayout = QtGui.QHBoxLayout()
+ self.defaultFileLayout.setObjectName(u'defaultFileLayout')
+ self.defaultFileLayout.addWidget(self.defaultFileEdit)
+ self.defaultFileLayout.addWidget(self.defaultBrowseButton)
+ self.defaultImageLayout.addRow(self.defaultFileLabel,
+ self.defaultFileLayout)
+ self.rightLayout.addWidget(self.defaultImageGroupBox)
self.rightLayout.addStretch()
-# QtCore.QObject.connect(self.sharedCheckBox,
-# QtCore.SIGNAL(u'stateChanged(int)'), self.onSharedCheckBoxChanged)
+
+ QtCore.QObject.connect(self.defaultColorButton,
+ QtCore.SIGNAL(u'pressed()'), self.onDefaultColorButtonPressed)
+ QtCore.QObject.connect(self.defaultBrowseButton,
+ QtCore.SIGNAL(u'pressed()'), self.onDefaultBrowseButtonPressed)
def retranslateUi(self):
"""
@@ -129,14 +137,13 @@
self.hideMouseGroupBox.setTitle(translate('OpenLP.AdvancedTab',
'Mouse Cursor'))
self.hideMouseCheckBox.setText(translate('OpenLP.AdvancedTab',
- 'Hide the mouse cursor when moved over the display window'))
-# self.sharedDirGroupBox.setTitle(
-# translate('AdvancedTab', 'Central Data Store'))
-# self.sharedCheckBox.setText(
-# translate('AdvancedTab', 'Enable a shared data location'))
-# self.sharedLabel.setText(translate('AdvancedTab', 'Store location:'))
-# self.sharedPushButton.setText(UiStrings.Browse)
-# self.databaseGroupBox.setTitle(translate('AdvancedTab', 'Databases'))
+ 'Hide mouse cursor when over display window'))
+ self.defaultImageGroupBox.setTitle(translate('OpenLP.AdvancedTab',
+ 'Default Image'))
+ self.defaultColorLabel.setText(translate('OpenLP.AdvancedTab',
+ 'Background color:'))
+ self.defaultFileLabel.setText(translate('OpenLP.AdvancedTab',
+ 'Image file:'))
def load(self):
"""
@@ -165,7 +172,14 @@
QtCore.QVariant(True)).toBool())
self.hideMouseCheckBox.setChecked(
settings.value(u'hide mouse', QtCore.QVariant(False)).toBool())
+ self.default_color = settings.value(u'default color',
+ QtCore.QVariant(u'#ffffff')).toString()
+ self.defaultFileEdit.setText(settings.value(u'default image',
+ QtCore.QVariant(u':/graphics/openlp-splash-screen.png'))\
+ .toString())
settings.endGroup()
+ self.defaultColorButton.setStyleSheet(
+ u'background-color: %s' % self.default_color)
def save(self):
"""
@@ -185,12 +199,24 @@
QtCore.QVariant(self.enableAutoCloseCheckBox.isChecked()))
settings.setValue(u'hide mouse',
QtCore.QVariant(self.hideMouseCheckBox.isChecked()))
+ settings.setValue(u'default color', self.default_color)
+ settings.setValue(u'default image', self.defaultFileEdit.text())
settings.endGroup()
-# def onSharedCheckBoxChanged(self, checked):
-# """
-# Enables the widgets to allow a shared data location
-# """
-# self.sharedLabel.setEnabled(checked)
-# self.sharedTextEdit.setEnabled(checked)
-# self.sharedPushButton.setEnabled(checked)
+ def onDefaultColorButtonPressed(self):
+ new_color = QtGui.QColorDialog.getColor(
+ QtGui.QColor(self.default_color), self)
+ if new_color.isValid():
+ self.default_color = new_color.name()
+ self.defaultColorButton.setStyleSheet(
+ u'background-color: %s' % self.default_color)
+
+ def onDefaultBrowseButtonPressed(self):
+ file_filters = u'%s;;%s (*.*) (*)' % (get_images_filter(),
+ UiStrings.AllFiles)
+ filename = QtGui.QFileDialog.getOpenFileName(self,
+ translate('OpenLP.AdvancedTab', 'Open File'), '',
+ file_filters)
+ if filename:
+ self.defaultFileEdit.setText(filename)
+ self.defaultFileEdit.setFocus()
=== modified file 'openlp/core/ui/maindisplay.py'
--- openlp/core/ui/maindisplay.py 2011-02-14 18:43:37 +0000
+++ openlp/core/ui/maindisplay.py 2011-02-23 21:20:24 +0000
@@ -132,14 +132,22 @@
painter_image.begin(self.black)
painter_image.fillRect(self.black.rect(), QtCore.Qt.black)
# Build the initial frame.
+ image_file = QtCore.QSettings().value(u'advanced/default image',
+ QtCore.QVariant(u':/graphics/openlp-splash-screen.png'))\
+ .toString()
+ background_color = QtGui.QColor(QtCore.QSettings().value(
+ u'advanced/default color',
+ QtCore.QVariant(u'#ffffff')).toString())
+ if not background_color.isValid():
+ background_color = QtCore.Qt.white
+ splash_image = QtGui.QImage(image_file)
initialFrame = QtGui.QImage(
self.screens.current[u'size'].width(),
self.screens.current[u'size'].height(),
QtGui.QImage.Format_ARGB32_Premultiplied)
- splash_image = QtGui.QImage(u':/graphics/openlp-splash-screen.png')
painter_image = QtGui.QPainter()
painter_image.begin(initialFrame)
- painter_image.fillRect(initialFrame.rect(), QtCore.Qt.white)
+ painter_image.fillRect(initialFrame.rect(), background_color)
painter_image.drawImage(
(self.screens.current[u'size'].width() -
splash_image.width()) / 2,
Follow ups