Add Song Tab option to remove them

This commit is contained in:
Tim Bentley 2009-10-26 06:30:08 +00:00
parent 19e27dbc95
commit 4833f7cd0b
2 changed files with 32 additions and 13 deletions

View File

@ -26,7 +26,7 @@ import logging
import time import time
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from openlp.core.lib import OpenLPToolbar, Receiver, ServiceType from openlp.core.lib import OpenLPToolbar, Receiver, ServiceType, str_to_bool, PluginConfig
class SlideList(QtGui.QTableWidget): class SlideList(QtGui.QTableWidget):
""" """
@ -72,6 +72,7 @@ class SlideController(QtGui.QWidget):
self.settingsmanager = settingsmanager self.settingsmanager = settingsmanager
self.isLive = isLive self.isLive = isLive
self.parent = parent self.parent = parent
self.songsconfig = PluginConfig(u'Songs')
self.image_list = [ self.image_list = [
u'Start Loop', u'Start Loop',
u'Stop Loop', u'Stop Loop',
@ -244,9 +245,9 @@ class SlideController(QtGui.QWidget):
def onSongBarHandler(self): def onSongBarHandler(self):
request = self.sender().text() request = self.sender().text()
if request == u'B': if request == u'Bridge':
pass pass
elif request == u'C': elif request == u'Chorus':
pass pass
else: else:
#Remember list is 1 out! #Remember list is 1 out!
@ -276,6 +277,11 @@ class SlideController(QtGui.QWidget):
""" """
if item.service_item_type == ServiceType.Text: if item.service_item_type == ServiceType.Text:
self.Toolbar.makeWidgetsInvisible(self.image_list) self.Toolbar.makeWidgetsInvisible(self.image_list)
if item.name == u'Songs' and \
str_to_bool(self.songsconfig.get_config(u'display songbar', True)):
self.Songbar.setVisible(True)
else:
self.Songbar.setVisible(False)
elif item.service_item_type == ServiceType.Image: elif item.service_item_type == ServiceType.Image:
#Not sensible to allow loops with 1 frame #Not sensible to allow loops with 1 frame
if len(item.frames) > 1: if len(item.frames) > 1:
@ -378,10 +384,6 @@ class SlideController(QtGui.QWidget):
self.PreviewListWidget.selectRow(self.PreviewListWidget.rowCount()) self.PreviewListWidget.selectRow(self.PreviewListWidget.rowCount())
else: else:
self.PreviewListWidget.selectRow(slideno) self.PreviewListWidget.selectRow(slideno)
if self.isLive:
self.Songbar.setVisible(False)
if self.serviceitem.name == u'Songs':
self.Songbar.setVisible(True)
self.onSlideSelected() self.onSlideSelected()
self.PreviewListWidget.setFocus() self.PreviewListWidget.setFocus()
log.info(u'Display Rendering took %4s' % (time.time() - before)) log.info(u'Display Rendering took %4s' % (time.time() - before))

View File

@ -46,26 +46,43 @@ class SongsTab(SettingsTab):
self.SearchAsTypeCheckBox = QtGui.QCheckBox(self.SongsModeGroupBox) self.SearchAsTypeCheckBox = QtGui.QCheckBox(self.SongsModeGroupBox)
self.SearchAsTypeCheckBox.setObjectName(u'SearchAsTypeCheckBox') self.SearchAsTypeCheckBox.setObjectName(u'SearchAsTypeCheckBox')
self.SongsModeLayout.addWidget(self.SearchAsTypeCheckBox) self.SongsModeLayout.addWidget(self.SearchAsTypeCheckBox)
self.SongBarActiveCheckBox = QtGui.QCheckBox(self.SongsModeGroupBox)
self.SongBarActiveCheckBox.setObjectName(u'SearchAsTypeCheckBox')
self.SongsModeLayout.addWidget(self.SongBarActiveCheckBox)
self.SongsLayout.setWidget( self.SongsLayout.setWidget(
0, QtGui.QFormLayout.LabelRole, self.SongsModeGroupBox) 0, QtGui.QFormLayout.LabelRole, self.SongsModeGroupBox)
QtCore.QObject.connect(self.SearchAsTypeCheckBox, QtCore.QObject.connect(self.SearchAsTypeCheckBox,
QtCore.SIGNAL(u'stateChanged(int)'), QtCore.SIGNAL(u'stateChanged(int)'),
self.onSearchAsTypeCheckBoxChanged) self.onSearchAsTypeCheckBoxChanged)
QtCore.QObject.connect(self.SongBarActiveCheckBox,
QtCore.SIGNAL(u'stateChanged(int)'),
self.SongBarActiveCheckBoxChanged)
def retranslateUi(self): def retranslateUi(self):
self.SongsModeGroupBox.setTitle(self.trUtf8(u'Songs Mode')) self.SongsModeGroupBox.setTitle(self.trUtf8(u'Songs Mode'))
self.SearchAsTypeCheckBox.setText(self.trUtf8(u'Enable search as you type:')) self.SearchAsTypeCheckBox.setText(self.trUtf8(u'Enable search as you type:'))
self.SongBarActiveCheckBox.setText(self.trUtf8(u'Display Verses on Live Tool bar:'))
def onSearchAsTypeCheckBoxChanged(self, check_state): def onSearchAsTypeCheckBoxChanged(self, check_state):
self.bible_search = False self.song_search = False
# we have a set value convert to True/False # we have a set value convert to True/False
if check_state == QtCore.Qt.Checked: if check_state == QtCore.Qt.Checked:
self.bible_search = True self.song_search = True
def SongBarActiveCheckBoxChanged(self, check_state):
self.song_bar = False
# we have a set value convert to True/False
if check_state == QtCore.Qt.Checked:
self.song_bar = True
def load(self): def load(self):
self.bible_search = str_to_bool( self.song_search = str_to_bool(
self.config.get_config(u'search as type', u'False')) self.config.get_config(u'search as type', False))
self.SearchAsTypeCheckBox.setChecked(self.bible_search) self.song_bar = str_to_bool(
self.config.get_config(u'display songbar', True))
self.SearchAsTypeCheckBox.setChecked(self.song_search)
self.SongBarActiveCheckBox.setChecked(self.song_bar)
def save(self): def save(self):
self.config.set_config(u'search as type', unicode(self.bible_search)) self.config.set_config(u'search as type', unicode(self.song_search))
self.config.set_config(u'display songbar', unicode(self.song_bar))