Ignore:
Timestamp:
Jan 4, 2017 8:19:24 AM (7 years ago)
Author:
wojciech
Children:
c85679b
Parents:
25594ca
Message:

Writting to configuration file at the end of session

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sas/sasgui/guiframe/gui_manager.py

    rb39debba r2a1b92eb  
    21092109        Quit the application 
    21102110        """ 
     2111        #IF SAS_OPENCL is set, settings are stored in the custom config file 
     2112        if "SAS_OPENCL" in os.environ: 
     2113            self._write_opencl_config_file() 
    21112114        logging.info(" --- SasView session was closed --- \n") 
    21122115        wx.Exit() 
    21132116        sys.exit() 
     2117 
     2118    def _write_opencl_config_file(self): 
     2119        #from sas.sasgui.guiframe.customdir import SetupCustom 
     2120        #from sas.sasgui.guiframe.gui_manager import _find_local_config 
     2121 
     2122        sas_opencl = os.environ.get("SAS_OPENCL","") 
     2123        #How to store it in file 
     2124        new_config_lines = [] 
     2125        config_file = open(custom_config.__file__) 
     2126        if custom_config is not None: 
     2127            config_lines = config_file.readlines() 
     2128            for line in config_lines: 
     2129                if "SAS_OPENCL" in line: 
     2130                    if sas_opencl: 
     2131                        new_config_lines.append("SAS_OPENCL = \""+sas_opencl+"\"") 
     2132                    else: 
     2133                        new_config_lines.append("SAS_OPENCL = None") 
     2134                else: 
     2135                    new_config_lines.append(line) 
     2136        config_file.close() 
     2137        new_config_file = open(custom_config.__file__,"w") 
     2138        new_config_file.writelines(new_config_lines) 
     2139        new_config_file.close() 
     2140 
    21142141 
    21152142    def _check_update(self, event=None): 
Note: See TracChangeset for help on using the changeset viewer.