/[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 781 by jonathan, Tue Apr 29 16:53:38 2003 UTC revision 812 by jonathan, Mon May 5 15:04:06 2003 UTC
# Line 23  import classifier Line 23  import classifier
23    
24  import resource  import resource
25    
 ID_CLASSGEN_GEN = 4001  
 ID_CLASSGEN_CLOSE = 4002  
26  ID_CLASSGEN_GENCOMBO = 4007  ID_CLASSGEN_GENCOMBO = 4007
27  ID_CLASSGEN_PROPCOMBO = 4008  ID_CLASSGEN_PROPCOMBO = 4008
28    
# Line 63  class ClassGenDialog(wxDialog): Line 61  class ClassGenDialog(wxDialog):
61          # we need to create genButton first because when we create the          # we need to create genButton first because when we create the
62          # panels they will call AllowGenerate() which uses genButton.          # panels they will call AllowGenerate() which uses genButton.
63          #          #
64          buttonSizer = wxBoxSizer(wxHORIZONTAL)          self.genButton = wxButton(self, wxID_OK, _("Generate"))
65          self.genButton = wxButton(self, ID_CLASSGEN_GEN, _("Generate"))          self.genButton.SetDefault()
66    
67          buttonSizer.Add(self.genButton, 0, wxALL, 4)          self.genChoice = wxChoice(self, ID_CLASSGEN_GENCOMBO)
68          buttonSizer.Add(60, 20, 0, wxALL, 4)  
69          buttonSizer.Add(wxButton(self, ID_CLASSGEN_CLOSE, _("Close")),          uniq_panel = GenUniquePanel(self, layer, fieldName, self.type)
70                          0, wxALL, 4)  
71            self.genPanel = uniq_panel
72            self.genChoice.Append(GENCOMBOSTR_UNIQUE, uniq_panel)
73    
74            if self.type in (FIELDTYPE_INT, FIELDTYPE_DOUBLE):
75                uni_panel = GenUniformPanel(self, layer, fieldName, self.type)
76                self.genChoice.Append(GENCOMBOSTR_UNIFORM, uni_panel)
77    
78            self.genChoice.SetSelection(0)
79    
80            self.propPanel = None
81            custom_ramp_panel = CustomRampPanel(self, layer.ShapeType())
82    
83            self.propCombo = wxChoice(self, ID_CLASSGEN_PROPCOMBO)
84            self.propCombo.Append(PROPCOMBOSTR_GREY,  GreyRamp())
85            self.propCombo.Append(PROPCOMBOSTR_RED,   RedRamp())
86            self.propCombo.Append(PROPCOMBOSTR_GREEN, GreenRamp())
87            self.propCombo.Append(PROPCOMBOSTR_BLUE,  BlueRamp())
88            self.propCombo.Append(PROPCOMBOSTR_HOT2COLD,  HotToColdRamp())
89            self.propCombo.Append(PROPCOMBOSTR_CUSTOM, custom_ramp_panel)
90    
91            self.propCombo.SetSelection(0)
92    
93          #############          #############
94    
# Line 85  class ClassGenDialog(wxDialog): Line 104  class ClassGenDialog(wxDialog):
104          psizer = wxBoxSizer(wxHORIZONTAL)          psizer = wxBoxSizer(wxHORIZONTAL)
105          psizer.Add(wxStaticText(self, -1, _("Generate:")),          psizer.Add(wxStaticText(self, -1, _("Generate:")),
106              0, wxALIGN_CENTER_VERTICAL, 0)              0, wxALIGN_CENTER_VERTICAL, 0)
   
         self.genChoice = wxChoice(self, ID_CLASSGEN_GENCOMBO)  
107          psizer.Add(self.genChoice, 1, wxALL | wxGROW, 4)          psizer.Add(self.genChoice, 1, wxALL | wxGROW, 4)
         EVT_CHOICE(self, ID_CLASSGEN_GENCOMBO, self._OnGenTypeSelect)  
108    
109          sizer.Add(psizer, 0, wxALL | wxGROW, 4)          sizer.Add(psizer, 0, wxALL | wxGROW, 4)
110            sizer.Add(self.genPanel, 1, wxGROW | wxALL, 4)
111    
112          #############          sizer.Show(uniq_panel, True)
   
         self.genPanel = None  
   
         panel = GenUniquePanel(self, layer, fieldName, self.type)  
         self.genChoice.Append(GENCOMBOSTR_UNIQUE, panel)  
         sizer.Add(panel, 1, wxGROW | wxALL, 4)  
   
         self.genPanel = panel  
   
113          if self.type in (FIELDTYPE_INT, FIELDTYPE_DOUBLE):          if self.type in (FIELDTYPE_INT, FIELDTYPE_DOUBLE):
114              panel = GenUniformPanel(self, layer, fieldName, self.type)              sizer.Add(uni_panel, 1, wxGROW | wxALL, 4)
115              self.genChoice.Append(GENCOMBOSTR_UNIFORM, panel)              sizer.Show(uni_panel, False)
             sizer.Add(panel, 1, wxGROW | wxALL, 4)  
             sizer.Show(panel, False)  
   
         self.genChoice.SetSelection(0)  
   
         #############  
116    
117          psizer = wxBoxSizer(wxHORIZONTAL)          psizer = wxBoxSizer(wxHORIZONTAL)
118          psizer.Add(wxStaticText(self, -1, _("Color Scheme:")),          psizer.Add(wxStaticText(self, -1, _("Color Scheme:")),
119              0, wxALIGN_CENTER_VERTICAL, 0)              0, wxALIGN_CENTER_VERTICAL, 0)
   
         self.propCombo = wxChoice(self, ID_CLASSGEN_PROPCOMBO)  
120          psizer.Add(self.propCombo, 1, wxALL | wxGROW, 4)          psizer.Add(self.propCombo, 1, wxALL | wxGROW, 4)
         EVT_CHOICE(self, ID_CLASSGEN_PROPCOMBO, self._OnPropTypeSelect)  
121          sizer.Add(psizer, 0, wxALL | wxGROW, 4)          sizer.Add(psizer, 0, wxALL | wxGROW, 4)
122    
123          #############          sizer.Add(custom_ramp_panel, 1, wxGROW | wxALL, 4)
124            sizer.Show(custom_ramp_panel, False)
         self.propPanel = None  
         panel = CustomRampPanel(self, layer.ShapeType())  
         sizer.Add(panel, 1, wxALL | wxGROW, 4)  
         sizer.Show(panel, False)  
   
         self.propCombo.Append(PROPCOMBOSTR_GREY,  GreyRamp())  
         self.propCombo.Append(PROPCOMBOSTR_RED,   RedRamp())  
         self.propCombo.Append(PROPCOMBOSTR_GREEN, GreenRamp())  
         self.propCombo.Append(PROPCOMBOSTR_BLUE,  BlueRamp())  
         self.propCombo.Append(PROPCOMBOSTR_HOT2COLD,  HotToColdRamp())  
         self.propCombo.Append(PROPCOMBOSTR_CUSTOM, panel)  
   
         self.propCombo.SetSelection(0)  
   
   
         #############  
125    
126            buttonSizer = wxBoxSizer(wxHORIZONTAL)
127            buttonSizer.Add(self.genButton, 0, wxALL, 4)
128            buttonSizer.Add(60, 20, 0, wxALL, 4)
129            buttonSizer.Add(wxButton(self, wxID_CANCEL, _("Close")),
130                            0, wxALL, 4)
131          sizer.Add(buttonSizer, 0,          sizer.Add(buttonSizer, 0,
132                    wxALL | wxALIGN_BOTTOM | wxALIGN_CENTER_HORIZONTAL, 4)                    wxALL | wxALIGN_BOTTOM | wxALIGN_CENTER_HORIZONTAL, 4)
133    
   
134          self.SetSizer(sizer)          self.SetSizer(sizer)
135          self.SetAutoLayout(True)          self.SetAutoLayout(True)
136          sizer.SetSizeHints(self)          sizer.SetSizeHints(self)
137    
138          self.sizer = sizer          self.sizer = sizer
139    
140          EVT_BUTTON(self, ID_CLASSGEN_GEN, self._OnGenerate)          EVT_CHOICE(self, ID_CLASSGEN_GENCOMBO, self._OnGenTypeSelect)
141          EVT_BUTTON(self, ID_CLASSGEN_CLOSE, self._OnCloseBtn)          EVT_CHOICE(self, ID_CLASSGEN_PROPCOMBO, self._OnPropTypeSelect)
142            EVT_BUTTON(self, wxID_OK, self.OnOK)
143            EVT_BUTTON(self, wxID_CANCEL, self.OnCancel)
144    
145    
146            self.genChoice.SetFocus()
147    
148      def GetClassification(self):      def GetClassification(self):
149          return self.clazz          return self.clazz
# Line 159  class ClassGenDialog(wxDialog): Line 151  class ClassGenDialog(wxDialog):
151      def AllowGenerate(self, on):      def AllowGenerate(self, on):
152          pass #self.genButton.Enable(on)          pass #self.genButton.Enable(on)
153    
154      def _OnGenerate(self, event):      def OnOK(self, event):
155            """This is really the generate button, but we want to override
156            the wxDialog class.
157            """
158    
159          index = self.genChoice.GetSelection()          index = self.genChoice.GetSelection()
160    
# Line 205  class ClassGenDialog(wxDialog): Line 200  class ClassGenDialog(wxDialog):
200    
201                      self.parent._SetClassification(self.clazz)                      self.parent._SetClassification(self.clazz)
202    
203      def _OnCloseBtn(self, event):      def OnCancel(self, event):
204          self.Close()          self.Close()
205    
206      def _OnGenTypeSelect(self, event):      def _OnGenTypeSelect(self, event):
# Line 436  class GenUniformPanel(wxPanel): Line 431  class GenUniformPanel(wxPanel):
431      def _OnRetrieve(self, event):      def _OnRetrieve(self, event):
432    
433          if self.layer.table is not None:          if self.layer.table is not None:
434                wxBeginBusyCursor()
435              range = self.layer.table.field_range(self.fieldName)              range = self.layer.table.field_range(self.fieldName)
436              self.minCtrl.SetValue(str(range[0][0]))              self.minCtrl.SetValue(str(range[0][0]))
437              self.maxCtrl.SetValue(str(range[1][0]))              self.maxCtrl.SetValue(str(range[1][0]))
438                wxEndBusyCursor()
439    
440      def __GetValidatedTypeEntry(self, win, value, type, badValue = None):      def __GetValidatedTypeEntry(self, win, value, type, badValue = None):
441    

Legend:
Removed from v.781  
changed lines
  Added in v.812

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26