More Fixes and clean ups

bzr-revno: 358
This commit is contained in:
Tim Bentley 2009-03-02 22:35:32 +00:00
parent 86115ec964
commit 2faca83bd9
3 changed files with 256 additions and 252 deletions

View File

@ -19,6 +19,7 @@ Place, Suite 330, Boston, MA 02111-1307 USA
"""
from PyQt4 import QtCore, QtGui
from PyQt4.QtGui import QColor
from openlp.core import translate
from openlp.core.lib import SettingsTab
@ -30,6 +31,7 @@ class AlertsTab(SettingsTab):
"""
def __init__(self):
SettingsTab.__init__(self, u'Alerts')
self.load()
def setupUi(self):
self.setObjectName(u'AlertsTab')
@ -64,22 +66,35 @@ class AlertsTab(SettingsTab):
self.FontColorLabel = QtGui.QLabel(self.ColorWidget)
self.FontColorLabel.setObjectName(u'FontColorLabel')
self.ColorLayout.addWidget(self.FontColorLabel)
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.FontColourButton = QtGui.QPushButton(self.ColorWidget)
self.FontColourButton.setObjectName("FontColourButton")
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,
QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.ColorLayout.addItem(self.ColorSpacerItem)
self.BackgroundColorLabel = QtGui.QLabel(self.ColorWidget)
self.BackgroundColorLabel.setObjectName(u'BackgroundColorLabel')
self.ColorLayout.addWidget(self.BackgroundColorLabel)
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.BackgroundColourButton = QtGui.QPushButton(self.ColorWidget)
self.BackgroundColourButton.setObjectName("BackgroundColourButton")
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.LengthWidget = QtGui.QWidget(self.FontGroupBox)
self.LengthWidget.setObjectName(u'LengthWidget')
@ -131,7 +146,8 @@ class AlertsTab(SettingsTab):
self.SlideRightLayout.addItem(self.SlideRightSpacer)
self.AlertsLayout.addWidget(self.AlertRightColumn)
QtCore.QObject.connect(self.BackgroundColorPanel, QtCore.SIGNAL("pressed()"), self.onBackgroundColorPanelclicked)
QtCore.QObject.connect(self.BackgroundColourButton, QtCore.SIGNAL("pressed()"), self.onBackgroundColourButtonclicked)
QtCore.QObject.connect(self.FontColourButton, QtCore.SIGNAL("pressed()"), self.onFontColourButtonclicked)
def retranslateUi(self):
self.FontGroupBox.setTitle(translate(u'AlertsTab', u'Font'))
@ -142,5 +158,18 @@ class AlertsTab(SettingsTab):
self.LengthSpinBox.setSuffix(translate(u'AlertsTab', u's'))
self.PreviewGroupBox.setTitle(translate(u'AlertsTab', u'Preview'))
def onBackgroundColorPanelclicked(self):
def onBackgroundColourButtonclicked(self):
print "pressed background"
def onFontColourButtonclicked(self):
print "pressed font"
old_name = 0
colour = QtGui.QColorDialog.getColor(QColor(old_name), self).name()
print colour
self.FontColourButton.setStyleSheet('background-color: %s' % colour)
def load(self):
pass
def save(self):
pass

View File

@ -30,6 +30,7 @@ class BiblesTab(SettingsTab):
"""
def __init__(self):
SettingsTab.__init__(self, u'Bibles')
self.load()
def setupUi(self):
self.setObjectName(u'BiblesTab')
@ -128,28 +129,25 @@ class BiblesTab(SettingsTab):
self.BibleSearchCheckBox.setText(translate("SettingsForm", "Search-as-you-type"))
def load(self):
bible_output_style = self.config.get_config("bible_output_style", "Paragraph")
if bible_output_style == "Paragraph":
self.ParagraphRadioButton.setChecked()
bible_output_style = self.config.get_config("output style", "P")
if bible_output_style == "P":
self.ParagraphRadioButton.setChecked(True)
self.paragraph_format = True
else:
self.VerseRadioButton.setChecked()
# self.SettingsOutputStyleComboBox.setCurrentIndex(int(self.config.get_config("bible_output_style", 0)))
# self.SettingsVerseStyleComboBox.setCurrentIndex(int(self.config.get_config("bible_verse_style", 0)))
# try:
# self.SettingsNewChapterCheck.setCheckState(int(self.config.get_config("bible_new_chapter", 0)))
#except:
# pass
self.VerseRadioButton.setChecked(True)
self.paragraph_format = False
display_new_chapters = self.config.get_config("display new chapters", "0")
#self.NewChaptersCheckBox.setState(display_new_chapters)
if display_new_chapters == 0:
self.display_new_chapters = True
def save(self):
print "VRB =- ", self.VerseRadioButton.isChecked()
print "PRB =- ", self.ParagraphRadioButton.isChecked()
if self.ParagraphRadioButton.isChecked():
self.config.set_config("bible_output_style", "Paragraph")
self.config.set_config("output style", "P")
else:
self.config.set_config("bible_output_style", "Verse")
print "NCCB =- ", self.NewChaptersCheckBox.checkState()
print "DSCB =- ", self.DisplayStyleComboBox.currentIndex()
print "BSCB =- ",self.BibleSearchCheckBox.checkState()
#self.config.set_config("bible_output_style", str(self.SettingsOutputStyleComboBox.currentIndex()))
#self.config.set_config("bible_verse_style", str(self.SettingsVerseStyleComboBox.currentIndex()))
#self.config.set_config("bible_new_chapter", str(self.SettingsNewChapterCheck.checkState()))
self.config.set_config("output style", "V")
self.config.set_config("display new chapter", str(self.NewChaptersCheckBox.checkState()))
self.config.set_config("display brackets", str(self.DisplayStyleComboBox.currentIndex()))
self.config.set_config("search as type", str(self.BibleSearchCheckBox.checkState()))

View File

@ -1,3 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>SettingsDialog</class>
<widget class="QDialog" name="SettingsDialog">
@ -26,7 +27,7 @@
<item>
<widget class="QTabWidget" name="SettingsTabWidget">
<property name="currentIndex">
<number>0</number>
<number>2</number>
</property>
<widget class="QWidget" name="GeneralTab">
<attribute name="title">
@ -40,7 +41,7 @@
<number>8</number>
</property>
<item>
<widget class="QWidget" native="1" name="GeneralLeftWidget" >
<widget class="QWidget" name="GeneralLeftWidget" native="true">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QGroupBox" name="MonitorGroupBox">
@ -133,7 +134,7 @@
</widget>
</item>
<item>
<widget class="QWidget" native="1" name="GeneralRightWidget" >
<widget class="QWidget" name="GeneralRightWidget" native="true">
<layout class="QVBoxLayout" name="GeneralRightLayout">
<property name="spacing">
<number>8</number>
@ -313,12 +314,12 @@
</item>
<item row="2" column="0">
<widget class="QRadioButton" name="GlobalLevelRadioButton">
<property name="text" >
<string>Global level</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="text">
<string>Global level</string>
</property>
</widget>
</item>
<item row="2" column="1">
@ -348,7 +349,7 @@
<number>8</number>
</property>
<item>
<widget class="QWidget" native="1" name="AlertLeftColumn" >
<widget class="QWidget" name="AlertLeftColumn" native="true">
<layout class="QVBoxLayout" name="SlideLeftLayout">
<property name="spacing">
<number>8</number>
@ -379,14 +380,8 @@
<widget class="QFontComboBox" name="FontComboBox"/>
</item>
<item>
<widget class="QWidget" native="1" name="ColorWidget" >
<layout class="QHBoxLayout" name="ColorLayout" >
<property name="spacing" >
<number>8</number>
</property>
<property name="margin" >
<number>0</number>
</property>
<widget class="QWidget" name="ColorWidget" native="true">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="FontColorLabel">
<property name="text">
@ -395,18 +390,9 @@
</widget>
</item>
<item>
<widget class="QGraphicsView" name="FontColorPanel" >
<property name="minimumSize" >
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="maximumSize" >
<size>
<width>24</width>
<height>24</height>
</size>
<widget class="QPushButton" name="FontColourButton">
<property name="text">
<string/>
</property>
</widget>
</item>
@ -431,18 +417,9 @@
</widget>
</item>
<item>
<widget class="QGraphicsView" name="BackgroundColorPanel" >
<property name="minimumSize" >
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="maximumSize" >
<size>
<width>24</width>
<height>24</height>
</size>
<widget class="QPushButton" name="BackgroundColourButton">
<property name="text">
<string/>
</property>
</widget>
</item>
@ -450,7 +427,7 @@
</widget>
</item>
<item>
<widget class="QWidget" native="1" name="LengthWidget" >
<widget class="QWidget" name="LengthWidget" native="true">
<layout class="QHBoxLayout" name="LengthLayout">
<property name="spacing">
<number>8</number>
@ -467,15 +444,15 @@
</item>
<item>
<widget class="QSpinBox" name="LengthSpinBox">
<property name="value">
<number>5</number>
</property>
<property name="suffix">
<string>s</string>
</property>
<property name="maximum">
<number>180</number>
</property>
<property name="value" >
<number>5</number>
</property>
</widget>
</item>
<item>
@ -514,7 +491,7 @@
</widget>
</item>
<item>
<widget class="QWidget" native="1" name="SlideRightColumn" >
<widget class="QWidget" name="SlideRightColumn" native="true">
<layout class="QVBoxLayout" name="SlideRightLayout">
<property name="spacing">
<number>8</number>
@ -525,7 +502,7 @@
<item>
<widget class="QGroupBox" name="PreviewGroupBox">
<property name="sizePolicy">
<sizepolicy vsizetype="Minimum" hsizetype="Minimum" >
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@ -576,7 +553,7 @@
<item>
<widget class="QDialogButtonBox" name="ButtonsBox">
<property name="sizePolicy">
<sizepolicy vsizetype="Minimum" hsizetype="Expanding" >
<sizepolicy hsizetype="Expanding" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>