forked from openlp/openlp
ServiceItem cleanup - hide lists
This commit is contained in:
parent
e618c3061c
commit
ad6abb1e9c
@ -101,13 +101,11 @@ class ServiceItem(object):
|
||||
before = time.time()
|
||||
formated = self.RenderManager.format_slide(slide[u'raw_slide'])
|
||||
for format in formated:
|
||||
frame = None
|
||||
lines = u''
|
||||
for line in format:
|
||||
lines += line + u'\n'
|
||||
title = lines.split(u'\n')[0]
|
||||
self.display_frames.append({u'title': title, u'text': lines,
|
||||
u'image': frame})
|
||||
self.display_frames.append({u'title': title, u'text': lines})
|
||||
log.info(u'Formatting took %4s' % (time.time() - before))
|
||||
elif self.service_item_type == ServiceItemType.Command:
|
||||
self.display_frames = self.raw_frames
|
||||
@ -115,7 +113,6 @@ class ServiceItem(object):
|
||||
for slide in self.raw_frames:
|
||||
slide[u'image'] = \
|
||||
self.RenderManager.resize_image(slide[u'image'])
|
||||
self.display_frames = self.raw_frames
|
||||
else:
|
||||
log.error(u'Invalid value renderer :%s' % self.service_item_type)
|
||||
|
||||
@ -151,7 +148,7 @@ class ServiceItem(object):
|
||||
self.service_item_type = ServiceItemType.Image
|
||||
self.service_item_path = path
|
||||
self.raw_frames.append(
|
||||
{u'title': title, u'text': None, u'image': image})
|
||||
{u'title': title, u'image': image})
|
||||
|
||||
def add_from_text(self, title, raw_slide):
|
||||
"""
|
||||
@ -184,7 +181,7 @@ class ServiceItem(object):
|
||||
self.service_item_type = ServiceItemType.Command
|
||||
self.service_item_path = path
|
||||
self.raw_frames.append(
|
||||
{u'title': file_name, u'command': None, u'text':None, u'image': image})
|
||||
{u'title': file_name, u'image': image})
|
||||
|
||||
def get_service_repr(self):
|
||||
"""
|
||||
@ -284,4 +281,13 @@ class ServiceItem(object):
|
||||
return self.service_item_type == ServiceItemType.Text
|
||||
|
||||
def getFrames(self):
|
||||
return self.display_frames
|
||||
if self.service_item_type == ServiceItemType.Text:
|
||||
return self.display_frames
|
||||
else:
|
||||
return self.raw_frames
|
||||
|
||||
def get_rendered_frame(self, row):
|
||||
if self.service_item_type == ServiceItemType.Text:
|
||||
return self.render_individual(row)
|
||||
else:
|
||||
return self.raw_frames[row][u'image']
|
||||
|
@ -364,7 +364,7 @@ class SlideController(QtGui.QWidget):
|
||||
self.Songbar.setVisible(True)
|
||||
elif item.isImage():
|
||||
#Not sensible to allow loops with 1 frame
|
||||
if len(item.frames) > 1:
|
||||
if len(item.getFrames()) > 1:
|
||||
self.Toolbar.makeWidgetsVisible(self.image_list)
|
||||
elif item.isMedia():
|
||||
self.Toolbar.setVisible(False)
|
||||
@ -463,7 +463,7 @@ class SlideController(QtGui.QWidget):
|
||||
item = QtGui.QTableWidgetItem()
|
||||
slide_height = 0
|
||||
#It is a Image
|
||||
if frame[u'text'] is None:
|
||||
if not self.serviceitem.isText():
|
||||
label = QtGui.QLabel()
|
||||
label.setMargin(4)
|
||||
pixmap = self.parent.RenderManager.resize_image(frame[u'image'])
|
||||
@ -476,7 +476,7 @@ class SlideController(QtGui.QWidget):
|
||||
self.PreviewListWidget.setItem(framenumber, 0, item)
|
||||
if slide_height != 0:
|
||||
self.PreviewListWidget.setRowHeight(framenumber, slide_height)
|
||||
if self.serviceitem.getFrames()[0][u'text']:
|
||||
if self.serviceitem.isText():
|
||||
self.PreviewListWidget.resizeRowsToContents()
|
||||
self.PreviewListWidget.setColumnWidth(
|
||||
0, self.PreviewListWidget.viewport().size().width())
|
||||
@ -528,10 +528,11 @@ class SlideController(QtGui.QWidget):
|
||||
if self.isLive:
|
||||
self.updatePreview()
|
||||
else:
|
||||
frame = self.serviceitem.getFrames()[row][u'image']
|
||||
#frame = self.serviceitem.getFrames()[row][u'image']
|
||||
before = time.time()
|
||||
if frame is None:
|
||||
frame = self.serviceitem.render_individual(row)
|
||||
#if frame is None:
|
||||
#frame = self.serviceitem.render_individual(row)
|
||||
frame = self.serviceitem.get_rendered_frame(row)
|
||||
self.SlidePreview.setPixmap(QtGui.QPixmap.fromImage(frame))
|
||||
log.log(15, u'Slide Rendering took %4s' % (time.time() - before))
|
||||
if self.isLive:
|
||||
|
Loading…
Reference in New Issue
Block a user