Skip to content

Commit

Permalink
version 0.0-36
Browse files Browse the repository at this point in the history
  • Loading branch information
John Verzani authored and gaborcsardi committed Jun 25, 2010
1 parent e43ee27 commit 878b0e7
Show file tree
Hide file tree
Showing 12 changed files with 106 additions and 57 deletions.
21 changes: 21 additions & 0 deletions ChangeLog
@@ -1,3 +1,24 @@
2010-06-14 john verzani <verzani@john-verzanis-macbook-pro.local>

* R/gtable.R (.computeWidths): removed autoscroll call - caused
issues with initial drawing of screen. Also in gtext.

2010-05-28 john verzani <verzani@john-verzanis-macbook-pro.local>

* R/gdroplist.R: svalue(obj, index=TRUE) <- -1 should work now (no
value set)

2010-05-27 john verzani <verzani@john-verzanis-macbook-pro.local>

* R/gedit.R: added visible<- method

2010-05-22 john verzani <verzani@john-verzanis-macbook-pro.local>

* R/gdialogs.R: fix to dialogs when message includes detail
(message has length 2 or more).

* R/gfile.R: bug fix with hidden argument multiple

2010-05-20 john verzani <verzani@john-verzanis-macbook-pro.local>

* R/gradio.R: try to fix issue that handler called before variable
Expand Down
6 changes: 3 additions & 3 deletions DESCRIPTION
@@ -1,5 +1,5 @@
Package: gWidgetstcltk
Version: 0.0-35
Version: 0.0-36
Title: Toolkit implementation of gWidgets for tcltk package
Author: John Verzani
Maintainer: John Verzani <gwidgetsrgtk@gmail.com>
Expand All @@ -14,6 +14,6 @@ Description: Port of gWidgets API to the tcltk package. Requires TK 8.5
License: GPL (>= 2)
URL: http://www.math.csi.cuny.edu/pmg
LazyLoad: yes
Packaged: 2010-05-21 12:54:19 UTC; verzani
Packaged: 2010-06-25 16:10:02 UTC; verzani
Repository: CRAN
Date/Publication: 2010-05-22 06:41:15
Date/Publication: 2010-06-25 17:50:40
4 changes: 4 additions & 0 deletions NEWS
Expand Up @@ -2,6 +2,10 @@ Dear Emacs, please make this -*-Text-*- mode!

NEWS for gWidgetstcltk

Changes for 0.0-36
-------------------
* added visible<- method for gedit. If FALSE will mask characters

Changes for 0.0-35
-------------------
* fix to gradio's addHandlerChanged and svalue methods.
Expand Down
53 changes: 31 additions & 22 deletions R/gdialogs.R
Expand Up @@ -72,7 +72,7 @@ tcltkDialog = function(
## set up label
if(missing(message) || is.null(message))
message <- ""
l <- ttklabel(dlgframe, text = as.character(message))
l <- ttklabel(dlgframe, text = paste(as.character(message), sep="\n"))
tkgrid(l, row=0, column = 1, stick ="nw", padx=25, pady=5)


Expand Down Expand Up @@ -152,24 +152,28 @@ setMethod(".gmessage",

icon = match.arg(icon)
l <- list(icon=icon,
message=gettext(message),
message=gettext(message[1]),
title = title,
type="ok")
if(length(message) > 1)
l$detail=gettext(message[2])

if(!is.null(parent))
l$parent <- getWidget(parent)

out <- do.call("tkmessageBox",l)
return(out)

## old
return(tcltkDialog(
message,
title=title,
icon=icon,
type="message",
parent = parent,
handler=handler,
action=action,
...))
## ## old
## return(tcltkDialog(
## message,
## title=title,
## icon=icon,
## type="message",
## parent = parent,
## handler=handler,
## action=action,
## ...))

## icon = match.arg(icon)

Expand All @@ -196,10 +200,15 @@ setMethod(".gconfirm",
...
) {
icon = match.arg(icon)

l <- list(icon=icon,
message=gettext(message),
message=gettext(message[1]),
title = title,
type="yesno")

if(length(message) > 1)
l$detail=gettext(message[2])

if(!is.null(parent))
l$parent <- getWidget(parent)
out <- do.call("tkmessageBox",l)
Expand All @@ -209,15 +218,15 @@ setMethod(".gconfirm",
FALSE)
return(val)

return(tcltkDialog(
message,
title=title,
icon=icon,
type="confirm",
parent = parent,
handler=handler,
action=action,
...))
## return(tcltkDialog(
## message,
## title=title,
## icon=icon,
## type="confirm",
## parent = parent,
## handler=handler,
## action=action,
## ...))

## icon = match.arg(icon)

Expand Down
9 changes: 6 additions & 3 deletions R/gdroplist.R
Expand Up @@ -150,6 +150,7 @@ setMethod(".svalue",
})

## set the displayed value to value
## if index=TRUE and value=0, seet to no state
setReplaceMethod(".svalue",
signature(toolkit="guiWidgetsToolkittcltk",obj="gDroplisttcltk"),
function(obj, toolkit, index=NULL, ..., value) {
Expand All @@ -161,12 +162,12 @@ setReplaceMethod(".svalue",

widget <- getWidget(obj)

n = length(obj)
n <- length(obj)
if(n <= 1) return(obj)

if(is.null(index))
index <- FALSE
index = as.logical(index)
index <- as.logical(index)

## if editable do differently
## editable not implented
Expand All @@ -175,7 +176,9 @@ setReplaceMethod(".svalue",
## if index, set
if(index) {
if(value > 0 && value <= n)
tclvalue(tcl(widget,"current", as.numeric(value) - 1))
tcl(widget,"current", as.numeric(value) - 1)
else # set to no state
tcl(widget,"set", "") # aka -1 for get
} else {
if(!is.null(editable) && editable) {
## editable
Expand Down
11 changes: 11 additions & 0 deletions R/gedit.R
Expand Up @@ -162,6 +162,17 @@ setReplaceMethod(".size",
})


##' visible<- if FALSE, for password usage
setReplaceMethod("visible",signature(obj="gEdittcltk"),
function(obj, ..., value) {
widget <- getWidget(obj)
if(as.logical(value))
tkconfigure(widget, show="")
else
tkconfigure(widget, show="*")
return(obj)
})


##################################################
## handlers
Expand Down
9 changes: 4 additions & 5 deletions R/gfile.R
Expand Up @@ -26,7 +26,7 @@ setMethod(".gfile",
args = list(...)

## this will be in the API, for now we pass in through ...
multiple <- getWithDefault(multiple, FALSE)
multiple <- getWithDefault(args$multiple, FALSE)


type = match.arg(type)
Expand Down Expand Up @@ -54,12 +54,11 @@ setMethod(".gfile",
theFilter = "{{All files} *}"
}

l <- list(title=text, filetypes=theFilter, multiple=multiple)
if(!is.null(initialfilename))
val = tkgetOpenFile(initialfile=initialfilename, title=text,
filetypes=theFilter, multiple=multiple)
else
val <- tkgetOpenFile(title=text, filetypes=theFilter)
l$initialfile=initialfilename

val <- do.call("tkgetOpenFile", l)
} else if(type == "save") {

val = tkgetSaveFile(initialfile=initialfilename, title=text)
Expand Down
1 change: 1 addition & 0 deletions R/ggroup.R
Expand Up @@ -78,6 +78,7 @@ setMethod(".ggroup",
})
} else {
gp <- ttkframe(tt)
tkconfigure(gp, borderwidth=10) # XXX
block <- gp
widget <- NULL # for later
}
Expand Down
42 changes: 21 additions & 21 deletions R/gtable.R
Expand Up @@ -197,12 +197,11 @@ setMethod(".gtable",
## selectmode
selectmode = if(multiple) "extended" else "browse"

##########
## setup widget
tt = getWidget(container)
gp = ttkframe(tt)
tt <- getWidget(container)
gp <- ttkframe(tt)


## set up widget, tr, with scrollbars
xscr <- ttkscrollbar(gp, orient="horizontal",
command=function(...)tkxview(tr,...))
yscr <- ttkscrollbar(gp, orient="vertical",
Expand All @@ -216,12 +215,25 @@ setMethod(".gtable",
xscrollcommand=function(...)tkset(xscr,...),
yscrollcommand=function(...)tkset(yscr,...))



## pack into grid
## see tkFAQ 10.1 -- makes for automatic resizing
tkgrid(tr,row=0,column=0, sticky="news")
tkgrid(yscr,row=0,column=1, sticky="ns")
tkgrid(xscr, row=1, column=0, sticky="ew")
tkgrid.columnconfigure(gp, 0, weight=1)
tkgrid.rowconfigure(gp, 0, weight=1)

## call in autoscroll
## tcl("autoscroll", xscr)
## tcl("autoscroll", yscr)


##
######################

obj = new("gTabletcltk",block=gp,widget=tr,
toolkit=toolkit,ID=getNewID(), e = new.env())

tag(obj,"icon.FUN") <- icon.FUN
tag(obj,"chosencol") <- chosencol
tag(obj,"color") = if(!is.null(theArgs$color))
Expand All @@ -235,18 +247,7 @@ setMethod(".gtable",
tag(obj,"visible") <- NULL


## pack into grid
## see tkFAQ 10.1 -- makes for automatic resizing
tkgrid(tr,row=0,column=0, sticky="news")
tkgrid(yscr,row=0,column=1, sticky="ns")
tkgrid(xscr, row=1, column=0, sticky="ew")
tkgrid.columnconfigure(gp, 0, weight=1)
tkgrid.rowconfigure(gp, 0, weight=1)

## call in autoscroll
tcl("autoscroll", xscr)
tcl("autoscroll", yscr)



## font -- fixed unless overridden
# tkconfigure(tr, font="courier") # fixed
Expand All @@ -270,8 +271,7 @@ setMethod(".gtable",
.populateTable(tr, .toCharacter(items), TRUE, icons,names(items),
getSizeFrom=gp)



size(obj) <- size(obj) + c(0, 20)
return(obj)

})
Expand Down
4 changes: 2 additions & 2 deletions R/gtext.R
Expand Up @@ -63,8 +63,8 @@ setMethod(".gtext",
tkgrid.rowconfigure(gp, 0, weight=1)

## call in autoscroll
tcl("autoscroll", xscr)
tcl("autoscroll", yscr)
# tcl("autoscroll", xscr)
# tcl("autoscroll", yscr)

## set point
tkmark.set(txt,"insert","0.0")
Expand Down
2 changes: 1 addition & 1 deletion TODO.txt
Expand Up @@ -2,7 +2,7 @@ TODO:
---------
** Bug with gfile being opened from a button -- button stays depressed
after gfile is closed
* the addSpring method!!!
DONE * the addSpring method. (Requires group to be expanded!)
* move gcalendar into gWidgets as an ANY object?
* addHandlerColumnClicked use tcl(obj,"heading", colno, command=function(...) {})
* anchor or expand=TRUE fails with add. -- This needs work!
Expand Down
1 change: 1 addition & 0 deletions man/gWidgetstcltk-undocumented.Rd
Expand Up @@ -539,6 +539,7 @@
\alias{visible<--methods}
\alias{visible<-,guiWidget-method}
\alias{visible<-,gWidgettcltk-method}
\alias{visible<-,gEdittcltk-method}
%%
%% -- .visible<- --
%%
Expand Down

0 comments on commit 878b0e7

Please sign in to comment.