From noreply at r-forge.r-project.org Thu Dec 5 15:59:08 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Thu, 5 Dec 2013 15:59:08 +0100 (CET) Subject: [Sciviews-commits] r540 - komodo/SciViews-K/defaults pkg/tcltk2 pkg/tcltk2/R Message-ID: <20131205145908.8DDD51868B3@r-forge.r-project.org> 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 From noreply at r-forge.r-project.org Wed Dec 11 17:03:40 2013 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Wed, 11 Dec 2013 17:03:40 +0100 (CET) Subject: [Sciviews-commits] r541 - in pkg/tcltk2: . R inst/tklibs/ttktheme_radiance man Message-ID: <20131211160340.B101C186B16@r-forge.r-project.org> Author: phgrosjean Date: 2013-12-11 17:03:40 +0100 (Wed, 11 Dec 2013) New Revision: 541 Added: pkg/tcltk2/R/tk2swaplist.R Modified: pkg/tcltk2/DESCRIPTION pkg/tcltk2/NEWS pkg/tcltk2/R/tk2commands.R pkg/tcltk2/R/tk2widgets.R pkg/tcltk2/inst/tklibs/ttktheme_radiance/pkgIndex.tcl pkg/tcltk2/man/tcltk2-package.Rd Log: Bug correction: invisible caret in text widget. Further tweaking of field background colour for those widgets that require it. Modified: pkg/tcltk2/DESCRIPTION =================================================================== --- pkg/tcltk2/DESCRIPTION 2013-12-05 14:59:07 UTC (rev 540) +++ pkg/tcltk2/DESCRIPTION 2013-12-11 16:03:40 UTC (rev 541) @@ -1,7 +1,7 @@ Package: tcltk2 Type: Package -Version: 1.2-8 -Date: 2013-12-05 +Version: 1.2-9 +Date: 2013-12-11 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-12-05 14:59:07 UTC (rev 540) +++ pkg/tcltk2/NEWS 2013-12-11 16:03:40 UTC (rev 541) @@ -1,5 +1,15 @@ = tcltk2 news +== Version 1.2-9 + +* New theme handling introduced in version 1.2-8 resulted in an invisible caret + in text widget. + +* Further tweaking of color themes: now fieldbackground for entry, combobox, + canvas, listbox, mclistbox, tablelist, spinbox, text and ctext widgets (build + using old Tk widgets or megawidgets) now default with the correct theme color. + + == Version 1.2-8 * A better handling of fonts and colors for Tk widgets according to themes used Modified: pkg/tcltk2/R/tk2commands.R =================================================================== --- pkg/tcltk2/R/tk2commands.R 2013-12-05 14:59:07 UTC (rev 540) +++ pkg/tcltk2/R/tk2commands.R 2013-12-11 16:03:40 UTC (rev 541) @@ -229,18 +229,20 @@ "activeForeground", afg, "disabledForeground", tclvalue(.Tcl("ttk::style lookup TLabel -foreground disabled")), - "highlightBackground", - tclvalue(.Tcl("ttk::style lookup TLabel -background focus")), + "highlightBackground", "white", + #tclvalue(.Tcl("ttk::style lookup TLabel -background focus")), "highlightColor", ffg, "insertBackground", - tclvalue(.Tcl("ttk::style lookup TLabel -background active")), + tclvalue(.Tcl("ttk::style lookup TLabel -foreground 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)) + "throughColor", hfg), + "fieldBackground", + tclvalue(.Tcl("ttk::style lookup TEntry -fieldbackground"))) ## Set menu font the same as label font font <- tclvalue(.Tcl("ttk::style lookup TLabel -font")) Added: pkg/tcltk2/R/tk2swaplist.R =================================================================== --- pkg/tcltk2/R/tk2swaplist.R (rev 0) +++ pkg/tcltk2/R/tk2swaplist.R 2013-12-11 16:03:40 UTC (rev 541) @@ -0,0 +1,23 @@ +tk2swaplist <- function(items, selection, title = "Select items", ...) +{ + win <- tktoplevel() + res <- try(tclRequire("swaplist"), silent = TRUE) + if (inherits(res, "try-error")) + stop("swaplist Tcl package not available") + sel <- tclVar() + res <- tcl("swaplist::swaplist", win, sel, items, selection, + title = title, ...) + if (tclvalue(res) == 0) { # User cancelled + res <- character(0) + } else res <- tclObj(sel) + if (is.ordered(items)) + return(ordered(as.character(res), levels = levels(items))) + if (is.factor(items)) + return(factor(as.character(res), levels = levels(items))) + switch(typeof(items), + integer = as.integer(res), + double = as.numeric(res), + logical = as.logical(res), + complex = as.complex(res), + as.character(res)) +} Modified: pkg/tcltk2/R/tk2widgets.R =================================================================== --- pkg/tcltk2/R/tk2widgets.R 2013-12-05 14:59:07 UTC (rev 540) +++ pkg/tcltk2/R/tk2widgets.R 2013-12-11 16:03:40 UTC (rev 541) @@ -27,7 +27,13 @@ { if (!is.ttk()) stop("Tcl/Tk >= 8.5 is required") ### TODO: use autoscroll here! - w <- tkwidget(parent, "canvas", ...) + ## Default background to fieldbackground + if (any(names(list(...)) == "background")) { + w <- tkwidget(parent, "canvas", ...) + } else { + w <- tkwidget(parent, "canvas", + background = .Tcl("ttk::style lookup TEntry -fieldbackground"), ...) + } if (tip != "") tk2tip(w, tip) class(w) <- c("tk2canvas", "tk2widget", class(w)) return(w) @@ -154,37 +160,41 @@ w <- tkwidget(parent, "listbox", font = "TkDefaultFont", borderwidth = 1, relief = "sunken", activestyle = "dotbox", selectmode = selectmode, height = height, exportselection = 0, - background = "#ffffff", ...) + background = .Tcl("ttk::style lookup TEntry -fieldbackground"), ...) } else { # We need to create a tk2frame as parent of the listbox wf <- tk2frame(parent) w <- tkwidget(wf, "listbox", font = "TkDefaultFont", borderwidth = 1, relief = "sunken", activestyle = "dotbox", selectmode = selectmode, height = height, exportselection = 0, - background = "#ffffff", ...) + background = .Tcl("ttk::style lookup TEntry -fieldbackground"), ...) } ## Make it react to tk2theme changes, and integrate the listbox as much ## as possible with current ttk theme + #restyleListbox <- function (W) { + # ## Restyle the listbox according to current ttk style + # ## Note: font is set to TkDefaultFont => already managed there! + # tkconfigure(W, + # foreground = tk2style("tk2entry", "foreground", + # default = "#000000"), + # borderwidth = tk2style("", "borderwidth", default = 0), + # disabledforeground = tk2style("tk2entry", "foreground", + # "disabled", default = "#a3a3a3"), + # highlightbackground = tk2style("tk2entry", "selectbackground", + # default = "#c3c3c3"), + # highlightcolor = tk2style("tk2entry", "selectbackground", + # default = "#c3c3c3"), + # selectbackground = tk2style("tk2entry", "selectbackground", + # default = "#c3c3c3"), + # selectforeground = tk2style("tk2entry", "selectforeground", + # default = "#ffffff") + # ) + #} + ## Restyle it now + #restyleListbox(w) restyleListbox <- function (W) { - ## Restyle the listbox according to current ttk style - ## Note: font is set to TkDefaultFont => already managed there! - tkconfigure(W, - foreground = tk2style("tk2entry", "foreground", - default = "#000000"), - borderwidth = tk2style("", "borderwidth", default = 0), - disabledforeground = tk2style("tk2entry", "foreground", - "disabled", default = "#a3a3a3"), - highlightbackground = tk2style("tk2entry", "selectbackground", - default = "#c3c3c3"), - highlightcolor = tk2style("tk2entry", "selectbackground", - default = "#c3c3c3"), - selectbackground = tk2style("tk2entry", "selectbackground", - default = "#c3c3c3"), - selectforeground = tk2style("tk2entry", "selectforeground", - default = "#ffffff") - ) + tkconfigure(W, background = + .Tcl("ttk::style lookup TEntry -fieldbackground")) } - ## Restyle it now - restyleListbox(w) ## If there are values and/or selections, populate the list now for (item in values) @@ -229,7 +239,8 @@ res <- tclRequire("mclistbox") if (!inherits(res, "tclObj")) stop("Impossible to load the Tcl mclistbox package; check your Tcl/Tk installation") - w <- tkwidget(parent, "mclistbox::mclistbox", font = "TkDefaultFont", ...) + w <- tkwidget(parent, "mclistbox::mclistbox", font = "TkDefaultFont", + background = .Tcl("ttk::style lookup TEntry -fieldbackground"), ...) tkconfigure(w, relief = "flat") if (tip != "") tk2tip(w, tip) class(w) <- c("tk2mclistbox", "tk2widget", class(w)) @@ -342,8 +353,16 @@ tk2spinbox <- function (parent, tip = "", ...) { if (!is.ttk()) stop("Tcl/Tk >= 8.5 is required") - w <- tkwidget(parent, "spinbox", font = "TkDefaultFont", - relief = "solid", borderwidth = 1, ...) + ## Default background to fieldbackground + if (any(names(list(...)) == "background")) { + w <- tkwidget(parent, "spinbox", font = "TkDefaultFont", + relief = "solid", borderwidth = 1, ...) + } else { + w <- tkwidget(parent, "spinbox", font = "TkDefaultFont", + relief = "solid", borderwidth = 1, + background = .Tcl("ttk::style lookup TEntry -fieldbackground"), ...) + } + if (tip != "") tk2tip(w, tip) class(w) <- c("tk2spinbox", "tk2widget", class(w)) return(w) @@ -366,8 +385,17 @@ if (!is.ttk()) stop("Tcl/Tk >= 8.5 is required") if (inherits(tclRequire("tablelist_tile", warn = FALSE), "tclObj")) { - w <- tkwidget(parent, "tablelist::tablelist", font = "TkDefaultFont", - ...) + ## Default background to fieldbackground + if (any(names(list(...)) == "background")) { + w <- tkwidget(parent, "tablelist::tablelist", + font = "TkDefaultFont", ...) + } else { + w <- tkwidget(parent, "tablelist::tablelist", + font = "TkDefaultFont", + background = .Tcl("ttk::style lookup TEntry -fieldbackground"), + ...) + } + class(w) <- c("tk2tablelist", "tk2widget", class(w)) return(w) } @@ -378,7 +406,15 @@ { ### TODO: autohide scrollbars if (!is.ttk()) stop("Tcl/Tk >= 8.5 is required") - w <- tkwidget(parent, "text", font = "TkTextFont", ...) + + ## Default background to fieldbackground + if (any(names(list(...)) == "background")) { + w <- tkwidget(parent, "text", font = "TkTextFont", ...) + } else { + w <- tkwidget(parent, "text", font = "TkTextFont", + background = .Tcl("ttk::style lookup TEntry -fieldbackground"), ...) + } + tkconfigure(w, relief = "flat") if (tip != "") tk2tip(w, tip) class(w) <- c("tk2text", "tk2widget", class(w)) @@ -390,7 +426,15 @@ ### TODO: autohide scrollbars if (!is.ttk()) stop("Tcl/Tk >= 8.5 is required") tclRequire("ctext") - w <- tkwidget(parent, "ctext", font = "TkFixedFont", ...) + + ## Default background to fieldbackground + if (any(names(list(...)) == "background")) { + w <- tkwidget(parent, "ctext", font = "TkFixedFont", ...) + } else { + w <- tkwidget(parent, "ctext", font = "TkFixedFont", + background = .Tcl("ttk::style lookup TEntry -fieldbackground"), ...) + } + tkconfigure(w, relief = "flat") if (tip != "") tk2tip(w, tip) class(w) <- c("tk2ctext", "tk2widget", class(w)) Modified: pkg/tcltk2/inst/tklibs/ttktheme_radiance/pkgIndex.tcl =================================================================== --- pkg/tcltk2/inst/tklibs/ttktheme_radiance/pkgIndex.tcl 2013-12-05 14:59:07 UTC (rev 540) +++ pkg/tcltk2/inst/tklibs/ttktheme_radiance/pkgIndex.tcl 2013-12-11 16:03:40 UTC (rev 541) @@ -5,7 +5,7 @@ package ifneeded ttk::theme::radiance 0.1 \ [list source [file join $dir radiance8.5.tcl]] } else { - package ifneeded tile::theme::clearlooks 0.1 \ + package ifneeded tile::theme::radiance 0.1 \ [list source [file join $dir radiance8.4.tcl]] } } Modified: pkg/tcltk2/man/tcltk2-package.Rd =================================================================== --- pkg/tcltk2/man/tcltk2-package.Rd 2013-12-05 14:59:07 UTC (rev 540) +++ pkg/tcltk2/man/tcltk2-package.Rd 2013-12-11 16:03:40 UTC (rev 541) @@ -16,8 +16,8 @@ \tabular{ll}{ Package: \tab tcltk2\cr Type: \tab Package\cr -Version: \tab 1.2-7\cr -Date: \tab 2013-11-30\cr +Version: \tab 1.2-9\cr +Date: \tab 2013-12-11\cr License: \tab LGPL-3 plus see LICENSE file\cr LazyLoad: \tab yes\cr }