Changeset 148

Show
Ignore:
Timestamp:
03/05/08 12:01:31 (10 months ago)
Author:
tal
Message:
Use the defcon glyph sort.
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • packages/defconAppKit/trunk/TestApp/DefconAppKitTest.py

    r88 r148  
    99from defconAppKit.representationFactories import GlyphCellHeaderHeight, GlyphCellMinHeightForHeader 
    1010from defconAppKit.views.glyphCellView import GlyphCellView 
     11from defconAppKit.views.glyphList import GlyphList 
    1112from defconAppKit.views.glyphLineView import GlyphLineView 
     13from defconAppKit.views.glyphNameComboBox import GlyphNameComboBox 
    1214from fontAppTools import splitText 
    1315 
     
    3436 
    3537 
     38glyphSortDescriptors = [ 
     39    dict(type="alphabetical", allowPseudoUnicode=True), 
     40    dict(type="category", allowPseudoUnicode=True), 
     41    dict(type="unicode", allowPseudoUnicode=True), 
     42    dict(type="script", allowPseudoUnicode=True), 
     43    dict(type="suffix", allowPseudoUnicode=True), 
     44    dict(type="decompositionBase", allowPseudoUnicode=True) 
     45] 
     46 
     47 
    3648class DefconAppKitTestDocumentWindow(BaseWindowController): 
    3749 
    3850    def __init__(self, font): 
    3951        self.font = font 
    40         self.glyphs = [font[k] for k in sorted(font.keys())] 
    41         self.w = vanilla.Window((500, 500), minSize=(400, 400)) 
     52        self.glyphs = [font[k] for k in font.unicodeData.sortGlyphNames(font.keys(), glyphSortDescriptors)] 
     53        self.w = vanilla.Window((700, 500), minSize=(400, 400)) 
    4254 
    43         self.w.tabs = vanilla.Tabs((10, 10, -10, -10), ["Window", "GlyphCellView", "GlyphLineView"]) 
     55        self.w.tabs = vanilla.Tabs((10, 10, -10, -10), ["Window", "GlyphCellView", "GlyphList", "GlyphLineView", "Misc. Controls"]) 
    4456        self.windowTab = self.w.tabs[0] 
    4557        self.cellViewTab = self.w.tabs[1] 
    46         self.lineViewTab = self.w.tabs[2] 
     58        self.listTab = self.w.tabs[2] 
     59        self.lineViewTab = self.w.tabs[3] 
     60        self.controlsTab = self.w.tabs[4] 
    4761 
    4862        # test various window methods 
     
    5569 
    5670        # test cell view 
    57         # test automatic updating 
    5871        self.cellViewTab.cellViewModifyButton = vanilla.Button((10, 10, 150, 20), "Modify Glyphs", callback=self.cellViewModify) 
    59         # test cell sizes 
    6072        self.cellViewTab.cellViewSizeSlider = vanilla.Slider((170, 10, 150, 20), minValue=10, maxValue=100, value=50, 
    6173            continuous=False, callback=self.cellViewResize) 
    62         # the cell view 
    6374        self.cellViewTab.cellView = GlyphCellView((10, 40, -10, -10), allowDrag=True, 
    6475            selectionCallback=self.cellViewSelectionCallback, doubleClickCallback=self.cellViewDoubleClickCallback, 
     
    6778        self.cellViewResize(self.cellViewTab.cellViewSizeSlider) 
    6879 
     80        ## test list 
     81        #formatter = NSNumberFormatter.alloc().init() 
     82        #formatter.setAllowsFloats_(False) 
     83        #columnDescriptions = [ 
     84        #    dict(title="name", editable=False), 
     85        #    dict(title="width", editable=True, formatter=formatter), 
     86        #    dict(title="leftMargin", editable=True, formatter=formatter), 
     87        #    dict(title="rightMargin", editable=True, formatter=formatter), 
     88        #] 
     89        #self.listTab.glyphList = GlyphList((10, 10, -10, -10), self.glyphs, columnDescriptions=columnDescriptions, editCallback=self.listViewEdit) 
     90 
    6991        # test line view 
    7092        self.lineViewTab.textInput = vanilla.EditText((10, 10, -10, 22), callback=self.lineViewTextInput) 
    7193        self.lineViewTab.lineView = GlyphLineView((10, 40, -10, -10), dropCallback=self.lineViewDropCallback) 
     94 
     95        # test controls 
     96 
     97        self.controlsTab.glyphNameComboBox = GlyphNameComboBox((10, 10, -10, 22), self.font) 
    7298 
    7399        self.setUpBaseWindowBehavior() 
     
    145171        self.cellViewTab.cellView.setCellRepresentationArguments(drawHeader=drawHeader, drawMetrics=drawHeader) 
    146172 
     173    # list view 
     174 
     175    def listViewEdit(self, sender): 
     176        pass 
     177 
    147178    # line view 
    148179 
     
    157188        return True 
    158189 
     190 
    159191if __name__ == "__main__": 
    160192    AppHelper.runEventLoop()