Stop memory growth, improve verse display

This commit is contained in:
Tim Bentley 2010-05-23 08:03:28 +01:00
parent 38290cb804
commit f7987501b9
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:

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' '):