Changeset 186

Show
Ignore:
Timestamp:
04/13/08 10:54:31 (9 months ago)
Author:
tal
Message:
Smarter handling of selection during setGlyphs_
Files:

Legend:

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

    r157 r186  
    126126 
    127127    def setGlyphs_(self, glyphs): 
     128        currentSelection = [self._glyphs[index] for index in self._selection] 
     129        newSelection = [glyphs.index(glyph) for glyph in currentSelection if glyph in glyphs] 
     130        self._selection = newSelection 
    128131        self._unsubscribeFromGlyphs() 
    129132        self._glyphs = glyphs 
    130133        self._subscribeToGlyphs() 
    131         maxIndex = len(glyphs) - 1 
    132         toRemove = set() 
    133         for index in self._selection: 
    134             if index > maxIndex: 
    135                 toRemove.add(index) 
    136         self._selection = self._selection - toRemove 
    137134        self.recalculateFrame() 
    138135