source: sasview/calculatorview/sansviewtool.py @ a01c743

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 a01c743 was 3be3a80, checked in by Jae Cho <jhjcho@…>, 14 years ago

implemented a resolution estimating tool

  • Property mode set to 100644
File size: 2.4 KB
RevLine 
[3be3a80]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################################################################################
11
12import wx
13from sans.guiframe import gui_manager
14# For py2exe, import config here
15import local_config
16import logging
17
18# Application dimensions
19APP_HEIGHT = 80
20APP_WIDTH  = 360
21
22class SansViewToolApp(gui_manager.ViewApp):
23    """
24    """
25    def OnInit(self):
26        """
27        """
28        screen_size = wx.GetDisplaySize()
29        app_height = APP_HEIGHT if screen_size[1]>APP_HEIGHT else screen_size[1]-50
30        app_width  = APP_WIDTH if screen_size[0]>APP_WIDTH else screen_size[0]-50
31
32        self.frame = gui_manager.ViewerFrame(None, -1, local_config.__appname__, 
33                             window_height=app_height, window_width=app_width) 
34
35        self.frame.Show(True)
36
37        if hasattr(self.frame, 'special'):
38            self.frame.special.SetCurrent()
39        self.SetTopWindow(self.frame)
40        return True
41   
42   
43
44class SansViewTool():
45    """
46    """
47    def __init__(self):
48        """
49        """
50        #from gui_manager import ViewApp
51        self.gui = SansViewToolApp(0) 
52        # Set the application manager for the GUI
53        self.gui.set_manager(self)
54        # Add perspectives to the basic application
55        # Additional perspectives can still be loaded
56        # dynamically
57        # Note: py2exe can't find dynamically loaded
58        # modules. We load the fitting module here
59        # to ensure a complete Windows executable build.
60       
61       
62        #Calculator perspective   
63        try:
64            import perspectives.calculator as module   
65            calculator_plug = module.Plugin(standalone=True)
66            self.gui.add_perspective(calculator_plug)
67        except:
68            logging.error("SansView: could not find Calculator plug-in module") 
69       
70     
71        # Build the GUI
72        self.gui.build_gui()
73
74        # Start the main loop
75        self.gui.MainLoop() 
76       
77
78if __name__ == "__main__": 
79    sansviewtool = SansViewTool()
Note: See TracBrowser for help on using the repository browser.