forked from openlp/openlp
Headr644
This commit is contained in:
commit
70b04f5821
@ -94,7 +94,7 @@ create_statements = [
|
||||
)""")
|
||||
]
|
||||
|
||||
def clean_string(dirty):
|
||||
def prepare_string(dirty):
|
||||
return dirty_chars.sub(u'', dirty.replace(u'\r\n', ' ').replace(u'\n', ' '))
|
||||
|
||||
def display_sql(sql, params):
|
||||
@ -193,12 +193,12 @@ def import_songs():
|
||||
xml_verse += (xml_verse_template % (line + 1, verse))
|
||||
verse_order += '%d ' % (line + 1)
|
||||
xml_lyrics = xml_lyrics_template % xml_verse
|
||||
search_title = clean_string(clean_title)
|
||||
search_lyrics = clean_string(clean_lyrics)
|
||||
search_title = prepare_string(clean_title)
|
||||
search_lyrics = prepare_string(clean_lyrics)
|
||||
sql_insert = u'INSERT INTO songs '\
|
||||
'(id, song_book_id, title, lyrics, verse_order, copyright, search_title, search_lyrics) '\
|
||||
'VALUES (NULL, 0, ?, ?, ?, ?, ?, ?)'
|
||||
sql_params = (clean_title, xml_lyrics, verse_order, clean_copyright, clean_title, clean_lyrics)
|
||||
sql_params = (clean_title, xml_lyrics, verse_order, clean_copyright, search_title, search_lyrics)
|
||||
if debug:
|
||||
print '...', display_sql(sql_insert, (sql_params[0], u'%s...' % clean_lyrics[:7], sql_params[2], sql_params[3], sql_params[4], u'%s...' % search_lyrics[:7]))
|
||||
elif verbose:
|
||||
|
@ -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):
|
||||
|
@ -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,
|
||||
|
@ -285,15 +285,16 @@ 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)
|
||||
elif item.service_item_type == ServiceItemType.Image:
|
||||
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:
|
||||
self.Toolbar.makeWidgetsVisible(self.image_list)
|
||||
@ -302,7 +303,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)
|
||||
|
@ -120,7 +120,7 @@ class Ui_customEditDialog(object):
|
||||
self.gridLayout.addLayout(self.horizontalLayout_2, 4, 0, 1, 1)
|
||||
self.buttonBox = QtGui.QDialogButtonBox(customEditDialog)
|
||||
self.buttonBox.setStandardButtons(
|
||||
QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok)
|
||||
QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Save)
|
||||
self.buttonBox.setObjectName(u'buttonBox')
|
||||
self.gridLayout.addWidget(self.buttonBox, 5, 0, 1, 1)
|
||||
|
||||
|
@ -101,7 +101,7 @@ class EditCustomForm(QtGui.QDialog, Ui_customEditDialog):
|
||||
verseList = songXML.get_verses()
|
||||
for verse in verseList:
|
||||
self.VerseListView.addItem(verse[1])
|
||||
theme = unicode(self.customSlide.theme_name)
|
||||
theme = self.customSlide.theme_name
|
||||
id = self.ThemeComboBox.findText(theme, QtCore.Qt.MatchExactly)
|
||||
if id == -1:
|
||||
id = 0 # Not Found
|
||||
@ -224,9 +224,12 @@ class EditCustomForm(QtGui.QDialog, Ui_customEditDialog):
|
||||
def _validate(self):
|
||||
if len(self.TitleEdit.displayText()) == 0:
|
||||
self.TitleEdit.setFocus()
|
||||
return False, self.trUtf8(u'You need to enter a title \n')
|
||||
return False, self.trUtf8(u'You need to enter a title')
|
||||
# must have 1 slide
|
||||
if self.VerseListView.count() == 0:
|
||||
self.VerseTextEdit.setFocus()
|
||||
return False, self.trUtf8(u'You need to enter a slide \n')
|
||||
return False, self.trUtf8(u'You need to enter a slide')
|
||||
if len(self.VerseTextEdit.toPlainText()) > 0:
|
||||
self.VerseTextEdit.setFocus()
|
||||
return False, self.trUtf8(u'You have unsaved data')
|
||||
return True, u''
|
||||
|
@ -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'')
|
||||
|
@ -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='):
|
||||
|
Loading…
Reference in New Issue
Block a user