Changes in src/sas/sasgui/guiframe/gui_manager.py [64ca561:73cbeec] in sasview
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sasgui/guiframe/gui_manager.py
r64ca561 r73cbeec 48 48 from matplotlib import _pylab_helpers 49 49 50 logger = logging.getLogger(__name__)51 52 50 warnings.simplefilter("ignore") 51 53 52 54 53 def get_app_dir(): … … 65 64 if os.path.isfile(os.path.join(app_path, "custom_config.py")): 66 65 app_path = os.path.abspath(app_path) 67 logg er.info("Using application path: %s", app_path)66 logging.info("Using application path: %s", app_path) 68 67 return app_path 69 68 70 69 # Next, try the current working directory 71 70 if os.path.isfile(os.path.join(os.getcwd(), "custom_config.py")): 72 logg er.info("Using application path: %s", os.getcwd())71 logging.info("Using application path: %s", os.getcwd()) 73 72 return os.path.abspath(os.getcwd()) 74 73 … … 77 76 # clean all these module variables and put them into a config class 78 77 # that can be passed by sasview.py. 79 logg er.info(sys.executable)80 logg er.info(str(sys.argv))78 logging.info(sys.executable) 79 logging.info(str(sys.argv)) 81 80 from sas import sasview as sasview 82 81 app_path = os.path.dirname(sasview.__file__) 83 logg er.info("Using application path: %s", app_path)82 logging.info("Using application path: %s", app_path) 84 83 return app_path 85 84 … … 105 104 config_module = imp.load_module(file, fObj, path_config, descr) 106 105 except: 107 logg er.error("Error loading %s/%s: %s" % (path, file, sys.exc_value))106 logging.error("Error loading %s/%s: %s" % (path, file, sys.exc_value)) 108 107 finally: 109 108 if fObj is not None: 110 109 fObj.close() 111 logg er.info("GuiManager loaded %s/%s" % (path, file))110 logging.info("GuiManager loaded %s/%s" % (path, file)) 112 111 return config_module 113 112 … … 126 125 # Didn't find local config, load the default 127 126 import sas.sasgui.guiframe.config as config 128 logg er.info("using default local_config")127 logging.info("using default local_config") 129 128 else: 130 logg er.info("found local_config in %s" % os.getcwd())129 logging.info("found local_config in %s" % os.getcwd()) 131 130 else: 132 logg er.info("found local_config in %s" % PATH_APP)131 logging.info("found local_config in %s" % PATH_APP) 133 132 134 133 from sas.sasgui.guiframe.customdir import SetupCustom … … 139 138 if custom_config is None: 140 139 msgConfig = "Custom_config file was not imported" 141 logg er.info(msgConfig)140 logging.info(msgConfig) 142 141 else: 143 logg er.info("using custom_config in %s" % os.getcwd())142 logging.info("using custom_config in %s" % os.getcwd()) 144 143 else: 145 logg er.info("using custom_config from %s" % c_conf_dir)144 logging.info("using custom_config from %s" % c_conf_dir) 146 145 147 146 # read some constants from config … … 375 374 frame.SetIcon(icon) 376 375 except: 377 logg er.error("ViewerFrame.put_icon: could not set icon")376 logging.error("ViewerFrame.put_icon: could not set icon") 378 377 379 378 def get_client_size(self): … … 804 803 str(self._input_file)) 805 804 msg += str(sys.exc_value) + '\n' 806 logg er.error(msg)805 logging.error(msg) 807 806 if self._data_panel is not None and len(self.plugins) > 0: 808 807 self._data_panel.fill_cbox_analysis(self.plugins) … … 870 869 if plugin.__class__ == item.__class__: 871 870 msg = "Plugin %s already loaded" % plugin.sub_menu 872 logg er.info(msg)871 logging.info(msg) 873 872 is_loaded = True 874 873 if not is_loaded: 875 874 self.plugins.append(plugin) 876 875 msg = "Plugin %s appended" % plugin.sub_menu 877 logg er.info(msg)876 logging.info(msg) 878 877 879 878 def _get_local_plugins(self): … … 895 894 msg = "ViewerFrame._get_local_plugins:" 896 895 msg += "cannot import dataloader plugin.\n %s" % sys.exc_value 897 logg er.error(msg)896 logging.error(msg) 898 897 if style2 == GUIFRAME.PLOTTING_ON: 899 898 try: … … 905 904 msg = "ViewerFrame._get_local_plugins:" 906 905 msg += "cannot import plotting plugin.\n %s" % sys.exc_value 907 logg er.error(msg)906 logging.error(msg) 908 907 909 908 return plugins … … 950 949 plugins.append(module.Plugin()) 951 950 msg = "Found plug-in: %s" % module.PLUGIN_ID 952 logg er.info(msg)951 logging.info(msg) 953 952 except: 954 953 msg = "Error accessing PluginPanel" … … 957 956 except: 958 957 msg = "ViewerFrame._find_plugins: %s" % sys.exc_value 959 logg er.error(msg)958 logging.error(msg) 960 959 finally: 961 960 if file is not None: … … 964 963 # Should raise and catch at a higher level and 965 964 # display error on status bar 966 logg er.error(sys.exc_value)965 logging.error(sys.exc_value) 967 966 968 967 return plugins … … 1386 1385 1387 1386 if config._do_aboutbox: 1388 logg er.info("Doing help menu")1387 logging.info("Doing help menu") 1389 1388 wx_id = wx.NewId() 1390 1389 self._help_menu.Append(wx_id, '&About', 'Software information') … … 1747 1746 del self.panels[ID] 1748 1747 else: 1749 logg er.error("delete_panel: No such plot id as %s" % ID)1748 logging.error("delete_panel: No such plot id as %s" % ID) 1750 1749 1751 1750 def create_gui_data(self, data, path=None): … … 1764 1763 log_msg += "load: %s\n" % str(basename) 1765 1764 log_msg += "Try Data opening...." 1766 logg er.error(log_msg)1765 logging.error(log_msg) 1767 1766 return 1768 1767 … … 1844 1843 log_msg += "load: %s\n" % str(path) 1845 1844 log_msg += "Try File opening ...." 1846 logg er.error(log_msg)1845 logging.error(log_msg) 1847 1846 return 1848 1847 log_msg = '' … … 1850 1849 error_message = "" 1851 1850 try: 1852 logg er.info("Loading Data...:\n" + str(path) + "\n")1851 logging.info("Loading Data...:\n" + str(path) + "\n") 1853 1852 temp = self.loader.load(path) 1854 1853 if temp.__class__.__name__ == "list": … … 1865 1864 error_message += " Data from cmd:\n %s\n" % str(path) 1866 1865 error_message += str(sys.exc_value) + "\n" 1867 logg er.error(error_message)1866 logging.error(error_message) 1868 1867 1869 1868 def load_folder(self, path): … … 1886 1885 error_message += " Data folder from cmd:\n %s\n" % str(path) 1887 1886 error_message += str(sys.exc_value) + "\n" 1888 logg er.error(error_message)1887 logging.error(error_message) 1889 1888 1890 1889 def _on_open_state_application(self, event): … … 2045 2044 msg += "and model selected. " 2046 2045 msg += "No project was saved to %s" % (str(path)) 2047 logg er.warning(msg)2046 logging.warning(msg) 2048 2047 wx.PostEvent(self, StatusEvent(status=msg, info="error")) 2049 2048 except Exception: … … 2112 2111 #IF SAS_OPENCL is set, settings are stored in the custom config file 2113 2112 self._write_opencl_config_file() 2114 logg er.info(" --- SasView session was closed --- \n")2113 logging.info(" --- SasView session was closed --- \n") 2115 2114 wx.Exit() 2116 2115 sys.exit() … … 2141 2140 new_config_file.close() 2142 2141 else: 2143 logg er.info("Failed to save OPENCL settings in custom config file")2142 logging.info("Failed to save OPENCL settings in custom config file") 2144 2143 2145 2144 … … 2158 2157 # 2159 2158 content = response.read().strip() 2160 logg er.info("Connected to www.sasview.org. Latest version: %s"2159 logging.info("Connected to www.sasview.org. Latest version: %s" 2161 2160 % (content)) 2162 2161 version_info = json.loads(content) 2163 2162 except: 2164 logg er.info("Failed to connect to www.sasview.org")2163 logging.info("Failed to connect to www.sasview.org") 2165 2164 self._process_version(version_info, standalone=event is None) 2166 2165 … … 2202 2201 msg = "guiframe: could not get latest application" 2203 2202 msg += " version number\n %s" % sys.exc_value 2204 logg er.error(msg)2203 logging.error(msg) 2205 2204 if not standalone: 2206 2205 msg = "Could not connect to the application server." … … 2249 2248 dialog.Show(True) 2250 2249 except: 2251 logg er.error("Error in _onTutorial: %s" % sys.exc_value)2250 logging.error("Error in _onTutorial: %s" % sys.exc_value) 2252 2251 try: 2253 2252 # Try an alternate method 2254 logg er.error(2253 logging.error( 2255 2254 "Could not open the tutorial pdf, trying xhtml2pdf") 2256 2255 from xhtml2pdf import pisa 2257 2256 pisa.startViewer(path) 2258 2257 except: 2259 logg er.error(2258 logging.error( 2260 2259 "Could not open the tutorial pdf with xhtml2pdf") 2261 2260 msg = "This feature requires 'PDF Viewer'\n" … … 2268 2267 try: 2269 2268 # Try an alternate method 2270 logg er.error(2269 logging.error( 2271 2270 "Could not open the tutorial pdf, trying xhtml2pdf") 2272 2271 from xhtml2pdf import pisa 2273 2272 pisa.startViewer(path) 2274 2273 except: 2275 logg er.error(2274 logging.error( 2276 2275 "Could not open the tutorial pdf with xhtml2pdf") 2277 2276 msg = "This feature requires the Preview application\n" … … 2412 2411 else: 2413 2412 msg = "Guiframe does not have a current perspective" 2414 logg er.info(msg)2413 logging.info(msg) 2415 2414 2416 2415 def set_theory(self, state_id, theory_id=None): … … 2423 2422 except: 2424 2423 msg = "Guiframe set_theory: \n" + str(sys.exc_value) 2425 logg er.info(msg)2424 logging.info(msg) 2426 2425 wx.PostEvent(self, StatusEvent(status=msg, info="error")) 2427 2426 else: 2428 2427 msg = "Guiframe does not have a current perspective" 2429 logg er.info(msg)2428 logging.info(msg) 2430 2429 2431 2430 def plot_data(self, state_id, data_id=None, … … 2509 2508 action='remove')) 2510 2509 except: 2511 logg er.error(sys.exc_value)2510 logging.error(sys.exc_value) 2512 2511 2513 2512 def save_data1d(self, data, fname): … … 3307 3306 msg = "%s Could not load " % str(APPLICATION_NAME) 3308 3307 msg += "input file from command line.\n" 3309 logg er.error(msg)3308 logging.error(msg) 3310 3309 # Display a splash screen on top of the frame. 3311 3310 try: … … 3321 3320 msg = "Cannot display splash screen\n" 3322 3321 msg += str(sys.exc_value) 3323 logg er.error(msg)3322 logging.error(msg) 3324 3323 self.frame.Show() 3325 3324 … … 3376 3375 os.remove(file_path) 3377 3376 except: 3378 logg er.error("gui_manager.clean_plugin_models:\n %s"3377 logging.error("gui_manager.clean_plugin_models:\n %s" 3379 3378 % sys.exc_value) 3380 3379
Note: See TracChangeset
for help on using the changeset viewer.