Fix up handling of service items in the slide controllers and stop editing issues

This commit is contained in:
Tim Bentley 2009-10-31 20:27:08 +00:00
commit 7a349c998e
5 changed files with 19 additions and 11 deletions

View File

@ -24,6 +24,7 @@
import types
import os
import uuid
from PyQt4 import QtCore, QtGui
@ -360,18 +361,23 @@ class MediaManagerItem(QtGui.QWidget):
log.debug(self.PluginNameShort + u' Preview Requested')
service_item = self.buildServiceItem()
if service_item is not None:
service_item.fromPlugin = True
self.parent.preview_controller.addServiceItem(service_item)
def onLiveClick(self):
log.debug(self.PluginNameShort + u' Live Requested')
service_item = self.buildServiceItem()
if service_item is not None:
service_item.fromPlugin = True
service_item.uuid = unicode(uuid.uuid1())
self.parent.live_controller.addServiceItem(service_item)
def onAddClick(self):
log.debug(self.PluginNameShort + u' Add Requested')
service_item = self.buildServiceItem()
if service_item is not None:
service_item.fromPlugin = False
service_item.uuid = unicode(uuid.uuid1())
self.parent.service_manager.addServiceItem(service_item)
def buildServiceItem(self):

View File

@ -27,7 +27,6 @@ import string
import logging
import cPickle
import zipfile
import uuid
from PyQt4 import QtCore, QtGui
from openlp.core.lib import PluginConfig, OpenLPToolbar, ServiceItem, \
@ -563,7 +562,6 @@ class ServiceManager(QtGui.QWidget):
self.repaintServiceList(sitem + 1, 0)
self.parent.LiveController.replaceServiceManagerItem(item)
else:
item.uuid = unicode(uuid.uuid1())
if sitem == -1:
self.serviceItems.append({u'data': item,
u'order': len(self.serviceItems) + 1,

View File

@ -284,14 +284,15 @@ class SlideController(QtGui.QWidget):
str_to_bool(self.songsconfig.get_config(u'display songbar', True)):
for action in self.Songbar.actions:
self.Songbar.actions[action].setVisible(False)
verses = item.verse_order.split(u' ')
for verse in verses:
try:
self.Songbar.actions[verse].setVisible(True)
except:
#More than 20 verses hard luck
pass
self.Songbar.setVisible(True)
if item.verse_order is not None:
verses = item.verse_order.split(u' ')
for verse in verses:
try:
self.Songbar.actions[verse].setVisible(True)
except:
#More than 20 verses hard luck
pass
self.Songbar.setVisible(True)
elif item.service_item_type == ServiceType.Image:
#Not sensible to allow loops with 1 frame
if len(item.frames) > 1:
@ -301,7 +302,7 @@ class SlideController(QtGui.QWidget):
"""
Allows the Preview toolbar to be customised
"""
if item.name == u'Songs':
if item.name == u'Songs' and item.fromPlugin:
self.Toolbar.makeWidgetsVisible(self.song_list)
else:
self.Toolbar.makeWidgetsInvisible(self.song_list)

View File

@ -468,6 +468,8 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
def processTitle(self):
log.debug(u'processTitle')
self.song.search_title = self.song.search_title.replace(u'\'', u'')
self.song.search_title = self.song.search_title.replace(u'\"', u'')
self.song.search_title = self.song.search_title.replace(u'\`', u'')
self.song.search_title = self.song.search_title.replace(u',', u'')
self.song.search_title = self.song.search_title.replace(u';', u'')
self.song.search_title = self.song.search_title.replace(u':', u'')

View File

@ -289,6 +289,7 @@ class SongMediaItem(MediaManagerItem):
song = self.parent.songmanager.get_song(item_id)
service_item.theme = song.theme_name
service_item.editEnabled = True
service_item.fromPlugin = True
service_item.editId = item_id
service_item.verse_order = song.verse_order
if song.lyrics.startswith(u'<?xml version='):