Changeset dad7cef in sasview


Ignore:
Timestamp:
Sep 21, 2012 9:31:54 AM (12 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:
944724a
Parents:
2bb625f
Message:

more flexible finding of default cat folder

File:
1 edited

Legend:

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

    r4f973f3 rdad7cef  
    66 
    77@author kieranrcampbell@gmail.com 
    8 @modified by NIST/MD sanview team 
     8@modified by NIST/MD sasview team 
    99""" 
    1010 
     
    4343        import sans.perspectives.fitting.models 
    4444        return sans.perspectives.fitting.models.get_model_python_path() 
     45     
    4546    @staticmethod 
    4647    def _get_default_cat_p_dir(): 
     
    4849        returns the dir where default_cat.p should be 
    4950        """ 
    50         app_path = sys.path[0] 
    51         if os.path.isfile(app_path): 
    52             app_path = os.path.dirname(app_path) 
    53         return app_path 
     51        cat_file = "default_categories.p" 
     52        app_dir = sys.path[0] 
     53        if os.path.isfile(app_dir): 
     54            app_dir = os.path.dirname(app_dir) 
     55        n_dir = 12 
     56        for i in range(n_dir):  
     57            path = os.path.join(app_dir, cat_file) 
     58            if os.path.isfile(path): 
     59                path = os.path.dirname(path) 
     60                return path 
     61            else: 
     62                app_dir, _ = os.path.split(app_dir) 
     63                 
     64        raise RuntimeError('Could not find the App folder')          
    5465 
    5566    @staticmethod 
Note: See TracChangeset for help on using the changeset viewer.