]> asedeno.scripts.mit.edu Git - git.git/blob - lib/about.tcl
git-gui: Refactor about dialog code into its own module
[git.git] / lib / about.tcl
1 # git-gui about git-gui dialog
2 # Copyright (C) 2006, 2007 Shawn Pearce
3
4 proc do_about {} {
5         global appvers copyright oguilib
6         global tcl_patchLevel tk_patchLevel
7
8         set w .about_dialog
9         toplevel $w
10         wm geometry $w "+[winfo rootx .]+[winfo rooty .]"
11
12         label $w.header -text [mc "About %s" [appname]] \
13                 -font font_uibold
14         pack $w.header -side top -fill x
15
16         frame $w.buttons
17         button $w.buttons.close -text {Close} \
18                 -default active \
19                 -command [list destroy $w]
20         pack $w.buttons.close -side right
21         pack $w.buttons -side bottom -fill x -pady 10 -padx 10
22
23         label $w.desc \
24                 -text "[mc "git-gui - a graphical user interface for Git."]\n$copyright" \
25                 -padx 5 -pady 5 \
26                 -justify left \
27                 -anchor w \
28                 -borderwidth 1 \
29                 -relief solid
30         pack $w.desc -side top -fill x -padx 5 -pady 5
31
32         set v {}
33         append v "git-gui version $appvers\n"
34         append v "[git version]\n"
35         append v "\n"
36         if {$tcl_patchLevel eq $tk_patchLevel} {
37                 append v "Tcl/Tk version $tcl_patchLevel"
38         } else {
39                 append v "Tcl version $tcl_patchLevel"
40                 append v ", Tk version $tk_patchLevel"
41         }
42
43         set d {}
44         append d "git wrapper: $::_git\n"
45         append d "git exec dir: [gitexec]\n"
46         append d "git-gui lib: $oguilib"
47
48         label $w.vers \
49                 -text $v \
50                 -padx 5 -pady 5 \
51                 -justify left \
52                 -anchor w \
53                 -borderwidth 1 \
54                 -relief solid
55         pack $w.vers -side top -fill x -padx 5 -pady 5
56
57         label $w.dirs \
58                 -text $d \
59                 -padx 5 -pady 5 \
60                 -justify left \
61                 -anchor w \
62                 -borderwidth 1 \
63                 -relief solid
64         pack $w.dirs -side top -fill x -padx 5 -pady 5
65
66         menu $w.ctxm -tearoff 0
67         $w.ctxm add command \
68                 -label {Copy} \
69                 -command "
70                 clipboard clear
71                 clipboard append -format STRING -type STRING -- \[$w.vers cget -text\]
72         "
73
74         bind $w <Visibility> "grab $w; focus $w.buttons.close"
75         bind $w <Key-Escape> "destroy $w"
76         bind $w <Key-Return> "destroy $w"
77         bind_button3 $w.vers "tk_popup $w.ctxm %X %Y; grab $w; focus $w"
78         wm title $w "About [appname]"
79         tkwait window $w
80 }