diff --git a/openlp/core/lib/eventreceiver.py b/openlp/core/lib/eventreceiver.py index 14b6126bc..40cac8e35 100644 --- a/openlp/core/lib/eventreceiver.py +++ b/openlp/core/lib/eventreceiver.py @@ -115,8 +115,12 @@ class EventReceiver(QtCore.QObject): ``slidecontroller_live_stop_loop`` Stop the loop on the main display. + **Servicemanager related signals** + ``servicemanager_new_service`` + A new service is being loaded or created. + ``servicemanager_previous_item`` Display the previous item in the service. diff --git a/openlp/core/ui/maindisplay.py b/openlp/core/ui/maindisplay.py index e439b1db1..328970d45 100644 --- a/openlp/core/ui/maindisplay.py +++ b/openlp/core/ui/maindisplay.py @@ -45,7 +45,7 @@ log = logging.getLogger(__name__) class Display(QtGui.QGraphicsView): """ - This is a general display screen class. Here the general display settings + This is a general display screen class. Here the general display settings will done. It will be used as specialized classes by Main Display and Preview display. """ @@ -66,7 +66,7 @@ class Display(QtGui.QGraphicsView): """ Set up and build the screen base """ - log.debug(u'Start Display base setup (live = %s)' % self.isLive) + log.debug(u'Start Display base setup (live = %s)' % self.isLive) self.setGeometry(self.screen[u'size']) log.debug(u'Setup webView') self.webView = QtWebKit.QWebView(self) diff --git a/openlp/core/ui/servicemanager.py b/openlp/core/ui/servicemanager.py index fa1ccede0..ed5d2ae5b 100644 --- a/openlp/core/ui/servicemanager.py +++ b/openlp/core/ui/servicemanager.py @@ -465,6 +465,7 @@ class ServiceManager(QtGui.QWidget): self.setModified(False) QtCore.QSettings(). \ setValue(u'servicemanager/last file',QtCore.QVariant(u'')) + Receiver.send_message(u'servicemanager_new_service') def saveFile(self): """ diff --git a/openlp/plugins/songs/songsplugin.py b/openlp/plugins/songs/songsplugin.py index 4f0e9d77a..bec9fdf97 100644 --- a/openlp/plugins/songs/songsplugin.py +++ b/openlp/plugins/songs/songsplugin.py @@ -77,6 +77,9 @@ class SongsPlugin(Plugin): action_list.add_action(self.songImportItem, UiStrings().Import) action_list.add_action(self.songExportItem, UiStrings().Export) action_list.add_action(self.toolsReindexItem, UiStrings().Tools) + QtCore.QObject.connect(Receiver.get_receiver(), + QtCore.SIGNAL(u'servicemanager_new_service'), + self.clearTemporarySongs) def addImportMenuItem(self, import_menu): """ @@ -264,10 +267,7 @@ class SongsPlugin(Plugin): Time to tidy up on exit """ log.info(u'Songs Finalising') - # Remove temporary songs - songs = self.manager.get_all_objects(Song, Song.temporary == True) - for song in songs: - self.manager.delete_object(Song, song.id) + self.clearTemporarySongs() # Clean up files and connections self.manager.finalise() self.songImportItem.setVisible(False) @@ -278,3 +278,9 @@ class SongsPlugin(Plugin): action_list.remove_action(self.songExportItem, UiStrings().Export) action_list.remove_action(self.toolsReindexItem, UiStrings().Tools) Plugin.finalise(self) + + def clearTemporarySongs(self): + # Remove temporary songs + songs = self.manager.get_all_objects(Song, Song.temporary == True) + for song in songs: + self.manager.delete_object(Song, song.id)