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