source: sasview/sansview/sansview.py @ b9405cd

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 b9405cd was ba69349, checked in by Gervaise Alina <gervyh@…>, 15 years ago

reverse code

  • Property mode set to 100644
File size: 3.4 KB
Line 
1"""
2This software was developed by the University of Tennessee as part of the
3Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
4project funded by the US National Science Foundation.
5
6See the license text in license.txt
7
8copyright 2009, University of Tennessee
9"""
10import wx
11from sans.guiframe import gui_manager
12from welcome_panel import WelcomePanel
13# For py2exe, import config here
14import local_config
15import logging
16
17# Application dimensions
18APP_HEIGHT = 800
19APP_WIDTH  = 1000
20
21class SansViewApp(gui_manager.ViewApp):
22    def OnInit(self):
23        screen_size = wx.GetDisplaySize()
24        app_height = APP_HEIGHT if screen_size[1]>APP_HEIGHT else screen_size[1]-50
25        app_width  = APP_WIDTH if screen_size[0]>APP_WIDTH else screen_size[0]-50
26
27        self.frame = gui_manager.ViewerFrame(None, -1, local_config.__appname__, 
28                             window_height=app_height, window_width=app_width)   
29        self.frame.Show(True)
30
31        if hasattr(self.frame, 'special'):
32            self.frame.special.SetCurrent()
33        self.SetTopWindow(self.frame)
34        return True
35
36class SansView():
37   
38    def __init__(self):
39        """
40       
41        """
42        #from gui_manager import ViewApp
43        self.gui = SansViewApp(0) 
44        # Set the application manager for the GUI
45        self.gui.set_manager(self)
46        # Add perspectives to the basic application
47        # Additional perspectives can still be loaded
48        # dynamically
49        # Note: py2exe can't find dynamically loaded
50        # modules. We load the fitting module here
51        # to ensure a complete Windows executable build.
52       
53        # P(r) perspective
54        try:
55            import sans.perspectives.pr as module   
56            pr_plug = module.Plugin(standalone=False)
57            self.gui.add_perspective(pr_plug)
58        except:
59            logging.error("SansView: could not find P(r) plug-in module") 
60       
61        #Invariant perspective
62        try:
63            import sans.perspectives.invariant as module   
64            invariant_plug = module.Plugin(standalone=False)
65            self.gui.add_perspective(invariant_plug)
66        except:
67            logging.error("SansView: could not find Invariant plug-in module") 
68       
69        #Calculator perspective   
70        try:
71            import sans.perspectives.calculator as module   
72            calculator_plug = module.Plugin(standalone=False)
73            self.gui.add_perspective(calculator_plug)
74        except:
75            logging.error("SansView: could not find Calculator plug-in module") 
76           
77        # theory perspective
78        try:
79            import sans.perspectives.theory as module   
80            theory_plug = module.Plugin(standalone=False)
81            self.gui.add_perspective(theory_plug)
82        except:
83            logging.error("SansView: could not find theory plug-in module")
84           
85        # Fitting perspective
86        import perspectives.fitting as module   
87        fitting_plug = module.Plugin()
88        self.gui.add_perspective(fitting_plug)
89       
90        # Add welcome page
91        self.gui.set_welcome_panel(WelcomePanel)
92     
93        # Build the GUI
94        self.gui.build_gui()
95       
96        # Start the main loop
97        self.gui.MainLoop() 
98       
99
100if __name__ == "__main__": 
101    sansview = SansView()
Note: See TracBrowser for help on using the repository browser.