Changeset 5bf0331 in sasview for src/sans/perspectives/fitting
- Timestamp:
- May 5, 2014 9:21:47 AM (10 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. - Location:
- src/sans/perspectives/fitting
- Files:
-
- 5 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'): -
src/sans/perspectives/fitting/fitproblem.py
r5777106 r5bf0331 454 454 return self.itervalues() 455 455 456 def 456 def set_result(self, result, fid): 457 457 """ 458 458 """ -
src/sans/perspectives/fitting/fitting.py
r6fe5100 r5bf0331 136 136 self.page_finder[page_id] = FitProblemDictionary() 137 137 138 def delete_fit_problem(self, page_id):138 def _DEAD_delete_fit_problem(self, page_id): 139 139 """ 140 140 Given an ID create a fitproblem container -
src/sans/perspectives/fitting/models.py
r201af9f r02cc1ea 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__) 471 472 from sans.models.CoreShellEllipsoidXTModel import CoreShellEllipsoidXTModel 473 self.model_dictionary[CoreShellEllipsoidXTModel.__name__] = CoreShellEllipsoidXTModel 474 # self.shape_list.append(CoreShellEllipsoidXTModel) 475 self.multiplication_factor.append(CoreShellEllipsoidXTModel) 476 self.model_name_list.append(CoreShellEllipsoidXTModel.__name__) 453 477 454 478 from sans.models.TriaxialEllipsoidModel import TriaxialEllipsoidModel 455 479 self.model_dictionary[TriaxialEllipsoidModel.__name__] = TriaxialEllipsoidModel 456 self.shape_list.append(TriaxialEllipsoidModel)480 # self.shape_list.append(TriaxialEllipsoidModel) 457 481 self.multiplication_factor.append(TriaxialEllipsoidModel) 458 482 self.model_name_list.append(TriaxialEllipsoidModel.__name__) … … 460 484 from sans.models.LamellarModel import LamellarModel 461 485 self.model_dictionary[LamellarModel.__name__] = LamellarModel 462 self.shape_list.append(LamellarModel)486 # self.shape_list.append(LamellarModel) 463 487 self.model_name_list.append(LamellarModel.__name__) 464 488 465 489 from sans.models.LamellarFFHGModel import LamellarFFHGModel 466 490 self.model_dictionary[LamellarFFHGModel.__name__] = LamellarFFHGModel 467 self.shape_list.append(LamellarFFHGModel)491 # self.shape_list.append(LamellarFFHGModel) 468 492 self.model_name_list.append(LamellarFFHGModel.__name__) 469 493 470 494 from sans.models.LamellarPSModel import LamellarPSModel 471 495 self.model_dictionary[LamellarPSModel.__name__] = LamellarPSModel 472 self.shape_list.append(LamellarPSModel)496 # self.shape_list.append(LamellarPSModel) 473 497 self.model_name_list.append(LamellarPSModel.__name__) 474 498 475 499 from sans.models.LamellarPSHGModel import LamellarPSHGModel 476 500 self.model_dictionary[LamellarPSHGModel.__name__] = LamellarPSHGModel 477 self.shape_list.append(LamellarPSHGModel)501 # self.shape_list.append(LamellarPSHGModel) 478 502 self.model_name_list.append(LamellarPSHGModel.__name__) 479 503 480 504 from sans.models.LamellarPCrystalModel import LamellarPCrystalModel 481 505 self.model_dictionary[LamellarPCrystalModel.__name__] = LamellarPCrystalModel 482 self.shape_list.append(LamellarPCrystalModel)506 # self.shape_list.append(LamellarPCrystalModel) 483 507 self.model_name_list.append(LamellarPCrystalModel.__name__) 484 508 485 509 from sans.models.SCCrystalModel import SCCrystalModel 486 510 self.model_dictionary[SCCrystalModel.__name__] = SCCrystalModel 487 self.shape_list.append(SCCrystalModel)511 # self.shape_list.append(SCCrystalModel) 488 512 self.model_name_list.append(SCCrystalModel.__name__) 489 513 490 514 from sans.models.FCCrystalModel import FCCrystalModel 491 515 self.model_dictionary[FCCrystalModel.__name__] = FCCrystalModel 492 self.shape_list.append(FCCrystalModel)516 # self.shape_list.append(FCCrystalModel) 493 517 self.model_name_list.append(FCCrystalModel.__name__) 494 518 495 519 from sans.models.BCCrystalModel import BCCrystalModel 496 520 self.model_dictionary[BCCrystalModel.__name__] = BCCrystalModel 497 self.shape_list.append(BCCrystalModel)521 # self.shape_list.append(BCCrystalModel) 498 522 self.model_name_list.append(BCCrystalModel.__name__) 499 523 … … 523 547 from sans.models.PowerLawAbsModel import PowerLawAbsModel 524 548 self.model_dictionary[PowerLawAbsModel.__name__] = PowerLawAbsModel 525 self.shape_indep_list.append(PowerLawAbsModel)549 # self.shape_indep_list.append(PowerLawAbsModel) 526 550 self.model_name_list.append(PowerLawAbsModel.__name__) 527 551 528 552 from sans.models.BEPolyelectrolyte import BEPolyelectrolyte 529 553 self.model_dictionary[BEPolyelectrolyte.__name__] = BEPolyelectrolyte 530 self.shape_indep_list.append(BEPolyelectrolyte)554 # self.shape_indep_list.append(BEPolyelectrolyte) 531 555 self.model_name_list.append(BEPolyelectrolyte.__name__) 532 556 self.form_factor_dict[str(wx.NewId())] = [SphereModel] … … 534 558 from sans.models.BroadPeakModel import BroadPeakModel 535 559 self.model_dictionary[BroadPeakModel.__name__] = BroadPeakModel 536 self.shape_indep_list.append(BroadPeakModel)560 # self.shape_indep_list.append(BroadPeakModel) 537 561 self.model_name_list.append(BroadPeakModel.__name__) 538 562 539 563 from sans.models.CorrLengthModel import CorrLengthModel 540 564 self.model_dictionary[CorrLengthModel.__name__] = CorrLengthModel 541 self.shape_indep_list.append(CorrLengthModel)565 # self.shape_indep_list.append(CorrLengthModel) 542 566 self.model_name_list.append(CorrLengthModel.__name__) 543 567 544 568 from sans.models.DABModel import DABModel 545 569 self.model_dictionary[DABModel.__name__] = DABModel 546 self.shape_indep_list.append(DABModel)570 # self.shape_indep_list.append(DABModel) 547 571 self.model_name_list.append(DABModel.__name__) 548 572 549 573 from sans.models.DebyeModel import DebyeModel 550 574 self.model_dictionary[DebyeModel.__name__] = DebyeModel 551 self.shape_indep_list.append(DebyeModel)575 # self.shape_indep_list.append(DebyeModel) 552 576 self.model_name_list.append(DebyeModel.__name__) 553 577 554 578 from sans.models.FractalModel import FractalModel 555 579 self.model_dictionary[FractalModel.__name__] = FractalModel 556 self.shape_indep_list.append(FractalModel)580 # self.shape_indep_list.append(FractalModel) 557 581 self.model_name_list.append(FractalModel.__name__) 558 582 559 583 from sans.models.FractalCoreShellModel import FractalCoreShellModel 560 584 self.model_dictionary[FractalCoreShellModel.__name__] = FractalCoreShellModel 561 self.shape_indep_list.append(FractalCoreShellModel)585 # self.shape_indep_list.append(FractalCoreShellModel) 562 586 self.model_name_list.append(FractalCoreShellModel.__name__) 563 587 564 588 from sans.models.GaussLorentzGelModel import GaussLorentzGelModel 565 589 self.model_dictionary[GaussLorentzGelModel.__name__] = GaussLorentzGelModel 566 self.shape_indep_list.append(GaussLorentzGelModel)590 # self.shape_indep_list.append(GaussLorentzGelModel) 567 591 self.model_name_list.append(GaussLorentzGelModel.__name__) 568 592 569 593 from sans.models.GuinierModel import GuinierModel 570 594 self.model_dictionary[GuinierModel.__name__] = GuinierModel 571 self.shape_indep_list.append(GuinierModel)595 # self.shape_indep_list.append(GuinierModel) 572 596 self.model_name_list.append(GuinierModel.__name__) 573 597 574 598 from sans.models.GuinierPorodModel import GuinierPorodModel 575 599 self.model_dictionary[GuinierPorodModel.__name__] = GuinierPorodModel 576 self.shape_indep_list.append(GuinierPorodModel)600 # self.shape_indep_list.append(GuinierPorodModel) 577 601 self.model_name_list.append(GuinierPorodModel.__name__) 578 602 579 603 from sans.models.LorentzModel import LorentzModel 580 604 self.model_dictionary[LorentzModel.__name__] = LorentzModel 581 self.shape_indep_list.append(LorentzModel)605 # self.shape_indep_list.append(LorentzModel) 582 606 self.model_name_list.append(LorentzModel.__name__) 583 607 584 608 from sans.models.MassFractalModel import MassFractalModel 585 609 self.model_dictionary[MassFractalModel.__name__] = MassFractalModel 586 self.shape_indep_list.append(MassFractalModel)610 # self.shape_indep_list.append(MassFractalModel) 587 611 self.model_name_list.append(MassFractalModel.__name__) 588 612 589 613 from sans.models.MassSurfaceFractal import MassSurfaceFractal 590 614 self.model_dictionary[MassSurfaceFractal.__name__] = MassSurfaceFractal 591 self.shape_indep_list.append(MassSurfaceFractal)615 # self.shape_indep_list.append(MassSurfaceFractal) 592 616 self.model_name_list.append(MassSurfaceFractal.__name__) 593 617 594 618 from sans.models.PeakGaussModel import PeakGaussModel 595 619 self.model_dictionary[PeakGaussModel.__name__] = PeakGaussModel 596 self.shape_indep_list.append(PeakGaussModel)620 # self.shape_indep_list.append(PeakGaussModel) 597 621 self.model_name_list.append(PeakGaussModel.__name__) 598 622 599 623 from sans.models.PeakLorentzModel import PeakLorentzModel 600 624 self.model_dictionary[PeakLorentzModel.__name__] = PeakLorentzModel 601 self.shape_indep_list.append(PeakLorentzModel)625 # self.shape_indep_list.append(PeakLorentzModel) 602 626 self.model_name_list.append(PeakLorentzModel.__name__) 603 627 604 628 from sans.models.Poly_GaussCoil import Poly_GaussCoil 605 629 self.model_dictionary[Poly_GaussCoil.__name__] = Poly_GaussCoil 606 self.shape_indep_list.append(Poly_GaussCoil)630 # self.shape_indep_list.append(Poly_GaussCoil) 607 631 self.model_name_list.append(Poly_GaussCoil.__name__) 608 632 609 633 from sans.models.PolymerExclVolume import PolymerExclVolume 610 634 self.model_dictionary[PolymerExclVolume.__name__] = PolymerExclVolume 611 self.shape_indep_list.append(PolymerExclVolume)635 # self.shape_indep_list.append(PolymerExclVolume) 612 636 self.model_name_list.append(PolymerExclVolume.__name__) 613 637 614 638 from sans.models.PorodModel import PorodModel 615 639 self.model_dictionary[PorodModel.__name__] = PorodModel 616 self.shape_indep_list.append(PorodModel)640 # self.shape_indep_list.append(PorodModel) 617 641 self.model_name_list.append(PorodModel.__name__) 618 642 619 643 from sans.models.RPA10Model import RPA10Model 620 644 self.model_dictionary[RPA10Model.__name__] = RPA10Model 621 self.shape_indep_list.append(RPA10Model)645 # self.shape_indep_list.append(RPA10Model) 622 646 self.multi_func_list.append(RPA10Model) 623 647 624 648 from sans.models.StarPolymer import StarPolymer 625 649 self.model_dictionary[StarPolymer.__name__] = StarPolymer 626 self.shape_indep_list.append(StarPolymer)650 # self.shape_indep_list.append(StarPolymer) 627 651 self.model_name_list.append(StarPolymer.__name__) 628 652 629 653 from sans.models.SurfaceFractalModel import SurfaceFractalModel 630 654 self.model_dictionary[SurfaceFractalModel.__name__] = SurfaceFractalModel 631 self.shape_indep_list.append(SurfaceFractalModel)655 # self.shape_indep_list.append(SurfaceFractalModel) 632 656 self.model_name_list.append(SurfaceFractalModel.__name__) 633 657 634 658 from sans.models.TeubnerStreyModel import TeubnerStreyModel 635 659 self.model_dictionary[TeubnerStreyModel.__name__] = TeubnerStreyModel 636 self.shape_indep_list.append(TeubnerStreyModel)660 # self.shape_indep_list.append(TeubnerStreyModel) 637 661 self.model_name_list.append(TeubnerStreyModel.__name__) 638 662 639 663 from sans.models.TwoLorentzianModel import TwoLorentzianModel 640 664 self.model_dictionary[TwoLorentzianModel.__name__] = TwoLorentzianModel 641 self.shape_indep_list.append(TwoLorentzianModel)665 # self.shape_indep_list.append(TwoLorentzianModel) 642 666 self.model_name_list.append(TwoLorentzianModel.__name__) 643 667 644 668 from sans.models.TwoPowerLawModel import TwoPowerLawModel 645 669 self.model_dictionary[TwoPowerLawModel.__name__] = TwoPowerLawModel 646 self.shape_indep_list.append(TwoPowerLawModel)670 # self.shape_indep_list.append(TwoPowerLawModel) 647 671 self.model_name_list.append(TwoPowerLawModel.__name__) 648 672 649 673 from sans.models.UnifiedPowerRgModel import UnifiedPowerRgModel 650 674 self.model_dictionary[UnifiedPowerRgModel.__name__] = UnifiedPowerRgModel 651 self.shape_indep_list.append(UnifiedPowerRgModel)675 # self.shape_indep_list.append(UnifiedPowerRgModel) 652 676 self.multi_func_list.append(UnifiedPowerRgModel) 653 677 654 678 from sans.models.LineModel import LineModel 655 679 self.model_dictionary[LineModel.__name__] = LineModel 656 self.shape_indep_list.append(LineModel)680 # self.shape_indep_list.append(LineModel) 657 681 self.model_name_list.append(LineModel.__name__) 658 682 659 683 from sans.models.ReflectivityModel import ReflectivityModel 660 684 self.model_dictionary[ReflectivityModel.__name__] = ReflectivityModel 661 self.shape_indep_list.append(ReflectivityModel)685 # self.shape_indep_list.append(ReflectivityModel) 662 686 self.multi_func_list.append(ReflectivityModel) 663 687 664 688 from sans.models.ReflectivityIIModel import ReflectivityIIModel 665 689 self.model_dictionary[ReflectivityIIModel.__name__] = ReflectivityIIModel 666 self.shape_indep_list.append(ReflectivityIIModel)690 # self.shape_indep_list.append(ReflectivityIIModel) 667 691 self.multi_func_list.append(ReflectivityIIModel) 668 692 669 693 from sans.models.GelFitModel import GelFitModel 670 694 self.model_dictionary[GelFitModel.__name__] = GelFitModel 671 self.shape_indep_list.append(GelFitModel)695 # self.shape_indep_list.append(GelFitModel) 672 696 self.model_name_list.append(GelFitModel.__name__) 673 697 674 698 from sans.models.PringlesModel import PringlesModel 675 699 self.model_dictionary[PringlesModel.__name__] = PringlesModel 676 self.shape_indep_list.append(PringlesModel)700 # self.shape_indep_list.append(PringlesModel) 677 701 self.model_name_list.append(PringlesModel.__name__) 678 702 679 703 from sans.models.RectangularPrismModel import RectangularPrismModel 680 704 self.model_dictionary[RectangularPrismModel.__name__] = RectangularPrismModel 681 self.shape_list.append(RectangularPrismModel)705 # self.shape_list.append(RectangularPrismModel) 682 706 self.multiplication_factor.append(RectangularPrismModel) 683 707 self.model_name_list.append(RectangularPrismModel.__name__) … … 685 709 from sans.models.RectangularHollowPrismInfThinWallsModel import RectangularHollowPrismInfThinWallsModel 686 710 self.model_dictionary[RectangularHollowPrismInfThinWallsModel.__name__] = RectangularHollowPrismInfThinWallsModel 687 self.shape_list.append(RectangularHollowPrismInfThinWallsModel)711 # self.shape_list.append(RectangularHollowPrismInfThinWallsModel) 688 712 self.multiplication_factor.append(RectangularHollowPrismInfThinWallsModel) 689 713 self.model_name_list.append(RectangularHollowPrismInfThinWallsModel.__name__) … … 691 715 from sans.models.RectangularHollowPrismModel import RectangularHollowPrismModel 692 716 self.model_dictionary[RectangularHollowPrismModel.__name__] = RectangularHollowPrismModel 693 self.shape_list.append(RectangularHollowPrismModel)717 # self.shape_list.append(RectangularHollowPrismModel) 694 718 self.multiplication_factor.append(RectangularHollowPrismModel) 695 719 self.model_name_list.append(RectangularHollowPrismModel.__name__) … … 761 785 return self.model_combobox.get_list() 762 786 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 """ 787 ## I believe the next four methods are for the old form factor GUI 788 ## where the dropdown showed a list of categories which then rolled out 789 ## in a second dropdown to the side. Some testing shows they indeed no longer 790 ## seem to be called. If no problems are found during testing of release we 791 ## can remove this huge chunck of stuff. 792 ## 793 ## -PDB April 26, 2014 794 795 # def populate_menu(self, modelmenu, event_owner): 796 # """ 797 # Populate a menu with our models 798 # 799 # :param id: first menu event ID to use when binding the menu events 800 # :param modelmenu: wx.Menu object to populate 801 # :param event_owner: wx object to bind the menu events to 802 # 803 # :return: the next free event ID following the new menu events 804 # 805 # """ 806 # 774 807 ## Fill model lists 775 self._getModelList()808 # self._getModelList() 776 809 ## store reference to model menu of guiframe 777 self.modelmenu = modelmenu810 # self.modelmenu = modelmenu 778 811 ## 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()812 # self.event_owner = event_owner 813 814 # shape_submenu = wx.Menu() 815 # shape_indep_submenu = wx.Menu() 816 # structure_factor = wx.Menu() 817 # added_models = wx.Menu() 818 # multip_models = wx.Menu() 786 819 ## 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) 820 # self._fill_simple_menu(menuinfo=["Shapes", 821 # shape_submenu, 822 # " simple shape"], 823 # list1=self.shape_list) 824 825 # self._fill_simple_menu(menuinfo=["Shape-Independent", 826 # shape_indep_submenu, 827 # "List of shape-independent models"], 828 # list1=self.shape_indep_list) 829 830 # self._fill_simple_menu(menuinfo=["Structure Factors", 831 # structure_factor, 832 # "List of Structure factors models"], 833 # list1=self.struct_list) 834 835 # self._fill_plugin_menu(menuinfo=["Customized Models", added_models, 836 # "List of additional models"], 837 # list1=self.plugins) 838 839 # self._fill_menu(menuinfo=["P(Q)*S(Q)", multip_models, 840 # "mulplication of 2 models"], 841 # list1=self.multiplication_factor, 842 # list2=self.struct_list) 843 # return 0 844 845 # def _fill_plugin_menu(self, menuinfo, list1): 846 # """ 847 # fill the plugin menu with costumized models 848 # """ 849 # print ("got to fill plugin menu") 850 # if len(list1) == 0: 851 # id = wx.NewId() 852 # msg = "No model available check plugins.log for errors to fix problem" 853 # menuinfo[1].Append(int(id), "Empty", msg) 854 # self._fill_simple_menu(menuinfo, list1) 855 856 # def _fill_simple_menu(self, menuinfo, list1): 857 # """ 858 # Fill the menu with list item 859 # 860 # :param modelmenu: the menu to fill 861 # :param menuinfo: submenu item for the first column of this modelmenu 862 # with info.Should be a list : 863 # [name(string) , menu(wx.menu), help(string)] 864 # :param list1: contains item (form factor )to fill modelmenu second column 865 # 866 # """ 867 # if len(list1) > 0: 868 # self.model_combobox.set_list(menuinfo[0], list1) 835 869 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])870 # for item in list1: 871 # try: 872 # id = wx.NewId() 873 # struct_factor = item() 874 # struct_name = struct_factor.__class__.__name__ 875 # if hasattr(struct_factor, "name"): 876 # struct_name = struct_factor.name 877 # 878 # menuinfo[1].Append(int(id), struct_name, struct_name) 879 # if not item in self.struct_factor_dict.itervalues(): 880 # self.struct_factor_dict[str(id)] = item 881 # wx.EVT_MENU(self.event_owner, int(id), self._on_model) 882 # except: 883 # msg = "Error Occured: %s" % sys.exc_value 884 # wx.PostEvent(self.event_owner, StatusEvent(status=msg)) 885 # 886 # id = wx.NewId() 887 # self.modelmenu.AppendMenu(id, menuinfo[0], menuinfo[1], menuinfo[2]) 888 # 889 # def _fill_menu(self, menuinfo, list1, list2): 890 # """ 891 # Fill the menu with list item 892 # 893 # :param menuinfo: submenu item for the first column of this modelmenu 894 # with info.Should be a list : 895 # [name(string) , menu(wx.menu), help(string)] 896 # :param list1: contains item (form factor )to fill modelmenu second column 897 # :param list2: contains item (Structure factor )to fill modelmenu 898 # third column 899 # 900 # """ 901 # if len(list1) > 0: 902 # self.model_combobox.set_list(menuinfo[0], list1) 903 # 904 # for item in list1: 905 # form_factor = item() 906 # form_name = form_factor.__class__.__name__ 907 # if hasattr(form_factor, "name"): 908 # form_name = form_factor.name 909 # ### store form factor to return to other users 910 # newmenu = wx.Menu() 911 # if len(list2) > 0: 912 # for model in list2: 913 # id = wx.NewId() 914 # struct_factor = model() 915 # name = struct_factor.__class__.__name__ 916 # if hasattr(struct_factor, "name"): 917 # name = struct_factor.name 918 # newmenu.Append(id, name, name) 919 # wx.EVT_MENU(self.event_owner, int(id), self._on_model) 920 # ## save form_fact and struct_fact 921 # self.form_factor_dict[int(id)] = [form_factor, 922 # struct_factor] 923 # 924 # form_id = wx.NewId() 925 # menuinfo[1].AppendMenu(int(form_id), form_name, 926 # newmenu, menuinfo[2]) 927 # id = wx.NewId() 928 # self.modelmenu.AppendMenu(id, menuinfo[0], menuinfo[1], menuinfo[2]) 895 929 896 930 def _on_model(self, evt): … … 932 966 933 967 """ 934 self.model_combobox.set_list("Shapes", self.shape_list) 935 self.model_combobox.set_list("Shape-Independent", 936 self.shape_indep_list) 968 ## Model_list now only contains attribute lists not category list. 969 ## Eventually this should be in one master list -- read in category 970 ## list then pull those models that exist and get attributes then add 971 ## to list ..and if model does not exist remove from list as now 972 ## and update json file. 973 ## 974 ## -PDB April 26, 2014 975 976 # self.model_combobox.set_list("Shapes", self.shape_list) 977 # self.model_combobox.set_list("Shape-Independent", 978 # self.shape_indep_list) 937 979 self.model_combobox.set_list("Structure Factors", self.struct_list) 938 980 self.model_combobox.set_list("Customized Models", self.plugins) -
src/sans/perspectives/fitting/console.py
r5777106 r85f17f6 5 5 import time 6 6 import wx 7 import park 8 from park.fitresult import FitHandler 7 from sans.fit import FitHandler 9 8 10 9 class ConsoleUpdate(FitHandler): … … 88 87 Print result object 89 88 """ 90 msg = " \n %s \n" % s elf.result.__str__()89 msg = " \n %s \n" % str(self.result) 91 90 wx.PostEvent(self.parent, StatusEvent(status=msg)) 92 91 … … 137 136 self.fit_duration += self.elapsed_time 138 137 str_time = time.strftime("%a, %d %b %Y %H:%M:%S ", time.localtime(t1)) 139 UPDATE_INTERVAL = 0.5138 UPDATE_INTERVAL = 5.0 140 139 u_flag = False 141 140 if self.fit_duration >= UPDATE_INTERVAL: … … 172 171 type="progress")) 173 172 174 def starting_fit(self):173 def _DEAD_starting_fit(self): 175 174 """ 176 175 """
Note: See TracChangeset
for help on using the changeset viewer.