adds a freeze_everything possibility
[tiramisu.git] / tiramisu / setting.py
index 3798ba7..d1dcb6e 100644 (file)
@@ -114,9 +114,10 @@ class Setting():
     frozen = True
     # enables validation function for options if set
     validator = False
-   # generic owner
+    # generic owner
     owner = owners.user
-
+    # in order to freeze everything, not **only** the frozen options
+    everything_frozen = False
     #____________________________________________________________
     # properties methods
     def has_properties(self):
@@ -142,11 +143,27 @@ class Setting():
         if not isinstance(permissive, list):
             raise TypeError('permissive must be a list')
         self.permissive = permissive
+    #____________________________________________________________
+    # complete freeze methods
+    def freeze_everything(self):
+        """everything is frozen, not only the option that are tagged "frozen"
+        """
+        self.everything_frozen = True
 
+    def un_freeze_everything(self):
+        """everything is frozen, not only the option that are tagged "frozen"
+        """
+        self.everything_frozen = False
+
+    def is_frozen_for_everything(self):
+        """frozen for a whole config (not only the options
+        that have been set to frozen)"""
+        return self.everything_frozen
+    #____________________________________________________________
     def read_only(self):
         "convenience method to freeze, hidde and disable"
-        # FIXME LE FREEZE NE MARCHE PAS
-        self.freeze()
+        self.freeze_everything()
+        self.freeze() # can be usefull...
         self.disable_property('hidden')
         self.enable_property('disabled')
         self.mandatory = True
@@ -154,7 +171,7 @@ class Setting():
 
     def read_write(self):
         "convenience method to freeze, hidde and disable"
-        # FIXME : POURQUOI UN FREEZE ICI ?
+        self.un_freeze_everything()
         self.freeze()
         self.enable_property('hidden')
         self.enable_property('disabled')