Finish remote editing of ServiceManager by updating live

This commit is contained in:
Tim Bentley 2009-10-31 08:45:24 +00:00
parent 4695d711f8
commit 4eaa7a1535
5 changed files with 19 additions and 7 deletions

View File

@ -525,7 +525,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
self.settingsForm.postSetUp()
def versionCheck(self):
applicationVersion = self.generalConfig.get_config(u'Application version', u'1.9.0-595')
applicationVersion = self.generalConfig.get_config(u'Application version', u'1.9.0-640')
version = check_latest_version(self.generalConfig, applicationVersion)
if applicationVersion != version:
version_text = unicode(self.trUtf8(u'OpenLP version %s has been updated '

View File

@ -27,6 +27,7 @@ import string
import logging
import cPickle
import zipfile
import uuid
from PyQt4 import QtCore, QtGui
from openlp.core.lib import PluginConfig, OpenLPToolbar, ServiceItem, \
@ -556,17 +557,22 @@ class ServiceManager(QtGui.QWidget):
sitem, count = self.findServiceItem()
item.render()
if self.remoteEditTriggered:
item.uuid = self.serviceItems[sitem][u'data'].uuid
self.serviceItems[sitem][u'data'] = item
self.remoteEditTriggered = False
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, u'expanded':True})
u'order': len(self.serviceItems) + 1,
u'expanded':True})
self.repaintServiceList(len(self.serviceItems) + 1, 0)
else:
self.serviceItems.insert(sitem + 1, {u'data': item,
u'order': len(self.serviceItems)+1, u'expanded':True})
u'order': len(self.serviceItems)+1,
u'expanded':True})
self.repaintServiceList(sitem + 1, 0)
self.parent.serviceChanged(False, self.serviceName)

View File

@ -282,6 +282,7 @@ class SlideController(QtGui.QWidget):
self.Toolbar.makeWidgetsInvisible(self.image_list)
if item.name == u'Songs' and \
str_to_bool(self.songsconfig.get_config(u'display songbar', True)):
print item.verse_order
self.Songbar.setVisible(True)
elif item.service_item_type == ServiceType.Image:
#Not sensible to allow loops with 1 frame
@ -323,6 +324,13 @@ class SlideController(QtGui.QWidget):
self.songEdit = False
self.displayServiceManagerItems(item, slideno)
def replaceServiceManagerItem(self, item):
"""
Replacement item following a remote edit
"""
if self.commandItem is not None and \
item.uuid == self.commandItem.uuid:
self.addServiceManagerItem(item, self.PreviewListWidget.currentRow())
def addServiceManagerItem(self, item, slideno):
"""

View File

@ -115,7 +115,6 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
self.VerseDeleteButton.setEnabled(False)
self.AuthorRemoveButton.setEnabled(False)
self.TopicRemoveButton.setEnabled(False)
self.title_change = False
def loadAuthors(self):
authors = self.songmanager.get_authors()
@ -162,7 +161,6 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
self.VerseListWidget.clear()
self.AuthorsListView.clear()
self.TopicsListView.clear()
self.title_change = False
self.TitleEditItem.setFocus(QtCore.Qt.OtherFocusReason)
self.loadAuthors()
self.loadTopics()
@ -235,7 +233,6 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
topic_name.setData(QtCore.Qt.UserRole, QtCore.QVariant(topic.id))
self.TopicsListView.addItem(topic_name)
self._validate_song()
self.title_change = False
self.TitleEditItem.setFocus(QtCore.Qt.OtherFocusReason)
#if not preview hide the preview button
self.previewButton.setVisible(False)
@ -378,7 +375,6 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
def onTitleEditItemLostFocus(self):
self.song.title = self.TitleEditItem.text()
self.title_change = True
def onVerseOrderEditLostFocus(self):
self.song.verse_order = self.VerseOrderEdit.text()
@ -431,6 +427,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog):
self.song.search_title = unicode(self.TitleEditItem.displayText()) + \
u'@'+ unicode(self.AlternativeEdit.displayText())
self.song.comments = unicode(self.CommentsEdit.toPlainText())
self.song.verse_order = unicode(self.VerseOrderEdit.text())
self.song.ccli_number = unicode(self.CCLNumberEdit.displayText())
self.processLyrics()
self.processTitle()

View File

@ -106,6 +106,7 @@ class SongManager():
self.session.commit()
return True
except:
log.exception(u'Could not save song to song database')
self.session.rollback()
log.exception(u'Could not save song to song database')
return False