Changeset 6f16e25 in sasview for src/sas/perspectives/fitting/simfitpage.py
- Timestamp:
- Oct 21, 2015 8:35:00 AM (9 years ago)
- Branches:
- master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- 85130cb
- Parents:
- 2d88fc4
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/perspectives/fitting/simfitpage.py
racf8e4a5 r6f16e25 46 46 ## Title to appear on top of the window 47 47 window_caption = "Simultaneous Fit Page" 48 49 def __init__(self, parent, page_finder={}, id= -1, batch_on=False, 48 ID_SET_ALL = wx.NewId() 49 ID_REMOVE = wx.NewId() 50 ID_FIT = wx.NewId() 51 ID_ADD = wx.NewId() 52 53 def __init__(self, parent, page_finder={}, id= wx.ID_ANY, batch_on=False, 50 54 *args, **kwargs): 51 55 ScrolledPanel.__init__(self, parent, id=id, … … 78 82 self.model_cbox_left = None 79 83 self.model_cbox_right = None 80 self.uid = wx.NewId()81 84 ## draw page 82 85 self.define_page_structure() … … 294 297 295 298 self.sizer1.Clear(True) 296 box_description = wx.StaticBox(self, -1, "Fit Combinations")299 box_description = wx.StaticBox(self, wx.ID_ANY, "Fit Combinations") 297 300 boxsizer1 = wx.StaticBoxSizer(box_description, wx.VERTICAL) 298 301 sizer_title = wx.BoxSizer(wx.HORIZONTAL) … … 303 306 msg += " Please load data and set up " 304 307 msg += "at least two fit panels first..." 305 sizer_title.Add(wx.StaticText(self, -1, msg))308 sizer_title.Add(wx.StaticText(self, wx.ID_ANY, msg)) 306 309 else: 307 310 ## store model 308 311 self._store_model() 309 312 310 self.cb1 = wx.CheckBox(self, -1, 'Select all')313 self.cb1 = wx.CheckBox(self, wx.ID_ANY, 'Select all') 311 314 self.cb1.SetValue(False) 312 315 … … 370 373 Show constraint fields 371 374 """ 372 box_description = wx.StaticBox(self, -1, "Easy Setup ")375 box_description = wx.StaticBox(self, wx.ID_ANY, "Easy Setup ") 373 376 boxsizer = wx.StaticBoxSizer(box_description, wx.HORIZONTAL) 374 377 sizer_constraint = wx.BoxSizer(wx.HORIZONTAL) 375 self.model_cbox_left = wx.ComboBox(self, -1, style=wx.CB_READONLY)378 self.model_cbox_left = wx.ComboBox(self, wx.ID_ANY, style=wx.CB_READONLY) 376 379 self.model_cbox_left.Clear() 377 self.model_cbox_right = wx.ComboBox(self, -1, style=wx.CB_READONLY)380 self.model_cbox_right = wx.ComboBox(self, wx.ID_ANY, style=wx.CB_READONLY) 378 381 self.model_cbox_right.Clear() 379 wx.EVT_COMBOBOX(self.model_cbox_left, -1, self._on_select_modelcb)380 wx.EVT_COMBOBOX(self.model_cbox_right, -1, self._on_select_modelcb)381 egal_txt = wx.StaticText(self, -1, " = ")382 self.set_button = wx.Button(self, wx.NewId(), 'Set All')382 wx.EVT_COMBOBOX(self.model_cbox_left, wx.ID_ANY, self._on_select_modelcb) 383 wx.EVT_COMBOBOX(self.model_cbox_right, wx.ID_ANY, self._on_select_modelcb) 384 egal_txt = wx.StaticText(self, wx.ID_ANY, " = ") 385 self.set_button = wx.Button(self, self.ID_SET_ALL, 'Set All') 383 386 self.set_button.Bind(wx.EVT_BUTTON, self._on_set_all_equal, 384 387 id=self.set_button.GetId()) … … 399 402 boxsizer.Add(self.model_cbox_left, 400 403 flag=wx.RIGHT | wx.EXPAND, border=10) 401 boxsizer.Add(wx.StaticText(self, -1, ".parameters"),404 boxsizer.Add(wx.StaticText(self, wx.ID_ANY, ".parameters"), 402 405 flag=wx.RIGHT | wx.EXPAND, border=5) 403 406 boxsizer.Add(egal_txt, flag=wx.RIGHT | wx.EXPAND, border=5) 404 407 boxsizer.Add(self.model_cbox_right, 405 408 flag=wx.RIGHT | wx.EXPAND, border=10) 406 boxsizer.Add(wx.StaticText(self, -1, ".parameters"),409 boxsizer.Add(wx.StaticText(self, wx.ID_ANY, ".parameters"), 407 410 flag=wx.RIGHT | wx.EXPAND, border=5) 408 411 boxsizer.Add((20, -1)) … … 510 513 511 514 sizer_constraint = wx.BoxSizer(wx.HORIZONTAL) 512 model_cbox = wx.ComboBox(self, -1, style=wx.CB_READONLY)515 model_cbox = wx.ComboBox(self, wx.ID_ANY, style=wx.CB_READONLY) 513 516 model_cbox.Clear() 514 param_cbox = wx.ComboBox(self, -1, style=wx.CB_READONLY, size=(100, -1),)517 param_cbox = wx.ComboBox(self, wx.ID_ANY, style=wx.CB_READONLY, size=(100, -1),) 515 518 param_cbox.Hide() 516 519 … … 518 521 self.param_cbox = param_cbox 519 522 520 wx.EVT_COMBOBOX(param_cbox, -1, self._on_select_param)521 self.ctl2 = wx.TextCtrl(self, -1)522 egal_txt = wx.StaticText(self, -1, " = ")523 self.btRemove = wx.Button(self, wx.NewId(), 'Remove')523 wx.EVT_COMBOBOX(param_cbox, wx.ID_ANY, self._on_select_param) 524 self.ctl2 = wx.TextCtrl(self, wx.ID_ANY) 525 egal_txt = wx.StaticText(self, wx.ID_ANY, " = ") 526 self.btRemove = wx.Button(self, self.ID_REMOVE, 'Remove') 524 527 self.btRemove.Bind(wx.EVT_BUTTON, self.onRemove, 525 528 id=self.btRemove.GetId()) … … 536 539 self.model_cbox = model_cbox 537 540 538 wx.EVT_COMBOBOX(model_cbox, -1, self._on_select_model)539 sizer_constraint.Add((5, -1))541 wx.EVT_COMBOBOX(model_cbox, wx.ID_ANY, self._on_select_model) 542 sizer_constraint.Add((5, wx.ID_ANY)) 540 543 sizer_constraint.Add(model_cbox, flag=wx.RIGHT | wx.EXPAND, border=10) 541 544 sizer_constraint.Add(param_cbox, flag=wx.RIGHT | wx.EXPAND, border=5) … … 672 675 """ 673 676 self.sizer3.Clear(True) 674 box_description = wx.StaticBox(self, -1, "Fit ")677 box_description = wx.StaticBox(self, wx.ID_ANY, "Fit ") 675 678 boxsizer1 = wx.StaticBoxSizer(box_description, wx.VERTICAL) 676 679 sizer_button = wx.BoxSizer(wx.HORIZONTAL) 677 680 678 self.btFit = wx.Button(self, wx.NewId(), 'Fit', size=wx.DefaultSize)681 self.btFit = wx.Button(self, self.ID_FIT, 'Fit', size=wx.DefaultSize) 679 682 self.btFit.Bind(wx.EVT_BUTTON, self.onFit, id=self.btFit.GetId()) 680 683 self.btFit.SetToolTipString("Perform fit.") … … 684 687 text = " This page requires at least one FitPage with a data\n" 685 688 text = " and a model for fitting." 686 text_hint = wx.StaticText(self, -1, text)689 text_hint = wx.StaticText(self, wx.ID_ANY, text) 687 690 688 691 sizer_button.Add(text_hint, wx.RIGHT | wx.EXPAND, 10) … … 705 708 self.sizer2.Show(False) 706 709 return 707 box_description = wx.StaticBox(self, -1, "Fit Constraints")710 box_description = wx.StaticBox(self, wx.ID_ANY, "Fit Constraints") 708 711 boxsizer1 = wx.StaticBoxSizer(box_description, wx.VERTICAL) 709 712 sizer_title = wx.BoxSizer(wx.HORIZONTAL) … … 712 715 sizer_button = wx.BoxSizer(wx.HORIZONTAL) 713 716 714 self.hide_constraint = wx.RadioButton(self, -1, 'No', (10, 10),717 self.hide_constraint = wx.RadioButton(self, wx.ID_ANY, 'No', (10, 10), 715 718 style=wx.RB_GROUP) 716 self.show_constraint = wx.RadioButton(self, -1, 'Yes', (10, 30))719 self.show_constraint = wx.RadioButton(self, wx.ID_ANY, 'Yes', (10, 30)) 717 720 self.Bind(wx.EVT_RADIOBUTTON, self._display_constraint, 718 721 id=self.hide_constraint.GetId()) … … 725 728 self.show_constraint.SetValue(False) 726 729 727 sizer_title.Add(wx.StaticText(self, -1, " Model"))730 sizer_title.Add(wx.StaticText(self, wx.ID_ANY, " Model")) 728 731 sizer_title.Add((10, 10)) 729 sizer_title.Add(wx.StaticText(self, -1, " Parameter"))732 sizer_title.Add(wx.StaticText(self, wx.ID_ANY, " Parameter")) 730 733 sizer_title.Add((10, 10)) 731 sizer_title.Add(wx.StaticText(self, -1, " Add Constraint?"))734 sizer_title.Add(wx.StaticText(self, wx.ID_ANY, " Add Constraint?")) 732 735 sizer_title.Add((10, 10)) 733 736 sizer_title.Add(self.show_constraint) … … 735 738 sizer_title.Add((10, 10)) 736 739 737 self.btAdd = wx.Button(self, wx.NewId(), 'Add')740 self.btAdd = wx.Button(self, self.ID_ADD, 'Add') 738 741 self.btAdd.Bind(wx.EVT_BUTTON, self._onAdd_constraint, 739 742 id=self.btAdd.GetId()) … … 741 744 self.btAdd.Hide() 742 745 743 text_hint = wx.StaticText(self, -1,746 text_hint = wx.StaticText(self, wx.ID_ANY, 744 747 "Example: [M0][paramter] = M1.parameter") 745 748 sizer_button.Add(text_hint, 0 , wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 10) … … 821 824 sizer.Clear(True) 822 825 823 new_name = wx.StaticText(self, -1, ' Model Title ',826 new_name = wx.StaticText(self, wx.ID_ANY, ' Model Title ', 824 827 style=wx.ALIGN_CENTER) 825 828 new_name.SetBackgroundColour('orange') … … 828 831 wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 15) 829 832 ix += 2 830 model_type = wx.StaticText(self, -1, ' Model ')833 model_type = wx.StaticText(self, wx.ID_ANY, ' Model ') 831 834 model_type.SetBackgroundColour('grey') 832 835 model_type.SetForegroundColour(wx.WHITE) … … 834 837 wx.EXPAND | wx.ADJUST_MINSIZE, 0) 835 838 ix += 1 836 data_used = wx.StaticText(self, -1, ' Data ')839 data_used = wx.StaticText(self, wx.ID_ANY, ' Data ') 837 840 data_used.SetBackgroundColour('grey') 838 841 data_used.SetForegroundColour(wx.WHITE) … … 840 843 wx.EXPAND | wx.ADJUST_MINSIZE, 0) 841 844 ix += 1 842 tab_used = wx.StaticText(self, -1, ' FitPage ')845 tab_used = wx.StaticText(self, wx.ID_ANY, ' FitPage ') 843 846 tab_used.SetBackgroundColour('grey') 844 847 tab_used.SetForegroundColour(wx.WHITE) … … 879 882 if model is not None: 880 883 name = str(model.name) 881 cb = wx.CheckBox(self, -1, name)884 cb = wx.CheckBox(self, wx.ID_ANY, name) 882 885 cb.SetValue(False) 883 886 cb.Enable(model is not None and data.is_data) … … 887 890 ix += 2 888 891 type = model.__class__.__name__ 889 model_type = wx.StaticText(self, -1, str(type))892 model_type = wx.StaticText(self, wx.ID_ANY, str(type)) 890 893 sizer.Add(model_type, (iy, ix), (1, 1), 891 894 wx.EXPAND | wx.ADJUST_MINSIZE, 0) 892 895 if self.batch_on: 893 data_used = wx.ComboBox(self, -1, style=wx.CB_READONLY)896 data_used = wx.ComboBox(self, wx.ID_ANY, style=wx.CB_READONLY) 894 897 data_used.AppendItems(data_list) 895 898 data_used.SetSelection(0) 896 899 else: 897 data_used = wx.StaticText(self, -1, data_list[0])900 data_used = wx.StaticText(self, wx.ID_ANY, data_list[0]) 898 901 899 902 ix += 1 … … 902 905 ix += 1 903 906 caption = value.get_fit_tab_caption() 904 tab_caption_used = wx.StaticText(self, -1, str(caption))907 tab_caption_used = wx.StaticText(self, wx.ID_ANY, str(caption)) 905 908 sizer.Add(tab_caption_used, (iy, ix), (1, 1), 906 909 wx.EXPAND | wx.ADJUST_MINSIZE, 0)
Note: See TracChangeset
for help on using the changeset viewer.