source: sasview/theoryview/perspectives/theory/model_panel.py @ d955bf19

ESS_GUIESS_GUI_DocsESS_GUI_batch_fittingESS_GUI_bumps_abstractionESS_GUI_iss1116ESS_GUI_iss879ESS_GUI_iss959ESS_GUI_openclESS_GUI_orderingESS_GUI_sync_sascalccostrafo411magnetic_scattrelease-4.1.1release-4.1.2release-4.2.2release_4.0.1ticket-1009ticket-1094-headlessticket-1242-2d-resolutionticket-1243ticket-1249ticket885unittest-saveload
Last change on this file since d955bf19 was 74755ff, checked in by Gervaise Alina <gervyh@…>, 14 years ago

working on documentation theory view

  • Property mode set to 100644
File size: 26.6 KB
Line 
1
2import wx
3import wx.lib.newevent
4import numpy
5import copy
6import math
7from sans.models.dispersion_models import ArrayDispersion, GaussianDispersion
8
9from sans.guicomm.events import StatusEvent   
10from sans.guiframe.utils import format_number
11(ModelEventbox, EVT_MODEL_BOX) = wx.lib.newevent.NewEvent()
12_BOX_WIDTH = 76
13
14import basepage
15from basepage import BasicPage
16from basepage import PageInfoEvent
17
18class ModelPanel(BasicPage):
19    """
20    FitPanel class contains fields allowing to display results when
21    fitting  a model and one data
22   
23    :note: For Fit to be performed the user should check at least
24        one parameter on fit Panel window.
25    """
26    ## Flag to tell the AUI manager to put this panel in the center pane
27    CENTER_PANE = True
28    ## Internal name for the AUI manager
29    window_name = "Theory model"
30    ## Title to appear on top of the window
31    window_caption = "Theory Model"
32    def __init__(self,parent, page_info, model_list_box):
33        BasicPage.__init__(self, parent, page_info , model_list_box)
34        """
35        Initialization of the Panel
36        """
37        self._fill_model_sizer( self.sizer1) 
38        self._fill_range_sizer()
39        self.engine_type = None 
40         
41        description=""
42        if self.model!=None:
43           
44            description = self.model.description
45           
46            self.select_model(self.model)
47            self.set_model_description(description,self.sizer2)
48           
49    def _on_display_description(self, event):
50        """
51        Show or Hide description
52       
53        :param event: wx.EVT_RADIOBUTTON
54       
55        """
56        self._on_display_description_helper()
57       
58        self.SetScrollbars(20,20,25,65)
59        self.Refresh()
60
61    def _on_display_description_helper(self):
62        """
63        Show or Hide description
64       
65        :param event: wx.EVT_RADIOBUTTON
66       
67        """
68        ## Show description
69        if self.description_hide.GetValue():
70            self.sizer_description.Clear(True)
71           
72        else:
73            description="Model contains no description"
74            if self.model!=None:
75                description = self.model.description
76            if description.lstrip().rstrip() =="": 
77                description="Model contains no description"
78            self.description = wx.StaticText( self,-1,str(description) )
79            self.sizer_description.Add( self.description, 1, wx.EXPAND | wx.ALL, 10 )
80           
81        self.Layout()
82   
83   
84    def _fill_range_sizer(self):
85        """
86        Fill the sizer containing the plotting range
87        add  access to npts
88       
89        """
90        ##The following 3 lines are for Mac. Let JHC know before modifying..
91        title = "Plotted Q Range"
92        box_description= wx.StaticBox(self, -1,str(title))
93        boxsizer1 = wx.StaticBoxSizer(box_description, wx.VERTICAL)
94
95        sizer_npts= wx.GridSizer(1, 1,5, 5)   
96        self.npts    = self.ModelTextCtrl(self, -1,size=(_BOX_WIDTH,20), style=wx.TE_PROCESS_ENTER)
97        self.npts.SetValue(format_number(self.num_points))
98        self.npts.SetToolTipString("Number of point to plot.")
99       
100        sizer_npts.Add(wx.StaticText(self, -1, 'Npts'),1, wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 13)       
101
102        sizer_npts.Add(self.npts,1,wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 10) 
103        self._set_range_sizer( title=title, box_sizer=boxsizer1, object= sizer_npts)
104       
105       
106    def _on_select_model(self, event): 
107        """
108        call back for model selection
109       
110        """   
111        self._on_select_model_helper() 
112        #Reset dispersity that was not done in _on_select_model_helper()
113        self._reset_dispersity()
114        self.select_model(self.model)
115       
116       
117    def _fill_model_sizer(self, sizer):
118        """
119        fill sizer containing model info
120       
121        """
122        ##The following 3 lines are for Mac. Let JHC know before modifying..
123        title = "Model"
124        box_description= wx.StaticBox(self, -1,str(title))
125        boxsizer1 = wx.StaticBoxSizer(box_description, wx.VERTICAL)
126       
127        id = wx.NewId()
128        self.model_view =wx.Button(self,id,'View 2D', size=(80,23))
129        self.model_view.Bind(wx.EVT_BUTTON, self._onModel2D,id=id)
130        self.model_view.SetToolTipString("View model in 2D")
131       
132        ## class base method  to add view 2d button   
133        self._set_model_sizer(sizer=sizer,box_sizer=boxsizer1, title=title,object= self.model_view )   
134   
135 
136    #def _set_sizer_gaussian(self):
137    def _set_sizer_dispersion(self, dispersity):
138        """
139        draw sizer with gaussian, log or schulz dispersity parameters
140       
141        """
142        self.fittable_param=[]
143        self.fixed_param=[]
144        self.orientation_params_disp=[]
145        #self.temp=[]
146       
147        self.sizer4_4.Clear(True)
148        if self.model==None:
149            ##no model is selected
150            return
151        if not self.enable_disp.GetValue():
152            ## the user didn't select dispersity display
153            return 
154        self._reset_dispersity()
155        # Create the dispersion objects
156        for item in self.model.dispersion.keys():
157            #disp_model =  GaussianDispersion()
158            disp_model = dispersity()
159            self._disp_obj_dict[item] = disp_model
160            self.model.set_dispersion(item, disp_model)
161            self.state._disp_obj_dict[item]= disp_model
162           
163           
164        ix=0
165        iy=1
166        disp = wx.StaticText(self, -1, ' ')
167        self.sizer4_4.Add(disp,( iy, ix),(1,1), 
168                           wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
169        ix += 1 
170        values = wx.StaticText(self, -1, 'Sigma (STD)')
171        values.SetToolTipString("Polydispersity multiplied by the value of the original parameter.")
172        self.sizer4_4.Add(values,( iy, ix),(1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0)
173       
174        ix += 1 
175        npts = wx.StaticText(self, -1, 'Npts')
176        npts.SetToolTipString("Number of points for weighting.")
177        self.sizer4_4.Add(npts,( iy, ix),(1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0)
178        ix += 1 
179        nsigmas = wx.StaticText(self, -1, 'Nsigmas')
180        nsigmas.SetToolTipString("Number of sigmas between which the range of the distribution function will be used for weighting. The value '3' covers 99.5% for Gaussian distribution function.")
181        self.sizer4_4.Add(nsigmas,( iy, ix),(1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0)
182       
183        for item in self.model.dispersion.keys():
184            if not item in self.model.orientation_params:
185                self.disp_cb_dict[item]= None
186                name1=item+".width"
187                name2=item+".npts"
188                name3=item+".nsigmas"
189                iy += 1
190                for p in self.model.dispersion[item].keys():
191                    if p=="width":
192                        ix = 0
193                        name = wx.StaticText(self, -1,  name1)
194                        self.sizer4_4.Add( name,( iy, ix),(1,1), 
195                                           wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
196                        ix = 1
197                        value= self.model.getParam(name1)
198                        ctl1 = self.ModelTextCtrl(self, -1, size=(_BOX_WIDTH,20),
199                                            style=wx.TE_PROCESS_ENTER)
200                        ctl1.SetToolTipString("Polydispersity multiplied by the value of the '%s'."%item)
201                        ctl1.SetValue(str (format_number(value)))
202                        self.sizer4_4.Add(ctl1, (iy,ix),(1,1), wx.EXPAND)
203                        self.fittable_param.append([None,name1,ctl1,None,
204                                                    None, None, None,None])
205                    elif p=="npts":
206                            ix =2
207                            value= self.model.getParam(name2)
208                            Tctl1 = self.ModelTextCtrl(self, -1, size=(_BOX_WIDTH/2,20),
209                                                style=wx.TE_PROCESS_ENTER)
210                           
211                            Tctl1.SetValue(str (format_number(value)))
212                            self.sizer4_4.Add(Tctl1, (iy,ix),(1,1),
213                                               wx.EXPAND|wx.ADJUST_MINSIZE, 0)
214                            self.fixed_param.append([None,name2, Tctl1,None,None,
215                                                      None, None,None])
216                    elif p=="nsigmas":
217                            ix =3 
218                            value= self.model.getParam(name3)
219                            Tctl2 = self.ModelTextCtrl(self, -1, size=(_BOX_WIDTH/2,20),
220                                                style=wx.TE_PROCESS_ENTER)
221                           
222                            Tctl2.SetValue(str (format_number(value)))
223                            self.sizer4_4.Add(Tctl2, (iy,ix),(1,1),
224                                               wx.EXPAND|wx.ADJUST_MINSIZE, 0)
225                            ix +=1
226                            self.sizer4_4.Add((20,20), (iy,ix),(1,1),
227                                               wx.EXPAND|wx.ADJUST_MINSIZE, 0)
228                            self.fixed_param.append([None,name3, Tctl2,
229                                                     None,None, None, None,None])
230        for item in self.model.dispersion.keys():
231            if item in self.model.orientation_params:
232                self.disp_cb_dict[item]= None
233                name1=item+".width"
234                name2=item+".npts"
235                name3=item+".nsigmas"
236                iy += 1
237                for p in self.model.dispersion[item].keys():
238                    if p=="width":
239                        ix = 0
240                        name = wx.StaticText(self, -1,  name1)
241                        self.sizer4_4.Add( name,( iy, ix),(1,1), 
242                                           wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
243                        if not self.enable2D:
244                            name.Hide()
245                        else:
246                            name.Show(True)
247                        ix = 1
248                        value= self.model.getParam(name1)
249                        ctl1 = self.ModelTextCtrl(self, -1, size=(_BOX_WIDTH,20),
250                                            style=wx.TE_PROCESS_ENTER)
251                        ctl1.SetToolTipString("Polydispersity multiplied by the value of '%s'."%item)
252                        ctl1.SetValue(str (format_number(value)))
253                        if not self.enable2D:
254                            ctl1.Hide()
255                            ctl1.Disable()
256                        else:
257                            ctl1.Show(True)
258                            ctl1.Enable()
259                        self.sizer4_4.Add(ctl1, (iy,ix),(1,1), wx.EXPAND)
260                        self.fittable_param.append([None,name1,ctl1,None,
261                                                    None, None, None,None])
262                        self.orientation_params_disp.append([None,name1,ctl1,None,
263                                                    None, None, None,None])
264                    elif p=="npts":
265                            ix =2
266                            value= self.model.getParam(name2)
267                            Tctl1 = self.ModelTextCtrl(self, -1, size=(_BOX_WIDTH/2,20),
268                                                style=wx.TE_PROCESS_ENTER)
269
270                            Tctl1.SetValue(str (format_number(value)))
271                            if not self.enable2D:
272                                Tctl1.Hide()
273                                Tctl1.Disable()
274                            else:
275                                Tctl1.Show(True)
276                                Tctl1.Enable()
277                            self.sizer4_4.Add(Tctl1, (iy,ix),(1,1),
278                                               wx.EXPAND|wx.ADJUST_MINSIZE, 0)
279                            self.fixed_param.append([None,name2, Tctl1,None,None,
280                                                      None, None,None])
281                            self.orientation_params_disp.append([None,name2, Tctl1,None,None,
282                                                      None, None,None])
283                    elif p=="nsigmas":
284                            ix =3 
285                            value= self.model.getParam(name3)
286                            Tctl2 = self.ModelTextCtrl(self, -1, size=(_BOX_WIDTH/2,20),
287                                                style=wx.TE_PROCESS_ENTER)
288                           
289                            Tctl2.SetValue(str (format_number(value)))
290                            if not self.enable2D:
291                                Tctl2.Hide()
292                                Tctl2.Disable()
293                            else:
294                                Tctl2.Show(True)
295                                Tctl2.Enable()
296                            self.sizer4_4.Add(Tctl2, (iy,ix),(1,1),
297                                               wx.EXPAND|wx.ADJUST_MINSIZE, 0)
298                            ix +=1
299                            #self.sizer4_4.Add((20,20), (iy,ix),(1,1),
300                                               #wx.EXPAND|wx.ADJUST_MINSIZE, 0)
301                            self.fixed_param.append([None,name3, Tctl2,
302                                                     None,None, None, None,None])
303                            self.orientation_params_disp.append([None,name3, Tctl2,
304                                                     None,None, None, None,None])
305           
306        msg = " Selected Distribution: Gaussian"       
307        wx.PostEvent(self.parent, StatusEvent( status= msg )) 
308        self.state.disp_cb_dict = copy.deepcopy(self.disp_cb_dict)   
309        ix =0
310        iy +=1 
311        #self.sizer4_4.Add((20,20),(iy,ix),(1,1), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)   
312        self.sizer4_4.Layout()
313        self.sizer4.Layout()
314        self.SetScrollbars(20,20,25,65)
315             
316 
317    def _onModel2D(self, event):
318        """
319        call manager to plot model in 2D
320       
321        """
322        # If the 2D display is not currently enabled, plot the model in 2D
323        # and set the enable2D flag.
324
325        if self.fitrange:
326            self.enable2D = True
327 
328        if self.enable2D:
329            self._draw_model()
330            self.model_view.Disable()
331           
332            n = self.disp_box.GetCurrentSelection()
333            dispersity= self.disp_box.GetClientData(n)
334            #TODO:Find a better way to reinitialize the parameters containers
335            # when resetting the page and 2D view is enable
336            #self.set_model_param_sizer(self.model): called here is using a lot
337            #of for loops and redraw the sizer again .How to avoid it?
338            self.set_model_param_sizer(self.model)
339           
340            if len(self.orientation_params)>0:
341                for item in self.orientation_params:
342                    if item[2]!=None:     
343                        item[2].Enable()
344            # same as above why do we have to redraw the sizer of dispersity to get
345            # the appropriate value of parameters containers on reset page?
346            # Reset containers of dispersity parameters for the appropriate dispersity
347            #and model
348            if  self.disp_name.lower()in ["array","arraydispersion"]:               
349                self._set_sizer_arraydispersion() 
350            else:
351                self._set_sizer_dispersion(dispersity)
352                if len(self.orientation_params_disp)>0:
353                   
354                    for item in self.orientation_params_disp:
355                        if item[2]!=None:
356                            item[2].Enable()
357                           
358        self.state.enable2D =  copy.deepcopy(self.enable2D)
359        self.Layout()
360        ## post state to fit panel
361        #self._undo.Enable(True)
362        event = PageInfoEvent(page = self)
363        wx.PostEvent(self.parent, event)
364             
365               
366    def reset_page(self, state):
367        """
368        reset the state
369       
370        """
371        self.reset_page_helper(state)
372       
373       
374    def select_model(self, model):
375        """
376        Select a new model
377       
378        :param model: model object
379       
380        """
381        self.model = model
382        if self.model !=None:
383            self.disp_list= self.model.getDispParamList()
384        self.set_model_param_sizer(self.model)
385        ## keep the sizer view consistent with the model menu selecting
386        self._set_model_sizer_selection( self.model )
387        self.enable_disp.SetValue(False)
388        self.disable_disp.SetValue(True)
389        self.set_dispers_sizer()
390       
391        self.model_view.SetFocus()
392        if self.model !=None:
393            self._draw_model()
394        self.state.structurecombobox = self.structurebox.GetCurrentSelection()
395        self.state.formfactorcombobox = self.formfactorbox.GetCurrentSelection()
396       
397        ## post state to fit panel
398        #self._undo.Enable(True)
399        event = PageInfoEvent(page = self)
400        wx.PostEvent(self.parent, event)               
401   
402   
403    def set_model_description(self,description,sizer):
404        """
405        fill a sizer with description
406       
407        :param description: of type string
408        :param sizer: wx.BoxSizer()
409       
410        """
411   
412        sizer.Clear(True)
413        box_description= wx.StaticBox(self, -1, 'Model Description')
414        boxsizer1 = wx.StaticBoxSizer(box_description, wx.VERTICAL)
415
416        sizer_selection=wx.BoxSizer(wx.HORIZONTAL)
417        self.description_hide = wx.RadioButton(self, -1, 'Hide', style=wx.RB_GROUP)
418        self.description_show = wx.RadioButton(self, -1, 'Show')
419       
420       
421        if description=="":
422            self.description_hide.SetValue(True)
423            description=" Description unavailable. Click for details"
424           
425        self.description = wx.StaticText( self,-1,str(description) )
426       
427        self.Bind( wx.EVT_RADIOBUTTON, self._on_display_description,
428                   id=self.description_hide.GetId() )
429       
430        self.Bind( wx.EVT_RADIOBUTTON, self._on_display_description,
431                   id=self.description_show.GetId() )
432        #MAC needs SetValue
433        self.description_hide.SetValue(True)
434       
435        self.model_description = wx.Button(self,-1, label="Details", size=(80,23))
436       
437        self.model_description.Bind(wx.EVT_BUTTON,self.on_button_clicked)
438        self.model_description.SetToolTipString("Click Model Functions in HelpWindow...")
439        self.model_description.SetFocus()
440        sizer_selection.Add( self.description_show )
441        sizer_selection.Add( (20,20)) 
442        sizer_selection.Add( self.description_hide )
443        sizer_selection.Add((20,20),0, wx.LEFT|wx.RIGHT|wx.EXPAND,75)
444        sizer_selection.Add( self.model_description )
445                     
446         
447        self.sizer_description=wx.BoxSizer(wx.HORIZONTAL)
448        self.sizer_description.Add( self.description, 1, wx.EXPAND | wx.ALL, 10 )
449        boxsizer1.Add( sizer_selection) 
450        boxsizer1.Add( (20,20)) 
451        boxsizer1.Add( self.sizer_description) 
452   
453        self._on_display_description(event=None)
454        sizer.Add(boxsizer1,0, wx.EXPAND | wx.ALL, 10)
455        sizer.Layout()
456   
457    def on_button_clicked(self,event):
458        """
459        On 'More details' button
460        """
461        from help_panel import  HelpWindow
462       
463        if self.model == None:
464            name = 'FuncHelp'
465        else:
466            name = self.model.name
467        frame = HelpWindow(None, -1,  pageToOpen="media/model_functions.html")   
468        frame.Show(True)
469        if frame.rhelp.HasAnchor(name):
470            frame.rhelp.ScrollToAnchor(name)
471        else:
472           msg= "Model does not contains an available description "
473           msg +="Please.Search in the Help window"
474           wx.PostEvent(self.parent, StatusEvent(status = msg ))
475                     
476    def set_range(self, qmin_x, qmax_x, npts):
477        """
478        Set the range for the plotted models
479       
480        :param qmin: minimum Q
481        :param qmax: maximum Q
482        :param npts: number of Q bins
483       
484        """
485        # Set the data members
486        self.qmin_x = qmin_x
487        self.qmax_x = qmax_x
488        self.num_points = npts
489        # Set the controls
490        #For qmin and qmax, do not use format_number.(If do, qmin and max could be different from what is in the data.)
491        self.qmin.SetValue(str(self.qmin_x))
492        self.qmax.SetValue(str(self.qmax_x))
493        self.npts.SetValue(format_number(self.num_points))
494       
495    def set_model_param_sizer(self, model):
496        """
497        Build the panel from the model content
498       
499        :param model: the model selected in combo box for fitting purpose
500       
501        """
502        self.sizer3.Clear(True)
503        self.parameters = []
504        self.param_toFit=[]
505        self.fixed_param=[]
506        self.orientation_params=[]
507        self.orientation_params_disp=[]
508        #self.temp=[]
509        if model ==None:
510            ##no model avaiable to draw sizer
511            self.sizer3.Layout()
512            self.SetScrollbars(20,20,25,65)
513            return
514        box_description= wx.StaticBox(self, -1,str("Model Parameters"))
515        boxsizer1 = wx.StaticBoxSizer(box_description, wx.VERTICAL)
516        sizer = wx.GridBagSizer(5,5)
517       
518        self.model = model
519        self.set_model_description(self.model.description,self.sizer2)
520       
521        keys = self.model.getParamList()
522        ##list of dispersion parameters
523        self.disp_list=self.model.getDispParamList()
524       
525        keys.sort()
526   
527        iy = 0
528        ix = 0
529        self.text1_2 = wx.StaticText(self, -1, 'Names')
530        sizer.Add(self.text1_2,(iy, ix),(1,1),\
531                             wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
532        ix +=1
533        self.text2_2 = wx.StaticText(self, -1, 'Values')
534        sizer.Add(self.text2_2,(iy, ix),(1,1),\
535                            wx.EXPAND|wx.ADJUST_MINSIZE, 0) 
536        ix +=1
537        self.text2_4 = wx.StaticText(self, -1, '[Units]')
538        sizer.Add(self.text2_4,(iy, ix),(1,1),\
539                            wx.EXPAND|wx.ADJUST_MINSIZE, 0) 
540        self.text2_4.Hide()
541       
542        for item in keys:
543            if not item in self.disp_list and not item in self.model.orientation_params:
544                iy += 1
545                ix = 0
546                name = wx.StaticText(self, -1,item)
547                sizer.Add( name,( iy, ix),(1,1),
548                             wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
549
550                ix += 1
551                value= self.model.getParam(item)
552                ctl1 = self.ModelTextCtrl(self, -1, size=(_BOX_WIDTH,20),
553                    style=wx.TE_PROCESS_ENTER)
554               
555                ctl1.SetValue(str (format_number(value)))
556               
557                sizer.Add(ctl1, (iy,ix),(1,1), wx.EXPAND)
558                ix +=1
559                # Units
560                if self.model.details.has_key(item):
561                    units = wx.StaticText(self, -1, self.model.details[item][0], style=wx.ALIGN_LEFT)
562                else:
563                    units = wx.StaticText(self, -1, "", style=wx.ALIGN_LEFT)
564                sizer.Add(units, (iy,ix),(1,1),  wx.EXPAND|wx.ADJUST_MINSIZE, 0)
565                ##[cb state, name, value, "+/-", error of fit, min, max , units]
566                self.parameters.append([None,item, ctl1,
567                                        None,None, None, None,None])
568        iy+=1
569        sizer.Add((10,10),(iy,ix),(1,1), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
570        iy += 1
571        ix = 0
572       
573        #Add tile for orientational angle parameters
574        for item in keys:
575            if item in self.model.orientation_params:       
576                orient_angle = wx.StaticText(self, -1, '[For 2D only]:')
577                sizer.Add(orient_angle,(iy, ix),(1,1), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 
578                if not self.enable2D:
579                    orient_angle.Hide()
580                else:
581                    orient_angle.Show(True)
582                break
583                                         
584        for item  in self.model.orientation_params:
585            if not item in self.disp_list and item in keys:
586                iy += 1
587                ix = 0
588                name = wx.StaticText(self, -1,item)
589                sizer.Add( name,( iy, ix),(1,1),
590                             wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
591                if not self.enable2D:
592                    name.Hide()
593                else:
594                    name.Show(True)
595
596                ix += 1
597                value= self.model.getParam(item)
598                ctl1 = self.ModelTextCtrl(self, -1, size=(_BOX_WIDTH,20),
599                    style=wx.TE_PROCESS_ENTER)
600               
601                ctl1.SetValue(str (format_number(value)))
602                if not self.enable2D:
603                    ctl1.Hide()
604                    ctl1.Disable()
605                else:
606                    ctl1.Show(True)
607                    ctl1.Enable()
608               
609                sizer.Add(ctl1, (iy,ix),(1,1), wx.EXPAND)
610                ix +=1
611                # Units
612                if self.model.details.has_key(item):
613                    units = wx.StaticText(self, -1, self.model.details[item][0], style=wx.ALIGN_LEFT)
614                else:
615                    units = wx.StaticText(self, -1, "", style=wx.ALIGN_LEFT)
616                if not self.enable2D:
617                    units.Hide()
618                else:
619                    units.Show(True)
620   
621                sizer.Add(units, (iy,ix),(1,1),  wx.EXPAND|wx.ADJUST_MINSIZE, 0)
622                #Save 2D orient. params
623                #self.temp.append([name,ctl1,units,orient_angle])
624               
625                               
626                ##[cb state, name, value, "+/-", error of fit, min, max , units]
627                self.parameters.append([None,item, ctl1,
628                                        None,None, None, None,None])
629                self.orientation_params.append([None,item, ctl1,
630                                        None,None, None, None,None]) 
631        iy += 1
632       
633        #Display units text on panel
634        for item in keys:   
635            self.text2_4.Show()
636
637        boxsizer1.Add(sizer)
638        self.sizer3.Add(boxsizer1,0, wx.EXPAND | wx.ALL, 10)
639        self.sizer3.Layout()
640        self.SetScrollbars(20,20,25,65)
641               
Note: See TracBrowser for help on using the repository browser.