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

View File

@ -27,7 +27,6 @@ import string
import logging import logging
import cPickle import cPickle
import zipfile import zipfile
import uuid
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from openlp.core.lib import PluginConfig, OpenLPToolbar, ServiceItem, \ from openlp.core.lib import PluginConfig, OpenLPToolbar, ServiceItem, \
@ -563,7 +562,6 @@ class ServiceManager(QtGui.QWidget):
self.repaintServiceList(sitem + 1, 0) self.repaintServiceList(sitem + 1, 0)
self.parent.LiveController.replaceServiceManagerItem(item) self.parent.LiveController.replaceServiceManagerItem(item)
else: else:
item.uuid = unicode(uuid.uuid1())
if sitem == -1: if sitem == -1:
self.serviceItems.append({u'data': item, self.serviceItems.append({u'data': item,
u'order': len(self.serviceItems) + 1, 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)): str_to_bool(self.songsconfig.get_config(u'display songbar', True)):
for action in self.Songbar.actions: for action in self.Songbar.actions:
self.Songbar.actions[action].setVisible(False) self.Songbar.actions[action].setVisible(False)
verses = item.verse_order.split(u' ') if item.verse_order is not None:
for verse in verses: verses = item.verse_order.split(u' ')
try: for verse in verses:
self.Songbar.actions[verse].setVisible(True) try:
except: self.Songbar.actions[verse].setVisible(True)
#More than 20 verses hard luck except:
pass #More than 20 verses hard luck
self.Songbar.setVisible(True) pass
self.Songbar.setVisible(True)
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:
@ -301,7 +302,7 @@ class SlideController(QtGui.QWidget):
""" """
Allows the Preview toolbar to be customised 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) self.Toolbar.makeWidgetsVisible(self.song_list)
else: else:
self.Toolbar.makeWidgetsInvisible(self.song_list) self.Toolbar.makeWidgetsInvisible(self.song_list)

View File

@ -468,6 +468,8 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
def processTitle(self): def processTitle(self):
log.debug(u'processTitle') 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'')
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) song = self.parent.songmanager.get_song(item_id)
service_item.theme = song.theme_name service_item.theme = song.theme_name
service_item.editEnabled = True service_item.editEnabled = True
service_item.fromPlugin = True
service_item.editId = item_id service_item.editId = item_id
service_item.verse_order = song.verse_order service_item.verse_order = song.verse_order
if song.lyrics.startswith(u'<?xml version='): if song.lyrics.startswith(u'<?xml version='):