Changeset 116e1a7 in sasview for src/sans/perspectives
- Timestamp:
- Apr 26, 2014 6:34:08 PM (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:
- 99d2aeb
- Parents:
- 6d7b5dd7
- Location:
- src/sans/perspectives/fitting
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sans/perspectives/fitting/basepage.py
r27b7acc r116e1a7 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'): -
src/sans/perspectives/fitting/models.py
r201af9f r116e1a7 47 47 48 48 """ 49 #Check i sthe plugin is of type Model1DPlugin49 #Check if the plugin is of type Model1DPlugin 50 50 if not issubclass(model, Model1DPlugin): 51 51 msg = "Plugin %s must be of type Model1DPlugin \n" % str(name) … … 243 243 ## external dict for models 244 244 model_combobox = ModelList() 245 ## Dictionary of form models245 ## Dictionary of form factor models 246 246 form_factor_dict = {} 247 ## dictionary of other247 ## dictionary of structure factor models 248 248 struct_factor_dict = {} 249 ##list of form factors250 shape_list = []251 ## independent shape model list252 shape_indep_list = []249 ##list of shape models -- this is superseded by categories 250 # shape_list = [] 251 ## shape independent model list-- this is superseded by categories 252 # shape_indep_list = [] 253 253 ##list of structure factors 254 254 struct_list = [] 255 ##list of model allowing multiplication 255 ##list of model allowing multiplication by a structure factor 256 256 multiplication_factor = [] 257 ##list of multifunctional shapes 257 ##list of multifunctional shapes (i.e. that have user defined number of levels 258 258 multi_func_list = [] 259 ## list of added models 259 ## list of added models -- currently python models found in the plugin dir. 260 260 plugins = [] 261 261 ## Event owner (guiframe) … … 290 290 """ 291 291 292 ## NOTE: as of April 26, 2014, as part of first pass on fixing categories, 293 ## all the appends to shape_list or shape_independent_list are 294 ## commented out. They should be possible to remove. They are in 295 ## fact a "category" of model whereas the other list are actually 296 ## "attributes" of a model. In other words is it a structure factor 297 ## that can be used against a form factor, is it a form factor that is 298 ## knows how to be multiplied by a structure factor, does it have user 299 ## defined number of parameters, etc. 300 ## 301 ## We hope this whole list will be superseded by the new C models 302 ## structure where each model will provide a method to interrogate it 303 ## about its "attributes" -- then this long list becomes a loop reading 304 ## each model in the category list to populate the "attribute"lists. 305 ## We should also refactor the whole category vs attribute list 306 ## structure when doing this as now the attribute lists think they are 307 ## also category lists. 308 ## 309 ## -PDB April 26, 2014 292 310 293 311 # regular model names only … … 295 313 from sans.models.SphereModel import SphereModel 296 314 self.model_dictionary[SphereModel.__name__] = SphereModel 297 self.shape_list.append(SphereModel)315 # self.shape_list.append(SphereModel) 298 316 self.multiplication_factor.append(SphereModel) 299 317 self.model_name_list.append(SphereModel.__name__) … … 301 319 from sans.models.BinaryHSModel import BinaryHSModel 302 320 self.model_dictionary[BinaryHSModel.__name__] = BinaryHSModel 303 self.shape_list.append(BinaryHSModel)321 # self.shape_list.append(BinaryHSModel) 304 322 self.model_name_list.append(BinaryHSModel.__name__) 305 323 306 324 from sans.models.FuzzySphereModel import FuzzySphereModel 307 325 self.model_dictionary[FuzzySphereModel.__name__] = FuzzySphereModel 308 self.shape_list.append(FuzzySphereModel)326 # self.shape_list.append(FuzzySphereModel) 309 327 self.multiplication_factor.append(FuzzySphereModel) 310 328 self.model_name_list.append(FuzzySphereModel.__name__) … … 312 330 from sans.models.RaspBerryModel import RaspBerryModel 313 331 self.model_dictionary[RaspBerryModel.__name__] = RaspBerryModel 314 self.shape_list.append(RaspBerryModel)332 # self.shape_list.append(RaspBerryModel) 315 333 self.model_name_list.append(RaspBerryModel.__name__) 316 334 317 335 from sans.models.CoreShellModel import CoreShellModel 318 336 self.model_dictionary[CoreShellModel.__name__] = CoreShellModel 319 self.shape_list.append(CoreShellModel)337 # self.shape_list.append(CoreShellModel) 320 338 self.multiplication_factor.append(CoreShellModel) 321 339 self.model_name_list.append(CoreShellModel.__name__) … … 323 341 from sans.models.Core2ndMomentModel import Core2ndMomentModel 324 342 self.model_dictionary[Core2ndMomentModel.__name__] = Core2ndMomentModel 325 self.shape_list.append(Core2ndMomentModel)343 # self.shape_list.append(Core2ndMomentModel) 326 344 self.model_name_list.append(Core2ndMomentModel.__name__) 327 345 328 346 from sans.models.CoreMultiShellModel import CoreMultiShellModel 329 347 self.model_dictionary[CoreMultiShellModel.__name__] = CoreMultiShellModel 330 self.shape_list.append(CoreMultiShellModel)348 # self.shape_list.append(CoreMultiShellModel) 331 349 self.multiplication_factor.append(CoreMultiShellModel) 332 350 self.multi_func_list.append(CoreMultiShellModel) … … 334 352 from sans.models.VesicleModel import VesicleModel 335 353 self.model_dictionary[VesicleModel.__name__] = VesicleModel 336 self.shape_list.append(VesicleModel)354 # self.shape_list.append(VesicleModel) 337 355 self.multiplication_factor.append(VesicleModel) 338 356 self.model_name_list.append(VesicleModel.__name__) … … 340 358 from sans.models.MultiShellModel import MultiShellModel 341 359 self.model_dictionary[MultiShellModel.__name__] = MultiShellModel 342 self.shape_list.append(MultiShellModel)360 # self.shape_list.append(MultiShellModel) 343 361 self.multiplication_factor.append(MultiShellModel) 344 362 self.model_name_list.append(MultiShellModel.__name__) … … 346 364 from sans.models.OnionExpShellModel import OnionExpShellModel 347 365 self.model_dictionary[OnionExpShellModel.__name__] = OnionExpShellModel 348 self.shape_list.append(OnionExpShellModel)366 # self.shape_list.append(OnionExpShellModel) 349 367 self.multiplication_factor.append(OnionExpShellModel) 350 368 self.multi_func_list.append(OnionExpShellModel) … … 352 370 from sans.models.SphericalSLDModel import SphericalSLDModel 353 371 self.model_dictionary[SphericalSLDModel.__name__] = SphericalSLDModel 354 self.shape_list.append(SphericalSLDModel)372 # self.shape_list.append(SphericalSLDModel) 355 373 self.multiplication_factor.append(SphericalSLDModel) 356 374 self.multi_func_list.append(SphericalSLDModel) … … 359 377 from sans.models.LinearPearlsModel import LinearPearlsModel 360 378 self.model_dictionary[LinearPearlsModel.__name__] = LinearPearlsModel 361 self.shape_list.append(LinearPearlsModel)379 # self.shape_list.append(LinearPearlsModel) 362 380 self.model_name_list.append(LinearPearlsModel.__name__) 363 381 364 382 from sans.models.PearlNecklaceModel import PearlNecklaceModel 365 383 self.model_dictionary[PearlNecklaceModel.__name__] = PearlNecklaceModel 366 self.shape_list.append(PearlNecklaceModel)384 # self.shape_list.append(PearlNecklaceModel) 367 385 self.model_name_list.append(PearlNecklaceModel.__name__) 368 386 #self.multiplication_factor.append(PearlNecklaceModel) … … 370 388 from sans.models.CylinderModel import CylinderModel 371 389 self.model_dictionary[CylinderModel.__name__] = CylinderModel 372 self.shape_list.append(CylinderModel)390 # self.shape_list.append(CylinderModel) 373 391 self.multiplication_factor.append(CylinderModel) 374 392 self.model_name_list.append(CylinderModel.__name__) … … 376 394 from sans.models.CoreShellCylinderModel import CoreShellCylinderModel 377 395 self.model_dictionary[CoreShellCylinderModel.__name__] = CoreShellCylinderModel 378 self.shape_list.append(CoreShellCylinderModel)396 # self.shape_list.append(CoreShellCylinderModel) 379 397 self.multiplication_factor.append(CoreShellCylinderModel) 380 398 self.model_name_list.append(CoreShellCylinderModel.__name__) … … 382 400 from sans.models.CoreShellBicelleModel import CoreShellBicelleModel 383 401 self.model_dictionary[CoreShellBicelleModel.__name__] = CoreShellBicelleModel 384 self.shape_list.append(CoreShellBicelleModel)402 # self.shape_list.append(CoreShellBicelleModel) 385 403 self.multiplication_factor.append(CoreShellBicelleModel) 386 404 self.model_name_list.append(CoreShellBicelleModel.__name__) … … 388 406 from sans.models.HollowCylinderModel import HollowCylinderModel 389 407 self.model_dictionary[HollowCylinderModel.__name__] = HollowCylinderModel 390 self.shape_list.append(HollowCylinderModel)408 # self.shape_list.append(HollowCylinderModel) 391 409 self.multiplication_factor.append(HollowCylinderModel) 392 410 self.model_name_list.append(HollowCylinderModel.__name__) … … 394 412 from sans.models.FlexibleCylinderModel import FlexibleCylinderModel 395 413 self.model_dictionary[FlexibleCylinderModel.__name__] = FlexibleCylinderModel 396 self.shape_list.append(FlexibleCylinderModel)414 # self.shape_list.append(FlexibleCylinderModel) 397 415 self.model_name_list.append(FlexibleCylinderModel.__name__) 398 416 399 417 from sans.models.FlexCylEllipXModel import FlexCylEllipXModel 400 418 self.model_dictionary[FlexCylEllipXModel.__name__] = FlexCylEllipXModel 401 self.shape_list.append(FlexCylEllipXModel)419 # self.shape_list.append(FlexCylEllipXModel) 402 420 self.model_name_list.append(FlexCylEllipXModel.__name__) 403 421 404 422 from sans.models.StackedDisksModel import StackedDisksModel 405 423 self.model_dictionary[StackedDisksModel.__name__] = StackedDisksModel 406 self.shape_list.append(StackedDisksModel)424 # self.shape_list.append(StackedDisksModel) 407 425 self.multiplication_factor.append(StackedDisksModel) 408 426 self.model_name_list.append(StackedDisksModel.__name__) … … 410 428 from sans.models.ParallelepipedModel import ParallelepipedModel 411 429 self.model_dictionary[ParallelepipedModel.__name__] = ParallelepipedModel 412 self.shape_list.append(ParallelepipedModel)430 # self.shape_list.append(ParallelepipedModel) 413 431 self.multiplication_factor.append(ParallelepipedModel) 414 432 self.model_name_list.append(ParallelepipedModel.__name__) … … 416 434 from sans.models.CSParallelepipedModel import CSParallelepipedModel 417 435 self.model_dictionary[CSParallelepipedModel.__name__] = CSParallelepipedModel 418 self.shape_list.append(CSParallelepipedModel)436 # self.shape_list.append(CSParallelepipedModel) 419 437 self.multiplication_factor.append(CSParallelepipedModel) 420 438 self.model_name_list.append(CSParallelepipedModel.__name__) … … 422 440 from sans.models.EllipticalCylinderModel import EllipticalCylinderModel 423 441 self.model_dictionary[EllipticalCylinderModel.__name__] = EllipticalCylinderModel 424 self.shape_list.append(EllipticalCylinderModel)442 # self.shape_list.append(EllipticalCylinderModel) 425 443 self.multiplication_factor.append(EllipticalCylinderModel) 426 444 self.model_name_list.append(EllipticalCylinderModel.__name__) … … 428 446 from sans.models.BarBellModel import BarBellModel 429 447 self.model_dictionary[BarBellModel.__name__] = BarBellModel 430 self.shape_list.append(BarBellModel)448 # self.shape_list.append(BarBellModel) 431 449 self.model_name_list.append(BarBellModel.__name__) 432 450 # not implemeted yet! … … 435 453 from sans.models.CappedCylinderModel import CappedCylinderModel 436 454 self.model_dictionary[CappedCylinderModel.__name__] = CappedCylinderModel 437 self.shape_list.append(CappedCylinderModel)455 # self.shape_list.append(CappedCylinderModel) 438 456 self.model_name_list.append(CappedCylinderModel.__name__) 439 457 # not implemeted yet! … … 442 460 from sans.models.EllipsoidModel import EllipsoidModel 443 461 self.model_dictionary[EllipsoidModel.__name__] = EllipsoidModel 444 self.shape_list.append(EllipsoidModel)462 # self.shape_list.append(EllipsoidModel) 445 463 self.multiplication_factor.append(EllipsoidModel) 446 464 self.model_name_list.append(EllipsoidModel.__name__) … … 448 466 from sans.models.CoreShellEllipsoidModel import CoreShellEllipsoidModel 449 467 self.model_dictionary[CoreShellEllipsoidModel.__name__] = CoreShellEllipsoidModel 450 self.shape_list.append(CoreShellEllipsoidModel)468 # self.shape_list.append(CoreShellEllipsoidModel) 451 469 self.multiplication_factor.append(CoreShellEllipsoidModel) 452 470 self.model_name_list.append(CoreShellEllipsoidModel.__name__) … … 454 472 from sans.models.TriaxialEllipsoidModel import TriaxialEllipsoidModel 455 473 self.model_dictionary[TriaxialEllipsoidModel.__name__] = TriaxialEllipsoidModel 456 self.shape_list.append(TriaxialEllipsoidModel)474 # self.shape_list.append(TriaxialEllipsoidModel) 457 475 self.multiplication_factor.append(TriaxialEllipsoidModel) 458 476 self.model_name_list.append(TriaxialEllipsoidModel.__name__) … … 460 478 from sans.models.LamellarModel import LamellarModel 461 479 self.model_dictionary[LamellarModel.__name__] = LamellarModel 462 self.shape_list.append(LamellarModel)480 # self.shape_list.append(LamellarModel) 463 481 self.model_name_list.append(LamellarModel.__name__) 464 482 465 483 from sans.models.LamellarFFHGModel import LamellarFFHGModel 466 484 self.model_dictionary[LamellarFFHGModel.__name__] = LamellarFFHGModel 467 self.shape_list.append(LamellarFFHGModel)485 # self.shape_list.append(LamellarFFHGModel) 468 486 self.model_name_list.append(LamellarFFHGModel.__name__) 469 487 470 488 from sans.models.LamellarPSModel import LamellarPSModel 471 489 self.model_dictionary[LamellarPSModel.__name__] = LamellarPSModel 472 self.shape_list.append(LamellarPSModel)490 # self.shape_list.append(LamellarPSModel) 473 491 self.model_name_list.append(LamellarPSModel.__name__) 474 492 475 493 from sans.models.LamellarPSHGModel import LamellarPSHGModel 476 494 self.model_dictionary[LamellarPSHGModel.__name__] = LamellarPSHGModel 477 self.shape_list.append(LamellarPSHGModel)495 # self.shape_list.append(LamellarPSHGModel) 478 496 self.model_name_list.append(LamellarPSHGModel.__name__) 479 497 480 498 from sans.models.LamellarPCrystalModel import LamellarPCrystalModel 481 499 self.model_dictionary[LamellarPCrystalModel.__name__] = LamellarPCrystalModel 482 self.shape_list.append(LamellarPCrystalModel)500 # self.shape_list.append(LamellarPCrystalModel) 483 501 self.model_name_list.append(LamellarPCrystalModel.__name__) 484 502 485 503 from sans.models.SCCrystalModel import SCCrystalModel 486 504 self.model_dictionary[SCCrystalModel.__name__] = SCCrystalModel 487 self.shape_list.append(SCCrystalModel)505 # self.shape_list.append(SCCrystalModel) 488 506 self.model_name_list.append(SCCrystalModel.__name__) 489 507 490 508 from sans.models.FCCrystalModel import FCCrystalModel 491 509 self.model_dictionary[FCCrystalModel.__name__] = FCCrystalModel 492 self.shape_list.append(FCCrystalModel)510 # self.shape_list.append(FCCrystalModel) 493 511 self.model_name_list.append(FCCrystalModel.__name__) 494 512 495 513 from sans.models.BCCrystalModel import BCCrystalModel 496 514 self.model_dictionary[BCCrystalModel.__name__] = BCCrystalModel 497 self.shape_list.append(BCCrystalModel)515 # self.shape_list.append(BCCrystalModel) 498 516 self.model_name_list.append(BCCrystalModel.__name__) 499 517 … … 523 541 from sans.models.PowerLawAbsModel import PowerLawAbsModel 524 542 self.model_dictionary[PowerLawAbsModel.__name__] = PowerLawAbsModel 525 self.shape_indep_list.append(PowerLawAbsModel)543 # self.shape_indep_list.append(PowerLawAbsModel) 526 544 self.model_name_list.append(PowerLawAbsModel.__name__) 527 545 528 546 from sans.models.BEPolyelectrolyte import BEPolyelectrolyte 529 547 self.model_dictionary[BEPolyelectrolyte.__name__] = BEPolyelectrolyte 530 self.shape_indep_list.append(BEPolyelectrolyte)548 # self.shape_indep_list.append(BEPolyelectrolyte) 531 549 self.model_name_list.append(BEPolyelectrolyte.__name__) 532 550 self.form_factor_dict[str(wx.NewId())] = [SphereModel] … … 534 552 from sans.models.BroadPeakModel import BroadPeakModel 535 553 self.model_dictionary[BroadPeakModel.__name__] = BroadPeakModel 536 self.shape_indep_list.append(BroadPeakModel)554 # self.shape_indep_list.append(BroadPeakModel) 537 555 self.model_name_list.append(BroadPeakModel.__name__) 538 556 539 557 from sans.models.CorrLengthModel import CorrLengthModel 540 558 self.model_dictionary[CorrLengthModel.__name__] = CorrLengthModel 541 self.shape_indep_list.append(CorrLengthModel)559 # self.shape_indep_list.append(CorrLengthModel) 542 560 self.model_name_list.append(CorrLengthModel.__name__) 543 561 544 562 from sans.models.DABModel import DABModel 545 563 self.model_dictionary[DABModel.__name__] = DABModel 546 self.shape_indep_list.append(DABModel)564 # self.shape_indep_list.append(DABModel) 547 565 self.model_name_list.append(DABModel.__name__) 548 566 549 567 from sans.models.DebyeModel import DebyeModel 550 568 self.model_dictionary[DebyeModel.__name__] = DebyeModel 551 self.shape_indep_list.append(DebyeModel)569 # self.shape_indep_list.append(DebyeModel) 552 570 self.model_name_list.append(DebyeModel.__name__) 553 571 554 572 from sans.models.FractalModel import FractalModel 555 573 self.model_dictionary[FractalModel.__name__] = FractalModel 556 self.shape_indep_list.append(FractalModel)574 # self.shape_indep_list.append(FractalModel) 557 575 self.model_name_list.append(FractalModel.__name__) 558 576 559 577 from sans.models.FractalCoreShellModel import FractalCoreShellModel 560 578 self.model_dictionary[FractalCoreShellModel.__name__] = FractalCoreShellModel 561 self.shape_indep_list.append(FractalCoreShellModel)579 # self.shape_indep_list.append(FractalCoreShellModel) 562 580 self.model_name_list.append(FractalCoreShellModel.__name__) 563 581 564 582 from sans.models.GaussLorentzGelModel import GaussLorentzGelModel 565 583 self.model_dictionary[GaussLorentzGelModel.__name__] = GaussLorentzGelModel 566 self.shape_indep_list.append(GaussLorentzGelModel)584 # self.shape_indep_list.append(GaussLorentzGelModel) 567 585 self.model_name_list.append(GaussLorentzGelModel.__name__) 568 586 569 587 from sans.models.GuinierModel import GuinierModel 570 588 self.model_dictionary[GuinierModel.__name__] = GuinierModel 571 self.shape_indep_list.append(GuinierModel)589 # self.shape_indep_list.append(GuinierModel) 572 590 self.model_name_list.append(GuinierModel.__name__) 573 591 574 592 from sans.models.GuinierPorodModel import GuinierPorodModel 575 593 self.model_dictionary[GuinierPorodModel.__name__] = GuinierPorodModel 576 self.shape_indep_list.append(GuinierPorodModel)594 # self.shape_indep_list.append(GuinierPorodModel) 577 595 self.model_name_list.append(GuinierPorodModel.__name__) 578 596 579 597 from sans.models.LorentzModel import LorentzModel 580 598 self.model_dictionary[LorentzModel.__name__] = LorentzModel 581 self.shape_indep_list.append(LorentzModel)599 # self.shape_indep_list.append(LorentzModel) 582 600 self.model_name_list.append(LorentzModel.__name__) 583 601 584 602 from sans.models.MassFractalModel import MassFractalModel 585 603 self.model_dictionary[MassFractalModel.__name__] = MassFractalModel 586 self.shape_indep_list.append(MassFractalModel)604 # self.shape_indep_list.append(MassFractalModel) 587 605 self.model_name_list.append(MassFractalModel.__name__) 588 606 589 607 from sans.models.MassSurfaceFractal import MassSurfaceFractal 590 608 self.model_dictionary[MassSurfaceFractal.__name__] = MassSurfaceFractal 591 self.shape_indep_list.append(MassSurfaceFractal)609 # self.shape_indep_list.append(MassSurfaceFractal) 592 610 self.model_name_list.append(MassSurfaceFractal.__name__) 593 611 594 612 from sans.models.PeakGaussModel import PeakGaussModel 595 613 self.model_dictionary[PeakGaussModel.__name__] = PeakGaussModel 596 self.shape_indep_list.append(PeakGaussModel)614 # self.shape_indep_list.append(PeakGaussModel) 597 615 self.model_name_list.append(PeakGaussModel.__name__) 598 616 599 617 from sans.models.PeakLorentzModel import PeakLorentzModel 600 618 self.model_dictionary[PeakLorentzModel.__name__] = PeakLorentzModel 601 self.shape_indep_list.append(PeakLorentzModel)619 # self.shape_indep_list.append(PeakLorentzModel) 602 620 self.model_name_list.append(PeakLorentzModel.__name__) 603 621 604 622 from sans.models.Poly_GaussCoil import Poly_GaussCoil 605 623 self.model_dictionary[Poly_GaussCoil.__name__] = Poly_GaussCoil 606 self.shape_indep_list.append(Poly_GaussCoil)624 # self.shape_indep_list.append(Poly_GaussCoil) 607 625 self.model_name_list.append(Poly_GaussCoil.__name__) 608 626 609 627 from sans.models.PolymerExclVolume import PolymerExclVolume 610 628 self.model_dictionary[PolymerExclVolume.__name__] = PolymerExclVolume 611 self.shape_indep_list.append(PolymerExclVolume)629 # self.shape_indep_list.append(PolymerExclVolume) 612 630 self.model_name_list.append(PolymerExclVolume.__name__) 613 631 614 632 from sans.models.PorodModel import PorodModel 615 633 self.model_dictionary[PorodModel.__name__] = PorodModel 616 self.shape_indep_list.append(PorodModel)634 # self.shape_indep_list.append(PorodModel) 617 635 self.model_name_list.append(PorodModel.__name__) 618 636 619 637 from sans.models.RPA10Model import RPA10Model 620 638 self.model_dictionary[RPA10Model.__name__] = RPA10Model 621 self.shape_indep_list.append(RPA10Model)639 # self.shape_indep_list.append(RPA10Model) 622 640 self.multi_func_list.append(RPA10Model) 623 641 624 642 from sans.models.StarPolymer import StarPolymer 625 643 self.model_dictionary[StarPolymer.__name__] = StarPolymer 626 self.shape_indep_list.append(StarPolymer)644 # self.shape_indep_list.append(StarPolymer) 627 645 self.model_name_list.append(StarPolymer.__name__) 628 646 629 647 from sans.models.SurfaceFractalModel import SurfaceFractalModel 630 648 self.model_dictionary[SurfaceFractalModel.__name__] = SurfaceFractalModel 631 self.shape_indep_list.append(SurfaceFractalModel)649 # self.shape_indep_list.append(SurfaceFractalModel) 632 650 self.model_name_list.append(SurfaceFractalModel.__name__) 633 651 634 652 from sans.models.TeubnerStreyModel import TeubnerStreyModel 635 653 self.model_dictionary[TeubnerStreyModel.__name__] = TeubnerStreyModel 636 self.shape_indep_list.append(TeubnerStreyModel)654 # self.shape_indep_list.append(TeubnerStreyModel) 637 655 self.model_name_list.append(TeubnerStreyModel.__name__) 638 656 639 657 from sans.models.TwoLorentzianModel import TwoLorentzianModel 640 658 self.model_dictionary[TwoLorentzianModel.__name__] = TwoLorentzianModel 641 self.shape_indep_list.append(TwoLorentzianModel)659 # self.shape_indep_list.append(TwoLorentzianModel) 642 660 self.model_name_list.append(TwoLorentzianModel.__name__) 643 661 644 662 from sans.models.TwoPowerLawModel import TwoPowerLawModel 645 663 self.model_dictionary[TwoPowerLawModel.__name__] = TwoPowerLawModel 646 self.shape_indep_list.append(TwoPowerLawModel)664 # self.shape_indep_list.append(TwoPowerLawModel) 647 665 self.model_name_list.append(TwoPowerLawModel.__name__) 648 666 649 667 from sans.models.UnifiedPowerRgModel import UnifiedPowerRgModel 650 668 self.model_dictionary[UnifiedPowerRgModel.__name__] = UnifiedPowerRgModel 651 self.shape_indep_list.append(UnifiedPowerRgModel)669 # self.shape_indep_list.append(UnifiedPowerRgModel) 652 670 self.multi_func_list.append(UnifiedPowerRgModel) 653 671 654 672 from sans.models.LineModel import LineModel 655 673 self.model_dictionary[LineModel.__name__] = LineModel 656 self.shape_indep_list.append(LineModel)674 # self.shape_indep_list.append(LineModel) 657 675 self.model_name_list.append(LineModel.__name__) 658 676 659 677 from sans.models.ReflectivityModel import ReflectivityModel 660 678 self.model_dictionary[ReflectivityModel.__name__] = ReflectivityModel 661 self.shape_indep_list.append(ReflectivityModel)679 # self.shape_indep_list.append(ReflectivityModel) 662 680 self.multi_func_list.append(ReflectivityModel) 663 681 664 682 from sans.models.ReflectivityIIModel import ReflectivityIIModel 665 683 self.model_dictionary[ReflectivityIIModel.__name__] = ReflectivityIIModel 666 self.shape_indep_list.append(ReflectivityIIModel)684 # self.shape_indep_list.append(ReflectivityIIModel) 667 685 self.multi_func_list.append(ReflectivityIIModel) 668 686 669 687 from sans.models.GelFitModel import GelFitModel 670 688 self.model_dictionary[GelFitModel.__name__] = GelFitModel 671 self.shape_indep_list.append(GelFitModel)689 # self.shape_indep_list.append(GelFitModel) 672 690 self.model_name_list.append(GelFitModel.__name__) 673 691 674 692 from sans.models.PringlesModel import PringlesModel 675 693 self.model_dictionary[PringlesModel.__name__] = PringlesModel 676 self.shape_indep_list.append(PringlesModel)694 # self.shape_indep_list.append(PringlesModel) 677 695 self.model_name_list.append(PringlesModel.__name__) 678 696 679 697 from sans.models.RectangularPrismModel import RectangularPrismModel 680 698 self.model_dictionary[RectangularPrismModel.__name__] = RectangularPrismModel 681 self.shape_list.append(RectangularPrismModel)699 # self.shape_list.append(RectangularPrismModel) 682 700 self.multiplication_factor.append(RectangularPrismModel) 683 701 self.model_name_list.append(RectangularPrismModel.__name__) … … 685 703 from sans.models.RectangularHollowPrismInfThinWallsModel import RectangularHollowPrismInfThinWallsModel 686 704 self.model_dictionary[RectangularHollowPrismInfThinWallsModel.__name__] = RectangularHollowPrismInfThinWallsModel 687 self.shape_list.append(RectangularHollowPrismInfThinWallsModel)705 # self.shape_list.append(RectangularHollowPrismInfThinWallsModel) 688 706 self.multiplication_factor.append(RectangularHollowPrismInfThinWallsModel) 689 707 self.model_name_list.append(RectangularHollowPrismInfThinWallsModel.__name__) … … 691 709 from sans.models.RectangularHollowPrismModel import RectangularHollowPrismModel 692 710 self.model_dictionary[RectangularHollowPrismModel.__name__] = RectangularHollowPrismModel 693 self.shape_list.append(RectangularHollowPrismModel)711 # self.shape_list.append(RectangularHollowPrismModel) 694 712 self.multiplication_factor.append(RectangularHollowPrismModel) 695 713 self.model_name_list.append(RectangularHollowPrismModel.__name__) … … 761 779 return self.model_combobox.get_list() 762 780 763 def populate_menu(self, modelmenu, event_owner): 764 """ 765 Populate a menu with our models 766 767 :param id: first menu event ID to use when binding the menu events 768 :param modelmenu: wx.Menu object to populate 769 :param event_owner: wx object to bind the menu events to 770 771 :return: the next free event ID following the new menu events 772 773 """ 781 ## I believe the next four methods are for the old form factor GUI 782 ## where the dropdown showed a list of categories which then rolled out 783 ## in a second dropdown to the side. Some testing shows they indeed no longer 784 ## seem to be called. If no problems are found during testing of release we 785 ## can remove this huge chunck of stuff. 786 ## 787 ## -PDB April 26, 2014 788 789 # def populate_menu(self, modelmenu, event_owner): 790 # """ 791 # Populate a menu with our models 792 # 793 # :param id: first menu event ID to use when binding the menu events 794 # :param modelmenu: wx.Menu object to populate 795 # :param event_owner: wx object to bind the menu events to 796 # 797 # :return: the next free event ID following the new menu events 798 # 799 # """ 800 # 774 801 ## Fill model lists 775 self._getModelList()802 # self._getModelList() 776 803 ## store reference to model menu of guiframe 777 self.modelmenu = modelmenu804 # self.modelmenu = modelmenu 778 805 ## guiframe reference 779 self.event_owner = event_owner780 781 shape_submenu = wx.Menu()782 shape_indep_submenu = wx.Menu()783 structure_factor = wx.Menu()784 added_models = wx.Menu()785 multip_models = wx.Menu()806 # self.event_owner = event_owner 807 808 # shape_submenu = wx.Menu() 809 # shape_indep_submenu = wx.Menu() 810 # structure_factor = wx.Menu() 811 # added_models = wx.Menu() 812 # multip_models = wx.Menu() 786 813 ## create menu with shape 787 self._fill_simple_menu(menuinfo=["Shapes", 788 shape_submenu, 789 " simple shape"], 790 list1=self.shape_list) 791 792 self._fill_simple_menu(menuinfo=["Shape-Independent", 793 shape_indep_submenu, 794 "List of shape-independent models"], 795 list1=self.shape_indep_list) 796 797 self._fill_simple_menu(menuinfo=["Structure Factors", 798 structure_factor, 799 "List of Structure factors models"], 800 list1=self.struct_list) 801 802 self._fill_plugin_menu(menuinfo=["Customized Models", added_models, 803 "List of additional models"], 804 list1=self.plugins) 805 806 self._fill_menu(menuinfo=["P(Q)*S(Q)", multip_models, 807 "mulplication of 2 models"], 808 list1=self.multiplication_factor, 809 list2=self.struct_list) 810 return 0 811 812 def _fill_plugin_menu(self, menuinfo, list1): 813 """ 814 fill the plugin menu with costumized models 815 """ 816 if len(list1) == 0: 817 id = wx.NewId() 818 msg = "No model available check plugins.log for errors to fix problem" 819 menuinfo[1].Append(int(id), "Empty", msg) 820 self._fill_simple_menu(menuinfo, list1) 821 822 def _fill_simple_menu(self, menuinfo, list1): 823 """ 824 Fill the menu with list item 825 826 :param modelmenu: the menu to fill 827 :param menuinfo: submenu item for the first column of this modelmenu 828 with info.Should be a list : 829 [name(string) , menu(wx.menu), help(string)] 830 :param list1: contains item (form factor )to fill modelmenu second column 831 832 """ 833 if len(list1) > 0: 834 self.model_combobox.set_list(menuinfo[0], list1) 814 # self._fill_simple_menu(menuinfo=["Shapes", 815 # shape_submenu, 816 # " simple shape"], 817 # list1=self.shape_list) 818 819 # self._fill_simple_menu(menuinfo=["Shape-Independent", 820 # shape_indep_submenu, 821 # "List of shape-independent models"], 822 # list1=self.shape_indep_list) 823 824 # self._fill_simple_menu(menuinfo=["Structure Factors", 825 # structure_factor, 826 # "List of Structure factors models"], 827 # list1=self.struct_list) 828 829 # self._fill_plugin_menu(menuinfo=["Customized Models", added_models, 830 # "List of additional models"], 831 # list1=self.plugins) 832 833 # self._fill_menu(menuinfo=["P(Q)*S(Q)", multip_models, 834 # "mulplication of 2 models"], 835 # list1=self.multiplication_factor, 836 # list2=self.struct_list) 837 # return 0 838 839 # def _fill_plugin_menu(self, menuinfo, list1): 840 # """ 841 # fill the plugin menu with costumized models 842 # """ 843 # print ("got to fill plugin menu") 844 # if len(list1) == 0: 845 # id = wx.NewId() 846 # msg = "No model available check plugins.log for errors to fix problem" 847 # menuinfo[1].Append(int(id), "Empty", msg) 848 # self._fill_simple_menu(menuinfo, list1) 849 850 # def _fill_simple_menu(self, menuinfo, list1): 851 # """ 852 # Fill the menu with list item 853 # 854 # :param modelmenu: the menu to fill 855 # :param menuinfo: submenu item for the first column of this modelmenu 856 # with info.Should be a list : 857 # [name(string) , menu(wx.menu), help(string)] 858 # :param list1: contains item (form factor )to fill modelmenu second column 859 # 860 # """ 861 # if len(list1) > 0: 862 # self.model_combobox.set_list(menuinfo[0], list1) 835 863 836 for item in list1:837 try:838 id = wx.NewId()839 struct_factor = item()840 struct_name = struct_factor.__class__.__name__841 if hasattr(struct_factor, "name"):842 struct_name = struct_factor.name843 844 menuinfo[1].Append(int(id), struct_name, struct_name)845 if not item in self.struct_factor_dict.itervalues():846 self.struct_factor_dict[str(id)] = item847 wx.EVT_MENU(self.event_owner, int(id), self._on_model)848 except:849 msg = "Error Occured: %s" % sys.exc_value850 wx.PostEvent(self.event_owner, StatusEvent(status=msg))851 852 id = wx.NewId()853 self.modelmenu.AppendMenu(id, menuinfo[0], menuinfo[1], menuinfo[2])854 855 def _fill_menu(self, menuinfo, list1, list2):856 """857 Fill the menu with list item858 859 :param menuinfo: submenu item for the first column of this modelmenu860 with info.Should be a list :861 [name(string) , menu(wx.menu), help(string)]862 :param list1: contains item (form factor )to fill modelmenu second column863 :param list2: contains item (Structure factor )to fill modelmenu864 third column865 866 """867 if len(list1) > 0:868 self.model_combobox.set_list(menuinfo[0], list1)869 870 for item in list1:871 form_factor = item()872 form_name = form_factor.__class__.__name__873 if hasattr(form_factor, "name"):874 form_name = form_factor.name875 ### store form factor to return to other users876 newmenu = wx.Menu()877 if len(list2) > 0:878 for model in list2:879 id = wx.NewId()880 struct_factor = model()881 name = struct_factor.__class__.__name__882 if hasattr(struct_factor, "name"):883 name = struct_factor.name884 newmenu.Append(id, name, name)885 wx.EVT_MENU(self.event_owner, int(id), self._on_model)886 ## save form_fact and struct_fact887 self.form_factor_dict[int(id)] = [form_factor,888 struct_factor]889 890 form_id = wx.NewId()891 menuinfo[1].AppendMenu(int(form_id), form_name,892 newmenu, menuinfo[2])893 id = wx.NewId()894 self.modelmenu.AppendMenu(id, menuinfo[0], menuinfo[1], menuinfo[2])864 # for item in list1: 865 # try: 866 # id = wx.NewId() 867 # struct_factor = item() 868 # struct_name = struct_factor.__class__.__name__ 869 # if hasattr(struct_factor, "name"): 870 # struct_name = struct_factor.name 871 # 872 # menuinfo[1].Append(int(id), struct_name, struct_name) 873 # if not item in self.struct_factor_dict.itervalues(): 874 # self.struct_factor_dict[str(id)] = item 875 # wx.EVT_MENU(self.event_owner, int(id), self._on_model) 876 # except: 877 # msg = "Error Occured: %s" % sys.exc_value 878 # wx.PostEvent(self.event_owner, StatusEvent(status=msg)) 879 # 880 # id = wx.NewId() 881 # self.modelmenu.AppendMenu(id, menuinfo[0], menuinfo[1], menuinfo[2]) 882 # 883 # def _fill_menu(self, menuinfo, list1, list2): 884 # """ 885 # Fill the menu with list item 886 # 887 # :param menuinfo: submenu item for the first column of this modelmenu 888 # with info.Should be a list : 889 # [name(string) , menu(wx.menu), help(string)] 890 # :param list1: contains item (form factor )to fill modelmenu second column 891 # :param list2: contains item (Structure factor )to fill modelmenu 892 # third column 893 # 894 # """ 895 # if len(list1) > 0: 896 # self.model_combobox.set_list(menuinfo[0], list1) 897 # 898 # for item in list1: 899 # form_factor = item() 900 # form_name = form_factor.__class__.__name__ 901 # if hasattr(form_factor, "name"): 902 # form_name = form_factor.name 903 # ### store form factor to return to other users 904 # newmenu = wx.Menu() 905 # if len(list2) > 0: 906 # for model in list2: 907 # id = wx.NewId() 908 # struct_factor = model() 909 # name = struct_factor.__class__.__name__ 910 # if hasattr(struct_factor, "name"): 911 # name = struct_factor.name 912 # newmenu.Append(id, name, name) 913 # wx.EVT_MENU(self.event_owner, int(id), self._on_model) 914 # ## save form_fact and struct_fact 915 # self.form_factor_dict[int(id)] = [form_factor, 916 # struct_factor] 917 # 918 # form_id = wx.NewId() 919 # menuinfo[1].AppendMenu(int(form_id), form_name, 920 # newmenu, menuinfo[2]) 921 # id = wx.NewId() 922 # self.modelmenu.AppendMenu(id, menuinfo[0], menuinfo[1], menuinfo[2]) 895 923 896 924 def _on_model(self, evt): … … 932 960 933 961 """ 934 self.model_combobox.set_list("Shapes", self.shape_list) 935 self.model_combobox.set_list("Shape-Independent", 936 self.shape_indep_list) 962 ## Model_list now only contains attribute lists not category list. 963 ## Eventually this should be in one master list -- read in category 964 ## list then pull those models that exist and get attributes then add 965 ## to list ..and if model does not exist remove from list as now 966 ## and update json file. 967 ## 968 ## -PDB April 26, 2014 969 970 # self.model_combobox.set_list("Shapes", self.shape_list) 971 # self.model_combobox.set_list("Shape-Independent", 972 # self.shape_indep_list) 937 973 self.model_combobox.set_list("Structure Factors", self.struct_list) 938 974 self.model_combobox.set_list("Customized Models", self.plugins)
Note: See TracChangeset
for help on using the changeset viewer.