Fixed up the settings dialog and the alerts tab a bit.

bzr-revno: 379
This commit is contained in:
Raoul Snyman 2009-03-05 20:31:17 +00:00
parent dffcec7ca3
commit c9ef88cfdc
6 changed files with 93 additions and 113 deletions

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE UserProject SYSTEM "UserProject-4.0.dtd"> <!DOCTYPE UserProject SYSTEM "UserProject-4.0.dtd">
<!-- eric4 user project file for project openlp.org 2.0 --> <!-- eric4 user project file for project openlp.org 2.0 -->
<!-- Saved: 2009-03-02, 23:55:18 --> <!-- Saved: 2009-03-05, 22:27:52 -->
<!-- Copyright (C) 2009 Raoul Snyman, raoulsnyman@openlp.org --> <!-- Copyright (C) 2009 Raoul Snyman, raoulsnyman@openlp.org -->
<UserProject version="4.0"> <UserProject version="4.0">
</UserProject> </UserProject>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Tasks SYSTEM "Tasks-4.2.dtd"> <!DOCTYPE Tasks SYSTEM "Tasks-4.2.dtd">
<!-- eric4 tasks file for project openlp.org 2.0 --> <!-- eric4 tasks file for project openlp.org 2.0 -->
<!-- Saved: 2009-03-02, 23:55:26 --> <!-- Saved: 2009-03-05, 22:27:54 -->
<Tasks version="4.2"> <Tasks version="4.2">
<Task priority="1" completed="False" bugfix="False"> <Task priority="1" completed="False" bugfix="False">
<Summary>TODO: what is the tags for bridge, pre-chorus?</Summary> <Summary>TODO: what is the tags for bridge, pre-chorus?</Summary>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Project SYSTEM "Project-4.6.dtd"> <!DOCTYPE Project SYSTEM "Project-4.6.dtd">
<!-- eric4 project file for project openlp.org 2.0 --> <!-- eric4 project file for project openlp.org 2.0 -->
<!-- Saved: 2009-03-02, 23:55:18 --> <!-- Saved: 2009-03-05, 22:27:52 -->
<!-- Copyright (C) 2009 Raoul Snyman, raoulsnyman@openlp.org --> <!-- Copyright (C) 2009 Raoul Snyman, raoulsnyman@openlp.org -->
<Project version="4.6"> <Project version="4.6">
<Language>en</Language> <Language>en</Language>
@ -118,7 +118,6 @@
<Source>openlp/core/lib/serviceitem.py</Source> <Source>openlp/core/lib/serviceitem.py</Source>
<Source>openlp/core/ui/slidecontroller.py</Source> <Source>openlp/core/ui/slidecontroller.py</Source>
<Source>openlp/core/lib/eventreceiver.py</Source> <Source>openlp/core/lib/eventreceiver.py</Source>
<Source>openlp/core/lib/imageserviceitem.py</Source>
<Source>resources/forms/Ui_editsongdialog.py</Source> <Source>resources/forms/Ui_editsongdialog.py</Source>
<Source>openlp/core/ui/servicemanager.py</Source> <Source>openlp/core/ui/servicemanager.py</Source>
<Source>openlp/core/lib/toolbar.py</Source> <Source>openlp/core/lib/toolbar.py</Source>
@ -134,6 +133,9 @@
<Source>openlp/plugins/videos/lib/__init__.py</Source> <Source>openlp/plugins/videos/lib/__init__.py</Source>
<Source>openlp/plugins/videos/lib/videotab.py</Source> <Source>openlp/plugins/videos/lib/videotab.py</Source>
<Source>openlp/plugins/bibles/lib/biblemediaitem.py</Source> <Source>openlp/plugins/bibles/lib/biblemediaitem.py</Source>
<Source>openlp/plugins/images/imageserviceitem.py</Source>
<Source>openlp/plugins/images/listwithpreviews.py</Source>
<Source>openlp/core/ui/test/test_service_manager.py</Source>
</Sources> </Sources>
<Forms> <Forms>
<Form>resources/forms/openlpexportform.ui</Form> <Form>resources/forms/openlpexportform.ui</Form>

View File

@ -38,8 +38,9 @@ class OpenLP(QtGui.QApplication):
def run(self): def run(self):
#provide a listener for widgets to reqest a screen update. #provide a listener for widgets to reqest a screen update.
QtCore.QObject.connect(Receiver().get_receiver(),QtCore.SIGNAL("openlpprocessevents"),self.processEvents) QtCore.QObject.connect(Receiver().get_receiver(),
QtCore.SIGNAL('openlpprocessevents'),self.processEvents)
self.setApplicationName('openlp.org') self.setApplicationName('openlp.org')
self.setApplicationVersion('1.9.0') self.setApplicationVersion('1.9.0')
self.splash = SplashScreen() self.splash = SplashScreen()

View File

@ -30,6 +30,8 @@ class AlertsTab(SettingsTab):
AlertsTab is the alerts settings tab in the settings dialog. AlertsTab is the alerts settings tab in the settings dialog.
""" """
def __init__(self): def __init__(self):
self.font_color = '#ffffff'
self.bg_color = '#660000'
SettingsTab.__init__(self, u'Alerts') SettingsTab.__init__(self, u'Alerts')
def setupUi(self): def setupUi(self):
@ -65,54 +67,36 @@ class AlertsTab(SettingsTab):
self.FontColorLabel = QtGui.QLabel(self.ColorWidget) self.FontColorLabel = QtGui.QLabel(self.ColorWidget)
self.FontColorLabel.setObjectName(u'FontColorLabel') self.FontColorLabel.setObjectName(u'FontColorLabel')
self.ColorLayout.addWidget(self.FontColorLabel) self.ColorLayout.addWidget(self.FontColorLabel)
self.FontColorButton = QtGui.QPushButton(self.ColorWidget)
self.FontColourButton = QtGui.QPushButton(self.ColorWidget) self.FontColorButton.setObjectName("FontColorButton")
self.FontColourButton.setObjectName("FontColourButton") self.ColorLayout.addWidget(self.FontColorButton)
self.ColorLayout.addWidget(self.FontColourButton)
# self.FontColorPanel = QtGui.QGraphicsView(self.ColorWidget)
# self.FontColorPanel.setMinimumSize(QtCore.QSize(24, 24))
# self.FontColorPanel.setMaximumSize(QtCore.QSize(24, 24))
# self.FontColorPanel.setObjectName(u'FontColorPanel')
# self.ColorLayout.addWidget(self.FontColorPanel)
self.ColorSpacerItem = QtGui.QSpacerItem(40, 20, self.ColorSpacerItem = QtGui.QSpacerItem(40, 20,
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.ColorLayout.addItem(self.ColorSpacerItem) self.ColorLayout.addItem(self.ColorSpacerItem)
self.BackgroundColorLabel = QtGui.QLabel(self.ColorWidget) self.BackgroundColorLabel = QtGui.QLabel(self.ColorWidget)
self.BackgroundColorLabel.setObjectName(u'BackgroundColorLabel') self.BackgroundColorLabel.setObjectName(u'BackgroundColorLabel')
self.ColorLayout.addWidget(self.BackgroundColorLabel) self.ColorLayout.addWidget(self.BackgroundColorLabel)
self.BackgroundColorButton = QtGui.QPushButton(self.ColorWidget)
self.BackgroundColourButton = QtGui.QPushButton(self.ColorWidget) self.BackgroundColorButton.setObjectName("BackgroundColorButton")
self.BackgroundColourButton.setObjectName("BackgroundColourButton") self.ColorLayout.addWidget(self.BackgroundColorButton)
self.ColorLayout.addWidget(self.BackgroundColourButton)
# self.BackgroundColorPanel = QtGui.QGraphicsView(self.ColorWidget)
# self.BackgroundColorPanel.setMinimumSize(QtCore.QSize(24, 24))
# self.BackgroundColorPanel.setMaximumSize(QtCore.QSize(24, 24))
# self.BackgroundColorPanel.setObjectName(u'BackgroundColorPanel')
# self.ColorLayout.addWidget(self.BackgroundColorPanel)
self.FontLayout.addWidget(self.ColorWidget) self.FontLayout.addWidget(self.ColorWidget)
self.LengthWidget = QtGui.QWidget(self.FontGroupBox) self.TimeoutWidget = QtGui.QWidget(self.FontGroupBox)
self.LengthWidget.setObjectName(u'LengthWidget') self.TimeoutWidget.setObjectName(u'TimeoutWidget')
self.LengthLayout = QtGui.QHBoxLayout(self.LengthWidget) self.TimeoutLayout = QtGui.QHBoxLayout(self.TimeoutWidget)
self.LengthLayout.setSpacing(8) self.TimeoutLayout.setSpacing(8)
self.LengthLayout.setMargin(0) self.TimeoutLayout.setMargin(0)
self.LengthLayout.setObjectName(u'LengthLayout') self.TimeoutLayout.setObjectName(u'TimeoutLayout')
self.LengthLabel = QtGui.QLabel(self.LengthWidget) self.TimeoutLabel = QtGui.QLabel(self.TimeoutWidget)
self.LengthLabel.setObjectName(u'LengthLabel') self.TimeoutLabel.setObjectName(u'TimeoutLabel')
self.LengthLayout.addWidget(self.LengthLabel) self.TimeoutLayout.addWidget(self.TimeoutLabel)
self.LengthSpinBox = QtGui.QSpinBox(self.LengthWidget) self.TimeoutSpinBox = QtGui.QSpinBox(self.TimeoutWidget)
self.LengthSpinBox.setMaximum(180) self.TimeoutSpinBox.setMaximum(180)
#self.LengthSpinBox.setProperty(u'value', QtCore.QVariant(5)) self.TimeoutSpinBox.setObjectName(u'TimeoutSpinBox')
self.LengthSpinBox.setObjectName(u'LengthSpinBox') self.TimeoutLayout.addWidget(self.TimeoutSpinBox)
self.LengthLayout.addWidget(self.LengthSpinBox) self.TimeoutSpacer = QtGui.QSpacerItem(147, 20,
self.LengthSpacer = QtGui.QSpacerItem(147, 20,
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.LengthLayout.addItem(self.LengthSpacer) self.TimeoutLayout.addItem(self.TimeoutSpacer)
self.FontLayout.addWidget(self.LengthWidget) self.FontLayout.addWidget(self.TimeoutWidget)
self.SlideLeftLayout.addWidget(self.FontGroupBox) self.SlideLeftLayout.addWidget(self.FontGroupBox)
self.SlideLeftSpacer = QtGui.QSpacerItem(20, 94, self.SlideLeftSpacer = QtGui.QSpacerItem(20, 94,
QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
@ -135,85 +119,83 @@ class AlertsTab(SettingsTab):
self.PreviewLayout.setSpacing(8) self.PreviewLayout.setSpacing(8)
self.PreviewLayout.setMargin(8) self.PreviewLayout.setMargin(8)
self.PreviewLayout.setObjectName(u'PreviewLayout') self.PreviewLayout.setObjectName(u'PreviewLayout')
self.FontPreview = QtGui.QLineEdit(self.PreviewGroupBox)
#self.FontPreview = QtGui.QGraphicsView(self.PreviewGroupBox) self.FontPreview.setMinimumSize(QtCore.QSize(280, 100))
self.FontPreview = QtGui.QTextEdit(self.PreviewGroupBox) self.FontPreview.setReadOnly(True)
self.FontPreview.setMaximumSize(QtCore.QSize(16777215, 64)) self.FontPreview.setFocusPolicy(QtCore.Qt.NoFocus)
self.FontPreview.setAlignment(QtCore.Qt.AlignHCenter|QtCore.Qt.AlignVCenter)
self.FontPreview.setObjectName(u'FontPreview') self.FontPreview.setObjectName(u'FontPreview')
self.PreviewLayout.addWidget(self.FontPreview) self.PreviewLayout.addWidget(self.FontPreview)
self.SlideRightLayout.addWidget(self.PreviewGroupBox) self.SlideRightLayout.addWidget(self.PreviewGroupBox)
self.SlideRightSpacer = QtGui.QSpacerItem(20, 40, self.SlideRightSpacer = QtGui.QSpacerItem(20, 40,
QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
self.SlideRightLayout.addItem(self.SlideRightSpacer) self.SlideRightLayout.addItem(self.SlideRightSpacer)
self.AlertsLayout.addWidget(self.AlertRightColumn) self.AlertsLayout.addWidget(self.AlertRightColumn)
# Signals and slots
QtCore.QObject.connect(self.BackgroundColourButton, \ QtCore.QObject.connect(self.BackgroundColorButton,
QtCore.SIGNAL("pressed()"), self.onBackgroundColourButtonclicked) QtCore.SIGNAL("pressed()"), self.onBackgroundColorButtonClicked)
QtCore.QObject.connect(self.FontColourButton, \ QtCore.QObject.connect(self.FontColorButton,
QtCore.SIGNAL("pressed()"), self.onFontColourButtonclicked) QtCore.SIGNAL("pressed()"), self.onFontColorButtonClicked)
QtCore.QObject.connect(self.FontComboBox,\ QtCore.QObject.connect(self.FontComboBox,
QtCore.SIGNAL("activated(int)"), self.onFontComboBoxclicked) QtCore.SIGNAL("activated(int)"), self.onFontComboBoxClicked)
QtCore.QObject.connect(self.LengthSpinBox,\ QtCore.QObject.connect(self.TimeoutSpinBox,
QtCore.SIGNAL("valueChanged(int)"), self.onLengthSpinBoxchanged) QtCore.SIGNAL("valueChanged(int)"), self.onTimeoutSpinBoxChanged)
def retranslateUi(self): def retranslateUi(self):
self.FontGroupBox.setTitle(translate(u'AlertsTab', u'Font')) self.FontGroupBox.setTitle(translate(u'AlertsTab', u'Font'))
self.FontLabel.setText(translate(u'AlertsTab', u'Font Name:')) self.FontLabel.setText(translate(u'AlertsTab', u'Font Name:'))
self.FontColorLabel.setText(translate(u'AlertsTab', u'Font Color:')) self.FontColorLabel.setText(translate(u'AlertsTab', u'Font Color:'))
self.BackgroundColorLabel.setText(translate(u'AlertsTab', u'Background Color:')) self.BackgroundColorLabel.setText(translate(u'AlertsTab', u'Background Color:'))
self.LengthLabel.setText(translate(u'AlertsTab', u'Display length:')) self.TimeoutLabel.setText(translate(u'AlertsTab', u'Alert timeout:'))
self.LengthSpinBox.setSuffix(translate(u'AlertsTab', u's')) self.TimeoutSpinBox.setSuffix(translate(u'AlertsTab', u's'))
self.PreviewGroupBox.setTitle(translate(u'AlertsTab', u'Preview')) self.PreviewGroupBox.setTitle(translate(u'AlertsTab', u'Preview'))
self.FontPreview.setText(translate(u'AlertsTab', 'openlp.org 2.0 rocks!'))
def onBackgroundColourButtonclicked(self):
self.bg_color = QtGui.QColorDialog.getColor(QColor(self.bg_color), self).name()
self.BackgroundColourButton.setStyleSheet('background-color: %s' % self.bg_color)
self._update_display()
def onFontComboBoxclicked(self): def onBackgroundColorButtonClicked(self):
self._update_display() self.bg_color = QtGui.QColorDialog.getColor(
QColor(self.bg_color), self).name()
self.BackgroundColorButton.setStyleSheet(
'background-color: %s' % self.bg_color)
self.updateDisplay()
def onFontColourButtonclicked(self): def onFontComboBoxClicked(self):
self.font_color = QtGui.QColorDialog.getColor(QColor(self.font_color), self).name() self.updateDisplay()
self.FontColourButton.setStyleSheet('background-color: %s' % self.font_color)
self._update_display()
def onLengthSpinBoxchanged(self): def onFontColorButtonClicked(self):
self.spin_length = self.LengthSpinBox.value() self.font_color = QtGui.QColorDialog.getColor(
QColor(self.font_color), self).name()
self.FontColorButton.setStyleSheet(
'background-color: %s' % self.font_color)
self.updateDisplay()
def onTimeoutSpinBoxChanged(self):
self.timeout = self.TimeoutSpinBox.value()
def load(self): def load(self):
self.spin_length = self.config.get_config("spin length",u"5" ) self.timeout = int(self.config.get_config('timeout', 5))
self.LengthSpinBox.setValue(int(self.spin_length)) self.font_color = str(self.config.get_config('font color', u'#ffffff'))
self.font_color = self.config.get_config("font color",u"#ffffff" ) self.bg_color = str(self.config.get_config('background color', u'#660000'))
self.FontColourButton.setStyleSheet('background-color: %s' % self.font_color) self.font_face = str(self.config.get_config('font face', QFont().family()))
self.bg_color = self.config.get_config("background color",u"#00007f" ) self.TimeoutSpinBox.setValue(self.timeout)
self.BackgroundColourButton.setStyleSheet('background-color: %s' % self.bg_color) self.FontColorButton.setStyleSheet('background-color: %s' % self.font_color)
self.font_text = self.config.get_config("text font",u"Century Schoolbook L,12,-1,5,50,0,0,0,0,0" ) self.BackgroundColorButton.setStyleSheet('background-color: %s' % self.bg_color)
font = QFont() font = QtGui.QFont()
font.fromString(self.font_text) font.setFamily(self.font_face)
self.FontComboBox.setCurrentFont(font) self.FontComboBox.setCurrentFont(font)
self.FontPreview.setReadOnly(True) self.updateDisplay()
self.FontPreview.setText("Openlp-2 is cool")
self._update_display()
def save(self): def save(self):
self.config.set_config("background color", str(self.bg_color)) self.font_face = self.FontComboBox.currentFont().family()
self.config.set_config("font color", str(self.font_color)) self.config.set_config('background color', str(self.bg_color))
font = self.FontComboBox.currentFont().toString() self.config.set_config('font color', str(self.font_color))
self.config.set_config("text font", str(font)) self.config.set_config('font face', str(self.font_face))
self.config.set_config("spin length", str(self.spin_length)) self.config.set_config('timeout', str(self.timeout))
def updateDisplay(self):
def _update_display(self): font = QFont()
font =self.FontComboBox.currentFont() font.setFamily(self.FontComboBox.currentFont().family())
font.setBold(True) font.setBold(True)
font.setPointSize(20) font.setPointSize(16)
self.FontPreview.setFont(font) self.FontPreview.setFont(font)
self.FontPreview.setStyleSheet("alignment : centre; background-color: "+ self.bg_color+ "; color: " + self.font_color) self.FontPreview.setStyleSheet(
'background-color: %s; color: %s' % (self.bg_color, self.font_color))
def load(self):
pass
def save(self):
pass

View File

@ -34,7 +34,6 @@ class SettingsForm(QtGui.QDialog, Ui_SettingsDialog):
def __init__(self, parent=None): def __init__(self, parent=None):
QtGui.QDialog.__init__(self, parent) QtGui.QDialog.__init__(self, parent)
self.setupUi(self) self.setupUi(self)
self.tab_list = []
# General tab # General tab
self.GeneralTab = GeneralTab() self.GeneralTab = GeneralTab()
self.addTab(self.GeneralTab) self.addTab(self.GeneralTab)
@ -48,12 +47,8 @@ class SettingsForm(QtGui.QDialog, Ui_SettingsDialog):
def addTab(self, tab): def addTab(self, tab):
log.info(u'Inserting %s' % tab.title()) log.info(u'Inserting %s' % tab.title())
self.SettingsTabWidget.addTab(tab, tab.title()) self.SettingsTabWidget.addTab(tab, tab.title())
self.tab_list.append(tab)
def accept(self): def accept(self):
for plugin in self.tab_list: for tab_index in range(0, self.SettingsTabWidget.count()):
plugin.save() self.SettingsTabWidget.widget(tab_index).save()
return QtGui.QDialog.accept(self)
# def reject(self):
# self.close()