/[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 507 by jonathan, Mon Mar 10 17:36:42 2003 UTC revision 509 by jonathan, Tue Mar 11 09:45:59 2003 UTC
# Line 70  class ClassGrid(wxGrid): Line 70  class ClassGrid(wxGrid):
70    
71          #wxGrid.__init__(self, parent, ID_CLASS_TABLE, size = (340, 160))          #wxGrid.__init__(self, parent, ID_CLASS_TABLE, size = (340, 160))
72          wxGrid.__init__(self, parent, ID_CLASS_TABLE)          wxGrid.__init__(self, parent, ID_CLASS_TABLE)
73          #self.SetTable(ClassTable(fieldData, layer.ShapeType(), self), true)          #self.SetTable(ClassTable(fieldData, layer.ShapeType(), self), True)
74    
75          EVT_GRID_CELL_LEFT_DCLICK(self, self._OnCellDClick)          EVT_GRID_CELL_LEFT_DCLICK(self, self._OnCellDClick)
76          EVT_GRID_RANGE_SELECT(self, self._OnSelectedRange)          EVT_GRID_RANGE_SELECT(self, self._OnSelectedRange)
# Line 89  class ClassGrid(wxGrid): Line 89  class ClassGrid(wxGrid):
89              h = self.GetDefaultRowSize() * 4 + self.GetDefaultColLabelSize()              h = self.GetDefaultRowSize() * 4 + self.GetDefaultColLabelSize()
90              self.SetDimensions(-1, -1, w, h)              self.SetDimensions(-1, -1, w, h)
91              self.SetSizeHints(w, h, -1, -1)              self.SetSizeHints(w, h, -1, -1)
92              self.SetTable(ClassTable(clazz, self.shapeType, self), true)              self.SetTable(ClassTable(clazz, self.shapeType, self), True)
93          else:          else:
94              table.Reset(clazz, self.shapeType)              table.Reset(clazz, self.shapeType)
95    
# Line 583  class Classifier(NonModalDialog): Line 583  class Classifier(NonModalDialog):
583          NonModalDialog.__init__(self, parent, interactor, name,          NonModalDialog.__init__(self, parent, interactor, name,
584                                  _("Classifier: %s") % layer.Title())                                  _("Classifier: %s") % layer.Title())
585    
586            panel = wxPanel(self, -1)
587    
588          self.layer = layer          self.layer = layer
589    
590          self.originalClass = self.layer.GetClassification()          self.originalClass = self.layer.GetClassification()
# Line 591  class Classifier(NonModalDialog): Line 593  class Classifier(NonModalDialog):
593    
594          topBox = wxBoxSizer(wxVERTICAL)          topBox = wxBoxSizer(wxVERTICAL)
595    
596          #topBox.Add(wxStaticText(self, -1, _("Layer: %s") % layer.Title()),          #topBox.Add(wxStaticText(panel, -1, _("Layer: %s") % layer.Title()),
597              #0, wxALIGN_LEFT | wxALL, 4)              #0, wxALIGN_LEFT | wxALL, 4)
598          topBox.Add(wxStaticText(self, -1,          topBox.Add(wxStaticText(panel, -1,
599                                  _("Layer Type: %s") % layer.ShapeType()),                                  _("Layer Type: %s") % layer.ShapeType()),
600              0, wxALIGN_LEFT | wxALL, 4)              0, wxALIGN_LEFT | wxALL, 4)
601    
# Line 601  class Classifier(NonModalDialog): Line 603  class Classifier(NonModalDialog):
603          #          #
604          # make field combo box          # make field combo box
605          #          #
606          self.fields = wxComboBox(self, ID_PROPERTY_SELECT, "",          self.fields = wxComboBox(panel, ID_PROPERTY_SELECT, "",
607                                       style = wxCB_READONLY)                                       style = wxCB_READONLY)
608    
609          self.num_cols = layer.table.field_count()          self.num_cols = layer.table.field_count()
# Line 623  class Classifier(NonModalDialog): Line 625  class Classifier(NonModalDialog):
625                  self.fields.SetClientData(i + 1, None)                  self.fields.SetClientData(i + 1, None)
626    
627    
628          #          ###########
         #  
         #  
629    
630          self.fieldTypeText = wxStaticText(self, -1, "")          self.fieldTypeText = wxStaticText(panel, -1, "")
631          topBox.Add(self.fieldTypeText, 0, wxGROW | wxALIGN_LEFT | wxALL, 4)          topBox.Add(self.fieldTypeText, 0, wxGROW | wxALIGN_LEFT | wxALL, 4)
632    
633          propertyBox = wxBoxSizer(wxHORIZONTAL)          propertyBox = wxBoxSizer(wxHORIZONTAL)
634          propertyBox.Add(wxStaticText(self, -1, _("Field: ")),          propertyBox.Add(wxStaticText(panel, -1, _("Field: ")),
635              0, wxALIGN_LEFT | wxALL, 4)              0, wxALIGN_LEFT | wxALL, 4)
636          propertyBox.Add(self.fields, 1, wxGROW|wxALL, 4)          propertyBox.Add(self.fields, 1, wxGROW|wxALL, 4)
637          EVT_COMBOBOX(self, ID_PROPERTY_SELECT, self._OnFieldSelect)          EVT_COMBOBOX(self, ID_PROPERTY_SELECT, self._OnFieldSelect)
638    
639          topBox.Add(propertyBox, 0, wxGROW, 4)          topBox.Add(propertyBox, 0, wxGROW, 4)
640    
641            ###########
642          #          #
643          # Classification data table          # Classification data table
644          #          #
# Line 649  class Classifier(NonModalDialog): Line 650  class Classifier(NonModalDialog):
650    
651          controlBox.Add(self.classGrid, 1, wxGROW, 0)          controlBox.Add(self.classGrid, 1, wxGROW, 0)
652    
653          controlButtonBox = wxBoxSizer(wxVERTICAL)          ###########
   
654          #          #
655          # Control buttons:          # Control buttons:
656          #          #
657          self.controlButtons = []          self.controlButtons = []
658    
659          button = wxButton(self, ID_CLASSIFY_ADD, _("Add"))          controlButtonBox = wxBoxSizer(wxVERTICAL)
660    
661            button = wxButton(panel, ID_CLASSIFY_ADD, _("Add"))
662          controlButtonBox.Add(button, 0, wxGROW | wxALL, 4)          controlButtonBox.Add(button, 0, wxGROW | wxALL, 4)
663          self.controlButtons.append(button)          self.controlButtons.append(button)
664    
665          #button = wxButton(self, ID_CLASSIFY_GENRANGE, _("Generate Ranges"))          #button = wxButton(panel, ID_CLASSIFY_GENRANGE, _("Generate Ranges"))
666          #controlButtonBox.Add(button, 0, wxGROW | wxALL, 4)          #controlButtonBox.Add(button, 0, wxGROW | wxALL, 4)
667          #self.controlButtons.append(button)          #self.controlButtons.append(button)
668    
669          button = wxButton(self, ID_CLASSIFY_MOVEUP, _("Move Up"))          button = wxButton(panel, ID_CLASSIFY_MOVEUP, _("Move Up"))
670          controlButtonBox.Add(button, 0, wxGROW | wxALL, 4)          controlButtonBox.Add(button, 0, wxGROW | wxALL, 4)
671          self.controlButtons.append(button)          self.controlButtons.append(button)
672    
673          button = wxButton(self, ID_CLASSIFY_MOVEDOWN, _("Move Down"))          button = wxButton(panel, ID_CLASSIFY_MOVEDOWN, _("Move Down"))
674          controlButtonBox.Add(button, 0, wxGROW | wxALL, 4)          controlButtonBox.Add(button, 0, wxGROW | wxALL, 4)
675          self.controlButtons.append(button)          self.controlButtons.append(button)
676    
677          controlButtonBox.Add(60, 20, 0, wxGROW | wxALL | wxALIGN_BOTTOM, 4)          controlButtonBox.Add(60, 20, 0, wxGROW | wxALL | wxALIGN_BOTTOM, 4)
678    
679          button = wxButton(self, ID_CLASSIFY_REMOVE, _("Remove"))          button = wxButton(panel, ID_CLASSIFY_REMOVE, _("Remove"))
680          controlButtonBox.Add(button, 0, wxGROW | wxALL | wxALIGN_BOTTOM, 4)          controlButtonBox.Add(button, 0, wxGROW | wxALL | wxALIGN_BOTTOM, 4)
681          self.controlButtons.append(button)          self.controlButtons.append(button)
682    
683          controlBox.Add(controlButtonBox, 0, wxGROW, 10)          controlBox.Add(controlButtonBox, 0, wxGROW, 10)
684          topBox.Add(controlBox, 1, wxGROW, 10)          topBox.Add(controlBox, 0, wxGROW, 10)
685    
686          EVT_BUTTON(self, ID_CLASSIFY_ADD, self._OnAdd)          EVT_BUTTON(self, ID_CLASSIFY_ADD, self._OnAdd)
687          EVT_BUTTON(self, ID_CLASSIFY_REMOVE, self._OnRemove)          EVT_BUTTON(self, ID_CLASSIFY_REMOVE, self._OnRemove)
# Line 687  class Classifier(NonModalDialog): Line 689  class Classifier(NonModalDialog):
689          EVT_BUTTON(self, ID_CLASSIFY_MOVEUP, self._OnMoveUp)          EVT_BUTTON(self, ID_CLASSIFY_MOVEUP, self._OnMoveUp)
690          EVT_BUTTON(self, ID_CLASSIFY_MOVEDOWN, self._OnMoveDown)          EVT_BUTTON(self, ID_CLASSIFY_MOVEDOWN, self._OnMoveDown)
691    
692            ###########
693    
694          buttonBox = wxBoxSizer(wxHORIZONTAL)          buttonBox = wxBoxSizer(wxHORIZONTAL)
695          buttonBox.Add(wxButton(self, ID_CLASSIFY_OK, _("OK")),          buttonBox.Add(wxButton(panel, ID_CLASSIFY_OK, _("OK")),
696                        0, wxALL, 4)                        0, wxALL, 4)
697          buttonBox.Add(60, 20, 0, wxALL, 4)          buttonBox.Add(60, 20, 0, wxALL, 4)
698          buttonBox.Add(wxButton(self, ID_CLASSIFY_APPLY, _("Apply")),          buttonBox.Add(wxButton(panel, ID_CLASSIFY_APPLY, _("Apply")),
699                        0, wxALL, 4)                        0, wxALL, 4)
700          buttonBox.Add(60, 20, 0, wxALL, 4)          buttonBox.Add(60, 20, 0, wxALL, 4)
701          buttonBox.Add(wxButton(self, ID_CLASSIFY_CANCEL, _("Cancel")),          buttonBox.Add(wxButton(panel, ID_CLASSIFY_CANCEL, _("Cancel")),
702                        0, wxALL, 4)                        0, wxALL, 4)
703          topBox.Add(buttonBox, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_BOTTOM, 10)          topBox.Add(buttonBox, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_BOTTOM, 0)
704    
705          EVT_BUTTON(self, ID_CLASSIFY_OK, self._OnOK)          EVT_BUTTON(self, ID_CLASSIFY_OK, self._OnOK)
706          EVT_BUTTON(self, ID_CLASSIFY_APPLY, self._OnApply)          EVT_BUTTON(self, ID_CLASSIFY_APPLY, self._OnApply)
707          EVT_BUTTON(self, ID_CLASSIFY_CANCEL, self._OnCancel)          EVT_BUTTON(self, ID_CLASSIFY_CANCEL, self._OnCancel)
708    
709            ###########
710    
711          self.fields.SetSelection(self.__cur_field)          self.fields.SetSelection(self.__cur_field)
712          self.__SelectField(self.__cur_field)          self.__SelectField(self.__cur_field)
713    
714          self.SetAutoLayout(true)          panel.SetAutoLayout(True)
715          self.SetSizer(topBox)          panel.SetSizer(topBox)
716          topBox.Fit(self)  
717          topBox.SetSizeHints(self)          topBox.SetSizeHints(panel)
718            topBox.Fit(panel)
719    
720            self.SetAutoLayout(True)
721            self.Fit()
722    
723    
724      def __BuildClassification(self, fieldIndex):      def __BuildClassification(self, fieldIndex):
# Line 948  class SelectPropertiesDialog(wxDialog): Line 958  class SelectPropertiesDialog(wxDialog):
958          EVT_BUTTON(self, ID_SELPROP_OK, self._OnOK)          EVT_BUTTON(self, ID_SELPROP_OK, self._OnOK)
959          EVT_BUTTON(self, ID_SELPROP_CANCEL, self._OnCancel)          EVT_BUTTON(self, ID_SELPROP_CANCEL, self._OnCancel)
960                                                                                                                                                                    
961          self.SetAutoLayout(true)          self.SetAutoLayout(True)
962          self.SetSizer(topBox)          self.SetSizer(topBox)
963          topBox.Fit(self)          topBox.Fit(self)
964          topBox.SetSizeHints(self)          topBox.SetSizeHints(self)

Legend:
Removed from v.507  
changed lines
  Added in v.509

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26