Changes in src/sas/sasgui/perspectives/fitting/models.py [a1b8fee:b1c2011] in sasview
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sasgui/perspectives/fitting/models.py
ra1b8fee rb1c2011 156 156 try: 157 157 import compileall 158 compileall.compile_dir(dir=dir, ddir=dir, force= 1,158 compileall.compile_dir(dir=dir, ddir=dir, force=0, 159 159 quiet=report_problem) 160 160 except: … … 163 163 164 164 165 def _find Models(dir):165 def _find_models(): 166 166 """ 167 167 Find custom models 168 168 """ 169 169 # List of plugin objects 170 dir = find_plugins_dir()170 directory = find_plugins_dir() 171 171 # Go through files in plug-in directory 172 if not os.path.isdir(dir ):173 msg = "SasView couldn't locate Model plugin folder %r." % dir 172 if not os.path.isdir(directory): 173 msg = "SasView couldn't locate Model plugin folder %r." % directory 174 174 logger.warning(msg) 175 175 return {} 176 176 177 plugin_log("looking for models in: %s" % str(dir ))178 # compile_file(dir) #always recompile the folder plugin179 logger.info("plugin model dir: %s" % str(dir ))177 plugin_log("looking for models in: %s" % str(directory)) 178 # compile_file(directory) #always recompile the folder plugin 179 logger.info("plugin model dir: %s" % str(directory)) 180 180 181 181 plugins = {} 182 for filename in os.listdir(dir ):182 for filename in os.listdir(directory): 183 183 name, ext = os.path.splitext(filename) 184 184 if ext == '.py' and not name == '__init__': 185 path = os.path.abspath(os.path.join(dir , filename))185 path = os.path.abspath(os.path.join(directory, filename)) 186 186 try: 187 187 model = load_custom_model(path) 188 model.name = PLUGIN_NAME_BASE + model.name 188 if not model.name.count(PLUGIN_NAME_BASE): 189 model.name = PLUGIN_NAME_BASE + model.name 189 190 plugins[model.name] = model 190 191 except Exception: … … 193 194 plugin_log(msg) 194 195 logger.warning("Failed to load plugin %r. See %s for details" 195 196 196 % (path, PLUGIN_LOG)) 197 197 198 return plugins 198 199 … … 264 265 temp = {} 265 266 if self.is_changed(): 266 return _find Models(dir)267 return _find_models() 267 268 logger.info("plugin model : %s" % str(temp)) 268 269 return temp … … 297 298 for name, plug in self.stored_plugins.iteritems(): 298 299 self.model_dictionary[name] = plug 299 300 300 301 self._get_multifunc_models() 301 302 … … 339 340 """ 340 341 self.plugins = [] 341 new_plugins = _find Models(dir)342 new_plugins = _find_models() 342 343 for name, plug in new_plugins.iteritems(): 343 344 for stored_name, stored_plug in self.stored_plugins.iteritems():
Note: See TracChangeset
for help on using the changeset viewer.