Changeset ea5fa58 in sasview
- Timestamp:
- Sep 20, 2012 1:22:02 PM (12 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:
- bda809e
- Parents:
- b71a53b
- Files:
-
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
calculatorview/src/sans/perspectives/calculator/model_editor.py
r8d0ec40 rea5fa58 785 785 msg = "Successful!!!" 786 786 msg += " " + self._notes 787 msg += " Please look for it in the 'Customized Models' box."787 msg += " Please look for it in the Customized Models." 788 788 info = 'Info' 789 789 color = 'blue' -
fittingview/src/sans/perspectives/fitting/basepage.py
rdf7a7e3 rea5fa58 2 2 Base Page for fitting 3 3 """ 4 5 4 import sys 6 5 import os … … 27 26 from sans.perspectives.fitting.pagestate import PageState 28 27 from sans.guiframe.CategoryInstaller import CategoryInstaller 29 30 31 28 32 29 (PageInfoEvent, EVT_PAGE_INFO) = wx.lib.newevent.NewEvent() … … 137 134 self.sld_axes = None 138 135 self.multi_factor = None 139 self.model_name = None140 self.model_dict = {}141 136 142 137 self.disp_cb_dict = {} … … 155 150 self.formfactorbox = None 156 151 self.structurebox = None 152 self.categorybox = None 157 153 ##list of model parameters. each item must have same length 158 154 ## each item related to a given parameters … … 170 166 self.disp_list = [] 171 167 self.disp_name = "" 172 173 ## category stuff174 self.category_box = None175 self.model_box = None176 168 177 169 ## list of orientation parameters … … 226 218 ## layout 227 219 self.set_layout() 228 229 230 220 231 221 def set_index_model(self, index): … … 474 464 self.model_list_box = page_info.model_list_box 475 465 ## Data member to store the dispersion object created 476 466 self.populate_box(dict=self.model_list_box) 477 467 478 468 def onContextMenu(self, event): … … 577 567 self.state.manager = manager 578 568 579 def populate_box(self, m_dict):569 def populate_box(self, dict): 580 570 """ 581 571 Store list of model … … 584 574 585 575 """ 586 self.model_list_box = m_dict587 #self.state.model_list_box = self.model_list_box588 #self.initialize_combox()576 self.model_list_box = dict 577 self.state.model_list_box = self.model_list_box 578 self.initialize_combox() 589 579 590 580 def set_model_dictionary(self, model_dict): … … 603 593 if self.model_list_box is None: 604 594 return 595 if len(self.model_list_box) > 0: 596 self._populate_box(self.formfactorbox, 597 self.model_list_box["Shapes"]) 605 598 606 599 if len(self.model_list_box) > 0: … … 901 894 self.state.structurecombobox = self.structurebox.\ 902 895 GetString(s_select) 903 # if self.formfactorbox != None: 904 # f_select = self.formfactorbox.GetSelection() 905 # if f_select > 0: 906 self.state.formfactorcombobox = \ 907 self.model_box.GetStringSelection() 908 896 if self.formfactorbox != None: 897 f_select = self.formfactorbox.GetSelection() 898 if f_select > 0: 899 self.state.formfactorcombobox = self.formfactorbox.\ 900 GetString(f_select) 901 if self.categorybox != None: 902 cb_select = self.categorybox.GetSelection() 903 if cb_select > 0: 904 self.state.categorycombobox = self.categorybox.\ 905 GetString(cb_select) 909 906 #save radiobutton state for model selection 910 # ILL 911 # self.state.shape_rbutton = self.shape_rbutton.GetValue() 912 # self.state.shape_indep_rbutton = self.shape_indep_rbutton.GetValue() 913 # self.state.struct_rbutton = self.struct_rbutton.GetValue() 914 # self.state.plugin_rbutton = self.plugin_rbutton.GetValue() 907 #self.state.shape_rbutton = self.shape_rbutton.GetValue() 908 #self.state.shape_indep_rbutton = self.shape_indep_rbutton.GetValue() 909 #self.state.struct_rbutton = self.struct_rbutton.GetValue() 910 #self.state.plugin_rbutton = self.plugin_rbutton.GetValue() 915 911 916 912 self.state.enable2D = copy.deepcopy(self.enable2D) … … 1061 1057 self.disp_list = state.disp_list 1062 1058 1059 ## set the state of the radio box 1060 #self.shape_rbutton.SetValue(state.shape_rbutton) 1061 #self.shape_indep_rbutton.SetValue(state.shape_indep_rbutton) 1062 #self.struct_rbutton.SetValue(state.struct_rbutton) 1063 #self.plugin_rbutton.SetValue(state.plugin_rbutton) 1064 1065 ## fill model combobox 1063 1066 self._show_combox_helper() 1064 1065 # select the model in the gui 1066 self._regenerate_model_dict() 1067 if(len(self.by_model_dict[state.formfactorcombobox]) == 0): 1068 self.category_box.SetStringSelection('Uncategorized') 1069 self.model_box.SetStringSelection(state.formfactorcombobox) 1070 else: 1071 self.category_box.SetStringSelection(\ 1072 self.by_model_dict[state.formfactorcombobox][0] ) 1073 self.model_box.SetStringSelection(state.formfactorcombobox) 1074 1075 1067 #select the current model 1068 try: 1069 # to support older version 1070 category_pos = int(state.categorycombobox) 1071 except: 1072 category_pos = 0 1073 for ind_cat in range(self.categorybox.GetCount()): 1074 if self.categorycombobox.GetString(ind_form) == \ 1075 state.categorycombobox: 1076 category_pos = int(ind_cat) 1077 break 1078 1079 self.categorybox.Select(category_pos) 1080 try: 1081 # to support older version 1082 formfactor_pos = int(state.formfactorcombobox) 1083 except: 1084 formfactor_pos = 0 1085 for ind_form in range(self.formfactorbox.GetCount()): 1086 if self.formfactorbox.GetString(ind_form) == \ 1087 state.formfactorcombobox: 1088 formfactor_pos = int(ind_form) 1089 break 1090 1091 self.formfactorbox.Select(formfactor_pos) 1092 1076 1093 try: 1077 1094 # to support older version … … 1118 1135 state.disp_cb_dict[item]) 1119 1136 # Create the dispersion objects 1120 from sans.models.dispersion_models \ 1121 import ArrayDispersion 1137 from sans.models.dispersion_models import ArrayDispersion 1122 1138 disp_model = ArrayDispersion() 1123 1139 if hasattr(state, "values") and \ … … 1218 1234 self.disp_list = state.disp_list 1219 1235 1236 ## set the state of the radio box 1237 #self.shape_rbutton.SetValue(state.shape_rbutton) 1238 #self.shape_indep_rbutton.SetValue(state.shape_indep_rbutton) 1239 #self.struct_rbutton.SetValue(state.struct_rbutton) 1240 #self.plugin_rbutton.SetValue(state.plugin_rbutton) 1220 1241 1221 1242 ## fill model combobox 1222 1243 self._show_combox_helper() 1223 1244 #select the current model 1224 1225 1226 self._regenerate_model_dict() 1227 if(len(self.by_model_dict[state.formfactorcombobox]) == 0): 1228 self.category_box.SetStringSelection('Uncategorized') 1229 self.model_box.SetStringSelection(state.formfactorcombobox) 1230 else: 1231 self.category_box.SetStringSelection(\ 1232 self.by_model_dict[state.formfactorcombobox][0] ) 1233 self.model_box.SetStringSelection(state.formfactorcombobox) 1234 1245 try: 1246 # to support older version 1247 category_pos = int(state.categorycombobox) 1248 except: 1249 category_pos = 0 1250 for ind_cat in range(self.categorybox.GetCount()): 1251 if self.categorybox.GetString(ind_cat) == \ 1252 state.categorycombobox: 1253 category_pos = int(ind_cat) 1254 break 1255 1256 self.categorybox.Select(category_pos) 1257 self._show_combox(None) 1258 try: 1259 # to support older version 1260 formfactor_pos = int(state.formfactorcombobox) 1261 except: 1262 formfactor_pos = 0 1263 for ind_form in range(self.formfactorbox.GetCount()): 1264 if self.formfactorbox.GetString(ind_form) == \ 1265 (state.formfactorcombobox): 1266 formfactor_pos = int(ind_form) 1267 break 1268 1269 self.formfactorbox.Select(formfactor_pos) 1270 1235 1271 try: 1236 1272 # to support older version … … 1432 1468 save radiobutton containing the type model that can be selected 1433 1469 """ 1434 # 1435 # 1436 # 1437 # 1470 #self.state.shape_rbutton = self.shape_rbutton.GetValue() 1471 #self.state.shape_indep_rbutton = self.shape_indep_rbutton.GetValue() 1472 #self.state.struct_rbutton = self.struct_rbutton.GetValue() 1473 #self.state.plugin_rbutton = self.plugin_rbutton.GetValue() 1438 1474 self.state.structurecombobox = self.structurebox.GetLabel() 1439 self.state.formfactorcombobox = self.model_box.GetStringSelection() 1475 self.state.formfactorcombobox = self.formfactorbox.GetLabel() 1476 self.state.categorycombobox = self.categorybox.GetLabel() 1440 1477 1441 1478 ## post state to fit panel … … 1772 1809 class_name = model.p_model.__class__ 1773 1810 name = model.p_model.name 1774 #self.formfactorbox.Clear()1811 self.formfactorbox.Clear() 1775 1812 1776 1813 for k, list in self.model_list_box.iteritems(): 1777 1814 if k in["P(Q)*S(Q)", "Shapes"] and \ 1778 1815 class_name in self.model_list_box["Shapes"]: 1779 #self.shape_rbutton.SetValue(True)1816 self.shape_rbutton.SetValue(True) 1780 1817 ## fill the form factor list with new model 1781 #self._populate_box(self.formfactorbox,1782 #self.model_list_box["Shapes"])1783 #items = self.formfactorbox.GetItems()1784 # ## set comboxbox to the selected item1785 #for i in range(len(items)):1786 #if items[i] == str(name):1787 #self.formfactorbox.SetSelection(i)1788 #break1818 self._populate_box(self.formfactorbox, 1819 self.model_list_box["Shapes"]) 1820 items = self.formfactorbox.GetItems() 1821 ## set comboxbox to the selected item 1822 for i in range(len(items)): 1823 if items[i] == str(name): 1824 self.formfactorbox.SetSelection(i) 1825 break 1789 1826 return 1790 #elif k == "Shape-Independent":1791 #self.shape_indep_rbutton.SetValue(True)1792 #elif k == "Structure Factors":1793 #self.struct_rbutton.SetValue(True)1794 #elif k == "Multi-Functions":1795 #continue1796 #else:1797 #self.plugin_rbutton.SetValue(True)1827 elif k == "Shape-Independent": 1828 self.shape_indep_rbutton.SetValue(True) 1829 elif k == "Structure Factors": 1830 self.struct_rbutton.SetValue(True) 1831 elif k == "Multi-Functions": 1832 continue 1833 else: 1834 self.plugin_rbutton.SetValue(True) 1798 1835 1799 #if class_name in list:1800 # ### fill the form factor list with new model1801 # #self._populate_box(self.formfactorbox, list)1802 # #items = self.formfactorbox.GetItems()1803 # ### set comboxbox to the selected item1804 # #for i in range(len(items)):1805 # #if items[i] == str(name):1806 # #self.formfactorbox.SetSelection(i)1807 # #break1808 # #break1809 #else:1836 if class_name in list: 1837 ## fill the form factor list with new model 1838 self._populate_box(self.formfactorbox, list) 1839 items = self.formfactorbox.GetItems() 1840 ## set comboxbox to the selected item 1841 for i in range(len(items)): 1842 if items[i] == str(name): 1843 self.formfactorbox.SetSelection(i) 1844 break 1845 break 1846 else: 1810 1847 ## Select the model from the menu 1811 1848 class_name = model.__class__ 1812 1849 name = model.name 1813 ##self.formfactorbox.Clear()1814 #items = self.formfactorbox.GetItems()1850 self.formfactorbox.Clear() 1851 items = self.formfactorbox.GetItems() 1815 1852 1816 1853 for k, list in self.model_list_box.iteritems(): … … 1830 1867 self.text2.Disable() 1831 1868 1832 #self.shape_rbutton.SetValue(True)1869 self.shape_rbutton.SetValue(True) 1833 1870 ## fill the form factor list with new model 1834 #self._populate_box(self.formfactorbox,1835 #self.model_list_box["Shapes"])1836 #items = self.formfactorbox.GetItems()1837 # ## set comboxbox to the selected item1838 #for i in range(len(items)):1839 #if items[i] == str(name):1840 #self.formfactorbox.SetSelection(i)1841 #break1871 self._populate_box(self.formfactorbox, 1872 self.model_list_box["Shapes"]) 1873 items = self.formfactorbox.GetItems() 1874 ## set comboxbox to the selected item 1875 for i in range(len(items)): 1876 if items[i] == str(name): 1877 self.formfactorbox.SetSelection(i) 1878 break 1842 1879 return 1843 #elif k == "Shape-Independent":1844 #self.shape_indep_rbutton.SetValue(True)1845 #elif k == "Structure Factors":1846 #self.struct_rbutton.SetValue(True)1847 #elif k == "Multi-Functions":1848 #continue1849 #else:1850 #self.plugin_rbutton.SetValue(True)1880 elif k == "Shape-Independent": 1881 self.shape_indep_rbutton.SetValue(True) 1882 elif k == "Structure Factors": 1883 self.struct_rbutton.SetValue(True) 1884 elif k == "Multi-Functions": 1885 continue 1886 else: 1887 self.plugin_rbutton.SetValue(True) 1851 1888 if class_name in list: 1852 1889 self.structurebox.SetSelection(0) … … 1854 1891 self.text2.Disable() 1855 1892 ## fill the form factor list with new model 1856 #self._populate_box(self.formfactorbox, list)1857 #items = self.formfactorbox.GetItems()1893 self._populate_box(self.formfactorbox, list) 1894 items = self.formfactorbox.GetItems() 1858 1895 ## set comboxbox to the selected item 1859 #for i in range(len(items)):1860 #if items[i] == str(name):1861 #self.formfactorbox.SetSelection(i)1862 #break1896 for i in range(len(items)): 1897 if items[i] == str(name): 1898 self.formfactorbox.SetSelection(i) 1899 break 1863 1900 break 1864 1901 … … 1953 1990 if self.multifactorbox.IsShown(): 1954 1991 self.multifactorbox.Hide() 1955 1992 1993 def formfactor_combo_init(self): 1994 """ 1995 First time calls _show_combox_helper 1996 """ 1997 self._show_combox(None) 1998 1956 1999 def _show_combox_helper(self): 1957 2000 """ 1958 2001 Fill panel's combo box according to the type of model selected 1959 2002 """ 1960 # if self.shape_rbutton.GetValue(): 1961 # ##fill the combobox with form factor list 1962 #self.structurebox.SetSelection(0)1963 #self.structurebox.Disable()1964 # #self.formfactorbox.Clear()1965 # # self._populate_box(self.formfactorbox, 1966 # # self.model_list_box["Shapes"]) 1967 # if self.shape_indep_rbutton.GetValue(): 1968 # ##fill the combobox with shape independent factor list 1969 # self.structurebox.SetSelection(0) 1970 # self.structurebox.Disable() 1971 # # self.formfactorbox.Clear() 1972 # self._populate_box(self.formfactorbox, 1973 # self.model_list_box["Shape-Independent"])1974 # if self.struct_rbutton.GetValue():1975 # ##fill the combobox with structure factor list 1976 # self.structurebox.SetSelection(0) 1977 # self.structurebox.Disable()1978 # # self.formfactorbox.Clear() 1979 # self._populate_box(self.formfactorbox, 1980 # self.model_list_box["Structure Factors"]) 1981 # if self.plugin_rbutton.GetValue(): 1982 # ##fill the combobox with form factor list 1983 # self.structurebox.Disable()1984 # # self.formfactorbox.Clear() 1985 # self._populate_box(self.formfactorbox, 1986 # self.model_list_box["Customized Models"])2003 custom_model = 'Customized Models' 2004 mod_cat = self.categorybox.GetStringSelection() 2005 self.structurebox.SetSelection(0) 2006 self.structurebox.Disable() 2007 self.formfactorbox.Clear() 2008 if mod_cat == None: 2009 return 2010 m_list = [] 2011 try: 2012 if mod_cat == custom_model: 2013 for model in self.model_list_box[mod_cat]: 2014 str_m = str(model).split(".")[0] 2015 #self.model_box.Append(str_m) 2016 m_list.append(self.model_dict[str_m]) 2017 else: 2018 for (model, enabled) in self.master_category_dict[mod_cat]: 2019 if enabled: 2020 m_list.append(self.model_dict[model]) 2021 else: 2022 msg = "This model is diabled by Category Manager." 2023 wx.PostEvent(self.parent.parent, 2024 StatusEvent(status=msg, info="error")) 2025 except: 2026 msg = "%s\n" % (sys.exc_value) 2027 wx.PostEvent(self.parent.parent, 2028 StatusEvent(status=msg, info="error")) 2029 self._populate_box(self.formfactorbox, m_list) 1987 2030 1988 2031 def _show_combox(self, event=None): … … 2000 2043 self.Refresh() 2001 2044 2002 def _populate_box(self, combobox, model_list):2045 def _populate_box(self, combobox, list): 2003 2046 """ 2004 2047 fill combox box with dict item … … 2008 2051 """ 2009 2052 mlist = [] 2010 for models in model_list:2053 for models in list: 2011 2054 model = models() 2012 2055 name = model.__class__.__name__ … … 2139 2182 """ 2140 2183 ## reset dictionary containing reference to dispersion 2141 if self.model_name == None:2142 return2143 2144 2184 self._disp_obj_dict = {} 2145 2185 self.disp_cb_dict = {} 2146 2186 self.temp_multi_functional = False 2147 2148 form_factor = self.model_dict[self.model_name] 2187 f_id = self.formfactorbox.GetCurrentSelection() 2188 #For MAC 2189 form_factor = None 2190 if f_id >= 0: 2191 form_factor = self.formfactorbox.GetClientData(f_id) 2149 2192 2150 2193 if not form_factor in self.model_list_box["multiplication"]: … … 2160 2203 self.text2.Enable() 2161 2204 2162 2163 2164 2205 if form_factor != None: 2165 2206 # set multifactor for Mutifunctional models … … 2339 2380 return flag 2340 2381 2341 def _check_value_enter(self, m_list, modified):2342 """ 2343 :param m_list: model parameter and panel info2344 :Note: each item of the m_list should be as follow:2382 def _check_value_enter(self, list, modified): 2383 """ 2384 :param list: model parameter and panel info 2385 :Note: each item of the list should be as follow: 2345 2386 item=[check button state, parameter's name, 2346 2387 paramater's value, string="+/-", … … 2351 2392 """ 2352 2393 is_modified = modified 2353 if len( m_list) == 0:2394 if len(list) == 0: 2354 2395 return is_modified 2355 for item in m_list:2396 for item in list: 2356 2397 #skip angle parameters for 1D 2357 2398 if not self.enable2D: … … 2903 2944 if self.model == None: 2904 2945 name = 'FuncHelp' 2905 2946 else: 2947 name = self.formfactorbox.GetValue() 2906 2948 frame = HelpWindow(None, -1, pageToOpen=model_path) 2907 # If model name exists and model is not a custom model2908 # if frame.rhelp.HasAnchor(name) and not self.plugin_rbutton.GetValue():2909 # frame.Show(True)2910 # frame.rhelp.ScrollToAnchor(name)2911 # else:2912 # if self.model != None:2913 # frame.Destroy()2914 # msg = 'Model description:\n'2915 # if str(self.model.description).rstrip().lstrip() == '':2916 # msg += "Sorry, no information is available for this model."2917 # else:2918 # msg += self.model.description + '\n'2919 # info = "Info"2920 # wx.MessageBox(msg, info)2921 # else:2922 # frame.Show(True) 2923 2949 if frame.rhelp.HasAnchor(name): 2950 frame.Show(True) 2951 frame.rhelp.ScrollToAnchor(name) 2952 else: 2953 if self.model != None: 2954 frame.Destroy() 2955 msg = 'Model description:\n' 2956 if str(self.model.description).rstrip().lstrip() == '': 2957 msg += "Sorry, no information is available for this model." 2958 else: 2959 msg += self.model.description + '\n' 2960 info = "Info" 2961 wx.MessageBox(msg, info) 2962 else: 2963 frame.Show(True) 2964 2965 2924 2966 def on_pd_help_clicked(self, event): 2925 2967 """ … … 3297 3339 return 3298 3340 3341 3342 3343 3299 3344 def _read_category_info(self): 3300 3345 """ … … 3307 3352 self.model_enabled_dict = defaultdict(bool) 3308 3353 3309 categorization_file = CategoryInstaller.get_user_file()3310 3311 3312 3354 try: 3355 categorization_file = CategoryInstaller.get_user_file() 3356 if not os.path.isfile(categorization_file): 3357 categorization_file = CategoryInstaller.get_default_file() 3313 3358 cat_file = open(categorization_file, 'rb') 3314 3359 … … 3317 3362 3318 3363 except IOError: 3364 raise 3319 3365 print 'Problem reading in category file.' 3320 3366 print 'We even looked for it, made sure it was there.' … … 3330 3376 self.by_model_dict = defaultdict(list) 3331 3377 for category in self.master_category_dict: 3332 for (model, enabled) in self.master_category_dict[category]:3378 for (model, enabled) in self.master_category_dict[category]: 3333 3379 self.by_model_dict[model].append(category) 3334 3380 self.model_enabled_dict[model] = enabled … … 3338 3384 fills out the category list box 3339 3385 """ 3386 uncat_str = 'Customized Models' 3340 3387 self._read_category_info() 3341 3388 3342 self.category _box.Clear()3389 self.categorybox.Clear() 3343 3390 cat_list = sorted(self.master_category_dict.keys()) 3344 cat_list.append('Customized') 3345 3391 if not uncat_str in cat_list: 3392 cat_list.append(uncat_str) 3393 3346 3394 for category in cat_list: 3347 3395 if category != '': 3348 self.category _box.Append(category)3349 3350 if self.category _box.GetSelection() == wx.NOT_FOUND:3351 self.category _box.SetSelection(0)3396 self.categorybox.Append(category) 3397 3398 if self.categorybox.GetSelection() == wx.NOT_FOUND: 3399 self.categorybox.SetSelection(0) 3352 3400 else: 3353 self.category _box.SetSelection( \3354 self.category _box.GetSelection())3355 3356 self._on_change_cat(None)3401 self.categorybox.SetSelection( \ 3402 self.categorybox.GetSelection()) 3403 3404 #self._on_change_cat(None) 3357 3405 3358 3406 … … 3362 3410 """ 3363 3411 self.model_name = None 3364 category = self.category _box.GetStringSelection()3412 category = self.categorybox.GetStringSelection() 3365 3413 if category == None: 3366 3414 return 3367 3415 self.model_box.Clear() 3368 3416 3369 if category == 'Customized ':3370 for model in self.model_list_box[ "Customized Models"]:3417 if category == 'Customized Models': 3418 for model in self.model_list_box[category]: 3371 3419 str_m = str(model).split(".")[0] 3372 3420 self.model_box.Append(str_m) … … 3379 3427 self.model_box.Append(model) 3380 3428 3429 3430 3431 3381 3432 def _fill_model_sizer(self, sizer): 3382 3433 """ 3383 3434 fill sizer containing model info 3384 3435 """ 3385 3386 3436 ##Add model function Details button in fitpanel. 3387 3437 ##The following 3 lines are for Mac. Let JHC know before modifying... … … 3391 3441 self.mbox_description = wx.StaticBox(self, -1, str(title)) 3392 3442 boxsizer1 = wx.StaticBoxSizer(self.mbox_description, wx.VERTICAL) 3443 sizer_cat = wx.BoxSizer(wx.HORIZONTAL) 3393 3444 self.mbox_description.SetForegroundColour(wx.RED) 3394 3445 id = wx.NewId() … … 3401 3452 hint = "toggle view of model from 1D to 2D or 2D to 1D" 3402 3453 self.model_view.SetToolTipString(hint) 3403 3404 3405 # ILL mod starts here - Aug 2012 3406 3407 3408 cat_text = wx.StaticText(self, -1, 'Category') 3409 mod_text = wx.StaticText(self, -1, 'Model') 3410 3411 id = wx.NewId() 3412 self.category_box = wx.ListBox(self, size=(150, 100)) 3413 self.category_box.Bind(wx.EVT_LISTBOX, self._on_change_cat) 3414 self.model_box = wx.ListBox(self, -1, size=(150, 100)) 3415 self.model_box.Bind(wx.EVT_LISTBOX, self._on_select_model) 3416 3417 sizer_radiobutton = wx.GridSizer(2, 3, 5, 5) 3418 hbox1 = wx.BoxSizer(wx.HORIZONTAL) 3419 hbox2 = wx.BoxSizer(wx.HORIZONTAL) 3420 vbox1 = wx.BoxSizer(wx.VERTICAL) 3421 vbox2 = wx.BoxSizer(wx.VERTICAL) 3422 vbox3 = wx.BoxSizer(wx.VERTICAL) 3423 3424 vbox1.Add(cat_text, border = 5, flag = wx.EXPAND | wx.ALL) 3425 vbox2.Add(mod_text, border=5, flag = wx.EXPAND | wx.ALL) 3426 vbox3.Add(self.model_view, flag= wx.ALL | wx.ALIGN_LEFT 3427 , border =5) 3428 vbox1.Add(self.category_box, border = 5, flag = wx.EXPAND | wx.ALL) 3429 vbox2.Add(self.model_box, flag = wx.EXPAND | wx.ALL, border = 5) 3430 vbox3.Add(self.model_help, border = 5, 3431 flag = wx.LEFT | wx.ALIGN_LEFT ) 3432 3433 hbox1.Add(vbox1, border = 5, flag = wx.EXPAND | wx.ALL) 3434 hbox1.Add(vbox2, border = 5, flag = wx.EXPAND | wx.ALL) 3435 hbox1.Add(vbox3, border = 5, flag = wx.EXPAND | wx.ALL) 3436 3454 3455 cat_set_box = wx.StaticBox(self, -1, 'Category') 3456 sizer_cat_box = wx.StaticBoxSizer(cat_set_box, wx.HORIZONTAL) 3457 sizer_cat_box.SetMinSize((200, 50)) 3458 self.categorybox = wx.ComboBox(self, -1, style=wx.CB_READONLY) 3459 self._populate_listbox() 3460 wx.EVT_COMBOBOX(self.categorybox, -1, self._show_combox) 3461 #self.shape_rbutton = wx.RadioButton(self, -1, 'Shapes', 3462 # style=wx.RB_GROUP) 3463 #self.shape_indep_rbutton = wx.RadioButton(self, -1, 3464 # "Shape-Independent") 3465 #self.struct_rbutton = wx.RadioButton(self, -1, "Structure Factor ") 3466 #self.plugin_rbutton = wx.RadioButton(self, -1, "Uncategorized") 3467 3468 #self.Bind(wx.EVT_RADIOBUTTON, self._show_combox, 3469 # id=self.shape_rbutton.GetId()) 3470 #self.Bind(wx.EVT_RADIOBUTTON, self._show_combox, 3471 # id=self.shape_indep_rbutton.GetId()) 3472 #self.Bind(wx.EVT_RADIOBUTTON, self._show_combox, 3473 # id=self.struct_rbutton.GetId()) 3474 #self.Bind(wx.EVT_RADIOBUTTON, self._show_combox, 3475 # id=self.plugin_rbutton.GetId()) 3476 #MAC needs SetValue 3477 sizer_cat_box.Add(self.categorybox, 1, wx.LEFT|wx.RIGHT|wx.EXPAND, 2.5) 3478 #self.shape_rbutton.SetValue(True) 3479 3480 sizer_radiobutton = wx.GridSizer(2, 2, 5, 5) 3481 3482 #sizer_radiobutton.Add(self.shape_rbutton) 3483 #sizer_radiobutton.Add(self.shape_indep_rbutton) 3484 sizer_radiobutton.Add((5,5)) 3485 sizer_radiobutton.Add(self.model_view, 1, wx.RIGHT, 15) 3486 #sizer_radiobutton.Add(self.plugin_rbutton) 3487 #sizer_radiobutton.Add(self.struct_rbutton) 3488 sizer_radiobutton.Add((5,5)) 3489 sizer_radiobutton.Add(self.model_help, 1, wx.RIGHT, 15) 3490 sizer_cat.Add(sizer_cat_box, 1, wx.LEFT, 2.5) 3491 sizer_cat.Add(sizer_radiobutton) 3437 3492 sizer_selection = wx.BoxSizer(wx.HORIZONTAL) 3438 3493 mutifactor_selection = wx.BoxSizer(wx.HORIZONTAL) 3439 3494 3440 3495 self.text1 = wx.StaticText(self, -1, "") 3441 self.text2 = wx.StaticText(self, -1, "P(Q)*S(Q) 3496 self.text2 = wx.StaticText(self, -1, "P(Q)*S(Q)") 3442 3497 self.mutifactor_text = wx.StaticText(self, -1, "No. of Shells: ") 3443 3498 self.mutifactor_text1 = wx.StaticText(self, -1, "") … … 3445 3500 self.show_sld_button.Bind(wx.EVT_BUTTON, self._on_show_sld) 3446 3501 3502 self.formfactorbox = wx.ComboBox(self, -1, style=wx.CB_READONLY) 3503 if self.model != None: 3504 self.formfactorbox.SetValue(self.model.name) 3447 3505 self.structurebox = wx.ComboBox(self, -1, style=wx.CB_READONLY) 3448 3506 self.multifactorbox = wx.ComboBox(self, -1, style=wx.CB_READONLY) 3449 3507 self.initialize_combox() 3508 wx.EVT_COMBOBOX(self.formfactorbox, -1, self._on_select_model) 3450 3509 3451 3510 wx.EVT_COMBOBOX(self.structurebox, -1, self._on_select_model) 3452 3511 wx.EVT_COMBOBOX(self.multifactorbox, -1, self._on_select_model) 3453 3512 ## check model type to show sizer 3454 3455 hbox2.Add(self.text2, border = 5, flag = wx.EXPAND | wx.ALL )3456 hbox2.Add(self.structurebox, border = 5, flag = wx.EXPAND | \3457 wx.ALL )3458 3459 3513 if self.model != None: 3460 self._set_model_sizer_selection(self.model) 3461 3462 self._populate_listbox() 3463 3514 print "_set_model_sizer_selection: disabled." 3515 #self._set_model_sizer_selection(self.model) 3516 3517 sizer_selection.Add(self.text1) 3518 sizer_selection.Add((10, 5)) 3519 sizer_selection.Add(self.formfactorbox) 3520 sizer_selection.Add((5, 5)) 3521 sizer_selection.Add(self.text2) 3522 sizer_selection.Add((5, 5)) 3523 sizer_selection.Add(self.structurebox) 3464 3524 3465 mutifactor_selection.Add((1 0, 5))3525 mutifactor_selection.Add((13, 5)) 3466 3526 mutifactor_selection.Add(self.mutifactor_text) 3467 3527 mutifactor_selection.Add(self.multifactorbox) … … 3471 3531 mutifactor_selection.Add(self.show_sld_button) 3472 3532 3473 boxsizer1.Add(hbox1, flag = wx.EXPAND) 3474 boxsizer1.Add(hbox2, flag = wx.EXPAND) 3533 boxsizer1.Add(sizer_cat) 3475 3534 boxsizer1.Add((10, 10)) 3476 3535 boxsizer1.Add(sizer_selection) 3536 boxsizer1.Add((10, 10)) 3477 3537 boxsizer1.Add(mutifactor_selection) 3478 3538 -
fittingview/src/sans/perspectives/fitting/fitpage.py
rdf7a7e3 rea5fa58 36 36 """ 37 37 38 def __init__(self, parent, m_dict,color='rand'):38 def __init__(self, parent, color='rand'): 39 39 """ 40 40 Initialization of the Panel 41 41 """ 42 42 BasicPage.__init__(self, parent, color=color) 43 self.populate_box(m_dict) 44 43 45 44 ## draw sizer 46 45 self._fill_data_sizer() … … 68 67 #create a default data for an empty panel 69 68 self.create_default_data() 70 69 71 70 def enable_fit_button(self): 72 71 """ … … 1088 1087 call back for model selection 1089 1088 """ 1090 # if we're just clearing the box then do nothing1091 if self.model_box.GetCount() == 0 or \1092 self.model_box.GetStringSelection() == '':1093 return1094 1095 1096 1089 self.Show(False) 1097 1090 copy_flag = False 1098 1091 is_poly_enabled = None 1099 1092 if event != None: 1100 # if (event.GetEventObject() == self.formfactorbox\ 1101 # and self.structurebox.GetLabel() != 'None')\ 1102 # or event.GetEventObject() == self.structurebox\ 1103 # or event.GetEventObject() == self.multifactorbox: 1104 copy_flag = self.get_copy_params() 1105 is_poly_enabled = self.enable_disp.GetValue() 1106 1107 self.model_name = self.model_box.GetStringSelection() 1093 if (event.GetEventObject() == self.formfactorbox\ 1094 and self.structurebox.GetLabel() != 'None')\ 1095 or event.GetEventObject() == self.structurebox\ 1096 or event.GetEventObject() == self.multifactorbox: 1097 copy_flag = self.get_copy_params() 1098 is_poly_enabled = self.enable_disp.GetValue() 1099 1108 1100 self._on_select_model_helper() 1109 1101 self.set_model_param_sizer(self.model) … … 1124 1116 1125 1117 self.state.structurecombobox = self.structurebox.GetLabel() 1126 self.state.formfactorcombobox = self. model_box.GetStringSelection()1118 self.state.formfactorcombobox = self.formfactorbox.GetLabel() 1127 1119 self.enable_fit_button() 1128 1120 if self.model != None: … … 1183 1175 wx.PostEvent(self.parent, new_event) 1184 1176 #update list of plugins if new plugin is available 1185 # if self.plugin_rbutton.GetValue(): 1186 # temp = self.parent.update_model_list() 1187 # if temp: 1188 # self.model_list_box = temp 1189 # current_val = self.formfactorbox.GetLabel() 1190 # pos = self.formfactorbox.GetSelection() 1191 # self._show_combox_helper() 1192 # self.formfactorbox.SetSelection(pos) 1193 # self.formfactorbox.SetValue(current_val) 1177 custom_model = 'Customized Models' 1178 mod_cat = self.categorybox.GetStringSelection() 1179 if mod_cat == custom_model: 1180 temp = self.parent.update_model_list() 1181 if temp: 1182 self.model_list_box = temp 1183 current_val = self.formfactorbox.GetLabel() 1184 pos = self.formfactorbox.GetSelection() 1185 self._show_combox_helper() 1186 self.formfactorbox.SetSelection(pos) 1187 self.formfactorbox.SetValue(current_val) 1194 1188 # when select a model only from guictr/button 1195 1189 if is_poly_enabled != None: … … 1822 1816 self.dI_idata.Enable(True) 1823 1817 1824 #self.formfactorbox.Enable()1818 self.formfactorbox.Enable() 1825 1819 self.structurebox.Enable() 1826 1820 data_name = self.data.name -
fittingview/src/sans/perspectives/fitting/fitpanel.py
rdf7a7e3 rea5fa58 48 48 self.menu_mng = models.ModelManager() 49 49 self.model_list_box = self.menu_mng.get_model_list() 50 #pageClosedEvent = nb.EVT_FLATNOTEBOOK_PAGE_CLOSING 50 51 self.model_dictionary = self.menu_mng.get_model_dictionary() 51 #pageClosedEvent = nb.EVT_FLATNOTEBOOK_PAGE_CLOSING52 52 self.pageClosedEvent = wx.aui.EVT_AUINOTEBOOK_PAGE_CLOSE 53 53 … … 305 305 page.set_manager(self._manager) 306 306 307 def set_model_list(self, m_dict):307 def set_model_list(self, dict): 308 308 """ 309 309 copy a dictionary of model into its own dictionary … … 312 312 as value 313 313 """ 314 self.model_list_box = m_dict314 self.model_list_box = dict 315 315 316 316 def set_model_dict(self, m_dict): … … 368 368 else: 369 369 """ 370 371 370 from fitpage import FitPage 372 panel = FitPage(parent=self, m_dict = self.model_list_box) 373 371 panel = FitPage(parent=self) 374 372 if self.batch_on: 375 373 self.batch_page_index += 1 … … 384 382 panel._set_save_flag(not panel.batch_on) 385 383 panel.set_model_dictionary(self.model_dictionary) 384 panel.populate_box(dict=self.model_list_box) 385 panel.formfactor_combo_init() 386 386 panel.set_manager(self._manager) 387 387 panel.window_caption = caption -
fittingview/src/sans/perspectives/fitting/fitting.py
rdf7a7e3 rea5fa58 321 321 Update custom model list in the fitpage combo box 322 322 """ 323 custom_model = 'Customized Models' 323 324 try: 324 325 # Update edit menus … … 332 333 page.model_list_box = temp 333 334 current_val = page.formfactorbox.GetLabel() 334 if page.plugin_rbutton.GetValue(): 335 #if page.plugin_rbutton.GetValue(): 336 mod_cat = page.categorybox.GetStringSelection() 337 if mod_cat == custom_model: 335 338 #pos = page.formfactorbox.GetSelection() 336 339 page._show_combox_helper() -
fittingview/src/sans/perspectives/fitting/models.py
rdf7a7e3 rea5fa58 679 679 self.stored_plugins = self.findModels() 680 680 self.plugins = self.stored_plugins.values() 681 681 for name, plug in self.stored_plugins.iteritems(): 682 self.model_dictionary[name] = plug 683 682 684 self._get_multifunc_models() 683 685 … … 710 712 self.stored_plugins[name] = plug 711 713 self.plugins.append(plug) 714 self.model_dictionary[name] = plug 712 715 self.model_combobox.set_list("Customized Models", self.plugins) 713 716 return self.model_combobox.get_list() … … 725 728 if name == stored_name: 726 729 del self.stored_plugins[name] 730 del self.model_dictionary[name] 727 731 break 728 732 self.stored_plugins[name] = plug 729 733 self.plugins.append(plug) 734 self.model_dictionary[name] = plug 730 735 731 736 self.model_combobox.reset_list("Customized Models", self.plugins) -
fittingview/src/sans/perspectives/fitting/pagestate.py
r7c720e9 rea5fa58 44 44 ["qmax", "qmax", "float"], 45 45 ["npts", "npts", "float"], 46 ["shape_rbutton", "shape_rbutton", "bool"], 47 ["shape_indep_rbutton", "shape_indep_rbutton", "bool"], 48 ["plugin_rbutton", "plugin_rbutton", "bool"], 49 ["struct_rbutton", "struct_rbutton", "bool"], 46 #["shape_rbutton", "shape_rbutton", "bool"], 47 #["shape_indep_rbutton", "shape_indep_rbutton", "bool"], 48 #["plugin_rbutton", "plugin_rbutton", "bool"], 49 #["struct_rbutton", "struct_rbutton", "bool"], 50 ["categorycombobox", "categorycombobox", "string"], 50 51 ["formfactorcombobox", "formfactorcombobox", "string"], 51 52 ["structurecombobox", "structurecombobox", "string"], … … 224 225 ## save selection of combobox 225 226 self.formfactorcombobox = None 227 self.categorycombobox = None 226 228 self.structurecombobox = None 227 229 228 230 ## radio box to select type of model 229 self.shape_rbutton = False230 self.shape_indep_rbutton = False231 self.struct_rbutton = False232 self.plugin_rbutton = False231 #self.shape_rbutton = False 232 #self.shape_indep_rbutton = False 233 #self.struct_rbutton = False 234 #self.plugin_rbutton = False 233 235 ## the indice of the current selection 234 236 self.disp_box = 0 … … 281 283 obj.engine_type = copy.deepcopy(self.engine_type) 282 284 285 obj.categorycombobox = self.categorycombobox 283 286 obj.formfactorcombobox = self.formfactorcombobox 284 287 obj.structurecombobox = self.structurecombobox 285 288 286 obj.shape_rbutton = self.shape_rbutton287 obj.shape_indep_rbutton = self.shape_indep_rbutton288 obj.struct_rbutton = self.struct_rbutton289 obj.plugin_rbutton = self.plugin_rbutton289 #obj.shape_rbutton = self.shape_rbutton 290 #obj.shape_indep_rbutton = self.shape_indep_rbutton 291 #obj.struct_rbutton = self.struct_rbutton 292 #obj.plugin_rbutton = self.plugin_rbutton 290 293 291 294 obj.manager = self.manager … … 380 383 else: 381 384 rep += "model name : None\n" 382 rep += "model type (form factor) selected: %s\n" % self.shape_rbutton385 #rep += "model type (form factor) selected: %s\n" % self.shape_rbutton 383 386 rep += "multi_factor : %s\n" % str(self.multi_factor) 384 rep += "model type (shape independent) selected: %s\n" % self.shape_indep_rbutton 385 rep += "model type (structure factor) selected: %s\n" % self.struct_rbutton 386 rep += "model type (plug-in ) selected: %s\n" % self.plugin_rbutton 387 rep += "model type (Category) selected: %s\n" % self.categorycombobox 388 #rep += "model type (shape independent) selected: %s\n" % self.shape_indep_rbutton 389 #rep += "model type (structure factor) selected: %s\n" % self.struct_rbutton 390 #rep += "model type (plug-in ) selected: %s\n" % self.plugin_rbutton 387 391 rep += "data : %s\n" % str(self.data) 388 392 rep += "Plotting Range: min: %s, max: %s, steps: %s\n" % (str(self.qmin), -
sansguiframe/src/sans/guiframe/CategoryInstaller.py
rdf7a7e3 rea5fa58 6 6 7 7 @author kieranrcampbell@gmail.com 8 8 @modified by NIST/MD sanview team 9 9 """ 10 10 … … 14 14 from collections import defaultdict 15 15 16 user_file= 'serialized_cat.p'16 USER_FILE = 'serialized_cat.p' 17 17 18 18 class CategoryInstaller: … … 47 47 returns the dir where default_cat.p should be 48 48 """ 49 import sans.dataloader.readers 50 return sans.dataloader.readers.get_data_path() 49 from sans import sansview as sasview 50 app_path = os.path.dirname(sasview.__file__) 51 return app_path 51 52 52 53 @staticmethod … … 55 56 returns the users sansview config dir 56 57 """ 57 return os.path.join(os.path.expanduser("~"), 58 ".sansview") 58 return os.path.join(os.path.expanduser("~"), ".sasview") 59 59 60 60 @staticmethod … … 95 95 def get_user_file(): 96 96 """ 97 returns the user data file, eg .sa nsview/serialized_cat.p97 returns the user data file, eg .sasview/serialized_cat.p 98 98 """ 99 99 return os.path.join(CategoryInstaller._get_home_dir(), 100 user_file)100 USER_FILE) 101 101 102 102 @staticmethod … … 107 107 """ 108 108 return os.path.join(\ 109 CategoryInstaller._get_default_cat_p_dir, 110 "default_categories.p") 109 CategoryInstaller._get_default_cat_p_dir(), "default_categories.p") 111 110 112 111 @staticmethod … … 128 127 serialized_file = CategoryInstaller.get_user_file() 129 128 else: 130 serialized_file = os.path.join(homedir, user_file)129 serialized_file = os.path.join(homedir, USER_FILE) 131 130 132 131 if os.path.exists(serialized_file): -
sansguiframe/src/sans/guiframe/CategoryManager.py
rdf7a7e3 rea5fa58 16 16 import wx 17 17 import sys 18 import os 18 19 from wx.lib.mixins.listctrl import CheckListCtrlMixin, ListCtrlAutoWidthMixin 19 20 from collections import defaultdict … … 290 291 cat_file = open(CategoryInstaller.get_user_file(), 'wb') 291 292 292 pickle.dump( self.master_category_dict, 293 cat_file ) 293 pickle.dump( self.master_category_dict, cat_file ) 294 294 295 295 … … 299 299 """ 300 300 try: 301 cat_file = open(CategoryInstaller.get_user_file(), 302 'rb') 303 self.master_category_dict = pickle.load(cat_file) 304 301 file = CategoryInstaller.get_user_file() 302 if os.path.isfile(file): 303 cat_file = open(file, 'rb') 304 self.master_category_dict = pickle.load(cat_file) 305 else: 306 cat_file = open(CategoryInstaller.get_default_file(), 'rb') 307 self.master_category_dict = pickle.load(cat_file) 305 308 except IOError: 306 309 print 'Problem reading in category file. Please review' … … 421 424 vbox.Add(self.ok_button, flag = wx.ALL | wx.ALIGN_RIGHT, 422 425 border = 10) 423 424 425 self.current_categories.SetSelection(0)426 427 if self.current_categories.GetCount() > 0: 428 self.current_categories.SetSelection(0) 426 429 self.new_text.Disable() 427 430 self.SetSizer(vbox) … … 494 497 return ret 495 498 496 497 498 499 500 499 if __name__ == '__main__': 501 500 … … 510 509 app.MainLoop() 511 510 512 -
sansguiframe/src/sans/guiframe/__init__.py
rdf7a7e3 rea5fa58 70 70 for f in findall(path): 71 71 data_files.append(('media/guiframe_media', [f])) 72 path = get_media_path(media="catdata")73 for f in findall(path):74 data_files.append(('.', [f]))75 72 76 73 return data_files -
sansguiframe/src/sans/guiframe/customdir.py
r94d6752 rea5fa58 3 3 import os.path 4 4 import shutil 5 from sans.guiframe.CategoryInstaller import CategoryInstaller 5 6 6 7 CONF_DIR = 'config' 7 8 APPLICATION_NAME = 'sasview' 9 10 def _find_usersasview_dir(): 11 """ 12 Find and return user/.sasview dir 13 """ 14 dir = os.path.join(os.path.expanduser("~"), 15 ("." + APPLICATION_NAME)) 16 return dir 8 17 9 18 def _find_customconf_dir(): … … 12 21 The plugin directory is located in the user's home directory. 13 22 """ 14 dir = os.path.join(os.path.expanduser("~"),15 ("." + APPLICATION_NAME), CONF_DIR)23 u_dir = _find_usersasview_dir() 24 dir = os.path.join(u_dir, CONF_DIR) 16 25 17 26 return dir … … 19 28 def _setup_conf_dir(path): 20 29 """ 21 Setup the custom config dir 30 Setup the custom config dir and cat file 22 31 """ 23 32 dir = _find_customconf_dir() … … 26 35 os.makedirs(dir) 27 36 file = os.path.join(dir, "custom_config.py") 37 u_dir = _find_usersasview_dir() 38 cat_file = os.path.join(u_dir, "serialized_cat.p") 39 # Place example user models as needed 40 if not os.path.isfile(cat_file): 41 try: 42 default_cat_file = CategoryInstaller.get_default_file() 43 if os.path.isfile(default_cat_file): 44 shutil.copyfile(default_cat_file, cat_file) 45 else: 46 print "Unable to find/copy default cat file" 47 except: 48 print "Unable to copy default cat file to the user dir." 49 28 50 # Place example user models as needed 29 51 try: -
sansmodels/default_categories.p
rdf7a7e3 rea5fa58 6 6 p2 7 7 tRp3 8 S'Uncategorized' 9 p4 10 (lp5 11 (S'PearlNecklaceModel' 12 p6 13 I01 14 tp7 15 a(S'TwoPowerLawModel' 16 p8 17 I01 18 tp9 19 a(S'GelFitModel' 20 p10 21 I01 22 tp11 23 a(S'SquareWellStructure' 24 p12 25 I01 26 tp13 27 a(S'DABModel' 28 p14 29 I01 30 tp15 31 a(S'PowerLawAbsModel' 32 p16 33 I01 34 tp17 35 a(S'PorodModel' 36 p18 37 I01 38 tp19 39 a(S'GuinierModel' 40 p20 41 I01 42 tp21 43 a(S'CoreMultiShellModel' 44 p22 45 I01 46 tp23 47 a(S'FCCrystalModel' 48 p24 49 I01 50 tp25 51 a(S'ParallelepipedModel' 52 p26 53 I01 54 tp27 55 a(S'LineModel' 56 p28 57 I01 58 tp29 59 a(S'BEPolyelectrolyte' 60 p30 61 I01 62 tp31 63 a(S'SCCrystalModel' 64 p32 65 I01 66 tp33 67 a(S'FuzzySphereModel' 68 p34 69 I01 70 tp35 71 a(S'FlexCylEllipXModel' 72 p36 73 I01 74 tp37 75 a(S'UnifiedPowerRgModel' 76 p38 77 I01 78 tp39 79 a(S'SphericalSLDModel' 80 p40 81 I01 82 tp41 83 a(S'EllipticalCylinderModel' 84 p42 85 I01 86 tp43 87 a(S'MassSurfaceFractal' 88 p44 89 I01 90 tp45 91 a(S'GuinierPorodModel' 92 p46 93 I01 94 tp47 95 a(S'Core2ndMomentModel' 96 p48 97 I01 98 tp49 99 a(S'RPA10Model' 100 p50 101 I01 102 tp51 103 a(S'TwoLorentzianModel' 104 p52 105 I01 106 tp53 107 a(S'DebyeModel' 108 p54 109 I01 110 tp55 111 a(S'CSParallelepipedModel' 112 p56 113 I01 114 tp57 115 a(S'PolymerExclVolume' 116 p58 117 I01 118 tp59 119 a(S'OnionExpShellModel' 120 p60 121 I01 122 tp61 123 a(S'MultiShellModel' 124 p62 125 I01 126 tp63 127 a(S'LamellarPCrystalModel' 128 p64 129 I01 130 tp65 131 a(S'RaspBerryModel' 132 p66 133 I01 134 tp67 135 a(S'CoreShellEllipsoidModel' 136 p68 137 I01 138 tp69 139 a(S'MassFractalModel' 140 p70 141 I01 142 tp71 143 a(S'CappedCylinderModel' 144 p72 145 I01 146 tp73 147 a(S'TeubnerStreyModel' 148 p74 149 I01 150 tp75 151 a(S'BCCrystalModel' 152 p76 153 I01 154 tp77 155 a(S'Poly_GaussCoil' 156 p78 157 I01 158 tp79 159 a(S'HayterMSAStructure' 160 p80 161 I01 162 tp81 163 a(S'CorrLengthModel' 164 p82 165 I01 166 tp83 167 a(S'StackedDisksModel' 168 p84 169 I01 170 tp85 171 a(S'LamellarPSHGModel' 172 p86 173 I01 174 tp87 175 a(S'StarPolymer' 176 p88 177 I01 178 tp89 179 a(S'FractalModel' 180 p90 181 I01 182 tp91 183 a(S'CoreShellBicelleModel' 184 p92 185 I01 186 tp93 187 a(S'ReflectivityModel' 188 p94 189 I01 190 tp95 191 a(S'PeakLorentzModel' 192 p96 193 I01 194 tp97 195 a(S'HardsphereStructure' 196 p98 197 I01 198 tp99 199 a(S'LamellarPSModel' 200 p100 201 I01 202 tp101 203 a(S'EllipsoidModel' 204 p102 205 I01 206 tp103 207 a(S'BroadPeakModel' 208 p104 209 I01 210 tp105 211 a(S'SphereModel' 212 p106 213 I01 214 tp107 215 a(S'VesicleModel' 216 p108 217 I01 218 tp109 219 a(S'ReflectivityIIModel' 220 p110 221 I01 222 tp111 223 a(S'TriaxialEllipsoidModel' 224 p112 225 I01 226 tp113 227 a(S'LamellarModel' 228 p114 229 I01 230 tp115 231 a(S'PeakGaussModel' 232 p116 233 I01 234 tp117 235 a(S'FractalCoreShellModel' 236 p118 237 I01 238 tp119 239 a(S'CylinderModel' 240 p120 241 I01 242 tp121 243 a(S'BarBellModel' 244 p122 245 I01 246 tp123 247 a(S'CoreShellCylinderModel' 248 p124 249 I01 250 tp125 251 a(S'BinaryHSModel' 252 p126 253 I01 254 tp127 255 a(S'FlexibleCylinderModel' 256 p128 257 I01 258 tp129 259 a(S'HollowCylinderModel' 260 p130 261 I01 262 tp131 263 a(S'LamellarFFHGModel' 264 p132 265 I01 266 tp133 267 a(S'SurfaceFractalModel' 268 p134 269 I01 270 tp135 271 a(S'LinearPearlsModel' 272 p136 273 I01 274 tp137 275 a(S'FractalO_Z' 276 p138 277 I01 278 tp139 279 a(S'StickyHSStructure' 280 p140 281 I01 282 tp141 283 a(S'GaussLorentzGelModel' 284 p142 285 I01 286 tp143 287 a(S'CoreShellModel' 288 p144 289 I01 290 tp145 291 a(S'LorentzModel' 292 p146 293 I01 294 tp147 295 as. 8 . -
sansview/default_categories.p
rcb9f50d6 rea5fa58 6 6 p2 7 7 tRp3 8 S'S pherical Shapes'8 S'Shapes' 9 9 p4 10 10 (lp5 … … 13 13 I01 14 14 tp7 15 a(S' MassFractalModel'15 a(S'CoreShellCylinderModel' 16 16 p8 17 17 I01 … … 21 21 I01 22 22 tp11 23 a(S'LamellarFFHGModel' 24 p12 25 I01 26 tp13 27 a(S'FCCrystalModel' 28 p14 29 I01 30 tp15 23 31 a(S'FuzzySphereModel' 24 p12 25 I01 26 tp13 32 p16 33 I01 34 tp17 35 a(S'FlexCylEllipXModel' 36 p18 37 I01 38 tp19 27 39 a(S'BCCrystalModel' 28 p14 29 I01 30 tp15 40 p20 41 I01 42 tp21 43 a(S'EllipticalCylinderModel' 44 p22 45 I01 46 tp23 47 a(S'CSParallelepipedModel' 48 p24 49 I01 50 tp25 51 a(S'OnionExpShellModel' 52 p26 53 I01 54 tp27 55 a(S'VesicleModel' 56 p28 57 I01 58 tp29 59 a(S'MultiShellModel' 60 p30 61 I01 62 tp31 63 a(S'LamellarPCrystalModel' 64 p32 65 I01 66 tp33 67 a(S'RaspBerryModel' 68 p34 69 I01 70 tp35 71 a(S'CoreShellEllipsoidModel' 72 p36 73 I01 74 tp37 75 a(S'CappedCylinderModel' 76 p38 77 I01 78 tp39 79 a(S'SphericalSLDModel' 80 p40 81 I01 82 tp41 83 a(S'StackedDisksModel' 84 p42 85 I01 86 tp43 87 a(S'LamellarPSHGModel' 88 p44 89 I01 90 tp45 91 a(S'CoreShellBicelleModel' 92 p46 93 I01 94 tp47 95 a(S'LamellarPSModel' 96 p48 97 I01 98 tp49 99 a(S'EllipsoidModel' 100 p50 101 I01 102 tp51 103 a(S'SphereModel' 104 p52 105 I01 106 tp53 107 a(S'ParallelepipedModel' 108 p54 109 I01 110 tp55 111 a(S'TriaxialEllipsoidModel' 112 p56 113 I01 114 tp57 115 a(S'LamellarModel' 116 p58 117 I01 118 tp59 119 a(S'CylinderModel' 120 p60 121 I01 122 tp61 123 a(S'BarBellModel' 124 p62 125 I01 126 tp63 127 a(S'BinaryHSModel' 128 p64 129 I01 130 tp65 131 a(S'FlexibleCylinderModel' 132 p66 133 I01 134 tp67 135 a(S'HollowCylinderModel' 136 p68 137 I01 138 tp69 31 139 a(S'SCCrystalModel' 32 p16 33 I01 34 tp17 140 p70 141 I01 142 tp71 143 a(S'LinearPearlsModel' 144 p72 145 I01 146 tp73 147 a(S'CoreShellModel' 148 p74 149 I01 150 tp75 151 asS'Structure Factor' 152 p76 153 (lp77 154 (S'SquareWellStructure' 155 p78 156 I01 157 tp79 158 a(S'HayterMSAStructure' 159 p80 160 I01 161 tp81 162 a(S'HardsphereStructure' 163 p82 164 I01 165 tp83 166 a(S'StickyHSStructure' 167 p84 168 I01 169 tp85 170 asS'Shape-Independent' 171 p86 172 (lp87 173 (S'TwoPowerLawModel' 174 p88 175 I01 176 tp89 177 a(S'GelFitModel' 178 p90 179 I01 180 tp91 181 a(S'PowerLawAbsModel' 182 p92 183 I01 184 tp93 185 a(S'PorodModel' 186 p94 187 I01 188 tp95 189 a(S'MassFractalModel' 190 p96 191 I01 192 tp97 193 a(S'TeubnerStreyModel' 194 p98 195 I01 196 tp99 197 a(S'BEPolyelectrolyte' 198 p100 199 I01 200 tp101 201 a(S'DebyeModel' 202 p102 203 I01 204 tp103 35 205 a(S'MassSurfaceFractal' 36 p18 37 I01 38 tp19 206 p104 207 I01 208 tp105 209 a(S'Poly_GaussCoil' 210 p106 211 I01 212 tp107 39 213 a(S'Core2ndMomentModel' 40 p20 41 I01 42 tp21 43 a(S'OnionExpShellModel' 44 p22 45 I01 46 tp23 47 a(S'MultiShellModel' 48 p24 49 I01 50 tp25 51 a(S'SphereModel' 52 p26 53 I01 54 tp27 214 p108 215 I01 216 tp109 217 a(S'RPA10Model' 218 p110 219 I01 220 tp111 221 a(S'TwoLorentzianModel' 222 p112 223 I01 224 tp113 225 a(S'UnifiedPowerRgModel' 226 p114 227 I01 228 tp115 229 a(S'PolymerExclVolume' 230 p116 231 I01 232 tp117 55 233 a(S'GuinierModel' 56 p28 57 I01 58 tp29 59 a(S'SphericalSLDModel' 60 p30 61 I01 62 tp31 234 p118 235 I01 236 tp119 63 237 a(S'GuinierPorodModel' 64 p32 65 I01 66 tp33 238 p120 239 I01 240 tp121 241 a(S'CorrLengthModel' 242 p122 243 I01 244 tp123 245 a(S'StarPolymer' 246 p124 247 I01 248 tp125 67 249 a(S'FractalModel' 68 p34 69 I01 70 tp35 71 a(S'VesicleModel' 72 p36 73 I01 74 tp37 250 p126 251 I01 252 tp127 253 a(S'PeakLorentzModel' 254 p128 255 I01 256 tp129 257 a(S'BroadPeakModel' 258 p130 259 I01 260 tp131 261 a(S'PeakGaussModel' 262 p132 263 I01 264 tp133 75 265 a(S'FractalCoreShellModel' 76 p38 77 I01 78 tp39 79 a(S'FCCrystalModel' 80 p40 81 I01 82 tp41 83 a(S'BinaryHSModel' 84 p42 85 I01 86 tp43 266 p134 267 I01 268 tp135 269 a(S'DABModel' 270 p136 271 I01 272 tp137 87 273 a(S'SurfaceFractalModel' 88 p44 89 I01 90 tp45 91 a(S'LinearPearlsModel' 92 p46 93 I01 94 tp47 95 a(S'RaspBerryModel' 96 p48 97 I01 98 tp49 99 a(S'CoreShellModel' 100 p50 101 I01 102 tp51 103 asS'Gels' 104 p52 105 (lp53 106 (g6 107 I01 108 tp54 109 a(S'TwoPowerLawModel' 110 p55 111 I01 112 tp56 113 a(g8 114 I01 115 tp57 116 a(g18 117 I01 118 tp58 119 a(S'TwoLorentzianModel' 120 p59 121 I01 122 tp60 123 a(S'UnifiedPowerRgModel' 124 p61 125 I01 126 tp62 127 a(g32 128 I01 129 tp63 130 a(S'CorrLengthModel' 131 p64 132 I01 133 tp65 134 a(S'BroadPeakModel' 135 p66 136 I01 137 tp67 138 a(S'DABModel' 139 p68 140 I01 141 tp69 142 a(g44 143 I01 144 tp70 145 a(g46 146 I01 147 tp71 274 p138 275 I01 276 tp139 148 277 a(S'GaussLorentzGelModel' 149 p72 150 I01 151 tp73 152 asS'Peaks' 153 p74 154 (lp75 155 (g6 156 I01 157 tp76 158 a(S'LamellarPCrystalModel' 159 p77 160 I01 161 tp78 162 a(g14 163 I01 164 tp79 165 a(g16 166 I01 167 tp80 168 a(g59 169 I01 170 tp81 171 a(g22 172 I01 173 tp82 174 a(g24 175 I01 176 tp83 177 a(S'StackedDisksModel' 178 p84 179 I01 180 tp85 181 a(S'LamellarPSHGModel' 182 p86 183 I01 184 tp87 185 a(S'PeakLorentzModel' 186 p88 187 I01 188 tp89 189 a(g66 190 I01 191 tp90 192 a(S'PeakGaussModel' 193 p91 194 I01 195 tp92 196 a(g40 197 I01 198 tp93 278 p140 279 I01 280 tp141 199 281 a(S'LorentzModel' 200 p94 201 I01 202 tp95 203 asS'Two-Phase' 204 p96 205 (lp97 206 (S'PorodModel' 207 p98 208 I01 209 tp99 210 a(g8 211 I01 212 tp100 213 a(g18 214 I01 215 tp101 216 a(g64 217 I01 218 tp102 219 a(g34 220 I01 221 tp103 222 a(g66 223 I01 224 tp104 225 a(g38 226 I01 227 tp105 228 a(g68 229 I01 230 tp106 231 a(g44 232 I01 233 tp107 234 a(g72 235 I01 236 tp108 237 asS'Polymers' 238 p109 239 (lp110 240 (g6 241 I01 242 tp111 243 a(S'BEPolyelectrolyte' 244 p112 245 I01 246 tp113 247 a(g77 248 I01 249 tp114 250 a(S'DebyeModel' 251 p115 252 I01 253 tp116 254 a(g14 255 I01 256 tp117 257 a(g16 258 I01 259 tp118 260 a(S'RPA10Model' 261 p119 262 I01 263 tp120 264 a(S'FlexCylEllipXModel' 265 p121 266 I01 267 tp122 268 a(S'PolymerExclVolume' 269 p123 270 I01 271 tp124 272 a(g86 273 I01 274 tp125 275 a(S'LamellarPSModel' 276 p126 277 I01 278 tp127 279 a(S'LamellarModel' 280 p128 281 I01 282 tp129 283 a(S'Poly_GaussCoil' 284 p130 285 I01 286 tp131 287 a(S'FlexibleCylinderModel' 288 p132 289 I01 290 tp133 291 a(S'LamellarFFHGModel' 292 p134 293 I01 294 tp135 295 a(g46 296 I01 297 tp136 298 a(g72 299 I01 300 tp137 301 asS'Empirical' 302 p138 303 (lp139 304 (g55 305 I01 306 tp140 307 a(g98 308 I01 309 tp141 310 a(g61 311 I01 312 tp142 313 a(g28 282 p142 314 283 I01 315 284 tp143 316 a(g32 317 I01 318 tp144 319 a(g64 320 I01 321 tp145 322 a(g66 323 I01 324 tp146 325 a(S'LineModel' 326 p147 327 I01 328 tp148 329 asS'Particles' 330 p149 331 (lp150 332 (g6 285 asS'Uncategorized' 286 p144 287 (lp145 288 (S'LineModel' 289 p146 290 I01 291 tp147 292 a(S'ReflectivityModel' 293 p148 294 I01 295 tp149 296 a(S'ReflectivityIIModel' 297 p150 333 298 I01 334 299 tp151 335 a(S'HollowCylinderModel'336 p152337 I01338 tp153339 a(g8340 I01341 tp154342 a(g10343 I01344 tp155345 a(S'CSParallelepipedModel'346 p156347 I01348 tp157349 a(S'ParallelepipedModel'350 p158351 I01352 tp159353 a(g12354 I01355 tp160356 a(g77357 I01358 tp161359 a(S'EllipticalCylinderModel'360 p162361 I01362 tp163363 a(g14364 I01365 tp164366 a(g16367 I01368 tp165369 a(g18370 I01371 tp166372 a(g20373 I01374 tp167375 a(g121376 I01377 tp168378 a(g22379 I01380 tp169381 a(g24382 I01383 tp170384 a(g26385 I01386 tp171387 a(S'CoreShellEllipsoidModel'388 p172389 I01390 tp173391 a(g28392 I01393 tp174394 a(S'CappedCylinderModel'395 p175396 I01397 tp176398 a(S'CylinderModel'399 p177400 I01401 tp178402 a(g30403 I01404 tp179405 a(g32406 I01407 tp180408 a(g84409 I01410 tp181411 a(g86412 I01413 tp182414 a(g34415 I01416 tp183417 a(S'CoreShellBicelleModel'418 p184419 I01420 tp185421 a(g126422 I01423 tp186424 a(S'EllipsoidModel'425 p187426 I01427 tp188428 a(g36429 I01430 tp189431 a(S'TriaxialEllipsoidModel'432 p190433 I01434 tp191435 a(g128436 I01437 tp192438 a(g38439 I01440 tp193441 a(S'BarBellModel'442 p194443 I01444 tp195445 a(g40446 I01447 tp196448 a(g42449 I01450 tp197451 a(g132452 I01453 tp198454 a(g134455 I01456 tp199457 a(g44458 I01459 tp200460 a(g46461 I01462 tp201463 a(g48464 I01465 tp202466 a(g50467 I01468 tp203469 asS'Non-Spherical Shapes'470 p204471 (lp205472 (g6473 I01474 tp206475 a(g152476 I01477 tp207478 a(g156479 I01480 tp208481 a(g158482 I01483 tp209484 a(g77485 I01486 tp210487 a(g162488 I01489 tp211490 a(g121491 I01492 tp212493 a(g172494 I01495 tp213496 a(g28497 I01498 tp214499 a(g175500 I01501 tp215502 a(g177503 I01504 tp216505 a(g32506 I01507 tp217508 a(g84509 I01510 tp218511 a(g86512 I01513 tp219514 a(g184515 I01516 tp220517 a(g126518 I01519 tp221520 a(g187521 I01522 tp222523 a(g190524 I01525 tp223526 a(g128527 I01528 tp224529 a(g194530 I01531 tp225532 a(g132533 I01534 tp226535 a(g134536 I01537 tp227538 a(g46539 I01540 tp228541 asS'Uncategorized'542 p229543 (lp230544 (S'GelFitModel'545 p231546 I01547 tp232548 a(S'CoreShellCylinderModel'549 p233550 I01551 tp234552 a(S'PowerLawAbsModel'553 p235554 I01555 tp236556 a(S'TeubnerStreyModel'557 p237558 I01559 tp238560 a(S'SquareWellStructure'561 p239562 I01563 tp240564 a(S'FractalO_Z'565 p241566 I01567 tp242568 a(S'HayterMSAStructure'569 p243570 I01571 tp244572 a(S'StarPolymer'573 p245574 I01575 tp246576 a(S'ReflectivityModel'577 p247578 I01579 tp248580 a(S'HardsphereStructure'581 p249582 I01583 tp250584 a(S'ReflectivityIIModel'585 p251586 I01587 tp252588 a(S'StickyHSStructure'589 p253590 I01591 tp254592 300 as. -
sansview/sansview.py
rdf7a7e3 rea5fa58 14 14 logging.basicConfig(level=logging.INFO, 15 15 format='%(asctime)s %(levelname)s %(message)s', 16 filename=os.path.join(os.path.expanduser("~"),'sasview.log')) 16 filename=os.path.join(os.path.expanduser("~"), 17 'sasview.log')) 17 18 18 19 import wx … … 103 104 logging.error(sys.exc_value) 104 105 105 # initialize category stuff106 user_file = os.path.join(os.path.expanduser("~"),107 'serialized_categories.p')108 106 109 if not os.path.isfile(user_file):110 # either first time starting sansview or the111 # user has deleted their category file112 my_dir = os.path.dirname(os.path.abspath(__file__))113 default_file = os.path.join(my_dir, '..',114 'sansmodels',115 'default_categories.p' )116 copy(default_file, user_file)117 118 107 119 108 # Add welcome page -
sansview/setup_exe.py
rdf7a7e3 rea5fa58 32 32 sys.argv.remove('--extrapath') 33 33 except: 34 print "Error processing extra python path needed to build SasView\n %s" % sys.exc_value 34 print "Error processing extra python path needed to build SasView\n %s" % \ 35 sys.exc_value 35 36 36 37 from distutils.core import setup … … 259 260 if os.path.isfile(f): 260 261 data_files.append(('.', [f])) 262 263 f = 'default_categories.p' 264 if os.path.isfile(f): 265 data_files.append(('.', [f])) 261 266 262 267 if os.path.isfile("BUILD_NUMBER"): -
sansview/setup_mac.py
rdf7a7e3 rea5fa58 54 54 55 55 APP = ['sansview.py'] 56 DATA_FILES += ['images','test','media', 'custom_config.py', 'local_config.py'] 56 DATA_FILES += ['images','test','media', 'custom_config.py', 'local_config.py', 57 'default_categories.p'] 57 58 if os.path.isfile("BUILD_NUMBER"): 58 59 DATA_FILES.append("BUILD_NUMBER") … … 92 93 93 94 EXTENSIONS_LIST = find_extension() 94 95 #initialize category stuff96 from sans.guiframe.CategoryInstaller import CategoryInstaller97 CategoryInstaller.check_install()98 99 95 100 96 -
setup.py
rdf7a7e3 rea5fa58 9 9 from setuptools import setup, Extension, find_packages 10 10 from distutils.command.build_ext import build_ext 11 12 13 14 11 15 12 try: … … 49 46 if os.path.isdir(sans_dir): 50 47 f_path = os.path.join(sans_dir, "sasview.log") 48 if os.path.isfile(f_path): 49 os.remove(f_path) 50 f_path = os.path.join(sans_dir, "serialized_cat.p") 51 51 if os.path.isfile(f_path): 52 52 os.remove(f_path) … … 116 116 package_dir["sans.guiframe.local_perspectives"] = os.path.join(guiframe_path, 117 117 "local_perspectives") 118 package_data["sans.guiframe"] = ['images/*', 119 'media/*', 120 'default_categories.p'] 121 118 package_data["sans.guiframe"] = ['images/*', 'media/*'] 122 119 packages.extend(["sans.guiframe", "sans.guiframe.local_perspectives"]) 123 120 # build local plugin … … 275 272 package_dir["sans.models"] = model_dir 276 273 277 package_dir["sans.models.sans_extension"] = os.path.join("sansmodels", "src", "sans", "models", "sans_extension") 274 package_dir["sans.models.sans_extension"] = os.path.join("sansmodels", "src", 275 "sans", "models", "sans_extension") 278 276 279 277 package_data['sans.models'] = [os.path.join('media', "*.*")] … … 317 315 318 316 package_dir["sans.sansview"] = "sansview" 319 package_data['sans.sansview'] = ['images/*', 'media/*', 'test/*'] 317 package_data['sans.sansview'] = ['images/*', 'media/*', 'test/*', 318 'default_categories.p'] 320 319 packages.append("sans.sansview") 321 320 … … 329 328 else: 330 329 required.extend(['pil']) 331 332 # sys.path.append(os.path.join('sansguiframe',333 # 'src',334 # 'sans',335 # 'guiframe'))336 337 #install category stuff338 cat_install_path = os.path.join('sansguiframe', 'src',339 'sans','guiframe','CategoryInstaller.py')340 shutil.copy(cat_install_path, os.getcwd())341 342 from CategoryInstaller import CategoryInstaller343 CategoryInstaller.check_install(defaultfile = \344 os.path.join('sansguiframe',345 'src',346 'sans',347 'guiframe',348 'default_categories.p'),349 modelsdir = \350 os.path.join('fittingview',351 'src',352 'sans',353 'perspectives',354 'fitting'),355 installed_models_dir = \356 os.path.join('sansdataloader',357 'src',358 'sans',359 'dataloader',360 'readers') )361 362 330 363 331 # Set up SasView
Note: See TracChangeset
for help on using the changeset viewer.