Ignore:
Timestamp:
Nov 9, 2017 6:41:54 AM (6 years ago)
Author:
Piotr Rozyczko <rozyczko@…>
Branches:
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
Children:
cee5c78
Parents:
749b715
git-author:
Piotr Rozyczko <rozyczko@…> (10/26/17 01:13:05)
git-committer:
Piotr Rozyczko <rozyczko@…> (11/09/17 06:41:54)
Message:

Initial changes to make SasView? run with python3

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sas/qtgui/Perspectives/Fitting/ModelUtilities.py

    r125c4be rb3e8629  
    22    Utilities to manage models 
    33""" 
    4 from __future__ import print_function 
     4 
    55 
    66import traceback 
     
    6868    except: 
    6969        msg = "Plugin %s error in __init__ \n\t: %s %s\n" % (str(name), 
    70                                                              str(sys.exc_type), 
     70                                                             str(sys.exc_info()[0]), 
    7171                                                             sys.exc_info()[1]) 
    7272        plugin_log(msg) 
     
    7878        except: 
    7979            msg = "Plugin %s: error writing function \n\t :%s %s\n " % \ 
    80                     (str(name), str(sys.exc_type), sys.exc_info()[1]) 
     80                    (str(name), str(sys.exc_info()[0]), sys.exc_info()[1]) 
    8181            plugin_log(msg) 
    8282            return None 
     
    138138    Class to check for problems with specific values 
    139139    """ 
    140     def __nonzero__(self): 
     140    def __bool__(self): 
    141141        type, value, tb = sys.exc_info() 
    142142        if type is not None and issubclass(type, py_compile.PyCompileError): 
    143143            print("Problem with", repr(value)) 
    144             raise type, value, tb 
     144            raise type(value).with_traceback(tb) 
    145145        return 1 
    146146 
     
    211211 
    212212        """ 
    213         if name not in self.mydict.keys(): 
     213        if name not in list(self.mydict.keys()): 
    214214            self.reset_list(name, mylist) 
    215215 
     
    292292        #Looking for plugins 
    293293        self.stored_plugins = self.findModels() 
    294         self.plugins = self.stored_plugins.values() 
    295         for name, plug in self.stored_plugins.iteritems(): 
     294        self.plugins = list(self.stored_plugins.values()) 
     295        for name, plug in self.stored_plugins.items(): 
    296296            self.model_dictionary[name] = plug 
    297297         
     
    322322        new_plugins = self.findModels() 
    323323        if len(new_plugins) > 0: 
    324             for name, plug in  new_plugins.iteritems(): 
    325                 if name not in self.stored_plugins.keys(): 
     324            for name, plug in  new_plugins.items(): 
     325                if name not in list(self.stored_plugins.keys()): 
    326326                    self.stored_plugins[name] = plug 
    327327                    self.plugins.append(plug) 
     
    338338        self.plugins = [] 
    339339        new_plugins = _find_models() 
    340         for name, plug in  new_plugins.iteritems(): 
    341             for stored_name, stored_plug in self.stored_plugins.iteritems(): 
     340        for name, plug in  new_plugins.items(): 
     341            for stored_name, stored_plug in self.stored_plugins.items(): 
    342342                if name == stored_name: 
    343343                    del self.stored_plugins[name] 
     
    358358 
    359359        """ 
    360         if int(evt.GetId()) in self.form_factor_dict.keys(): 
     360        if int(evt.GetId()) in list(self.form_factor_dict.keys()): 
    361361            from sasmodels.sasview_model import MultiplicationModel 
    362362            self.model_dictionary[MultiplicationModel.__name__] = MultiplicationModel 
     
    417417    __modelmanager = ModelManagerBase() 
    418418    cat_model_list = [__modelmanager.model_dictionary[model_name] for model_name \ 
    419                       in __modelmanager.model_dictionary.keys() \ 
    420                       if model_name not in __modelmanager.stored_plugins.keys()] 
     419                      in list(__modelmanager.model_dictionary.keys()) \ 
     420                      if model_name not in list(__modelmanager.stored_plugins.keys())] 
    421421 
    422422    CategoryInstaller.check_install(model_list=cat_model_list) 
Note: See TracChangeset for help on using the changeset viewer.