Pratt 1.5.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (283) hide show
  1. data/.exrc +61 -0
  2. data/.gitignore +4 -0
  3. data/History.txt +6 -0
  4. data/Manifest.txt +46 -0
  5. data/Pratt.gemspec +351 -0
  6. data/README.txt +66 -0
  7. data/Rakefile +85 -0
  8. data/TODO +54 -0
  9. data/VERSION +1 -0
  10. data/bin/pratt.rb +13 -0
  11. data/config.rb +34 -0
  12. data/lib/pratt.rb +527 -0
  13. data/lib/pratt/array.rb +11 -0
  14. data/lib/pratt/string.rb +18 -0
  15. data/models/app.rb +40 -0
  16. data/models/customer.rb +24 -0
  17. data/models/payment.rb +22 -0
  18. data/models/pratt.rb +19 -0
  19. data/models/project.rb +82 -0
  20. data/models/whence.rb +70 -0
  21. data/pkgs/tile-0.8.2.tar.gz +0 -0
  22. data/pkgs/tile-0.8.2/ANNOUNCE.txt +95 -0
  23. data/pkgs/tile-0.8.2/ChangeLog +4651 -0
  24. data/pkgs/tile-0.8.2/Makefile +250 -0
  25. data/pkgs/tile-0.8.2/Makefile.in +250 -0
  26. data/pkgs/tile-0.8.2/README.txt +86 -0
  27. data/pkgs/tile-0.8.2/aclocal.m4 +2 -0
  28. data/pkgs/tile-0.8.2/altTheme.o +0 -0
  29. data/pkgs/tile-0.8.2/blink.o +0 -0
  30. data/pkgs/tile-0.8.2/button.o +0 -0
  31. data/pkgs/tile-0.8.2/cache.o +0 -0
  32. data/pkgs/tile-0.8.2/clamTheme.o +0 -0
  33. data/pkgs/tile-0.8.2/classicTheme.o +0 -0
  34. data/pkgs/tile-0.8.2/config.log +1330 -0
  35. data/pkgs/tile-0.8.2/config.status +795 -0
  36. data/pkgs/tile-0.8.2/configure +15248 -0
  37. data/pkgs/tile-0.8.2/configure.in +89 -0
  38. data/pkgs/tile-0.8.2/demos/autocomplete.tcl +59 -0
  39. data/pkgs/tile-0.8.2/demos/demo.tcl +870 -0
  40. data/pkgs/tile-0.8.2/demos/dirbrowser.tcl +167 -0
  41. data/pkgs/tile-0.8.2/demos/dlgtest.tcl +97 -0
  42. data/pkgs/tile-0.8.2/demos/iconlib.tcl +110 -0
  43. data/pkgs/tile-0.8.2/demos/repeater.tcl +117 -0
  44. data/pkgs/tile-0.8.2/demos/toolbutton.tcl +101 -0
  45. data/pkgs/tile-0.8.2/doc/Geometry.3 +230 -0
  46. data/pkgs/tile-0.8.2/doc/INDEX.MAP +153 -0
  47. data/pkgs/tile-0.8.2/doc/Makefile +36 -0
  48. data/pkgs/tile-0.8.2/doc/TILE.XML +45 -0
  49. data/pkgs/tile-0.8.2/doc/Theme.3 +34 -0
  50. data/pkgs/tile-0.8.2/doc/button.n +75 -0
  51. data/pkgs/tile-0.8.2/doc/checkbutton.n +61 -0
  52. data/pkgs/tile-0.8.2/doc/combobox.n +98 -0
  53. data/pkgs/tile-0.8.2/doc/converting.txt +97 -0
  54. data/pkgs/tile-0.8.2/doc/dialog.n +122 -0
  55. data/pkgs/tile-0.8.2/doc/entry.n +438 -0
  56. data/pkgs/tile-0.8.2/doc/frame.n +43 -0
  57. data/pkgs/tile-0.8.2/doc/html/Geometry.html +304 -0
  58. data/pkgs/tile-0.8.2/doc/html/Theme.html +48 -0
  59. data/pkgs/tile-0.8.2/doc/html/button.html +120 -0
  60. data/pkgs/tile-0.8.2/doc/html/category-index.html +18 -0
  61. data/pkgs/tile-0.8.2/doc/html/checkbutton.html +94 -0
  62. data/pkgs/tile-0.8.2/doc/html/combobox.html +164 -0
  63. data/pkgs/tile-0.8.2/doc/html/converting.txt +97 -0
  64. data/pkgs/tile-0.8.2/doc/html/dialog.html +159 -0
  65. data/pkgs/tile-0.8.2/doc/html/entry.html +613 -0
  66. data/pkgs/tile-0.8.2/doc/html/frame.html +76 -0
  67. data/pkgs/tile-0.8.2/doc/html/image.html +100 -0
  68. data/pkgs/tile-0.8.2/doc/html/index.html +25 -0
  69. data/pkgs/tile-0.8.2/doc/html/keyword-index.html +228 -0
  70. data/pkgs/tile-0.8.2/doc/html/label.html +133 -0
  71. data/pkgs/tile-0.8.2/doc/html/labelframe.html +91 -0
  72. data/pkgs/tile-0.8.2/doc/html/manpage.css +212 -0
  73. data/pkgs/tile-0.8.2/doc/html/menubutton.html +63 -0
  74. data/pkgs/tile-0.8.2/doc/html/notebook.html +280 -0
  75. data/pkgs/tile-0.8.2/doc/html/paned.html +149 -0
  76. data/pkgs/tile-0.8.2/doc/html/progressbar.html +138 -0
  77. data/pkgs/tile-0.8.2/doc/html/radiobutton.html +89 -0
  78. data/pkgs/tile-0.8.2/doc/html/scrollbar.html +221 -0
  79. data/pkgs/tile-0.8.2/doc/html/separator.html +48 -0
  80. data/pkgs/tile-0.8.2/doc/html/sizegrip.html +62 -0
  81. data/pkgs/tile-0.8.2/doc/html/style.html +172 -0
  82. data/pkgs/tile-0.8.2/doc/html/tile-intro.html +164 -0
  83. data/pkgs/tile-0.8.2/doc/html/treeview.html +634 -0
  84. data/pkgs/tile-0.8.2/doc/html/widget.html +342 -0
  85. data/pkgs/tile-0.8.2/doc/image.n +81 -0
  86. data/pkgs/tile-0.8.2/doc/internals.txt +409 -0
  87. data/pkgs/tile-0.8.2/doc/label.n +75 -0
  88. data/pkgs/tile-0.8.2/doc/labelframe.n +64 -0
  89. data/pkgs/tile-0.8.2/doc/man.macros +239 -0
  90. data/pkgs/tile-0.8.2/doc/menubutton.n +41 -0
  91. data/pkgs/tile-0.8.2/doc/notebook.n +188 -0
  92. data/pkgs/tile-0.8.2/doc/paned.n +95 -0
  93. data/pkgs/tile-0.8.2/doc/progressbar.n +79 -0
  94. data/pkgs/tile-0.8.2/doc/radiobutton.n +57 -0
  95. data/pkgs/tile-0.8.2/doc/scrollbar.n +160 -0
  96. data/pkgs/tile-0.8.2/doc/separator.n +30 -0
  97. data/pkgs/tile-0.8.2/doc/sizegrip.n +53 -0
  98. data/pkgs/tile-0.8.2/doc/style.n +119 -0
  99. data/pkgs/tile-0.8.2/doc/tile-intro.n +165 -0
  100. data/pkgs/tile-0.8.2/doc/tmml.options +4 -0
  101. data/pkgs/tile-0.8.2/doc/treeview.n +415 -0
  102. data/pkgs/tile-0.8.2/doc/widget.n +227 -0
  103. data/pkgs/tile-0.8.2/doc/xml/Geometry.tmml +379 -0
  104. data/pkgs/tile-0.8.2/doc/xml/INDEX.MAP +153 -0
  105. data/pkgs/tile-0.8.2/doc/xml/Theme.tmml +63 -0
  106. data/pkgs/tile-0.8.2/doc/xml/button.tmml +134 -0
  107. data/pkgs/tile-0.8.2/doc/xml/checkbutton.tmml +119 -0
  108. data/pkgs/tile-0.8.2/doc/xml/combobox.tmml +184 -0
  109. data/pkgs/tile-0.8.2/doc/xml/dialog.tmml +195 -0
  110. data/pkgs/tile-0.8.2/doc/xml/entry.tmml +630 -0
  111. data/pkgs/tile-0.8.2/doc/xml/frame.tmml +98 -0
  112. data/pkgs/tile-0.8.2/doc/xml/image.tmml +101 -0
  113. data/pkgs/tile-0.8.2/doc/xml/label.tmml +154 -0
  114. data/pkgs/tile-0.8.2/doc/xml/labelframe.tmml +116 -0
  115. data/pkgs/tile-0.8.2/doc/xml/menubutton.tmml +80 -0
  116. data/pkgs/tile-0.8.2/doc/xml/notebook.tmml +306 -0
  117. data/pkgs/tile-0.8.2/doc/xml/paned.tmml +154 -0
  118. data/pkgs/tile-0.8.2/doc/xml/progressbar.tmml +151 -0
  119. data/pkgs/tile-0.8.2/doc/xml/radiobutton.tmml +109 -0
  120. data/pkgs/tile-0.8.2/doc/xml/scrollbar.tmml +233 -0
  121. data/pkgs/tile-0.8.2/doc/xml/separator.tmml +59 -0
  122. data/pkgs/tile-0.8.2/doc/xml/sizegrip.tmml +82 -0
  123. data/pkgs/tile-0.8.2/doc/xml/style.tmml +171 -0
  124. data/pkgs/tile-0.8.2/doc/xml/tile-intro.tmml +192 -0
  125. data/pkgs/tile-0.8.2/doc/xml/treeview.tmml +604 -0
  126. data/pkgs/tile-0.8.2/doc/xml/widget.tmml +372 -0
  127. data/pkgs/tile-0.8.2/entry.o +0 -0
  128. data/pkgs/tile-0.8.2/frame.o +0 -0
  129. data/pkgs/tile-0.8.2/generic/Makefile.in +221 -0
  130. data/pkgs/tile-0.8.2/generic/TODO +493 -0
  131. data/pkgs/tile-0.8.2/generic/altTheme.c +1172 -0
  132. data/pkgs/tile-0.8.2/generic/blink.c +168 -0
  133. data/pkgs/tile-0.8.2/generic/button.c +858 -0
  134. data/pkgs/tile-0.8.2/generic/cache.c +354 -0
  135. data/pkgs/tile-0.8.2/generic/clamTheme.c +974 -0
  136. data/pkgs/tile-0.8.2/generic/classicTheme.c +518 -0
  137. data/pkgs/tile-0.8.2/generic/configure +10334 -0
  138. data/pkgs/tile-0.8.2/generic/configure.in +100 -0
  139. data/pkgs/tile-0.8.2/generic/entry.c +1922 -0
  140. data/pkgs/tile-0.8.2/generic/frame.c +648 -0
  141. data/pkgs/tile-0.8.2/generic/gunk.h +44 -0
  142. data/pkgs/tile-0.8.2/generic/image.c +416 -0
  143. data/pkgs/tile-0.8.2/generic/label.c +663 -0
  144. data/pkgs/tile-0.8.2/generic/layout.c +1215 -0
  145. data/pkgs/tile-0.8.2/generic/manager.c +554 -0
  146. data/pkgs/tile-0.8.2/generic/manager.h +91 -0
  147. data/pkgs/tile-0.8.2/generic/notebook.c +1380 -0
  148. data/pkgs/tile-0.8.2/generic/paned.c +958 -0
  149. data/pkgs/tile-0.8.2/generic/pkgIndex.tcl.in +7 -0
  150. data/pkgs/tile-0.8.2/generic/progress.c +549 -0
  151. data/pkgs/tile-0.8.2/generic/scale.c +526 -0
  152. data/pkgs/tile-0.8.2/generic/scroll.c +253 -0
  153. data/pkgs/tile-0.8.2/generic/scrollbar.c +346 -0
  154. data/pkgs/tile-0.8.2/generic/separator.c +132 -0
  155. data/pkgs/tile-0.8.2/generic/square.c +306 -0
  156. data/pkgs/tile-0.8.2/generic/tagset.c +147 -0
  157. data/pkgs/tile-0.8.2/generic/tile.c +296 -0
  158. data/pkgs/tile-0.8.2/generic/tkElements.c +1280 -0
  159. data/pkgs/tile-0.8.2/generic/tkTheme.c +1708 -0
  160. data/pkgs/tile-0.8.2/generic/tkTheme.h +419 -0
  161. data/pkgs/tile-0.8.2/generic/tkThemeInt.h +45 -0
  162. data/pkgs/tile-0.8.2/generic/tkstate.c +268 -0
  163. data/pkgs/tile-0.8.2/generic/trace.c +145 -0
  164. data/pkgs/tile-0.8.2/generic/track.c +174 -0
  165. data/pkgs/tile-0.8.2/generic/treeview.c +3211 -0
  166. data/pkgs/tile-0.8.2/generic/ttk.decls +154 -0
  167. data/pkgs/tile-0.8.2/generic/ttkDecls.h +340 -0
  168. data/pkgs/tile-0.8.2/generic/ttkStubInit.c +61 -0
  169. data/pkgs/tile-0.8.2/generic/ttkStubLib.c +70 -0
  170. data/pkgs/tile-0.8.2/generic/widget.c +785 -0
  171. data/pkgs/tile-0.8.2/generic/widget.h +263 -0
  172. data/pkgs/tile-0.8.2/image.o +0 -0
  173. data/pkgs/tile-0.8.2/label.o +0 -0
  174. data/pkgs/tile-0.8.2/layout.o +0 -0
  175. data/pkgs/tile-0.8.2/library/altTheme.tcl +101 -0
  176. data/pkgs/tile-0.8.2/library/aquaTheme.tcl +62 -0
  177. data/pkgs/tile-0.8.2/library/button.tcl +85 -0
  178. data/pkgs/tile-0.8.2/library/clamTheme.tcl +139 -0
  179. data/pkgs/tile-0.8.2/library/classicTheme.tcl +108 -0
  180. data/pkgs/tile-0.8.2/library/combobox.tcl +439 -0
  181. data/pkgs/tile-0.8.2/library/cursors.tcl +36 -0
  182. data/pkgs/tile-0.8.2/library/defaults.tcl +118 -0
  183. data/pkgs/tile-0.8.2/library/dialog.tcl +274 -0
  184. data/pkgs/tile-0.8.2/library/entry.tcl +580 -0
  185. data/pkgs/tile-0.8.2/library/fonts.tcl +153 -0
  186. data/pkgs/tile-0.8.2/library/icons.tcl +105 -0
  187. data/pkgs/tile-0.8.2/library/keynav.tcl +192 -0
  188. data/pkgs/tile-0.8.2/library/menubutton.tcl +171 -0
  189. data/pkgs/tile-0.8.2/library/notebook.tcl +193 -0
  190. data/pkgs/tile-0.8.2/library/paned.tcl +87 -0
  191. data/pkgs/tile-0.8.2/library/progress.tcl +51 -0
  192. data/pkgs/tile-0.8.2/library/scale.tcl +54 -0
  193. data/pkgs/tile-0.8.2/library/scrollbar.tcl +125 -0
  194. data/pkgs/tile-0.8.2/library/sizegrip.tcl +77 -0
  195. data/pkgs/tile-0.8.2/library/tile.tcl +211 -0
  196. data/pkgs/tile-0.8.2/library/treeview.tcl +382 -0
  197. data/pkgs/tile-0.8.2/library/utils.tcl +254 -0
  198. data/pkgs/tile-0.8.2/library/winTheme.tcl +77 -0
  199. data/pkgs/tile-0.8.2/library/xpTheme.tcl +63 -0
  200. data/pkgs/tile-0.8.2/libtile0.8.2.so +0 -0
  201. data/pkgs/tile-0.8.2/libttkstub.a +0 -0
  202. data/pkgs/tile-0.8.2/license.terms +24 -0
  203. data/pkgs/tile-0.8.2/macosx/aquaTheme.c +1076 -0
  204. data/pkgs/tile-0.8.2/manager.o +0 -0
  205. data/pkgs/tile-0.8.2/notebook.o +0 -0
  206. data/pkgs/tile-0.8.2/paned.o +0 -0
  207. data/pkgs/tile-0.8.2/pkgIndex.tcl +3 -0
  208. data/pkgs/tile-0.8.2/progress.o +0 -0
  209. data/pkgs/tile-0.8.2/scale.o +0 -0
  210. data/pkgs/tile-0.8.2/scroll.o +0 -0
  211. data/pkgs/tile-0.8.2/scrollbar.o +0 -0
  212. data/pkgs/tile-0.8.2/separator.o +0 -0
  213. data/pkgs/tile-0.8.2/tagset.o +0 -0
  214. data/pkgs/tile-0.8.2/tclconfig/install-sh +119 -0
  215. data/pkgs/tile-0.8.2/tclconfig/tcl.m4 +4069 -0
  216. data/pkgs/tile-0.8.2/tclconfig/teax.m4 +109 -0
  217. data/pkgs/tile-0.8.2/tests/all.tcl +18 -0
  218. data/pkgs/tile-0.8.2/tests/bwidget.test +103 -0
  219. data/pkgs/tile-0.8.2/tests/cbtest.tcl +125 -0
  220. data/pkgs/tile-0.8.2/tests/combobox.test +51 -0
  221. data/pkgs/tile-0.8.2/tests/compound.tcl +92 -0
  222. data/pkgs/tile-0.8.2/tests/entry.test +285 -0
  223. data/pkgs/tile-0.8.2/tests/entrytest.tcl +78 -0
  224. data/pkgs/tile-0.8.2/tests/image.test +94 -0
  225. data/pkgs/tile-0.8.2/tests/labelframe.tcl +41 -0
  226. data/pkgs/tile-0.8.2/tests/labelframe.test +137 -0
  227. data/pkgs/tile-0.8.2/tests/layout.test +33 -0
  228. data/pkgs/tile-0.8.2/tests/misc.test +35 -0
  229. data/pkgs/tile-0.8.2/tests/nbtest.tcl +66 -0
  230. data/pkgs/tile-0.8.2/tests/notebook.test +500 -0
  231. data/pkgs/tile-0.8.2/tests/paned.test +298 -0
  232. data/pkgs/tile-0.8.2/tests/progress.test +92 -0
  233. data/pkgs/tile-0.8.2/tests/pwtest.tcl +90 -0
  234. data/pkgs/tile-0.8.2/tests/sbtest.tcl +79 -0
  235. data/pkgs/tile-0.8.2/tests/scrollbar.test +77 -0
  236. data/pkgs/tile-0.8.2/tests/sgtest.tcl +52 -0
  237. data/pkgs/tile-0.8.2/tests/testutils.tcl +20 -0
  238. data/pkgs/tile-0.8.2/tests/tile.test +674 -0
  239. data/pkgs/tile-0.8.2/tests/treetags.test +78 -0
  240. data/pkgs/tile-0.8.2/tests/treeview.test +563 -0
  241. data/pkgs/tile-0.8.2/tests/tvtest.tcl +332 -0
  242. data/pkgs/tile-0.8.2/tests/validate.test +278 -0
  243. data/pkgs/tile-0.8.2/tile.o +0 -0
  244. data/pkgs/tile-0.8.2/tkElements.o +0 -0
  245. data/pkgs/tile-0.8.2/tkTheme.o +0 -0
  246. data/pkgs/tile-0.8.2/tkstate.o +0 -0
  247. data/pkgs/tile-0.8.2/tools/genStubs.tcl +861 -0
  248. data/pkgs/tile-0.8.2/trace.o +0 -0
  249. data/pkgs/tile-0.8.2/track.o +0 -0
  250. data/pkgs/tile-0.8.2/treeview.o +0 -0
  251. data/pkgs/tile-0.8.2/ttkStubInit.o +0 -0
  252. data/pkgs/tile-0.8.2/ttkStubLib.o +0 -0
  253. data/pkgs/tile-0.8.2/widget.o +0 -0
  254. data/pkgs/tile-0.8.2/win/Tile.dsp +261 -0
  255. data/pkgs/tile-0.8.2/win/makefile.vc +527 -0
  256. data/pkgs/tile-0.8.2/win/monitor.c +164 -0
  257. data/pkgs/tile-0.8.2/win/nmakehlp.c +483 -0
  258. data/pkgs/tile-0.8.2/win/rules.vc +512 -0
  259. data/pkgs/tile-0.8.2/win/tile.rc +40 -0
  260. data/pkgs/tile-0.8.2/win/winTheme.c +734 -0
  261. data/pkgs/tile-0.8.2/win/xpTheme.c +1029 -0
  262. data/spec/app_spec.rb +48 -0
  263. data/spec/customer_spec.rb +31 -0
  264. data/spec/fixtures/graph.expectation +18 -0
  265. data/spec/payment_spec.rb +19 -0
  266. data/spec/pratt_spec.rb +148 -0
  267. data/spec/project_spec.rb +163 -0
  268. data/spec/rcov.opts +0 -0
  269. data/spec/spec.opts +1 -0
  270. data/spec/spec_helper.rb +21 -0
  271. data/spec/whence_spec.rb +54 -0
  272. data/tasks/pratt.rb +84 -0
  273. data/templates/model.eruby +12 -0
  274. data/templates/spec.eruby +8 -0
  275. data/views/env.rb +22 -0
  276. data/views/graph.eruby +20 -0
  277. data/views/invoice.eruby +148 -0
  278. data/views/main.rb +92 -0
  279. data/views/pid.eruby +3 -0
  280. data/views/pop.rb +94 -0
  281. data/views/pop2.rb +75 -0
  282. data/views/raw.eruby +11 -0
  283. metadata +390 -0
@@ -0,0 +1,332 @@
1
+ # tvtest.tcl,v 1.11 2006/12/18 19:03:33 jenglish Exp
2
+ #
3
+ # Sandbox test script for treeview testing
4
+ #
5
+
6
+ package require tile
7
+
8
+ source [file join [file dirname [info script]] testutils.tcl]
9
+
10
+ set haveswaplist [expr {![catch {package require swaplist}]}]
11
+ set haveinplace [expr {![catch {package require tile::inplace}]}]
12
+
13
+ option add *Toolbar*TCheckbutton.style Toolbutton
14
+ option add *Toolbar*TRadiobutton.style Toolbutton
15
+ option add *tearOff 0
16
+
17
+ #
18
+ # Tree window:
19
+ #
20
+ set f [ttk::frame .f]
21
+ set tv $f.tv
22
+ ttk::scrollbar $f.vsb -orient vertical -command [list $tv yview]
23
+ ttk::scrollbar $f.hsb -orient horizontal -command [list $tv xview]
24
+ ttk::treeview $tv \
25
+ -columns [list X Y Z] -displaycolumns [list X Y Z] \
26
+ -yscrollcommand [list $f.vsb set] \
27
+ -xscrollcommand [list $f.hsb set] \
28
+ ;
29
+
30
+ grid $f.tv $f.vsb -sticky news
31
+ grid $f.hsb -sticky news
32
+ grid columnconfigure $f 0 -weight 1
33
+ grid rowconfigure $f 0 -weight 1
34
+
35
+ #
36
+ # Status bar:
37
+ #
38
+
39
+ style configure Indicator.TLabel -relief sunken -borderwidth 1
40
+ option add *Indicator.style Indicator.TLabel
41
+
42
+ set s [ttk::frame .status -class Statusbar]
43
+
44
+ pack \
45
+ [ttk::label $s.l -class Indicator -textvariable message -width 20] \
46
+ [ttk::label $s.lr -text "Row:" ] \
47
+ [ttk::label $s.r -class Indicator -textvariable ::irow -width 10] \
48
+ [ttk::label $s.lc -text "Col:" ] \
49
+ [ttk::label $s.c -class Indicator -textvariable ::icol -width 10] \
50
+ [ttk::label $s.lb -text "BBox:" ] \
51
+ [ttk::label $s.b -class Indicator -textvariable ::bbox -width 16] \
52
+ -side left -pady 2;
53
+
54
+ #
55
+ # View control:
56
+ #
57
+ set Show(headings) 1
58
+ set Show(tree) 1
59
+ proc setShow {tv} {
60
+ variable Show
61
+ set show [list]
62
+ foreach {what} [list headings tree] {
63
+ if {$Show($what)} {
64
+ lappend show $what
65
+ }
66
+ }
67
+ $tv configure -show $show
68
+ }
69
+
70
+ set State(selectMode) extended
71
+ proc setSelectMode {tv} {
72
+ variable State
73
+ $tv configure -selectmode $State(selectMode)
74
+ $tv selection set {}
75
+ }
76
+
77
+ #
78
+ # Menubar:
79
+ #
80
+ set m [menu .menu]
81
+
82
+ $m add cascade -label View -underline 0 -menu [menu $m.view]
83
+ $m.view add checkbutton -label "Headings?" \
84
+ -variable Show(headings) -command [list setShow $f.tv]
85
+ $m.view add checkbutton -label "Tree?" \
86
+ -variable Show(tree) -command [list setShow $f.tv]
87
+ $m.view add separator
88
+ $m.view add radiobutton -label "Extended" \
89
+ -variable State(selectMode) -value extended \
90
+ -command [list setSelectMode $f.tv] ;
91
+ $m.view add radiobutton -label "Browse" \
92
+ -variable State(selectMode) -value browse \
93
+ -command [list setSelectMode $f.tv] ;
94
+ $m.view add radiobutton -label "None" \
95
+ -variable State(selectMode) -value none \
96
+ -command [list setSelectMode $f.tv] ;
97
+
98
+ . configure -menu $m
99
+
100
+ #
101
+ # Toolbar:
102
+ #
103
+ ttk::frame .t -class Toolbar
104
+ raise .t
105
+ pack \
106
+ [ttk::checkbutton .t.sh -text "Headings?" \
107
+ -variable Show(headings) -command [list setShow $f.tv]] \
108
+ [ttk::checkbutton .t.st -text "Tree?" \
109
+ -variable Show(tree) -command [list setShow $f.tv]] \
110
+ [ttk::button .t.db -text "Directory" -command [list dirbrowse [pwd]]] \
111
+ -side left;
112
+
113
+ if {$haveswaplist} {
114
+ pack \
115
+ [ttk::button .t.cl -text "Columns" -command [list selectColumns $tv]] \
116
+ -side left;
117
+ }
118
+
119
+ foreach selectmode {extended browse none} {
120
+ pack [ttk::radiobutton .t.sm-$selectmode -text $selectmode \
121
+ -variable State(selectMode) -value $selectmode \
122
+ -command [list setSelectMode $tv] \
123
+ ] -side left;
124
+ }
125
+
126
+ #
127
+ # Configure tree:
128
+ #
129
+ $tv heading #0 -text "Tree"
130
+ $tv heading X -text "XXX"
131
+ $tv heading Y -text "YYY"
132
+ $tv heading Z -text "ZZZ"
133
+
134
+ pack .t -side top -expand false -fill x
135
+ pack .status -side bottom -expand false -fill x
136
+ pack .f -side top -expand true -fill both -padx 6 -pady 6
137
+
138
+ bind . <KeyPress-Escape> [list destroy .]
139
+
140
+ bind $tv <Motion> { identify %W %x %y }
141
+ bind $tv <KeyPress-Delete> { %W delete [%W selection] }
142
+
143
+ # identify --
144
+ # Update status bar
145
+ #
146
+ proc identify {tv x y} {
147
+ # Old form:
148
+ set ::message [$tv identify $x $y]
149
+
150
+ # New form:
151
+ set ::irow [$tv identify row $x $y]
152
+ set ::icol [$tv identify column $x $y]
153
+
154
+ if {$::irow ne ""} {
155
+ if {$::icol ne ""} {
156
+ set ::bbox [$tv bbox $::irow $::icol]
157
+ } else {
158
+ set ::bbox [$tv bbox $::irow]
159
+ }
160
+ } else {
161
+ set ::bbox N/A
162
+ }
163
+ }
164
+
165
+ ## Add some nodes:
166
+ #
167
+
168
+ $tv insert {} end -id a -text "First node" -values [list a1 a2 a3]
169
+ $tv insert {} end -id b -text "Second node" -values [list b1 b2 b3]
170
+ $tv insert {} end -id c -text "Third node" -values [list c1 c2 c3]
171
+
172
+ $tv insert {} end -id moveme -text "Press ^M to move me" -values {- - -}
173
+ bind $tv <Control-KeyPress-m> {
174
+ %W move moveme [%W parent [%W focus]] [%W index [%W focus]]
175
+ ttk::treeview::BrowseTo %W moveme
176
+ }
177
+ bind $tv <Control-Shift-KeyPress-M> {
178
+ %W move moveme [%W focus] 0
179
+ ttk::treeview::BrowseTo %W moveme
180
+ }
181
+
182
+ $tv insert a end -id a1 -text "First subnode" -values [list d1 d2 d3]
183
+ $tv insert a end -id a2 -text "Second subnode" -values [list e1 e2 e3]
184
+ $tv insert a1 end -text "Subsubnode!!" -values [list X! Y! Z!]
185
+
186
+ foreach label {a b c d e f g h i j k l m n o} {
187
+ $tv insert b end -text $label
188
+ }
189
+
190
+
191
+ # Directory browser:
192
+
193
+ # SOURCE: tkfbox.tcl
194
+ set Icons(folder) [image create photo -data {
195
+ R0lGODlhEAAMAKEAAAD//wAAAPD/gAAAACH5BAEAAAAALAAAAAAQAAwAAAIghINhyycvVFsB
196
+ QtmS3rjaH1Hg141WaT5ouprt2HHcUgAAOw==}]
197
+
198
+ set Icons(file) [image create photo -data {
199
+ R0lGODlhDAAMAKEAALLA3AAAAP//8wAAACH5BAEAAAAALAAAAAAMAAwAAAIgRI4Ha+IfWHsO
200
+ rSASvJTGhnhcV3EJlo3kh53ltF5nAhQAOw==}]
201
+
202
+ proc loaddir {tv node dir} {
203
+ variable Icons
204
+ foreach subdir [glob -nocomplain -type d -directory $dir *] {
205
+ set dirnode [$tv insert $node end -text [file tail $subdir] \
206
+ -image $Icons(folder) -tags DIR -values [list X Y Z]]
207
+ loaddir $tv $dirnode $subdir
208
+ }
209
+ foreach file [glob -nocomplain -type f -directory $dir *] {
210
+ $tv insert $node end -text [file tail $file] \
211
+ -image $Icons(file) -tags FILE -values [list X Y Z]
212
+ }
213
+ }
214
+
215
+ proc scandir {dir} {
216
+ foreach subdir [glob -nocomplain -type d -directory $dir *] {
217
+ scandir $subdir
218
+ }
219
+ glob -nocomplain -type f -directory $dir *
220
+ }
221
+
222
+ proc dirbrowse {dir} {
223
+ set tv $::tv
224
+ $tv tag bind DIR <Double-ButtonPress-1> {
225
+ puts "DIR: [%W item [%W identify row %x %y] -text]"
226
+ }
227
+ $tv tag bind FILE <Double-ButtonPress-1> {
228
+ puts "FILE: [%W item [%W identify row %x %y] -text]"
229
+ }
230
+ $tv tag configure DIR -foreground #000077 -background #777700
231
+ $tv tag configure FILE -foreground #007700 -background #770077
232
+ loaddir $tv [$tv insert {} end -text $dir -tags DIR] $dir
233
+ }
234
+
235
+
236
+ proc setWidths {tv {weights {}} {width {}}} {
237
+ if {$width eq {}} { set width [winfo width $tv] }
238
+ array set W $weights
239
+
240
+ set columns [$tv cget -displaycolumns]
241
+ if {![llength $columns]} {
242
+ set columns [$tv cget -columns]
243
+ }
244
+ set columns [linsert $columns 0 "#0"]
245
+
246
+ set totalWeight 0.0
247
+ set weights [list]
248
+ foreach column $columns {
249
+ if {[info exists W($column)]} {
250
+ set weight $W($column)
251
+ } else {
252
+ set weight 1
253
+ }
254
+ lappend weights $weight
255
+ set totalWeight [expr {$totalWeight+$weight}]
256
+ }
257
+
258
+ foreach column $columns weight $weights {
259
+ set colwidth [expr {int(($width * $weight)/$totalWeight)}]
260
+ $tv column $column -width $colwidth
261
+ }
262
+ }
263
+
264
+ proc selectColumns {tv} {
265
+ set columns [$tv cget -displaycolumns]
266
+ if {[swaplist::swaplist $tv.c columns [$tv cget -columns] $columns]} {
267
+ $tv configure -displaycolumns $columns
268
+ }
269
+ }
270
+
271
+ # ...
272
+ if {$haveinplace} {
273
+
274
+ bind $tv <ButtonPress-2> { clickToEdit %W %x %y }
275
+
276
+ proc clickToEdit {tv x y} {
277
+ set row [$tv identify row $x $y]
278
+ set column [$tv identify column $x $y]
279
+ if {$row ne "" && $column ne ""} {
280
+ ttk::treeview::edit $tv $row $column
281
+ }
282
+ }
283
+ }
284
+
285
+ menu $tv.m -tearoff false -borderwidth 1
286
+ bind $tv <ButtonPress-3> [list column-menu/post $tv $tv.m %x %y]
287
+
288
+ proc column-menu/post {tv m x y} {
289
+ upvar #0 $m M
290
+
291
+ set M(tv) $tv
292
+ set M(column) [$tv identify column $x $y]
293
+ set M(stretch) [$tv column $M(column) -stretch]
294
+
295
+ set displaycolumns [$tv cget -displaycolumns]
296
+ foreach column [$tv cget -columns] {
297
+ set M(show.$column) [expr {[lsearch $displaycolumns $column] >= 0}]
298
+ }
299
+
300
+ $m delete 0 end
301
+ $m add checkbutton -label "Stretch?" \
302
+ -variable ${m}(stretch) \
303
+ -command [list column-menu/stretch-changed $m] \
304
+ ;
305
+ $m add separator
306
+ foreach column [$tv cget -columns] {
307
+ $m add checkbutton \
308
+ -label [$tv heading $column -text] \
309
+ -variable ${m}(show.$column) \
310
+ -command [list column-menu/show-changed $m] \
311
+ ;
312
+ }
313
+
314
+ tk_popup $m [winfo pointerx $m] [winfo pointery $m]
315
+ }
316
+
317
+ proc column-menu/show-changed {m} {
318
+ upvar #0 $m M
319
+ set tv [winfo parent $m]
320
+ set displaycolumns [list]
321
+ foreach column [$tv cget -columns] {
322
+ if {$M(show.$column)} {
323
+ lappend displaycolumns $column
324
+ }
325
+ }
326
+ $tv configure -displaycolumns $displaycolumns
327
+ }
328
+
329
+ proc column-menu/stretch-changed {m} {
330
+ upvar #0 $m M
331
+ $M(tv) column $M(column) -stretch $M(stretch)
332
+ }
@@ -0,0 +1,278 @@
1
+ ##
2
+ ## Entry widget validation tests
3
+ ## Derived from core test suite entry-19.1 through entry-19.20
4
+ ##
5
+
6
+ package require Tk
7
+ package require tcltest 2.1
8
+ namespace import -force tcltest::*
9
+
10
+ loadTestedCommands
11
+
12
+ testConstraint tileEntry 1
13
+ testConstraint coreEntry [expr ![testConstraint tileEntry]]
14
+
15
+ eval tcltest::configure $argv
16
+
17
+ test validate-0.0 "Setup" -constraints tileEntry -body {
18
+ lappend auto_path . ; package require tile
19
+ rename entry {}
20
+ interp alias {} entry {} ttk::entry
21
+ return;
22
+ }
23
+
24
+ test validate-0.1 "More setup" -body {
25
+ destroy .e
26
+ catch {unset ::e}
27
+ catch {unset ::vVals}
28
+ entry .e -validate all \
29
+ -validatecommand [list doval %W %d %i %P %s %S %v %V] \
30
+ -invalidcommand bell \
31
+ -textvariable ::e \
32
+ ;
33
+ pack .e
34
+ proc doval {W d i P s S v V} {
35
+ set ::vVals [list $W $d $i $P $s $S $v $V]
36
+ return 1
37
+ }
38
+ }
39
+
40
+ # The validation tests build each one upon the previous, so cascading
41
+ # failures aren't good
42
+ #
43
+ test validate-1.1 {entry widget validation - insert} -body {
44
+ .e insert 0 a
45
+ set ::vVals
46
+ } -result {.e 1 0 a {} a all key}
47
+
48
+ test validate-1.2 {entry widget validation - insert} -body {
49
+ .e insert 1 b
50
+ set ::vVals
51
+ } -result {.e 1 1 ab a b all key}
52
+
53
+ test validate-1.3 {entry widget validation - insert} -body {
54
+ .e insert end c
55
+ set ::vVals
56
+ } -result {.e 1 2 abc ab c all key}
57
+
58
+ test validate-1.4 {entry widget validation - insert} -body {
59
+ .e insert 1 123
60
+ list $::vVals $::e
61
+ } -result {{.e 1 1 a123bc abc 123 all key} a123bc}
62
+
63
+ test validate-1.5 {entry widget validation - delete} -body {
64
+ .e delete 2
65
+ set ::vVals
66
+ } -result {.e 0 2 a13bc a123bc 2 all key}
67
+
68
+ test validate-1.6 {entry widget validation - delete} -body {
69
+ .e configure -validate key
70
+ .e delete 1 3
71
+ set ::vVals
72
+ } -result {.e 0 1 abc a13bc 13 key key}
73
+
74
+ test validate-1.7 {entry widget validation - vmode focus} -body {
75
+ set ::vVals {}
76
+ .e configure -validate focus
77
+ .e insert end d
78
+ set ::vVals
79
+ } -result {}
80
+
81
+ test validate-1.8 {entry widget validation - vmode focus} -body {
82
+ focus -force .e
83
+ # update necessary to process FocusIn event
84
+ update
85
+ set ::vVals
86
+ } -result {.e -1 -1 abcd abcd {} focus focusin}
87
+
88
+ test validate-1.9 {entry widget validation - vmode focus} -body {
89
+ focus -force .
90
+ # update necessary to process FocusOut event
91
+ update
92
+ set ::vVals
93
+ } -result {.e -1 -1 abcd abcd {} focus focusout}
94
+
95
+ .e configure -validate all
96
+ test validate-1.10 {entry widget validation - vmode all} -body {
97
+ focus -force .e
98
+ # update necessary to process FocusIn event
99
+ update
100
+ set ::vVals
101
+ } -result {.e -1 -1 abcd abcd {} all focusin}
102
+
103
+ test validate-1.11 {entry widget validation} -body {
104
+ focus -force .
105
+ # update necessary to process FocusOut event
106
+ update
107
+ set ::vVals
108
+ } -result {.e -1 -1 abcd abcd {} all focusout}
109
+ .e configure -validate focusin
110
+
111
+ test validate-1.12 {entry widget validation} -body {
112
+ focus -force .e
113
+ # update necessary to process FocusIn event
114
+ update
115
+ set ::vVals
116
+ } -result {.e -1 -1 abcd abcd {} focusin focusin}
117
+
118
+ test validate-1.13 {entry widget validation} -body {
119
+ set ::vVals {}
120
+ focus -force .
121
+ # update necessary to process FocusOut event
122
+ update
123
+ set ::vVals
124
+ } -result {}
125
+ .e configure -validate focuso
126
+
127
+ test validate-1.14 {entry widget validation} -body {
128
+ focus -force .e
129
+ # update necessary to process FocusIn event
130
+ update
131
+ set ::vVals
132
+ } -result {}
133
+
134
+ test validate-1.15 {entry widget validation} -body {
135
+ focus -force .
136
+ # update necessary to process FocusOut event
137
+ update
138
+ set ::vVals
139
+ } -result {.e -1 -1 abcd abcd {} focusout focusout}
140
+
141
+ # DIFFERENCE: core entry temporarily sets "-validate all", ttk::entry doesn't.
142
+ test validate-1.16 {entry widget validation} -body {
143
+ .e configure -validate all
144
+ list [.e validate] $::vVals
145
+ } -result {1 {.e -1 -1 abcd abcd {} all forced}}
146
+
147
+ # DIFFERENCE: ttk::entry does not perform validation when setting the -variable
148
+ test validate-1.17 {entry widget validation} -constraints coreEntry -body {
149
+ .e configure -validate all
150
+ set ::e newdata
151
+ list [.e cget -validate] $::vVals
152
+ } -result {all {.e -1 -1 newdata abcd {} all forced}}
153
+
154
+ proc doval {W d i P s S v V} {
155
+ set ::vVals [list $W $d $i $P $s $S $v $V]
156
+ return 0
157
+ }
158
+
159
+ test validate-1.18 {entry widget validation} -constraints coreEntry -body {
160
+ .e configure -validate all
161
+ set ::e nextdata
162
+ list [.e cget -validate] $::vVals
163
+ } -result {none {.e -1 -1 nextdata newdata {} all forced}}
164
+ # DIFFERENCE: ttk::entry doesn't validate when setting linked -variable
165
+ # DIFFERENCE: ttk::entry doesn't disable validation
166
+
167
+ proc doval {W d i P s S v V} {
168
+ set ::vVals [list $W $d $i $P $s $S $v $V]
169
+ set ::e mydata
170
+ return 1
171
+ }
172
+
173
+ ## This sets validate to none because it shows that we prevent a possible
174
+ ## loop condition in the validation, when the entry textvar is also set
175
+ test validate-1.19 {entry widget validation} -constraints coreEntry -body {
176
+ .e configure -validate all
177
+ .e validate
178
+ list [.e cget -validate] [.e get] $::vVals
179
+ } -result {none mydata {.e -1 -1 nextdata nextdata {} all forced}}
180
+
181
+ ## This leaves validate alone because we trigger validation through the
182
+ ## textvar (a write trace), and the write during validation triggers
183
+ ## nothing (by definition of avoiding loops on var traces). This is
184
+ ## one of those "dangerous" conditions where the user will have a
185
+ ## different value in the entry widget shown as is in the textvar.
186
+
187
+ # DIFFERENCE: tile entry doesn't get out of sync w/textvar
188
+ test validate-1.20 {entry widget validation} -constraints coreEntry -body {
189
+ .e configure -validate all
190
+ set ::e testdata
191
+ list [.e cget -validate] [.e get] $::e $::vVals
192
+ } -result {all testdata mydata {.e -1 -1 testdata mydata {} all forced}}
193
+
194
+ #
195
+ # New tests, -JE:
196
+ #
197
+ proc doval {W d i P s S v V} {
198
+ set ::vVals [list $W $d $i $P $s $S $v $V]
199
+ .e delete 0 end;
200
+ .e insert end dovaldata
201
+ return 0
202
+ }
203
+ test validate-2.1 "Validation script changes value" -body {
204
+ .e configure -validate none
205
+ set ::e testdata
206
+ .e configure -validate all
207
+ .e validate
208
+ list [.e get] $::e $::vVals
209
+ } -result {dovaldata dovaldata {.e -1 -1 testdata testdata {} all forced}}
210
+ # DIFFERENCE: core entry disables validation, tile entry does not.
211
+
212
+ destroy .e
213
+ catch {unset ::e ::vVals}
214
+
215
+ # See bug #1236979
216
+
217
+ test validate-2.2 "configure in -validatecommand" -body {
218
+ proc validate-2.2 {win str} {
219
+ $win configure -foreground black
220
+ return 1
221
+ }
222
+ ttk::entry .e -textvariable var -validatecommand {validate-2.2 %W %P}
223
+ .e validate
224
+ } -result 1 -cleanup { destroy .e }
225
+
226
+
227
+ ### invalid state behavior
228
+ #
229
+
230
+ test validate-3.0 "Setup" -body {
231
+ set ::E "123"
232
+ ttk::entry .e \
233
+ -validatecommand {string is integer -strict %P} \
234
+ -validate all \
235
+ -textvariable ::E \
236
+ ;
237
+ return [list [.e get] [.e state]]
238
+ } -result [list 123 {}]
239
+
240
+ test validate-3.1 "insert - valid" -body {
241
+ .e insert end "4"
242
+ return [list [.e get] [.e state]]
243
+ } -result [list 1234 {}]
244
+
245
+ test validate-3.2 "insert - invalid" -body {
246
+ .e insert end "X"
247
+ return [list [.e get] [.e state]]
248
+ } -result [list 1234 {}]
249
+
250
+ test validate-3.3 "force invalid value" -body {
251
+ append ::E "XY"
252
+ return [list [.e get] [.e state]]
253
+ } -result [list 1234XY {}]
254
+
255
+ test validate-3.4 "revalidate" -body {
256
+ return [list [.e validate] [.e get] [.e state]]
257
+ } -result [list 0 1234XY {invalid}]
258
+
259
+ testConstraint NA 0
260
+ # the next two tests (used to) exercise validation lockout protection --
261
+ # if the widget is currently invalid, all edits are allowed.
262
+ # This behavior is currently disabled.
263
+ #
264
+ test validate-3.5 "all edits allowed while invalid" -constraints NA -body {
265
+ .e delete 4
266
+ return [list [.e get] [.e state]]
267
+ } -result [list 1234Y {invalid}]
268
+
269
+ test validate-3.6 "...until the value becomes valid" -constraints NA -body {
270
+ .e delete 4
271
+ return [list [.e get] [.e state]]
272
+ } -result [list 1234 {}]
273
+
274
+ test validate-3.last "Cleanup" -body { destroy .e }
275
+
276
+
277
+ ###
278
+ tcltest::cleanupTests