aboutsummaryrefslogtreecommitdiff
path: root/inst
diff options
context:
space:
mode:
authorJohannes Ranke <jranke@uni-bremen.de>2014-10-16 10:55:20 +0200
committerJohannes Ranke <jranke@uni-bremen.de>2014-10-16 10:55:20 +0200
commit27a6c4418ec39c473e02fefa062b1e077553525e (patch)
tree5811001dde348f2d7a6ad5f131f8a56bbdbef96f /inst
parent520cd0fcea385454460b3958ce864828f0ae6542 (diff)
Fix saving summary files
Diffstat (limited to 'inst')
-rw-r--r--inst/GUI/gmkin.R28
1 files changed, 21 insertions, 7 deletions
diff --git a/inst/GUI/gmkin.R b/inst/GUI/gmkin.R
index 9a19732..7932331 100644
--- a/inst/GUI/gmkin.R
+++ b/inst/GUI/gmkin.R
@@ -270,7 +270,8 @@ configure_fit_handler = function(h, ...) {
show_plot("Initial", default = TRUE)
oldwidth <<- options()$width
options(width = 90)
- svalue(f.gg.summary) <- c("<pre>", capture.output(stmp), "</pre>")
+ svalue(f.gg.summary.filename) <<- ""
+ svalue(f.gg.summary.listing) <<- c("<pre>", capture.output(stmp), "</pre>")
options(width = oldwidth)
svalue(center) <- 3
}
@@ -764,7 +765,8 @@ run_fit <- function() {
svalue(f.gg.opts.st) <- ftmp$solution_type
svalue(f.gg.opts.weight) <- ftmp$weight.ini
f.gg.parms[,] <- get_Parameters(stmp, TRUE)
- svalue(f.gg.summary) <- c("<pre>", capture.output(stmp), "</pre>")
+ svalue(f.gg.summary.filename) <<- paste(ftmp$ds$title, "_", ftmp$mkinmod$name, ".txt", sep = "")
+ svalue(f.gg.summary.listing) <<- c("<pre>", capture.output(stmp), "</pre>")
}
ds.i <- m.i <- "1"
f.cur <- "0"
@@ -930,15 +932,26 @@ f.gg.opts.maxit.modFit <- gedit("auto", label = "maxit.modFit",
# Summary {{{3
oldwidth <- options()$width
options(width = 90)
-summaryfile <- paste(ds[[ds.cur]]$title, "_", m[[m.cur]]$name, ".txt", sep = "")
f.gg.summary <- ggroup(label = "Summary", cont = f.gn, horizontal = FALSE)
f.gg.summary.topline <- ggroup(cont = f.gg.summary, horizontal = TRUE)
-f.gg.summary.filename <- gedit(summaryfile, width = 50, cont = f.gg.summary.topline)
+f.gg.summary.filename <- gedit(paste(ds[[ds.cur]]$title, "_", m[[m.cur]]$name,
+ ".txt", sep = ""),
+ width = 50, cont = f.gg.summary.topline)
f.gg.summary.savebutton <- gbutton("Save summary", cont = f.gg.summary.topline,
handler = function(h, ...) {
- capture.output(stmp, file = summaryfile)
+ filename <- svalue(f.gg.summary.filename)
+ if (file.exists(filename))
+ {
+ gconfirm(paste("File", filename, "exists. Overwrite?"),
+ parent = w,
+ handler = function(h, ...) {
+ capture.output(stmp, file = filename)
+ })
+ } else {
+ capture.output(stmp, file = filename)
+ }
})
-f.gg.summary <- ghtml(c("<pre>", capture.output(stmp), "</pre>"),
+f.gg.summary.listing <- ghtml(c("<pre>", capture.output(stmp), "</pre>"),
cont = f.gg.summary, label = "Summary")
options(width = oldwidth)
@@ -979,7 +992,8 @@ update_plotting_and_fitting <- function() {
# Summary
oldwidth <<- options()$width
options(width = 90)
- svalue(f.gg.summary) <- c("<pre>", capture.output(stmp), "</pre>")
+ svalue(f.gg.summary.filename) <<- paste(ftmp$ds$title, "_", ftmp$mkinmod$name, ".txt", sep = "")
+ svalue(f.gg.summary.listing) <<- c("<pre>", capture.output(stmp), "</pre>")
options(width = oldwidth)
# Plot options

Contact - Imprint