← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~raoul-snyman/openlp/bug-fixes into lp:openlp

 

Raoul Snyman has proposed merging lp:~raoul-snyman/openlp/bug-fixes into lp:openlp.

Requested reviews:
  OpenLP Core (openlp-core)


Fix bug #596506 and bug #596505
-- 
https://code.launchpad.net/~raoul-snyman/openlp/bug-fixes/+merge/28016
Your team OpenLP Core is requested to review the proposed merge of lp:~raoul-snyman/openlp/bug-fixes into lp:openlp.
=== modified file 'openlp/core/lib/serviceitem.py'
--- openlp/core/lib/serviceitem.py	2010-06-18 05:58:40 +0000
+++ openlp/core/lib/serviceitem.py	2010-06-20 12:15:43 +0000
@@ -90,7 +90,7 @@
         self.from_plugin = False
         self.capabilities = []
         self.is_valid = True
-        self.cache = []
+        self.cache = {}
         self.icon = None
 
     def add_capability(self, capability):
@@ -129,7 +129,7 @@
         """
         log.debug(u'Render called')
         self._display_frames = []
-        self.cache = []
+        self.clear_cache()
         if self.service_item_type == ServiceItemType.Text:
             log.debug(u'Formatting slides')
             if self.theme is None:
@@ -149,7 +149,8 @@
                     self._display_frames.append({u'title': title,
                         u'text': lines.rstrip(),
                         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))
         elif self.service_item_type == ServiceItemType.Image:
             for slide in self._raw_frames:
@@ -172,8 +173,7 @@
         else:
             self.render_manager.set_override_theme(self.theme)
         format = self._display_frames[row][u'text'].split(u'\n')
-        #if screen blank then do not display footer
-        if len(self.cache) > 0 and self.cache[row] is not None:
+        if self.cache.get(row):
             frame = self.cache[row]
         else:
             if format[0]:
@@ -385,3 +385,8 @@
         """
         return self._raw_frames[row][u'path']
 
+    def clear_cache(self):
+        """
+        Clear's the service item's cache.
+        """
+        self.cache = {}

=== modified file 'openlp/core/ui/servicemanager.py'
--- openlp/core/ui/servicemanager.py	2010-06-19 04:05:39 +0000
+++ openlp/core/ui/servicemanager.py	2010-06-20 12:15:43 +0000
@@ -661,8 +661,7 @@
         filename = unicode(filename)
         name = filename.split(os.path.sep)
         if filename:
-            SettingsManager.set_last_dir(
-                self.parent.serviceSettingsSection,
+            SettingsManager.set_last_dir(self.parent.serviceSettingsSection,
                 os.path.split(filename)[0])
             zip = None
             file_to = None
@@ -697,7 +696,7 @@
                     self.onNewService()
                     for item in items:
                         serviceitem = ServiceItem()
-                        serviceitem.RenderManager = self.parent.RenderManager
+                        serviceitem.render_manager = self.parent.RenderManager
                         serviceitem.set_from_service(item, self.servicePath)
                         self.validateItem(serviceitem)
                         self.addServiceItem(serviceitem)

=== modified file 'openlp/core/ui/slidecontroller.py'
--- openlp/core/ui/slidecontroller.py	2010-06-19 04:05:39 +0000
+++ openlp/core/ui/slidecontroller.py	2010-06-20 12:15:43 +0000
@@ -537,7 +537,7 @@
         before = time.time()
         #Clear the old serviceItem cache to release memory
         if self.serviceItem and self.serviceItem is not serviceItem:
-            self.serviceItem.cache = []
+            self.serviceItem.clear_cache()
         self.serviceItem = serviceItem
         self.PreviewListWidget.clear()
         self.PreviewListWidget.setRowCount(0)


Follow ups