Changeset 61184df in sasview


Ignore:
Timestamp:
Apr 13, 2012 7:20:25 AM (12 years ago)
Author:
Mathieu Doucet <doucetm@…>
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
Message:

Fixing code style problems and bugs

File:
1 edited

Legend:

Unmodified
Added
Removed
  • fittingview/src/sans/perspectives/fitting/models.py

    r543d1bd r61184df  
    1  
     1""" 
     2    Utilities to manage models 
     3""" 
    24import wx 
    35import wx.lib.newevent 
     
    2224def log(message): 
    2325    """ 
    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) 
    2629    out = open(os.path.join(dir, "plugins.log"), 'a') 
    2730    out.write("%10g:  %s\n" % (time.clock(), message)) 
     
    4144    #Check is the plugin is of type Model1DPlugin 
    4245    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) 
    4447        log(msg) 
    4548        return None 
    4649    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) 
    4851        log(msg) 
    4952        return None 
     
    5154        new_instance= model() 
    5255    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) 
    5558        log(msg) 
    5659        return None 
     
    6164           value=new_instance.function() 
    6265        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) 
    6568           log(msg) 
    6669           return None 
    6770    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) 
    6972       log(msg) 
    7073       return None 
     
    7679        The plugin directory is located in the user's home directory. 
    7780    """ 
    78     dir = os.path.join(os.path.expanduser("~"),'.sansview', PLUGIN_DIR) 
     81    dir = os.path.join(os.path.expanduser("~"), '.sansview', PLUGIN_DIR) 
    7982     
    8083    # If the plugin directory doesn't exist, create it 
     
    144147    # Go through files in plug-in directory 
    145148    #always recompile the folder plugin 
    146     import compileall 
    147149    dir = find_plugins_dir() 
    148150    if not os.path.isdir(dir): 
     
    225227class ModelManagerBase: 
    226228    """ 
     229        Base class for the model manager 
    227230    """ 
    228231    ## external dict for models 
     
    768771        else: 
    769772            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) 
    772778         
    773779    def _get_multifunc_models(self): 
Note: See TracChangeset for help on using the changeset viewer.