{"thread":{"id":"24285","subject":"[PATCH] gitk: Let the ttk theme be controllable via preferences.","startedAt":"2010-07-04T15:17:45Z","lastAt":"2010-07-04T15:17:45Z","messageCount":1,"participants":["Nelson Elhage"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"144779","messageId":"1278256665-29034-1-git-send-email-nelhage@mit.edu","threadId":"24285","inReplyTo":null,"subject":"[PATCH] gitk: Let the ttk theme be controllable via preferences.","fromName":"Nelson Elhage","fromEmail":"nelhage@mit.edu","sentAt":"2010-07-04T15:17:45Z","receivedAt":"2010-07-04T15:17:45Z","isPatch":true,"sender":{"key":"nelhage@mit.edu","avatar":"https://avatars.githubusercontent.com/u/16725?v=4"},"body":"Signed-off-by: Nelson Elhage <nelhage@mit.edu>\n---\n gitk-git/gitk |   32 +++++++++++++++++++++++++++-----\n 1 files changed, 27 insertions(+), 5 deletions(-)\n\ndiff --git a/gitk-git/gitk b/gitk-git/gitk\nindex 1b0e09a..8790cee 100644\n--- a/gitk-git/gitk\n+++ b/gitk-git/gitk\n@@ -2626,7 +2626,7 @@ proc savestuff {w} {\n     global cmitmode wrapcomment datetimeformat limitdiffs\n     global colors uicolor bgcolor fgcolor diffcolors diffcontext selectbgcolor\n     global autoselect extdifftool perfile_attrs markbgcolor use_ttk\n-    global hideremotes want_ttk\n+    global hideremotes want_ttk ttk_theme\n \n     if {$stuffsaved} return\n     if {![winfo viewable .]} return\n@@ -2653,6 +2653,7 @@ proc savestuff {w} {\n \tputs $f [list set limitdiffs $limitdiffs]\n \tputs $f [list set uicolor $uicolor]\n \tputs $f [list set want_ttk $want_ttk]\n+\tputs $f [list set ttk_theme $ttk_theme]\n \tputs $f [list set bgcolor $bgcolor]\n \tputs $f [list set fgcolor $fgcolor]\n \tputs $f [list set colors $colors]\n@@ -10696,7 +10697,7 @@ proc doprefs {} {\n     global oldprefs prefstop showneartags showlocalchanges\n     global uicolor bgcolor fgcolor ctext diffcolors selectbgcolor markbgcolor\n     global tabstop limitdiffs autoselect extdifftool perfile_attrs\n-    global hideremotes want_ttk have_ttk\n+    global hideremotes want_ttk have_ttk ttk_theme\n \n     set top .gitkprefs\n     set prefstop $top\n@@ -10705,7 +10706,8 @@ proc doprefs {} {\n \treturn\n     }\n     foreach v {maxwidth maxgraphpct showneartags showlocalchanges \\\n-\t\t   limitdiffs tabstop perfile_attrs hideremotes want_ttk} {\n+\t\t   limitdiffs tabstop perfile_attrs hideremotes want_ttk \\\n+\t\t   ttk_theme} {\n \tset oldprefs($v) [set $v]\n     }\n     ttk_toplevel $top\n@@ -10764,6 +10766,17 @@ proc doprefs {} {\n     }\n     grid x $top.want_ttk $top.ttk_note -sticky w\n \n+    if {$have_ttk} {\n+\tttk::combobox $top.ttk_theme -textvariable ttk_theme \\\n+\t    -values [ttk::style theme names]\n+\t$top.ttk_theme state readonly\n+\tif {!$use_ttk} {\n+\t    $top.ttk_theme state disabled\n+\t}\n+\t${NS}::label $top.lttk_theme -text [mc \"Theme\"]\n+\tgrid x $top.lttk_theme $top.ttk_theme -sticky w\n+    }\n+\n     ${NS}::label $top.cdisp -text [mc \"Colors: press to choose\"]\n     grid $top.cdisp - -sticky w -pady 10\n     label $top.ui -padx 40 -relief sunk -background $uicolor\n@@ -10892,7 +10905,8 @@ proc prefscan {} {\n     global oldprefs prefstop\n \n     foreach v {maxwidth maxgraphpct showneartags showlocalchanges \\\n-\t\t   limitdiffs tabstop perfile_attrs hideremotes want_ttk} {\n+\t\t   limitdiffs tabstop perfile_attrs hideremotes want_ttk \\\n+\t\t   ttk_theme} {\n \tglobal $v\n \tset $v $oldprefs($v)\n     }\n@@ -10906,7 +10920,7 @@ proc prefsok {} {\n     global oldprefs prefstop showneartags showlocalchanges\n     global fontpref mainfont textfont uifont\n     global limitdiffs treediffs perfile_attrs\n-    global hideremotes\n+    global hideremotes use_ttk ttk_theme\n \n     catch {destroy $prefstop}\n     unset prefstop\n@@ -10955,6 +10969,9 @@ proc prefsok {} {\n     if {$hideremotes != $oldprefs(hideremotes)} {\n \trereadrefs\n     }\n+    if {$use_ttk && $ttk_theme != $oldprefs(ttk_theme)} {\n+\tttk::style theme use $ttk_theme\n+    }\n }\n \n proc formatdate {d} {\n@@ -11369,6 +11386,7 @@ set datetimeformat \"%Y-%m-%d %H:%M:%S\"\n set autoselect 1\n set perfile_attrs 0\n set want_ttk 1\n+set ttk_theme \"default\"\n \n if {[tk windowingsystem] eq \"aqua\"} {\n     set extdifftool \"opendiff\"\n@@ -11519,6 +11537,10 @@ if {![info exists have_ttk]} {\n set use_ttk [expr {$have_ttk && $want_ttk}]\n set NS [expr {$use_ttk ? \"ttk\" : \"\"}]\n \n+if {$use_ttk} {\n+    ttk::style theme use $ttk_theme\n+}\n+\n set git_version [join [lrange [split [lindex [exec git version] end] .] 0 2] .]\n \n set runq {}\n-- \n1.7.1.1\n"}]}