forked from openlp/openlp
clean up service
This commit is contained in:
parent
39bc9238bf
commit
b07e10282d
@ -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.
|
||||
|
||||
|
@ -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):
|
||||
"""
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user