/[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 649 by jonathan, Fri Apr 11 14:27:12 2003 UTC revision 711 by jonathan, Wed Apr 23 08:46:23 2003 UTC
# Line 5  Line 5 
5  # This program is free software under the GPL (>=v2)  # This program is free software under the GPL (>=v2)
6  # Read the file COPYING coming with Thuban for details.  # Read the file COPYING coming with Thuban for details.
7    
8    import sys
9    
10  from Thuban import _  from Thuban import _
11    
12  from wxPython.wx import *  from wxPython.wx import *
# Line 86  class ClassGenDialog(wxDialog): Line 88  class ClassGenDialog(wxDialog):
88          psizer.Add(wxStaticText(self, -1, _("Generate:")),          psizer.Add(wxStaticText(self, -1, _("Generate:")),
89              0, wxALIGN_CENTER_VERTICAL, 0)              0, wxALIGN_CENTER_VERTICAL, 0)
90    
91          self.genCombo = wxComboBox(self,          self.genCombo = wxChoice(self, ID_CLASSGEN_GENCOMBO)
                                    ID_CLASSGEN_GENCOMBO,  
                                    "", style = wxCB_READONLY)  
92          psizer.Add(self.genCombo, 1, wxALL | wxGROW, 4)          psizer.Add(self.genCombo, 1, wxALL | wxGROW, 4)
93          EVT_COMBOBOX(self, ID_CLASSGEN_GENCOMBO, self._OnGenTypeSelect)          EVT_CHOICE(self, ID_CLASSGEN_GENCOMBO, self._OnGenTypeSelect)
94    
95          sizer.Add(psizer, 0, wxALL | wxGROW, 4)          sizer.Add(psizer, 0, wxALL | wxGROW, 4)
96    
# Line 107  class ClassGenDialog(wxDialog): Line 107  class ClassGenDialog(wxDialog):
107          if self.type in (FIELDTYPE_INT, FIELDTYPE_DOUBLE):          if self.type in (FIELDTYPE_INT, FIELDTYPE_DOUBLE):
108              panel = GenUniformPanel(self, layer, fieldName, self.type)              panel = GenUniformPanel(self, layer, fieldName, self.type)
109              self.genCombo.Append(GENCOMBOSTR_UNIFORM, panel)              self.genCombo.Append(GENCOMBOSTR_UNIFORM, panel)
110              sizer.Add(panel, 0, wxGROW | wxALL, 4)              sizer.Add(panel, 1, wxGROW | wxALL, 4)
111              sizer.Show(panel, False)              sizer.Show(panel, False)
112    
113            self.genCombo.SetSelection(0)
114    
115          #############          #############
116    
117          psizer = wxBoxSizer(wxHORIZONTAL)          psizer = wxBoxSizer(wxHORIZONTAL)
118          psizer.Add(wxStaticText(self, -1, _("Color Schemes:")),          psizer.Add(wxStaticText(self, -1, _("Color Scheme:")),
119              0, wxALIGN_CENTER_VERTICAL, 0)              0, wxALIGN_CENTER_VERTICAL, 0)
120    
121          self.propCombo = wxComboBox(self,          self.propCombo = wxChoice(self, ID_CLASSGEN_PROPCOMBO)
                                    ID_CLASSGEN_PROPCOMBO,  
                                    "", style = wxCB_READONLY)  
122          psizer.Add(self.propCombo, 1, wxALL | wxGROW, 4)          psizer.Add(self.propCombo, 1, wxALL | wxGROW, 4)
123          EVT_COMBOBOX(self, ID_CLASSGEN_PROPCOMBO, self._OnPropTypeSelect)          EVT_CHOICE(self, ID_CLASSGEN_PROPCOMBO, self._OnPropTypeSelect)
124          sizer.Add(psizer, 0, wxALL | wxGROW, 4)          sizer.Add(psizer, 0, wxALL | wxGROW, 4)
125    
126          #############          #############
# Line 137  class ClassGenDialog(wxDialog): Line 137  class ClassGenDialog(wxDialog):
137          self.propCombo.Append(PROPCOMBOSTR_HOT2COLD,  HotToColdRamp())          self.propCombo.Append(PROPCOMBOSTR_HOT2COLD,  HotToColdRamp())
138          self.propCombo.Append(PROPCOMBOSTR_CUSTOM, panel)          self.propCombo.Append(PROPCOMBOSTR_CUSTOM, panel)
139    
140            self.propCombo.SetSelection(0)
141    
142    
143          #############          #############
# Line 287  class GenUniformPanel(wxPanel): Line 288  class GenUniformPanel(wxPanel):
288          sizer = wxBoxSizer(wxHORIZONTAL)          sizer = wxBoxSizer(wxHORIZONTAL)
289    
290          sizer.Add(wxStaticText(self, -1, _("Number of Groups:")), 0, wxALL, 4)          sizer.Add(wxStaticText(self, -1, _("Number of Groups:")), 0, wxALL, 4)
291          self.numGroupsCtrl = wxSpinCtrl(self, ID_UNIFORM_NGROUPS, style=wxTE_RIGHT)          self.numGroupsCtrl = wxSpinCtrl(self, ID_UNIFORM_NGROUPS,
292                                            style=wxTE_RIGHT)
293          EVT_TEXT(self, ID_UNIFORM_NGROUPS, self._OnNumGroupsChanged)          EVT_TEXT(self, ID_UNIFORM_NGROUPS, self._OnNumGroupsChanged)
294          EVT_SPINCTRL(self, ID_UNIFORM_NGROUPS, self._OnNumGroupsChanged)          EVT_SPINCTRL(self, ID_UNIFORM_NGROUPS, self._OnNumGroupsChanged)
295          sizer.Add(self.numGroupsCtrl, 1, wxALL, 4)          sizer.Add(self.numGroupsCtrl, 1, wxALL, 4)
# Line 308  class GenUniformPanel(wxPanel): Line 310  class GenUniformPanel(wxPanel):
310          self.numGroupsChanging = False          self.numGroupsChanging = False
311          self.steppingChanging = False          self.steppingChanging = False
312    
313          self.numGroupsCtrl.SetRange(1, 100)          self.numGroupsCtrl.SetRange(1, sys.maxint)
314    
315          self.numGroupsCtrl.SetValue(1)          self.numGroupsCtrl.SetValue(1)
316          self.stepCtrl.SetValue("1")          self.stepCtrl.SetValue("1")
# Line 358  class GenUniformPanel(wxPanel): Line 360  class GenUniformPanel(wxPanel):
360          self.numGroupsCtrl.Enable(on)          self.numGroupsCtrl.Enable(on)
361          self.stepCtrl.Enable(on)          self.stepCtrl.Enable(on)
362    
         if on:  
             self.numGroupsCtrl.SetRange(1, abs(max - min) / 0.001)  
   
363          ngroups = self.GetNumGroups()          ngroups = self.GetNumGroups()
364    
365          if ngroups is not None  \          if ngroups is not None  \
# Line 391  class GenUniformPanel(wxPanel): Line 390  class GenUniformPanel(wxPanel):
390          min = self.GetMin()          min = self.GetMin()
391          max = self.GetMax()          max = self.GetMax()
392    
         if ngroups >= self.numGroupsCtrl.GetMax():  
             self.numGroupsCtrl.SetRange(1, ngroups + 1)  
   
393          if ngroups is not None  \          if ngroups is not None  \
394              and min is not None \              and min is not None \
395              and max is not None \              and max is not None \
# Line 1012  class MonochromaticRamp(CustomRamp): Line 1008  class MonochromaticRamp(CustomRamp):
1008    
1009  class GreyRamp(MonochromaticRamp):  class GreyRamp(MonochromaticRamp):
1010      def __init__(self):      def __init__(self):
1011          MonochromaticRamp.__init__(self, Color(0, 0, 0), Color(1, 1, 1))          MonochromaticRamp.__init__(self, Color(1, 1, 1), Color(0, 0, 0))
1012    
1013  class RedRamp(MonochromaticRamp):  class RedRamp(MonochromaticRamp):
1014      def __init__(self):      def __init__(self):
1015          MonochromaticRamp.__init__(self, Color(.2, 0, 0), Color(1, 0, 0))          MonochromaticRamp.__init__(self, Color(1, 1, 1), Color(.8, 0, 0))
1016    
1017  class GreenRamp(MonochromaticRamp):  class GreenRamp(MonochromaticRamp):
1018      def __init__(self):      def __init__(self):
1019          MonochromaticRamp.__init__(self, Color(0, .2, 0), Color(0, 1, 0))          MonochromaticRamp.__init__(self, Color(1, 1, 1), Color(0, .8, 0))
1020    
1021  class BlueRamp(MonochromaticRamp):  class BlueRamp(MonochromaticRamp):
1022      def __init__(self):      def __init__(self):
1023          MonochromaticRamp.__init__(self, Color(0, 0, .2), Color(0, 0, 1))          MonochromaticRamp.__init__(self, Color(1, 1, 1), Color(0, 0, .8))
1024    
1025  class HotToColdRamp:  class HotToColdRamp:
1026    

Legend:
Removed from v.649  
changed lines
  Added in v.711

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26