/[thuban]/trunk/thuban/Thuban/UI/classifier.py
ViewVC logotype

Diff of /trunk/thuban/Thuban/UI/classifier.py

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

revision 1207 by bh, Fri Jun 13 18:16:10 2003 UTC revision 1307 by jonathan, Thu Jun 26 17:00:17 2003 UTC
# Line 706  class Classifier(NonModalNonParentDialog Line 706  class Classifier(NonModalNonParentDialog
706              field = self.originalClass.GetField()              field = self.originalClass.GetField()
707              fieldType = self.originalClass.GetFieldType()              fieldType = self.originalClass.GetFieldType()
708    
709                table = layer.ShapeStore().Table()
710              #              #
711              # make field choice box              # make field choice box
712              #              #
713              self.fields = wxChoice(panel, ID_PROPERTY_SELECT,)              self.fields = wxChoice(panel, ID_PROPERTY_SELECT,)
714    
715              self.num_cols = layer.table.NumColumns()              self.num_cols = table.NumColumns()
716              # just assume the first field in case one hasn't been              # just assume the first field in case one hasn't been
717              # specified in the file.              # specified in the file.
718              self.__cur_field = 0              self.__cur_field = 0
# Line 724  class Classifier(NonModalNonParentDialog Line 725  class Classifier(NonModalNonParentDialog
725                  self.fields.SetClientData(0, None)                  self.fields.SetClientData(0, None)
726    
727              for i in range(self.num_cols):              for i in range(self.num_cols):
728                  name = layer.table.Column(i).name                  name = table.Column(i).name
729                  self.fields.Append(name)                  self.fields.Append(name)
730    
731                  if name == field:                  if name == field:
# Line 876  class Classifier(NonModalNonParentDialog Line 877  class Classifier(NonModalNonParentDialog
877    
878          # get a new ClassGroupProperties object and copy the          # get a new ClassGroupProperties object and copy the
879          # values over to our current object          # values over to our current object
880          propDlg = SelectPropertiesDialog(NULL, prop, self.layer.ShapeType())          propDlg = SelectPropertiesDialog(self, prop, self.layer.ShapeType())
881    
882          self.Enable(False)          self.Enable(False)
883          if propDlg.ShowModal() == wxID_OK:          if propDlg.ShowModal() == wxID_OK:
# Line 960  class Classifier(NonModalNonParentDialog Line 961  class Classifier(NonModalNonParentDialog
961    
962          self.__SetGridTable(newIndex, group)          self.__SetGridTable(newIndex, group)
963    
964          self.__EnableButtons(EB_SELECT_FIELD, newIndex != 0)          self.__EnableButtons(EB_SELECT_FIELD)
965    
966          self.__SetFieldTypeText(newIndex)          self.__SetFieldTypeText(newIndex)
967    
# Line 1037  class Classifier(NonModalNonParentDialog Line 1038  class Classifier(NonModalNonParentDialog
1038    
1039          EVT_CLOSE(self.genDlg, self._OnGenDialogClose)          EVT_CLOSE(self.genDlg, self._OnGenDialogClose)
1040    
1041          self.__EnableButtons(EB_GEN_CLASS, False)          self.__EnableButtons(EB_GEN_CLASS)
1042    
1043          self.genDlg.Show()          self.genDlg.Show()
1044    
1045      def _OnGenDialogClose(self, event):      def _OnGenDialogClose(self, event):
1046          self.genDlg.Destroy()          self.genDlg.Destroy()
1047          self.__EnableButtons(EB_GEN_CLASS, True)          self.genDlg = None
1048            self.__EnableButtons(EB_GEN_CLASS)
1049    
1050      def _OnMoveUp(self, event):      def _OnMoveUp(self, event):
1051          sel = self.classGrid.GetCurrentSelection()          sel = self.classGrid.GetCurrentSelection()
# Line 1081  class Classifier(NonModalNonParentDialog Line 1083  class Classifier(NonModalNonParentDialog
1083          self.layer.SetTitle(obj.GetValue())          self.layer.SetTitle(obj.GetValue())
1084          self.__SetTitle(self.layer.Title())          self.__SetTitle(self.layer.Title())
1085    
1086          self.__EnableButtons(EB_LAYER_TITLE, self.layer.Title() != "")          self.__EnableButtons(EB_LAYER_TITLE)
1087    
1088      def __EnableButtons(self, case, enable):      def __EnableButtons(self, case):
1089    
1090            list = {wxID_OK                 : True,
1091                    wxID_CANCEL             : True,
1092                    ID_PROPERTY_ADD         : True,
1093                    ID_PROPERTY_MOVEUP      : True,
1094                    ID_PROPERTY_MOVEDOWN    : True,
1095                    ID_PROPERTY_REMOVE      : True,
1096                    ID_PROPERTY_SELECT      : True,
1097                    ID_PROPERTY_FIELDTEXT   : True,
1098                    ID_PROPERTY_GENCLASS    : True,
1099                    ID_PROPERTY_EDITSYM     : True}
1100    
1101          if case == EB_LAYER_TITLE:            if case == EB_LAYER_TITLE:  
1102              list = (wxID_OK,              if self.layer.Title() == "":
1103                      wxID_CANCEL)                  list[wxID_OK] = False
1104                    list[wxID_CANCEL] = False
1105    
1106          elif case == EB_SELECT_FIELD:          elif case == EB_SELECT_FIELD:
1107              list = (ID_PROPERTY_GENCLASS,              if self.fields.GetSelection() == 0:
1108                      ID_PROPERTY_ADD,                  list[ID_PROPERTY_GENCLASS] = False
1109                      ID_PROPERTY_MOVEUP,                  list[ID_PROPERTY_ADD] = False
1110                      ID_PROPERTY_MOVEDOWN,                  list[ID_PROPERTY_MOVEUP] = False
1111                      ID_PROPERTY_EDITSYM,                  list[ID_PROPERTY_MOVEDOWN] = False
1112                      ID_PROPERTY_REMOVE)                  list[ID_PROPERTY_REMOVE] = False
1113    
1114          elif case == EB_GEN_CLASS:          elif case == EB_GEN_CLASS:
1115              list = (ID_PROPERTY_SELECT,              if self.genDlg is not None:
1116                      ID_PROPERTY_FIELDTEXT,                  list[ID_PROPERTY_SELECT] = False
1117                      ID_PROPERTY_GENCLASS,                  list[ID_PROPERTY_FIELDTEXT] = False
1118                      ID_PROPERTY_EDITSYM)                  list[ID_PROPERTY_GENCLASS] = False
1119    
1120          for id in list:          for id, enable in list.items():
1121              self.FindWindowById(id).Enable(enable)              win = self.FindWindowById(id)
1122                if win:
1123                    win.Enable(enable)
1124    
1125  ID_SELPROP_SPINCTRL = 4002  ID_SELPROP_SPINCTRL = 4002
1126  ID_SELPROP_PREVIEW = 4003  ID_SELPROP_PREVIEW = 4003
# Line 1370  class ClassGroupPropertiesCtrl(wxWindow, Line 1386  class ClassGroupPropertiesCtrl(wxWindow,
1386    
1387          wxWindow.__init__(self, parent, id, size = size, style = style)          wxWindow.__init__(self, parent, id, size = size, style = style)
1388    
1389            self.parent = parent
1390    
1391          self.SetProperties(props)          self.SetProperties(props)
1392          self.SetShapeType(shapeType)          self.SetShapeType(shapeType)
1393          self.AllowEdit(True)          self.AllowEdit(True)
# Line 1413  class ClassGroupPropertiesCtrl(wxWindow, Line 1431  class ClassGroupPropertiesCtrl(wxWindow,
1431      def DoEdit(self):      def DoEdit(self):
1432          if not self.allowEdit: return          if not self.allowEdit: return
1433    
1434          propDlg = SelectPropertiesDialog(NULL,          propDlg = SelectPropertiesDialog(self.parent,
1435                                           self.GetProperties(),                                           self.GetProperties(),
1436                                           self.GetShapeType())                                           self.GetShapeType())
1437    

Legend:
Removed from v.1207  
changed lines
  Added in v.1307

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26