Corrected image reloading in SingleObjectView._rowChanged. Fixes ticket #69.
authorJoel Rosdahl <joel@rosdahl.net>
Sat, 29 Jan 2005 21:43:59 +0000 (21:43 +0000)
committerJoel Rosdahl <joel@rosdahl.net>
Sat, 29 Jan 2005 21:43:59 +0000 (21:43 +0000)
Freeze views in ObjectCollection.__insertionWorker to avoid excessive
amounts of row_changed callbacks when inserting a new object.

src/gkofoto/gkofoto/objectcollection.py
src/gkofoto/gkofoto/singleobjectview.py

index 0863fb9..7a03938 100644 (file)
@@ -253,6 +253,7 @@ class ObjectCollection(object):
 
     def __insertionWorker(self, objectList, location):
         for obj in objectList:
+            self._freezeViews()
             iterator = self.__treeModel.insert(location)
             self.__treeModel.set_value(iterator, self.COLUMN_OBJECT_ID, obj.getId())
             if obj.isAlbum():
@@ -271,6 +272,7 @@ class ObjectCollection(object):
                     column = self.__objectMetadataMap["@" + attribute][self.COLUMN_NR]
                     self.__treeModel.set_value(iterator, column, value)
             self.__treeModel.set_value(iterator, self.COLUMN_ROW_EDITABLE, True)
+            self._thawViews()
             self.signalRowInserted()
             self.__loadThumbnail(self.__treeModel, iterator)
             location += 1
index 6cd7ce9..4e3bf92 100644 (file)
@@ -145,11 +145,13 @@ class SingleObjectView(ObjectCollectionView, ImageView):
     def _rowChanged(self, model, path, iter, arg, *unused):
         if path[0] == self.__selectedRowNr:
             env.debug("selected object in SingleObjectView changed")
-            objectSelection = self._objectCollection.getObjectSelection()
-            obj = objectSelection[path[0]]
+            oc = self._objectCollection
+            model = oc.getUnsortedModel()
+            objid = model.get_value(model.get_iter(path), oc.COLUMN_OBJECT_ID)
+            obj = env.shelf.getObject(objid)
             if not obj.isAlbum():
                 self.loadFile(obj.getLocation(), True)
-        
+
     def _goto(self, button, direction):
         objectSelection = self._objectCollection.getObjectSelection()
         objectSelection.setSelection([self.__selectedRowNr + direction])