source: sasview/sansview/sansview.py @ 1a2dc10

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 1a2dc10 was 6e0e2d85, checked in by Gervaise Alina <gervyh@…>, 15 years ago

add calculator perspective

  • Property mode set to 100644
File size: 3.1 KB
RevLine 
[e2da832]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"""
[d89f09b]10import wx
11from sans.guiframe import gui_manager
[e2da832]12from welcome_panel import WelcomePanel
[d89f09b]13# For py2exe, import config here
14import local_config
[9f73a1d]15import logging
[d89f09b]16
[57acd41]17# Application dimensions
18APP_HEIGHT = 800
19APP_WIDTH  = 1000
20
21class SansViewApp(gui_manager.ViewApp):
22    def OnInit(self):
[2a1be2d9]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
[57acd41]27        self.frame = gui_manager.ViewerFrame(None, -1, local_config.__appname__, 
[2a1be2d9]28                             window_height=app_height, window_width=app_width)   
[57acd41]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
[2d39535]35
[d89f09b]36class SansView():
37   
38    def __init__(self):
39        """
40       
41        """
42        #from gui_manager import ViewApp
[57acd41]43        self.gui = SansViewApp(0) 
[d89f09b]44       
45        # Add perspectives to the basic application
46        # Additional perspectives can still be loaded
47        # dynamically
[365a17f6]48        # Note: py2exe can't find dynamically loaded
49        # modules. We load the fitting module here
50        # to ensure a complete Windows executable build.
[2d39535]51
[1c8015f]52        # P(r) perspective
53        try:
54            import sans.perspectives.pr as module   
55            fitting_plug = module.Plugin(standalone=False)
56            self.gui.add_perspective(fitting_plug)
57        except:
58            logging.error("SansView: could not find P(r) plug-in module") 
[6e0e2d85]59         
60        #Calculator perspective   
61        try:
62            import sans.perspectives.calculator as module   
63            calculator_plug = module.Plugin(standalone=False)
64            self.gui.add_perspective(calculator_plug)
65        except:
66            logging.error("SansView: could not find Calculator plug-in module") 
67           
68        # theory perspective
69        try:
70            import sans.perspectives.theory as module   
71            theory_plug = module.Plugin(standalone=False)
72            self.gui.add_perspective(theory_plug)
73        except:
74            raise
75            #logging.error("SansView: could not find theory plug-in module")
[2d39535]76        # Fitting perspective
[365a17f6]77        import perspectives.fitting as module   
78        fitting_plug = module.Plugin()
79        self.gui.add_perspective(fitting_plug)
[e5c6fff]80     
[e2da832]81        # Add welcome page
82        self.gui.set_welcome_panel(WelcomePanel)
83     
[d89f09b]84        # Build the GUI
85        self.gui.build_gui()
86       
87        # Set the application manager for the GUI
88        self.gui.set_manager(self)
89       
90        # Start the main loop
91        self.gui.MainLoop() 
92       
93
94if __name__ == "__main__": 
95    sansview = SansView()
Note: See TracBrowser for help on using the repository browser.