/[thuban]/branches/WIP-pyshapelib-bramz/Thuban/UI/classgen.py
ViewVC logotype

Diff of /branches/WIP-pyshapelib-bramz/Thuban/UI/classgen.py

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

revision 1219 by bh, Mon Jun 16 17:42:54 2003 UTC revision 1341 by jonathan, Tue Jul 1 16:10:42 2003 UTC
# Line 17  from Thuban.Model.table import FIELDTYPE Line 17  from Thuban.Model.table import FIELDTYPE
17       FIELDTYPE_STRING       FIELDTYPE_STRING
18    
19  from Thuban.Model.range import Range  from Thuban.Model.range import Range
20    from Thuban.UI.common import ThubanBeginBusyCursor, ThubanEndBusyCursor
21    
22  import classifier, resource  import classifier, resource
23    
# Line 75  class ClassGenDialog(wxDialog): Line 76  class ClassGenDialog(wxDialog):
76          # panels they will call AllowGenerate() which uses genButton.          # panels they will call AllowGenerate() which uses genButton.
77          #          #
78          self.genButton = wxButton(self, wxID_OK, _("Generate"))          self.genButton = wxButton(self, wxID_OK, _("Generate"))
         self.genButton.SetDefault()  
79          self.cancelButton = wxButton(self, wxID_CANCEL, _("Close"))          self.cancelButton = wxButton(self, wxID_CANCEL, _("Close"))
80            self.genButton.SetDefault()
81    
82          self.genChoice = wxChoice(self, ID_CLASSGEN_GENCOMBO)          self.genChoice = wxChoice(self, ID_CLASSGEN_GENCOMBO)
83    
# Line 130  class ClassGenDialog(wxDialog): Line 131  class ClassGenDialog(wxDialog):
131          self.propPanel = None          self.propPanel = None
132          custom_ramp_panel = CustomRampPanel(self, layer.ShapeType())          custom_ramp_panel = CustomRampPanel(self, layer.ShapeType())
133    
134          self.propCombo.Append(PROPCOMBOSTR_GREY,  GreyRamp())          self.propCombo.Append(PROPCOMBOSTR_GREY,  GreyRamp)
135          self.propCombo.Append(PROPCOMBOSTR_RED,   RedRamp())          self.propCombo.Append(PROPCOMBOSTR_RED,   RedRamp)
136          self.propCombo.Append(PROPCOMBOSTR_GREEN, GreenRamp())          self.propCombo.Append(PROPCOMBOSTR_GREEN, GreenRamp)
137          self.propCombo.Append(PROPCOMBOSTR_BLUE,  BlueRamp())          self.propCombo.Append(PROPCOMBOSTR_BLUE,  BlueRamp)
138          self.propCombo.Append(PROPCOMBOSTR_GREEN2RED, GreenToRedRamp())          self.propCombo.Append(PROPCOMBOSTR_GREEN2RED, GreenToRedRamp)
139          self.propCombo.Append(PROPCOMBOSTR_HOT2COLD,  HotToColdRamp())          self.propCombo.Append(PROPCOMBOSTR_HOT2COLD,  HotToColdRamp())
140          self.propCombo.Append(PROPCOMBOSTR_CUSTOM, custom_ramp_panel)          self.propCombo.Append(PROPCOMBOSTR_CUSTOM, custom_ramp_panel)
141    
# Line 221  class ClassGenDialog(wxDialog): Line 222  class ClassGenDialog(wxDialog):
222    
223                  list = genPanel.GetValueList()                  list = genPanel.GetValueList()
224    
225                  if len(list) > 0 \                  if len(list) > 0:
226                      and numGroups is not None:                      self.clazz = generate_singletons(list, ramp)
   
                     self.clazz = generate_singletons(  
                                     list, numGroups, ramp)  
   
227                      self.parent._SetClassification(self.clazz)                      self.parent._SetClassification(self.clazz)
228    
229              elif genSel == GENCOMBOSTR_QUANTILES:              elif genSel == GENCOMBOSTR_QUANTILES:
# Line 506  class GenUniformPanel(wxPanel): Line 503  class GenUniformPanel(wxPanel):
503      def _OnRetrieve(self, event):      def _OnRetrieve(self, event):
504          table = self.layer.ShapeStore().Table()          table = self.layer.ShapeStore().Table()
505          if table is not None:          if table is not None:
506              wxBeginBusyCursor()              ThubanBeginBusyCursor()
507              try:              try:
508                  min, max = table.ValueRange(self.fieldName)                  min, max = table.ValueRange(self.fieldName)
509                  self.minCtrl.SetValue(str(min))                  self.minCtrl.SetValue(str(min))
510                  self.maxCtrl.SetValue(str(max))                  self.maxCtrl.SetValue(str(max))
511              finally:              finally:
512                  wxEndBusyCursor()                  ThubanEndBusyCursor()
513    
514      def __GetValidatedTypeEntry(self, win, value, type, badValue = None):      def __GetValidatedTypeEntry(self, win, value, type, badValue = None):
515    
# Line 720  class GenUniquePanel(wxPanel): Line 717  class GenUniquePanel(wxPanel):
717          self.list_avail.DeleteAllItems()          self.list_avail.DeleteAllItems()
718          self.list_avail_data = []          self.list_avail_data = []
719    
720          list = self.layer.ShapeStore().Table().UniqueValues(self.fieldName)          ThubanBeginBusyCursor()
721          index = 0          try:
722          for v in list:              list = self.layer.ShapeStore().Table().UniqueValues(self.fieldName)
723              self.dataList.append(v)              index = 0
724              i = self.list_avail.InsertStringItem(index, str(v))              for v in list:
725              self.list_avail.SetItemData(index, i)                  self.dataList.append(v)
726                    i = self.list_avail.InsertStringItem(index, str(v))
727              self.list_avail_data.append(v)                  self.list_avail.SetItemData(index, i)
728              index += 1      
729                    self.list_avail_data.append(v)
730                    index += 1
731            finally:
732                ThubanEndBusyCursor()
733    
734      def _OnUseAll(self, event):      def _OnUseAll(self, event):
735          for i in range(self.list_avail.GetItemCount()):          for i in range(self.list_avail.GetItemCount()):
# Line 835  class GenQuantilesPanel(wxPanel): Line 836  class GenQuantilesPanel(wxPanel):
836          _list = []          _list = []
837          table = self.layer.ShapeStore().Table()          table = self.layer.ShapeStore().Table()
838          if table is not None:          if table is not None:
839              wxBeginBusyCursor()              ThubanBeginBusyCursor()
840              try:              try:
841                  #                  #
842                  # FIXME: Replace with a call to table when the method                  # FIXME: Replace with a call to table when the method
# Line 844  class GenQuantilesPanel(wxPanel): Line 845  class GenQuantilesPanel(wxPanel):
845                  for i in range(table.NumRows()):                  for i in range(table.NumRows()):
846                      _list.append(table.ReadValue(i, self.fieldName))                      _list.append(table.ReadValue(i, self.fieldName))
847              finally:              finally:
848                  wxEndBusyCursor()                  ThubanEndBusyCursor()
849    
850          return _list          return _list
851    
# Line 863  class GenQuantilesPanel(wxPanel): Line 864  class GenQuantilesPanel(wxPanel):
864      def OnRetrieve(self, event):      def OnRetrieve(self, event):
865          table = self.layer.ShapeStore().Table()          table = self.layer.ShapeStore().Table()
866          if table is not None:          if table is not None:
867              wxBeginBusyCursor()              ThubanBeginBusyCursor()
868              try:              try:
869                  min, max = table.ValueRange(self.fieldName)                  min, max = table.ValueRange(self.fieldName)
870                  self.text_range.SetValue("[" + str(min) + ";" + str(max) + "]")                  self.text_range.SetValue("[" + str(min) + ";" + str(max) + "]")
871              finally:              finally:
872                  wxEndBusyCursor()                  ThubanEndBusyCursor()
873    
874  ID_CUSTOMRAMP_COPYSTART = 4001  ID_CUSTOMRAMP_COPYSTART = 4001
875  ID_CUSTOMRAMP_COPYEND = 4002  ID_CUSTOMRAMP_COPYEND = 4002

Legend:
Removed from v.1219  
changed lines
  Added in v.1341

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26