[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.") |
---|
[1328e03] | 88 | self.npts.Bind(wx.EVT_SET_FOCUS, self.onSetFocus) |
---|
[d15c0202] | 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 | """ |
---|
[59a7f2d] | 99 | self._on_select_model_helper() |
---|
[c77d859] | 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) |
---|
[59a7f2d] | 152 | |
---|
| 153 | |
---|
[c77d859] | 154 | for item in self.model.dispersion.keys(): |
---|
| 155 | name1=item+".width" |
---|
| 156 | name2=item+".npts" |
---|
| 157 | name3=item+".nsigmas" |
---|
| 158 | iy += 1 |
---|
| 159 | for p in self.model.dispersion[item].keys(): |
---|
| 160 | if p=="width": |
---|
| 161 | ix = 0 |
---|
| 162 | name = wx.StaticText(self, -1, name1) |
---|
| 163 | self.sizer4_4.Add( name,( iy, ix),(1,1), |
---|
| 164 | wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) |
---|
| 165 | ix = 1 |
---|
| 166 | value= self.model.getParam(name1) |
---|
| 167 | ctl1 = wx.TextCtrl(self, -1, size=(_BOX_WIDTH,20), |
---|
| 168 | style=wx.TE_PROCESS_ENTER) |
---|
[bb18ef1] | 169 | |
---|
[c77d859] | 170 | ctl1.SetValue(str (format_number(value))) |
---|
[1328e03] | 171 | ctl1.Bind(wx.EVT_SET_FOCUS, self.onSetFocus) |
---|
[c77d859] | 172 | ctl1.Bind(wx.EVT_TEXT_ENTER,self._onparamEnter) |
---|
| 173 | self.sizer4_4.Add(ctl1, (iy,ix),(1,1), wx.EXPAND) |
---|
| 174 | |
---|
| 175 | self.fittable_param.append([None,name1,ctl1,None, |
---|
| 176 | None, None, None,None]) |
---|
| 177 | |
---|
| 178 | elif p=="npts": |
---|
| 179 | ix =2 |
---|
| 180 | value= self.model.getParam(name2) |
---|
| 181 | Tctl1 = wx.TextCtrl(self, -1, size=(_BOX_WIDTH/2,20), |
---|
| 182 | style=wx.TE_PROCESS_ENTER) |
---|
| 183 | |
---|
| 184 | Tctl1.SetValue(str (format_number(value))) |
---|
[1328e03] | 185 | Tctl1.Bind(wx.EVT_SET_FOCUS, self.onSetFocus) |
---|
[c77d859] | 186 | Tctl1.Bind(wx.EVT_TEXT_ENTER,self._onparamEnter) |
---|
| 187 | self.sizer4_4.Add(Tctl1, (iy,ix),(1,1), |
---|
| 188 | wx.EXPAND|wx.ADJUST_MINSIZE, 0) |
---|
| 189 | |
---|
| 190 | self.fixed_param.append([None,name2, Tctl1,None,None, |
---|
| 191 | None, None,None]) |
---|
[bb18ef1] | 192 | |
---|
[c77d859] | 193 | elif p=="nsigmas": |
---|
[59a7f2d] | 194 | |
---|
[c77d859] | 195 | ix =3 |
---|
| 196 | value= self.model.getParam(name3) |
---|
| 197 | Tctl2 = wx.TextCtrl(self, -1, size=(_BOX_WIDTH/2,20), |
---|
| 198 | style=wx.TE_PROCESS_ENTER) |
---|
| 199 | Tctl2.SetValue(str (format_number(value))) |
---|
[1328e03] | 200 | Tctl2.Bind(wx.EVT_SET_FOCUS, self.onSetFocus) |
---|
[c77d859] | 201 | Tctl2.Bind(wx.EVT_TEXT_ENTER,self._onparamEnter) |
---|
| 202 | self.sizer4_4.Add(Tctl2, (iy,ix),(1,1), |
---|
| 203 | wx.EXPAND|wx.ADJUST_MINSIZE, 0) |
---|
| 204 | ix +=1 |
---|
| 205 | self.sizer4_4.Add((20,20), (iy,ix),(1,1), |
---|
| 206 | wx.EXPAND|wx.ADJUST_MINSIZE, 0) |
---|
| 207 | |
---|
| 208 | self.fixed_param.append([None,name3, Tctl2, |
---|
| 209 | None,None, None, None,None]) |
---|
[dc317d1] | 210 | |
---|
[c77d859] | 211 | msg = " Selected Distribution: Gaussian" |
---|
| 212 | wx.PostEvent(self.parent.parent, StatusEvent( status= msg )) |
---|
| 213 | ix =0 |
---|
| 214 | iy +=1 |
---|
| 215 | self.sizer4_4.Add((20,20),(iy,ix),(1,1), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) |
---|
| 216 | self.sizer4_4.Layout() |
---|
| 217 | self.sizer4.Layout() |
---|
| 218 | self.SetScrollbars(20,20,200,100) |
---|
| 219 | |
---|
| 220 | def _onModel2D(self, event): |
---|
[86c1832] | 221 | """ |
---|
| 222 | call manager to plot model in 2D |
---|
| 223 | """ |
---|
[24ea33c] | 224 | # If the 2D display is not currently enabled, plot the model in 2D |
---|
| 225 | # and set the enable2D flag. |
---|
[bb18ef1] | 226 | if self.fitrange: |
---|
| 227 | self.enable2D = True |
---|
| 228 | |
---|
| 229 | if self.enable2D: |
---|
[cfc68540] | 230 | self._draw_model() |
---|
[e5af88b] | 231 | self.model_view.Disable() |
---|
[c77d859] | 232 | |
---|
[32d802f] | 233 | def select_model(self, model, name): |
---|
[3dc83be] | 234 | """ |
---|
| 235 | Select a new model |
---|
| 236 | @param model: model object |
---|
| 237 | """ |
---|
[ef8b580] | 238 | self.model = model |
---|
| 239 | self.parent.model_page.name = name |
---|
| 240 | self.parent.draw_model_name = name |
---|
[51d47b5] | 241 | |
---|
[c77d859] | 242 | self.set_model_param_sizer(self.model) |
---|
[bb18ef1] | 243 | self._draw_model() |
---|
[c77d859] | 244 | ## keep the sizer view consistent with the model menu selecting |
---|
| 245 | ## |
---|
| 246 | self.structurebox.Hide() |
---|
| 247 | self.text2.Hide() |
---|
| 248 | self.multip_cb.SetValue(False) |
---|
[1b07935d] | 249 | |
---|
[c77d859] | 250 | if hasattr( model,"model1"): |
---|
| 251 | self._set_model_sizer_selection( model ) |
---|
[1b07935d] | 252 | |
---|
[c77d859] | 253 | self.model_view.SetFocus() |
---|
| 254 | |
---|
| 255 | |
---|
| 256 | def set_model_description(self,description,sizer): |
---|
[1b07935d] | 257 | """ |
---|
[c77d859] | 258 | fill a sizer with description |
---|
| 259 | @param description: of type string |
---|
| 260 | @param sizer: wx.BoxSizer() |
---|
[1b07935d] | 261 | """ |
---|
[c77d859] | 262 | |
---|
| 263 | sizer.Clear(True) |
---|
| 264 | box_description= wx.StaticBox(self, -1, 'Model Description') |
---|
| 265 | boxsizer1 = wx.StaticBoxSizer(box_description, wx.VERTICAL) |
---|
[bb18ef1] | 266 | |
---|
[c77d859] | 267 | sizer_selection=wx.BoxSizer(wx.HORIZONTAL) |
---|
| 268 | |
---|
| 269 | self.description_show = wx.RadioButton(self, -1, 'Show', style=wx.RB_GROUP) |
---|
| 270 | self.description_hide = wx.RadioButton(self, -1, 'Hide') |
---|
[51d47b5] | 271 | |
---|
[c77d859] | 272 | if description=="": |
---|
| 273 | self.description_hide.SetValue(True) |
---|
| 274 | description=" Description unavailable. Click for details" |
---|
[bb18ef1] | 275 | |
---|
[c77d859] | 276 | self.description = wx.StaticText( self,-1,str(description) ) |
---|
[51d47b5] | 277 | |
---|
[c77d859] | 278 | self.Bind( wx.EVT_RADIOBUTTON, self._on_display_description, |
---|
| 279 | id=self.description_hide.GetId() ) |
---|
[51d47b5] | 280 | |
---|
[c77d859] | 281 | self.Bind( wx.EVT_RADIOBUTTON, self._on_display_description, |
---|
| 282 | id=self.description_show.GetId() ) |
---|
[51d47b5] | 283 | |
---|
[c77d859] | 284 | self.model_description = wx.Button(self, -1, "More Details") |
---|
| 285 | self.model_description.SetToolTipString("See more description in help menu.") |
---|
[51d47b5] | 286 | |
---|
[c77d859] | 287 | self.page_info.save_radiobox_state( self.description_hide ) |
---|
| 288 | self.page_info.save_radiobox_state( self.description_show ) |
---|
[fbc3e04] | 289 | |
---|
[c77d859] | 290 | sizer_selection.Add( self.description_show ) |
---|
| 291 | sizer_selection.Add( (20,20)) |
---|
| 292 | sizer_selection.Add( self.description_hide ) |
---|
| 293 | sizer_selection.Add( (20,20)) |
---|
| 294 | sizer_selection.Add( self.model_description ) |
---|
[fbc3e04] | 295 | |
---|
[c77d859] | 296 | |
---|
| 297 | self.sizer_description=wx.BoxSizer(wx.HORIZONTAL) |
---|
| 298 | self.sizer_description.Add( self.description, 1, wx.EXPAND | wx.ALL, 10 ) |
---|
| 299 | |
---|
| 300 | boxsizer1.Add( sizer_selection) |
---|
| 301 | boxsizer1.Add( (20,20)) |
---|
| 302 | boxsizer1.Add( self.sizer_description) |
---|
| 303 | |
---|
[fbc3e04] | 304 | |
---|
[c77d859] | 305 | sizer.Add(boxsizer1,0, wx.EXPAND | wx.ALL, 10) |
---|
| 306 | sizer.Layout() |
---|
| 307 | |
---|
| 308 | |
---|
| 309 | |
---|
[aa306e4] | 310 | def set_range(self, qmin_x, qmax_x, npts): |
---|
[ed2ea6a] | 311 | """ |
---|
[c77d859] | 312 | Set the range for the plotted models |
---|
| 313 | @param qmin: minimum Q |
---|
| 314 | @param qmax: maximum Q |
---|
| 315 | @param npts: number of Q bins |
---|
[ed2ea6a] | 316 | """ |
---|
[c77d859] | 317 | # Set the data members |
---|
| 318 | self.qmin_x = qmin_x |
---|
| 319 | self.qmax_x = qmax_x |
---|
| 320 | self.num_points = npts |
---|
[26bf293] | 321 | |
---|
[c77d859] | 322 | # Set the controls |
---|
| 323 | self.qmin.SetValue(format_number(self.qmin_x)) |
---|
| 324 | self.qmax.SetValue(format_number(self.qmax_x)) |
---|
| 325 | self.npts.SetValue(format_number(self.num_points)) |
---|
[51d47b5] | 326 | |
---|
[c77d859] | 327 | |
---|
| 328 | def set_model_param_sizer(self, model): |
---|
[51d47b5] | 329 | """ |
---|
[c77d859] | 330 | Build the panel from the model content |
---|
| 331 | @param model: the model selected in combo box for fitting purpose |
---|
[51d47b5] | 332 | """ |
---|
[c77d859] | 333 | self.sizer3.Clear(True) |
---|
| 334 | self.parameters = [] |
---|
| 335 | self.param_toFit=[] |
---|
| 336 | self.fixed_param=[] |
---|
[1b07935d] | 337 | |
---|
[c77d859] | 338 | if model ==None: |
---|
| 339 | ##no model avaiable to draw sizer |
---|
| 340 | return |
---|
| 341 | box_description= wx.StaticBox(self, -1,str("Model Parameters")) |
---|
| 342 | boxsizer1 = wx.StaticBoxSizer(box_description, wx.VERTICAL) |
---|
| 343 | sizer = wx.GridBagSizer(5,5) |
---|
[1b07935d] | 344 | |
---|
[c77d859] | 345 | self.model = model |
---|
| 346 | self.set_model_description(self.model.description,self.sizer2) |
---|
| 347 | |
---|
| 348 | keys = self.model.getParamList() |
---|
| 349 | #list of dispersion paramaters |
---|
| 350 | self.disp_list=self.model.getDispParamList() |
---|
| 351 | |
---|
| 352 | keys.sort() |
---|
| 353 | |
---|
| 354 | iy = 1 |
---|
| 355 | ix = 0 |
---|
| 356 | self.text1_2 = wx.StaticText(self, -1, 'Names') |
---|
| 357 | sizer.Add(self.text1_2,(iy, ix),(1,1),\ |
---|
| 358 | wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) |
---|
| 359 | ix +=1 |
---|
| 360 | self.text2_2 = wx.StaticText(self, -1, 'Values') |
---|
| 361 | sizer.Add(self.text2_2,(iy, ix),(1,1),\ |
---|
| 362 | wx.EXPAND|wx.ADJUST_MINSIZE, 0) |
---|
| 363 | ix +=1 |
---|
| 364 | self.text2_4 = wx.StaticText(self, -1, 'Units') |
---|
| 365 | sizer.Add(self.text2_4,(iy, ix),(1,1),\ |
---|
| 366 | wx.EXPAND|wx.ADJUST_MINSIZE, 0) |
---|
| 367 | self.text2_4.Hide() |
---|
| 368 | |
---|
| 369 | |
---|
| 370 | for item in keys: |
---|
| 371 | if not item in self.disp_list: |
---|
| 372 | iy += 1 |
---|
| 373 | ix = 0 |
---|
| 374 | |
---|
| 375 | name = wx.StaticText(self, -1,item) |
---|
| 376 | sizer.Add( name,( iy, ix),(1,1), |
---|
| 377 | wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) |
---|
| 378 | |
---|
| 379 | ix += 1 |
---|
| 380 | value= self.model.getParam(item) |
---|
| 381 | ctl1 = wx.TextCtrl(self, -1, size=(_BOX_WIDTH,20), |
---|
[8bd4dc0] | 382 | style=wx.TE_PROCESS_ENTER) |
---|
[26bf293] | 383 | |
---|
[c77d859] | 384 | ctl1.SetValue(str (format_number(value))) |
---|
[1328e03] | 385 | ctl1.Bind(wx.EVT_SET_FOCUS, self.onSetFocus) |
---|
[c77d859] | 386 | ctl1.Bind(wx.EVT_TEXT_ENTER,self._onparamEnter) |
---|
[1328e03] | 387 | |
---|
[c77d859] | 388 | sizer.Add(ctl1, (iy,ix),(1,1), wx.EXPAND) |
---|
| 389 | |
---|
| 390 | ix +=1 |
---|
| 391 | # Units |
---|
[a5aaec9] | 392 | try: |
---|
[c77d859] | 393 | units = wx.StaticText(self, -1, self.model.details[item][0], style=wx.ALIGN_LEFT) |
---|
[db709e4] | 394 | except: |
---|
[c77d859] | 395 | units = wx.StaticText(self, -1, "", style=wx.ALIGN_LEFT) |
---|
| 396 | sizer.Add(units, (iy,ix),(1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0) |
---|
[ed2ea6a] | 397 | |
---|
[c77d859] | 398 | ##[cb state, name, value, "+/-", error of fit, min, max , units] |
---|
| 399 | self.parameters.append([None,item, ctl1, |
---|
| 400 | None,None, None, None,None]) |
---|
[ed2ea6a] | 401 | |
---|
[c77d859] | 402 | iy+=1 |
---|
| 403 | sizer.Add((20,20),(iy,ix),(1,1), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) |
---|
| 404 | |
---|
| 405 | #Display units text on panel |
---|
| 406 | for item in keys: |
---|
| 407 | if self.model.details[item][0]!='': |
---|
| 408 | self.text2_4.Show() |
---|
| 409 | break |
---|
[bb18ef1] | 410 | else: |
---|
[c77d859] | 411 | self.text2_4.Hide() |
---|
| 412 | |
---|
| 413 | boxsizer1.Add(sizer) |
---|
| 414 | |
---|
| 415 | self.sizer3.Add(boxsizer1,0, wx.EXPAND | wx.ALL, 10) |
---|
| 416 | self.sizer3.Layout() |
---|
| 417 | self.SetScrollbars(20,20,200,100) |
---|
[8bd4dc0] | 418 | |
---|
[dfae8b3] | 419 | |
---|
[2e10b70] | 420 | |
---|
[c77d859] | 421 | |
---|
| 422 | class HelpWindow(wx.Frame): |
---|
| 423 | def __init__(self, parent, id, title): |
---|
| 424 | wx.Frame.__init__(self, parent, id, title, size=(570, 400)) |
---|
[ef8b580] | 425 | |
---|
[c77d859] | 426 | from sans.models.CylinderModel import CylinderModel |
---|
| 427 | model = CylinderModel() |
---|
| 428 | #from sans.models.LineModel import LineModel |
---|
| 429 | #model = LineModel() |
---|
| 430 | from pageInfo import PageInfo |
---|
| 431 | myinfo = PageInfo(self,model) |
---|
| 432 | from models import ModelList |
---|
| 433 | mylist= ModelList() |
---|
[fbc3e04] | 434 | |
---|
[c77d859] | 435 | from sans.models.SphereModel import SphereModel |
---|
| 436 | from sans.models.SquareWellStructure import SquareWellStructure |
---|
| 437 | from sans.models.DebyeModel import DebyeModel |
---|
| 438 | from sans.models.LineModel import LineModel |
---|
| 439 | name= "shapes" |
---|
| 440 | list1= [SphereModel] |
---|
| 441 | mylist.set_list( name, list1) |
---|
[fbc3e04] | 442 | |
---|
[c77d859] | 443 | name= "Shape-independent" |
---|
| 444 | list1= [DebyeModel] |
---|
| 445 | mylist.set_list( name, list1) |
---|
| 446 | |
---|
| 447 | name= "Structure Factors" |
---|
| 448 | list1= [SquareWellStructure] |
---|
| 449 | mylist.set_list( name, list1) |
---|
| 450 | |
---|
| 451 | name= "Added models" |
---|
| 452 | list1= [LineModel] |
---|
| 453 | mylist.set_list( name, list1) |
---|
| 454 | |
---|
| 455 | myinfo.model_list_box = mylist.get_list() |
---|
| 456 | |
---|
| 457 | self.page = ModelPage(self, myinfo) |
---|
| 458 | |
---|
| 459 | |
---|
| 460 | |
---|
| 461 | self.Centre() |
---|
| 462 | self.Show(True) |
---|
| 463 | |
---|
| 464 | |
---|
| 465 | |
---|
| 466 | if __name__=="__main__": |
---|
| 467 | app = wx.App() |
---|
| 468 | HelpWindow(None, -1, 'HelpWindow') |
---|
| 469 | app.MainLoop() |
---|
| 470 | |
---|