Changeset 282

Show
Ignore:
Timestamp:
11/13/08 13:50:30 (2 months ago)
Author:
tal
Message:
screen can now be specified during __init__.
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • packages/vanilla/trunk/Lib/vanilla/vanillaWindows.py

    r206 r282  
    5151 
    5252    def __init__(self, posSize, title="", minSize=None, maxSize=None, textured=False, 
    53                 autosaveName=None, closable=True, miniaturizable=True, initiallyVisible=True): 
     53                autosaveName=None, closable=True, miniaturizable=True, initiallyVisible=True, screen=None): 
    5454        """ 
    5555        *posSize* Tuple of form (left, top, width, height) representing the position and size of the window. It may also be a tuple of form (width, height). In this case, the window will be positioned on screen automatically.  
     
    7070 
    7171        *initiallyVisible* Boolean value representing if the window will be initially visible. Default is True. If False, you can show the window later by calling window.show(). 
     72 
     73        *screen* A "NSScreen":http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Classes/NSScreen_Class/Reference/Reference.html object indicating the screen that the window should be drawn to. When None the window will be drawn to the main screen. 
    7274        """ 
    7375        mask = self.nsWindowStyleMask 
     
    8991            l, t, w, h = posSize 
    9092            cascade = False 
    91         frame = _calcFrame(NSScreen.mainScreen().visibleFrame(), ((l, t), (w, h))) 
    92         self._window = self.nsWindowClass.alloc().initWithContentRect_styleMask_backing_defer_( 
    93             frame, mask, NSBackingStoreBuffered, False) 
     93        if screen is None: 
     94            screen = NSScreen.mainScreen() 
     95        frame = _calcFrame(screen.visibleFrame(), ((l, t), (w, h))) 
     96        self._window = self.nsWindowClass.alloc().initWithContentRect_styleMask_backing_defer_screen_( 
     97            frame, mask, NSBackingStoreBuffered, False, screen) 
    9498        if autosaveName is not None: 
    9599            # This also sets the window frame if it was previously stored. 
     
    593597    def __init__(self, posSize, title="", minSize=None, maxSize=None, 
    594598            textured=False, autosaveName=None, closable=True, 
    595             initiallyVisible=True): 
     599            initiallyVisible=True, screen=None): 
    596600        """ 
    597601        *posSize* Tuple of form (left, top, width, height) representing the position and size of the window. It may also be a tuple of form (width, height). In this case, the window will be positioned on screen automatically.  
     
    608612 
    609613        *closable* Boolean value representing if the window should have a close button in the title bar. 
     614 
     615        *screen* A "NSScreen":http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Classes/NSScreen_Class/Reference/Reference.html object indicating the screen that the window should be drawn to. When None the window will be drawn to the main screen. 
    610616        """ 
    611617        super(FloatingWindow, self).__init__(posSize, title, minSize, maxSize, 
    612                 textured, autosaveName, closable, initiallyVisible=initiallyVisible
     618                textured, autosaveName, closable, initiallyVisible=initiallyVisible, screen=screen
    613619        self._window.setBecomesKeyOnlyIfNeeded_(True) 
    614620