~ubuntu-branches/ubuntu/quantal/astk/quantal

« back to all changes in this revision

Viewing changes to ASTK_CLIENT/lib/pref_config.tcl

  • Committer: Bazaar Package Importer
  • Author(s): Christophe Trophime
  • Date: 2010-04-25 16:43:13 UTC
  • Revision ID: james.westby@ubuntu.com-20100425164313-0s0wtsmbiewbdz53
Tags: upstream-1.8.0
Import upstream version 1.8.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#########################################################################
 
2
# COPYRIGHT (C) 2003         EDF R&D              WWW.CODE-ASTER.ORG    #
 
3
#                                                                       #
 
4
# THIS PROGRAM IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR         #
 
5
# MODIFY IT UNDER THE TERMS OF THE GNU GENERAL PUBLIC LICENSE AS        #
 
6
# PUBLISHED BY THE FREE SOFTWARE FOUNDATION; EITHER VERSION 2 OF THE    #
 
7
# LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.                       #
 
8
# THIS PROGRAM IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL,       #
 
9
# BUT WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF        #
 
10
# MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU      #
 
11
# GENERAL PUBLIC LICENSE FOR MORE DETAILS.                              #
 
12
#                                                                       #
 
13
# YOU SHOULD HAVE RECEIVED A COPY OF THE GNU GENERAL PUBLIC LICENSE     #
 
14
# ALONG WITH THIS PROGRAM; IF NOT, WRITE TO : EDF R&D CODE_ASTER,       #
 
15
#    1 AVENUE DU GENERAL DE GAULLE, 92141 CLAMART CEDEX, FRANCE.        #
 
16
#########################################################################
 
17
 
 
18
# $Id: pref_config.tcl 3530 2008-09-26 08:45:55Z courtois $
 
19
 
 
20
# reaction a Configuration/Preferences/Generales
 
21
#################################################################
 
22
proc Opt_prefs { } {
 
23
   bckup_prefs
 
24
 
 
25
   set fen .fen_pref
 
26
   catch {destroy $fen}
 
27
   toplevel $fen
 
28
   wm withdraw $fen
 
29
   wm title $fen "[ashare::mess ihm 33] - [ashare::mess ihm 37]"
 
30
   wm transient $fen .
 
31
   grab set $fen
 
32
 
 
33
   pack [frame $fen.liste -relief solid -bd 1]
 
34
# titre
 
35
   pack [frame $fen.liste.tit1 -relief solid -bd 0] -fill x
 
36
   label $fen.liste.tit1.lbl -font $astk::ihm(font,labbout) -text [ashare::mess ihm 141] -width 35 -anchor w
 
37
   pack $fen.liste.tit1.lbl -pady 3 -side left -fill x
 
38
# aide
 
39
   button $fen.liste.tit1.help -image [image create photo -file $astk::icon(help)] \
 
40
      -command "grab release $fen ; aff_aide . 190" -bd 0 -bg $astk::ihm(couleur,background)
 
41
   pack $fen.liste.tit1.help -side right
 
42
 
 
43
# infos "perso"
 
44
   pack [frame $fen.liste.nom -relief solid -bd 0] -anchor w
 
45
   label $fen.liste.nom.lbl -font $astk::ihm(font,lab) -text [ashare::mess ihm 89] -width 35 -anchor w
 
46
   entry $fen.liste.nom.path -width 30 -font $astk::ihm(font,val) -textvariable astk::config(-1,nom_user)
 
47
   pack $fen.liste.nom.lbl $fen.liste.nom.path -pady 3 -side left
 
48
 
 
49
   pack [frame $fen.liste.email -relief solid -bd 0] -anchor w
 
50
   label $fen.liste.email.lbl -font $astk::ihm(font,lab) -text [ashare::mess ihm 90] -width 35 -anchor w
 
51
   entry $fen.liste.email.path -width 30 -font $astk::ihm(font,val) -textvariable astk::config(-1,email)
 
52
   pack $fen.liste.email.lbl $fen.liste.email.path -pady 3 -side left
 
53
 
 
54
# organisme / unit�
 
55
   pack [frame $fen.liste.org -relief solid -bd 0] -anchor w
 
56
   if { $astk::agla(num_serv) > -1 && [llength $astk::agla(infoid)] > 0 } {
 
57
      set astk::config(-1,org) [lindex $astk::agla(infoid) 3]
 
58
      label $fen.liste.org.lbl -font $astk::ihm(font,lab) -text [ashare::mess ihm 240] -width 35 -anchor w
 
59
      label $fen.liste.org.inst -font $astk::ihm(font,lab) -text $astk::config(-1,org)
 
60
      pack $fen.liste.org.lbl $fen.liste.org.inst -pady 3 -side left
 
61
   } else {
 
62
      label $fen.liste.org.lbl -font $astk::ihm(font,lab) -text [ashare::mess ihm 240] -width 35 -anchor w
 
63
      entry $fen.liste.org.inst -width 30 -font $astk::ihm(font,val) -textvariable astk::config(-1,org)
 
64
      pack $fen.liste.org.lbl $fen.liste.org.inst -pady 3 -side left
 
65
   }
 
66
 
 
67
# instance AGLA
 
68
   pack [frame $fen.liste.agla -relief solid -bd 0] -anchor w
 
69
   if { $astk::agla(num_serv) > -1 } {
 
70
      label $fen.liste.agla.lbl -font $astk::ihm(font,lab) -text [ashare::mess ihm 91] -width 35 -anchor w
 
71
      label $fen.liste.agla.inst -font $astk::ihm(font,lab) -text [join $astk::agla(instance)]
 
72
      pack $fen.liste.agla.lbl $fen.liste.agla.inst -pady 3 -side left
 
73
   }
 
74
 
 
75
# langue
 
76
   pack [frame $fen.liste.langue -relief solid -bd 0] -anchor w
 
77
   label $fen.liste.langue.lbl -font $astk::ihm(font,lab) -text [ashare::mess ihm 101] -width 35 -anchor w
 
78
   set MenuLang [tk_optionMenu $fen.liste.langue.choix astk::config(-1,langue) $ashare::llang(lang,0)]
 
79
   $MenuLang entryconfigure 0 -font $astk::ihm(font,labmenu)
 
80
   for {set j 1} {$j < $ashare::llang(nb_lang)} {incr j} {
 
81
      $MenuLang add radiobutton
 
82
      $MenuLang entryconfigure $j -label $ashare::llang(lang,$j) -font $astk::ihm(font,labmenu) -variable astk::config(-1,langue)
 
83
   }
 
84
   $fen.liste.langue.choix configure -font $astk::ihm(font,labmenu) -bg $astk::ihm(couleur,liste)
 
85
   pack $fen.liste.langue.lbl $fen.liste.langue.choix -pady 3 -side left
 
86
 
 
87
# pr�f�rences - version par d�faut
 
88
   pack [frame $fen.liste.defvers -relief solid -bd 0] -anchor w
 
89
   label $fen.liste.defvers.lbl -font $astk::ihm(font,lab) -text [ashare::mess ihm 92] -width 35 -anchor w
 
90
   entry $fen.liste.defvers.path -width 30 -font $astk::ihm(font,val) -textvariable astk::config(-1,def_vers)
 
91
   pack $fen.liste.defvers.lbl $fen.liste.defvers.path -pady 3 -side left
 
92
 
 
93
# xterm
 
94
   pack [frame $fen.liste.xterm -relief solid -bd 0] -anchor w
 
95
   label $fen.liste.xterm.lbl -font $astk::ihm(font,lab) -text [ashare::mess ihm 82] -width 35 -anchor w
 
96
   entry $fen.liste.xterm.path -width 30 -font $astk::ihm(font,val) -textvariable astk::config(-1,xterm)
 
97
   pack $fen.liste.xterm.lbl $fen.liste.xterm.path -pady 3 -side left
 
98
 
 
99
# editeur
 
100
   pack [frame $fen.liste.editeur -relief solid -bd 0] -anchor w
 
101
   label $fen.liste.editeur.lbl -font $astk::ihm(font,lab) -text [ashare::mess ihm 93] -width 35 -anchor w
 
102
   entry $fen.liste.editeur.path -width 30 -font $astk::ihm(font,val) -textvariable astk::config(-1,editeur)
 
103
   pack $fen.liste.editeur.lbl $fen.liste.editeur.path -pady 3 -side left
 
104
 
 
105
# navigateur
 
106
   pack [frame $fen.liste.browser -relief solid -bd 0] -anchor w
 
107
   label $fen.liste.browser.lbl -font $astk::ihm(font,lab) -text [ashare::mess ihm 363] -width 35 -anchor w
 
108
   entry $fen.liste.browser.path -width 30 -font $astk::ihm(font,val) -textvariable astk::config(-1,browser)
 
109
   pack $fen.liste.browser.lbl $fen.liste.browser.path -pady 3 -side left
 
110
 
 
111
# nbre de fichiers r�manents
 
112
   pack [frame $fen.liste.nb_reman -relief solid -bd 0] -anchor w
 
113
   label $fen.liste.nb_reman.lbl -font $astk::ihm(font,lab) -text [ashare::mess ihm 94] -width 35 -anchor w
 
114
   scale $fen.liste.nb_reman.scl -orient horizontal -length 200 -from 0 -to 10 -tickinterval 1 \
 
115
      -variable astk::config(-1,nb_reman) -font $astk::ihm(font,lab) -showvalue 0
 
116
   pack $fen.liste.nb_reman.lbl $fen.liste.nb_reman.scl -pady 3 -side left
 
117
 
 
118
# niveau de debug
 
119
   pack [frame $fen.liste.dbg -relief solid -bd 0] -anchor w
 
120
   label $fen.liste.dbg.lbl -font $astk::ihm(font,lab) -text [ashare::mess ihm 36] -width 35 -anchor w
 
121
   scale $fen.liste.dbg.scl -orient horizontal -length 200 -from 0 -to 5 -tickinterval 1 \
 
122
      -variable astk::config(-1,dbglevel) -font $astk::ihm(font,lab) -showvalue 0
 
123
   pack $fen.liste.dbg.lbl $fen.liste.dbg.scl -pady 3 -side left
 
124
 
 
125
# bip
 
126
   pack [frame $fen.liste.bip -relief solid -bd 0] -anchor w -padx 20
 
127
   checkbutton $fen.liste.bip.cb -variable astk::config(-1,bip) -anchor w
 
128
   label  $fen.liste.bip.lbl -font $astk::ihm(font,lab) -text "[ashare::mess ihm 362]"
 
129
   pack $fen.liste.bip.cb $fen.liste.bip.lbl -pady 3 -side left
 
130
 
 
131
# options asjob
 
132
# titre
 
133
   pack [frame $fen.liste.tit2 -relief solid -bd 0] -anchor w
 
134
   label $fen.liste.tit2.lbl -font $astk::ihm(font,labbout) -text [ashare::mess ihm 142] -width 35 -anchor w
 
135
   pack $fen.liste.tit2.lbl -pady 3 -side left
 
136
 
 
137
# nbre de ligne
 
138
   pack [frame $fen.liste.nb_ligne -relief solid -bd 0] -anchor w
 
139
   label $fen.liste.nb_ligne.lbl -font $astk::ihm(font,lab) -text [ashare::mess ihm 139] -width 35 -anchor w
 
140
   scale $fen.liste.nb_ligne.scl -orient horizontal -length 200 -from 50 -to 450 -tickinterval 100 -resolution 10 \
 
141
      -variable astk::config(-1,nb_ligne) -font $astk::ihm(font,lab) -showvalue 0
 
142
   pack $fen.liste.nb_ligne.lbl $fen.liste.nb_ligne.scl -pady 3 -side left
 
143
 
 
144
# frequence d'actualisation
 
145
   pack [frame $fen.liste.freq_actu -relief solid -bd 0] -anchor w
 
146
   label $fen.liste.freq_actu.lbl -font $astk::ihm(font,lab) -text [ashare::mess ihm 140] -width 35 -anchor w
 
147
   scale $fen.liste.freq_actu.scl -orient horizontal -length 200 -from 1 -to 5 -tickinterval 1 \
 
148
      -variable astk::config(-1,freq_actu) -font $astk::ihm(font,lab) -showvalue 0
 
149
   pack $fen.liste.freq_actu.lbl $fen.liste.freq_actu.scl -pady 3 -side left
 
150
 
 
151
# ok
 
152
   pack [frame $fen.valid -relief solid -bd 0]
 
153
   button $fen.valid.annuler -font $astk::ihm(font,labbout) -text [ashare::mess ihm 85] \
 
154
       -bg $astk::ihm(couleur,annul) \
 
155
      -command "restaure_prefs ; destroy $fen ; grab release $fen"
 
156
   button $fen.valid.ok -font $astk::ihm(font,labbout) -text "Ok" \
 
157
       -bg $astk::ihm(couleur,valid) \
 
158
      -command "accept_pref $ashare::lang ; destroy $fen ; grab release $fen"
 
159
   pack $fen.valid.ok $fen.valid.annuler -side left -padx 10 -pady 5
 
160
   
 
161
   wm deiconify $fen
 
162
}
 
163
 
 
164
# reaction a Configuration/Preferences/Reseau
 
165
#################################################################
 
166
proc Opt_prefs_net { } {
 
167
   bckup_prefs
 
168
 
 
169
   set fen .fen_prefnet
 
170
   catch {destroy $fen}
 
171
   toplevel $fen
 
172
   wm withdraw $fen
 
173
   wm title $fen "[ashare::mess ihm 33] - [ashare::mess ihm 378]"
 
174
   wm transient $fen .
 
175
   grab set $fen
 
176
 
 
177
   pack [frame $fen.liste -relief solid -bd 1]
 
178
 
 
179
# param�tres r�seau
 
180
# titre
 
181
   pack [frame $fen.liste.tit3 -relief solid -bd 0] -anchor w
 
182
   label $fen.liste.tit3.lbl -font $astk::ihm(font,labbout) -text [ashare::mess ihm 356] -width 35 -anchor w
 
183
   pack $fen.liste.tit3.lbl -pady 3 -side left
 
184
 
 
185
# ipdhcp ou nom du client
 
186
   pack [frame $fen.liste.ipdhcp -relief solid -bd 0] -anchor w
 
187
   if { $astk::config(-1,isdhcp) == 1} {
 
188
      label $fen.liste.ipdhcp.lbl -font $astk::ihm(font,lab) -text "[ashare::mess ihm 348]" -width 35 -anchor w
 
189
      entry $fen.liste.ipdhcp.path -width 30 -font $astk::ihm(font,val) -textvariable astk::config(-1,ipdhcp)
 
190
   } else {
 
191
      label $fen.liste.ipdhcp.lbl -font $astk::ihm(font,lab) -text "[ashare::mess ihm 349]" -width 35 -anchor w
 
192
      entry $fen.liste.ipdhcp.path -width 30 -font $astk::ihm(font,val) -textvariable astk::config(-1,nom_complet) -state disabled
 
193
   }
 
194
   pack $fen.liste.ipdhcp.lbl $fen.liste.ipdhcp.path -pady 3 -side left
 
195
 
 
196
# switch mode DHCP / hostname
 
197
   pack [frame $fen.liste.mode -relief solid -bd 0] -anchor w -padx 20
 
198
   checkbutton $fen.liste.mode.cb -variable astk::config(-1,isdhcp) -anchor w
 
199
   label  $fen.liste.mode.lbl -font $astk::ihm(font,lab) -text "[ashare::mess ihm 350]"
 
200
   pack $fen.liste.mode.cb $fen.liste.mode.lbl -pady 3 -side left
 
201
 
 
202
# domain name
 
203
   pack [frame $fen.liste.domain -relief solid -bd 0] -anchor w
 
204
   label $fen.liste.domain.lbl -font $astk::ihm(font,lab) -text "[ashare::mess ihm 322] (ex.: domain.org)" -width 35 -anchor w
 
205
   entry $fen.liste.domain.path -width 30 -font $astk::ihm(font,val) -textvariable astk::config(-1,nom_domaine)
 
206
   pack $fen.liste.domain.lbl $fen.liste.domain.path -pady 3 -side left
 
207
 
 
208
# forced display variable
 
209
   pack [frame $fen.liste.displ -relief solid -bd 0] -anchor w
 
210
   label $fen.liste.displ.lbl -font $astk::ihm(font,lab) -text "[ashare::mess ihm 376]" -width 35 -anchor w
 
211
   entry $fen.liste.displ.path -width 30 -font $astk::ihm(font,val) -textvariable astk::config(-1,forced_display)
 
212
   pack $fen.liste.displ.lbl $fen.liste.displ.path -pady 3 -side left
 
213
 
 
214
# remote shell protocol
 
215
   pack [frame $fen.liste.proto1 -relief solid -bd 0] -anchor w
 
216
   label $fen.liste.proto1.lbl -font $astk::ihm(font,lab) -text "[ashare::mess ihm 354]" -width 35 -anchor w
 
217
   radiobutton $fen.liste.proto1.rsh -font $astk::ihm(font,val) -text rsh -value RSH -variable astk::config(-1,remote_shell_protocol)
 
218
   radiobutton $fen.liste.proto1.ssh -font $astk::ihm(font,val) -text ssh -value SSH -variable astk::config(-1,remote_shell_protocol)
 
219
   pack $fen.liste.proto1.lbl $fen.liste.proto1.rsh $fen.liste.proto1.ssh -pady 3 -side left
 
220
 
 
221
# remote copy protocol
 
222
   pack [frame $fen.liste.proto2 -relief solid -bd 0] -anchor w
 
223
   label $fen.liste.proto2.lbl -font $astk::ihm(font,lab) -text "[ashare::mess ihm 355]" -width 35 -anchor w
 
224
   radiobutton $fen.liste.proto2.rcp -font $astk::ihm(font,val) -text rcp -value RCP -variable astk::config(-1,remote_copy_protocol)
 
225
   radiobutton $fen.liste.proto2.scp -font $astk::ihm(font,val) -text scp -value SCP -variable astk::config(-1,remote_copy_protocol)
 
226
   pack $fen.liste.proto2.lbl $fen.liste.proto2.rcp $fen.liste.proto2.scp -pady 3 -side left
 
227
 
 
228
# ok
 
229
   pack [frame $fen.valid -relief solid -bd 0]
 
230
   button $fen.valid.annuler -font $astk::ihm(font,labbout) -text [ashare::mess ihm 85] \
 
231
       -bg $astk::ihm(couleur,annul) \
 
232
      -command "restaure_prefs ; destroy $fen ; grab release $fen"
 
233
   button $fen.valid.ok -font $astk::ihm(font,labbout) -text "Ok" \
 
234
       -bg $astk::ihm(couleur,valid) \
 
235
      -command "accept_pref $ashare::lang ; destroy $fen ; grab release $fen"
 
236
   pack $fen.valid.ok $fen.valid.annuler -side left -padx 10 -pady 5
 
237
   
 
238
   wm deiconify $fen
 
239
}
 
240
 
 
241
# Acceptation des pr�f�rences
 
242
#################################################################
 
243
proc accept_pref { old_lang } {
 
244
   global old_pref
 
245
 
 
246
# nom de machine / domaine
 
247
   init_nom_complet $astk::config(-1,isdhcp)
 
248
 
 
249
   if { $astk::config(-1,ipdhcp) != $old_pref(-1,ipdhcp)
 
250
     || $astk::config(-1,isdhcp) != $old_pref(-1,isdhcp)
 
251
     || $astk::config(-1,nom_complet) != $old_pref(-1,nom_complet) } {
 
252
      check_nom_complet
 
253
   }
 
254
# display
 
255
   init_display
 
256
   check_display
 
257
# niveau debug
 
258
   set ashare::dbg $astk::config(-1,dbglevel)
 
259
# info en cas de changement de la langue
 
260
   if { $astk::config(-1,langue) != $old_lang } {
 
261
      set ashare::lang $astk::config(-1,langue)
 
262
      raffr_princ
 
263
   }
 
264
# mise � jour de la liste des profils (nb_reman)
 
265
   maj_prof
 
266
# sauvegarde des pr�f�rences
 
267
   ashare::save_prefs
 
268
}
 
269
 
 
270
#################################################################
 
271
proc bckup_prefs {} {
 
272
   global old_pref
 
273
   
 
274
# valeurs actuelles dans old_pref
 
275
   set mots_cles $ashare::mots(MCS_pref)
 
276
   lappend mots_cles "nom_complet"
 
277
   for { set k 0 } { $k < [ llength $mots_cles ] } { incr k } {
 
278
      set mcs [lindex $mots_cles $k]
 
279
      set old_pref(-1,$mcs) $astk::config(-1,$mcs)
 
280
   }
 
281
}
 
282
 
 
283
#################################################################
 
284
proc restaure_prefs {} {
 
285
   global old_pref
 
286
 
 
287
# r�cup�re depuis old_pref
 
288
   set mots_cles $ashare::mots(MCS_pref)
 
289
   lappend mots_cles "nom_complet"
 
290
   for { set k 0 } { $k < [ llength $mots_cles ] } { incr k } {
 
291
      set mcs [lindex $mots_cles $k]
 
292
      set astk::config(-1,$mcs) $old_pref(-1,$mcs)
 
293
   }
 
294
}
 
295