openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #00570
[Merge] lp:~trb143/openlp/bitsandbobs into lp:openlp
Tim Bentley has proposed merging lp:~trb143/openlp/bitsandbobs into lp:openlp.
Requested reviews:
OpenLP Core (openlp-core)
Number of changes
- Sort out Tabs for Songs and Bibles
- Hide the display Image if requested
- Rename Alert tab for ALOK
- Update SlideController to Hide on Presentations
- In Single Screen mode let the Display Take over control when Live selected.
--
https://code.launchpad.net/~trb143/openlp/bitsandbobs/+merge/13521
Your team OpenLP Core is subscribed to branch lp:openlp.
=== modified file 'openlp/core/lib/eventreceiver.py'
--- openlp/core/lib/eventreceiver.py 2009-09-29 12:51:38 +0000
+++ openlp/core/lib/eventreceiver.py 2009-10-17 17:15:22 +0000
@@ -83,6 +83,9 @@
``audit_changed``
Audit information may have changed
+
+ ``config_updated``
+ Informs components the config has changed
"""
global log
log = logging.getLogger(u'EventReceiver')
=== modified file 'openlp/core/ui/maindisplay.py'
--- openlp/core/ui/maindisplay.py 2009-09-28 20:45:04 +0000
+++ openlp/core/ui/maindisplay.py 2009-10-17 17:15:22 +0000
@@ -25,9 +25,40 @@
import logging
from PyQt4 import QtCore, QtGui
-from openlp.core.lib import Receiver
-
-class MainDisplay(QtGui.QWidget):
+from openlp.core.lib import Receiver, str_to_bool
+
+class DisplayLabel(QtGui.QWidget):
+ """
+ Customised version of QTableWidget which can respond to keyboard
+ events.
+ """
+ def __init__(self, parent=None, name=None):
+ QQtGui.QWidget.__init__(self, parent)
+ self.parent = parent
+
+ def keyPressEvent(self, event):
+ if type(event) == QtGui.QKeyEvent:
+ #here accept the event and do something
+ if event.key() == QtCore.Qt.Key_Up:
+ Receiver().send_message(u'slidecontroller_previous')
+ event.accept()
+ elif event.key() == QtCore.Qt.Key_Down:
+ Receiver().send_message(u'slidecontroller_next')
+ event.accept()
+ elif event.key() == QtCore.Qt.Key_PageUp:
+ Receiver().send_message(u'slidecontroller_first')
+ event.accept()
+ elif event.key() == QtCore.Qt.Key_PageDown:
+ Receiver().send_message(u'slidecontroller_last')
+ event.accept()
+ elif event.key() == QtCore.Qt.Key_Escape:
+ self.resetDisplay()
+ event.accept()
+ event.ignore()
+ else:
+ event.ignore()
+
+class MainDisplay(DisplayLabel):
"""
This is the form that is used to display things on the projector.
"""
@@ -59,6 +90,7 @@
self.layout.addWidget(self.display)
self.displayBlank = False
self.blankFrame = None
+ self.frame = None
self.alertactive = False
self.alertTab = None
self.timer_id = 0
@@ -66,6 +98,10 @@
QtCore.SIGNAL(u'live_slide_blank'), self.blankDisplay)
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'alert_text'), self.displayAlert)
+ QtCore.QObject.connect(Receiver.get_receiver(),
+ QtCore.SIGNAL(u'presentations_start'), self.hideDisplay)
+ QtCore.QObject.connect(Receiver.get_receiver(),
+ QtCore.SIGNAL(u'presentations_stop'), self.showDisplay)
def setup(self, screenNumber):
"""
@@ -84,21 +120,24 @@
self.setGeometry(screen[u'size'])
if not screen[u'primary']:
self.showFullScreen()
+ self.primary = False
else:
- self.showMinimized()
+ self.setVisible(False)
+ self.primary = True
#Build a custom splash screen
- self.InitialFrame = QtGui.QImage(
- screen[u'size'].width(), screen[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(self.InitialFrame)
- painter_image.fillRect(self.InitialFrame.rect(), QtCore.Qt.white)
- painter_image.drawImage(
- (screen[u'size'].width() - splash_image.width()) / 2,
- (screen[u'size'].height() - splash_image.height()) / 2,
- splash_image)
- self.frameView(self.InitialFrame)
+ if str_to_bool(self.parent.generalConfig.get_config(u'show splash', u'True')):
+ self.InitialFrame = QtGui.QImage(
+ screen[u'size'].width(), screen[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(self.InitialFrame)
+ painter_image.fillRect(self.InitialFrame.rect(), QtCore.Qt.white)
+ painter_image.drawImage(
+ (screen[u'size'].width() - splash_image.width()) / 2,
+ (screen[u'size'].height() - splash_image.height()) / 2,
+ splash_image)
+ self.frameView(self.InitialFrame)
#Build a Black screen
painter = QtGui.QPainter()
self.blankFrame = QtGui.QImage(
@@ -107,6 +146,17 @@
painter.begin(self.blankFrame)
painter.fillRect(self.blankFrame.rect(), QtCore.Qt.black)
+ def resetDisplay(self):
+ if self.primary:
+ self.setVisible(False)
+
+ def hideDisplay(self):
+ self.setVisible(False)
+
+ def showDisplay(self):
+ if not self.primary:
+ self.setVisible(True)
+
def frameView(self, frame):
"""
Called from a slide controller to display a frame
@@ -119,6 +169,9 @@
self.displayAlert()
elif not self.displayBlank:
self.display.setPixmap(QtGui.QPixmap.fromImage(frame))
+ if not self.isVisible():
+ self.setVisible(True)
+ self.showFullScreen()
def blankDisplay(self):
if not self.displayBlank:
@@ -126,7 +179,8 @@
self.display.setPixmap(QtGui.QPixmap.fromImage(self.blankFrame))
else:
self.displayBlank = False
- self.frameView(self.frame)
+ if self.frame is not None:
+ self.frameView(self.frame)
def displayAlert(self, text=u''):
"""
=== modified file 'openlp/core/ui/mainwindow.py'
--- openlp/core/ui/mainwindow.py 2009-10-12 04:43:02 +0000
+++ openlp/core/ui/mainwindow.py 2009-10-17 17:15:22 +0000
@@ -368,7 +368,7 @@
self.action_Preview_Panel.setStatusTip(translate(u'mainWindow',
u'Toggle the visibility of the Preview Panel'))
self.action_Preview_Panel.setShortcut(translate(u'mainWindow', u'F11'))
- self.ToolsAlertItem.setText(translate(u'mainWindow', u'Nursery &Alert'))
+ self.ToolsAlertItem.setText(translate(u'mainWindow', u'&Alert'))
self.ToolsAlertItem.setStatusTip(
translate(u'mainWindow', u'Show an alert message'))
self.ToolsAlertItem.setShortcut(translate(u'mainWindow', u'F7'))
@@ -418,8 +418,8 @@
self.screenList = screens
self.serviceNotSaved = False
self.settingsmanager = SettingsManager(screens)
+ self.generalConfig = PluginConfig(u'General')
self.mainDisplay = MainDisplay(self, screens)
- self.generalConfig = PluginConfig(u'General')
self.alertForm = AlertForm(self)
self.aboutForm = AboutForm(self)
self.settingsForm = SettingsForm(self.screenList, self)
=== modified file 'openlp/core/ui/servicemanager.py'
--- openlp/core/ui/servicemanager.py 2009-10-11 09:31:27 +0000
+++ openlp/core/ui/servicemanager.py 2009-10-17 17:15:22 +0000
@@ -426,8 +426,10 @@
files retrieved from the zip file are placed in a temporary directory
and will only be used for this service.
"""
- filename = QtGui.QFileDialog.getOpenFileName(self, u'Open Service',
- self.config.get_last_dir(), u'Services (*.osz)')
+ filename = QtGui.QFileDialog.getOpenFileName(self,
+ translate(u'ThemeManager', u'Open Service'),
+ self.config.get_last_dir(),
+ u'Services (*.osz)')
filename = unicode(filename)
name = filename.split(os.path.sep)
if filename != u'':
=== modified file 'openlp/core/ui/settingsform.py'
--- openlp/core/ui/settingsform.py 2009-10-11 06:29:25 +0000
+++ openlp/core/ui/settingsform.py 2009-10-17 17:15:22 +0000
@@ -27,6 +27,7 @@
from PyQt4 import QtGui
from openlp.core.ui import GeneralTab, ThemesTab, AlertsTab
+from openlp.core.lib import Receiver
from settingsdialog import Ui_SettingsDialog
log = logging.getLogger(u'SettingsForm')
@@ -64,6 +65,7 @@
def accept(self):
for tab_index in range(0, self.SettingsTabWidget.count()):
self.SettingsTabWidget.widget(tab_index).save()
+ Receiver().send_message(u'config_updated')
return QtGui.QDialog.accept(self)
def postSetUp(self):
=== modified file 'openlp/core/ui/slidecontroller.py'
--- openlp/core/ui/slidecontroller.py 2009-10-03 19:18:59 +0000
+++ openlp/core/ui/slidecontroller.py 2009-10-17 17:15:22 +0000
@@ -195,8 +195,14 @@
Receiver().send_message(u'request_spin_delay')
if isLive:
self.Toolbar.makeWidgetsInvisible(self.image_list)
- else:
- pass
+ QtCore.QObject.connect(Receiver.get_receiver(),
+ QtCore.SIGNAL(u'slidecontroller_first'), self.onSlideSelectedFirst)
+ QtCore.QObject.connect(Receiver.get_receiver(),
+ QtCore.SIGNAL(u'slidecontroller_next'), self.onSlideSelectedNext)
+ QtCore.QObject.connect(Receiver.get_receiver(),
+ QtCore.SIGNAL(u'slidecontroller_previous'), self.onSlideSelectedPrevious)
+ QtCore.QObject.connect(Receiver.get_receiver(),
+ QtCore.SIGNAL(u'slidecontroller_last'), self.onSlideSelectedLast)
def receiveSpinDelay(self, value):
self.DelaySpinBox.setValue(int(value))
@@ -321,7 +327,8 @@
"""
Go to the first slide.
"""
- if self.commandItem.service_item_type == ServiceType.Command:
+ if self.commandItem is not None and \
+ self.commandItem.service_item_type == ServiceType.Command:
Receiver().send_message(u'%s_first'% self.commandItem.name.lower())
else:
self.PreviewListWidget.selectRow(0)
@@ -331,12 +338,13 @@
"""
Blank the screen.
"""
- if self.commandItem.service_item_type == ServiceType.Command:
+ if self.commandItem is not None and \
+ self.commandItem.service_item_type == ServiceType.Command:
if blanked:
Receiver().send_message(u'%s_blank'% self.commandItem.name.lower())
else:
Receiver().send_message(u'%s_unblank'% self.commandItem.name.lower())
- else:
+ else:
self.parent.mainDisplay.blankDisplay()
def onSlideSelected(self):
@@ -347,7 +355,7 @@
row = self.PreviewListWidget.currentRow()
if row > -1 and row < self.PreviewListWidget.rowCount():
if self.commandItem.service_item_type == ServiceType.Command:
- Receiver().send_message(u'%s_slide'% self.commandItem.name.lower(), [row])
+ Receiver().send_message(u'%s_slide'% self.commandItem.name.lower(), [row])
else:
#label = self.PreviewListWidget.cellWidget(row, 0)
frame = self.serviceitem.frames[row][u'image']
@@ -363,7 +371,8 @@
"""
Go to the next slide.
"""
- if self.commandItem.service_item_type == ServiceType.Command:
+ if self.commandItem is not None and \
+ self.commandItem.service_item_type == ServiceType.Command:
Receiver().send_message(u'%s_next'% self.commandItem.name.lower())
else:
row = self.PreviewListWidget.currentRow() + 1
@@ -376,7 +385,8 @@
"""
Go to the previous slide.
"""
- if self.commandItem.service_item_type == ServiceType.Command:
+ if self.commandItem is not None and \
+ self.commandItem.service_item_type == ServiceType.Command:
Receiver().send_message(
u'%s_previous'% self.commandItem.name.lower())
else:
@@ -390,7 +400,8 @@
"""
Go to the last slide.
"""
- if self.commandItem.service_item_type == ServiceType.Command:
+ if self.commandItem is not None and \
+ self.commandItem.service_item_type == ServiceType.Command:
Receiver().send_message(u'%s_last'% self.commandItem.name.lower())
else:
self.PreviewListWidget.selectRow(self.PreviewListWidget.rowCount() - 1)
=== modified file 'openlp/core/ui/thememanager.py'
--- openlp/core/ui/thememanager.py 2009-10-11 06:25:37 +0000
+++ openlp/core/ui/thememanager.py 2009-10-17 17:15:22 +0000
@@ -224,13 +224,14 @@
zip.close()
def onImportTheme(self):
- files = QtGui.QFileDialog.getOpenFileNames(None,
- translate(u'ThemeManager',
- u'Select Theme Import File'),
- self.path, u'Theme (*.*)')
+ files = QtGui.QFileDialog.getOpenFileNames(self,
+ translate(u'ThemeManager', u'Select Theme Import File'),
+ self.config.get_last_dir(),
+ u'Theme (*.*)')
log.info(u'New Themes %s', unicode(files))
if len(files) > 0:
for file in files:
+ self.config.set_last_dir(filename)
self.unzipTheme(file, self.path)
self.loadThemes()
=== modified file 'openlp/plugins/bibles/lib/biblestab.py'
--- openlp/plugins/bibles/lib/biblestab.py 2009-09-25 00:43:42 +0000
+++ openlp/plugins/bibles/lib/biblestab.py 2009-10-17 17:15:22 +0000
@@ -41,7 +41,6 @@
self.paragraph_style = True
self.show_new_chapters = False
self.display_style = 0
- self.bible_search = True
SettingsTab.__init__(
self, translate(u'BiblesTab', u'Bibles'), u'Bibles')
@@ -98,7 +97,6 @@
self.LayoutStyleComboBox.addItem(QtCore.QString())
self.LayoutStyleLayout.addWidget(self.LayoutStyleComboBox)
self.VerseDisplayLayout.addWidget(self.LayoutStyleWidget, 2, 0, 1, 1)
-
self.BibleThemeWidget = QtGui.QWidget(self.VerseDisplayGroupBox)
self.BibleThemeWidget.setObjectName(u'BibleThemeWidget')
self.BibleThemeLayout = QtGui.QHBoxLayout(self.BibleThemeWidget)
@@ -112,10 +110,13 @@
self.BibleThemeComboBox.setObjectName(u'BibleThemeComboBox')
self.BibleThemeComboBox.addItem(QtCore.QString())
self.BibleThemeLayout.addWidget(self.BibleThemeComboBox)
- self.VerseDisplayLayout.addWidget(self.BibleThemeWidget, 3, 0, 1, 1)
+ self.BibleDuelCheckBox = QtGui.QCheckBox(self.VerseDisplayGroupBox)
+ self.BibleDuelCheckBox.setObjectName(u'BibleDuelCheckBox')
+ self.VerseDisplayLayout.addWidget(self.BibleDuelCheckBox, 3, 0, 1, 1)
+ self.VerseDisplayLayout.addWidget(self.BibleThemeWidget, 4, 0, 1, 1)
self.ChangeNoteLabel = QtGui.QLabel(self.VerseDisplayGroupBox)
self.ChangeNoteLabel.setObjectName(u'ChangeNoteLabel')
- self.VerseDisplayLayout.addWidget(self.ChangeNoteLabel, 4, 0, 1, 1)
+ self.VerseDisplayLayout.addWidget(self.ChangeNoteLabel, 5, 0, 1, 1)
self.BibleLeftLayout.addWidget(self.VerseDisplayGroupBox)
self.BibleLeftSpacer = QtGui.QSpacerItem(40, 20,
QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
@@ -127,27 +128,11 @@
self.BibleRightLayout.setObjectName(u'BibleRightLayout')
self.BibleRightLayout.setSpacing(8)
self.BibleRightLayout.setMargin(0)
- self.BibleSearchGroupBox = QtGui.QGroupBox(self)
- self.BibleSearchGroupBox.setObjectName(u'BibleSearchGroupBox')
- self.BibleSearchLayout = QtGui.QVBoxLayout(self.BibleSearchGroupBox)
- self.BibleSearchLayout.setObjectName(u'BibleSearchLayout')
- self.BibleSearchLayout.setSpacing(8)
- self.BibleSearchLayout.setMargin(8)
- self.BibleSearchCheckBox = QtGui.QCheckBox(self.BibleSearchGroupBox)
- self.BibleSearchCheckBox.setObjectName(u'BibleSearchCheckBox')
- self.BibleSearchLayout.addWidget(self.BibleSearchCheckBox)
- self.BibleRightLayout.addWidget(self.BibleSearchGroupBox)
- self.BibleRightSpacer = QtGui.QSpacerItem(40, 20,
- QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
- self.BibleRightLayout.addItem(self.BibleRightSpacer)
self.BibleLayout.addWidget(self.BibleRightWidget)
# Signals and slots
QtCore.QObject.connect(self.NewChaptersCheckBox,
QtCore.SIGNAL(u'stateChanged(int)'),
self.onNewChaptersCheckBoxChanged)
- QtCore.QObject.connect(self.BibleSearchCheckBox,
- QtCore.SIGNAL(u'stateChanged(int)'),
- self.onBibleSearchCheckBoxChanged)
QtCore.QObject.connect(self.DisplayStyleComboBox,
QtCore.SIGNAL(u'activated(int)'),
self.onDisplayStyleComboBoxChanged)
@@ -156,6 +141,9 @@
QtCore.QObject.connect(self.LayoutStyleComboBox,
QtCore.SIGNAL(u'activated(int)'),
self.onLayoutStyleComboBoxChanged)
+ QtCore.QObject.connect(self.BibleDuelCheckBox,
+ QtCore.SIGNAL(u'stateChanged(int)'),
+ self.onBibleDuelCheckBox)
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'update_themes'), self.updateThemeList)
@@ -186,10 +174,8 @@
3, translate(u'SettingsForm', u'[ and ]'))
self.ChangeNoteLabel.setText(translate(u'SettingsForm',
u'Note:\nChanges don\'t affect verses already in the service'))
- self.BibleSearchGroupBox.setTitle(
- translate(u'SettingsForm', u'Search'))
- self.BibleSearchCheckBox.setText(
- translate(u'SettingsForm', u'Search-as-you-type'))
+ self.BibleDuelCheckBox.setText(
+ translate(u'SettingsForm', u'Display Duel Bible Verses'))
def onBibleThemeComboBoxChanged(self):
self.bible_theme = self.BibleThemeComboBox.currentText()
@@ -200,19 +186,17 @@
def onLayoutStyleComboBoxChanged(self):
self.layout_style = self.LayoutStyleComboBox.currentIndex()
- def onNewChaptersCheckBoxChanged(self):
- check_state = self.NewChaptersCheckBox.checkState()
+ def onNewChaptersCheckBoxChanged(self, check_state):
self.show_new_chapters = False
# we have a set value convert to True/False
if check_state == QtCore.Qt.Checked:
self.show_new_chapters = True
- def onBibleSearchCheckBoxChanged(self):
- check_state = self.BibleSearchCheckBox.checkState()
- self.bible_search = False
+ def onBibleDuelCheckBox(self, check_state):
+ self.duel_bibles = False
# we have a set value convert to True/False
if check_state == QtCore.Qt.Checked:
- self.bible_search = True
+ self.duel_bibles = True
def load(self):
self.show_new_chapters = str_to_bool(
@@ -222,12 +206,12 @@
self.layout_style = int(
self.config.get_config(u'verse layout style', u'0'))
self.bible_theme = self.config.get_config(u'bible theme', u'0')
- self.bible_search = str_to_bool(
- self.config.get_config(u'search as type', u'True'))
+ self.duel_bibles = str_to_bool(
+ self.config.get_config(u'duel bibles', u'True'))
self.NewChaptersCheckBox.setChecked(self.show_new_chapters)
self.DisplayStyleComboBox.setCurrentIndex(self.display_style)
self.LayoutStyleComboBox.setCurrentIndex(self.layout_style)
- self.BibleSearchCheckBox.setChecked(self.bible_search)
+ self.BibleDuelCheckBox.setChecked(self.duel_bibles)
def save(self):
self.config.set_config(
@@ -236,7 +220,7 @@
u'display brackets', unicode(self.display_style))
self.config.set_config(
u'verse layout style', unicode(self.layout_style))
- self.config.set_config(u'search as type', unicode(self.bible_search))
+ self.config.set_config(u'duel bibles', unicode(self.duel_bibles))
self.config.set_config(u'bible theme', unicode(self.bible_theme))
def updateThemeList(self, theme_list):
=== modified file 'openlp/plugins/bibles/lib/mediaitem.py'
--- openlp/plugins/bibles/lib/mediaitem.py 2009-10-14 16:27:46 +0000
+++ openlp/plugins/bibles/lib/mediaitem.py 2009-10-17 17:15:22 +0000
@@ -28,7 +28,7 @@
from PyQt4 import QtCore, QtGui
from openlp.core.lib import translate, MediaManagerItem, Receiver, \
- BaseListWithDnD
+ BaseListWithDnD, str_to_bool
from openlp.plugins.bibles.forms import BibleImportForm
from openlp.plugins.bibles.lib.manager import BibleMode
@@ -203,6 +203,17 @@
QtCore.SIGNAL(u'pressed()'), self.onAdvancedSearchButton)
QtCore.QObject.connect(self.QuickSearchButton,
QtCore.SIGNAL(u'pressed()'), self.onQuickSearchButton)
+ QtCore.QObject.connect(Receiver.get_receiver(),
+ QtCore.SIGNAL(u'config_updated'), self.configUpdated)
+
+ def configUpdated(self):
+ if str_to_bool(
+ self.parent.config.get_config(u'duel bibles', u'False')):
+ self.AdvancedSecondBibleComboBox.setVisible(True)
+ self.QuickSecondBibleComboBox.setVisible(True)
+ else:
+ self.AdvancedSecondBibleComboBox.setVisible(False)
+ self.QuickSecondBibleComboBox.setVisible(False)
def retranslateUi(self):
log.debug(u'retranslateUi')
@@ -242,6 +253,7 @@
log.debug(u'bible manager initialise')
self.loadBibles()
self.parent.biblemanager.set_media_manager(self)
+ self.configUpdated()
log.debug(u'bible manager initialise complete')
def setQuickMessage(self, text):
=== modified file 'openlp/plugins/songs/lib/mediaitem.py'
--- openlp/plugins/songs/lib/mediaitem.py 2009-10-08 17:28:59 +0000
+++ openlp/plugins/songs/lib/mediaitem.py 2009-10-17 17:15:22 +0000
@@ -27,7 +27,7 @@
from PyQt4 import QtCore, QtGui
from openlp.core.lib import MediaManagerItem, translate, SongXMLParser, \
- BaseListWithDnD, Receiver
+ BaseListWithDnD, Receiver, str_to_bool
from openlp.plugins.songs.forms import EditSongForm, SongMaintenanceForm
class SongListView(BaseListWithDnD):
@@ -113,6 +113,12 @@
self.onSearchTextEditChanged)
QtCore.QObject.connect(Receiver.get_receiver(),
QtCore.SIGNAL(u'load_song_list'), self.onSearchTextButtonClick)
+ QtCore.QObject.connect(Receiver.get_receiver(),
+ QtCore.SIGNAL(u'config_updated'), self.configUpdated)
+
+ def configUpdated(self):
+ self.searchAsYouType = str_to_bool(
+ self.parent.config.get_config(u'search as type', u'False'))
def retranslateUi(self):
self.SearchTypeLabel.setText(
@@ -126,6 +132,7 @@
self.SearchTypeComboBox.addItem(translate(u'SongMediaItem', u'Titles'))
self.SearchTypeComboBox.addItem(translate(u'SongMediaItem', u'Lyrics'))
self.SearchTypeComboBox.addItem(translate(u'SongMediaItem', u'Authors'))
+ self.configUpdated()
def onSearchTextButtonClick(self):
search_keywords = unicode(self.SearchTextEdit.displayText())
@@ -181,11 +188,12 @@
self.SearchTextEdit.clear()
def onSearchTextEditChanged(self, text):
- search_length = 1
- if self.SearchTypeComboBox.currentIndex() == 1:
- search_length = 7
- if len(text) > search_length:
- self.onSearchTextButtonClick()
+ if self.searchAsYouType:
+ search_length = 1
+ if self.SearchTypeComboBox.currentIndex() == 1:
+ search_length = 7
+ if len(text) > search_length:
+ self.onSearchTextButtonClick()
def onNewClick(self):
self.edit_song_form.newSong()
=== modified file 'openlp/plugins/songs/lib/songstab.py'
--- openlp/plugins/songs/lib/songstab.py 2009-09-25 00:43:42 +0000
+++ openlp/plugins/songs/lib/songstab.py 2009-10-17 17:15:22 +0000
@@ -22,14 +22,51 @@
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
###############################################################################
-from openlp.core.lib import SettingsTab, translate
+from PyQt4 import QtCore, QtGui
+
+from openlp.core.lib import SettingsTab, str_to_bool, translate
class SongsTab(SettingsTab):
"""
- SongsTab is the songs settings tab in the settings dialog.
+ SongsTab is the Songs settings tab in the settings dialog.
"""
def __init__(self):
SettingsTab.__init__(self, translate(u'SongsTab', u'Songs'), u'Songs')
def setupUi(self):
self.setObjectName(u'SongsTab')
+ self.SongsLayout = QtGui.QFormLayout(self)
+ self.SongsLayout.setObjectName(u'SongsLayout')
+ self.SongsModeGroupBox = QtGui.QGroupBox(self)
+ self.SongsModeGroupBox.setObjectName(u'SongsModeGroupBox')
+ self.SongsModeLayout = QtGui.QVBoxLayout(self.SongsModeGroupBox)
+ self.SongsModeLayout.setSpacing(8)
+ self.SongsModeLayout.setMargin(8)
+ self.SongsModeLayout.setObjectName(u'SongsModeLayout')
+ self.SearchAsTypeCheckBox = QtGui.QCheckBox(self.SongsModeGroupBox)
+ self.SearchAsTypeCheckBox.setObjectName(u'SearchAsTypeCheckBox')
+ self.SongsModeLayout.addWidget(self.SearchAsTypeCheckBox)
+ self.SongsLayout.setWidget(
+ 0, QtGui.QFormLayout.LabelRole, self.SongsModeGroupBox)
+ QtCore.QObject.connect(self.SearchAsTypeCheckBox,
+ QtCore.SIGNAL(u'stateChanged(int)'),
+ self.onSearchAsTypeCheckBoxChanged)
+
+ def retranslateUi(self):
+ self.SongsModeGroupBox.setTitle(translate(u'SongsTab', u'Songs Mode'))
+ self.SearchAsTypeCheckBox.setText(
+ translate(u'SongsTab', u'Enable search as you type:'))
+
+ def onSearchAsTypeCheckBoxChanged(self, check_state):
+ self.bible_search = False
+ # we have a set value convert to True/False
+ if check_state == QtCore.Qt.Checked:
+ self.bible_search = True
+
+ def load(self):
+ self.bible_search = str_to_bool(
+ self.config.get_config(u'search as type', u'False'))
+ self.SearchAsTypeCheckBox.setChecked(self.bible_search)
+
+ def save(self):
+ self.config.set_config(u'search as type', unicode(self.bible_search))
=== modified file 'openlp/plugins/songs/songsplugin.py'
--- openlp/plugins/songs/songsplugin.py 2009-10-09 22:38:21 +0000
+++ openlp/plugins/songs/songsplugin.py 2009-10-17 17:15:22 +0000
@@ -27,7 +27,7 @@
from PyQt4 import QtCore, QtGui
from openlp.core.lib import Plugin, translate, buildIcon
-from openlp.plugins.songs.lib import SongManager, SongMediaItem
+from openlp.plugins.songs.lib import SongManager, SongMediaItem, SongsTab
from openlp.plugins.songs.forms import OpenLPImportForm, OpenSongExportForm, \
OpenSongImportForm, OpenLPExportForm
@@ -62,6 +62,9 @@
def can_be_disabled(self):
return True
+ def get_settings_tab(self):
+ return SongsTab()
+
def initialise(self):
log.info(u'Songs Initialising')
#if self.songmanager is None:
Follow ups