/[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 506 by jonathan, Mon Mar 10 15:49:22 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 629  class Classifier(NonModalDialog): Line 628  class Classifier(NonModalDialog):
628          #          #
629    
630          self.fieldTypeText = wxStaticText(self, -1, "")          self.fieldTypeText = wxStaticText(self, -1, "")
631          self.__SetFieldTypeText(self.__cur_field)          topBox.Add(self.fieldTypeText, 0, wxGROW | wxALIGN_LEFT | wxALL, 4)
   
         topBox.Add(self.fieldTypeText, 0, wxALIGN_LEFT | wxALL, 4)  
         #self.fieldTypeText.SetLabel("asdfadsfs")  
632    
633          propertyBox = wxBoxSizer(wxHORIZONTAL)          propertyBox = wxBoxSizer(wxHORIZONTAL)
634          propertyBox.Add(wxStaticText(self, -1, _("Field: ")),          propertyBox.Add(wxStaticText(self, -1, _("Field: ")),
635              0, wxALIGN_CENTER | 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    
# Line 759  class Classifier(NonModalDialog): Line 755  class Classifier(NonModalDialog):
755    
756    
757    
758      type2string = {None:             "None",      type2string = {None:             _("None"),
759                     FIELDTYPE_STRING: "Text",                     FIELDTYPE_STRING: _("Text"),
760                     FIELDTYPE_INT:    "Integer",                     FIELDTYPE_INT:    _("Integer"),
761                     FIELDTYPE_DOUBLE: "Decimal"}                     FIELDTYPE_DOUBLE: _("Decimal")}
762    
763      def __SetFieldTypeText(self, fieldIndex):      def __SetFieldTypeText(self, fieldIndex):
764          fieldName = self.fields.GetString(fieldIndex)          fieldName = self.fields.GetString(fieldIndex)
# Line 774  class Classifier(NonModalDialog): Line 770  class Classifier(NonModalDialog):
770    
771          self.fieldTypeText.SetLabel(_("Field Type: %s") % text)          self.fieldTypeText.SetLabel(_("Field Type: %s") % text)
772    
773      def __SelectField(self, fieldIndex):      def __SelectField(self, newIndex, oldIndex = -1):
774          clazz = self.__BuildClassification(fieldIndex)  
775          self.fields.SetClientData(fieldIndex, clazz)          assert(oldIndex >= -1)
776    
777          self.__cur_field = self.fields.GetSelection()          if oldIndex != -1:
778          self.__SetGridTable(fieldIndex)              clazz = self.__BuildClassification(oldIndex)
779                self.fields.SetClientData(oldIndex, clazz)
780    
781          enabled = fieldIndex != 0          self.__SetGridTable(newIndex)
782    
783            enabled = newIndex != 0
784    
785          for b in self.controlButtons:          for b in self.controlButtons:
786              b.Enable(enabled)              b.Enable(enabled)
787    
788          self.__SetFieldTypeText(fieldIndex)          self.__SetFieldTypeText(newIndex)
789    
790    
791      def _OnFieldSelect(self, event):      def _OnFieldSelect(self, event):
792          self.__SelectField(self.__cur_field)          index = self.fields.GetSelection()
793            self.__SelectField(index, self.__cur_field)
794            self.__cur_field = index
795    
796      def _OnApply(self, event):      def _OnApply(self, event):
797          """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 892  class SelectPropertiesDialog(wxDialog):
892    
893          lineColorBox = wxBoxSizer(wxHORIZONTAL)          lineColorBox = wxBoxSizer(wxHORIZONTAL)
894          lineColorBox.Add(          lineColorBox.Add(
895              wxButton(self, ID_SELPROP_STROKECLR, "Change Line Color"),              wxButton(self, ID_SELPROP_STROKECLR, _("Change Line Color")),
896              1, wxALL | wxGROW, 4)              1, wxALL | wxGROW, 4)
897          EVT_BUTTON(self, ID_SELPROP_STROKECLR, self._OnChangeLineColor)          EVT_BUTTON(self, ID_SELPROP_STROKECLR, self._OnChangeLineColor)
898    
899          lineColorBox.Add(          lineColorBox.Add(
900              wxButton(self, ID_SELPROP_STROKECLRTRANS, "Transparent"),              wxButton(self, ID_SELPROP_STROKECLRTRANS, _("Transparent")),
901              1, wxALL | wxGROW, 4)              1, wxALL | wxGROW, 4)
902          EVT_BUTTON(self, ID_SELPROP_STROKECLRTRANS,          EVT_BUTTON(self, ID_SELPROP_STROKECLRTRANS,
903                     self._OnChangeLineColorTrans)                     self._OnChangeLineColorTrans)
# Line 907  class SelectPropertiesDialog(wxDialog): Line 908  class SelectPropertiesDialog(wxDialog):
908          if shapeType != SHAPETYPE_ARC:          if shapeType != SHAPETYPE_ARC:
909              fillColorBox = wxBoxSizer(wxHORIZONTAL)              fillColorBox = wxBoxSizer(wxHORIZONTAL)
910              fillColorBox.Add(              fillColorBox.Add(
911                  wxButton(self, ID_SELPROP_FILLCLR, "Change Fill Color"),                  wxButton(self, ID_SELPROP_FILLCLR, _("Change Fill Color")),
912                  1, wxALL | wxGROW, 4)                  1, wxALL | wxGROW, 4)
913              EVT_BUTTON(self, ID_SELPROP_FILLCLR, self._OnChangeFillColor)              EVT_BUTTON(self, ID_SELPROP_FILLCLR, self._OnChangeFillColor)
914              fillColorBox.Add(              fillColorBox.Add(
915                  wxButton(self, ID_SELPROP_FILLCLRTRANS, "Transparent"),                  wxButton(self, ID_SELPROP_FILLCLRTRANS, _("Transparent")),
916                  1, wxALL | wxGROW, 4)                  1, wxALL | wxGROW, 4)
917              EVT_BUTTON(self, ID_SELPROP_FILLCLRTRANS,              EVT_BUTTON(self, ID_SELPROP_FILLCLRTRANS,
918                         self._OnChangeFillColorTrans)                         self._OnChangeFillColorTrans)

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

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26