Changeset 210

Show
Ignore:
Timestamp:
04/28/08 07:56:49 (8 months ago)
Author:
tal
Message:
Added drop settings for restricting the source to the window containing the List.
Files:

Legend:

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

    r206 r210  
    105105            settings = vanillaWrapper._selfDropSettings 
    106106            return self._handleDropBasedOnSettings(settings, vanillaWrapper, dropOnRow, draggingInfo, dropInformation) 
     107        # drag from same window 
     108        window = tableView.window() 
     109        if window is not None and window == draggingSource.window() and vanillaWrapper._selfWindowDropSettings is not None: 
     110            if vanillaWrapper._selfWindowDropSettings is None: 
     111                return NSDragOperationNone 
     112            settings = vanillaWrapper._selfWindowDropSettings 
     113            return self._handleDropBasedOnSettings(settings, vanillaWrapper, dropOnRow, draggingInfo, dropInformation) 
    107114        # drag from same document 
    108115        document = tableView.window().document() 
    109         if document is not None and document != draggingSource.window().document(): 
     116        if document is not None and document == draggingSource.window().document(): 
    110117            if vanillaWrapper._selfDocumentDropSettings is None: 
    111118                return NSDragOperationNone 
     
    288295                autohidesScrollers=True, drawFocusRing=True, rowHeight=17.0, 
    289296                selfDropSettings=None, 
     297                selfWindowDropSettings=None, 
    290298                selfDocumentDropSettings=None, 
    291299                selfApplicationDropSettings=None, 
     
    343351        *selfDropSettings* A dictionary defining the drop settings when the source of the drop is this list. The dictionary form is described below. 
    344352 
    345         *selfDocumentDropSettings* A dictionary defining the drop settings when the source of the drop is contained the same document as this list. The dictionary form is described below. 
     353        *selfWindowDropSettings* A dictionary defining the drop settings when the source of the drop is contained the same document as this list. The dictionary form is described below. 
     354 
     355        *selfDocumentDropSettings* A dictionary defining the drop settings when the source of the drop is contained the same window as this list. The dictionary form is described below. 
    346356 
    347357        *selfApplicationDropSettings* A dictionary defining the drop settings when the source of the drop is contained the same application as this list. The dictionary form is described below. 
     
    445455        # set the drop data 
    446456        self._selfDropSettings = selfDropSettings 
     457        self._selfWindowDropSettings = selfWindowDropSettings 
    447458        self._selfDocumentDropSettings = selfDocumentDropSettings 
    448459        self._otherApplicationDropSettings = selfApplicationDropSettings 
    449460        self._otherApplicationDropSettings = otherApplicationDropSettings 
    450461        allDropTypes = [] 
    451         for settings in (selfDropSettings, selfDocumentDropSettings, selfApplicationDropSettings, otherApplicationDropSettings): 
     462        for settings in (selfDropSettings, selfWindowDropSettings, selfDocumentDropSettings, selfApplicationDropSettings, otherApplicationDropSettings): 
    452463            if settings is None: 
    453464                continue 
     
    506517            self._doubleClickTarget.callback = None 
    507518        self._selfDropSettings = None 
     519        self._selfWindowDropSettings = None 
    508520        self._selfDocumentDropSettings = None 
    509521        self._otherApplicationDropSettings = None