/[thuban]/branches/WIP-pyshapelib-bramz/Thuban/Model/classification.py
ViewVC logotype

Diff of /branches/WIP-pyshapelib-bramz/Thuban/Model/classification.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 527 by jonathan, Mon Mar 10 10:44:42 2003 UTC revision 528 by jonathan, Wed Mar 12 19:55:13 2003 UTC
# Line 60  class Classification: Line 60  class Classification:
60          self.fieldType = None          self.fieldType = None
61          self.groups = []          self.groups = []
62    
63            self.__setLayerLock = False
64    
65          self.SetDefaultGroup(ClassGroupDefault())          self.SetDefaultGroup(ClassGroupDefault())
66    
67          self.SetLayer(layer)          self.SetLayer(layer)
# Line 137  class Classification: Line 139  class Classification:
139             field type mismatch the information in the layer's table.             field type mismatch the information in the layer's table.
140          """          """
141    
142            # prevent infinite recursion when calling SetClassification()
143            if self.__setLayerLock: return
144    
145            self.__setLayerLock = True
146    
147          if layer is None:          if layer is None:
148              if self.layer is not None:              if self.layer is not None:
149                  l = self.layer                  l = self.layer
# Line 145  class Classification: Line 152  class Classification:
152          else:          else:
153              assert(isinstance(layer, Thuban.Model.layer.Layer))              assert(isinstance(layer, Thuban.Model.layer.Layer))
154    
             # prevent infinite recursion when calling SetClassification()  
             if layer == self.layer:  
                 return  
               
155              old_layer = self.layer              old_layer = self.layer
156    
157              self.layer = layer              self.layer = layer
# Line 157  class Classification: Line 160  class Classification:
160                  self.SetField(self.GetField()) # this sync's the fieldType                  self.SetField(self.GetField()) # this sync's the fieldType
161              except ValueError:              except ValueError:
162                  self.layer = old_layer                  self.layer = old_layer
163                    self.__setLayerLock = False
164                  raise ValueError                  raise ValueError
165              else:              else:
166                  self.layer.SetClassification(self)                  self.layer.SetClassification(self)
167    
168            self.__setLayerLock = False
169    
170      def GetLayer(self):      def GetLayer(self):
171          """Return the parent layer."""          """Return the parent layer."""
172          return self.layer          return self.layer

Legend:
Removed from v.527  
changed lines
  Added in v.528

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26