forked from openlp/openlp
Fix song editing where text is lost
This commit is contained in:
parent
4a83e572e9
commit
1979f24502
@ -30,6 +30,8 @@ from PyQt4 import QtCore, QtGui
|
|||||||
|
|
||||||
from openlp.core.lib import MediaManagerItem, BaseListWithDnD, build_icon
|
from openlp.core.lib import MediaManagerItem, BaseListWithDnD, build_icon
|
||||||
|
|
||||||
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
class MediaListView(BaseListWithDnD):
|
class MediaListView(BaseListWithDnD):
|
||||||
def __init__(self, parent=None):
|
def __init__(self, parent=None):
|
||||||
self.PluginName = u'Media'
|
self.PluginName = u'Media'
|
||||||
@ -39,9 +41,7 @@ class MediaMediaItem(MediaManagerItem):
|
|||||||
"""
|
"""
|
||||||
This is the custom media manager item for Media Slides.
|
This is the custom media manager item for Media Slides.
|
||||||
"""
|
"""
|
||||||
global log
|
log.info(u'%s MediaMediaItem loaded', __name__)
|
||||||
log = logging.getLogger(u'MediaMediaItem')
|
|
||||||
log.info(u'Media Media Item loaded')
|
|
||||||
|
|
||||||
def __init__(self, parent, icon, title):
|
def __init__(self, parent, icon, title):
|
||||||
self.PluginNameShort = u'Media'
|
self.PluginNameShort = u'Media'
|
||||||
|
@ -29,10 +29,10 @@ from openlp.core.lib import Plugin, build_icon, PluginStatus
|
|||||||
from openlp.plugins.media.lib import MediaMediaItem
|
from openlp.plugins.media.lib import MediaMediaItem
|
||||||
from PyQt4.phonon import Phonon
|
from PyQt4.phonon import Phonon
|
||||||
|
|
||||||
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
class MediaPlugin(Plugin):
|
class MediaPlugin(Plugin):
|
||||||
global log
|
log.info(u'%s MediaPlugin loaded', __name__)
|
||||||
log = logging.getLogger(u'MediaPlugin')
|
|
||||||
log.info(u'Media Plugin loaded')
|
|
||||||
|
|
||||||
def __init__(self, plugin_helpers):
|
def __init__(self, plugin_helpers):
|
||||||
Plugin.__init__(self, u'Media', u'1.9.1', 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
|
# passed with drag and drop messages
|
||||||
self.dnd_id = u'Media'
|
self.dnd_id = u'Media'
|
||||||
self.status = PluginStatus.Active
|
self.status = PluginStatus.Active
|
||||||
|
# print Phonon.BackendCapabilities.availableMimeTypes()
|
||||||
|
# for mimetype in Phonon.BackendCapabilities.availableMimeTypes():
|
||||||
|
# print mimetype
|
||||||
|
|
||||||
def initialise(self):
|
def initialise(self):
|
||||||
log.info(u'Plugin Initialising')
|
log.info(u'Plugin Initialising')
|
||||||
|
@ -33,13 +33,13 @@ from openlp.plugins.songs.forms import EditVerseForm
|
|||||||
from openlp.plugins.songs.lib.models import Song
|
from openlp.plugins.songs.lib.models import Song
|
||||||
from editsongdialog import Ui_EditSongDialog
|
from editsongdialog import Ui_EditSongDialog
|
||||||
|
|
||||||
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
|
||||||
"""
|
"""
|
||||||
Class to manage the editing of a song
|
Class to manage the editing of a song
|
||||||
"""
|
"""
|
||||||
global log
|
log.info(u'%s EditSongForm loaded', __name__)
|
||||||
log = logging.getLogger(u'EditSongForm')
|
|
||||||
log.info(u'Song Editor loaded')
|
|
||||||
|
|
||||||
def __init__(self, songmanager, parent=None):
|
def __init__(self, songmanager, parent=None):
|
||||||
"""
|
"""
|
||||||
|
@ -77,6 +77,8 @@ class EditVerseForm(QtGui.QDialog, Ui_EditVerseDialog):
|
|||||||
def setVerse(self, text, verseCount=0, single=False, tag=u'Verse:1'):
|
def setVerse(self, text, verseCount=0, single=False, tag=u'Verse:1'):
|
||||||
posVerse = 0
|
posVerse = 0
|
||||||
posSub = 0
|
posSub = 0
|
||||||
|
if len(text) == 0:
|
||||||
|
text = u'---[Verse:1]---'
|
||||||
if single:
|
if single:
|
||||||
id = tag.split(u':')
|
id = tag.split(u':')
|
||||||
posVerse = self.VerseListComboBox.findText(id[0], QtCore.Qt.MatchExactly)
|
posVerse = self.VerseListComboBox.findText(id[0], QtCore.Qt.MatchExactly)
|
||||||
@ -119,11 +121,14 @@ class EditVerseForm(QtGui.QDialog, Ui_EditVerseDialog):
|
|||||||
unicode(self.SubVerseListComboBox.currentText())
|
unicode(self.SubVerseListComboBox.currentText())
|
||||||
|
|
||||||
def getVerseAll(self):
|
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):
|
def onVerseComboChanged(self, id):
|
||||||
if unicode(self.VerseListComboBox.currentText()) == u'Verse':
|
if unicode(self.VerseListComboBox.currentText()) == u'Verse':
|
||||||
self.SubVerseListComboBox.setEnabled(True)
|
self.SubVerseListComboBox.setEnabled(True)
|
||||||
else:
|
else:
|
||||||
self.SubVerseListComboBox.setEnabled(False)
|
self.SubVerseListComboBox.setEnabled(False)
|
||||||
self.SubVerseListComboBox.setCurrentIndex(0)
|
self.SubVerseListComboBox.setCurrentIndex(0)
|
||||||
|
Loading…
Reference in New Issue
Block a user