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() self.regenerateServiceItems()
def regenerateServiceItems(self): 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 #force reset of renderer as theme data has changed
self.parent.RenderManager.themedata = None self.parent.RenderManager.themedata = None
if self.serviceItems: if self.serviceItems:
@ -963,4 +967,4 @@ class ServiceManager(QtGui.QWidget):
data_item[u'notes'] = unicode(service_item.notes) data_item[u'notes'] = unicode(service_item.notes)
data_item[u'selected'] = (item == curitem) data_item[u'selected'] = (item == curitem)
data.append(data_item) 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 #Set pointing cursor when we have somthing to point at
self.PreviewListWidget.setCursor(QtCore.Qt.PointingHandCursor) self.PreviewListWidget.setCursor(QtCore.Qt.PointingHandCursor)
before = time.time() before = time.time()
#Clear the old serviceItem cache to release memory
if self.serviceItem:
self.serviceItem.cache = []
self.serviceItem = serviceItem self.serviceItem = serviceItem
self.PreviewListWidget.clear() self.PreviewListWidget.clear()
self.PreviewListWidget.setRowCount(0) self.PreviewListWidget.setRowCount(0)
@ -531,8 +534,7 @@ class SlideController(QtGui.QWidget):
slideHeight = 0 slideHeight = 0
#It is a based Text Render #It is a based Text Render
if self.serviceItem.is_text(): if self.serviceItem.is_text():
if frame[u'verseTag'] is not None: if frame[u'verseTag']:
#only load the slot once
bits = frame[u'verseTag'].split(u':') bits = frame[u'verseTag'].split(u':')
tag = None tag = None
#If verse handle verse number else tag only #If verse handle verse number else tag only
@ -545,13 +547,13 @@ class SlideController(QtGui.QWidget):
tag = bits[0] tag = bits[0]
tag1 = tag tag1 = tag
row = bits[0][0:1] 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: else:
row += 1 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']) item.setText(frame[u'text'])
else: else:
label = QtGui.QLabel() label = QtGui.QLabel()

View File

@ -323,7 +323,9 @@ class SongMediaItem(MediaManagerItem):
#no verse list or only 1 space (in error) #no verse list or only 1 space (in error)
if not song.verse_order or not song.verse_order.strip(): if not song.verse_order or not song.verse_order.strip():
for verse in verseList: 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: else:
#Loop through the verse list and expand the song accordingly. #Loop through the verse list and expand the song accordingly.
for order in song.verse_order.upper().split(u' '): for order in song.verse_order.upper().split(u' '):