Fix song editing where text is lost

This commit is contained in:
Tim Bentley 2010-02-27 09:55:44 +00:00
parent 4a83e572e9
commit 1979f24502
4 changed files with 19 additions and 11 deletions

View File

@ -30,6 +30,8 @@ from PyQt4 import QtCore, QtGui
from openlp.core.lib import MediaManagerItem, BaseListWithDnD, build_icon
log = logging.getLogger(__name__)
class MediaListView(BaseListWithDnD):
def __init__(self, parent=None):
self.PluginName = u'Media'
@ -39,9 +41,7 @@ class MediaMediaItem(MediaManagerItem):
"""
This is the custom media manager item for Media Slides.
"""
global log
log = logging.getLogger(u'MediaMediaItem')
log.info(u'Media Media Item loaded')
log.info(u'%s MediaMediaItem loaded', __name__)
def __init__(self, parent, icon, title):
self.PluginNameShort = u'Media'

View File

@ -29,10 +29,10 @@ from openlp.core.lib import Plugin, build_icon, PluginStatus
from openlp.plugins.media.lib import MediaMediaItem
from PyQt4.phonon import Phonon
log = logging.getLogger(__name__)
class MediaPlugin(Plugin):
global log
log = logging.getLogger(u'MediaPlugin')
log.info(u'Media Plugin loaded')
log.info(u'%s MediaPlugin loaded', __name__)
def __init__(self, plugin_helpers):
Plugin.__init__(self, u'Media', u'1.9.1', plugin_helpers)
@ -41,6 +41,9 @@ class MediaPlugin(Plugin):
# passed with drag and drop messages
self.dnd_id = u'Media'
self.status = PluginStatus.Active
# print Phonon.BackendCapabilities.availableMimeTypes()
# for mimetype in Phonon.BackendCapabilities.availableMimeTypes():
# print mimetype
def initialise(self):
log.info(u'Plugin Initialising')

View File

@ -33,13 +33,13 @@ from openlp.plugins.songs.forms import EditVerseForm
from openlp.plugins.songs.lib.models import Song
from editsongdialog import Ui_EditSongDialog
log = logging.getLogger(__name__)
class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
"""
Class to manage the editing of a song
"""
global log
log = logging.getLogger(u'EditSongForm')
log.info(u'Song Editor loaded')
log.info(u'%s EditSongForm loaded', __name__)
def __init__(self, songmanager, parent=None):
"""

View File

@ -77,6 +77,8 @@ class EditVerseForm(QtGui.QDialog, Ui_EditVerseDialog):
def setVerse(self, text, verseCount=0, single=False, tag=u'Verse:1'):
posVerse = 0
posSub = 0
if len(text) == 0:
text = u'---[Verse:1]---'
if single:
id = tag.split(u':')
posVerse = self.VerseListComboBox.findText(id[0], QtCore.Qt.MatchExactly)
@ -119,11 +121,14 @@ class EditVerseForm(QtGui.QDialog, Ui_EditVerseDialog):
unicode(self.SubVerseListComboBox.currentText())
def getVerseAll(self):
return self.VerseTextEdit.toPlainText()
text = self.VerseTextEdit.toPlainText()
if not text.startsWith(u'---['):
text = u'---[Verse:1]---\n%s' % text
return text
def onVerseComboChanged(self, id):
if unicode(self.VerseListComboBox.currentText()) == u'Verse':
self.SubVerseListComboBox.setEnabled(True)
else:
self.SubVerseListComboBox.setEnabled(False)
self.SubVerseListComboBox.setCurrentIndex(0)
self.SubVerseListComboBox.setCurrentIndex(0)