Fix memory leak and improve slide controller tags

bzr-revno: 823
This commit is contained in:
Tim Bentley 2010-05-24 19:04:22 +01:00
commit f6d7743905
3 changed files with 17 additions and 9 deletions

View File

@ -711,6 +711,10 @@ class ServiceManager(QtGui.QWidget):
self.regenerateServiceItems()
def regenerateServiceItems(self):
"""
Rebuild the service list as things have changed and a
repaint is the easiest way to do this.
"""
#force reset of renderer as theme data has changed
self.parent.RenderManager.themedata = None
if self.serviceItems:
@ -963,4 +967,4 @@ class ServiceManager(QtGui.QWidget):
data_item[u'notes'] = unicode(service_item.notes)
data_item[u'selected'] = (item == curitem)
data.append(data_item)
Receiver.send_message(u'servicemanager_list_response', data)
Receiver.send_message(u'servicemanager_list_response', data)

View File

@ -516,6 +516,9 @@ class SlideController(QtGui.QWidget):
#Set pointing cursor when we have somthing to point at
self.PreviewListWidget.setCursor(QtCore.Qt.PointingHandCursor)
before = time.time()
#Clear the old serviceItem cache to release memory
if self.serviceItem:
self.serviceItem.cache = []
self.serviceItem = serviceItem
self.PreviewListWidget.clear()
self.PreviewListWidget.setRowCount(0)
@ -531,8 +534,7 @@ class SlideController(QtGui.QWidget):
slideHeight = 0
#It is a based Text Render
if self.serviceItem.is_text():
if frame[u'verseTag'] is not None:
#only load the slot once
if frame[u'verseTag']:
bits = frame[u'verseTag'].split(u':')
tag = None
#If verse handle verse number else tag only
@ -545,13 +547,13 @@ class SlideController(QtGui.QWidget):
tag = bits[0]
tag1 = tag
row = bits[0][0:1]
if self.isLive:
if tag1 not in self.slideList:
self.slideList[tag1] = framenumber
self.SongMenu.menu().addAction(self.trUtf8(u'%s'%tag1),
self.onSongBarHandler)
else:
row += 1
if self.isLive and frame[u'verseTag'] is not None:
if tag1 not in self.slideList:
self.slideList[tag1] = framenumber
self.SongMenu.menu().addAction(self.trUtf8(u'%s'%tag1),
self.onSongBarHandler)
item.setText(frame[u'text'])
else:
label = QtGui.QLabel()

View File

@ -323,7 +323,9 @@ class SongMediaItem(MediaManagerItem):
#no verse list or only 1 space (in error)
if not song.verse_order or not song.verse_order.strip():
for verse in verseList:
service_item.add_from_text(verse[1][:30], unicode(verse[1]))
verseTag = u'%s:%s' % (verse[0][u'type'], verse[0][u'label'])
service_item.add_from_text(\
verse[1][:30], unicode(verse[1]), verseTag)
else:
#Loop through the verse list and expand the song accordingly.
for order in song.verse_order.upper().split(u' '):