[c77d859] | 1 | |
---|
[1b07935d] | 2 | import wx |
---|
[bb18ef1] | 3 | import wx.lib.newevent |
---|
[1b07935d] | 4 | import numpy |
---|
| 5 | import copy |
---|
[81e4cf7] | 6 | import math |
---|
| 7 | from sans.models.dispersion_models import ArrayDispersion, GaussianDispersion |
---|
[26bf293] | 8 | |
---|
[1b07935d] | 9 | from sans.guicomm.events import StatusEvent |
---|
[26bf293] | 10 | from sans.guiframe.utils import format_number |
---|
[1b07935d] | 11 | (ModelEventbox, EVT_MODEL_BOX) = wx.lib.newevent.NewEvent() |
---|
| 12 | _BOX_WIDTH = 80 |
---|
| 13 | |
---|
[c77d859] | 14 | import basepage |
---|
| 15 | from basepage import BasicPage |
---|
[1b07935d] | 16 | |
---|
[26bf293] | 17 | |
---|
[c77d859] | 18 | class ModelPage(BasicPage): |
---|
[1b07935d] | 19 | """ |
---|
[fbc3e04] | 20 | FitPanel class contains fields allowing to display results when |
---|
| 21 | fitting a model and one data |
---|
| 22 | @note: For Fit to be performed the user should check at least one parameter |
---|
| 23 | on fit Panel window. |
---|
[1b07935d] | 24 | |
---|
| 25 | """ |
---|
[c77d859] | 26 | def __init__(self,parent, page_info, name=""): |
---|
| 27 | BasicPage.__init__(self, parent, page_info,name) |
---|
[1b07935d] | 28 | """ |
---|
| 29 | Initialization of the Panel |
---|
| 30 | """ |
---|
[bb18ef1] | 31 | |
---|
[c77d859] | 32 | self._fill_model_sizer( self.sizer1) |
---|
| 33 | self._fill_range_sizer() |
---|
| 34 | if hasattr(self.page_info,"model"): |
---|
| 35 | model=self.page_info.model |
---|
| 36 | description="" |
---|
| 37 | if model!=None: |
---|
| 38 | description = self.page_info.model.description |
---|
| 39 | self.set_model_param_sizer(self.model) |
---|
| 40 | self.set_model_description(description,self.sizer2) |
---|
[bb18ef1] | 41 | |
---|
[c77d859] | 42 | |
---|
[bb18ef1] | 43 | |
---|
[ef8b580] | 44 | |
---|
[c77d859] | 45 | def _on_display_description(self, event): |
---|
| 46 | """ |
---|
| 47 | Show or Hide description |
---|
| 48 | @param event: wx.EVT_RADIOBUTTON |
---|
| 49 | """ |
---|
| 50 | self._on_display_description_helper() |
---|
[fbc3e04] | 51 | |
---|
[24ea33c] | 52 | |
---|
[00561739] | 53 | |
---|
[c77d859] | 54 | def _on_display_description_helper(self): |
---|
| 55 | """ |
---|
| 56 | Show or Hide description |
---|
| 57 | @param event: wx.EVT_RADIOBUTTON |
---|
| 58 | """ |
---|
| 59 | ## save state of radiobox |
---|
| 60 | self.page_info. save_radiobox_state( self.description_hide ) |
---|
| 61 | self.page_info. save_radiobox_state( self.description_show ) |
---|
| 62 | ## Show description |
---|
| 63 | if not self.description_show.GetValue(): |
---|
| 64 | self.sizer_description.Clear(True) |
---|
| 65 | |
---|
| 66 | else: |
---|
| 67 | model=self.page_info.model |
---|
| 68 | description="" |
---|
| 69 | if model!=None: |
---|
| 70 | description = self.page_info.model.description |
---|
| 71 | self.description = wx.StaticText( self,-1,str(description) ) |
---|
| 72 | self.sizer_description.Add( self.description, 1, wx.EXPAND | wx.ALL, 10 ) |
---|
| 73 | |
---|
| 74 | self.Layout() |
---|
| 75 | |
---|
| 76 | |
---|
| 77 | def _fill_range_sizer(self): |
---|
| 78 | """ |
---|
| 79 | Fill the sizer containing the plotting range |
---|
| 80 | add access to npts |
---|
| 81 | """ |
---|
| 82 | sizer_npts= wx.GridSizer(1, 1,5, 5) |
---|
| 83 | |
---|
[d15c0202] | 84 | self.npts = wx.TextCtrl(self, -1,size=(_BOX_WIDTH,20)) |
---|
| 85 | self.npts.SetValue(format_number(self.num_points)) |
---|
| 86 | self.npts.SetToolTipString("Number of point to plot.") |
---|
| 87 | self.npts.Bind(wx.EVT_KILL_FOCUS, self._onparamEnter) |
---|
| 88 | self.npts.Bind(wx.EVT_TEXT_ENTER, self._onparamEnter) |
---|
[bb18ef1] | 89 | |
---|
[c77d859] | 90 | sizer_npts.Add(wx.StaticText(self, -1, 'Npts'),1, wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 5) |
---|
| 91 | sizer_npts.Add(self.npts,1, wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 5) |
---|
| 92 | self._set_range_sizer( title="Plotted Q Range", object= sizer_npts) |
---|
[fbc3e04] | 93 | |
---|
[c77d859] | 94 | def _on_select_model(self, event): |
---|
| 95 | """ |
---|
| 96 | call back for model selection |
---|
| 97 | """ |
---|
| 98 | self._on_select_model_helper(event) |
---|
| 99 | self.set_model_param_sizer(self.model) |
---|
| 100 | self._set_sizer_gaussian() |
---|
| 101 | self.name = self.model.name |
---|
| 102 | self.model_view.SetFocus() |
---|
| 103 | self.parent.model_page.name = self.name |
---|
| 104 | self.parent.draw_model_name = self.name |
---|
| 105 | self._draw_model() |
---|
| 106 | |
---|
| 107 | def _fill_model_sizer(self, sizer): |
---|
[26bf293] | 108 | """ |
---|
[c77d859] | 109 | fill sizer containing model info |
---|
[26bf293] | 110 | """ |
---|
[c77d859] | 111 | id = wx.NewId() |
---|
| 112 | self.model_view =wx.Button(self,id,'View 2D') |
---|
| 113 | self.model_view.Bind(wx.EVT_BUTTON, self._onModel2D,id=id) |
---|
| 114 | self.model_view.SetToolTipString("View model in 2D") |
---|
[26bf293] | 115 | |
---|
[c77d859] | 116 | ## class base method to add view 2d button |
---|
| 117 | self._set_model_sizer(sizer=sizer, title="Model",object= self.model_view ) |
---|
| 118 | |
---|
| 119 | |
---|
| 120 | def _set_sizer_gaussian(self): |
---|
[26bf293] | 121 | """ |
---|
[c77d859] | 122 | draw sizer with gaussian dispersity parameters |
---|
[26bf293] | 123 | """ |
---|
[c77d859] | 124 | self.fittable_param=[] |
---|
| 125 | self.fixed_param=[] |
---|
| 126 | ##reset model dispersity to gaussian |
---|
| 127 | self._reset_gaussian_dispers() |
---|
| 128 | |
---|
| 129 | self.sizer4_4.Clear(True) |
---|
| 130 | if self.model==None: |
---|
| 131 | ##no model is selected |
---|
| 132 | return |
---|
| 133 | if not self.enable_disp.GetValue(): |
---|
| 134 | ## the user didn't select dispersity display |
---|
[bb18ef1] | 135 | return |
---|
[c77d859] | 136 | ix=0 |
---|
| 137 | iy=1 |
---|
| 138 | disp = wx.StaticText(self, -1, 'Names') |
---|
| 139 | self.sizer4_4.Add(disp,( iy, ix),(1,1), |
---|
| 140 | wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) |
---|
| 141 | ix += 1 |
---|
| 142 | values = wx.StaticText(self, -1, 'Values') |
---|
| 143 | self.sizer4_4.Add(values,( iy, ix),(1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0) |
---|
| 144 | |
---|
| 145 | ix += 1 |
---|
| 146 | npts = wx.StaticText(self, -1, 'Npts') |
---|
| 147 | self.sizer4_4.Add(npts,( iy, ix),(1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0) |
---|
| 148 | ix += 1 |
---|
| 149 | nsigmas = wx.StaticText(self, -1, 'Nsigmas') |
---|
| 150 | self.sizer4_4.Add(nsigmas,( iy, ix),(1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0) |
---|
| 151 | |
---|
| 152 | for item in self.model.dispersion.keys(): |
---|
| 153 | name1=item+".width" |
---|
| 154 | name2=item+".npts" |
---|
| 155 | name3=item+".nsigmas" |
---|
| 156 | iy += 1 |
---|
| 157 | for p in self.model.dispersion[item].keys(): |
---|
| 158 | if p=="width": |
---|
| 159 | ix = 0 |
---|
| 160 | name = wx.StaticText(self, -1, name1) |
---|
| 161 | self.sizer4_4.Add( name,( iy, ix),(1,1), |
---|
| 162 | wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) |
---|
| 163 | ix = 1 |
---|
| 164 | value= self.model.getParam(name1) |
---|
| 165 | ctl1 = wx.TextCtrl(self, -1, size=(_BOX_WIDTH,20), |
---|
| 166 | style=wx.TE_PROCESS_ENTER) |
---|
[bb18ef1] | 167 | |
---|
[c77d859] | 168 | ctl1.SetValue(str (format_number(value))) |
---|
| 169 | ctl1.Bind(wx.EVT_KILL_FOCUS, self._onparamEnter) |
---|
| 170 | ctl1.Bind(wx.EVT_TEXT_ENTER,self._onparamEnter) |
---|
| 171 | self.sizer4_4.Add(ctl1, (iy,ix),(1,1), wx.EXPAND) |
---|
| 172 | |
---|
| 173 | self.fittable_param.append([None,name1,ctl1,None, |
---|
| 174 | None, None, None,None]) |
---|
| 175 | |
---|
| 176 | elif p=="npts": |
---|
| 177 | ix =2 |
---|
| 178 | value= self.model.getParam(name2) |
---|
| 179 | Tctl1 = wx.TextCtrl(self, -1, size=(_BOX_WIDTH/2,20), |
---|
| 180 | style=wx.TE_PROCESS_ENTER) |
---|
| 181 | |
---|
| 182 | Tctl1.SetValue(str (format_number(value))) |
---|
| 183 | Tctl1.Bind(wx.EVT_KILL_FOCUS, self._onparamEnter) |
---|
| 184 | Tctl1.Bind(wx.EVT_TEXT_ENTER,self._onparamEnter) |
---|
| 185 | self.sizer4_4.Add(Tctl1, (iy,ix),(1,1), |
---|
| 186 | wx.EXPAND|wx.ADJUST_MINSIZE, 0) |
---|
| 187 | |
---|
| 188 | self.fixed_param.append([None,name2, Tctl1,None,None, |
---|
| 189 | None, None,None]) |
---|
[bb18ef1] | 190 | |
---|
[c77d859] | 191 | elif p=="nsigmas": |
---|
| 192 | ix =3 |
---|
| 193 | value= self.model.getParam(name3) |
---|
| 194 | Tctl2 = wx.TextCtrl(self, -1, size=(_BOX_WIDTH/2,20), |
---|
| 195 | style=wx.TE_PROCESS_ENTER) |
---|
| 196 | Tctl2.SetValue(str (format_number(value))) |
---|
| 197 | Tctl2.Bind(wx.EVT_KILL_FOCUS, self._onparamEnter) |
---|
| 198 | Tctl2.Bind(wx.EVT_TEXT_ENTER,self._onparamEnter) |
---|
| 199 | self.sizer4_4.Add(Tctl2, (iy,ix),(1,1), |
---|
| 200 | wx.EXPAND|wx.ADJUST_MINSIZE, 0) |
---|
| 201 | ix +=1 |
---|
| 202 | self.sizer4_4.Add((20,20), (iy,ix),(1,1), |
---|
| 203 | wx.EXPAND|wx.ADJUST_MINSIZE, 0) |
---|
| 204 | |
---|
| 205 | self.fixed_param.append([None,name3, Tctl2, |
---|
| 206 | None,None, None, None,None]) |
---|
[dc317d1] | 207 | |
---|
[c77d859] | 208 | msg = " Selected Distribution: Gaussian" |
---|
| 209 | wx.PostEvent(self.parent.parent, StatusEvent( status= msg )) |
---|
| 210 | ix =0 |
---|
| 211 | iy +=1 |
---|
| 212 | self.sizer4_4.Add((20,20),(iy,ix),(1,1), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) |
---|
| 213 | self.sizer4_4.Layout() |
---|
| 214 | self.sizer4.Layout() |
---|
| 215 | self.SetScrollbars(20,20,200,100) |
---|
| 216 | |
---|
| 217 | def _onModel2D(self, event): |
---|
[86c1832] | 218 | """ |
---|
| 219 | call manager to plot model in 2D |
---|
| 220 | """ |
---|
[24ea33c] | 221 | # If the 2D display is not currently enabled, plot the model in 2D |
---|
| 222 | # and set the enable2D flag. |
---|
[bb18ef1] | 223 | if self.fitrange: |
---|
| 224 | self.enable2D = True |
---|
| 225 | |
---|
| 226 | if self.enable2D: |
---|
[cfc68540] | 227 | self._draw_model() |
---|
[e5af88b] | 228 | self.model_view.Disable() |
---|
[c77d859] | 229 | |
---|
[32d802f] | 230 | def select_model(self, model, name): |
---|
[3dc83be] | 231 | """ |
---|
| 232 | Select a new model |
---|
| 233 | @param model: model object |
---|
| 234 | """ |
---|
[ef8b580] | 235 | self.model = model |
---|
| 236 | self.parent.model_page.name = name |
---|
| 237 | self.parent.draw_model_name = name |
---|
[51d47b5] | 238 | |
---|
[c77d859] | 239 | self.set_model_param_sizer(self.model) |
---|
[bb18ef1] | 240 | self._draw_model() |
---|
[c77d859] | 241 | ## keep the sizer view consistent with the model menu selecting |
---|
| 242 | ## |
---|
| 243 | self.structurebox.Hide() |
---|
| 244 | self.text2.Hide() |
---|
| 245 | self.multip_cb.SetValue(False) |
---|
[1b07935d] | 246 | |
---|
[c77d859] | 247 | if hasattr( model,"model1"): |
---|
| 248 | self._set_model_sizer_selection( model ) |
---|
[1b07935d] | 249 | |
---|
[c77d859] | 250 | self.model_view.SetFocus() |
---|
| 251 | |
---|
| 252 | |
---|
| 253 | def set_model_description(self,description,sizer): |
---|
[1b07935d] | 254 | """ |
---|
[c77d859] | 255 | fill a sizer with description |
---|
| 256 | @param description: of type string |
---|
| 257 | @param sizer: wx.BoxSizer() |
---|
[1b07935d] | 258 | """ |
---|
[c77d859] | 259 | |
---|
| 260 | sizer.Clear(True) |
---|
| 261 | box_description= wx.StaticBox(self, -1, 'Model Description') |
---|
| 262 | boxsizer1 = wx.StaticBoxSizer(box_description, wx.VERTICAL) |
---|
[bb18ef1] | 263 | |
---|
[c77d859] | 264 | sizer_selection=wx.BoxSizer(wx.HORIZONTAL) |
---|
| 265 | |
---|
| 266 | self.description_show = wx.RadioButton(self, -1, 'Show', style=wx.RB_GROUP) |
---|
| 267 | self.description_hide = wx.RadioButton(self, -1, 'Hide') |
---|
[51d47b5] | 268 | |
---|
[c77d859] | 269 | if description=="": |
---|
| 270 | self.description_hide.SetValue(True) |
---|
| 271 | description=" Description unavailable. Click for details" |
---|
[bb18ef1] | 272 | |
---|
[c77d859] | 273 | self.description = wx.StaticText( self,-1,str(description) ) |
---|
[51d47b5] | 274 | |
---|
[c77d859] | 275 | self.Bind( wx.EVT_RADIOBUTTON, self._on_display_description, |
---|
| 276 | id=self.description_hide.GetId() ) |
---|
[51d47b5] | 277 | |
---|
[c77d859] | 278 | self.Bind( wx.EVT_RADIOBUTTON, self._on_display_description, |
---|
| 279 | id=self.description_show.GetId() ) |
---|
[51d47b5] | 280 | |
---|
[c77d859] | 281 | self.model_description = wx.Button(self, -1, "More Details") |
---|
| 282 | self.model_description.SetToolTipString("See more description in help menu.") |
---|
[51d47b5] | 283 | |
---|
[c77d859] | 284 | self.page_info.save_radiobox_state( self.description_hide ) |
---|
| 285 | self.page_info.save_radiobox_state( self.description_show ) |
---|
[fbc3e04] | 286 | |
---|
[c77d859] | 287 | sizer_selection.Add( self.description_show ) |
---|
| 288 | sizer_selection.Add( (20,20)) |
---|
| 289 | sizer_selection.Add( self.description_hide ) |
---|
| 290 | sizer_selection.Add( (20,20)) |
---|
| 291 | sizer_selection.Add( self.model_description ) |
---|
[fbc3e04] | 292 | |
---|
[c77d859] | 293 | |
---|
| 294 | self.sizer_description=wx.BoxSizer(wx.HORIZONTAL) |
---|
| 295 | self.sizer_description.Add( self.description, 1, wx.EXPAND | wx.ALL, 10 ) |
---|
| 296 | |
---|
| 297 | boxsizer1.Add( sizer_selection) |
---|
| 298 | boxsizer1.Add( (20,20)) |
---|
| 299 | boxsizer1.Add( self.sizer_description) |
---|
| 300 | |
---|
[fbc3e04] | 301 | |
---|
[c77d859] | 302 | sizer.Add(boxsizer1,0, wx.EXPAND | wx.ALL, 10) |
---|
| 303 | sizer.Layout() |
---|
| 304 | |
---|
| 305 | |
---|
| 306 | |
---|
[aa306e4] | 307 | def set_range(self, qmin_x, qmax_x, npts): |
---|
[ed2ea6a] | 308 | """ |
---|
[c77d859] | 309 | Set the range for the plotted models |
---|
| 310 | @param qmin: minimum Q |
---|
| 311 | @param qmax: maximum Q |
---|
| 312 | @param npts: number of Q bins |
---|
[ed2ea6a] | 313 | """ |
---|
[c77d859] | 314 | # Set the data members |
---|
| 315 | self.qmin_x = qmin_x |
---|
| 316 | self.qmax_x = qmax_x |
---|
| 317 | self.num_points = npts |
---|
[26bf293] | 318 | |
---|
[c77d859] | 319 | # Set the controls |
---|
| 320 | self.qmin.SetValue(format_number(self.qmin_x)) |
---|
| 321 | self.qmax.SetValue(format_number(self.qmax_x)) |
---|
| 322 | self.npts.SetValue(format_number(self.num_points)) |
---|
[51d47b5] | 323 | |
---|
[c77d859] | 324 | |
---|
| 325 | def set_model_param_sizer(self, model): |
---|
[51d47b5] | 326 | """ |
---|
[c77d859] | 327 | Build the panel from the model content |
---|
| 328 | @param model: the model selected in combo box for fitting purpose |
---|
[51d47b5] | 329 | """ |
---|
[c77d859] | 330 | self.sizer3.Clear(True) |
---|
| 331 | self.parameters = [] |
---|
| 332 | self.param_toFit=[] |
---|
| 333 | self.fixed_param=[] |
---|
[1b07935d] | 334 | |
---|
[c77d859] | 335 | if model ==None: |
---|
| 336 | ##no model avaiable to draw sizer |
---|
| 337 | return |
---|
| 338 | box_description= wx.StaticBox(self, -1,str("Model Parameters")) |
---|
| 339 | boxsizer1 = wx.StaticBoxSizer(box_description, wx.VERTICAL) |
---|
| 340 | sizer = wx.GridBagSizer(5,5) |
---|
[1b07935d] | 341 | |
---|
[c77d859] | 342 | self.model = model |
---|
| 343 | self.set_model_description(self.model.description,self.sizer2) |
---|
| 344 | |
---|
| 345 | keys = self.model.getParamList() |
---|
| 346 | #list of dispersion paramaters |
---|
| 347 | self.disp_list=self.model.getDispParamList() |
---|
| 348 | |
---|
| 349 | keys.sort() |
---|
| 350 | |
---|
| 351 | iy = 1 |
---|
| 352 | ix = 0 |
---|
| 353 | self.text1_2 = wx.StaticText(self, -1, 'Names') |
---|
| 354 | sizer.Add(self.text1_2,(iy, ix),(1,1),\ |
---|
| 355 | wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) |
---|
| 356 | ix +=1 |
---|
| 357 | self.text2_2 = wx.StaticText(self, -1, 'Values') |
---|
| 358 | sizer.Add(self.text2_2,(iy, ix),(1,1),\ |
---|
| 359 | wx.EXPAND|wx.ADJUST_MINSIZE, 0) |
---|
| 360 | ix +=1 |
---|
| 361 | self.text2_4 = wx.StaticText(self, -1, 'Units') |
---|
| 362 | sizer.Add(self.text2_4,(iy, ix),(1,1),\ |
---|
| 363 | wx.EXPAND|wx.ADJUST_MINSIZE, 0) |
---|
| 364 | self.text2_4.Hide() |
---|
| 365 | |
---|
| 366 | |
---|
| 367 | for item in keys: |
---|
| 368 | if not item in self.disp_list: |
---|
| 369 | iy += 1 |
---|
| 370 | ix = 0 |
---|
| 371 | |
---|
| 372 | name = wx.StaticText(self, -1,item) |
---|
| 373 | sizer.Add( name,( iy, ix),(1,1), |
---|
| 374 | wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) |
---|
| 375 | |
---|
| 376 | ix += 1 |
---|
| 377 | value= self.model.getParam(item) |
---|
| 378 | ctl1 = wx.TextCtrl(self, -1, size=(_BOX_WIDTH,20), |
---|
[8bd4dc0] | 379 | style=wx.TE_PROCESS_ENTER) |
---|
[26bf293] | 380 | |
---|
[c77d859] | 381 | ctl1.SetValue(str (format_number(value))) |
---|
| 382 | ctl1.Bind(wx.EVT_KILL_FOCUS, self._onparamEnter) |
---|
| 383 | ctl1.Bind(wx.EVT_TEXT_ENTER,self._onparamEnter) |
---|
| 384 | sizer.Add(ctl1, (iy,ix),(1,1), wx.EXPAND) |
---|
| 385 | |
---|
| 386 | ix +=1 |
---|
| 387 | # Units |
---|
[a5aaec9] | 388 | try: |
---|
[c77d859] | 389 | units = wx.StaticText(self, -1, self.model.details[item][0], style=wx.ALIGN_LEFT) |
---|
[db709e4] | 390 | except: |
---|
[c77d859] | 391 | units = wx.StaticText(self, -1, "", style=wx.ALIGN_LEFT) |
---|
| 392 | sizer.Add(units, (iy,ix),(1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0) |
---|
[ed2ea6a] | 393 | |
---|
[c77d859] | 394 | ##[cb state, name, value, "+/-", error of fit, min, max , units] |
---|
| 395 | self.parameters.append([None,item, ctl1, |
---|
| 396 | None,None, None, None,None]) |
---|
[ed2ea6a] | 397 | |
---|
[c77d859] | 398 | iy+=1 |
---|
| 399 | sizer.Add((20,20),(iy,ix),(1,1), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) |
---|
| 400 | |
---|
| 401 | #Display units text on panel |
---|
| 402 | for item in keys: |
---|
| 403 | if self.model.details[item][0]!='': |
---|
| 404 | self.text2_4.Show() |
---|
| 405 | break |
---|
[bb18ef1] | 406 | else: |
---|
[c77d859] | 407 | self.text2_4.Hide() |
---|
| 408 | |
---|
| 409 | boxsizer1.Add(sizer) |
---|
| 410 | |
---|
| 411 | self.sizer3.Add(boxsizer1,0, wx.EXPAND | wx.ALL, 10) |
---|
| 412 | self.sizer3.Layout() |
---|
| 413 | self.SetScrollbars(20,20,200,100) |
---|
[8bd4dc0] | 414 | |
---|
[dfae8b3] | 415 | |
---|
[2e10b70] | 416 | |
---|
[c77d859] | 417 | |
---|
| 418 | class HelpWindow(wx.Frame): |
---|
| 419 | def __init__(self, parent, id, title): |
---|
| 420 | wx.Frame.__init__(self, parent, id, title, size=(570, 400)) |
---|
[ef8b580] | 421 | |
---|
[c77d859] | 422 | from sans.models.CylinderModel import CylinderModel |
---|
| 423 | model = CylinderModel() |
---|
| 424 | #from sans.models.LineModel import LineModel |
---|
| 425 | #model = LineModel() |
---|
| 426 | from pageInfo import PageInfo |
---|
| 427 | myinfo = PageInfo(self,model) |
---|
| 428 | from models import ModelList |
---|
| 429 | mylist= ModelList() |
---|
[fbc3e04] | 430 | |
---|
[c77d859] | 431 | from sans.models.SphereModel import SphereModel |
---|
| 432 | from sans.models.SquareWellStructure import SquareWellStructure |
---|
| 433 | from sans.models.DebyeModel import DebyeModel |
---|
| 434 | from sans.models.LineModel import LineModel |
---|
| 435 | name= "shapes" |
---|
| 436 | list1= [SphereModel] |
---|
| 437 | mylist.set_list( name, list1) |
---|
[fbc3e04] | 438 | |
---|
[c77d859] | 439 | name= "Shape-independent" |
---|
| 440 | list1= [DebyeModel] |
---|
| 441 | mylist.set_list( name, list1) |
---|
| 442 | |
---|
| 443 | name= "Structure Factors" |
---|
| 444 | list1= [SquareWellStructure] |
---|
| 445 | mylist.set_list( name, list1) |
---|
| 446 | |
---|
| 447 | name= "Added models" |
---|
| 448 | list1= [LineModel] |
---|
| 449 | mylist.set_list( name, list1) |
---|
| 450 | |
---|
| 451 | myinfo.model_list_box = mylist.get_list() |
---|
| 452 | |
---|
| 453 | self.page = ModelPage(self, myinfo) |
---|
| 454 | |
---|
| 455 | |
---|
| 456 | |
---|
| 457 | self.Centre() |
---|
| 458 | self.Show(True) |
---|
| 459 | |
---|
| 460 | |
---|
| 461 | |
---|
| 462 | if __name__=="__main__": |
---|
| 463 | app = wx.App() |
---|
| 464 | HelpWindow(None, -1, 'HelpWindow') |
---|
| 465 | app.MainLoop() |
---|
| 466 | |
---|