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