Changeset cda697a in sasview


Ignore:
Timestamp:
Jan 11, 2012 11:04:29 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:
aa07420
Parents:
9520702
Message:

Remove app path problem until we clean up the config

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sansguiframe/src/sans/guiframe/gui_manager.py

    r176fbf1 rcda697a  
    4848def get_app_dir(): 
    4949    """ 
    50     Get the path of the current app (whatever among SansView/PrView/...)  
    51     This is mainly for running app/data file from the command line 
     50      Return sansview dir until we clean up the gui_manager configuration. 
     51      There should be a proper config class so that we don't need all 
     52      the complexity currently used to figure out where things are. 
    5253    """ 
    53     tem_path = sys.path[0] 
    54     if os.path.isfile(tem_path): 
    55         tem_path = os.path.dirname(tem_path) 
    56     return os.path.abspath(tem_path) 
     54    from sans import sansview 
     55    return os.path.dirname(sansview.__file__) 
    5756 
    5857def get_user_directory(): 
     
    8382 
    8483# GUI always starts from the App folder  
    85 os.chdir(PATH_APP) 
     84#os.chdir(PATH_APP) 
    8685# Read in the local config, which can either be with the main 
    8786# application or in the installation directory 
     
    8988if config is None: 
    9089    config = _find_local_config('local_config', os.getcwd()) 
    91 if config is None: 
    92     # Didn't find local config, load the default  
    93     import sans.guiframe.config as config           
    94         
     90    if config is None: 
     91        # Didn't find local config, load the default  
     92        import sans.guiframe.config as config 
     93        logging.info("using default local_config")         
     94    else: 
     95        logging.info("found local_config in %s" % os.getcwd())   
     96else: 
     97    logging.info("found local_config in %s" % PATH_APP)      
     98            
    9599from sans.guiframe.customdir  import SetupCustom 
    96100c_conf_dir = SetupCustom().setup_dir(PATH_APP) 
     
    98102if custom_config is None: 
    99103    custom_config = _find_local_config('custom_config', os.getcwd()) 
    100 if custom_config is None: 
    101     msg = "Custom_config file was not imported" 
    102     logging.info(msg) 
    103      
     104    if custom_config is None: 
     105        msg = "Custom_config file was not imported" 
     106        logging.info(msg) 
     107    else: 
     108        logging.info("using custom_config in %s" % os.getcwd()) 
     109else: 
     110    logging.info("using custom_config from %s" % c_conf_dir) 
    104111 
    105112#read some constants from config 
Note: See TracChangeset for help on using the changeset viewer.