source: sasview/prview/sansview.py @ b6666d4

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 b6666d4 was 4d5005e, checked in by Mathieu Doucet <doucetm@…>, 15 years ago

prview: Consider user's screen size when setting the app window size.

  • Property mode set to 100644
File size: 1.9 KB
RevLine 
[aa4b8379]1import wx
[f3d51f6]2#import gui_manager
3from sans.guiframe import gui_manager
[4a5de6f]4
5# For py2exe, import config here
6import local_config
[0fdcd1e]7import sys
[aa4b8379]8from perspectives.pr.pr import NewPrFileEvent
9
[0fdcd1e]10# Application dimensions
11APP_HEIGHT = 780
12APP_WIDTH  = 850
[4318af7f]13
[aa4b8379]14class PrFrame(gui_manager.ViewerFrame):
15    def _on_open(self, event):
16        wx.PostEvent(self, NewPrFileEvent())
17
18class PrApp(gui_manager.ViewApp):
19    def OnInit(self):
[4d5005e]20       
21        # Check the size of the screen
22        # Add some padding to make sure to clear any OS tool bar
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       
[2a92852]27        self.frame = PrFrame(None, -1, local_config.__appname__, 
[4d5005e]28                             window_height=app_height, window_width=app_width)   
[aa4b8379]29        self.frame.Show(True)
[4a5de6f]30
[aa4b8379]31        if hasattr(self.frame, 'special'):
32            self.frame.special.SetCurrent()
33        self.SetTopWindow(self.frame)
34        return True
35   
[f3d51f6]36class SansView():
37   
38    def __init__(self):
39        """
40       
41        """
42        #from gui_manager import ViewApp
[aa4b8379]43        #self.gui = gui_manager.ViewApp(0)
44        self.gui = PrApp(0)
[f3d51f6]45       
[4a5de6f]46        # Add perspectives to the basic application
47        # Additional perspectives can still be loaded
48        # dynamically
49        import perspectives.pr as module
[ee6f84c]50        self.pr_plug = module.Plugin(standalone=True)
[aa4b8379]51        self.gui.add_perspective(self.pr_plug)
[4a5de6f]52           
53        # Build the GUI
54        self.gui.build_gui()
55       
[f3d51f6]56        # Set the application manager for the GUI
57        self.gui.set_manager(self)
58       
59        # Start the main loop
60        self.gui.MainLoop() 
[aa4b8379]61       
[f3d51f6]62
63if __name__ == "__main__": 
64    sansview = SansView()
Note: See TracBrowser for help on using the repository browser.