Changeset 415fb82 in sasview for sasview/sasview.py


Ignore:
Timestamp:
Apr 1, 2015 12:57:33 PM (9 years ago)
Author:
krzywon
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
Message:

Fixed the perspectives loading error. Cleaned up the sasview.log by
removing any extra linefeeds/carraige returns and added a start session
and end session message.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasview/sasview.py

    r4e080980 r415fb82  
    1  
     1""" 
     2Base module for loading and running the main SasView application. 
     3""" 
    24################################################################################ 
    35#This software was developed by the University of Tennessee as part of the 
    46#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. 
    68# 
    79#See the license text in license.txt 
     
    2830        self.log_level = log_level 
    2931        self.linebuf = '' 
    30   
     32 
    3133    def write(self, buf): 
     34        """ 
     35        Main logging method 
     36        """ 
    3237        # Write the message to stdout so we can see it when running interactively 
    3338        sys.stdout.write(buf) 
     
    3843sl = StreamToLogger(stderr_logger, logging.ERROR) 
    3944sys.stderr = sl 
     45 
     46# Log the start of the session 
     47logging.info(" --- SasView session started ---") 
    4048 
    4149# Log the python version 
     
    4957WX_ENV_VAR = "SASVIEW_WX_VERSION" 
    5058if 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])) 
    5261    import wxversion 
    5362    if wxversion.checkInstalled(os.environ[WX_ENV_VAR]): 
     
    6473except: 
    6574    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. 
    6978if hasattr(sys, 'frozen'): 
    7079    mplconfigdir = os.path.join(os.path.expanduser("~"), '.matplotlib') 
     
    7685from sas.guiframe import gui_manager 
    7786from sas.guiframe.gui_style import GUIFRAME 
    78 from welcome_panel import WelcomePanel 
     87from sas.sasview.welcome_panel import WelcomePanel 
    7988# For py2exe, import config here 
    80 import local_config 
     89import sas.sasview.local_config 
    8190PLUGIN_MODEL_DIR = 'plugin_models' 
    8291APP_NAME = 'SasView' 
     
    8998class SasView(): 
    9099    """ 
     100    Main class for running the SasView application 
    91101    """ 
    92102    def __init__(self): 
     
    94104        """ 
    95105        #from gui_manager import ViewApp 
    96         self.gui = SasViewApp(0)  
     106        self.gui = SasViewApp(0) 
    97107        # Set the application manager for the GUI 
    98108        self.gui.set_manager(self) 
     
    109119            fitting_plug = module.Plugin() 
    110120            self.gui.add_perspective(fitting_plug) 
    111         except Exception as inst: 
     121        except Exception: 
    112122            logging.error("%s: could not find Fitting plug-in module"% APP_NAME) 
    113123            logging.error(traceback.format_exc()) 
     
    115125        # P(r) perspective 
    116126        try: 
    117             import sas.perspectives.pr as module     
     127            import sas.perspectives.pr as module 
    118128            pr_plug = module.Plugin(standalone=False) 
    119129            self.gui.add_perspective(pr_plug) 
     
    124134        #Invariant perspective 
    125135        try: 
    126             import sas.perspectives.invariant as module     
     136            import sas.perspectives.invariant as module 
    127137            invariant_plug = module.Plugin(standalone=False) 
    128138            self.gui.add_perspective(invariant_plug) 
    129139        except: 
    130             raise 
    131140            logging.error("%s: could not find Invariant plug-in module"% \ 
    132141                          APP_NAME) 
     
    135144        #Calculator perspective    
    136145        try: 
    137             import sas.perspectives.calculator as module     
     146            import sas.perspectives.calculator as module 
    138147            calculator_plug = module.Plugin(standalone=False) 
    139148            self.gui.add_perspective(calculator_plug) 
     
    143152            logging.error(traceback.format_exc()) 
    144153 
    145              
     154 
    146155        # Add welcome page 
    147156        self.gui.set_welcome_panel(WelcomePanel) 
    148        
     157 
    149158        # Build the GUI 
    150159        self.gui.build_gui() 
    151         # delete unused model folder     
     160        # delete unused model folder 
    152161        self.gui.clean_plugin_models(PLUGIN_MODEL_DIR) 
    153162        # Start the main loop 
     
    156165 
    157166def run(): 
     167    """ 
     168    __main__ method for loading and running SasView 
     169    """ 
    158170    from multiprocessing import freeze_support 
    159171    freeze_support() 
Note: See TracChangeset for help on using the changeset viewer.