Changeset 285

Show
Ignore:
Timestamp:
11/13/08 14:23:23 (2 months ago)
Author:
tal
Message:
Better behavior on multiple displays.
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • packages/defconAppKit/trunk/Lib/defconAppKit/views/glyphCellView.py

    r280 r285  
    200200 
    201201    def glyphDetailWindow(self): 
     202        if self._glyphDetailWindow is None and self._glyphDetailWindowClass is not None: 
     203            self._setupGlyphDetailWindow() 
    202204        return self._glyphDetailWindow 
     205 
     206    def _setupGlyphDetailWindow(self): 
     207        if self._glyphDetailWindow is None and self._glyphDetailWindowClass is not None: 
     208            screen = self.window().screen() 
     209            self._glyphDetailWindow = self._glyphDetailWindowClass(screen=screen) 
    203210 
    204211    # selection 
     
    257264        # if window() returns an object, open the detail window 
    258265        if self.window() is not None: 
    259             if self._glyphDetailWindow is None and self._glyphDetailWindowClass is not None: 
    260                 self._glyphDetailWindow = self._glyphDetailWindowClass() 
    261266            self.subscribeToWindow() 
    262267            self.subscribeToScrollViewFrameChange() 
     
    402407        if self._windowIsClosed: 
    403408            return 
    404         if self._glyphDetailWindow is None: 
     409        glyphDetailWindow = self.glyphDetailWindow() 
     410        if glyphDetailWindow is None: 
    405411            return 
    406412        # determine show/hide 
     
    415421        ## to be called after a drop from the view has occurred 
    416422        ## outside of the view. 
    417         elif mouseDragged and not self._glyphDetailWindow.isVisible(): 
     423        elif mouseDragged and not glyphDetailWindow.isVisible(): 
    418424            shouldBeVisible = False 
    419425        ## event requirements 
     
    454460        # set the position 
    455461        if shouldBeVisible: 
    456             x, y = eventLocation 
    457             windowX, windowY = event.window().frame().origin 
    458             detailX = windowX + x 
    459             detailY = windowY + y 
     462            detailX, detailY = self.window().convertBaseToScreen_(eventLocation) 
    460463            glyph = self._glyphs[found] 
    461             self._glyphDetailWindow.setPositionNearCursor((detailX, detailY)) 
    462             self._glyphDetailWindow.set(glyph) 
    463             if not self._glyphDetailWindow.isVisible(): 
    464                 self._glyphDetailWindow.show() 
    465         else: 
    466             self._glyphDetailWindow.hide() 
     464            glyphDetailWindow.setPositionNearCursor((detailX, detailY)) 
     465            glyphDetailWindow.set(glyph) 
     466            if not glyphDetailWindow.isVisible(): 
     467                glyphDetailWindow.show() 
     468        else: 
     469            glyphDetailWindow.hide() 
    467470 
    468471    def _mouseSelection(self, event, found, mouseDown=False, mouseDragged=False, mouseUp=False, mouseMoved=False): 
     
    816819class GlyphInformationPopUpWindow(InformationPopUpWindow): 
    817820 
    818     def __init__(self): 
     821    def __init__(self, screen=None): 
    819822        posSize = (200, 280) 
    820         super(GlyphInformationPopUpWindow, self).__init__(posSize
     823        super(GlyphInformationPopUpWindow, self).__init__(posSize, screen=screen
    821824        self.glyphView = GlyphInformationGlyphView((5, 5, -5, 145)) 
    822825 
  • packages/defconAppKit/trunk/Lib/defconAppKit/windows/popUpWindow.py

    r281 r285  
    3232    nsWindowLevel = NSTornOffMenuWindowLevel 
    3333 
    34     def __init__(self, posSize): 
     34    def __init__(self, posSize, screen=None): 
    3535        super(InformationPopUpWindow, self).__init__(posSize, "", minSize=None, 
    3636                maxSize=None, textured=False, autosaveName=None, 
    37                 closable=False, initiallyVisible=False
     37                closable=False, initiallyVisible=False, screen=screen
    3838        contentView = DefconAppKitInformationPopUpWindowContentView.alloc().init() 
    3939        self._window.setContentView_(contentView) 
     
    175175    contentViewClass = DefconAppKitInteractivePopUpWindowContentView 
    176176 
    177     def __init__(self, posSize): 
    178         super(InteractivePopUpWindow, self).__init__(posSize
     177    def __init__(self, posSize, screen=None): 
     178        super(InteractivePopUpWindow, self).__init__(posSize, screen=screen
    179179        self._window.setMovableByWindowBackground_(True) 
    180180