* [PATCH] gitk: Let the ttk theme be controllable via preferences.
@ 2010-07-04 15:17 Nelson Elhage
0 siblings, 0 replies; only message in thread
From: Nelson Elhage @ 2010-07-04 15:17 UTC (permalink / raw)
To: Paul Mackerras; +Cc: git, Nelson Elhage
Signed-off-by: Nelson Elhage <nelhage@mit.edu>
---
gitk-git/gitk | 32 +++++++++++++++++++++++++++-----
1 files changed, 27 insertions(+), 5 deletions(-)
diff --git a/gitk-git/gitk b/gitk-git/gitk
index 1b0e09a..8790cee 100644
--- a/gitk-git/gitk
+++ b/gitk-git/gitk
@@ -2626,7 +2626,7 @@ proc savestuff {w} {
global cmitmode wrapcomment datetimeformat limitdiffs
global colors uicolor bgcolor fgcolor diffcolors diffcontext selectbgcolor
global autoselect extdifftool perfile_attrs markbgcolor use_ttk
- global hideremotes want_ttk
+ global hideremotes want_ttk ttk_theme
if {$stuffsaved} return
if {![winfo viewable .]} return
@@ -2653,6 +2653,7 @@ proc savestuff {w} {
puts $f [list set limitdiffs $limitdiffs]
puts $f [list set uicolor $uicolor]
puts $f [list set want_ttk $want_ttk]
+ puts $f [list set ttk_theme $ttk_theme]
puts $f [list set bgcolor $bgcolor]
puts $f [list set fgcolor $fgcolor]
puts $f [list set colors $colors]
@@ -10696,7 +10697,7 @@ proc doprefs {} {
global oldprefs prefstop showneartags showlocalchanges
global uicolor bgcolor fgcolor ctext diffcolors selectbgcolor markbgcolor
global tabstop limitdiffs autoselect extdifftool perfile_attrs
- global hideremotes want_ttk have_ttk
+ global hideremotes want_ttk have_ttk ttk_theme
set top .gitkprefs
set prefstop $top
@@ -10705,7 +10706,8 @@ proc doprefs {} {
return
}
foreach v {maxwidth maxgraphpct showneartags showlocalchanges \
- limitdiffs tabstop perfile_attrs hideremotes want_ttk} {
+ limitdiffs tabstop perfile_attrs hideremotes want_ttk \
+ ttk_theme} {
set oldprefs($v) [set $v]
}
ttk_toplevel $top
@@ -10764,6 +10766,17 @@ proc doprefs {} {
}
grid x $top.want_ttk $top.ttk_note -sticky w
+ if {$have_ttk} {
+ ttk::combobox $top.ttk_theme -textvariable ttk_theme \
+ -values [ttk::style theme names]
+ $top.ttk_theme state readonly
+ if {!$use_ttk} {
+ $top.ttk_theme state disabled
+ }
+ ${NS}::label $top.lttk_theme -text [mc "Theme"]
+ grid x $top.lttk_theme $top.ttk_theme -sticky w
+ }
+
${NS}::label $top.cdisp -text [mc "Colors: press to choose"]
grid $top.cdisp - -sticky w -pady 10
label $top.ui -padx 40 -relief sunk -background $uicolor
@@ -10892,7 +10905,8 @@ proc prefscan {} {
global oldprefs prefstop
foreach v {maxwidth maxgraphpct showneartags showlocalchanges \
- limitdiffs tabstop perfile_attrs hideremotes want_ttk} {
+ limitdiffs tabstop perfile_attrs hideremotes want_ttk \
+ ttk_theme} {
global $v
set $v $oldprefs($v)
}
@@ -10906,7 +10920,7 @@ proc prefsok {} {
global oldprefs prefstop showneartags showlocalchanges
global fontpref mainfont textfont uifont
global limitdiffs treediffs perfile_attrs
- global hideremotes
+ global hideremotes use_ttk ttk_theme
catch {destroy $prefstop}
unset prefstop
@@ -10955,6 +10969,9 @@ proc prefsok {} {
if {$hideremotes != $oldprefs(hideremotes)} {
rereadrefs
}
+ if {$use_ttk && $ttk_theme != $oldprefs(ttk_theme)} {
+ ttk::style theme use $ttk_theme
+ }
}
proc formatdate {d} {
@@ -11369,6 +11386,7 @@ set datetimeformat "%Y-%m-%d %H:%M:%S"
set autoselect 1
set perfile_attrs 0
set want_ttk 1
+set ttk_theme "default"
if {[tk windowingsystem] eq "aqua"} {
set extdifftool "opendiff"
@@ -11519,6 +11537,10 @@ if {![info exists have_ttk]} {
set use_ttk [expr {$have_ttk && $want_ttk}]
set NS [expr {$use_ttk ? "ttk" : ""}]
+if {$use_ttk} {
+ ttk::style theme use $ttk_theme
+}
+
set git_version [join [lrange [split [lindex [exec git version] end] .] 0 2] .]
set runq {}
--
1.7.1.1
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2010-07-04 15:19 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-07-04 15:17 [PATCH] gitk: Let the ttk theme be controllable via preferences Nelson Elhage
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).