Bug fix (or rather workaround): In the object collection model, don't
authorJoel Rosdahl <joel@rosdahl.net>
Thu, 29 Jul 2004 11:05:37 +0000 (11:05 +0000)
committerJoel Rosdahl <joel@rosdahl.net>
Thu, 29 Jul 2004 11:05:37 +0000 (11:05 +0000)
try to set attributes that don't exist in the model (attributes
appearing in newly registered images). (The attribute columns in the
model are created when the model is constructed and it seems hard to
add columns afterwards.)

src/gkofoto/objectcollection.py

index 029bd24..4e01fed 100644 (file)
@@ -241,8 +241,9 @@ class ObjectCollection(object):
                 self.__nrOfImages += 1
                 # TODO Set COLUMN_VALID_LOCATION and COLUMN_VALID_CHECKSUM
             for attribute, value in obj.getAttributeMap().items():
-                column = self.__objectMetadataMap["@" + attribute][self.COLUMN_NR]
-                self.__treeModel.set_value(iterator, column, value)
+                if "@" + attribute in self.__objectMetadataMap:
+                    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.__loadThumbnail(self.__treeModel, iterator)
             location += 1