/[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 496 by jonathan, Mon Mar 10 10:54:50 2003 UTC revision 500 by jonathan, Mon Mar 10 15:11:24 2003 UTC
# Line 85  class ClassGrid(wxGrid): Line 85  class ClassGrid(wxGrid):
85          self.shapeType = shapeType          self.shapeType = shapeType
86          table = self.GetTable()          table = self.GetTable()
87          if table is None:          if table is None:
88                w = self.GetDefaultColSize() * 3 + self.GetDefaultRowLabelSize()
89                h = self.GetDefaultRowSize() * 4 + self.GetDefaultColLabelSize()
90                self.SetDimensions(-1, -1, w, h)
91                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)
# Line 279  class ClassTable(wxPyGridTableBase): Line 283  class ClassTable(wxPyGridTableBase):
283    
284          self.__NotifyRowChanges(old_len, len(self.tdata))          self.__NotifyRowChanges(old_len, len(self.tdata))
285    
         view = self.GetView()  
         w = view.GetDefaultColSize() * 3 + view.GetDefaultRowLabelSize()  
         h = view.GetDefaultRowSize() * 4 + view.GetDefaultColLabelSize()  
         view.SetDimensions(-1, -1, w, h)  
         view.SetSizeHints(w, h, -1, -1)  
286                            
287          self.GetView().EndBatch()          self.GetView().EndBatch()
288    
# Line 759  class Classifier(NonModalDialog): Line 758  class Classifier(NonModalDialog):
758    
759    
760    
761      type2string = {None:             "None",      type2string = {None:             _("None"),
762                     FIELDTYPE_STRING: "Text",                     FIELDTYPE_STRING: _("Text"),
763                     FIELDTYPE_INT:    "Integer",                     FIELDTYPE_INT:    _("Integer"),
764                     FIELDTYPE_DOUBLE: "Decimal"}                     FIELDTYPE_DOUBLE: _("Decimal")}
765    
766      def __SetFieldTypeText(self, fieldIndex):      def __SetFieldTypeText(self, fieldIndex):
767          fieldName = self.fields.GetString(fieldIndex)          fieldName = self.fields.GetString(fieldIndex)
# Line 774  class Classifier(NonModalDialog): Line 773  class Classifier(NonModalDialog):
773    
774          self.fieldTypeText.SetLabel(_("Field Type: %s") % text)          self.fieldTypeText.SetLabel(_("Field Type: %s") % text)
775    
776      def __SelectField(self, fieldIndex):      def __SelectField(self, newIndex, oldIndex = -1):
         clazz = self.__BuildClassification(fieldIndex)  
         self.fields.SetClientData(fieldIndex, clazz)  
777    
778          self.__cur_field = self.fields.GetSelection()          assert(oldIndex >= -1)
         self.__SetGridTable(fieldIndex)  
779    
780          enabled = fieldIndex != 0          if oldIndex != -1:
781                clazz = self.__BuildClassification(oldIndex)
782                self.fields.SetClientData(oldIndex, clazz)
783    
784            self.__SetGridTable(newIndex)
785    
786            enabled = newIndex != 0
787    
788          for b in self.controlButtons:          for b in self.controlButtons:
789              b.Enable(enabled)              b.Enable(enabled)
790    
791          self.__SetFieldTypeText(fieldIndex)          self.__SetFieldTypeText(newIndex)
792    
793    
794      def _OnFieldSelect(self, event):      def _OnFieldSelect(self, event):
795          self.__SelectField(self.__cur_field)          index = self.fields.GetSelection()
796            self.__SelectField(index, self.__cur_field)
797            self.__cur_field = index
798    
799      def _OnApply(self, event):      def _OnApply(self, event):
800          """Put the data from the table into a new Classification and hand          """Put the data from the table into a new Classification and hand
# Line 891  class SelectPropertiesDialog(wxDialog): Line 895  class SelectPropertiesDialog(wxDialog):
895    
896          lineColorBox = wxBoxSizer(wxHORIZONTAL)          lineColorBox = wxBoxSizer(wxHORIZONTAL)
897          lineColorBox.Add(          lineColorBox.Add(
898              wxButton(self, ID_SELPROP_STROKECLR, "Change Line Color"),              wxButton(self, ID_SELPROP_STROKECLR, _("Change Line Color")),
899              1, wxALL | wxGROW, 4)              1, wxALL | wxGROW, 4)
900          EVT_BUTTON(self, ID_SELPROP_STROKECLR, self._OnChangeLineColor)          EVT_BUTTON(self, ID_SELPROP_STROKECLR, self._OnChangeLineColor)
901    
902          lineColorBox.Add(          lineColorBox.Add(
903              wxButton(self, ID_SELPROP_STROKECLRTRANS, "Transparent"),              wxButton(self, ID_SELPROP_STROKECLRTRANS, _("Transparent")),
904              1, wxALL | wxGROW, 4)              1, wxALL | wxGROW, 4)
905          EVT_BUTTON(self, ID_SELPROP_STROKECLRTRANS,          EVT_BUTTON(self, ID_SELPROP_STROKECLRTRANS,
906                     self._OnChangeLineColorTrans)                     self._OnChangeLineColorTrans)
# Line 907  class SelectPropertiesDialog(wxDialog): Line 911  class SelectPropertiesDialog(wxDialog):
911          if shapeType != SHAPETYPE_ARC:          if shapeType != SHAPETYPE_ARC:
912              fillColorBox = wxBoxSizer(wxHORIZONTAL)              fillColorBox = wxBoxSizer(wxHORIZONTAL)
913              fillColorBox.Add(              fillColorBox.Add(
914                  wxButton(self, ID_SELPROP_FILLCLR, "Change Fill Color"),                  wxButton(self, ID_SELPROP_FILLCLR, _("Change Fill Color")),
915                  1, wxALL | wxGROW, 4)                  1, wxALL | wxGROW, 4)
916              EVT_BUTTON(self, ID_SELPROP_FILLCLR, self._OnChangeFillColor)              EVT_BUTTON(self, ID_SELPROP_FILLCLR, self._OnChangeFillColor)
917              fillColorBox.Add(              fillColorBox.Add(
918                  wxButton(self, ID_SELPROP_FILLCLRTRANS, "Transparent"),                  wxButton(self, ID_SELPROP_FILLCLRTRANS, _("Transparent")),
919                  1, wxALL | wxGROW, 4)                  1, wxALL | wxGROW, 4)
920              EVT_BUTTON(self, ID_SELPROP_FILLCLRTRANS,              EVT_BUTTON(self, ID_SELPROP_FILLCLRTRANS,
921                         self._OnChangeFillColorTrans)                         self._OnChangeFillColorTrans)

Legend:
Removed from v.496  
changed lines
  Added in v.500

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26