Changes in src/sas/perspectives/fitting/fitpage.py [6f16e25:098f3d2] in sasview
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/perspectives/fitting/fitpage.py
r6f16e25 r098f3d2 93 93 fill sizer 0 with data info 94 94 """ 95 self.data_box_description = wx.StaticBox(self, wx.ID_ANY, 96 'I(q) Data Source') 95 self.data_box_description = wx.StaticBox(self, -1, 'I(q) Data Source') 97 96 if check_data_validity(self.data): 98 97 dname_color = wx.BLUE … … 103 102 #---------------------------------------------------------- 104 103 sizer_data = wx.BoxSizer(wx.HORIZONTAL) 105 self.dataSource = wx.ComboBox(self, wx.ID_ANY, style=wx.CB_READONLY)106 wx.EVT_COMBOBOX(self.dataSource, wx.ID_ANY, self.on_select_data)104 self.dataSource = wx.ComboBox(self, -1, style=wx.CB_READONLY) 105 wx.EVT_COMBOBOX(self.dataSource, -1, self.on_select_data) 107 106 self.dataSource.SetMinSize((_DATA_BOX_WIDTH, -1)) 108 sizer_data.Add(wx.StaticText(self, wx.ID_ANY, 'Name : '))107 sizer_data.Add(wx.StaticText(self, -1, 'Name : ')) 109 108 sizer_data.Add(self.dataSource) 110 109 sizer_data.Add((0, 5)) … … 222 221 223 222 #Sizers 224 box_description_range = wx.StaticBox(self, wx.ID_ANY, str(title))223 box_description_range = wx.StaticBox(self, -1, str(title)) 225 224 box_description_range.SetForegroundColour(wx.BLUE) 226 225 boxsizer_range = wx.StaticBoxSizer(box_description_range, wx.VERTICAL) … … 230 229 self.sizer_set_masking = wx.BoxSizer(wx.HORIZONTAL) 231 230 sizer_chi2 = wx.BoxSizer(wx.VERTICAL) 232 smear_set_box = wx.StaticBox(self, wx.ID_ANY, 233 'Set Instrumental Smearing') 231 smear_set_box = wx.StaticBox(self, -1, 'Set Instrumental Smearing') 234 232 sizer_smearer_box = wx.StaticBoxSizer(smear_set_box, wx.HORIZONTAL) 235 233 sizer_smearer_box.SetMinSize((_DATA_BOX_WIDTH, 60)) 236 234 237 weighting_set_box = wx.StaticBox(self, wx.ID_ANY,235 weighting_set_box = wx.StaticBox(self, -1, \ 238 236 'Set Weighting by Selecting dI Source') 239 237 weighting_box = wx.StaticBoxSizer(weighting_set_box, wx.HORIZONTAL) … … 241 239 weighting_box.SetMinSize((_DATA_BOX_WIDTH, 40)) 242 240 #Filling the sizer containing weighting info. 243 self.dI_noweight = wx.RadioButton(self, wx.ID_ANY,244 'No Weighting',style=wx.RB_GROUP)245 self.dI_didata = wx.RadioButton(self, wx.ID_ANY, 'Use dI Data')246 self.dI_sqrdata = wx.RadioButton(self, wx.ID_ANY, 'Use |sqrt(I Data)|')247 self.dI_idata = wx.RadioButton(self, wx.ID_ANY, 'Use |I Data|')241 self.dI_noweight = wx.RadioButton(self, -1, 'No Weighting', 242 style=wx.RB_GROUP) 243 self.dI_didata = wx.RadioButton(self, -1, 'Use dI Data') 244 self.dI_sqrdata = wx.RadioButton(self, -1, 'Use |sqrt(I Data)|') 245 self.dI_idata = wx.RadioButton(self, -1, 'Use |I Data|') 248 246 self.Bind(wx.EVT_RADIOBUTTON, self.onWeighting, 249 247 id=self.dI_noweight.GetId()) … … 270 268 weighting_box.Add(sizer_weighting) 271 269 270 sizer_fit = wx.GridSizer(2, 5, 2, 6) 271 272 272 # combobox for smear2d accuracy selection 273 self.smear_accuracy = wx.ComboBox(self, wx.ID_ANY,274 s ize=(50, -1), style=wx.CB_READONLY)273 self.smear_accuracy = wx.ComboBox(self, -1, size=(50, -1), 274 style=wx.CB_READONLY) 275 275 self._set_accuracy_list() 276 276 self.smear_accuracy.SetValue(self.smear2d_accuracy) 277 277 self.smear_accuracy.SetSelection(0) 278 self.smear_accuracy.SetToolTipString( 278 self.smear_accuracy.SetToolTipString(\ 279 279 "'Higher' uses more Gaussian points for smearing computation.") 280 280 281 wx.EVT_COMBOBOX(self.smear_accuracy, wx.ID_ANY, 282 self._on_select_accuracy) 281 wx.EVT_COMBOBOX(self.smear_accuracy, -1, self._on_select_accuracy) 283 282 284 283 #Fit button 285 self.btFit = wx.Button(self, self._ids.next(), 'Fit')284 self.btFit = wx.Button(self, wx.NewId(), 'Fit', size=(88, 25)) 286 285 self.default_bt_colour = self.btFit.GetDefaultAttributes() 287 286 self.btFit.Bind(wx.EVT_BUTTON, self._onFit, id=self.btFit.GetId()) … … 289 288 290 289 #General Help button 291 self.btFitHelp = wx.Button(self, wx.ID_ANY, 'Help')292 self.btFitHelp.SetToolTipString("General fitting help.")290 self.btFitHelp = wx.Button(self, -1, 'HELP') 291 self.btFitHelp.SetToolTipString("General Fitting Help.") 293 292 self.btFitHelp.Bind(wx.EVT_BUTTON, self._onFitHelp) 294 293 … … 302 301 else: 303 302 size_q = (30, 20) #on MAC 304 self.btSmearHelp = wx.Button(self, wx.ID_ANY, '?',305 s tyle=wx.BU_EXACTFIT, size=size_q)306 self.btSmearHelp.SetToolTipString("Resolution smearing help.")303 self.btSmearHelp = wx.Button(self, -1, '?', style=wx.BU_EXACTFIT,\ 304 size=size_q) 305 self.btSmearHelp.SetToolTipString("Resolution Smearing Help.") 307 306 self.btSmearHelp.Bind(wx.EVT_BUTTON, self._onSmearHelp) 308 307 309 308 #textcntrl for custom resolution 310 self.smear_pinhole_max = ModelTextCtrl(self, wx.ID_ANY,309 self.smear_pinhole_max = ModelTextCtrl(self, -1, 311 310 size=(_BOX_WIDTH - 25, 20), 312 311 style=wx.TE_PROCESS_ENTER, 313 312 text_enter_callback=self.onPinholeSmear) 314 self.smear_pinhole_min = ModelTextCtrl(self, wx.ID_ANY,313 self.smear_pinhole_min = ModelTextCtrl(self, -1, 315 314 size=(_BOX_WIDTH - 25, 20), 316 315 style=wx.TE_PROCESS_ENTER, 317 316 text_enter_callback=self.onPinholeSmear) 318 self.smear_slit_height = ModelTextCtrl(self, wx.ID_ANY,317 self.smear_slit_height = ModelTextCtrl(self, -1, 319 318 size=(_BOX_WIDTH - 25, 20), 320 319 style=wx.TE_PROCESS_ENTER, 321 320 text_enter_callback=self.onSlitSmear) 322 self.smear_slit_width = ModelTextCtrl(self, wx.ID_ANY,321 self.smear_slit_width = ModelTextCtrl(self, -1, 323 322 size=(_BOX_WIDTH - 25, 20), 324 323 style=wx.TE_PROCESS_ENTER, … … 326 325 327 326 ## smear 328 self.smear_data_left = BGTextCtrl(self, wx.ID_ANY,327 self.smear_data_left = BGTextCtrl(self, -1, 329 328 size=(_BOX_WIDTH - 25, 20), style=0) 330 329 self.smear_data_left.SetValue(str(self.dq_l)) 331 self.smear_data_right = BGTextCtrl(self, wx.ID_ANY,330 self.smear_data_right = BGTextCtrl(self, -1, 332 331 size=(_BOX_WIDTH - 25, 20), style=0) 333 332 self.smear_data_right.SetValue(str(self.dq_r)) … … 340 339 341 340 #Filling the sizer containing instruments smearing info. 342 self.disable_smearer = wx.RadioButton(self, wx.ID_ANY,341 self.disable_smearer = wx.RadioButton(self, -1, 343 342 'None', style=wx.RB_GROUP) 344 self.enable_smearer = wx.RadioButton(self, wx.ID_ANY, 'Use dQ Data') 343 self.enable_smearer = wx.RadioButton(self, -1, 344 'Use dQ Data') 345 345 #self.enable_smearer.SetToolTipString( 346 346 #"Click to use the loaded dQ data for smearing.") 347 self.pinhole_smearer = wx.RadioButton(self, wx.ID_ANY,347 self.pinhole_smearer = wx.RadioButton(self, -1, 348 348 'Custom Pinhole Smear') 349 349 #self.pinhole_smearer.SetToolTipString 350 350 #("Click to input custom resolution for pinhole smearing.") 351 self.slit_smearer = wx.RadioButton(self, wx.ID_ANY, 'Custom Slit Smear')351 self.slit_smearer = wx.RadioButton(self, -1, 'Custom Slit Smear') 352 352 #self.slit_smearer.SetToolTipString 353 353 #("Click to input custom resolution for slit smearing.") … … 362 362 self.disable_smearer.SetValue(True) 363 363 364 # add 4 types of smearing to the sizer 365 # Note from June 14, 2015 366 # removed the extra (10,10) spaces to make room for help. Actually 367 # don't see the need for those anyway as the wx.LEFT, xx should take 368 # care of spacing anyway though it does not seem to work for some 369 # reason. Currently leaving as we are in "code freeze" only making 370 # minimal changes necessary for release 3.1. We probably want to clean 371 # up the whole fitpage (and basepage and fitpanel etc) eventually. 372 # ---- PDB 364 373 sizer_smearer.Add(self.disable_smearer, 0, wx.LEFT, 10) 374 # sizer_smearer.Add((10, 10)) 365 375 sizer_smearer.Add(self.enable_smearer) 376 # sizer_smearer.Add((10, 10)) 366 377 sizer_smearer.Add(self.pinhole_smearer) 378 # sizer_smearer.Add((10, 10)) 367 379 sizer_smearer.Add(self.slit_smearer) 380 # sizer_smearer.Add((10, 10)) 368 381 sizer_smearer.Add(self.btSmearHelp) 369 382 sizer_smearer.Add((10, 10)) 370 383 371 384 # StaticText for chi2, N(for fitting), Npts + Log/linear spacing 372 self.tcChi = BGTextCtrl(self, wx.ID_ANY, "-", size=(75, 20), style=0)385 self.tcChi = BGTextCtrl(self, -1, "-", size=(75, 20), style=0) 373 386 self.tcChi.SetToolTipString("Chi2/Npts(Fit)") 374 self.Npts_fit = BGTextCtrl(self, wx.ID_ANY, "-", size=(75, 20), style=0)375 self.Npts_fit.SetToolTipString( 387 self.Npts_fit = BGTextCtrl(self, -1, "-", size=(75, 20), style=0) 388 self.Npts_fit.SetToolTipString(\ 376 389 " Npts : number of points selected for fitting") 377 self.Npts_total = ModelTextCtrl(self, wx.ID_ANY, size=(_BOX_WIDTH, 20), 390 self.Npts_total = ModelTextCtrl(self, -1, 391 size=(_BOX_WIDTH, 20), 378 392 style=wx.TE_PROCESS_ENTER, 379 393 text_enter_callback=self._onQrangeEnter) … … 383 397 384 398 # Update and Draw button 385 self.draw_button = wx.Button(self, self._ids.next(), 'Compute') 386 self.draw_button.Bind(wx.EVT_BUTTON, 399 self.draw_button = wx.Button(self, wx.NewId(), 400 'Compute', size=(88, 24)) 401 self.draw_button.Bind(wx.EVT_BUTTON, \ 387 402 self._onDraw, id=self.draw_button.GetId()) 388 403 self.draw_button.SetToolTipString("Compute and Draw.") 389 404 390 405 self.points_sizer = wx.BoxSizer(wx.HORIZONTAL) 391 self.pointsbox = wx.CheckBox(self, wx.ID_ANY, 'Log?', (10, 10))406 self.pointsbox = wx.CheckBox(self, -1, 'Log?', (10, 10)) 392 407 self.pointsbox.SetValue(False) 393 408 self.pointsbox.SetToolTipString("Check mark to use log spaced points") 394 409 wx.EVT_CHECKBOX(self, self.pointsbox.GetId(), self.select_log) 395 410 396 self.points_sizer.Add(wx.StaticText(self, wx.ID_ANY, 'Npts '))411 self.points_sizer.Add(wx.StaticText(self, -1, 'Npts ')) 397 412 self.points_sizer.Add(self.pointsbox) 398 413 399 box_description_1 = wx.StaticText(self, wx.ID_ANY, ' Chi2/Npts') 400 box_description_2 = wx.StaticText(self, wx.ID_ANY, 'Npts(Fit)') 414 box_description_1 = wx.StaticText(self, -1, ' Chi2/Npts') 415 box_description_2 = wx.StaticText(self, -1, 'Npts(Fit)') 416 #box_description_3 = wx.StaticText(self, -1, 'Total Npts') 417 #box_description_3.SetToolTipString( \ 418 # " Total Npts : total number of data points") 419 420 sizer_fit.Add(box_description_1, 0, 0) 421 sizer_fit.Add(box_description_2, 0, 0) 422 sizer_fit.Add(self.points_sizer, 0, 0) 423 #sizer_fit.Add(box_description_3, 0, 0) 424 sizer_fit.Add(self.draw_button, 0, 0) 425 sizer_fit.Add((-1,5)) 426 sizer_fit.Add(self.tcChi, 0, 0) 427 sizer_fit.Add(self.Npts_fit, 0, 0) 428 sizer_fit.Add(self.Npts_total, 0, 0) 429 sizer_fit.Add(self.btFit, 0, 0) 430 sizer_fit.Add(self.btFitHelp, 0, 0) 401 431 402 432 # StaticText for smear 403 self.smear_description_none = wx.StaticText(self, wx.ID_ANY,433 self.smear_description_none = wx.StaticText(self, -1, 404 434 smear_message_none, style=wx.ALIGN_LEFT) 405 self.smear_description_dqdata = wx.StaticText(self, wx.ID_ANY,406 smear_message_dqdata, style=wx.ALIGN_LEFT)407 self.smear_description_type = wx.StaticText(self, wx.ID_ANY,408 "Type:", style=wx.ALIGN_LEFT)409 self.smear_description_accuracy_type = wx.StaticText(self, wx.ID_ANY,410 "Accuracy:", style=wx.ALIGN_LEFT)411 self.smear_description_smear_type = BGTextCtrl(self, wx.ID_ANY,435 self.smear_description_dqdata = wx.StaticText(self, 436 - 1, smear_message_dqdata, style=wx.ALIGN_LEFT) 437 self.smear_description_type = wx.StaticText(self, 438 - 1, "Type:", style=wx.ALIGN_LEFT) 439 self.smear_description_accuracy_type = wx.StaticText(self, -1, 440 "Accuracy:", style=wx.ALIGN_LEFT) 441 self.smear_description_smear_type = BGTextCtrl(self, -1, 412 442 size=(57, 20), style=0) 413 443 self.smear_description_smear_type.SetValue(str(self.dq_l)) 414 444 self.SetBackgroundColour(self.GetParent().GetBackgroundColour()) 415 self.smear_description_2d = wx.StaticText(self, wx.ID_ANY,445 self.smear_description_2d = wx.StaticText(self, -1, 416 446 smear_message_2d, style=wx.ALIGN_LEFT) 417 self.smear_message_new_s = wx.StaticText(self, wx.ID_ANY,447 self.smear_message_new_s = wx.StaticText(self, -1, 418 448 smear_message_new_ssmear, style=wx.ALIGN_LEFT) 419 self.smear_message_new_p = wx.StaticText(self, wx.ID_ANY,449 self.smear_message_new_p = wx.StaticText(self, -1, 420 450 smear_message_new_psmear, style=wx.ALIGN_LEFT) 421 self.smear_description_2d_x = wx.StaticText(self, wx.ID_ANY,451 self.smear_description_2d_x = wx.StaticText(self, -1, 422 452 smear_message_2d_x_title, style=wx.ALIGN_LEFT) 423 self.smear_description_2d_x.SetToolTipString( 453 self.smear_description_2d_x.SetToolTipString(\ 424 454 " dQp(parallel) in q_r direction.") 425 self.smear_description_2d_y = wx.StaticText(self, wx.ID_ANY,455 self.smear_description_2d_y = wx.StaticText(self, -1, 426 456 smear_message_2d_y_title, style=wx.ALIGN_LEFT) 427 457 self.smear_description_2d_y.SetToolTipString(\ 428 458 " dQs(perpendicular) in q_phi direction.") 429 self.smear_description_pin_min = wx.StaticText(self, wx.ID_ANY,459 self.smear_description_pin_min = wx.StaticText(self, -1, 430 460 smear_message_pinhole_min_title, style=wx.ALIGN_LEFT) 431 self.smear_description_pin_max = wx.StaticText(self, wx.ID_ANY,461 self.smear_description_pin_max = wx.StaticText(self, -1, 432 462 smear_message_pinhole_max_title, style=wx.ALIGN_LEFT) 433 self.smear_description_slit_height = wx.StaticText(self, wx.ID_ANY,463 self.smear_description_slit_height = wx.StaticText(self, -1, 434 464 smear_message_slit_height_title, style=wx.ALIGN_LEFT) 435 self.smear_description_slit_width = wx.StaticText(self, wx.ID_ANY,465 self.smear_description_slit_width = wx.StaticText(self, -1, 436 466 smear_message_slit_width_title, style=wx.ALIGN_LEFT) 437 467 … … 520 550 self.sizer5.Clear(True) 521 551 522 self.qmin = ModelTextCtrl(self, wx.ID_ANY, size=(_BOX_WIDTH, 20),552 self.qmin = ModelTextCtrl(self, -1, size=(_BOX_WIDTH, 20), 523 553 style=wx.TE_PROCESS_ENTER, 524 554 set_focus_callback=self.qrang_set_focus, … … 531 561 self.qmin.SetToolTipString(qmin_tip) 532 562 533 self.qmax = ModelTextCtrl(self, wx.ID_ANY, size=(_BOX_WIDTH, 20),563 self.qmax = ModelTextCtrl(self, -1, size=(_BOX_WIDTH, 20), 534 564 style=wx.TE_PROCESS_ENTER, 535 565 set_focus_callback=self.qrang_set_focus, … … 546 576 self.qmin.Bind(wx.EVT_TEXT, self.on_qrange_text) 547 577 self.qmax.Bind(wx.EVT_TEXT, self.on_qrange_text) 548 wx_id = self._ids.next()549 self.reset_qrange = wx.Button(self, wx_id, 'Reset')550 551 self.reset_qrange.Bind(wx.EVT_BUTTON, self.on_reset_clicked, id= wx_id)578 id = wx.NewId() 579 self.reset_qrange = wx.Button(self, id, 'Reset', size=(77, 20)) 580 581 self.reset_qrange.Bind(wx.EVT_BUTTON, self.on_reset_clicked, id=id) 552 582 self.reset_qrange.SetToolTipString("Reset Q range to the default") 553 583 554 sizer = wx.GridSizer( 5, 5, 2, 6)555 556 self.btEditMask = wx.Button(self, self._ids.next(), 'Editor')584 sizer = wx.GridSizer(2, 4, 2, 6) 585 586 self.btEditMask = wx.Button(self, wx.NewId(), 'Editor', size=(88, 23)) 557 587 self.btEditMask.Bind(wx.EVT_BUTTON, self._onMask, 558 588 id=self.btEditMask.GetId()) 559 589 self.btEditMask.SetToolTipString("Edit Mask.") 560 self.EditMask_title = wx.StaticText(self, wx.ID_ANY, ' Masking(2D)')561 562 sizer.Add(wx.StaticText(self, wx.ID_ANY, ' Q range'))563 sizer.Add(wx.StaticText(self, wx.ID_ANY, ' Min[1/A]'))564 sizer.Add(wx.StaticText(self, wx.ID_ANY, ' Max[1/A]'))590 self.EditMask_title = wx.StaticText(self, -1, ' Masking(2D)') 591 592 sizer.Add(wx.StaticText(self, -1, ' Q range')) 593 sizer.Add(wx.StaticText(self, -1, ' Min[1/A]')) 594 sizer.Add(wx.StaticText(self, -1, ' Max[1/A]')) 565 595 sizer.Add(self.EditMask_title) 566 sizer.Add((-1,5))567 568 596 sizer.Add(self.reset_qrange) 569 597 sizer.Add(self.qmin) 570 598 sizer.Add(self.qmax) 599 #sizer.Add(self.theory_npts_tcrtl) 571 600 sizer.Add(self.btEditMask) 572 sizer.Add((-1,5))573 574 sizer.AddMany(5*[(-1,5)])575 576 sizer.Add(box_description_1, 0, 0)577 sizer.Add(box_description_2, 0, 0)578 sizer.Add(self.points_sizer, 0, 0)579 sizer.Add(self.draw_button, 0, 0)580 sizer.Add((-1,5))581 582 sizer.Add(self.tcChi, 0, 0)583 sizer.Add(self.Npts_fit, 0, 0)584 sizer.Add(self.Npts_total, 0, 0)585 sizer.Add(self.btFit, 0, 0)586 sizer.Add(self.btFitHelp, 0, 0)587 588 601 boxsizer_range.Add(sizer_chi2) 602 boxsizer_range.Add((10, 10)) 589 603 boxsizer_range.Add(sizer) 604 605 boxsizer_range.Add((10, 15)) 606 boxsizer_range.Add(sizer_fit) 590 607 if is_2Ddata: 591 608 self.btEditMask.Enable() … … 619 636 620 637 ## fill a sizer with the combobox to select dispersion type 621 model_disp = wx.StaticText(self, wx.ID_ANY, 'Function')638 model_disp = wx.StaticText(self, -1, 'Function') 622 639 CHECK_STATE = self.cb1.GetValue() 623 640 import sas.models.dispersion_models … … 626 643 ix = 0 627 644 iy = 0 628 disp = wx.StaticText(self, wx.ID_ANY, ' ')645 disp = wx.StaticText(self, -1, ' ') 629 646 self.sizer4_4.Add(disp, (iy, ix), (1, 1), 630 647 wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 15) 631 648 ix += 1 632 values = wx.StaticText(self, wx.ID_ANY, 'PD[ratio]')649 values = wx.StaticText(self, -1, 'PD[ratio]') 633 650 polytext = "Polydispersity (= STD/mean); " 634 651 polytext += "the standard deviation over the mean value." … … 642 659 else: 643 660 err_text = '' 644 self.text_disp_1 = wx.StaticText(self, wx.ID_ANY, err_text)661 self.text_disp_1 = wx.StaticText(self, -1, err_text) 645 662 self.sizer4_4.Add(self.text_disp_1, (iy, ix), (1, 1), \ 646 663 wx.EXPAND | wx.ADJUST_MINSIZE, 0) 647 664 648 665 ix += 1 649 self.text_disp_min = wx.StaticText(self, wx.ID_ANY, 'Min')666 self.text_disp_min = wx.StaticText(self, -1, 'Min') 650 667 self.sizer4_4.Add(self.text_disp_min, (iy, ix), (1, 1), \ 651 668 wx.EXPAND | wx.ADJUST_MINSIZE, 0) 652 669 653 670 ix += 1 654 self.text_disp_max = wx.StaticText(self, wx.ID_ANY, 'Max')671 self.text_disp_max = wx.StaticText(self, -1, 'Max') 655 672 self.sizer4_4.Add(self.text_disp_max, (iy, ix), (1, 1), 656 673 wx.EXPAND | wx.ADJUST_MINSIZE, 0) 657 674 658 675 ix += 1 659 npts = wx.StaticText(self, wx.ID_ANY, 'Npts')676 npts = wx.StaticText(self, -1, 'Npts') 660 677 npts.SetToolTipString("Number of sampling points for the numerical\n\ 661 678 integration over the distribution function.") … … 663 680 wx.EXPAND | wx.ADJUST_MINSIZE, 0) 664 681 ix += 1 665 nsigmas = wx.StaticText(self, wx.ID_ANY, 'Nsigs')682 nsigmas = wx.StaticText(self, -1, 'Nsigs') 666 683 nsigmas.SetToolTipString("Number of sigmas between which the range\n\ 667 684 of the distribution function will be used for weighting. \n\ … … 696 713 if p == "width": 697 714 ix = 0 698 cb = wx.CheckBox(self, wx.ID_ANY, name0, (10, 10))715 cb = wx.CheckBox(self, -1, name0, (10, 10)) 699 716 cb.SetValue(CHECK_STATE) 700 717 cb.SetToolTipString("Check mark to fit") … … 704 721 ix = 1 705 722 value = self.model.getParam(name1) 706 ctl1 = ModelTextCtrl(self, wx.ID_ANY,723 ctl1 = ModelTextCtrl(self, -1, 707 724 size=(_BOX_WIDTH / 1.3, 20), 708 725 style=wx.TE_PROCESS_ENTER) … … 716 733 ## text to show error sign 717 734 ix = 2 718 text2 = wx.StaticText(self, wx.ID_ANY, '+/-')735 text2 = wx.StaticText(self, -1, '+/-') 719 736 self.sizer4_4.Add(text2, (iy, ix), (1, 1), 720 737 wx.EXPAND | wx.ADJUST_MINSIZE, 0) … … 723 740 724 741 ix = 3 725 ctl2 = wx.TextCtrl(self, wx.ID_ANY,742 ctl2 = wx.TextCtrl(self, -1, 726 743 size=(_BOX_WIDTH / 1.3, 20), 727 744 style=0) … … 733 750 734 751 ix = 4 735 ctl3 = ModelTextCtrl(self, wx.ID_ANY,752 ctl3 = ModelTextCtrl(self, -1, 736 753 size=(_BOX_WIDTH / 2, 20), 737 754 style=wx.TE_PROCESS_ENTER, … … 742 759 743 760 ix = 5 744 ctl4 = ModelTextCtrl(self, wx.ID_ANY,761 ctl4 = ModelTextCtrl(self, -1, 745 762 size=(_BOX_WIDTH / 2, 20), 746 763 style=wx.TE_PROCESS_ENTER, … … 756 773 ix = 6 757 774 value = self.model.getParam(name2) 758 Tctl = ModelTextCtrl(self, wx.ID_ANY,775 Tctl = ModelTextCtrl(self, -1, 759 776 size=(_BOX_WIDTH / 2.2, 20), 760 777 style=wx.TE_PROCESS_ENTER) … … 768 785 ix = 7 769 786 value = self.model.getParam(name3) 770 Tct2 = ModelTextCtrl(self, wx.ID_ANY,787 Tct2 = ModelTextCtrl(self, -1, 771 788 size=(_BOX_WIDTH / 2.2, 20), 772 789 style=wx.TE_PROCESS_ENTER) … … 780 797 781 798 ix = 8 782 disp_box = wx.ComboBox(self, wx.ID_ANY, size=(65, -1),799 disp_box = wx.ComboBox(self, -1, size=(65, -1), 783 800 style=wx.CB_READONLY, name='%s' % name1) 784 801 for key, value in self.polydisp.iteritems(): … … 786 803 disp_box.Append(name_disp, value) 787 804 disp_box.SetStringSelection("gaussian") 788 wx.EVT_COMBOBOX(disp_box, wx.ID_ANY, self._on_disp_func)805 wx.EVT_COMBOBOX(disp_box, -1, self._on_disp_func) 789 806 self.sizer4_4.Add(disp_box, (iy, ix), (1, 1), wx.EXPAND) 790 807 self.fittable_param.append([cb, name1, ctl1, text2, … … 816 833 if p == "width": 817 834 ix = 0 818 cb = wx.CheckBox(self, wx.ID_ANY, name0, (10, 10))835 cb = wx.CheckBox(self, -1, name0, (10, 10)) 819 836 cb.SetValue(CHECK_STATE) 820 837 cb.SetToolTipString("Check mark to fit") … … 829 846 ix = 1 830 847 value = self.model.getParam(name1) 831 ctl1 = ModelTextCtrl(self, wx.ID_ANY,848 ctl1 = ModelTextCtrl(self, -1, 832 849 size=(_BOX_WIDTH / 1.3, 20), 833 850 style=wx.TE_PROCESS_ENTER) … … 855 872 ## text to show error sign 856 873 ix = 2 857 text2 = wx.StaticText(self, wx.ID_ANY, '+/-')874 text2 = wx.StaticText(self, -1, '+/-') 858 875 self.sizer4_4.Add(text2, (iy, ix), (1, 1), 859 876 wx.EXPAND | wx.ADJUST_MINSIZE, 0) … … 862 879 863 880 ix = 3 864 ctl2 = wx.TextCtrl(self, wx.ID_ANY,881 ctl2 = wx.TextCtrl(self, -1, 865 882 size=(_BOX_WIDTH / 1.3, 20), 866 883 style=0) … … 877 894 878 895 ix = 4 879 ctl3 = ModelTextCtrl(self, wx.ID_ANY,896 ctl3 = ModelTextCtrl(self, -1, 880 897 size=(_BOX_WIDTH / 2, 20), 881 898 style=wx.TE_PROCESS_ENTER, … … 888 905 889 906 ix = 5 890 ctl4 = ModelTextCtrl(self, wx.ID_ANY,907 ctl4 = ModelTextCtrl(self, -1, 891 908 size=(_BOX_WIDTH / 2, 20), 892 909 style=wx.TE_PROCESS_ENTER, … … 904 921 ix = 6 905 922 value = self.model.getParam(name2) 906 Tctl = ModelTextCtrl(self, wx.ID_ANY,923 Tctl = ModelTextCtrl(self, -1, 907 924 size=(_BOX_WIDTH / 2.2, 20), 908 925 style=wx.TE_PROCESS_ENTER) … … 924 941 ix = 7 925 942 value = self.model.getParam(name3) 926 Tct2 = ModelTextCtrl(self, wx.ID_ANY,943 Tct2 = ModelTextCtrl(self, -1, 927 944 size=(_BOX_WIDTH / 2.2, 20), 928 945 style=wx.TE_PROCESS_ENTER) … … 944 961 945 962 ix = 8 946 disp_box = wx.ComboBox(self, wx.ID_ANY, size=(65, -1),963 disp_box = wx.ComboBox(self, -1, size=(65, -1), 947 964 style=wx.CB_READONLY, name='%s' % name1) 948 965 for key, value in self.polydisp.iteritems(): … … 950 967 disp_box.Append(name_disp, value) 951 968 disp_box.SetStringSelection("gaussian") 952 wx.EVT_COMBOBOX(disp_box, wx.ID_ANY, self._on_disp_func)969 wx.EVT_COMBOBOX(disp_box, -1, self._on_disp_func) 953 970 self.sizer4_4.Add(disp_box, (iy, ix), (1, 1), wx.EXPAND) 954 971 self.fittable_param.append([cb, name1, ctl1, text2, … … 1080 1097 1081 1098 _TreeLocation = "user/perspectives/fitting/fitting_help.html" 1082 _doc_viewer = DocumentationWindow(self, wx.ID_ANY, _TreeLocation, "",1099 _doc_viewer = DocumentationWindow(self, -1, _TreeLocation, "", 1083 1100 "General Fitting Help") 1084 1101 … … 1099 1116 1100 1117 _TreeLocation = "user/perspectives/fitting/sm_help.html" 1101 _doc_viewer = DocumentationWindow(self, wx.ID_ANY, _TreeLocation, "",1118 _doc_viewer = DocumentationWindow(self, -1, _TreeLocation, "", 1102 1119 "Instrumental Resolution Smearing \ 1103 1120 Help") … … 1183 1200 self._keep.Enable(False) 1184 1201 self._set_save_flag(False) 1185 # TODO: why do we have to variables for one flag??1186 1202 self.enable_disp.SetValue(False) 1187 1203 self.disable_disp.SetValue(True) 1188 # TODO: should not have an untrapped exception when displaying disperser1189 # TODO: do we need to create the disperser panel on every model change?1190 # Note: if we fix this, then remove ID_DISPERSER_HELP from basepage1191 1204 try: 1192 1205 self.set_dispers_sizer() … … 2836 2849 return 2837 2850 2838 box_description = wx.StaticBox(self, wx.ID_ANY, str("Model Parameters"))2851 box_description = wx.StaticBox(self, -1, str("Model Parameters")) 2839 2852 boxsizer1 = wx.StaticBoxSizer(box_description, wx.VERTICAL) 2840 2853 sizer = wx.GridBagSizer(5, 5) … … 2903 2916 ix = 0 2904 2917 select_text = "Select All" 2905 self.cb1 = wx.CheckBox(self, wx.ID_ANY, str(select_text), (10, 10))2918 self.cb1 = wx.CheckBox(self, -1, str(select_text), (10, 10)) 2906 2919 wx.EVT_CHECKBOX(self, self.cb1.GetId(), self.select_all_param) 2907 2920 self.cb1.SetToolTipString("To check/uncheck all the boxes below.") … … 2911 2924 wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 5) 2912 2925 ix += 1 2913 self.text2_2 = wx.StaticText(self, wx.ID_ANY, 'Value')2926 self.text2_2 = wx.StaticText(self, -1, 'Value') 2914 2927 sizer.Add(self.text2_2, (iy, ix), (1, 1), \ 2915 2928 wx.EXPAND | wx.ADJUST_MINSIZE, 0) 2916 2929 ix += 2 2917 self.text2_3 = wx.StaticText(self, wx.ID_ANY, 'Error')2930 self.text2_3 = wx.StaticText(self, -1, 'Error') 2918 2931 sizer.Add(self.text2_3, (iy, ix), (1, 1), \ 2919 2932 wx.EXPAND | wx.ADJUST_MINSIZE, 0) … … 2921 2934 self.text2_3.Hide() 2922 2935 ix += 1 2923 self.text2_min = wx.StaticText(self, wx.ID_ANY, 'Min')2936 self.text2_min = wx.StaticText(self, -1, 'Min') 2924 2937 sizer.Add(self.text2_min, (iy, ix), (1, 1), \ 2925 2938 wx.EXPAND | wx.ADJUST_MINSIZE, 0) 2926 2939 #self.text2_min.Hide() 2927 2940 ix += 1 2928 self.text2_max = wx.StaticText(self, wx.ID_ANY, 'Max')2941 self.text2_max = wx.StaticText(self, -1, 'Max') 2929 2942 sizer.Add(self.text2_max, (iy, ix), (1, 1), \ 2930 2943 wx.EXPAND | wx.ADJUST_MINSIZE, 0) 2931 2944 #self.text2_max.Hide() 2932 2945 ix += 1 2933 self.text2_4 = wx.StaticText(self, wx.ID_ANY, '[Units]')2946 self.text2_4 = wx.StaticText(self, -1, '[Units]') 2934 2947 sizer.Add(self.text2_4, (iy, ix), (1, 1), \ 2935 2948 wx.EXPAND | wx.ADJUST_MINSIZE, 0) … … 2952 2965 self.temp_multi_functional)\ 2953 2966 and (item in self.model.non_fittable): 2954 non_fittable_name = wx.StaticText(self, wx.ID_ANY, item)2967 non_fittable_name = wx.StaticText(self, -1, item) 2955 2968 sizer.Add(non_fittable_name, (iy, ix), (1, 1), \ 2956 2969 wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 21) … … 2960 2973 if len(self.model.fun_list) > 0: 2961 2974 #num = item.split('_')[1][5:7] 2962 fun_box = wx.ComboBox(self, wx.ID_ANY, size=(100, -1),2975 fun_box = wx.ComboBox(self, -1, size=(100, -1), 2963 2976 style=wx.CB_READONLY, name='%s' % item) 2964 2977 self._set_fun_box_list(fun_box) … … 2966 2979 #self.fun_box.SetToolTipString("A function 2967 2980 # describing the interface") 2968 wx.EVT_COMBOBOX(fun_box, wx.ID_ANY, self._on_fun_box)2981 wx.EVT_COMBOBOX(fun_box, -1, self._on_fun_box) 2969 2982 else: 2970 fun_box = ModelTextCtrl(self, wx.ID_ANY,2983 fun_box = ModelTextCtrl(self, -1, 2971 2984 size=(_BOX_WIDTH, 20), 2972 2985 style=wx.TE_PROCESS_ENTER, name='%s' % item) … … 2980 2993 else: 2981 2994 ## add parameters name with checkbox for selecting to fit 2982 cb = wx.CheckBox(self, wx.ID_ANY, item)2995 cb = wx.CheckBox(self, -1, item) 2983 2996 cb.SetValue(CHECK_STATE) 2984 2997 cb.SetToolTipString(" Check mark to fit.") … … 2992 3005 ix += 1 2993 3006 value = self.model.getParam(item) 2994 ctl1 = ModelTextCtrl(self, wx.ID_ANY, size=(_BOX_WIDTH, 20),3007 ctl1 = ModelTextCtrl(self, -1, size=(_BOX_WIDTH, 20), 2995 3008 style=wx.TE_PROCESS_ENTER) 2996 3009 ctl1.SetToolTipString(\ … … 3000 3013 ## text to show error sign 3001 3014 ix += 1 3002 text2 = wx.StaticText(self, wx.ID_ANY, '+/-')3015 text2 = wx.StaticText(self, -1, '+/-') 3003 3016 sizer.Add(text2, (iy, ix), (1, 1), \ 3004 3017 wx.EXPAND | wx.ADJUST_MINSIZE, 0) … … 3006 3019 text2.Hide() 3007 3020 ix += 1 3008 ctl2 = wx.TextCtrl(self, wx.ID_ANY,3021 ctl2 = wx.TextCtrl(self, -1, 3009 3022 size=(_BOX_WIDTH / 1.2, 20), style=0) 3010 3023 sizer.Add(ctl2, (iy, ix), (1, 1), … … 3014 3027 3015 3028 ix += 1 3016 ctl3 = ModelTextCtrl(self, wx.ID_ANY,3029 ctl3 = ModelTextCtrl(self, -1, 3017 3030 size=(_BOX_WIDTH / 1.9, 20), 3018 3031 style=wx.TE_PROCESS_ENTER, … … 3026 3039 3027 3040 ix += 1 3028 ctl4 = ModelTextCtrl(self, wx.ID_ANY,3041 ctl4 = ModelTextCtrl(self, -1, 3029 3042 size=(_BOX_WIDTH / 1.9, 20), 3030 3043 style=wx.TE_PROCESS_ENTER, … … 3039 3052 # Units 3040 3053 if item in self.model.details: 3041 units = wx.StaticText(self, wx.ID_ANY,3054 units = wx.StaticText(self, -1, 3042 3055 self.model.details[item][0], style=wx.ALIGN_LEFT) 3043 3056 else: 3044 units = wx.StaticText(self, wx.ID_ANY, "",3057 units = wx.StaticText(self, -1, "", 3045 3058 style=wx.ALIGN_LEFT) 3046 3059 sizer.Add(units, (iy, ix), (1, 1), … … 3065 3078 for item in keys: 3066 3079 if item in self.model.orientation_params: 3067 orient_angle = wx.StaticText(self, wx.ID_ANY, '[For 2D only]:')3068 mag_on_button = wx.Button(self, wx.ID_ANY, "Magnetic ON")3080 orient_angle = wx.StaticText(self, -1, '[For 2D only]:') 3081 mag_on_button = wx.Button(self, -1, "Magnetic ON") 3069 3082 mag_on_button.SetToolTipString("Turn Pol Beam/Mag scatt on/off") 3070 3083 mag_on_button.Bind(wx.EVT_BUTTON, self._on_mag_on) 3071 mag_angle_help_button = wx.Button(self, wx.ID_ANY, "Magnetic angles?")3084 mag_angle_help_button = wx.Button(self, -1, "Magnetic angles?") 3072 3085 mag_angle_help_button.SetToolTipString("see angle definitions") 3073 mag_help_button = wx.Button(self, wx.ID_ANY, "Mag HELP")3086 mag_help_button = wx.Button(self, -1, "Mag HELP") 3074 3087 mag_help_button.SetToolTipString("Help on pol beam/mag fitting") 3075 3088 mag_help_button.Bind(wx.EVT_BUTTON, self._on_mag_help) … … 3129 3142 ix = 0 3130 3143 ## add parameters name with checkbox for selecting to fit 3131 cb = wx.CheckBox(self, wx.ID_ANY, item)3144 cb = wx.CheckBox(self, -1, item) 3132 3145 cb.SetValue(CHECK_STATE) 3133 3146 cb.SetToolTipString("Check mark to fit")
Note: See TracChangeset
for help on using the changeset viewer.