Changeset 415fb82 in sasview for sasview/sasview.py
- Timestamp:
- Apr 1, 2015 12:57:33 PM (9 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:
- 5f0be1f
- Parents:
- c4a7660
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sasview/sasview.py
r4e080980 r415fb82 1 1 """ 2 Base module for loading and running the main SasView application. 3 """ 2 4 ################################################################################ 3 5 #This software was developed by the University of Tennessee as part of the 4 6 #Distributed Data Analysis of Neutron Scattering Experiments (DANSE) 5 #project funded by the US National Science Foundation. 7 #project funded by the US National Science Foundation. 6 8 # 7 9 #See the license text in license.txt … … 28 30 self.log_level = log_level 29 31 self.linebuf = '' 30 32 31 33 def write(self, buf): 34 """ 35 Main logging method 36 """ 32 37 # Write the message to stdout so we can see it when running interactively 33 38 sys.stdout.write(buf) … … 38 43 sl = StreamToLogger(stderr_logger, logging.ERROR) 39 44 sys.stderr = sl 45 46 # Log the start of the session 47 logging.info(" --- SasView session started ---") 40 48 41 49 # Log the python version … … 49 57 WX_ENV_VAR = "SASVIEW_WX_VERSION" 50 58 if WX_ENV_VAR in os.environ: 51 logging.info("You have set the %s environment variable to %s." % (WX_ENV_VAR, os.environ[WX_ENV_VAR])) 59 logging.info("You have set the %s environment variable to %s." % \ 60 (WX_ENV_VAR, os.environ[WX_ENV_VAR])) 52 61 import wxversion 53 62 if wxversion.checkInstalled(os.environ[WX_ENV_VAR]): … … 64 73 except: 65 74 logging.error("Wx version: error reading version") 66 67 # The below will make sure that sasview application uses the matplotlib font 68 # bundled with sasview. 75 76 # The below will make sure that sasview application uses the matplotlib font 77 # bundled with sasview. 69 78 if hasattr(sys, 'frozen'): 70 79 mplconfigdir = os.path.join(os.path.expanduser("~"), '.matplotlib') … … 76 85 from sas.guiframe import gui_manager 77 86 from sas.guiframe.gui_style import GUIFRAME 78 from welcome_panel import WelcomePanel87 from sas.sasview.welcome_panel import WelcomePanel 79 88 # For py2exe, import config here 80 import local_config89 import sas.sasview.local_config 81 90 PLUGIN_MODEL_DIR = 'plugin_models' 82 91 APP_NAME = 'SasView' … … 89 98 class SasView(): 90 99 """ 100 Main class for running the SasView application 91 101 """ 92 102 def __init__(self): … … 94 104 """ 95 105 #from gui_manager import ViewApp 96 self.gui = SasViewApp(0) 106 self.gui = SasViewApp(0) 97 107 # Set the application manager for the GUI 98 108 self.gui.set_manager(self) … … 109 119 fitting_plug = module.Plugin() 110 120 self.gui.add_perspective(fitting_plug) 111 except Exception as inst:121 except Exception: 112 122 logging.error("%s: could not find Fitting plug-in module"% APP_NAME) 113 123 logging.error(traceback.format_exc()) … … 115 125 # P(r) perspective 116 126 try: 117 import sas.perspectives.pr as module 127 import sas.perspectives.pr as module 118 128 pr_plug = module.Plugin(standalone=False) 119 129 self.gui.add_perspective(pr_plug) … … 124 134 #Invariant perspective 125 135 try: 126 import sas.perspectives.invariant as module 136 import sas.perspectives.invariant as module 127 137 invariant_plug = module.Plugin(standalone=False) 128 138 self.gui.add_perspective(invariant_plug) 129 139 except: 130 raise131 140 logging.error("%s: could not find Invariant plug-in module"% \ 132 141 APP_NAME) … … 135 144 #Calculator perspective 136 145 try: 137 import sas.perspectives.calculator as module 146 import sas.perspectives.calculator as module 138 147 calculator_plug = module.Plugin(standalone=False) 139 148 self.gui.add_perspective(calculator_plug) … … 143 152 logging.error(traceback.format_exc()) 144 153 145 154 146 155 # Add welcome page 147 156 self.gui.set_welcome_panel(WelcomePanel) 148 157 149 158 # Build the GUI 150 159 self.gui.build_gui() 151 # delete unused model folder 160 # delete unused model folder 152 161 self.gui.clean_plugin_models(PLUGIN_MODEL_DIR) 153 162 # Start the main loop … … 156 165 157 166 def run(): 167 """ 168 __main__ method for loading and running SasView 169 """ 158 170 from multiprocessing import freeze_support 159 171 freeze_support()
Note: See TracChangeset
for help on using the changeset viewer.