1 | # This program is under CECILL_B licence. See footer for details. |
---|
2 | |
---|
3 | proc dTreeBrowser_create {win} { |
---|
4 | ttk::frame $win |
---|
5 | ttk::scrollbar $win.ybar -command "$win.treev yview" |
---|
6 | ttk::scrollbar $win.xbar -orient horizontal -command "$win.treev xview" |
---|
7 | ttk::treeview $win.treev -yscrollcommand "$win.ybar set" -xscrollcommand "$win.xbar set" -columns "attribute value" |
---|
8 | |
---|
9 | |
---|
10 | $win.treev heading #0 -text "Node" |
---|
11 | $win.treev heading #1 -text "Attribute" |
---|
12 | $win.treev heading #2 -text "Value" |
---|
13 | |
---|
14 | pack $win.ybar -side right -fill y |
---|
15 | pack $win.xbar -side bottom -fill x |
---|
16 | pack $win.treev -side left -fill both -expand 1 |
---|
17 | return $win |
---|
18 | } |
---|
19 | |
---|
20 | proc dTreeBrowser_fill {args} { |
---|
21 | set win [lindex $args 0] |
---|
22 | set tree [lindex $args 1] |
---|
23 | set status 0 |
---|
24 | catch {set status [lindex $args 2]} |
---|
25 | dTreeBrowser_fillNode $win $tree "root" $status |
---|
26 | } |
---|
27 | |
---|
28 | proc dTreeBrowser_fillNode {win tree node status} { |
---|
29 | global widgetInfo |
---|
30 | set attributs [dTree_getAttributes $tree $node] |
---|
31 | set children [dTree_getChildren $tree $node] |
---|
32 | set father [lrange $node 0 end-1] |
---|
33 | set name [lindex $node end] |
---|
34 | |
---|
35 | if {$status == 1} { |
---|
36 | catch {lappend attributs [list "status" $widgetInfo([tree2gui $node]-status)]} |
---|
37 | catch {lappend attributs [list "visible" $widgetInfo([tree2gui $node]-visible)]} |
---|
38 | |
---|
39 | } |
---|
40 | |
---|
41 | $win.treev insert $father end -id $node -text $name -open true -tags "tree_nodes" |
---|
42 | |
---|
43 | foreach att $attributs { |
---|
44 | $win.treev insert $node end -text "" -values $att -tags "tree_attributes" |
---|
45 | } |
---|
46 | |
---|
47 | foreach child $children { |
---|
48 | set dummy_node $node |
---|
49 | lappend dummy_node $child |
---|
50 | dTreeBrowser_fillNode $win $tree $dummy_node $status |
---|
51 | } |
---|
52 | |
---|
53 | $win.treev tag configure "tree_nodes" -background grey80 |
---|
54 | $win.treev tag configure "tree_attributes" -background grey90 |
---|
55 | $win.treev column #0 -stretch 0 |
---|
56 | $win.treev column #1 -stretch 0 |
---|
57 | } |
---|
58 | |
---|
59 | |
---|
60 | |
---|
61 | # Copyright CERFACS 2014 |
---|
62 | # |
---|
63 | # antoine.dauptain@cerfacs.fr |
---|
64 | # |
---|
65 | # This software is a computer program whose purpose is to ensure technology |
---|
66 | # transfer between academia and industry. |
---|
67 | # |
---|
68 | # This software is governed by the CeCILL-B license under French law and |
---|
69 | # abiding by the rules of distribution of free software. You can use, |
---|
70 | # modify and/ or redistribute the software under the terms of the CeCILL-B |
---|
71 | # license as circulated by CEA, CNRS and INRIA at the following URL |
---|
72 | # "http://www.cecill.info". |
---|
73 | # |
---|
74 | # As a counterpart to the access to the source code and rights to copy, |
---|
75 | # modify and redistribute granted by the license, users are provided only |
---|
76 | # with a limited warranty and the software's author, the holder of the |
---|
77 | # economic rights, and the successive licensors have only limited |
---|
78 | # liability. |
---|
79 | # |
---|
80 | # In this respect, the user's attention is drawn to the risks associated |
---|
81 | # with loading, using, modifying and/or developing or reproducing the |
---|
82 | # software by the user in light of its specific status of free software, |
---|
83 | # that may mean that it is complicated to manipulate, and that also |
---|
84 | # therefore means that it is reserved for developers and experienced |
---|
85 | # professionals having in-depth computer knowledge. Users are therefore |
---|
86 | # encouraged to load and test the software's suitability as regards their |
---|
87 | # requirements in conditions enabling the security of their systems and/or |
---|
88 | # data to be ensured and, more generally, to use and operate it in the |
---|
89 | # same conditions as regards security. |
---|
90 | # |
---|
91 | # The fact that you are presently reading this means that you have had |
---|
92 | # knowledge of the CeCILL-B license and that you accept its terms. |
---|