source: sasview/prview/perspectives/pr/inversion_panel.py @ f71287f4

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 f71287f4 was 32dffae4, checked in by Mathieu Doucet <doucetm@…>, 16 years ago

Added alpha estimator and help

  • Property mode set to 100644
File size: 21.6 KB
Line 
1#!/usr/bin/env python
2
3# version
4__id__ = "$Id: aboutdialog.py 1193 2007-05-03 17:29:59Z dmitriy $"
5__revision__ = "$Revision: 1193 $"
6
7import wx
8from sans.guicomm.events import StatusEvent   
9
10class InversionDlg(wx.Dialog):
11    def __init__(self, parent, id, title, plots, file=False, pars=True):
12       
13        # Estimate size
14        nplots = len(plots)
15        # y size for data set only
16        ysize  = 110 + nplots*20
17        # y size including parameters
18        if pars:
19            ysize  += 90
20       
21        wx.Dialog.__init__(self, parent, id, title, size=(250, ysize))
22        self.SetTitle(title)
23
24        # Data set
25        self.datasets = InversionPanel(self, -1, plots)
26        vbox = wx.BoxSizer(wx.VERTICAL)
27
28        vbox.Add(self.datasets)
29
30        # Parameters
31        self.pars_flag = False
32        if pars==True:
33            self.pars_flag = True
34            self.pars = ParsDialog(self, -1, file=file)
35            vbox.Add(self.pars)
36
37        static_line = wx.StaticLine(self, -1)
38        vbox.Add(static_line, 0, wx.EXPAND, 0)
39       
40        button_OK = wx.Button(self, wx.ID_OK, "OK")
41        button_Cancel = wx.Button(self, wx.ID_CANCEL, "Cancel")
42       
43        sizer_button = wx.BoxSizer(wx.HORIZONTAL)
44        sizer_button.Add((20, 20), 1, wx.EXPAND|wx.ADJUST_MINSIZE, 0)
45        sizer_button.Add(button_OK, 0, wx.LEFT|wx.ADJUST_MINSIZE, 10)
46        sizer_button.Add(button_Cancel, 0, wx.LEFT|wx.RIGHT|wx.ADJUST_MINSIZE, 10)       
47        vbox.Add(sizer_button, 0, wx.EXPAND|wx.BOTTOM|wx.TOP, 10)
48
49        self.SetSizer(vbox)
50        self.SetAutoLayout(True)
51       
52        self.Layout()
53        self.Centre()
54
55    def get_content(self):
56        dataset = self.datasets.get_selected()
57        if self.pars_flag:
58            nfunc, alpha, dmax, file = self.pars.getContent()
59            return dataset, nfunc, alpha, dmax
60        else:
61            return dataset
62   
63    def set_content(self, dataset, nfunc, alpha, dmax):
64        if not dataset==None and dataset in self.datasets.radio_buttons.keys():
65            self.datasets.radio_buttons[dataset].SetValue(True)
66        if self.pars_flag:
67            self.pars.setContent(nfunc, alpha, dmax, None)
68
69class InversionPanel(wx.Panel):
70   
71    def __init__(self, parent, id = -1, plots = None, **kwargs):
72        wx.Panel.__init__(self, parent, id = id, **kwargs)
73       
74        self.plots = plots
75        self.radio_buttons = {}
76       
77        self._do_layout()
78       
79    def _do_layout(self):
80        panel = wx.Panel(self, -1)
81        vbox = wx.BoxSizer(wx.VERTICAL)
82
83        ysize = 30+20*len(self.plots)
84        wx.StaticBox(panel, -1, 'Choose a data set', (5, 5), (230, ysize))
85        ypos = 30
86        self.radio_buttons = {}
87        for item in self.plots.keys():
88            self.radio_buttons[self.plots[item].name] = wx.RadioButton(panel, -1, self.plots[item].name, (15, ypos))
89            ypos += 20
90       
91        vbox.Add(panel)
92
93        self.SetSizer(vbox)
94       
95    def get_selected(self):
96        for item in self.radio_buttons:
97            if self.radio_buttons[item].GetValue():
98                return item
99        return None
100
101class InversionControl(wx.Panel):
102    window_name = 'pr_control'
103    window_caption = "P(r) control panel"
104    CENTER_PANE = True
105   
106    # Figure of merit parameters [default]
107    oscillation_max = 1.5
108   
109    def __init__(self, parent, id = -1, plots = None, **kwargs):
110        wx.Panel.__init__(self, parent, id = id, **kwargs)
111       
112        self.plots = plots
113        self.radio_buttons = {}
114       
115        ## Data file TextCtrl
116        self.data_file = None
117        self.plot_data = None
118        self.nfunc_ctl = None
119        self.alpha_ctl = None
120        self.dmax_ctl  = None
121        self.time_ctl  = None
122        self.chi2_ctl  = None
123        self.osc_ctl  = None
124        self.file_radio = None
125        self.plot_radio = None
126       
127        ## Estimates
128        self.alpha_estimate_ctl = None
129       
130        ## Data manager
131        self.manager   = None
132       
133        self._do_layout()
134       
135    def __setattr__(self, name, value):
136        """
137            Allow direct hooks to text boxes
138        """
139        if name=='nfunc':
140            self.nfunc_ctl.SetValue(str(value))
141        elif name=='d_max':
142            self.dmax_ctl.SetValue(str(value))
143        elif name=='alpha':
144            self.alpha_ctl.SetValue(str(value))
145        elif name=='chi2':
146            self.chi2_ctl.SetValue("%-5.3g" % value)
147        elif name=='elapsed':
148            self.time_ctl.SetValue("%-5.2g" % value)
149        elif name=='oscillation':
150            self.osc_ctl.SetValue("%-5.2g" % value)
151        elif name=='alpha_estimate':
152            self.alpha_estimate_ctl.SetValue("%-3.1g" % value)
153        elif name=='plotname':
154            self.plot_data.SetValue(str(value))
155            self.plot_radio.SetValue(True)
156            self._on_pars_changed(None)
157        else:
158            wx.Panel.__setattr__(self, name, value)
159       
160    def __getattr__(self, name):
161        """
162            Allow direct hooks to text boxes
163        """
164        if name=='nfunc':
165            int(self.nfunc_ctl.GetValue())
166        elif name=='d_max':
167            self.dmax_ctl.GetValue()
168        elif name=='alpha':
169            self.alpha_ctl.GetValue()
170        elif name=='chi2':
171            self.chi2_ctl.GetValue()
172        elif name=='elapsed':
173            self.time_ctl.GetValue()
174        elif name=='oscillation':
175            self.osc_ctl.GetValue()
176        elif name=='alpha_estimate':
177            self.alpha_estimate_ctl.GetValue()
178        elif name=='plotname':
179            self.plot_data.GetValue()
180        else:
181            wx.Panel.__getattr__(self, name)
182       
183    def set_manager(self, manager):
184        self.manager = manager
185        # Get data
186       
187        # Push data to form
188       
189       
190    def _do_layout(self):
191        #panel = wx.Panel(self, -1)
192        vbox = wx.BoxSizer(wx.VERTICAL)
193
194        # ----- I(q) data -----
195        databox = wx.StaticBox(self, -1, "I(q) data")
196       
197        boxsizer1 = wx.StaticBoxSizer(databox, wx.VERTICAL)
198        boxsizer1.SetMinSize((320,50))
199        pars_sizer = wx.GridBagSizer(5,5)
200
201        iy = 0
202        self.file_radio = wx.RadioButton(self, -1, "File data:")
203        self.data_file = wx.TextCtrl(self, -1, size=(100,20))
204        self.data_file.SetEditable(False)
205        self.data_file.SetValue("")
206        id = wx.NewId()
207        choose_button = wx.Button(self, id, "Choose file")
208        self.Bind(wx.EVT_BUTTON, self._change_file, id = id)   
209        pars_sizer.Add(self.file_radio, (iy,0), (1,1), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
210        pars_sizer.Add(self.data_file, (iy,1), (1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 15)
211        pars_sizer.Add(choose_button, (iy,3), (1,1), wx.RIGHT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
212       
213        iy += 1
214        self.plot_radio = wx.RadioButton(self, -1, "Plot data:")
215        self.plot_data = wx.TextCtrl(self, -1, size=(100,20))
216        self.plot_data.SetEditable(False)
217        pars_sizer.Add(self.plot_radio, (iy,0), (1,1), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
218        pars_sizer.Add(self.plot_data, (iy,1), (1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 15)
219       
220        boxsizer1.Add(pars_sizer, 0, wx.EXPAND)
221        vbox.Add(boxsizer1)
222
223        # ----- Parameters -----
224        parsbox = wx.StaticBox(self, -1, "Parameters")
225        boxsizer2 = wx.StaticBoxSizer(parsbox, wx.VERTICAL)
226        boxsizer2.SetMinSize((320,50))
227       
228        explanation  = "P(r) is found by fitting a set of base functions to I(Q). "
229        explanation += "The minimization involves a regularization term to ensure "
230        explanation += "a smooth P(r). The alpha parameter gives the size of that " 
231        explanation += "term. The suggested value is the value above which the"
232        explanation += "output P(r) will have only one peak."
233        label_explain = wx.StaticText(self, -1, explanation, size=(280,80))
234        boxsizer2.Add(label_explain,  wx.LEFT|wx.BOTTOM, 5)
235       
236       
237       
238        label_nfunc = wx.StaticText(self, -1, "Number of terms")
239        label_nfunc.SetMinSize((120,20))
240        label_alpha = wx.StaticText(self, -1, "Regularization constant")
241        label_dmax  = wx.StaticText(self, -1, "Max distance [A]")
242        label_sugg  = wx.StaticText(self, -1, "Suggested value")
243       
244        self.nfunc_ctl = wx.TextCtrl(self, -1, size=(60,20))
245        self.nfunc_ctl.SetToolTipString("Number of terms in the expansion.")
246        self.alpha_ctl = wx.TextCtrl(self, -1, size=(60,20))
247        self.alpha_ctl.SetToolTipString("Control parameter for the size of the regularization term.")
248        self.dmax_ctl  = wx.TextCtrl(self, -1, size=(60,20))
249        self.dmax_ctl.SetToolTipString("Maximum distance between any two points in the system.")
250        self.alpha_estimate_ctl  = wx.TextCtrl(self, -1, size=(60,20))
251        self.alpha_estimate_ctl.Enable(False)
252        self.alpha_estimate_ctl.SetToolTipString("Value of alpha below which P(r) may have multiple peaks.")
253       
254        # EVT_TEXT would trigger an event for each character entered
255        self.nfunc_ctl.Bind(wx.EVT_KILL_FOCUS, self._on_pars_changed)
256        #self.alpha_ctl.Bind(wx.EVT_KILL_FOCUS, self._on_pars_changed)
257        self.dmax_ctl.Bind(wx.EVT_KILL_FOCUS, self._on_pars_changed)
258        self.Bind(wx.EVT_TEXT_ENTER, self._on_pars_changed)
259       
260        sizer_params = wx.GridBagSizer(5,5)
261
262        iy = 0
263        sizer_params.Add(label_sugg,       (iy,2), (1,1), wx.LEFT, 15)
264        iy += 1
265        sizer_params.Add(label_nfunc,      (iy,0), (1,1), wx.LEFT, 15)
266        sizer_params.Add(self.nfunc_ctl,   (iy,1), (1,1), wx.RIGHT, 0)
267        iy += 1
268        sizer_params.Add(label_alpha,      (iy,0), (1,1), wx.LEFT, 15)
269        sizer_params.Add(self.alpha_ctl,   (iy,1), (1,1), wx.RIGHT, 0)
270        sizer_params.Add(self.alpha_estimate_ctl, (iy,2), (1,1), wx.LEFT, 15)
271        iy += 1
272        sizer_params.Add(label_dmax, (iy,0), (1,1), wx.LEFT, 15)
273        sizer_params.Add(self.dmax_ctl,   (iy,1), (1,1), wx.RIGHT, 0)
274
275        boxsizer2.Add(sizer_params, 0)
276        vbox.Add(boxsizer2)
277
278        # ----- Results -----
279        resbox = wx.StaticBox(self, -1, "Outputs")
280        ressizer = wx.StaticBoxSizer(resbox, wx.VERTICAL)
281        ressizer.SetMinSize((320,50))
282       
283        label_time = wx.StaticText(self, -1, "Computation time")
284        label_time_unit = wx.StaticText(self, -1, "secs")
285        label_time.SetMinSize((120,20))
286        label_chi2 = wx.StaticText(self, -1, "Chi2/dof")
287        label_osc = wx.StaticText(self, -1, "Oscillations")
288       
289        self.time_ctl = wx.TextCtrl(self, -1, size=(60,20))
290        self.time_ctl.SetEditable(False)
291        self.time_ctl.SetToolTipString("Computation time for the last inversion, in seconds.")
292       
293        self.chi2_ctl = wx.TextCtrl(self, -1, size=(60,20))
294        self.chi2_ctl.SetEditable(False)
295        self.chi2_ctl.SetToolTipString("Chi^2 over degrees of freedom.")
296       
297        self.osc_ctl = wx.TextCtrl(self, -1, size=(60,20))
298        self.osc_ctl.SetEditable(False)
299        self.osc_ctl.SetToolTipString("Oscillation parameter. P(r) for a sphere has an oscillation parameter of 1.1.")
300       
301        sizer_res = wx.GridBagSizer(5,5)
302
303        iy = 0
304        sizer_res.Add(label_time, (iy,0), (1,1), wx.LEFT|wx.EXPAND, 15)
305        sizer_res.Add(self.time_ctl,   (iy,1), (1,1), wx.RIGHT|wx.EXPAND, 15)
306        sizer_res.Add(label_time_unit,   (iy,2), (1,1), wx.RIGHT|wx.EXPAND, 15)
307        iy += 1
308        sizer_res.Add(label_chi2, (iy,0), (1,1), wx.LEFT|wx.EXPAND, 15)
309        sizer_res.Add(self.chi2_ctl,   (iy,1), (1,1), wx.RIGHT|wx.EXPAND, 15)
310        iy += 1
311        sizer_res.Add(label_osc, (iy,0), (1,1), wx.LEFT|wx.EXPAND, 15)
312        sizer_res.Add(self.osc_ctl,   (iy,1), (1,1), wx.RIGHT|wx.EXPAND, 15)
313
314        ressizer.Add(sizer_res, 0)
315        vbox.Add(ressizer)
316
317        # ----- Buttons -----
318        static_line = wx.StaticLine(self, -1)
319        vbox.Add(static_line, 0, wx.EXPAND|wx.TOP, 10)
320       
321        id = wx.NewId()
322        button_OK = wx.Button(self, id, "Compute")
323        button_OK.SetToolTipString("Perform P(r) inversion.")
324        self.Bind(wx.EVT_BUTTON, self._on_invert, id = id)   
325        #button_Cancel = wx.Button(self, wx.ID_CANCEL, "Cancel")
326       
327        sizer_button = wx.BoxSizer(wx.HORIZONTAL)
328        sizer_button.Add((20, 20), 1, wx.EXPAND|wx.ADJUST_MINSIZE, 0)
329        sizer_button.Add(button_OK, 0, wx.LEFT|wx.ADJUST_MINSIZE, 10)
330        #sizer_button.Add(button_Cancel, 0, wx.LEFT|wx.RIGHT|wx.ADJUST_MINSIZE, 10)       
331        vbox.Add(sizer_button, 0, wx.EXPAND|wx.BOTTOM|wx.TOP, 10)
332
333
334        self.SetSizer(vbox)
335       
336    def _on_pars_changed(self, evt):
337        """
338            Called when an input parameter has changed
339            We will estimate the alpha parameter behind the
340            scenes.
341        """
342        flag, alpha, dmax, nfunc = self._read_pars()
343       
344        # If the pars are valid, estimate alpha
345        if flag:
346            if self.plot_radio.GetValue():
347                dataset = self.plot_data.GetValue()
348                self.manager.estimate_plot_inversion(alpha=alpha, nfunc=nfunc, 
349                                                     d_max=dmax)
350            else:
351                path = self.data_file.GetValue()
352                self.manager.estimate_file_inversion(alpha=alpha, nfunc=nfunc, 
353                                                     d_max=dmax, path=path)
354       
355       
356    def _read_pars(self):   
357        alpha = 0
358        nfunc = 5
359        dmax  = 120
360       
361        flag = True
362       
363        # Read alpha
364        try:
365            alpha = float(self.alpha_ctl.GetValue())
366            self.alpha_ctl.SetBackgroundColour(wx.WHITE)
367            self.alpha_ctl.Refresh()
368        except:
369            flag = False
370            self.alpha_ctl.SetBackgroundColour("pink")
371            self.alpha_ctl.Refresh()
372       
373        # Read d_max   
374        try:
375            dmax = float(self.dmax_ctl.GetValue())
376            self.dmax_ctl.SetBackgroundColour(wx.WHITE)
377            self.dmax_ctl.Refresh()
378        except:
379            flag = False
380            self.dmax_ctl.SetBackgroundColour("pink")
381            self.dmax_ctl.Refresh()
382           
383        # Read nfunc
384        try:
385            nfunc = int(self.nfunc_ctl.GetValue())
386            self.nfunc_ctl.SetBackgroundColour(wx.WHITE)
387            self.nfunc_ctl.Refresh()
388        except:
389            flag = False
390            self.nfunc_ctl.SetBackgroundColour("pink")
391            self.nfunc_ctl.Refresh()
392       
393        return flag, alpha, dmax, nfunc
394   
395    def _on_invert(self, evt):
396        """
397            Perform inversion
398            @param silent: when True, there will be no output for the user
399        """
400        # Get the data from the form
401        # Push it to the manager
402       
403        flag, alpha, dmax, nfunc = self._read_pars()
404       
405        if flag:
406            if self.plot_radio.GetValue():
407                dataset = self.plot_data.GetValue()
408                self.manager.setup_plot_inversion(alpha=alpha, nfunc=nfunc, 
409                                                  d_max=dmax)
410            else:
411                path = self.data_file.GetValue()
412                self.manager.setup_file_inversion(alpha=alpha, nfunc=nfunc, 
413                                                  d_max=dmax, path=path)
414               
415        else:
416            message = "The P(r) form contains invalid values: please submit it again."
417            wx.PostEvent(self.parent, StatusEvent(status=message))
418       
419    def _change_file(self, evt):
420        """
421            Choose a new input file for I(q)
422        """
423        import os
424        if not self.manager==None:
425            path = self.manager.choose_file()
426           
427            if path and os.path.isfile(path):
428                self.data_file.SetValue(str(path))
429                self.file_radio.SetValue(True)
430                self._on_pars_changed(None)
431       
432
433class ParsDialog(wx.Panel):
434    """
435        Dialog box to let the user edit detector settings
436    """
437   
438    def __init__(self, parent, id = id, file=True, **kwargs):
439
440        wx.Panel.__init__(self, parent, id = id, **kwargs)
441        self.file = file
442       
443        self.label_nfunc = wx.StaticText(self, -1, "Number of terms")
444        self.label_alpha = wx.StaticText(self, -1, "Regularization constant")
445        self.label_dmax  = wx.StaticText(self, -1, "Max distance [A]")
446       
447        # Npts, q max
448        self.nfunc_ctl = wx.TextCtrl(self, -1, size=(60,20))
449        self.alpha_ctl = wx.TextCtrl(self, -1, size=(60,20))
450        self.dmax_ctl  = wx.TextCtrl(self, -1, size=(60,20))
451
452        self.label_file = None
453        self.file_ctl   = None
454
455        self.static_line_3 = wx.StaticLine(self, -1)
456       
457       
458
459        self.__do_layout()
460
461        self.Fit()
462       
463    def _load_file(self, evt):
464        import os
465        path = None
466        dlg = wx.FileDialog(self, "Choose a file", os.getcwd(), "", "*.txt", wx.OPEN)
467        if dlg.ShowModal() == wx.ID_OK:
468            path = dlg.GetPath()
469            mypath = os.path.basename(path)
470        dlg.Destroy()
471       
472        if path and os.path.isfile(path):
473            self.file_ctl.SetValue(str(path))
474
475       
476    def checkValues(self, event):
477        flag = True
478        try:
479            float(self.alpha_ctl.GetValue())
480            self.alpha_ctl.SetBackgroundColour(wx.WHITE)
481            self.alpha_ctl.Refresh()
482        except:
483            flag = False
484            self.alpha_ctl.SetBackgroundColour("pink")
485            self.alpha_ctl.Refresh()
486           
487        try:
488            float(self.dmax_ctl.GetValue())
489            self.dmax_ctl.SetBackgroundColour(wx.WHITE)
490            self.dmax_ctl.Refresh()
491        except:
492            flag = False
493            self.dmax_ctl.SetBackgroundColour("pink")
494            self.dmax_ctl.Refresh()
495           
496        try:
497            int(self.nfunc_ctl.GetValue())
498            self.nfunc_ctl.SetBackgroundColour(wx.WHITE)
499            self.nfunc_ctl.Refresh()
500        except:
501            flag = False
502            self.nfunc_ctl.SetBackgroundColour("pink")
503            self.nfunc_ctl.Refresh()
504       
505        if flag:
506            event.Skip(True)
507   
508    def setContent(self, nfunc, alpha, dmax, file):
509        self.nfunc_ctl.SetValue(str(nfunc))
510        self.alpha_ctl.SetValue(str(alpha))
511        self.dmax_ctl.SetValue(str(dmax))
512        if self.file:
513            self.file_ctl.SetValue(str(file))
514
515    def getContent(self):
516        nfunc = int(self.nfunc_ctl.GetValue())
517        alpha = float(self.alpha_ctl.GetValue())
518        dmax = float(self.dmax_ctl.GetValue())
519        file = None
520        if self.file:
521            file = self.file_ctl.GetValue()
522        return nfunc, alpha, dmax, file
523
524
525    def __do_layout(self):
526        sizer_main = wx.BoxSizer(wx.VERTICAL)
527        sizer_params = wx.GridBagSizer(5,5)
528
529        iy = 0
530        sizer_params.Add(self.label_nfunc, (iy,0), (1,1), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
531        sizer_params.Add(self.nfunc_ctl,   (iy,1), (1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0)
532        iy += 1
533        sizer_params.Add(self.label_alpha, (iy,0), (1,1), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
534        sizer_params.Add(self.alpha_ctl,   (iy,1), (1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0)
535        iy += 1
536        sizer_params.Add(self.label_dmax, (iy,0), (1,1), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
537        sizer_params.Add(self.dmax_ctl,   (iy,1), (1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0)
538        iy += 1
539        if self.file:
540            self.label_file  = wx.StaticText(self, -1, "Input file")
541            self.file_ctl  = wx.TextCtrl(self, -1, size=(120,20))
542            sizer_params.Add(self.label_file, (iy,0), (1,1), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15)
543            sizer_params.Add(self.file_ctl,   (iy,1), (1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0)
544
545        sizer_main.Add(sizer_params, 0, wx.EXPAND|wx.ALL, 10)
546       
547       
548        if self.file:
549            sizer_button = wx.BoxSizer(wx.HORIZONTAL)
550            self.button_load = wx.Button(self, 1, "Choose file")
551            self.Bind(wx.EVT_BUTTON, self._load_file, id = 1)       
552            sizer_button.Add(self.button_load, 0, wx.LEFT|wx.ADJUST_MINSIZE, 10)
553       
554       
555            sizer_main.Add(sizer_button, 0, wx.EXPAND|wx.BOTTOM|wx.TOP, 10)
556        self.SetAutoLayout(True)
557        self.SetSizer(sizer_main)
558        self.Layout()
559        self.Centre()
560        # end wxGlade
561
562
563# end of class DialogAbout
564
565##### testing code ############################################################
566class TestPlot:
567    def __init__(self, text):
568        self.name = text
569   
570class MyApp(wx.App):
571    def OnInit(self):
572        wx.InitAllImageHandlers()
573        plots = {}
574        plots['a'] = TestPlot("data 1")
575        plots['b'] = TestPlot("data 2")
576        #plots['c'] = TestPlot("data 3")
577        #plots['d'] = TestPlot("data 1")
578        #plots['e'] = TestPlot("data 2")
579        #plots['f'] = TestPlot("data 3")
580        dialog = InversionDlg(None, -1, "P(r) parameters", plots)
581        if dialog.ShowModal() == wx.ID_OK:
582            print dialog.get_content()
583        dialog.Destroy()
584       
585        return 1
586
587# end of class MyApp
588
589if __name__ == "__main__":
590    app = MyApp(0)
591    app.MainLoop()
592   
593##### end of testing code #####################################################   
Note: See TracBrowser for help on using the repository browser.