/[thuban]/branches/WIP-pyshapelib-bramz/Thuban/UI/classifier.py
ViewVC logotype

Diff of /branches/WIP-pyshapelib-bramz/Thuban/UI/classifier.py

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

revision 1446 by jonathan, Wed Jul 16 13:24:25 2003 UTC revision 1447 by jonathan, Thu Jul 17 14:59:29 2003 UTC
# Line 891  class Classifier(NonModalNonParentDialog Line 891  class Classifier(NonModalNonParentDialog
891          self.fields.SetClientData(self.__cur_field, clazz)          self.fields.SetClientData(self.__cur_field, clazz)
892          self.classGrid.GetTable().SetClassification(clazz)          self.classGrid.GetTable().SetClassification(clazz)
893    
894      def __BuildClassification(self, fieldIndex, copyClass = False):      def __BuildClassification(self, fieldIndex, copyClass=False, force=False):
895    
896  #       numRows = self.classGrid.GetNumberRows()  #       numRows = self.classGrid.GetNumberRows()
897  #       assert numRows > 0  # there should always be a default row  #       assert numRows > 0  # there should always be a default row
# Line 903  class Classifier(NonModalNonParentDialog Line 903  class Classifier(NonModalNonParentDialog
903              fieldName = self.fields.GetString(fieldIndex)              fieldName = self.fields.GetString(fieldIndex)
904              fieldType = self.layer.GetFieldType(fieldName)              fieldType = self.layer.GetFieldType(fieldName)
905    
906          clazz = self.classGrid.GetTable().GetClassification()          clazz = self.fields.GetClientData(fieldIndex)
907            if clazz is None or self.classGrid.GetTable().IsModified() or force:
908          if copyClass:              clazz = self.classGrid.GetTable().GetClassification()
909              clazz = copy.deepcopy(clazz)              if copyClass:
910                    clazz = copy.deepcopy(clazz)
911    
912          return clazz          return clazz, fieldName
913    
914      def __SetGridTable(self, fieldIndex, group = None):      def __SetGridTable(self, fieldIndex, group = None):
915    
# Line 945  class Classifier(NonModalNonParentDialog Line 946  class Classifier(NonModalNonParentDialog
946          assert oldIndex >= -1          assert oldIndex >= -1
947    
948          if oldIndex != -1:          if oldIndex != -1:
949              clazz = self.__BuildClassification(oldIndex)              clazz, name = self.__BuildClassification(oldIndex, force = True)
950              self.fields.SetClientData(oldIndex, clazz)              self.fields.SetClientData(oldIndex, clazz)
951    
952          self.__SetGridTable(newIndex, group)          self.__SetGridTable(newIndex, group)
# Line 984  class Classifier(NonModalNonParentDialog Line 985  class Classifier(NonModalNonParentDialog
985              # to begin with or it has been modified              # to begin with or it has been modified
986              #              #
987              self.classGrid.SaveEditControlValue()              self.classGrid.SaveEditControlValue()
988              if clazz is None or self.classGrid.GetTable().IsModified():              clazz, name = self.__BuildClassification(self.__cur_field, True)
                 clazz = self.__BuildClassification(self.__cur_field, True)  
989    
990              self.layer.SetClassificationField(              self.layer.SetClassificationField(name)
                 self.fields.GetString(self.__cur_field))  
991              self.layer.SetClassification(clazz)              self.layer.SetClassification(clazz)
992    
993          self.haveApplied = True          self.haveApplied = True

Legend:
Removed from v.1446  
changed lines
  Added in v.1447

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26