source: CPL/oasis3-mct/branches/OASIS3-MCT_2.0_branch/util/oasisgui/opentea/create_status.tcl @ 4775

Last change on this file since 4775 was 4775, checked in by aclsce, 5 years ago
  • Imported oasis3-mct from Cerfacs svn server (not suppotred anymore).

The version has been extracted from https://oasis3mct.cerfacs.fr/svn/branches/OASIS3-MCT_2.0_branch/oasis3-mct@1818

File size: 3.7 KB
Line 
1#  This program is under CECILL_B licence. See footer for details.
2
3
4
5
6# ENTRY CREATION
7
8proc status_create { args } {
9    set mandatory_arguments { path_father address }
10    # Initializes the widget
11    initWidget
12   
13     
14    set widgetInfo($address-status) "0"
15    set widgetInfo($address-status_txt) "" 
16   
17    ttk::frame $win -height 40p -width $widgetInfo(guiSmallWidgetWidth)
18    eval $widgetInfo(packme-$win)
19    ttk::label $win.status -textvariable widgetInfo($address-status_txt) -justify center -compound left
20    $win.status configure -wraplength [expr { 0.9*$widgetInfo(guiSmallWidgetWidth)}]
21    pack $win.status
22   
23   
24    set widgetInfo($address-status) [dTree_tryGetAttribute $XMLtree $full_address_XML "default" "-1"]
25   
26   
27    set widgetInfo($address-msgerr) [dTree_tryGetAttribute $XMLtree $full_address_XML "msgerr" ""]
28    set widgetInfo($address-msgunknown) [dTree_tryGetAttribute $XMLtree $full_address_XML "msgunknown" ""]
29    set widgetInfo($address-msgtrue) [dTree_tryGetAttribute $XMLtree $full_address_XML "msgtrue" ""]
30   
31   
32   
33    append widgetInfo($address-refreshStatus) [ subst { status_refreshStatus $win $address}]
34   
35    eval $widgetInfo($address-refreshStatus)
36   
37    finishWidget
38    # clean the widget callBack on dstruction
39    bind $win <Destroy> [ subst {widget_destroy $win $address}]
40    return $win
41}
42
43proc status_refreshStatus {win address} {
44    global widgetInfo
45    set widgetInfo($address-status) $widgetInfo($address-variable)
46   
47    switch  $widgetInfo($address-variable) {
48        "-1" {
49            set widgetInfo($address-status_txt) $widgetInfo($address-msgerr)
50            $win.status configure -image icon_flag -foreground red
51        }
52        "0" {
53            set widgetInfo($address-status_txt) $widgetInfo($address-msgunknown)
54             $win.status configure -image "" -foreground orange2
55        }
56        "1" {
57            set widgetInfo($address-status_txt) $widgetInfo($address-msgtrue)
58             $win.status configure -image "" -foreground green4
59        }
60    }
61}
62
63
64#  Copyright CERFACS 2014
65#   
66#  antoine.dauptain@cerfacs.fr
67#   
68#  This software is a computer program whose purpose is to ensure technology
69#  transfer between academia and industry.
70#   
71#  This software is governed by the CeCILL-B license under French law and
72#  abiding by the rules of distribution of free software.  You can  use,
73#  modify and/ or redistribute the software under the terms of the CeCILL-B
74#  license as circulated by CEA, CNRS and INRIA at the following URL
75#  "http://www.cecill.info".
76#   
77#  As a counterpart to the access to the source code and  rights to copy,
78#  modify and redistribute granted by the license, users are provided only
79#  with a limited warranty  and the software's author,  the holder of the
80#  economic rights,  and the successive licensors  have only  limited
81#  liability.
82#   
83#  In this respect, the user's attention is drawn to the risks associated
84#  with loading,  using,  modifying and/or developing or reproducing the
85#  software by the user in light of its specific status of free software,
86#  that may mean  that it is complicated to manipulate,  and  that  also
87#  therefore means  that it is reserved for developers  and  experienced
88#  professionals having in-depth computer knowledge. Users are therefore
89#  encouraged to load and test the software's suitability as regards their
90#  requirements in conditions enabling the security of their systems and/or
91#  data to be ensured and,  more generally, to use and operate it in the
92#  same conditions as regards security.
93#   
94#  The fact that you are presently reading this means that you have had
95#  knowledge of the CeCILL-B license and that you accept its terms.
Note: See TracBrowser for help on using the repository browser.