Changeset a0986f6 in sasview
- Timestamp:
- Apr 27, 2011 9:02:17 AM (14 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:
- 0b6ae5f
- Parents:
- 5683f47
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sansview/perspectives/fitting/models.py
r23ccf07 ra0986f6 18 18 19 19 PLUGIN_DIR = 'plugins' 20 path = os.path.dirname(os.path.sys.path[0])21 file = os.path.join(path, "plugins.log")22 23 20 24 21 def log(message): 25 22 """ 26 23 """ 27 out = open( file, 'a')24 out = open("plugins.log", 'a') 28 25 out.write("%10g: %s\n" % (time.clock(), message)) 29 26 out.close() … … 79 76 plugins = {} 80 77 # Go through files in plug-in directory 78 #always recompile the folder plugin 79 import compileall 80 dir = os.path.abspath(PLUGIN_DIR) 81 if not os.path.isdir(dir): 82 dir = os.path.join(os.getcwd(), PLUGIN_DIR) 83 if not os.path.isdir(dir): 84 dir = os.path.join(os.path.dirname(__file__), PLUGIN_DIR) 85 if not os.path.isdir(dir): 86 dir = os.path.join(os.path.dirname(os.path.sys.path[0]), PLUGIN_DIR) 87 if not os.path.isdir(dir): 88 msg = "SansView couldn't locate Model plugin folder." 89 msg += """ "%s" does not exist""" % dir 90 logging.warning(msg) 91 return plugins 92 else: 93 log("looking for models in: %s" % str(dir)) 94 compileall.compile_dir(dir=dir, ddir=dir, force=1, quiet=True) 95 logging.info("pluging model dir: %s\n" % str(dir)) 81 96 try: 82 97 list = os.listdir(dir) … … 180 195 temp = {} 181 196 if self.is_changed(): 182 #always recompile the folder plugin 183 import compileall 184 if os.path.isdir(os.path.abspath(PLUGIN_DIR)): 185 dir = os.path.abspath(PLUGIN_DIR) 186 else: 187 dir = os.path.join(os.path.dirname(os.path.sys.path[0]), 'plugins') 188 if not os.path.isdir(dir): 189 log("Could not locate models plugins in: %s" % str(dir)) 190 else: 191 log("looking for models in: %s" % str(dir)) 192 compileall.compile_dir(dir=dir, ddir=dir, force=1, quiet=True) 193 return _findModels(dir) 197 return _findModels(dir) 194 198 logging.info("pluging model : %s\n" % str(temp)) 195 199 return temp
Note: See TracChangeset
for help on using the changeset viewer.