Changeset 61184df in sasview
- Timestamp:
- Apr 13, 2012 9:20:25 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:
- 6d8bad4
- Parents:
- 14cd6b92
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
fittingview/src/sans/perspectives/fitting/models.py
r543d1bd r61184df 1 1 """ 2 Utilities to manage models 3 """ 2 4 import wx 3 5 import wx.lib.newevent … … 22 24 def log(message): 23 25 """ 24 """ 25 dir = os.path.join(os.path.expanduser("~"),'.sansview', PLUGIN_DIR) 26 Log a message in a file located in the user's home directory 27 """ 28 dir = os.path.join(os.path.expanduser("~"), '.sansview', PLUGIN_DIR) 26 29 out = open(os.path.join(dir, "plugins.log"), 'a') 27 30 out.write("%10g: %s\n" % (time.clock(), message)) … … 41 44 #Check is the plugin is of type Model1DPlugin 42 45 if not issubclass(model, Model1DPlugin): 43 msg = "Plugin %s must be of type Model1DPlugin \n" %str(name)46 msg = "Plugin %s must be of type Model1DPlugin \n" % str(name) 44 47 log(msg) 45 48 return None 46 49 if model.__name__!="Model": 47 msg= "Plugin %s class name must be Model \n" %str(name)50 msg= "Plugin %s class name must be Model \n" % str(name) 48 51 log(msg) 49 52 return None … … 51 54 new_instance= model() 52 55 except: 53 msg="Plugin %s error in __init__ \n\t: %s %s\n" %(str(name),54 str(sys.exc_type), sys.exc_value)56 msg="Plugin %s error in __init__ \n\t: %s %s\n" % (str(name), 57 str(sys.exc_type), sys.exc_value) 55 58 log(msg) 56 59 return None … … 61 64 value=new_instance.function() 62 65 except: 63 msg="Plugin %s: error writing function \n\t :%s %s\n " %(str(name),64 str(sys.exc_type), sys.exc_value)66 msg="Plugin %s: error writing function \n\t :%s %s\n " % (str(name), 67 str(sys.exc_type), sys.exc_value) 65 68 log(msg) 66 69 return None 67 70 else: 68 msg="Plugin %s needs a method called function \n" %str(name)71 msg="Plugin %s needs a method called function \n" % str(name) 69 72 log(msg) 70 73 return None … … 76 79 The plugin directory is located in the user's home directory. 77 80 """ 78 dir = os.path.join(os.path.expanduser("~"), '.sansview', PLUGIN_DIR)81 dir = os.path.join(os.path.expanduser("~"), '.sansview', PLUGIN_DIR) 79 82 80 83 # If the plugin directory doesn't exist, create it … … 144 147 # Go through files in plug-in directory 145 148 #always recompile the folder plugin 146 import compileall147 149 dir = find_plugins_dir() 148 150 if not os.path.isdir(dir): … … 225 227 class ModelManagerBase: 226 228 """ 229 Base class for the model manager 227 230 """ 228 231 ## external dict for models … … 768 771 else: 769 772 model= self.struct_factor_dict[str(evt.GetId())]() 770 evt = ModelEvent(model=model) 771 wx.PostEvent(self.event_owner, evt) 773 774 #TODO: investigate why the following two lines were left in the code 775 # even though the ModelEvent class doesn't exist 776 #evt = ModelEvent(model=model) 777 #wx.PostEvent(self.event_owner, evt) 772 778 773 779 def _get_multifunc_models(self):
Note: See TracChangeset
for help on using the changeset viewer.