diff options
author | Olivier Tilloy <olivier@tilloy.net> | 2009-07-14 09:38:16 +0200 |
---|---|---|
committer | Olivier Tilloy <olivier@tilloy.net> | 2009-07-14 09:38:16 +0200 |
commit | 9c7fa0a73e9c8868ac03c3640edebf6751d6ee01 (patch) | |
tree | 3bb6a954f3935dab5ea8651a14913df2307c9b1a | |
parent | 02f0b6a062532f26e316688782ec323315d2fd35 (diff) | |
download | pyexiv2-9c7fa0a73e9c8868ac03c3640edebf6751d6ee01.tar.gz |
Make an IPTC tag's values a notifying list.
-rw-r--r-- | src/pyexiv2.py | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/pyexiv2.py b/src/pyexiv2.py index f5d60ed..f4c0942 100644 --- a/src/pyexiv2.py +++ b/src/pyexiv2.py @@ -709,8 +709,10 @@ class IptcTag(MetadataTag): def __init__(self, key, name, label, description, xtype, values): super(IptcTag, self).__init__(key, name, label, description, xtype, values) - # FIXME: make values a notifying list - self._values = map(lambda x: IptcTag._convert_to_python(x, xtype), values) + # Make values a notifying list + values = map(lambda x: IptcTag._convert_to_python(x, xtype), values) + self._values = NotifyingList(values) + self._values.register_listener(self) def _get_values(self): return self._values @@ -719,8 +721,11 @@ class IptcTag(MetadataTag): if self.metadata is not None: raw_values = map(lambda x: IptcTag._convert_to_string(x, self.xtype), new_values) self.metadata._set_iptc_tag_values(self.key, raw_values) - # FIXME: make values a notifying list if needed - self._values = new_values + # Make values a notifying list if needed + if isinstance(new_values, NotifyingList): + self._values = new_values + else: + self._values = NotifyingList(new_values) def _del_values(self): if self.metadata is not None: |