Changeset 19b5c5c9 in sasview


Ignore:
Timestamp:
Jul 14, 2011 2:27:37 PM (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:
ce180bd
Parents:
7f291a3
Message:

made changes to fit the implementation of SANSVIEWPATH env.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • guiframe/gui_manager.py

    r8d8415f r19b5c5c9  
    2020# Try to find a local config 
    2121import imp 
    22 path = os.getcwd() 
    23 if(os.path.isfile("%s/%s.py" % (path, 'local_config'))) or \ 
    24     (os.path.isfile("%s/%s.pyc" % (path, 'local_config'))): 
    25     fObj, path_config, descr = imp.find_module('local_config', [path]) 
     22tem_path = sys.path[0] 
     23if os.path.isfile(tem_path): 
     24    tem_path = os.path.dirname(tem_path) 
     25os.chdir(tem_path) 
     26PATH_APP = os.getcwd() 
     27if(os.path.isfile("%s/%s.py" % (PATH_APP, 'local_config'))) or \ 
     28    (os.path.isfile("%s/%s.pyc" % (PATH_APP, 'local_config'))): 
     29    fObj, path_config, descr = imp.find_module('local_config', [PATH_APP]) 
    2630    try: 
    2731        config = imp.load_module('local_config', fObj, path_config, descr)  
     
    3539    # Try simply importing local_config 
    3640    import local_config as config 
    37 #path = os.path.sys.path[0] 
    38 PATH_APP = path 
    3941 
    4042#import compileall 
    4143import py_compile 
    42 c_name = os.path.join(path, 'custom_config.py') 
    43 if(os.path.isfile("%s/%s.py" % (path, 'custom_config'))): 
     44 
     45c_name = os.path.join(PATH_APP, 'custom_config.py') 
     46if(os.path.isfile("%s/%s.py" % (PATH_APP, 'custom_config'))): 
    4447    py_compile.compile(file=c_name) 
    4548    #compileall.compile_dir(dir=path, force=True, quiet=0) 
    46     cfObj, path_cconfig, descr = imp.find_module('custom_config', [path])  
     49    cfObj, path_cconfig, descr = imp.find_module('custom_config', [PATH_APP])  
    4750try: 
    48     custom_config = imp.load_module('custom_config', cfObj, path, descr) 
     51    custom_config = imp.load_module('custom_config', cfObj, PATH_APP, descr) 
    4952except: 
    5053    custom_config = None 
     
    976979         
    977980        self.panel = ConfDialog(parent=self, gui=self.__gui_style) 
    978         #self.panel.Bind(wx.EVT_CLOSE, self._draw_masked_model) 
    979981        self.panel.ShowModal() 
    980982        #wx.PostEvent(self.parent, event) 
    981983         
    982     def _draw_masked_model(self,event): 
    983         """ 
    984         Draw model image w/mask 
    985         """ 
    986         event.Skip() 
    987  
    988         is_valid_qrange = self._update_paramv_on_fit() 
    989  
    990         if is_valid_qrange: 
    991             # try re draw the model plot if it exists 
    992             self._draw_model() 
    993             self.panel.Destroy() # frame 
    994             self.set_npts2fit() 
    995         elif self.model == None: 
    996             self.panel.Destroy() 
    997             self.set_npts2fit() 
    998             msg= "No model is found on updating MASK in the model plot... " 
    999             wx.PostEvent(self.parent.parent, StatusEvent(status = msg )) 
    1000         else: 
    1001             msg = ' Please consider your Q range, too.' 
    1002             self.panel.ShowMessage(msg) 
    1003984 
    1004985    def _add_menu_window(self): 
     
    25242505        self.frame.Hide() 
    25252506        self.s_screen = None 
     2507        temp_path = None 
    25262508        try: 
    25272509            # make sure the current dir is App dir when it starts 
    2528             temp_path = os.path.dirname(os.path.sys.path[0]) 
     2510            temp_path = os.path.dirname(sys.path[0]) 
    25292511            os.chdir(temp_path) 
    25302512        except: 
    25312513            pass 
     2514        try: 
     2515            self.open_file() 
     2516        except: 
     2517            msg = "%s Could not load " % str(APPLICATION_NAME) 
     2518            msg += "input file from command line.\n" 
     2519            logging.error(msg) 
    25322520        # Display a splash screen on top of the frame. 
    25332521        if len(sys.argv) > 1 and '--time' in sys.argv[1:]: 
     
    25462534            logging.error(msg) 
    25472535            self.frame.Show() 
    2548             
     2536  
    25492537        if hasattr(self.frame, 'special'): 
    25502538            self.frame.special.SetCurrent() 
    25512539        self.SetTopWindow(self.frame) 
    2552         try: 
    2553             self.open_file() 
    2554         except: 
    2555             msg = "%s Could not load " % str(APPLICATION_NAME) 
    2556             msg += "input file from command line.\n" 
    2557             logging.error(msg) 
     2540   
    25582541        return True 
    25592542 
     
    25652548        if len(sys.argv) >= 2: 
    25662549            cmd = sys.argv[0].lower() 
    2567             if os.path.isfile(cmd): 
    2568                 basename  = os.path.basename(cmd) 
    2569                 app_py = str(APPLICATION_NAME).lower() + '.py' 
    2570                 app_exe = str(APPLICATION_NAME).lower() + '.exe' 
    2571                 app_app = str(APPLICATION_NAME).lower() + '.app' 
    2572                 if basename.lower() in [app_py, app_exe, app_app]: 
     2550            basename  = os.path.basename(cmd) 
     2551            app_base = str(APPLICATION_NAME).lower() 
     2552            if os.path.isfile(cmd) or basename.lower() == app_base: 
     2553                app_py = app_base + '.py' 
     2554                app_exe = app_base + '.exe' 
     2555                app_app = app_base + '.app' 
     2556                if basename.lower() in [app_py, app_exe, app_app, app_base]: 
    25732557                    input_file = sys.argv[1] 
    25742558        if input_file is None: 
Note: See TracChangeset for help on using the changeset viewer.