[PATCH 5 of 9] hgk: update backgroud colour when Ttk is available
Andrew Shadura
bugzilla at tut.by
Sun Mar 10 11:24:46 CDT 2013
# HG changeset patch
# User Andrew Shadura <bugzilla at tut.by>
# Date 1362930136 -3600
# Node ID 49ad2ddd4a8f5f776dbd0e97bfb8b6c4d8e7ee29
# Parent c9806449456004b3f3e0e395dc8d98881bee6fe7
hgk: update backgroud colour when Ttk is available
Ttk doesn't automatically set up Tk colour palette.
Because of that, Ttk controls look differently when used
together with old Tk controls. When we use Ttk controls,
we first query if we have any setting for the client
background, and if we do, we update Tk palette as well.
diff --git a/contrib/hgk b/contrib/hgk
--- a/contrib/hgk
+++ b/contrib/hgk
@@ -30,6 +30,8 @@ if {[catch {package require Ttk}]} {
interp alias {} ttk::label {} label
interp alias {} ttk::scrollbar {} scrollbar
interp alias {} ttk::optionMenu {} tk_optionMenu
+
+ proc updatepalette {} {}
} else {
proc ::ttk::optionMenu {w varName firstValue args} {
upvar #0 $varName var
@@ -46,6 +48,11 @@ if {[catch {package require Ttk}]} {
}
return $w.menu
}
+ proc updatepalette {} {
+ catch {
+ tk_setPalette background [ttk::style lookup client -background]
+ }
+ }
}
if {[tk windowingsystem] eq "win32"} {
@@ -120,6 +127,7 @@ if {$theme eq "default"} {
}
+updatepalette
# Unify right mouse button handling.
# See "mouse buttons on macintosh" thread on comp.lang.tcl
More information about the Mercurial-devel
mailing list