forked from openlp/openlp
commit
068cb0ff8b
@ -90,7 +90,7 @@ class ServiceItem(object):
|
|||||||
self.from_plugin = False
|
self.from_plugin = False
|
||||||
self.capabilities = []
|
self.capabilities = []
|
||||||
self.is_valid = True
|
self.is_valid = True
|
||||||
self.cache = []
|
self.cache = {}
|
||||||
self.icon = None
|
self.icon = None
|
||||||
|
|
||||||
def add_capability(self, capability):
|
def add_capability(self, capability):
|
||||||
@ -129,7 +129,7 @@ class ServiceItem(object):
|
|||||||
"""
|
"""
|
||||||
log.debug(u'Render called')
|
log.debug(u'Render called')
|
||||||
self._display_frames = []
|
self._display_frames = []
|
||||||
self.cache = []
|
self.clear_cache()
|
||||||
if self.service_item_type == ServiceItemType.Text:
|
if self.service_item_type == ServiceItemType.Text:
|
||||||
log.debug(u'Formatting slides')
|
log.debug(u'Formatting slides')
|
||||||
if self.theme is None:
|
if self.theme is None:
|
||||||
@ -149,7 +149,8 @@ class ServiceItem(object):
|
|||||||
self._display_frames.append({u'title': title,
|
self._display_frames.append({u'title': title,
|
||||||
u'text': lines.rstrip(),
|
u'text': lines.rstrip(),
|
||||||
u'verseTag': slide[u'verseTag'] })
|
u'verseTag': slide[u'verseTag'] })
|
||||||
self.cache.insert(len(self._display_frames), None)
|
if len(self._display_frames) in self.cache.keys():
|
||||||
|
del self.cache[len(self._display_frames)]
|
||||||
log.log(15, u'Formatting took %4s' % (time.time() - before))
|
log.log(15, u'Formatting took %4s' % (time.time() - before))
|
||||||
elif self.service_item_type == ServiceItemType.Image:
|
elif self.service_item_type == ServiceItemType.Image:
|
||||||
for slide in self._raw_frames:
|
for slide in self._raw_frames:
|
||||||
@ -172,8 +173,7 @@ class ServiceItem(object):
|
|||||||
else:
|
else:
|
||||||
self.render_manager.set_override_theme(self.theme)
|
self.render_manager.set_override_theme(self.theme)
|
||||||
format = self._display_frames[row][u'text'].split(u'\n')
|
format = self._display_frames[row][u'text'].split(u'\n')
|
||||||
#if screen blank then do not display footer
|
if self.cache.get(row):
|
||||||
if len(self.cache) > 0 and self.cache[row] is not None:
|
|
||||||
frame = self.cache[row]
|
frame = self.cache[row]
|
||||||
else:
|
else:
|
||||||
if format[0]:
|
if format[0]:
|
||||||
@ -385,3 +385,8 @@ class ServiceItem(object):
|
|||||||
"""
|
"""
|
||||||
return self._raw_frames[row][u'path']
|
return self._raw_frames[row][u'path']
|
||||||
|
|
||||||
|
def clear_cache(self):
|
||||||
|
"""
|
||||||
|
Clear's the service item's cache.
|
||||||
|
"""
|
||||||
|
self.cache = {}
|
||||||
|
@ -661,8 +661,7 @@ class ServiceManager(QtGui.QWidget):
|
|||||||
filename = unicode(filename)
|
filename = unicode(filename)
|
||||||
name = filename.split(os.path.sep)
|
name = filename.split(os.path.sep)
|
||||||
if filename:
|
if filename:
|
||||||
SettingsManager.set_last_dir(
|
SettingsManager.set_last_dir(self.parent.serviceSettingsSection,
|
||||||
self.parent.serviceSettingsSection,
|
|
||||||
os.path.split(filename)[0])
|
os.path.split(filename)[0])
|
||||||
zip = None
|
zip = None
|
||||||
file_to = None
|
file_to = None
|
||||||
@ -697,7 +696,7 @@ class ServiceManager(QtGui.QWidget):
|
|||||||
self.onNewService()
|
self.onNewService()
|
||||||
for item in items:
|
for item in items:
|
||||||
serviceitem = ServiceItem()
|
serviceitem = ServiceItem()
|
||||||
serviceitem.RenderManager = self.parent.RenderManager
|
serviceitem.render_manager = self.parent.RenderManager
|
||||||
serviceitem.set_from_service(item, self.servicePath)
|
serviceitem.set_from_service(item, self.servicePath)
|
||||||
self.validateItem(serviceitem)
|
self.validateItem(serviceitem)
|
||||||
self.addServiceItem(serviceitem)
|
self.addServiceItem(serviceitem)
|
||||||
|
@ -537,7 +537,7 @@ class SlideController(QtGui.QWidget):
|
|||||||
before = time.time()
|
before = time.time()
|
||||||
#Clear the old serviceItem cache to release memory
|
#Clear the old serviceItem cache to release memory
|
||||||
if self.serviceItem and self.serviceItem is not serviceItem:
|
if self.serviceItem and self.serviceItem is not serviceItem:
|
||||||
self.serviceItem.cache = []
|
self.serviceItem.clear_cache()
|
||||||
self.serviceItem = serviceItem
|
self.serviceItem = serviceItem
|
||||||
self.PreviewListWidget.clear()
|
self.PreviewListWidget.clear()
|
||||||
self.PreviewListWidget.setRowCount(0)
|
self.PreviewListWidget.setRowCount(0)
|
||||||
|
Loading…
Reference in New Issue
Block a user