1 | # This program is under CECILL_B licence. See footer for details. |
---|
2 | |
---|
3 | |
---|
4 | |
---|
5 | |
---|
6 | # ENTRY CREATION |
---|
7 | |
---|
8 | proc entry_create { args } { |
---|
9 | set mandatory_arguments { path_father address } |
---|
10 | |
---|
11 | # Initializes the widget |
---|
12 | initWidget |
---|
13 | |
---|
14 | ttk::frame $win -height 40p |
---|
15 | |
---|
16 | eval $widgetInfo(packme-$win) |
---|
17 | |
---|
18 | smartpacker_setup_label $win $address |
---|
19 | smartpacker_setup_status $win $address |
---|
20 | |
---|
21 | ttk::entry $win.entry -textvariable widgetInfo($address-variable) |
---|
22 | bind $win.entry <KeyRelease> [subst {eval \$widgetInfo($address-check)}] |
---|
23 | |
---|
24 | place $win.entry -relx 0.5 -rely 0. -relwidth $widgetInfo(guiEntryRelWidth) -anchor nw |
---|
25 | |
---|
26 | |
---|
27 | #add the check/refresh procedure to the bindings of the variable |
---|
28 | |
---|
29 | append widgetInfo($address-refreshStatus) [ subst { entry_refreshStatus $win $address}] |
---|
30 | |
---|
31 | finishWidget |
---|
32 | |
---|
33 | # clean the widget callBack on dstruction |
---|
34 | bind $win <Destroy> [ subst {widget_destroy $win $address}] |
---|
35 | |
---|
36 | return $win |
---|
37 | } |
---|
38 | |
---|
39 | |
---|
40 | proc entry_refreshStatus {win address} { |
---|
41 | global widgetInfo XMLtree |
---|
42 | |
---|
43 | smartpacker_update_visibility $win $address |
---|
44 | |
---|
45 | |
---|
46 | set full_address_XML [split $address "."] |
---|
47 | set type [dTree_getAttribute $XMLtree $full_address_XML "type"] |
---|
48 | |
---|
49 | |
---|
50 | switch -glob $type { |
---|
51 | "*double*" { |
---|
52 | set widgetInfo($address-variable) [string map {"," "."} $widgetInfo($address-variable)] |
---|
53 | } |
---|
54 | "*ascii*" - |
---|
55 | "*string*" { |
---|
56 | set widgetInfo($address-variable) [stringclean $widgetInfo($address-variable)] |
---|
57 | } |
---|
58 | } |
---|
59 | |
---|
60 | |
---|
61 | set test_entry [test_vartype $widgetInfo($address-variable) $type ] |
---|
62 | if { $test_entry == 1 } { |
---|
63 | set widgetInfo($address-status_txt) "" |
---|
64 | set widgetInfo($address-status) 1 |
---|
65 | } else { |
---|
66 | set widgetInfo($address-status_txt) $test_entry |
---|
67 | set widgetInfo($address-status) -1 |
---|
68 | } |
---|
69 | |
---|
70 | |
---|
71 | $win.status configure -image "" |
---|
72 | |
---|
73 | if { $widgetInfo($address-variable) == ""} { |
---|
74 | set widgetInfo($address-status) -1 |
---|
75 | set widgetInfo($address-status_txt) "(...)" |
---|
76 | $win.status configure -image icon_question |
---|
77 | } |
---|
78 | |
---|
79 | if { $widgetInfo($address-status) == -1 && $widgetInfo($address-status_txt) != "(...)" } { |
---|
80 | $win.status configure -image icon_flag |
---|
81 | } |
---|
82 | |
---|
83 | } |
---|
84 | |
---|
85 | |
---|
86 | |
---|
87 | # Copyright CERFACS 2014 |
---|
88 | # |
---|
89 | # antoine.dauptain@cerfacs.fr |
---|
90 | # |
---|
91 | # This software is a computer program whose purpose is to ensure technology |
---|
92 | # transfer between academia and industry. |
---|
93 | # |
---|
94 | # This software is governed by the CeCILL-B license under French law and |
---|
95 | # abiding by the rules of distribution of free software. You can use, |
---|
96 | # modify and/ or redistribute the software under the terms of the CeCILL-B |
---|
97 | # license as circulated by CEA, CNRS and INRIA at the following URL |
---|
98 | # "http://www.cecill.info". |
---|
99 | # |
---|
100 | # As a counterpart to the access to the source code and rights to copy, |
---|
101 | # modify and redistribute granted by the license, users are provided only |
---|
102 | # with a limited warranty and the software's author, the holder of the |
---|
103 | # economic rights, and the successive licensors have only limited |
---|
104 | # liability. |
---|
105 | # |
---|
106 | # In this respect, the user's attention is drawn to the risks associated |
---|
107 | # with loading, using, modifying and/or developing or reproducing the |
---|
108 | # software by the user in light of its specific status of free software, |
---|
109 | # that may mean that it is complicated to manipulate, and that also |
---|
110 | # therefore means that it is reserved for developers and experienced |
---|
111 | # professionals having in-depth computer knowledge. Users are therefore |
---|
112 | # encouraged to load and test the software's suitability as regards their |
---|
113 | # requirements in conditions enabling the security of their systems and/or |
---|
114 | # data to be ensured and, more generally, to use and operate it in the |
---|
115 | # same conditions as regards security. |
---|
116 | # |
---|
117 | # The fact that you are presently reading this means that you have had |
---|
118 | # knowledge of the CeCILL-B license and that you accept its terms. |
---|