Changeset e9f6979 in sasview for sansguiframe


Ignore:
Timestamp:
Dec 23, 2011 8:05:36 AM (13 years ago)
Author:
Jae Cho <jhjcho@…>
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:
27f1ddb
Parents:
1eae432
Message:

Now got all the startup path right

File:
1 edited

Legend:

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

    r1eae432 re9f6979  
    4242from sans.dataloader.loader import Loader 
    4343 
    44 from sans import sansview 
    45 PATH_APP = os.path.dirname(sansview.__file__) 
    46 DATAPATH = PATH_APP 
    47  
    48 def _change_current_dir(): 
     44# gui_manager should not know about sansview 
     45#from sans import sansview 
     46#PATH_APP = os.path.dirname(sansview.__file__) 
     47 
     48def get_app_dir(): 
    4949    """ 
    50     Get the path of the current file 
    51     This is for openning sansview/data file from command line 
     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 
    5252    """ 
    5353    tem_path = sys.path[0] 
    5454    if os.path.isfile(tem_path): 
    5555        tem_path = os.path.dirname(tem_path) 
    56      
    57     os.chdir(os.path.abspath(tem_path)) 
    58 _change_current_dir()    
     56    return os.path.abspath(tem_path) 
    5957 
    6058def get_user_directory(): 
     
    8078    return config_module 
    8179 
     80# Get APP folder 
     81PATH_APP = get_app_dir()  
     82DATAPATH = PATH_APP 
     83 
     84# GUI always starts from the App folder  
     85os.chdir(PATH_APP) 
    8286# Read in the local config, which can either be with the main 
    8387# application or in the installation directory 
     
    292296        self.Bind(EVT_NEW_COLOR, self.on_color_selection) 
    293297        self.setup_custom_conf() 
    294      
     298         
    295299    def add_icon(self): 
    296300        """ 
     
    30323036        self.frame.Hide() 
    30333037        self.s_screen = None 
    3034         temp_path = None 
    3035         try: 
    3036             _change_current_dir() 
    3037         except: 
    3038             pass 
     3038 
    30393039        try: 
    30403040            self.open_file() 
Note: See TracChangeset for help on using the changeset viewer.