[Sciviews-commits] r540 - komodo/SciViews-K/defaults pkg/tcltk2 pkg/tcltk2/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Dec 5 15:59:08 CET 2013


Author: phgrosjean
Date: 2013-12-05 15:59:07 +0100 (Thu, 05 Dec 2013)
New Revision: 540

Added:
   komodo/SciViews-K/defaults/SciViews_0.9-11.tar.gz
   komodo/SciViews-K/defaults/ellipse_0.3-8.tar.gz
   komodo/SciViews-K/defaults/svDoc_0.9-9.tar.gz
   komodo/SciViews-K/defaults/svMisc_0.9-70.tar.gz
Modified:
   pkg/tcltk2/DESCRIPTION
   pkg/tcltk2/NEWS
   pkg/tcltk2/R/tcltk2-Internal.R
   pkg/tcltk2/R/tk2commands.R
   pkg/tcltk2/R/tk2fonts.R
Log:
tcltk2: better fonts and colours management of tk2theme()s
New default packages for SciViews-K

Added: komodo/SciViews-K/defaults/SciViews_0.9-11.tar.gz
===================================================================
(Binary files differ)


Property changes on: komodo/SciViews-K/defaults/SciViews_0.9-11.tar.gz
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: komodo/SciViews-K/defaults/ellipse_0.3-8.tar.gz
===================================================================
(Binary files differ)


Property changes on: komodo/SciViews-K/defaults/ellipse_0.3-8.tar.gz
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: komodo/SciViews-K/defaults/svDoc_0.9-9.tar.gz
===================================================================
(Binary files differ)


Property changes on: komodo/SciViews-K/defaults/svDoc_0.9-9.tar.gz
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: komodo/SciViews-K/defaults/svMisc_0.9-70.tar.gz
===================================================================
(Binary files differ)


Property changes on: komodo/SciViews-K/defaults/svMisc_0.9-70.tar.gz
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Modified: pkg/tcltk2/DESCRIPTION
===================================================================
--- pkg/tcltk2/DESCRIPTION	2013-11-30 14:30:32 UTC (rev 539)
+++ pkg/tcltk2/DESCRIPTION	2013-12-05 14:59:07 UTC (rev 540)
@@ -1,7 +1,7 @@
 Package: tcltk2
 Type: Package
-Version: 1.2-7
-Date: 2013-11-30
+Version: 1.2-8
+Date: 2013-12-05
 Title: Tcl/Tk Additions
 Authors at R: c(person("Philippe", "Grosjean", role = c("aut", "cre"),
   email = "phgrosjean at sciviews.org"))

Modified: pkg/tcltk2/NEWS
===================================================================
--- pkg/tcltk2/NEWS	2013-11-30 14:30:32 UTC (rev 539)
+++ pkg/tcltk2/NEWS	2013-12-05 14:59:07 UTC (rev 540)
@@ -1,5 +1,14 @@
 = tcltk2 news
 
+== Version 1.2-8
+
+* A better handling of fonts and colors for Tk widgets according to themes used
+  for Ttk widgets using tk2theme(). Also for menus.
+  
+* The default font was not reset properly after switching back from radiance
+  to another theme.
+
+
 == Version 1.2-7
 
 * A tk2tablelist() function added to create a tablelist widget (the Tcl package

Modified: pkg/tcltk2/R/tcltk2-Internal.R
===================================================================
--- pkg/tcltk2/R/tcltk2-Internal.R	2013-11-30 14:30:32 UTC (rev 539)
+++ pkg/tcltk2/R/tcltk2-Internal.R	2013-12-05 14:59:07 UTC (rev 540)
@@ -122,7 +122,9 @@
 					try(tk2theme("clearlooks"), silent = TRUE)
 				}
 			}
-		}		
+		}
+		## Save default font as TkSysDefaultFont
+		tk2font.set("TkSysDefaultFont", tk2font.get("TkDefaultFont"))
 	}
 	
 	## Windows only

Modified: pkg/tcltk2/R/tk2commands.R
===================================================================
--- pkg/tcltk2/R/tk2commands.R	2013-11-30 14:30:32 UTC (rev 539)
+++ pkg/tcltk2/R/tk2commands.R	2013-12-05 14:59:07 UTC (rev 540)
@@ -202,14 +202,55 @@
 			if (inherits(res, "try-error"))
 				stop("Ttk theme ", theme, " is not found")
 		}
-		.Tcl(paste("ttk::style theme use", theme))  # Better to use tile::setTheme?
+		## Themes (like radiance) change TkDefaultFont => reset it for the others
+		if (theme == "radiance") {
+			tkfont.configure("TkDefaultFont", family = "Ubuntu", size = 11)
+		} else tk2font.set("TkDefaultFont", tk2font.get("TkSysDefaultFont"))
+		## Change theme
+		.Tcl(paste("ttk::style theme use", theme))
         ## And save current theme in option "tk2theme"
         options(tk2theme = theme)
 		## Make sure to homogenize background for old tk widgets (suggested by Milan Bouchet-Valat)
-		.Tcl(paste("tk_setPalette", tclvalue(.Tcl("ttk::style lookup TFrame -background"))))
+		## Note: foreground not defined for plastik and keramik => workaround
+		fg <- tclvalue(.Tcl("ttk::style lookup TLabel -foreground"))
+		if (fg == "") fg <- "#000000"
+		afg <- tclvalue(.Tcl("ttk::style lookup TLabel -foreground active"))
+		if (afg == "") afg <- "#000000"
+		ffg <- tclvalue(.Tcl("ttk::style lookup TLabel -foreground focus"))
+		if (ffg == "") ffg <- "#000000"
+		hfg <- tclvalue(.Tcl("ttk::style lookup TLabel -foreground hover"))
+		if (hfg == "") hfg <- "#000000"
+		.Tcl(paste("tk_setPalette",
+			"background",
+				tclvalue(.Tcl("ttk::style lookup TLabel -background")),
+			"foreground", fg,
+			"activeBackground",
+				tclvalue(.Tcl("ttk::style lookup TLabel -background active")),
+			"activeForeground", afg,
+			"disabledForeground",
+				tclvalue(.Tcl("ttk::style lookup TLabel -foreground disabled")),
+			"highlightBackground",
+				tclvalue(.Tcl("ttk::style lookup TLabel -background focus")),
+			"highlightColor", ffg,
+			"insertBackground",
+				tclvalue(.Tcl("ttk::style lookup TLabel -background active")),
+			"selectBackground",
+				tclvalue(.Tcl("ttk::style lookup TText -selectbackground")),
+			"selectForeground",
+				tclvalue(.Tcl("ttk::style lookup TText -selectforeground")),
+			"selectColor",
+				tclvalue(.Tcl("ttk::style lookup TText -selectforeground")),
+			"throughColor", hfg))
+		
+		## Set menu font the same as label font
+		font <- tclvalue(.Tcl("ttk::style lookup TLabel -font"))
+		if (!length(font) || font == "") font <- "TkDefaultFont"
+		tk2font.set("TkMenuFont", tk2font.get(font))
+		
+		## Return the theme
 		res <- theme
     }
-    return(res)
+    res
 }
 ### Note: to change a style element: .Tcl('ttk::style configure TButton -font "helvetica 24"')
 ### Create a derived style: ttk::style configure Emergency.TButton -font "helvetica 24" -foreground red -padding 10

Modified: pkg/tcltk2/R/tk2fonts.R
===================================================================
--- pkg/tcltk2/R/tk2fonts.R	2013-11-30 14:30:32 UTC (rev 539)
+++ pkg/tcltk2/R/tk2fonts.R	2013-12-05 14:59:07 UTC (rev 540)
@@ -163,6 +163,7 @@
 		)
 		## Make sure these are correctly defined
 		assignTemp(".SystemFonts", sysfonts)
+		res <- TRUE
 	} else res <- character(0)
 
 	if (default.styles) {  # Define default styles



More information about the Sciviews-commits mailing list