Exemple #1
0
 def copy_from(self, other):
     changed = Item.copy_from(self, other)
     first, common, second = dict_diff(self.__items_dict, other.__items_dict)
     if first or second:
         changed = True
     for id in first:
         self.remove_item(id)
     for id in common:
         changed = self[id].copy_from(other[id]) or changed
     for id in second:
         self.add_item(other[id].copy())
     return changed
Exemple #2
0
        def copy_from(self, other):
            changed = Item.copy_from(self, other)
            first, common, second = dict_diff(self.__items, other.__items)

            if first or second:
                changed = True
            for key in first:
                del self[key]
            for key in second:
                self[key] = _copy_instance(other.__items[key])

            if issubclass(Dict.__elm_type__, Item):
                for key in common:
                    changed = self.__items[key].copy_from(other.__items[key]) or changed
            else:
                for key in common:
                    old = self.__items[key]
                    new = other.__items[key]
                    if old != new:
                        self.__items[key] = new
                        changed = True

            return changed