/[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 977 by bh, Fri May 16 15:01:04 2003 UTC revision 978 by frank, Thu May 22 11:40:32 2003 UTC
# Line 75  class ClassGenDialog(wxDialog): Line 75  class ClassGenDialog(wxDialog):
75          #          #
76          self.genButton = wxButton(self, wxID_OK, _("Generate"))          self.genButton = wxButton(self, wxID_OK, _("Generate"))
77          self.genButton.SetDefault()          self.genButton.SetDefault()
78            self.cancelButton = wxButton(self, wxID_CANCEL, _("Close"))
79    
80          self.genChoice = wxChoice(self, ID_CLASSGEN_GENCOMBO)          self.genChoice = wxChoice(self, ID_CLASSGEN_GENCOMBO)
81    
82          self.genpanels.append((GENCOMBOSTR_UNIQUE, GenUniquePanel))          self.genpanels.append((GENCOMBOSTR_UNIQUE, GenUniquePanel))
# Line 87  class ClassGenDialog(wxDialog): Line 89  class ClassGenDialog(wxDialog):
89    
90          self.genChoice.SetSelection(0)          self.genChoice.SetSelection(0)
91    
92          self.propPanel = None          for i in range(self.genChoice.GetCount()):
93          custom_ramp_panel = CustomRampPanel(self, layer.ShapeType())              clazz, obj = self.genChoice.GetClientData(i)
94    
95          self.propCombo = wxChoice(self, ID_CLASSGEN_PROPCOMBO)              if obj is None:
96          self.propCombo.Append(PROPCOMBOSTR_GREY,  GreyRamp())                  obj = clazz(self, self.layer, self.fieldName, self.fieldType)
97          self.propCombo.Append(PROPCOMBOSTR_RED,   RedRamp())                  obj.Hide()
98          self.propCombo.Append(PROPCOMBOSTR_GREEN, GreenRamp())                  self.genChoice.SetClientData(i, [clazz, obj])
         self.propCombo.Append(PROPCOMBOSTR_BLUE,  BlueRamp())  
         self.propCombo.Append(PROPCOMBOSTR_GREEN2RED, GreenToRedRamp())  
         self.propCombo.Append(PROPCOMBOSTR_HOT2COLD,  HotToColdRamp())  
         self.propCombo.Append(PROPCOMBOSTR_CUSTOM, custom_ramp_panel)  
99    
         self.propCombo.SetSelection(0)  
100    
101          #############          #############
102    
# Line 125  class ClassGenDialog(wxDialog): Line 122  class ClassGenDialog(wxDialog):
122          psizer = wxBoxSizer(wxHORIZONTAL)          psizer = wxBoxSizer(wxHORIZONTAL)
123          psizer.Add(wxStaticText(self, -1, _("Color Scheme:")),          psizer.Add(wxStaticText(self, -1, _("Color Scheme:")),
124              0, wxALIGN_CENTER_VERTICAL, 0)              0, wxALIGN_CENTER_VERTICAL, 0)
125    
126            # Properties (Ramp) ComboBox
127            self.propCombo = wxChoice(self, ID_CLASSGEN_PROPCOMBO)
128    
129            self.propPanel = None
130            custom_ramp_panel = CustomRampPanel(self, layer.ShapeType())
131    
132            self.propCombo.Append(PROPCOMBOSTR_GREY,  GreyRamp())
133            self.propCombo.Append(PROPCOMBOSTR_RED,   RedRamp())
134            self.propCombo.Append(PROPCOMBOSTR_GREEN, GreenRamp())
135            self.propCombo.Append(PROPCOMBOSTR_BLUE,  BlueRamp())
136            self.propCombo.Append(PROPCOMBOSTR_GREEN2RED, GreenToRedRamp())
137            self.propCombo.Append(PROPCOMBOSTR_HOT2COLD,  HotToColdRamp())
138            self.propCombo.Append(PROPCOMBOSTR_CUSTOM, custom_ramp_panel)
139    
140            self.propCombo.SetSelection(0)
141    
142          psizer.Add(self.propCombo, 1, wxALL | wxGROW, 4)          psizer.Add(self.propCombo, 1, wxALL | wxGROW, 4)
143          sizer.Add(psizer, 0, wxALL | wxGROW, 4)          sizer.Add(psizer, 0, wxALL | wxGROW, 4)
144    
145          sizer.Add(custom_ramp_panel, 1, wxGROW | wxALL, 4)          sizer.Add(custom_ramp_panel, 1, wxGROW | wxALL, 4)
146          sizer.Show(custom_ramp_panel, False)          sizer.Show(custom_ramp_panel, False)
147    
148            # Finally place the main buttons
149          buttonSizer = wxBoxSizer(wxHORIZONTAL)          buttonSizer = wxBoxSizer(wxHORIZONTAL)
150          buttonSizer.Add(self.genButton, 0, wxALL, 4)          buttonSizer.Add(self.genButton, 0, wxRIGHT|wxEXPAND, 10)
151          buttonSizer.Add(60, 20, 0, wxALL, 4)          buttonSizer.Add(self.cancelButton, 0, wxRIGHT|wxEXPAND, 10)
152          buttonSizer.Add(wxButton(self, wxID_CANCEL, _("Close")),          sizer.Add(buttonSizer, 0, wxALIGN_RIGHT|wxBOTTOM|wxTOP, 10)
                         0, wxALL, 4)  
         sizer.Add(buttonSizer, 0,  
                   wxALL | wxALIGN_BOTTOM | wxALIGN_CENTER_HORIZONTAL, 4)  
153    
154          self.SetSizer(sizer)          self.SetSizer(sizer)
155          self.SetAutoLayout(True)          self.SetAutoLayout(True)
# Line 286  class ClassGenDialog(wxDialog): Line 298  class ClassGenDialog(wxDialog):
298    
299          clazz, obj = choice.GetClientData(sel)          clazz, obj = choice.GetClientData(sel)
300    
         if obj is None:  
             obj = clazz(self, self.layer, self.fieldName, self.fieldType)  
             choice.SetClientData(sel, [clazz, obj])  
   
301          if self.curGenPanel is not None:          if self.curGenPanel is not None:
302              self.curGenPanel.Hide()              self.curGenPanel.Hide()
303              self.sizer_genPanel.Remove(self.curGenPanel)              self.sizer_genPanel.Remove(self.curGenPanel)
# Line 662  class GenUniquePanel(wxPanel): Line 670  class GenUniquePanel(wxPanel):
670          self.SetAutoLayout(True)          self.SetAutoLayout(True)
671          topSizer.SetSizeHints(self)          topSizer.SetSizeHints(self)
672    
673            width, height = self.list_avail.GetSizeTuple()
674            self.list_avail.SetColumnWidth(0,width)
675            width, height = self.list_use.GetSizeTuple()
676            self.list_use.SetColumnWidth(0,width)
677    
678          self.parent.AllowGenerate(False)          self.parent.AllowGenerate(False)
679    
680      def GetNumGroups(self):      def GetNumGroups(self):

Legend:
Removed from v.977  
changed lines
  Added in v.978

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26