Changeset 8ab3302 in sasview for fittingview/src/sans
- Timestamp:
- Dec 22, 2011 11:55:32 AM (13 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:
- 273801b
- Parents:
- 7983000f
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
fittingview/src/sans/perspectives/fitting/models.py
r7c8d3093 r8ab3302 18 18 from sans.models.pluginmodel import Model1DPlugin 19 19 20 PLUGIN_DIR = 'plugin s'20 PLUGIN_DIR = 'plugin_models' 21 21 22 22 def log(message): … … 75 75 The plugin directory is located in the user's home directory. 76 76 """ 77 dir = os.path.join(os.path.expanduser("~"),'.sansview', PLUGIN_DIR)77 dir = os.path.join(os.path.expanduser("~"),'.sansview', PLUGIN_DIR) 78 78 79 79 # If the plugin directory doesn't exist, create it … … 81 81 os.makedirs(dir) 82 82 83 # Find paths needed 84 try: 85 # For source 86 if os.path.isdir(os.path.dirname(__file__)): 87 p_dir = os.path.join(os.path.dirname(__file__), PLUGIN_DIR) 88 else: 89 raise 90 except: 91 # Check for data path next to exe/zip file. 92 #Look for maximum n_dir up of the current dir to find plugins dir 93 n_dir = 12 94 p_dir = None 95 f_dir = os.path.join(os.path.dirname(__file__)) 96 for i in range(n_dir): 97 if i > 1: 98 f_dir, _ = os.path.split(f_dir) 99 plugin_path = os.path.join(f_dir, PLUGIN_DIR) 100 if os.path.isdir(plugin_path): 101 p_dir = plugin_path 102 break 103 if not p_dir: 104 raise 105 83 106 # Place example user models as needed 84 if not os.path.isfile(os.path.join(dir,"testmodel.py")):85 shutil.copy(os.path.join(os.path.dirname(__file__),"plugin_models","testmodel.py"), dir)86 if not os.path.isfile(os.path.join(dir,"testmodel_2.py")):87 shutil.copy(os.path.join(os.path.dirname(__file__),"plugin_models","testmodel_2.py"), dir)88 if not os.path.isfile(os.path.join(dir,"sum_p1_p2.py")):89 shutil.copy(os.path.join(os.path.dirname(__file__),"plugin_models","sum_p1_p2.py"), dir)90 107 for file in os.listdir(p_dir): 108 file_path = os.path.join(p_dir, file) 109 if os.path.isfile(file_path): 110 if file.split(".")[-1] == 'py' and\ 111 file.split(".")[0] != '__init__': 112 if not os.path.isfile(os.path.join(dir, file)): 113 shutil.copy(file_path, dir) 91 114 return dir 92 115
Note: See TracChangeset
for help on using the changeset viewer.