/[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 650 by jonathan, Fri Apr 11 14:27:41 2003 UTC revision 782 by jonathan, Tue Apr 29 16:53:55 2003 UTC
# Line 398  class ClassTable(wxPyGridTableBase): Line 398  class ClassTable(wxPyGridTableBase):
398              if isinstance(group, ClassGroupMap):       return _("Map")              if isinstance(group, ClassGroupMap):       return _("Map")
399    
400          assert False # shouldn't get here          assert False # shouldn't get here
401          return _("")          return ""
402    
403      def GetNumberRows(self):      def GetNumberRows(self):
404          """Return the number of rows."""          """Return the number of rows."""
# Line 478  class ClassTable(wxPyGridTableBase): Line 478  class ClassTable(wxPyGridTableBase):
478          elif type in (FIELDTYPE_INT, FIELDTYPE_DOUBLE):          elif type in (FIELDTYPE_INT, FIELDTYPE_DOUBLE):
479    
480              if type == FIELDTYPE_INT:              if type == FIELDTYPE_INT:
481                    # the float call allows the user to enter 1.0 for 1
482                  conv = lambda p: int(float(p))                  conv = lambda p: int(float(p))
483              else:              else:
484                  conv = lambda p: p                  conv = lambda p: p
# Line 492  class ClassTable(wxPyGridTableBase): Line 493  class ClassTable(wxPyGridTableBase):
493              # function.              # function.
494              #              #
495              try:              try:
496                  return (conv(Str2Num(value)),)                  return (conv(value),)
497              except ValueError:              except ValueError:
498                  i = value.find('-')                  i = value.find('-')
499                  if i == 0:                  if i == 0:
500                      i = value.find('-', 1)                      i = value.find('-', 1)
501    
502                  return (conv(Str2Num(value[:i])), conv(Str2Num(value[i+1:])))                  return (conv(value[:i]), conv(value[i+1:]))
503    
504          assert False  # shouldn't get here          assert False  # shouldn't get here
505          return (0,)          return (0,)
# Line 558  class ClassTable(wxPyGridTableBase): Line 559  class ClassTable(wxPyGridTableBase):
559                      #                      #
560                      if len(dataInfo) == 1:                      if len(dataInfo) == 1:
561                          if not isinstance(group, ClassGroupSingleton):                          if not isinstance(group, ClassGroupSingleton):
562                              ngroup = ClassGroupSingleton(prop = props)                              ngroup = ClassGroupSingleton(props = props)
563                              changed = True                              changed = True
564                          ngroup.SetValue(dataInfo[0])                          ngroup.SetValue(dataInfo[0])
565                      elif len(dataInfo) == 2:                      elif len(dataInfo) == 2:
566                          if not isinstance(group, ClassGroupRange):                          if not isinstance(group, ClassGroupRange):
567                              ngroup = ClassGroupRange(prop = props)                              ngroup = ClassGroupRange(props = props)
568                              changed = True                              changed = True
569                          ngroup.SetRange(dataInfo[0], dataInfo[1])                          ngroup.SetRange(dataInfo[0], dataInfo[1])
570                      else:                      else:
# Line 697  class Classifier(NonModalDialog): Line 698  class Classifier(NonModalDialog):
698    
699          topBox = wxBoxSizer(wxVERTICAL)          topBox = wxBoxSizer(wxVERTICAL)
700    
701            panel = wxPanel(self, -1, size=(100, 100))
702    
703            panelBox = wxBoxSizer(wxVERTICAL)
704    
705          sizer = wxBoxSizer(wxHORIZONTAL)          sizer = wxBoxSizer(wxHORIZONTAL)
706          sizer.Add(wxStaticText(self, -1, _("Title: ")),          sizer.Add(wxStaticText(panel, -1, _("Title: ")),
707              0, wxALIGN_LEFT | wxALL | wxALIGN_CENTER_VERTICAL, 4)              0, wxALIGN_LEFT | wxALL | wxALIGN_CENTER_VERTICAL, 4)
708          sizer.Add(wxTextCtrl(self, ID_PROPERTY_TITLE, layer.Title()),          sizer.Add(wxTextCtrl(panel, ID_PROPERTY_TITLE, layer.Title()),
709                    1, wxGROW | wxALL, 4)                    1, wxGROW | wxALL, 4)
710          EVT_TEXT(self, ID_PROPERTY_TITLE, self._OnTitleChanged)          EVT_TEXT(self, ID_PROPERTY_TITLE, self._OnTitleChanged)
711    
712          topBox.Add(sizer, 0, wxGROW, 4)          panelBox.Add(sizer, 0, wxGROW, 4)
713    
714          topBox.Add(wxStaticText(self, -1,          panelBox.Add(wxStaticText(panel, -1,
715                                  _("Type: %s") % layer.ShapeType()),                                  _("Type: %s") % layer.ShapeType()),
716              0, wxALIGN_LEFT | wxALL, 4)              0, wxALIGN_LEFT | wxALL, 4)
717    
         panel = wxPanel(self, -1, size=(100, 100))  
718    
719          #####################          #####################
720    
721          #panelBox = wxBoxSizer(wxVERTICAL)          #panelBox = wxBoxSizer(wxVERTICAL)
722          panelBox = wxStaticBoxSizer(          classBox = wxStaticBoxSizer(
723                      wxStaticBox(panel, -1, _("Classification")), wxVERTICAL)                      wxStaticBox(panel, -1, _("Classification")), wxVERTICAL)
724    
725    
726          #          #
727          # make field combo box          # make field choice box
728          #          #
729          self.fields = wxComboBox(panel, ID_PROPERTY_SELECT, "",          self.fields = wxChoice(panel, ID_PROPERTY_SELECT,)
730                                       style = wxCB_READONLY)          #self.fields = wxComboBox(panel, ID_PROPERTY_SELECT, "",
731            #                             style = wxCB_READONLY)
732    
733          self.num_cols = layer.table.field_count()          self.num_cols = layer.table.field_count()
734          # just assume the first field in case one hasn't been          # just assume the first field in case one hasn't been
# Line 756  class Classifier(NonModalDialog): Line 761  class Classifier(NonModalDialog):
761          sizer.Add(wxStaticText(panel, ID_PROPERTY_FIELDTEXT, _("Field: ")),          sizer.Add(wxStaticText(panel, ID_PROPERTY_FIELDTEXT, _("Field: ")),
762              0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 4)              0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL | wxALL, 4)
763          sizer.Add(self.fields, 1, wxGROW | wxALL, 4)          sizer.Add(self.fields, 1, wxGROW | wxALL, 4)
764          EVT_COMBOBOX(self, ID_PROPERTY_SELECT, self._OnFieldSelect)          EVT_CHOICE(self, ID_PROPERTY_SELECT, self._OnFieldSelect)
765            #EVT_COMBOBOX(self, ID_PROPERTY_SELECT, self._OnFieldSelect)
766    
767          panelBox.Add(sizer, 0, wxGROW, 4)          classBox.Add(sizer, 0, wxGROW, 4)
768    
769          self.fieldTypeText = wxStaticText(panel, -1, "")          self.fieldTypeText = wxStaticText(panel, -1, "")
770          panelBox.Add(self.fieldTypeText, 0,          classBox.Add(self.fieldTypeText, 0,
771                       wxGROW | wxALIGN_LEFT | wxALL | wxADJUST_MINSIZE, 4)                       wxGROW | wxALIGN_LEFT | wxALL | wxADJUST_MINSIZE, 4)
772    
773    
# Line 811  class Classifier(NonModalDialog): Line 817  class Classifier(NonModalDialog):
817          self.__SelectField(self.__cur_field, group = group)          self.__SelectField(self.__cur_field, group = group)
818    
819          controlBox.Add(self.classGrid, 1, wxGROW, 0)          controlBox.Add(self.classGrid, 1, wxGROW, 0)
   
820          controlBox.Add(controlButtonBox, 0, wxGROW, 10)          controlBox.Add(controlButtonBox, 0, wxGROW, 10)
821          panelBox.Add(controlBox, 1, wxGROW, 10)  
822            classBox.Add(controlBox, 1, wxGROW, 10)
823            panelBox.Add(classBox, 1, wxGROW, 0)
824    
825          EVT_BUTTON(self, ID_PROPERTY_ADD, self._OnAdd)          EVT_BUTTON(self, ID_PROPERTY_ADD, self._OnAdd)
826          EVT_BUTTON(self, ID_PROPERTY_EDITSYM, self._OnEditSymbol)          EVT_BUTTON(self, ID_PROPERTY_EDITSYM, self._OnEditSymbol)
# Line 824  class Classifier(NonModalDialog): Line 831  class Classifier(NonModalDialog):
831    
832          ###########          ###########
833    
834    
835          panel.SetAutoLayout(True)          panel.SetAutoLayout(True)
836          panel.SetSizer(panelBox)          panel.SetSizer(panelBox)
837          panelBox.SetSizeHints(panel)          panelBox.SetSizeHints(panel)

Legend:
Removed from v.650  
changed lines
  Added in v.782

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26