clean up service

This commit is contained in:
Tim Bentley 2011-12-10 14:34:28 +00:00
parent 39bc9238bf
commit b07e10282d
4 changed files with 17 additions and 6 deletions

View File

@ -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.

View File

@ -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)

View File

@ -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):
"""

View File

@ -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)