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