Changeset 5bf0331 in sasview for src/sans/perspectives/fitting/basepage.py
- Timestamp:
- May 5, 2014 9:21:47 AM (11 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:
- 644ca73
- Parents:
- 6f87cc1 (diff), 0089be3 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sans/perspectives/fitting/basepage.py
r6fe5100 r5bf0331 172 172 self.orientation_params = [] 173 173 self.orientation_params_disp = [] 174 if self.model != None: 175 self.disp_list = self.model.getDispParamList() 174 # Self.model should ALWAYS be None here. It was set to none above in 175 # this long init setting. no obvious function call in between setting 176 # and this - commenting out on 4/8/2014 by PDB. Remove once clear 177 # it is pointless. 178 # if self.model != None: 179 # self.disp_list = self.model.getDispParamList() 176 180 self.temp_multi_functional = False 177 181 ##enable model 2D draw … … 481 485 set some page important information at once 482 486 """ 487 # THIS METHOD/FUNCTION NO LONGE APPEARS TO BE CALLED. Started up program 488 # and started new fit window and PR and Invariant and a fit in fitting 489 # but never entered this routine which should be an initialization 490 # routine. Leave for a while but probably something to clean up at 491 # some point? 492 # 493 # PDB April 13 2014 494 # 483 495 ##window_name 484 496 self.window_name = page_info.window_name … … 626 638 return 627 639 if len(self.model_list_box) > 0: 628 self._populate_box(self.formfactorbox, 629 self.model_list_box["Shapes"]) 630 631 if len(self.model_list_box) > 0: 640 ## This is obsolete code since form factor box is no longer static. 641 ## It is now set dynamically through _show_combox and _show_combos_helper 642 ## These are called for first time by formfactor_combo_init 643 ## itself called from fitpanel only. If we find that I'm wrong and 644 ## we DO need to initialize somehow here - do it by a call to 645 ## formfactor_combo_init 646 ## self.formfator_combo_init() 647 ## BUT NOT HERE -- make it last line of this 648 ## method so that structure box is populated before _show_comboox_helper 649 ## is called. Otherwise wx will complain mightily:-) 650 ## 651 ## Also change the name to initiatlize_structurebox along with changes 652 ## to other combobox methods (_populate_listbox --> _populate_categorybox 653 ## etc ) 654 ## 655 ## PDB 4/26/2014 656 # self._populate_box(self.formfactorbox, 657 # self.model_list_box["Shapes"]) 632 658 self._populate_box(self.structurebox, 633 659 self.model_list_box["Structure Factors"]) … … 644 670 self.structurebox.Enable() 645 671 self.text2.Enable() 672 646 673 647 674 def set_dispers_sizer(self): … … 1836 1863 [max_state, max_value], unit]) 1837 1864 1838 def _set_model_sizer_selection(self, model): 1839 """ 1840 Display the sizer according to the type of the current model 1841 """ 1842 if model == None: 1843 return 1844 if hasattr(model, "s_model"): 1845 1846 class_name = model.s_model.__class__ 1847 name = model.s_model.name 1848 flag = (name != "NoStructure") 1849 if flag and \ 1850 (class_name in self.model_list_box["Structure Factors"]): 1851 self.structurebox.Show() 1852 self.text2.Show() 1853 self.structurebox.Enable() 1854 self.text2.Enable() 1855 items = self.structurebox.GetItems() 1856 self.sizer1.Layout() 1857 1858 for i in range(len(items)): 1859 if items[i] == str(name): 1860 self.structurebox.SetSelection(i) 1861 break 1862 1863 if hasattr(model, "p_model"): 1864 class_name = model.p_model.__class__ 1865 name = model.p_model.name 1866 self.formfactorbox.Clear() 1867 1868 for k, list in self.model_list_box.iteritems(): 1869 if k in["P(Q)*S(Q)", "Shapes"] and \ 1870 class_name in self.model_list_box["Shapes"]: 1871 self.shape_rbutton.SetValue(True) 1865 # The following funcion seems to be superseded with fillsizer and 1866 # init combo box. certainly it seems not to know about categories and uses 1867 # only shapes and shape independent -- tested after commenting out and does 1868 # not seem to cause problem. Leave commented out for now but delete in 1869 # a code cleanup once clear it really is no longer used. 1870 # PDB 8 April 2014 1871 1872 # def _set_model_sizer_selection(self, model): 1873 # """ 1874 # Display the sizer according to the type of the current model 1875 # """ 1876 # if model == None: 1877 # return 1878 # if hasattr(model, "s_model"): 1879 # 1880 # class_name = model.s_model.__class__ 1881 # name = model.s_model.name 1882 # flag = (name != "NoStructure") 1883 # if flag and \ 1884 # (class_name in self.model_list_box["Structure Factors"]): 1885 # self.structurebox.Show() 1886 # self.text2.Show() 1887 # self.structurebox.Enable() 1888 # self.text2.Enable() 1889 # items = self.structurebox.GetItems() 1890 # self.sizer1.Layout() 1891 # 1892 # for i in range(len(items)): 1893 # if items[i] == str(name): 1894 # self.structurebox.SetSelection(i) 1895 # break 1896 # 1897 # if hasattr(model, "p_model"): 1898 # class_name = model.p_model.__class__ 1899 # name = model.p_model.name 1900 # self.formfactorbox.Clear() 1901 # 1902 # for k, list in self.model_list_box.iteritems(): 1903 # if k in["P(Q)*S(Q)", "Shapes"] and \ 1904 # class_name in self.model_list_box["Shapes"]: 1905 # self.shape_rbutton.SetValue(True) 1906 # ## fill the form factor list with new model 1907 # self._populate_box(self.formfactorbox, 1908 # self.model_list_box["Shapes"]) 1909 # items = self.formfactorbox.GetItems() 1910 # ## set comboxbox to the selected item 1911 # for i in range(len(items)): 1912 # if items[i] == str(name): 1913 # self.formfactorbox.SetSelection(i) 1914 # break 1915 # return 1916 # elif k == "Shape-Independent": 1917 # self.shape_indep_rbutton.SetValue(True) 1918 # elif k == "Structure Factors": 1919 # self.struct_rbutton.SetValue(True) 1920 # elif k == "Multi-Functions": 1921 # continue 1922 # else: 1923 # self.plugin_rbutton.SetValue(True) 1924 # 1925 # if class_name in list: 1926 # ## fill the form factor list with new model 1927 # self._populate_box(self.formfactorbox, list) 1928 # items = self.formfactorbox.GetItems() 1929 # ## set comboxbox to the selected item 1930 # for i in range(len(items)): 1931 # if items[i] == str(name): 1932 # self.formfactorbox.SetSelection(i) 1933 # break 1934 # break 1935 # else: 1936 ## Select the model from the menu 1937 # class_name = model.__class__ 1938 # name = model.name 1939 # self.formfactorbox.Clear() 1940 # items = self.formfactorbox.GetItems() 1941 # 1942 # for k, list in self.model_list_box.iteritems(): 1943 # if k in["P(Q)*S(Q)", "Shapes"] and \ 1944 # class_name in self.model_list_box["Shapes"]: 1945 # if class_name in self.model_list_box["P(Q)*S(Q)"]: 1946 # self.structurebox.Show() 1947 # self.text2.Show() 1948 # self.structurebox.Enable() 1949 # self.structurebox.SetSelection(0) 1950 # self.text2.Enable() 1951 # else: 1952 # self.structurebox.Hide() 1953 # self.text2.Hide() 1954 # self.structurebox.Disable() 1955 # self.structurebox.SetSelection(0) 1956 # self.text2.Disable() 1957 # 1958 # self.shape_rbutton.SetValue(True) 1872 1959 ## fill the form factor list with new model 1873 self._populate_box(self.formfactorbox, 1874 self.model_list_box["Shapes"]) 1875 items = self.formfactorbox.GetItems() 1960 # self._populate_box(self.formfactorbox, 1961 # self.model_list_box["Shapes"]) 1962 # items = self.formfactorbox.GetItems() 1963 # ## set comboxbox to the selected item 1964 # for i in range(len(items)): 1965 # if items[i] == str(name): 1966 # self.formfactorbox.SetSelection(i) 1967 # break 1968 # return 1969 # elif k == "Shape-Independent": 1970 # self.shape_indep_rbutton.SetValue(True) 1971 # elif k == "Structure Factors": 1972 # self.struct_rbutton.SetValue(True) 1973 # elif k == "Multi-Functions": 1974 # continue 1975 # else: 1976 # self.plugin_rbutton.SetValue(True) 1977 # if class_name in list: 1978 # self.structurebox.SetSelection(0) 1979 # self.structurebox.Disable() 1980 # self.text2.Disable() 1981 ## fill the form factor list with new model 1982 # self._populate_box(self.formfactorbox, list) 1983 # items = self.formfactorbox.GetItems() 1876 1984 ## set comboxbox to the selected item 1877 for i in range(len(items)): 1878 if items[i] == str(name): 1879 self.formfactorbox.SetSelection(i) 1880 break 1881 return 1882 elif k == "Shape-Independent": 1883 self.shape_indep_rbutton.SetValue(True) 1884 elif k == "Structure Factors": 1885 self.struct_rbutton.SetValue(True) 1886 elif k == "Multi-Functions": 1887 continue 1888 else: 1889 self.plugin_rbutton.SetValue(True) 1890 1891 if class_name in list: 1892 ## fill the form factor list with new model 1893 self._populate_box(self.formfactorbox, list) 1894 items = self.formfactorbox.GetItems() 1895 ## set comboxbox to the selected item 1896 for i in range(len(items)): 1897 if items[i] == str(name): 1898 self.formfactorbox.SetSelection(i) 1899 break 1900 break 1901 else: 1902 ## Select the model from the menu 1903 class_name = model.__class__ 1904 name = model.name 1905 self.formfactorbox.Clear() 1906 items = self.formfactorbox.GetItems() 1907 1908 for k, list in self.model_list_box.iteritems(): 1909 if k in["P(Q)*S(Q)", "Shapes"] and \ 1910 class_name in self.model_list_box["Shapes"]: 1911 if class_name in self.model_list_box["P(Q)*S(Q)"]: 1912 self.structurebox.Show() 1913 self.text2.Show() 1914 self.structurebox.Enable() 1915 self.structurebox.SetSelection(0) 1916 self.text2.Enable() 1917 else: 1918 self.structurebox.Hide() 1919 self.text2.Hide() 1920 self.structurebox.Disable() 1921 self.structurebox.SetSelection(0) 1922 self.text2.Disable() 1923 1924 self.shape_rbutton.SetValue(True) 1925 ## fill the form factor list with new model 1926 self._populate_box(self.formfactorbox, 1927 self.model_list_box["Shapes"]) 1928 items = self.formfactorbox.GetItems() 1929 ## set comboxbox to the selected item 1930 for i in range(len(items)): 1931 if items[i] == str(name): 1932 self.formfactorbox.SetSelection(i) 1933 break 1934 return 1935 elif k == "Shape-Independent": 1936 self.shape_indep_rbutton.SetValue(True) 1937 elif k == "Structure Factors": 1938 self.struct_rbutton.SetValue(True) 1939 elif k == "Multi-Functions": 1940 continue 1941 else: 1942 self.plugin_rbutton.SetValue(True) 1943 if class_name in list: 1944 self.structurebox.SetSelection(0) 1945 self.structurebox.Disable() 1946 self.text2.Disable() 1947 ## fill the form factor list with new model 1948 self._populate_box(self.formfactorbox, list) 1949 items = self.formfactorbox.GetItems() 1950 ## set comboxbox to the selected item 1951 for i in range(len(items)): 1952 if items[i] == str(name): 1953 self.formfactorbox.SetSelection(i) 1954 break 1955 break 1985 # for i in range(len(items)): 1986 # if items[i] == str(name): 1987 # self.formfactorbox.SetSelection(i) 1988 # break 1989 # break 1956 1990 1957 1991 def _draw_model(self, update_chisqr=True, source='model'):
Note: See TracChangeset
for help on using the changeset viewer.