[POS-commit] r7144 - in kiwi/trunk: . kiwi/ui

Johan Dahlin jdahlin at async.com.br
Sun Aug 26 22:26:08 BRT 2007


Author: jdahlin
Date: Sun Aug 26 22:26:08 2007
New Revision: 7144

Modified:
   kiwi/trunk/ChangeLog
   kiwi/trunk/kiwi/ui/objectlist.py

Log:
2007-08-26  Johan Dahlin  <jdahlin at async.com.br>

    * kiwi/ui/objectlist.py (Column, ObjectList): Remove the cache
    property.



Modified: kiwi/trunk/ChangeLog
==============================================================================
--- kiwi/trunk/ChangeLog	(original)
+++ kiwi/trunk/ChangeLog	Sun Aug 26 22:26:08 2007
@@ -1,3 +1,8 @@
+2007-08-26  Johan Dahlin  <jdahlin at async.com.br>
+
+	* kiwi/ui/objectlist.py (Column, ObjectList): Remove the cache
+	property.
+
 2007-08-22  Johan Dahlin  <jdahlin at async.com.br>
 
 	* kiwi/ui/listdialog.py (ListContainer._on_list__row_activated): 

Modified: kiwi/trunk/kiwi/ui/objectlist.py
==============================================================================
--- kiwi/trunk/kiwi/ui/objectlist.py	(original)
+++ kiwi/trunk/kiwi/ui/objectlist.py	Sun Aug 26 22:26:08 2007
@@ -113,9 +113,6 @@
       - B{radio}: bool I{False}
         -  If true render the column as a radio instead of toggle.
            Only applicable for columns with boolean data types.
-      - B{cache}: bool I{False}
-        -  If true, the value will only be fetched once, and the same value
-           will be reused for futher access.
       - B{use_stock}: bool I{False}
         - If true, this will be rendered as pixbuf from the value which
           should be a stock id.
@@ -151,7 +148,6 @@
     gproperty('editable', bool, default=False)
     gproperty('searchable', bool, default=False)
     gproperty('radio', bool, default=False)
-    gproperty('cache', bool, default=False)
     gproperty('use-stock', bool, default=False)
     gproperty('use-markup', bool, default=False)
     gproperty('icon-size', gtk.IconSize, default=gtk.ICON_SIZE_MENU)
@@ -542,7 +538,6 @@
         self._columns = []
         # Mapping of instance id -> treeiter
         self._iters = {}
-        self._cell_data_caches = {}
         self._autosize = True
         self._vscrollbar = None
 
@@ -913,8 +908,6 @@
 
         if column.cell_data_func:
             cell_data_func = column.cell_data_func
-        elif column.cache:
-            self._cell_data_caches[column.attribute] = {}
 
         treeview_column.pack_start(renderer)
         treeview_column.set_cell_data_func(renderer, cell_data_func,
@@ -1184,18 +1177,8 @@
             else:
                 raise AssertionError
 
-        if column.cache:
-            cache = self._cell_data_caches[column.attribute]
-            path = row.path[0]
-            if path in cache:
-                data = cache[path]
-            else:
-                data = column.get_attribute(row[COL_MODEL],
-                                            column.attribute, None)
-                cache[path] = data
-        else:
-            data = column.get_attribute(row[COL_MODEL],
-                                        column.attribute, None)
+        data = column.get_attribute(row[COL_MODEL],
+                                    column.attribute, None)
 
         text = column.as_string(data)
 
@@ -1433,21 +1416,11 @@
         if not treeiter:
             return False
 
-        # Remove any references to this path
-        self._clear_cache_for_iter(treeiter)
-
         # All references to the iter gone, now it can be removed
         self._model.remove(treeiter)
 
         return True
 
-    def _clear_cache_for_iter(self, treeiter):
-        # Not as inefficent as it looks
-        path = self._model[treeiter].path[0]
-        for cache in self._cell_data_caches.values():
-            if path in cache:
-                del cache[path]
-
     def remove(self, instance, select=False):
         """Remove an instance from the list.
         If the instance is not in the list it returns False. Otherwise it
@@ -1477,7 +1450,6 @@
         if not objid in self._iters:
             raise ValueError("instance %r is not in the list" % instance)
         treeiter = self._iters[objid]
-        self._clear_cache_for_iter(treeiter)
         self._model.row_changed(self._model[treeiter].path, treeiter)
 
     def refresh(self, view_only=False):
@@ -1608,11 +1580,6 @@
         self._model.clear()
         self._iters = {}
 
-        # Don't clear the whole cache, just the
-        # individual column caches
-        for key in self._cell_data_caches:
-            self._cell_data_caches[key] = {}
-
     def get_next(self, instance):
         """
         Returns the item after instance in the list.


More information about the POS-commit mailing list