Hello Benjamin,

> could you try the attached patch please?
I was working on a patch myself (attached), but yours is shorter.
Both patches do work.

Thanks for the quick response!

Bye,
Thomas

-- 
Thomas Fischer
Senior Lecturer, Doctor of Engineering
School of Informatics
University of Skövde, Sweden
https://www.his.se/fish
diff -Naur _sdaps-1.1.11_orig/sdaps/model/data.py sdaps-1.1.11/sdaps/model/data.py
--- _sdaps-1.1.11_orig/sdaps/model/data.py	2014-04-12 01:20:46.000000000 +0200
+++ sdaps-1.1.11/sdaps/model/data.py	2016-12-21 11:22:48.369021567 +0100
@@ -27,6 +27,9 @@
         self.y = parent.y
         self.width = parent.width
         self.height = parent.height
+        
+        # A flag to (temporarily) disable calls to  notify_data_changed(..)
+        self._enable_notification = True
 
         # Set _parent last, so that we don't trigger notifications
         # during __init__
@@ -43,7 +46,7 @@
         if name.startswith('_'):
             return
 
-        if value != old_value and hasattr(self, '_parent') and self._parent is not None:
+        if (not hasattr(self, '_enable_notification') or self._enable_notification) and value != old_value and hasattr(self, '_parent') and self._parent is not None:
             self._parent.question.questionnaire.notify_data_changed(self._parent, self, name, old_value)
 
     def __getstate__(self):
@@ -70,7 +73,12 @@
     def __init__(self, parent):
         Box.__init__(self, parent)
 
+        self._enable_notification = False
         self.text = unicode()
+        self._enable_notification = True
+        
+        # override __setattr__
+        self.__setattr__ = self.__setattr_impl
 
 
 class Additional_Mark(object):

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to