Changeset 19b5c5c9 in sasview
- Timestamp:
- Jul 14, 2011 2:27:37 PM (13 years ago)
- 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
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
guiframe/gui_manager.py
r8d8415f r19b5c5c9 20 20 # Try to find a local config 21 21 import 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]) 22 tem_path = sys.path[0] 23 if os.path.isfile(tem_path): 24 tem_path = os.path.dirname(tem_path) 25 os.chdir(tem_path) 26 PATH_APP = os.getcwd() 27 if(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]) 26 30 try: 27 31 config = imp.load_module('local_config', fObj, path_config, descr) … … 35 39 # Try simply importing local_config 36 40 import local_config as config 37 #path = os.path.sys.path[0]38 PATH_APP = path39 41 40 42 #import compileall 41 43 import py_compile 42 c_name = os.path.join(path, 'custom_config.py') 43 if(os.path.isfile("%s/%s.py" % (path, 'custom_config'))): 44 45 c_name = os.path.join(PATH_APP, 'custom_config.py') 46 if(os.path.isfile("%s/%s.py" % (PATH_APP, 'custom_config'))): 44 47 py_compile.compile(file=c_name) 45 48 #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]) 47 50 try: 48 custom_config = imp.load_module('custom_config', cfObj, path, descr)51 custom_config = imp.load_module('custom_config', cfObj, PATH_APP, descr) 49 52 except: 50 53 custom_config = None … … 976 979 977 980 self.panel = ConfDialog(parent=self, gui=self.__gui_style) 978 #self.panel.Bind(wx.EVT_CLOSE, self._draw_masked_model)979 981 self.panel.ShowModal() 980 982 #wx.PostEvent(self.parent, event) 981 983 982 def _draw_masked_model(self,event):983 """984 Draw model image w/mask985 """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 exists992 self._draw_model()993 self.panel.Destroy() # frame994 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)1003 984 1004 985 def _add_menu_window(self): … … 2524 2505 self.frame.Hide() 2525 2506 self.s_screen = None 2507 temp_path = None 2526 2508 try: 2527 2509 # 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]) 2529 2511 os.chdir(temp_path) 2530 2512 except: 2531 2513 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) 2532 2520 # Display a splash screen on top of the frame. 2533 2521 if len(sys.argv) > 1 and '--time' in sys.argv[1:]: … … 2546 2534 logging.error(msg) 2547 2535 self.frame.Show() 2548 2536 2549 2537 if hasattr(self.frame, 'special'): 2550 2538 self.frame.special.SetCurrent() 2551 2539 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 2558 2541 return True 2559 2542 … … 2565 2548 if len(sys.argv) >= 2: 2566 2549 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]: 2573 2557 input_file = sys.argv[1] 2574 2558 if input_file is None:
Note: See TracChangeset
for help on using the changeset viewer.