File: tklanguage

package info (click to toggle)
language-env 0.64
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 1,588 kB
  • ctags: 125
  • sloc: perl: 6,243; makefile: 83; tcl: 64; sh: 18
file content (83 lines) | stat: -rwxr-xr-x 2,268 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#!/usr/bin/wish

set LIB "/usr/share/language-env"
set EXEC "/usr/bin/set-language-env"
set NAME "Native Language Environment"
set VER "0.57"
set WIDTH 350
set GEOMETRY 400x250

set LANGUAGES [glob "$LIB/support.*.pl"]
foreach lang $LANGUAGES {
	set f [open $lang]
	set line [gets $f]
	close $f
	regexp "!(.*)!" $line tmp languagename
	regexp {support\.(.*)\.pl} $lang tmp symbolname
	lappend langlist "$symbolname ($languagename)"
}
set langlist [lsort $langlist]


wm title . $NAME
wm geometry . $GEOMETRY
frame .name
label .name.name -text $NAME
label .name.ver -text "Version $VER"
pack .name.name -side left
pack .name.ver -side right
pack .name -side top -fill x

message .t -text "This program sets up your native language environment by modifying your dot-files.  Please select your native language." -padx 10 -pady 10 -aspect 700
pack .t -side top -fill x


frame .x
button .x.remove -text "REMOVE SETTINGS" -fg red -command {remove_settings}
button .x.cancel -text "     CANCEL    " -command {exit}
pack .x.remove -fill x -side left
pack .x.cancel -fill x 
pack .x -side bottom

frame .f -border 2 -relief sunken
set height [expr 32 * [llength $LANGUAGES]]
canvas .f.c -yscrollcommand {.f.s set} -width $WIDTH -height $height  \
	-scrollregion "0 0 $WIDTH $height"
scrollbar .f.s -orient vertical -command {.f.c yview}

set i 0
foreach lang $langlist {
	set symbol [lindex $lang 0]
	set language [lindex $lang 1]
	frame .f.c.$symbol
	button .f.c.$symbol.b -bitmap @${LIB}/${symbol}.xbm -anchor w \
		-command "
			exec x-terminal-emulator -e set-language-env -l $symbol
			exit
		" -width [expr $WIDTH - 6]
	pack .f.c.$symbol.b
	.f.c create window 0 [expr $i * 32] -window .f.c.$symbol -anchor nw

#	.f.c.$symbol window create end -window .f.c.$symbol -anchor nw
#	place .f.c.$symbol -in .f.c -x 0 -y [expr $i * 38]
	incr i
#	pack .f.c.$symbol -fill x
}
#.f.c create line 0 0 1000 1000
pack .f.s -side right -fill y
pack .f.c -fill both -expand yes
pack .f -fill y -expand yes

bind . <Escape> {.f.cancel invoke}

proc remove_settings {} {
	set answer [tk_messageBox -parent . \
		-title "REMOVE SETTINGS" -icon warning \
		-type okcancel -message "Surely remove your settings?"
	]
	if {"$answer" == "cancel"} then return
	exec set-language-env -r
	exit
}