Changeset 148
- Timestamp:
- 03/05/08 12:01:31 (10 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
packages/defconAppKit/trunk/TestApp/DefconAppKitTest.py
r88 r148 9 9 from defconAppKit.representationFactories import GlyphCellHeaderHeight, GlyphCellMinHeightForHeader 10 10 from defconAppKit.views.glyphCellView import GlyphCellView 11 from defconAppKit.views.glyphList import GlyphList 11 12 from defconAppKit.views.glyphLineView import GlyphLineView 13 from defconAppKit.views.glyphNameComboBox import GlyphNameComboBox 12 14 from fontAppTools import splitText 13 15 … … 34 36 35 37 38 glyphSortDescriptors = [ 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 36 48 class DefconAppKitTestDocumentWindow(BaseWindowController): 37 49 38 50 def __init__(self, font): 39 51 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)) 42 54 43 self.w.tabs = vanilla.Tabs((10, 10, -10, -10), ["Window", "GlyphCellView", "GlyphLi neView"])55 self.w.tabs = vanilla.Tabs((10, 10, -10, -10), ["Window", "GlyphCellView", "GlyphList", "GlyphLineView", "Misc. Controls"]) 44 56 self.windowTab = self.w.tabs[0] 45 57 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] 47 61 48 62 # test various window methods … … 55 69 56 70 # test cell view 57 # test automatic updating58 71 self.cellViewTab.cellViewModifyButton = vanilla.Button((10, 10, 150, 20), "Modify Glyphs", callback=self.cellViewModify) 59 # test cell sizes60 72 self.cellViewTab.cellViewSizeSlider = vanilla.Slider((170, 10, 150, 20), minValue=10, maxValue=100, value=50, 61 73 continuous=False, callback=self.cellViewResize) 62 # the cell view63 74 self.cellViewTab.cellView = GlyphCellView((10, 40, -10, -10), allowDrag=True, 64 75 selectionCallback=self.cellViewSelectionCallback, doubleClickCallback=self.cellViewDoubleClickCallback, … … 67 78 self.cellViewResize(self.cellViewTab.cellViewSizeSlider) 68 79 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 69 91 # test line view 70 92 self.lineViewTab.textInput = vanilla.EditText((10, 10, -10, 22), callback=self.lineViewTextInput) 71 93 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) 72 98 73 99 self.setUpBaseWindowBehavior() … … 145 171 self.cellViewTab.cellView.setCellRepresentationArguments(drawHeader=drawHeader, drawMetrics=drawHeader) 146 172 173 # list view 174 175 def listViewEdit(self, sender): 176 pass 177 147 178 # line view 148 179 … … 157 188 return True 158 189 190 159 191 if __name__ == "__main__": 160 192 AppHelper.runEventLoop()
