source: sasview/sansview/sansview.py @ 7d90e55

ESS_GUIESS_GUI_DocsESS_GUI_batch_fittingESS_GUI_bumps_abstractionESS_GUI_iss1116ESS_GUI_iss879ESS_GUI_iss959ESS_GUI_openclESS_GUI_orderingESS_GUI_sync_sascalccostrafo411magnetic_scattrelease-4.1.1release-4.1.2release-4.2.2release_4.0.1ticket-1009ticket-1094-headlessticket-1242-2d-resolutionticket-1243ticket-1249ticket885unittest-saveload
Last change on this file since 7d90e55 was e2271c5, checked in by Anders Markvardsen <anders.markvardsen@…>, 12 years ago

Prepare to move corfunc perspective code out of trunk into branch

  • Property mode set to 100644
File size: 4.3 KB
Line 
1
2################################################################################
3#This software was developed by the University of Tennessee as part of the
4#Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
5#project funded by the US National Science Foundation.
6#
7#See the license text in license.txt
8#
9#copyright 2009, University of Tennessee
10################################################################################
11import os
12import logging
13from shutil import copy
14logging.basicConfig(level=logging.INFO,
15                    format='%(asctime)s %(levelname)s %(message)s',
16                    filename=os.path.join(os.path.expanduser("~"),
17                                          'sasview.log'))
18
19import wx
20import sys
21# The below will make sure that sasview application uses the matplotlib font
22# bundled with sasview.
23if hasattr(sys, 'frozen'):
24    mplconfigdir = os.path.join(os.path.expanduser("~"), '.matplotlib')
25    if not os.path.exists(mplconfigdir):
26        os.mkdir(mplconfigdir)
27    os.environ['MPLCONFIGDIR'] = mplconfigdir
28    if sys.version_info < (2, 7):
29        reload(sys)
30    sys.setdefaultencoding("iso-8859-1")
31from sans.guiframe import gui_manager
32from sans.guiframe.gui_style import GUIFRAME
33from welcome_panel import WelcomePanel
34# For py2exe, import config here
35import local_config
36PLUGIN_MODEL_DIR = 'plugin_models'
37APP_NAME = 'SasView'
38def run():
39    sys.path.append(os.path.join("..","..",".."))
40    from multiprocessing import freeze_support
41    freeze_support()
42    sasview = SasView()
43       
44class SasViewApp(gui_manager.ViewApp):
45    """
46    """
47 
48
49class SasView():
50    """
51    """
52    def __init__(self):
53        """
54        """
55        #from gui_manager import ViewApp
56        self.gui = SasViewApp(0) 
57        # Set the application manager for the GUI
58        self.gui.set_manager(self)
59        # Add perspectives to the basic application
60        # Additional perspectives can still be loaded
61        # dynamically
62        # Note: py2exe can't find dynamically loaded
63        # modules. We load the fitting module here
64        # to ensure a complete Windows executable build.
65       
66        # Fitting perspective
67        try:
68            import sans.perspectives.fitting as module   
69            fitting_plug = module.Plugin()
70            self.gui.add_perspective(fitting_plug)
71        except Exception as inst:
72            logging.error("Fitting problems: " + str(inst))
73            logging.error("%s: could not find Fitting plug-in module"% APP_NAME) 
74            logging.error(sys.exc_value) 
75           
76        # P(r) perspective
77        try:
78            import sans.perspectives.pr as module   
79            pr_plug = module.Plugin(standalone=False)
80            self.gui.add_perspective(pr_plug)
81        except:
82            logging.error("%s: could not find P(r) plug-in module"% APP_NAME)
83            logging.error(sys.exc_value) 
84       
85        #Invariant perspective
86        try:
87            import sans.perspectives.invariant as module   
88            invariant_plug = module.Plugin(standalone=False)
89            self.gui.add_perspective(invariant_plug)
90        except:
91            raise
92            logging.error("%s: could not find Invariant plug-in module"% \
93                          APP_NAME)
94            logging.error(sys.exc_value) 
95       
96        #Calculator perspective   
97        try:
98            import sans.perspectives.calculator as module   
99            calculator_plug = module.Plugin(standalone=False)
100            self.gui.add_perspective(calculator_plug)
101        except:
102            logging.error("%s: could not find Calculator plug-in module"% \
103                                                        APP_NAME)
104            logging.error(sys.exc_value) 
105       
106           
107        # Add welcome page
108        self.gui.set_welcome_panel(WelcomePanel)
109     
110        # Build the GUI
111        self.gui.build_gui()
112        # delete unused model folder   
113        self.gui.clean_plugin_models(PLUGIN_MODEL_DIR)
114        # Start the main loop
115        self.gui.MainLoop() 
116       
117
118
119if __name__ == "__main__": 
120    from multiprocessing import freeze_support
121    freeze_support()
122    #Process(target=SasView).start()
123    sasview = SasView()
124
125   
Note: See TracBrowser for help on using the repository browser.