Changeset 23ccf07 in sasview for sansview/perspectives/fitting/models.py
- Timestamp:
- Apr 26, 2011 11:20:22 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:
- 60642b4
- Parents:
- 168a845
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sansview/perspectives/fitting/models.py
r5901bb9 r23ccf07 9 9 # Time is needed by the log method 10 10 import time 11 import logging 11 12 12 13 from sans.guiframe.events import StatusEvent … … 17 18 18 19 PLUGIN_DIR = 'plugins' 20 path = os.path.dirname(os.path.sys.path[0]) 21 file = os.path.join(path, "plugins.log") 22 19 23 20 24 def log(message): 21 25 """ 22 26 """ 23 out = open( "plugins.log", 'a')27 out = open(file, 'a') 24 28 out.write("%10g: %s\n" % (time.clock(), message)) 25 29 out.close() … … 107 111 except: 108 112 # Don't deal with bad plug-in imports. Just skip. 113 msg = "Could not import model plugin: %s\n" % sys.exc_value 114 log(msg) 109 115 pass 110 116 return plugins … … 172 178 in the directory if file were modified 173 179 """ 180 temp = {} 174 181 if self.is_changed(): 175 182 #always recompile the folder plugin 176 183 import compileall 177 compileall.compile_dir(dir=PLUGIN_DIR, force=1) 178 dir = os.path.join(os.getcwd(), 'plugins') 179 log("looking for models in: %s" % str(dir)) 180 return _findModels(PLUGIN_DIR) 181 return {} 182 183 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) 194 logging.info("pluging model : %s\n" % str(temp)) 195 return temp 196 184 197 def _getModelList(self): 185 198 """
Note: See TracChangeset
for help on using the changeset viewer.