source: sasview/fittingview/src/sans/perspectives/fitting/simfitpage.py @ 1976004

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 1976004 was 1976004, checked in by Jae Cho <jhjcho@…>, 13 years ago

found and fixed a problem with set focus

  • Property mode set to 100644
File size: 24.9 KB
Line 
1
2import sys,re,string, wx 
3import wx.lib.newevent 
4from sans.guiframe.events import StatusEvent
5from sans.guiframe.panel_base import PanelBase
6from wx.lib.scrolledpanel import ScrolledPanel
7from sans.guiframe.events import PanelOnFocusEvent
8#Control panel width
9if sys.platform.count("darwin")==0:
10    PANEL_WID = 420
11    FONT_VARIANT = 0
12else:
13    PANEL_WID = 490
14    FONT_VARIANT = 1
15           
16def get_fittableParam( model):
17    """
18    return list of fittable parameters name of a model
19   
20    :param model: the model used
21   
22    """
23    fittable_param=[]
24   
25    for item in model.getParamList():
26        if not item  in model.getDispParamList():
27            if not item in model.non_fittable:
28                fittable_param.append(item)
29           
30    for item in model.fixed:
31        fittable_param.append(item)
32       
33    return fittable_param
34
35class SimultaneousFitPage(ScrolledPanel, PanelBase):
36    """
37    Simultaneous fitting panel
38    All that needs to be defined are the
39    two data members window_name and window_caption
40    """
41    ## Internal name for the AUI manager
42    window_name = "simultaneous Fit page"
43    ## Title to appear on top of the window
44    window_caption = "Simultaneous Fit Page"
45   
46   
47    def __init__(self, parent,page_finder ={}, *args, **kwargs):
48        ScrolledPanel.__init__(self, parent,style= wx.FULL_REPAINT_ON_RESIZE )
49        PanelBase.__init__(self, parent)
50        """
51        Simultaneous page display
52        """
53        ##Font size
54        self.SetWindowVariant(variant = FONT_VARIANT)
55        self.uid = wx.NewId()
56        self.parent = parent
57        ## store page_finder
58        self.page_finder = page_finder
59        ## list contaning info to set constraint
60        ## look like self.constraint_dict[page_id]= page
61        self.constraint_dict={}
62        ## item list  self.constraints_list=[combobox1, combobox2,=,textcrtl, button ]
63        self.constraints_list=[]
64        ## list of current model
65        self.model_list=[]
66        ## selected mdoel to fit
67        self.model_toFit=[]
68        ## number of constraint
69        self.nb_constraint= 0
70        self.uid = wx.NewId()
71        ## draw page
72        self.define_page_structure()
73        self.draw_page()
74        self.set_layout()
75       
76    def define_page_structure(self):
77        """
78        Create empty sizer for a panel
79        """
80        self.vbox  = wx.BoxSizer(wx.VERTICAL)
81        self.sizer1 = wx.BoxSizer(wx.VERTICAL)
82        self.sizer2 = wx.BoxSizer(wx.VERTICAL)
83        self.sizer3 = wx.BoxSizer(wx.VERTICAL)
84
85        self.sizer1.SetMinSize((PANEL_WID,-1))
86        self.sizer2.SetMinSize((PANEL_WID,-1))
87        self.sizer3.SetMinSize((PANEL_WID,-1))
88        self.vbox.Add(self.sizer1)
89        self.vbox.Add(self.sizer2)
90        self.vbox.Add(self.sizer3)
91       
92    def set_scroll(self):
93        """
94        """
95        self.SetScrollbars(20,20,25,65)
96        self.Layout() 
97         
98    def set_layout(self):
99        """
100        layout
101        """
102        self.vbox.Layout()
103        self.vbox.Fit(self) 
104        self.SetSizer(self.vbox)
105        self.set_scroll()
106        self.Centre()
107       
108    def onRemove(self, event):
109        """
110        Remove constraint fields
111        """
112        if len(self.constraints_list)==1:
113            self.hide_constraint.SetValue(True)
114            self._hide_constraint()
115            return 
116        if len(self.constraints_list)==0:
117            return 
118        for item in self.constraints_list:
119            length= len(item)
120            if event.GetId()==item[length-2].GetId():
121                sizer= item[length-1]
122                sizer.Clear(True)
123                self.sizer_constraints.Remove(sizer)
124             
125                self.sizer2.Layout()
126                self.SetScrollbars(20,20,25,65)
127                self.constraints_list.remove(item)
128                self.nb_constraint -= 1
129                break
130               
131    def onFit(self, event):
132        """
133        signal for fitting
134       
135        """
136        ## making sure all parameters content a constraint
137        ## validity of the constraint expression is own by fit engine
138        if self.show_constraint.GetValue():
139            self._set_constraint()
140        ## model was actually selected from this page to be fit
141        if len(self.model_toFit) >= 1 :
142            self.manager._reset_schedule_problem(value=0)
143            for item in self.model_list:
144                if item[0].GetValue():
145                    self.manager.schedule_for_fit(value=1, uid=item[2]) 
146            self.manager.onFit(uid=self.uid)
147        else:
148            msg= "Select at least one model to fit "
149            wx.PostEvent(self.parent.Parent, StatusEvent(status=msg))
150           
151    def set_manager(self, manager):
152        """
153        set panel manager
154       
155        :param manager: instance of plugin fitting
156       
157        """
158        self.manager = manager
159       
160    def check_all_model_name(self,event):
161        """
162        check all models names
163        """
164        self.model_toFit = [] 
165        if self.cb1.GetValue()== True:
166            for item in self.model_list:
167                if item[0].IsEnabled():
168                    item[0].SetValue(True)
169                    self.model_toFit.append(item)
170               
171            ## constraint info
172            self._store_model()
173            ## display constraint fields
174            if self.show_constraint.GetValue():
175                self._show_constraint()
176                return
177        else:
178            for item in self.model_list:
179                item[0].SetValue(False) 
180               
181            self.model_toFit=[]
182            ##constraint info
183            self._hide_constraint()
184       
185    def check_model_name(self,event):
186        """
187        Save information related to checkbox and their states
188        """
189        self.model_toFit=[]
190        for item in self.model_list:
191            if item[0].GetValue()==True:
192                self.model_toFit.append(item)
193            else:
194                if item in self.model_toFit:
195                    self.model_toFit.remove(item)
196                    self.cb1.SetValue(False)
197       
198        ## display constraint fields
199        if len(self.model_toFit)==2:
200            self._store_model()
201            if self.show_constraint.GetValue() and len(self.constraints_list)==0:
202                self._show_constraint()
203        elif len(self.model_toFit)< 2:
204            ##constraint info
205            self._hide_constraint()             
206       
207        ## set the value of the main check button         
208        if len(self.model_list)==len(self.model_toFit):
209            self.cb1.SetValue(True)
210            return
211        else:
212            self.cb1.SetValue(False)
213       
214    def draw_page(self):     
215        """
216        Draw a sizer containing couples of data and model
217        """ 
218        self.model_list=[]
219        self.model_toFit=[]
220        self.constraints_list=[]
221        self.constraint_dict={}
222        self.nb_constraint= 0
223       
224        if len(self.model_list)>0:
225            for item in self.model_list:
226                item[0].SetValue(False) 
227                self.manager.schedule_for_fit(value=0, uid=item[2])
228               
229        self.sizer1.Clear(True)   
230        box_description= wx.StaticBox(self, -1,"Fit Combinations")
231        boxsizer1 = wx.StaticBoxSizer(box_description, wx.VERTICAL)
232        sizer_title = wx.BoxSizer(wx.HORIZONTAL)
233        sizer_couples = wx.GridBagSizer(5,5)
234        #------------------------------------------------------
235        if len(self.page_finder)==0:
236            msg = " No fit combinations are found! \n\n"
237            msg += " Please load data and set up at least two fit panels first..."
238            sizer_title.Add(wx.StaticText(self, -1, msg))
239        else:
240            ## store model 
241            self._store_model()
242       
243            self.cb1 = wx.CheckBox(self, -1,'Select all')
244            self.cb1.SetValue(False)
245            wx.EVT_CHECKBOX(self, self.cb1.GetId(), self.check_all_model_name)
246           
247            sizer_title.Add((10,10),0,
248                wx.TOP|wx.BOTTOM|wx.EXPAND|wx.ADJUST_MINSIZE,border=5)
249            sizer_title.Add(self.cb1,0,
250                wx.TOP|wx.BOTTOM|wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE,border=5)
251           
252            ## draw list of model and data name
253            self._fill_sizer_model_list(sizer_couples)
254            ## draw the sizer containing constraint info
255            self._fill_sizer_constraint()
256            ## draw fit button
257            self._fill_sizer_fit()
258        #--------------------------------------------------------
259        boxsizer1.Add(sizer_title, flag= wx.TOP|wx.BOTTOM,border=5) 
260        boxsizer1.Add(sizer_couples, flag= wx.TOP|wx.BOTTOM,border=5)
261       
262        self.sizer1.Add(boxsizer1,1, wx.EXPAND | wx.ALL, 10)
263        self.sizer1.Layout()
264        self.SetScrollbars(20,20,25,65)
265        self.AdjustScrollbars()
266       
267    def _store_model(self):
268        """
269         Store selected model
270        """
271        if len(self.model_toFit) < 2:
272            return
273        for item in self.model_toFit:
274            model = item[3]
275            page_id= item[2]
276            self.constraint_dict[page_id] = model
277                   
278    def _display_constraint(self, event):
279        """
280        Show fields to add constraint
281        """
282        if len(self.model_toFit)< 2:
283            msg= "Select at least 2 models to add constraint "
284            wx.PostEvent(self.parent.Parent, StatusEvent(status= msg ))
285            ## hide button
286            self._hide_constraint()
287            return
288        if self.show_constraint.GetValue():
289            self._show_constraint()
290            return
291        else:
292           self._hide_constraint()
293           return 
294           
295    def _show_constraint(self):
296        """
297        Show constraint fields
298        """
299        self.btAdd.Show(True)
300        if len(self.constraints_list)!= 0:
301            nb_fit_param = 0
302            for model in self.constraint_dict.values():
303                nb_fit_param += len(get_fittableParam(model))
304            ##Don't add anymore
305            if len(self.constraints_list) == nb_fit_param:
306                msg= "Cannot add another constraint .Maximum of number "
307                msg += "Parameters name reached %s"%str(nb_fit_param)
308                wx.PostEvent(self.parent.Parent, StatusEvent(status= msg ))
309                self.sizer_constraints.Layout()
310                self.sizer2.Layout()
311                self.SetScrollbars(20,20,25,65)
312                return
313           
314        if len(self.model_toFit) < 2 :
315            msg= "Select at least 2 model to add constraint "
316            wx.PostEvent(self.parent.Parent, StatusEvent(status= msg ))
317            self.sizer_constraints.Layout()
318            self.sizer2.Layout()
319            self.SetScrollbars(20,20,25,65)
320            return
321           
322        sizer_constraint =  wx.BoxSizer(wx.HORIZONTAL)
323        model_cbox = wx.ComboBox(self, -1,style=wx.CB_READONLY)
324        model_cbox.Clear()
325        param_cbox = wx.ComboBox(self, -1,style=wx.CB_READONLY)
326        param_cbox.Hide()
327       
328        #This is for GetCLientData() _on_select_param: Was None return on MAC.
329        self.param_cbox = param_cbox
330       
331        wx.EVT_COMBOBOX(param_cbox,-1, self._on_select_param)
332        ctl2 = wx.TextCtrl(self, -1)
333        egal_txt= wx.StaticText(self,-1," = ")
334        btRemove = wx.Button(self,wx.NewId(),'Remove')
335        btRemove.Bind(wx.EVT_BUTTON, self.onRemove,id= btRemove.GetId())
336        btRemove.SetToolTipString("Remove constraint.")
337       
338        for id,model in self.constraint_dict.iteritems():
339            ## check if all parameters have been selected for constraint
340            ## then do not allow add constraint on parameters
341            model_cbox.Append( str(model.name), model)
342           
343        #This is for GetCLientData() passing to self._on_select_param: Was None return on MAC.
344        self.model_cbox = model_cbox
345           
346        wx.EVT_COMBOBOX(model_cbox,-1, self._on_select_model)
347   
348        sizer_constraint.Add(model_cbox, flag= wx.RIGHT|wx.EXPAND,border=10)
349        sizer_constraint.Add(param_cbox, flag= wx.RIGHT|wx.EXPAND,border=5)
350        sizer_constraint.Add(egal_txt, flag= wx.RIGHT|wx.EXPAND,border=5)
351        sizer_constraint.Add(ctl2, flag= wx.RIGHT|wx.EXPAND,border=10)
352        sizer_constraint.Add(btRemove, flag= wx.RIGHT|wx.EXPAND,border=10)
353     
354        self.sizer_constraints.Insert(before=self.nb_constraint,
355                                      item=sizer_constraint, flag= wx.TOP|wx.BOTTOM|wx.EXPAND,
356                                   border=5)
357        ##[combobox1, combobox2,=,textcrtl, remove button ]
358        self.constraints_list.append([model_cbox, param_cbox, egal_txt, ctl2,btRemove,sizer_constraint])
359   
360        self.nb_constraint += 1
361        self.sizer_constraints.Layout()
362        self.sizer2.Layout()
363        self.SetScrollbars(20,20,25,65)
364       
365    def _hide_constraint(self): 
366        """
367        hide buttons related constraint
368        """ 
369        for id in  self.page_finder.iterkeys():
370            self.page_finder[id].clear_model_param()
371               
372        self.nb_constraint =0     
373        self.constraint_dict={}
374        if hasattr(self,"btAdd"):
375            self.btAdd.Hide()
376        self._store_model()
377        self.constraints_list=[]         
378        self.sizer_constraints.Clear(True) 
379        self.sizer_constraints.Layout()   
380        self.sizer2.Layout()
381        self.SetScrollbars(20,20,25,65)
382        self.AdjustScrollbars()   
383           
384    def _on_select_model(self, event):
385        """
386        fill combox box with list of parameters
387        """
388        ##This way PC/MAC both work, instead of using event.GetClientData().
389        n = self.model_cbox.GetCurrentSelection()
390        model = self.model_cbox.GetClientData(n)
391       
392        param_list= get_fittableParam(model)
393        length = len(self.constraints_list)
394        if length < 1:
395            return 
396        param_cbox = self.constraints_list[length-1][1]
397        param_cbox.Clear()
398        ## insert only fittable paramaters
399        for param in param_list:
400            param_cbox.Append( str(param), model)
401           
402        param_cbox.Show(True)
403        self.sizer2.Layout()
404        self.SetScrollbars(20,20,25,65)
405       
406    def _on_select_param(self, event):
407        """
408        Store the appropriate constraint in the page_finder
409        """
410        ##This way PC/MAC both work, instead of using event.GetClientData().
411        n = self.param_cbox.GetCurrentSelection()
412        model = self.param_cbox.GetClientData(n)
413        param = event.GetString()
414     
415        length = len(self.constraints_list)
416        if length < 1:
417            return 
418        egal_txt = self.constraints_list[length-1][2]
419        egal_txt.Show(True)       
420       
421        ctl2 = self.constraints_list[length-1][3]
422        ctl2.Show(True)
423        #self.sizer2.Layout()
424        self.SetScrollbars(20,20,25,65)
425       
426    def _onAdd_constraint(self, event): 
427        """
428        Add another line for constraint
429        """
430        if not self.show_constraint.GetValue():
431            msg= " Select Yes to add Constraint "
432            wx.PostEvent(self.parent.Parent, StatusEvent(status= msg ))
433            return 
434        ## check that a constraint is added before allow to add another cosntraint
435        for item in self.constraints_list:
436            model_cbox = item[0]
437            if model_cbox.GetString(0)=="":
438                msg= " Select a model Name! "
439                wx.PostEvent(self.parent.Parent, StatusEvent(status= msg ))
440                return 
441            param_cbox = item[1]
442            if param_cbox.GetString(0)=="":
443                msg= " Select a parameter Name! "
444                wx.PostEvent(self.parent.Parent, StatusEvent(status= msg ))
445                return 
446            ctl2 = item[3]
447            if ctl2.GetValue().lstrip().rstrip()=="":
448                model= param_cbox.GetClientData(param_cbox.GetCurrentSelection())
449                msg= " Enter a constraint for %s.%s! "%(model.name,param_cbox.GetString(0))           
450                wx.PostEvent(self.parent.Parent, StatusEvent(status= msg ))
451                return 
452        ## some model or parameters can be constrained
453        self._show_constraint()
454       
455    def _fill_sizer_fit(self):
456        """
457        Draw fit button
458        """
459        self.sizer3.Clear(True)
460        box_description= wx.StaticBox(self, -1,"Fit ")
461        boxsizer1 = wx.StaticBoxSizer(box_description, wx.VERTICAL)
462        sizer_button = wx.BoxSizer(wx.HORIZONTAL)
463         
464        self.btFit = wx.Button(self,wx.NewId(),'Fit')
465        self.btFit.Bind(wx.EVT_BUTTON, self.onFit,id= self.btFit.GetId())
466        self.btFit.SetToolTipString("Perform fit.")
467       
468        text= "Hint: Park fitting engine will be selected \n"
469        text+= "automatically for more than 2 combinations checked"
470        text_hint = wx.StaticText(self,-1,text)
471       
472        sizer_button.Add(text_hint,  wx.RIGHT|wx.EXPAND, 10)
473        sizer_button.Add(self.btFit, 0, wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 10)
474       
475        boxsizer1.Add(sizer_button, flag= wx.TOP|wx.BOTTOM,border=10)
476        self.sizer3.Add(boxsizer1,0, wx.EXPAND | wx.ALL, 10)
477        self.sizer3.Layout()
478        self.SetScrollbars(20,20,25,65)
479       
480    def _fill_sizer_constraint(self):
481        """
482        Fill sizer containing constraint info
483        """
484        msg = "Select at least 2 model to add constraint "
485        wx.PostEvent(self.parent.Parent, StatusEvent(status= msg ))
486       
487        self.sizer2.Clear(True)
488        box_description= wx.StaticBox(self, -1,"Fit Constraints")
489        boxsizer1 = wx.StaticBoxSizer(box_description, wx.VERTICAL)
490        sizer_title = wx.BoxSizer(wx.HORIZONTAL)
491        self.sizer_constraints = wx.BoxSizer(wx.VERTICAL)
492        sizer_button = wx.BoxSizer(wx.HORIZONTAL)
493       
494        self.hide_constraint = wx.RadioButton(self, -1, 'No', (10, 10), style=wx.RB_GROUP)
495        self.show_constraint = wx.RadioButton(self, -1, 'Yes', (10, 30))
496        self.Bind( wx.EVT_RADIOBUTTON, self._display_constraint,
497                    id= self.hide_constraint.GetId() )
498        self.Bind(  wx.EVT_RADIOBUTTON, self._display_constraint,
499                         id= self.show_constraint.GetId()    )
500        self.hide_constraint.SetValue(True)
501        sizer_title.Add( wx.StaticText(self,-1," Model") )
502        sizer_title.Add(( 10,10) )
503        sizer_title.Add( wx.StaticText(self,-1," Parameter") )
504        sizer_title.Add(( 10,10) )
505        sizer_title.Add( wx.StaticText(self,-1," Add Constraint?") )
506        sizer_title.Add(( 10,10) )
507        sizer_title.Add( self.show_constraint )
508        sizer_title.Add( self.hide_constraint )
509        sizer_title.Add(( 10,10) )
510       
511        self.btAdd =wx.Button(self,wx.NewId(),'Add')
512        self.btAdd.Bind(wx.EVT_BUTTON, self._onAdd_constraint,id= self.btAdd.GetId())
513        self.btAdd.SetToolTipString("Add another constraint?")
514        self.btAdd.Hide()
515     
516        text_hint = wx.StaticText(self,-1,"Example: [M0][paramter] = M1.parameter") 
517        sizer_button.Add(text_hint, 0 , wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 10)
518        sizer_button.Add(self.btAdd, 0, wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 10)
519       
520        boxsizer1.Add(sizer_title, flag= wx.TOP|wx.BOTTOM,border=10)
521        boxsizer1.Add(self.sizer_constraints, flag= wx.TOP|wx.BOTTOM,border=10)
522        boxsizer1.Add(sizer_button, flag= wx.TOP|wx.BOTTOM,border=10)
523       
524        self.sizer2.Add(boxsizer1,0, wx.EXPAND | wx.ALL, 10)
525        self.sizer2.Layout()
526        self.SetScrollbars(20,20,25,65)
527   
528    def _set_constraint(self):
529        """
530        get values from the constrainst textcrtl ,parses them into model name
531        parameter name and parameters values.
532        store them in a list self.params .when when params is not empty set_model
533        uses it to reset the appropriate model and its appropriates parameters
534        """
535        for item in self.constraints_list:
536            model = item[0].GetClientData(item[0].GetCurrentSelection())
537            param = item[1].GetString(item[1].GetCurrentSelection())
538            constraint = item[3].GetValue().lstrip().rstrip()
539            if param.lstrip().rstrip()=="":
540                param= None
541                msg= " Constraint will be ignored!. missing parameters in combobox"
542                msg+= " to set constraint! "
543                wx.PostEvent(self.parent.Parent, StatusEvent(status= msg ))
544            for id, value in self.constraint_dict.iteritems():
545                if model == value:
546                    if constraint == "":
547                        msg= " Constraint will be ignored!. missing value in textcrtl"
548                        msg+= " to set constraint! "
549                        wx.PostEvent(self.parent.Parent, StatusEvent(status= msg ))
550                        constraint = None
551                    for fid in self.page_finder[id].iterkeys():
552                        self.page_finder[id].set_model_param(param,
553                                                        constraint, fid=fid)
554                    break
555   
556    def _fill_sizer_model_list(self,sizer):
557        """
558        Receive a dictionary containing information to display model name
559       
560        :param page_finder: the dictionary containing models information
561       
562        """
563        ix = 0
564        iy = 0
565        list=[]
566        sizer.Clear(True)
567       
568        new_name = wx.StaticText(self, -1, 'New Model Name', style=wx.ALIGN_CENTER)
569        new_name.SetBackgroundColour('orange')
570        sizer.Add(new_name,(iy, ix),(1,1),
571                            wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
572        ix += 2 
573        model_type = wx.StaticText(self, -1, '  Model Type')
574        model_type.SetBackgroundColour('grey')
575        sizer.Add(model_type,(iy, ix),(1,1),
576                            wx.EXPAND|wx.ADJUST_MINSIZE, 0) 
577        ix += 1 
578        data_used = wx.StaticText(self, -1, '  Used Data')
579        data_used.SetBackgroundColour('grey')
580        sizer.Add(data_used,(iy, ix),(1,1),
581                            wx.EXPAND|wx.ADJUST_MINSIZE, 0) 
582        ix += 1 
583        tab_used = wx.StaticText(self, -1, '  Fit Tab')
584        tab_used.SetBackgroundColour('grey')
585        sizer.Add(tab_used,(iy, ix),(1,1),
586                            wx.EXPAND|wx.ADJUST_MINSIZE, 0) 
587        for id, value in self.page_finder.iteritems():
588            try:
589                ix = 0
590                iy += 1 
591                for fitproblem in value.get_fit_problem():
592                    data = fitproblem.get_fit_data()
593                    model = fitproblem.get_model()
594                    name = '_'
595                    if model is not None:
596                        name = str(model.name)
597                    cb = wx.CheckBox(self, -1, name)
598                    cb.SetValue(False)
599                    cb.Enable(model is not None and data.is_data)
600                    sizer.Add(cb, (iy, ix), (1, 1), 
601                               wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
602                    wx.EVT_CHECKBOX(self, cb.GetId(), self.check_model_name)
603                    ix += 2 
604                    type = model.__class__.__name__
605                    model_type = wx.StaticText(self, -1, str(type))
606                    sizer.Add(model_type, (iy, ix), (1, 1), 
607                              wx.EXPAND|wx.ADJUST_MINSIZE, 0)
608                    name = '-'
609                    if data is not None and data.is_data:
610                        name = str(data.name)
611                    data_used = wx.StaticText(self, -1, name)
612                    ix += 1 
613                    sizer.Add(data_used, (iy, ix), (1, 1), 
614                              wx.EXPAND|wx.ADJUST_MINSIZE, 0)
615                    ix += 1 
616                    caption = value.get_fit_tab_caption()
617                    tab_caption_used= wx.StaticText(self, -1, str(caption))
618                    sizer.Add(tab_caption_used, (iy, ix), (1, 1), 
619                              wx.EXPAND|wx.ADJUST_MINSIZE, 0)
620                   
621                self.model_list.append([cb,value,id,model])
622               
623            except:
624                raise
625                #pass
626        iy += 1
627        sizer.Add((20, 20), (iy, ix), (1, 1), 
628                  wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
629        sizer.Layout()   
630
631    def on_set_focus(self, event=None):
632        """
633        The  derivative class is on focus if implemented
634        """
635        if self.parent is not None:
636            if self.parent.parent is not None:
637                wx.PostEvent(self.parent.parent, PanelOnFocusEvent(panel=self))
638            self.page_finder = self.parent._manager.get_page_finder()
639       
Note: See TracBrowser for help on using the repository browser.