Changeset 036e9ba in sasview for sansguiframe/src/sans/guiframe


Ignore:
Timestamp:
Apr 25, 2012 6:18:06 AM (13 years ago)
Author:
Robert Whitley <robert.whitley@…>
Branches:
master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
7dfdd56
Parents:
278b995
Message:

Refs #54. If the window is too big then it will reduce to fit screen.

Make sure it is setup correctly on multiple screens.
Take into account the task bar for all OS's.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sansguiframe/src/sans/guiframe/gui_manager.py

    r6e75ed0 r036e9ba  
    33243324        """ 
    33253325        """ 
    3326         global GUIFRAME_WIDTH, GUIFRAME_HEIGHT   
    3327          
    3328         if (GUIFRAME_WIDTH > ((wx.DisplaySize()[0]/100)*90) | GUIFRAME_HEIGHT > ((wx.DisplaySize()[1]/100)*90) ): 
    3329             GUIFRAME_WIDTH = (wx.DisplaySize()[0]/100)*90 
    3330             GUIFRAME_HEIGHT = (wx.DisplaySize()[1]/100)*90 
    3331  
    33323326        pos, size = self.window_placement((GUIFRAME_WIDTH, GUIFRAME_HEIGHT))      
    33333327        self.frame = ViewerFrame(parent=None,  
     
    34333427        placed on the left side of the screen. 
    34343428        """ 
    3435         window_width, window_height = size 
    3436         screen_size = wx.GetDisplaySize() 
    3437         window_height = window_height if screen_size[1]>window_height else screen_size[1]-10 
    3438         window_width  = window_width if screen_size[0]> window_width else screen_size[0]-10 
    3439         xpos = ypos = 0 
    3440  
     3429         
     3430        # Get size of screen without  
     3431        for screenCount in range(wx.Display().GetCount()): 
     3432            screen = wx.Display(screenCount) 
     3433            if screen.IsPrimary(): 
     3434                displayRect = screen.GetClientArea() 
     3435                break 
     3436         
     3437        posX, posY, displayWidth, displayHeight = displayRect         
     3438        customWidth, customHeight = size 
     3439         
     3440        # If the custom screen is bigger than the window screen than make maximum size 
     3441        if customWidth > displayWidth: 
     3442            customWidth = displayWidth 
     3443        if customHeight > displayHeight: 
     3444            customHeight = displayHeight 
     3445             
    34413446        # Note that when running Linux and using an Xming (X11) server on a PC 
    34423447        # with a dual  monitor configuration, the reported display size may be 
     
    34453450        # screen 'too big'.  If so, we assume a smaller width which means the 
    34463451        # application will be placed towards the left hand side of the screen. 
    3447  
    3448         _, _, x, y = wx.Display().GetClientArea() # size excludes task bar 
    3449         if len(sys.argv) > 1 and '--platform' in sys.argv[1:]: 
    3450             w, h = wx.DisplaySize()  # size includes task bar area 
    3451         # display on left side, not centered on screen 
    3452         if x > 1920 and x > (2*y): x = x / 2   
    3453         if x > window_width:  xpos = (x - window_width)/2 
    3454         if y > window_height: ypos = (y - window_height)/2 
    3455  
    3456         # Return the suggested position and size for the application frame. 
    3457         return (xpos, ypos), (min(x, window_width), min(y, window_height)) 
     3452         
     3453        # If dual screen registered as 1 screen. Make width half. 
     3454        if displayWidth > (displayHeight*2): 
     3455            customWidth = displayWidth/2 
     3456            posX = 0 
     3457            posY = 0 
     3458             
     3459        # Make the position the middle of the screen. (Not 0,0) 
     3460        else: 
     3461            posX = (displayWidth - customWidth)/2 
     3462            posY = (displayHeight - customHeight)/2 
     3463         
     3464        # Return the suggested position and size for the application frame.     
     3465        return (posX, posY), (min(displayWidth, customWidth), min(displayHeight, customHeight)) 
     3466 
    34583467     
    34593468    def display_splash_screen(self, parent,  
Note: See TracChangeset for help on using the changeset viewer.