Changeset 271

Show
Ignore:
Timestamp:
10/03/08 07:00:21 (2 years ago)
Author:
tal
Message:
Added a showModePlacard argument.
Files:

Legend:

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

    r270 r271  
    3939    listShowColumnTitles 
    4040    Same as showColumnTitles in vanilla.List 
     41 
     42    showModePlacard 
     43    Flag to indicate if the mode switch placard should be shown. This can be 
     44    useful if you only want to show the list or the cell view. 
    4145 
    4246    cellRepresentationName 
     
    7579 
    7680    def __init__(self, posSize, initialMode="cell", listColumnDescriptions=None, listShowColumnTitles=False, 
     81        showModePlacard=True, 
    7782        cellRepresentationName="defconAppKitGlyphCell", glyphDetailWindowClass=GlyphInformationPopUpWindow, 
    7883        selectionCallback=None, doubleClickCallback=None, deleteCallback=None, editCallback=None, 
     
    144149                dropTypes.append(d["type"]) 
    145150        self._glyphCellView.registerForDraggedTypes_(dropTypes) 
     151        self._placard = None 
    146152        ## set up the placard 
    147         placardW = 34 
    148         placardH = 16 
    149         self._placard = vanilla.Group((0, 0, placardW, placardH)) 
    150         self._placard.button = PlacardSegmentedButton((0, 0, placardW, placardH), 
    151             [dict(imageObject=placardCellImage, width=16), dict(imageObject=placardListImage, width=18)], 
    152             callback=self._placardSelection, sizeStyle="mini") 
    153         self._nsObject.setPlacard_(self._placard.getNSView()) 
     153        if showModePlacard: 
     154            placardW = 34 
     155            placardH = 16 
     156            self._placard = vanilla.Group((0, 0, placardW, placardH)) 
     157            self._placard.button = PlacardSegmentedButton((0, 0, placardW, placardH), 
     158                [dict(imageObject=placardCellImage, width=16), dict(imageObject=placardListImage, width=18)], 
     159                callback=self._placardSelection, sizeStyle="mini") 
     160            self._nsObject.setPlacard_(self._placard.getNSView()) 
    154161        ## tweak the scroll view 
    155162        self._nsObject.setBackgroundColor_(gridColor) 
     
    186193        if mode == "list": 
    187194            documentView = self._tableView 
    188             placard.button.set(1) 
     195            if placard is not None: 
     196                placard.button.set(1) 
    189197        elif mode == "cell": 
    190198            documentView = self._glyphCellView 
    191             placard.button.set(0) 
     199            if placard is not None: 
     200                placard.button.set(0) 
    192201        self._nsObject.setDocumentView_(documentView) 
    193202        self._mode = mode