{"thread":{"id":"7407","subject":"[PATCH 5/5] Improve look-and-feel of GUI tools.","startedAt":"2007-03-26T07:39:44Z","lastAt":"2007-03-26T07:39:44Z","messageCount":1,"participants":["Eygene Ryabinkin"],"isPatch":true,"patchVersion":1,"patchTotal":5},"messages":[{"id":"38004","messageId":"20070326073944.GI44578@codelabs.ru","threadId":"7407","inReplyTo":null,"subject":"[PATCH 5/5] Improve look-and-feel of GUI tools.","fromName":"Eygene Ryabinkin","fromEmail":"rea-git@codelabs.ru","sentAt":"2007-03-26T07:39:44Z","receivedAt":"2007-03-26T07:39:44Z","isPatch":true,"sender":{"key":"rea-git@codelabs.ru","avatar":null},"body":"Made the default buttons on the dialog active and focused upon the\ndialog appearence.\n\nBound 'Escape' and 'Return' keys to the dialog dismissal where it\nwas appropriate: mainly for dialogs with only one button and no\neditable fields, but on console output dialogs as well.\n\nUnified the look of the gitk's \"About gitk\" and \"Key bindings\"\ndialogs.\n\nSigned-off-by: Eygene Ryabinkin <rea-git@codelabs.ru>\n---\n git-gui/git-gui.sh |   19 +++++++++++++++----\n gitk               |   23 +++++++++++++++--------\n 2 files changed, 30 insertions(+), 12 deletions(-)\n\ndiff --git a/git-gui/git-gui.sh b/git-gui/git-gui.sh\nindex f10cfa7..5b53891 100755\n--- a/git-gui/git-gui.sh\n+++ b/git-gui/git-gui.sh\n@@ -2694,10 +2694,12 @@ proc do_push_anywhere {} {\n \tframe $w.buttons\n \tbutton $w.buttons.create -text Push \\\n \t\t-font font_ui \\\n+\t\t-default active \\\n \t\t-command [list start_push_anywhere_action $w]\n \tpack $w.buttons.create -side right\n \tbutton $w.buttons.cancel -text {Cancel} \\\n \t\t-font font_ui \\\n+\t\t-default normal \\\n \t\t-command [list destroy $w]\n \tpack $w.buttons.cancel -side right -padx 5\n \tpack $w.buttons -side bottom -fill x -pady 10 -padx 10\n@@ -2789,7 +2791,7 @@ proc do_push_anywhere {} {\n \tset push_thin 0\n \tset push_tags 0\n \n-\tbind $w <Visibility> \"grab $w\"\n+\tbind $w <Visibility> \"grab $w; focus $w.buttons.create\"\n \tbind $w <Key-Escape> \"destroy $w\"\n \twm title $w \"[appname] ([reponame]): Push\"\n \ttkwait window $w\n@@ -4111,6 +4113,7 @@ proc console_done {args} {\n \t\tif {[winfo exists $w]} {\n \t\t\t$w.m.s conf -background green -text {Success}\n \t\t\t$w.ok conf -state normal\n+\t\t\tfocus $w.ok\n \t\t}\n \t} else {\n \t\tif {![winfo exists $w]} {\n@@ -4118,6 +4121,7 @@ proc console_done {args} {\n \t\t}\n \t\t$w.m.s conf -background red -text {Error: Command Failed}\n \t\t$w.ok conf -state normal\n+\t\tfocus $w.ok\n \t}\n \n \tarray unset console_cr $w\n@@ -4185,9 +4189,11 @@ proc do_stats {} {\n \tframe $w.buttons -border 1\n \tbutton $w.buttons.close -text Close \\\n \t\t-font font_ui \\\n+\t\t-default active \\\n \t\t-command [list destroy $w]\n \tbutton $w.buttons.gc -text {Compress Database} \\\n \t\t-font font_ui \\\n+\t\t-default normal \\\n \t\t-command \"destroy $w;do_gc\"\n \tpack $w.buttons.close -side right\n \tpack $w.buttons.gc -side left\n@@ -4216,7 +4222,7 @@ proc do_stats {} {\n \t}\n \tpack $w.stat -pady 10 -padx 10\n \n-\tbind $w <Visibility> \"grab $w; focus $w\"\n+\tbind $w <Visibility> \"grab $w; focus $w.buttons.close\"\n \tbind $w <Key-Escape> [list destroy $w]\n \tbind $w <Key-Return> [list destroy $w]\n \twm title $w \"[appname] ([reponame]): Database Statistics\"\n@@ -4513,6 +4519,7 @@ proc do_about {} {\n \tframe $w.buttons\n \tbutton $w.buttons.close -text {Close} \\\n \t\t-font font_ui \\\n+\t\t-default active \\\n \t\t-command [list destroy $w]\n \tpack $w.buttons.close -side right\n \tpack $w.buttons -side bottom -fill x -pady 10 -padx 10\n@@ -4558,8 +4565,9 @@ $copyright\" \\\n \t\tclipboard append -format STRING -type STRING -- \\[$w.vers cget -text\\]\n \t\"\n \n-\tbind $w <Visibility> \"grab $w; focus $w\"\n+\tbind $w <Visibility> \"grab $w; focus $w.buttons.close\"\n \tbind $w <Key-Escape> \"destroy $w\"\n+\tbind $w <Key-Return> \"destroy $w\"\n \tbind_button3 $w.vers \"tk_popup $w.ctxm %X %Y; grab $w; focus $w\"\n \twm title $w \"About [appname]\"\n \ttkwait window $w\n@@ -4596,14 +4604,17 @@ proc do_options {} {\n \tframe $w.buttons\n \tbutton $w.buttons.restore -text {Restore Defaults} \\\n \t\t-font font_ui \\\n+\t\t-default normal \\\n \t\t-command do_restore_defaults\n \tpack $w.buttons.restore -side left\n \tbutton $w.buttons.save -text Save \\\n \t\t-font font_ui \\\n+\t\t-default active \\\n \t\t-command [list do_save_config $w]\n \tpack $w.buttons.save -side right\n \tbutton $w.buttons.cancel -text {Cancel} \\\n \t\t-font font_ui \\\n+\t\t-default normal \\\n \t\t-command [list destroy $w]\n \tpack $w.buttons.cancel -side right -padx 5\n \tpack $w.buttons -side bottom -fill x -pady 10 -padx 10\n@@ -4707,7 +4718,7 @@ proc do_options {} {\n \t\tpack $w.global.$name -side top -anchor w -fill x\n \t}\n \n-\tbind $w <Visibility> \"grab $w; focus $w\"\n+\tbind $w <Visibility> \"grab $w; focus $w.buttons.save\"\n \tbind $w <Key-Escape> \"destroy $w\"\n \twm title $w \"[appname] ([reponame]): Options\"\n \ttkwait window $w\ndiff --git a/gitk b/gitk\nindex f54ff27..0173660 100755\n--- a/gitk\n+++ b/gitk\n@@ -938,12 +938,15 @@ Gitk - a commit viewer for git\n Copyright ╘ 2005-2006 Paul Mackerras\n \n Use and redistribute under the terms of the GNU General Public License} \\\n-\t    -justify center -aspect 400\n-    pack $w.m -side top -fill x -padx 20 -pady 20\n+\t    -justify center -aspect 400 -border 2 -bg white -relief groove\n+    pack $w.m -side top -fill x -padx 2 -pady 2\n     $w.m configure -font $uifont\n-    button $w.ok -text Close -command \"destroy $w\"\n+    button $w.ok -text Close -command \"destroy $w\" -default active\n     pack $w.ok -side bottom\n     $w.ok configure -font $uifont\n+    bind $w <Visibility> \"focus $w.ok\"\n+    bind $w <Key-Escape> \"destroy $w\"\n+    bind $w <Key-Return> \"destroy $w\"\n }\n \n proc keys {} {\n@@ -994,12 +997,15 @@ f\t\tScroll diff view to next file\n <Ctrl-minus>\tDecrease font size\n <F5>\t\tUpdate\n } \\\n-\t    -justify left -bg white -border 2 -relief sunken\n-    pack $w.m -side top -fill both\n+\t    -justify left -bg white -border 2 -relief groove\n+    pack $w.m -side top -fill both -padx 2 -pady 2\n     $w.m configure -font $uifont\n-    button $w.ok -text Close -command \"destroy $w\"\n+    button $w.ok -text Close -command \"destroy $w\" -default active\n     pack $w.ok -side bottom\n     $w.ok configure -font $uifont\n+    bind $w <Visibility> \"focus $w.ok\"\n+    bind $w <Key-Escape> \"destroy $w\"\n+    bind $w <Key-Return> \"destroy $w\"\n }\n \n # Procedures for manipulating the file list window at the\n@@ -5892,14 +5898,15 @@ proc doprefs {} {\n     grid x $top.hunksepbut $top.hunksep -sticky w\n \n     frame $top.buts\n-    button $top.buts.ok -text \"OK\" -command prefsok\n+    button $top.buts.ok -text \"OK\" -command prefsok -default active\n     $top.buts.ok configure -font $uifont\n-    button $top.buts.can -text \"Cancel\" -command prefscan\n+    button $top.buts.can -text \"Cancel\" -command prefscan -default normal\n     $top.buts.can configure -font $uifont\n     grid $top.buts.ok $top.buts.can\n     grid columnconfigure $top.buts 0 -weight 1 -uniform a\n     grid columnconfigure $top.buts 1 -weight 1 -uniform a\n     grid $top.buts - - -pady 10 -sticky ew\n+    bind $top <Visibility> \"focus $top.buts.ok\"\n }\n \n proc choosecolor {v vi w x cmd} {\n-- \n1.5.0.3-dirty\n"}]}