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