diff options
author | jranke <jranke@edb9625f-4e0d-4859-8d74-9fd3b1da38cb> | 2013-09-05 12:50:58 +0000 |
---|---|---|
committer | jranke <jranke@edb9625f-4e0d-4859-8d74-9fd3b1da38cb> | 2013-09-05 12:50:58 +0000 |
commit | 25c7431bcf8cef4a8eeaa2374ff7c5e48ef86a3c (patch) | |
tree | fe2968429e65b4c6872cfe09b06b247ea192aceb | |
parent | ed8057b5a43bcdad59e7ebf4c3d429e38b25836d (diff) |
Saving the contents of the data frame with the observed variable names and reloading works in simple3.R
git-svn-id: svn+ssh://svn.r-forge.r-project.org/svnroot/kinfit/pkg/mkin@88 edb9625f-4e0d-4859-8d74-9fd3b1da38cb
-rw-r--r-- | inst/GUI/mkinGUItest.RData | bin | 169 -> 184 bytes | |||
-rw-r--r-- | inst/GUI/mkin_project_1.RData | bin | 0 -> 156 bytes | |||
-rw-r--r-- | inst/GUI/mkin_project_2.RData | bin | 0 -> 161 bytes | |||
-rw-r--r-- | inst/GUI/mkin_project_3.RData | bin | 0 -> 172 bytes | |||
-rw-r--r-- | inst/GUI/simple3.R | 55 | ||||
-rw-r--r-- | inst/GUI/test-simple2.R | 19 | ||||
-rw-r--r-- | inst/GUI/test-simple3.R | 2 |
7 files changed, 59 insertions, 17 deletions
diff --git a/inst/GUI/mkinGUItest.RData b/inst/GUI/mkinGUItest.RData Binary files differindex 82b7086d..21ec7920 100644 --- a/inst/GUI/mkinGUItest.RData +++ b/inst/GUI/mkinGUItest.RData diff --git a/inst/GUI/mkin_project_1.RData b/inst/GUI/mkin_project_1.RData Binary files differnew file mode 100644 index 00000000..24ad7616 --- /dev/null +++ b/inst/GUI/mkin_project_1.RData diff --git a/inst/GUI/mkin_project_2.RData b/inst/GUI/mkin_project_2.RData Binary files differnew file mode 100644 index 00000000..005e7652 --- /dev/null +++ b/inst/GUI/mkin_project_2.RData diff --git a/inst/GUI/mkin_project_3.RData b/inst/GUI/mkin_project_3.RData Binary files differnew file mode 100644 index 00000000..f92ed594 --- /dev/null +++ b/inst/GUI/mkin_project_3.RData diff --git a/inst/GUI/simple3.R b/inst/GUI/simple3.R new file mode 100644 index 00000000..0b12d0f9 --- /dev/null +++ b/inst/GUI/simple3.R @@ -0,0 +1,55 @@ +# Simple gWidgetsWWW2 GUI for mkin
+# Set the GUI title and create the parent frame {{{1
+GUI_title <- "Simple Browser based GUI for kinetic evaluations using mkin"
+w <- gwindow(GUI_title)
+sb <- gstatusbar("Powered by gWidgetsWWW2 and Rook", cont = w)
+g <- gframe(GUI_title, cont = w, use.scrollwindow = TRUE, horizontal = FALSE)
+
+# Set default values for project data objects {{{1
+project_file <- "mkin_project_1.RData"
+# Observed variables {{{2
+n.observed <- 2
+observed.names = c("parent", paste("M", 1:(n.observed - 1), sep=""))
+observed.df = data.frame(Index = 1:n.observed,
+ Name = observed.names,
+ stringsAsFactors = FALSE)
+
+# Project definition and file management {{{1
+upload_file_handler <- function(h, ...) # {{{2
+{
+ tmpfile <- normalizePath(svalue(h$obj), winslash = "/")
+ try(load(tmpfile))
+ project_file <<- pr.gf$filename
+ svalue(wf.ge) <- project_file
+ observed.gdf[,] <- observed.df
+}
+save_to_file_handler <- function(h, ...) # {{{2
+{
+ observed.df <- observed.gdf[,]
+ save(observed.df, file = project_file)
+ galert(paste("Saved project contents to", project_file), parent = w)
+}
+
+prg <- gexpandgroup("Project definition", cont = g)
+
+pr.vg <- ggroup(cont = prg, horizontal = FALSE)
+pr.hg <- ggroup(cont = pr.vg, horizontal = TRUE)
+pr.gf <- gfile(text = "Select project file", cont = pr.hg,
+ handler = upload_file_handler)
+pr.vg2 <- ggroup(cont = pr.hg, horizontal = FALSE)
+pr.hg2 <- ggroup(cont = pr.vg2, horizontal = TRUE)
+glabel("Current project file name is", cont = pr.hg2)
+change_project_file_handler = function(h, ...) {
+ project_file <<- as.character(svalue(h$obj))
+}
+wf.ge <- gedit(project_file, cont = pr.hg2,
+ handler = change_project_file_handler)
+
+gbutton("Save current project contents to this file", cont = pr.vg2,
+ handler = save_to_file_handler)
+
+observed.gdf <- gdf(observed.df, name = "Names of observed variables",
+ width = 500, height = 250, cont = pr.vg)
+observed.gdf$set_column_width(1, 40)
+
+# vim: set foldmethod=marker ts=2 sw=2 expandtab:
diff --git a/inst/GUI/test-simple2.R b/inst/GUI/test-simple2.R index e33e0774..3d33884d 100644 --- a/inst/GUI/test-simple2.R +++ b/inst/GUI/test-simple2.R @@ -1,17 +1,2 @@ -require(gWidgetsWWW)
-localServerStart("simple.R")
-
-localServerStart("gdf-test.R")
-localServerStart("gdf-test-john.R")
-
-localServerStart("Examples/ex-actions.R", package="gWidgetsWWW")
-localServerStart("Examples/ex-add-widget-dynamically.R", package="gWidgetsWWW")
-localServerStart("Examples/ex-clt.R", package="gWidgetsWWW")
-localServerStart("Examples/ex-form.R", package="gWidgetsWWW")
-localServerStart("Examples/ex-gcombobox.R", package="gWidgetsWWW")
-localServerStart("Examples/ex-gtable.R", package="gWidgetsWWW")
-localServerStart("Examples/ex-index.R", package="gWidgetsWWW")
-localServerStart("Examples/ex-layouts.R", package="gWidgetsWWW")
-localServerStart("Examples/ex-simple-gui.R", package="gWidgetsWWW")
-localServerStart("Examples/ex-widgets.R", package="gWidgetsWWW")
-localServerStart("Examples/ex-windows.R", package="gWidgetsWWW")
+require(gWidgetsWWW2)
+load_app("simple2.R")
diff --git a/inst/GUI/test-simple3.R b/inst/GUI/test-simple3.R new file mode 100644 index 00000000..bdac3262 --- /dev/null +++ b/inst/GUI/test-simple3.R @@ -0,0 +1,2 @@ +require(gWidgetsWWW2)
+load_app("simple3.R")
|