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

Last change on this file 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: 4.8 KB
Line 
1#  This program is under CECILL_B licence. See footer for details.
2
3# fenetre d'accueil si aucune application n'est choisie au lancement.
4
5proc main_create {} {
6    global pathEngine libraryPath applicationList relaunchCmd configPath
7   
8    wm geometry . 640x640
9       
10    # Get the recent projects
11    set recents [getRecentProjects] 
12       
13    ttk::frame .main
14    pack .main -fill both -expand true
15   
16    ttk::frame .main.header
17    place  .main.header -relx 0.05 -rely 0.0 -relwidth 0.9 -relheight 0.2
18   
19   
20    ttk::label .main.header.icon -image icon_gui_small
21   
22    wm iconphoto .  icon_gui_small
23    pack .main.header.icon     
24
25   
26   
27    # applications
28    ttk::labelframe .main.app -text "Applications"
29   
30   
31    #pack .main.app  -fill both -expand true
32    place  .main.app -relx 0.05 -rely 0.3 -relwidth 0.9 -relheight 0.65
33   
34    canvas .main.app.c  -yscrollcommand [list .main.app.sby set] -xscrollcommand [list .main.app.sbx set] -background [ThemeColor 1.0] -highlightbackground [ThemeColor 1.0]
35    ttk::scrollbar .main.app.sbx -orient horizontal -command [list .main.app.c xview]
36    ttk::scrollbar .main.app.sby -orient vertical -command [list .main.app.c yview]
37    #grid .main.app.c -row 0 -column 0
38    #grid .main.app.sby -row 0 -column 1 -sticky news
39    #grid .main.app.sbx -row 1 -column 0 -sticky news
40   
41    place  .main.app.c -relx 0 -rely 0 -relwidth 0.95 -relheight 0.95
42    place  .main.app.sby -relx 0.95 -rely 0  -relheight 0.95
43    place  .main.app.sbx -relx 0 -rely 0.95  -relwidth 0.95 
44   
45   
46    ttk::frame .main.app.c.f
47    .main.app.c  create window 1 1 -window .main.app.c.f
48   
49    #pack .main.app.c.f
50   
51    set win ".main.app.c.f"
52   
53   
54   
55   
56    set colmax 3
57    set colid 0
58    set rowid 0
59    set appid 0
60 
61    foreach app $applicationList {
62        if {$app == "config"} {continue}
63        if {$colid > $colmax } {
64            set colid 0
65            incr rowid  2     
66        }
67        set winref "appico_$appid"
68       
69       
70        set filename [file join $libraryPath $app XML icon.gif]
71        if {[ file exists $filename]} {
72            image create photo icon_$winref -file $filename       
73            ttk::label $win.$winref -image  icon_$winref 
74            grid $win.$winref -column $colid -row $rowid -padx 10 -pady {10 0}
75            set cmd "$relaunchCmd -code $app &"
76            bind $win.$winref <ButtonPress-1>  [subst {
77                puts "Executing $cmd"
78                exec $cmd
79                exit
80            }]
81        }
82           
83        set winref "applbl_$appid"
84        ttk::label $win.$winref -text $app
85        set cmd "$relaunchCmd -code $app &"
86        bind $win.$winref <ButtonPress-1>  [subst {
87            puts "Executing $cmd"
88            exec $cmd
89            exit
90        }]
91        grid $win.$winref -column $colid -row [expr $rowid + 1] -padx 10 -pady {0 10}
92       
93       
94        incr appid
95        incr colid
96    }
97   
98   
99   
100    bind .main.app.c <Configure> [subst {
101        .main.app.c configure -scrollregion \[ .main.app.c bbox all\]
102        .main.app.c xview moveto 0.0
103        .main.app.c yview moveto 0.0
104    }]
105   
106 
107}
108
109
110
111
112#  Copyright CERFACS 2014
113#   
114#  antoine.dauptain@cerfacs.fr
115#   
116#  This software is a computer program whose purpose is to ensure technology
117#  transfer between academia and industry.
118#   
119#  This software is governed by the CeCILL-B license under French law and
120#  abiding by the rules of distribution of free software.  You can  use,
121#  modify and/ or redistribute the software under the terms of the CeCILL-B
122#  license as circulated by CEA, CNRS and INRIA at the following URL
123#  "http://www.cecill.info".
124#   
125#  As a counterpart to the access to the source code and  rights to copy,
126#  modify and redistribute granted by the license, users are provided only
127#  with a limited warranty  and the software's author,  the holder of the
128#  economic rights,  and the successive licensors  have only  limited
129#  liability.
130#   
131#  In this respect, the user's attention is drawn to the risks associated
132#  with loading,  using,  modifying and/or developing or reproducing the
133#  software by the user in light of its specific status of free software,
134#  that may mean  that it is complicated to manipulate,  and  that  also
135#  therefore means  that it is reserved for developers  and  experienced
136#  professionals having in-depth computer knowledge. Users are therefore
137#  encouraged to load and test the software's suitability as regards their
138#  requirements in conditions enabling the security of their systems and/or
139#  data to be ensured and,  more generally, to use and operate it in the
140#  same conditions as regards security.
141#   
142#  The fact that you are presently reading this means that you have had
143#  knowledge of the CeCILL-B license and that you accept its terms.
Note: See TracBrowser for help on using the repository browser.