aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--inst/GUI/mkin_project_1.RDatabin189 -> 277 bytes
-rw-r--r--inst/GUI/run_simple.R2
-rw-r--r--inst/GUI/simple.R84
3 files changed, 81 insertions, 5 deletions
diff --git a/inst/GUI/mkin_project_1.RData b/inst/GUI/mkin_project_1.RData
index 827a148..c1d956f 100644
--- a/inst/GUI/mkin_project_1.RData
+++ b/inst/GUI/mkin_project_1.RData
Binary files differ
diff --git a/inst/GUI/run_simple.R b/inst/GUI/run_simple.R
index 1220e6e..49af768 100644
--- a/inst/GUI/run_simple.R
+++ b/inst/GUI/run_simple.R
@@ -1,3 +1,3 @@
require(gWidgetsWWW2)
-load_app("simple3.R")
+load_app("simple.R")
# vim: set filetype=r:
diff --git a/inst/GUI/simple.R b/inst/GUI/simple.R
index 33ab259..bd69979 100644
--- a/inst/GUI/simple.R
+++ b/inst/GUI/simple.R
@@ -1,5 +1,6 @@
# Simple gWidgetsWWW2 GUI for mkin
# Set the GUI title and create the parent frame {{{1
+require(mkin)
GUI_title <- "Simple Browser based GUI for kinetic evaluations using mkin"
w <- gwindow(GUI_title)
sb <- gstatusbar("Powered by gWidgetsWWW2 and Rook", cont = w)
@@ -14,8 +15,33 @@ observed.df = data.frame(Index = 1:n.observed,
Name = observed.names,
Chemical = "NA",
stringsAsFactors = FALSE)
+# Studies {{{2
+studies.df <- data.frame(Index = as.integer(1),
+ Author = "FOCUS kinetics workgroup",
+ Year = "2006", Title = "FOCUS Kinetics",
+ Datasets = as.integer(3),
+ stringsAsFactors = FALSE)
+
+# Datasets {{{2
+ds <- list()
+# FOCUS 2006 A {{{3
+ds[[1]] <- list(
+ study_nr = 1,
+ dataset_nr = 1,
+ title = "FOCUS example dataset A",
+ sampling_times = unique(FOCUS_2006_A$time),
+ time_unit = "NA",
+ observed = "1",
+ unit = "% AR",
+ replicates = 1,
+ data = FOCUS_2006_A
+)
+ds[[1]]$data$override = "NA"
+ds[[1]]$data$weight = 1
-# Project definition and file management {{{1
+# Set the initial dataset number
+ds.cur = 1
+# Project data management {{{1
upload_file_handler <- function(h, ...) # {{{2
{
tmpfile <- normalizePath(svalue(h$obj), winslash = "/")
@@ -23,15 +49,17 @@ upload_file_handler <- function(h, ...) # {{{2
project_file <<- pr.gf$filename
svalue(wf.ge) <- project_file
observed.gdf[,] <- observed.df
+ studies.gdf[,] <- studies.df
}
save_to_file_handler <- function(h, ...) # {{{2
{
observed.df <- observed.gdf[,]
- save(observed.df, file = project_file)
+ studies.df <- studies.gdf[,]
+ save(observed.df, studies.df, file = project_file)
galert(paste("Saved project contents to", project_file), parent = w)
}
-# Add widgets for project definition to an expandable group {{{1
+# Add widgets for project data management to an expandable group {{{1
prg <- gexpandgroup("Project definition", cont = g)
pr.vg <- ggroup(cont = prg, horizontal = FALSE)
@@ -50,8 +78,56 @@ wf.ge <- gedit(project_file, cont = pr.hg2,
gbutton("Save current project contents to this file", cont = pr.vg2,
handler = save_to_file_handler)
+# Expandable group for observed variables {{{1
+ovg <- gexpandgroup("Observed variables", cont = g)
observed.gdf <- gdf(observed.df, name = "Names of observed variables",
- width = 500, height = 250, cont = pr.vg)
+ width = 500, height = 250, cont = ovg)
observed.gdf$set_column_width(1, 40)
+# Expandable group for studies {{{1
+stg <- gexpandgroup("Studies", cont = g)
+studies.gdf <- gdf(studies.df, name = "Studies in the project",
+ width = 500, height = 250, cont = stg)
+studies.gdf$set_column_width(1, 40)
+studies.gdf$set_column_width(2, 200)
+
+# Expandable group for datasets {{{1
+dsg <- gexpandgroup("Datasets", cont = g)
+# The following will be generated from the dataset object list later
+ds.df <- data.frame(Index = 1:3,
+ Study = as.integer(1),
+ Title = paste("FOCUS dataset", c("A", "B", "C")),
+ icon = asIcon(c("editor", "editor", "editor")),
+ stringsAsFactors = FALSE)
+ds.gtable <- gtable(ds.df, width = "auto", cont = dsg)
+ds.gtable$set_column_width(1, 40)
+ds.gtable$set_column_width(2, 40)
+ds.gtable$set_column_width(3, 200)
+
+# Dataset editor {{{2
+update_dataset_handler <- function(h, ...) {
+}
+ds.editor <- gframe(paste("Dataset", ds.cur), cont = g)
+ds.e.head <- ggroup(cont = ds.editor, horizontal = FALSE)
+ds.e.1 <- ggroup(cont = ds.e.head, horizontal = TRUE)
+glabel(paste0("Study ", ds[[ds.cur]]$study_nr, ": "), cont = ds.e.1)
+ds.title.ge <- gedit(ds[[ds.cur]]$title, cont = ds.e.1,
+ handler = update_dataset_handler)
+
+ds.e.2 <- glayout(cont = ds.e.head)
+ds.e.2[1, 1] <- glabel("Sampling times: ", cont = ds.e.2)
+ds.e.2[1, 2] <- gedit(paste(ds[[ds.cur]]$sampling_times, collapse = ", "),
+ cont = ds.e.2)
+ds.e.2[1, 3] <- glabel("Unit: ", cont = ds.e.2)
+ds.e.2[1, 4] <- gedit(ds[[ds.cur]]$time_unit, width = 8, cont = ds.e.2)
+ds.e.2[2, 1] <- glabel("Observed variables: ", cont = ds.e.2)
+ds.e.2[2, 2] <- gedit(ds[[ds.cur]]$observed, cont = ds.e.2)
+ds.e.2[2, 3] <- glabel("Unit: ", cont = ds.e.2)
+ds.e.2[2, 4] <- gedit(ds[[ds.cur]]$unit, width = 8, cont = ds.e.2)
+ds.e.2[3, 1] <- glabel("Replicates: ", cont = ds.e.2)
+ds.e.2[3, 2] <- gedit(ds[[ds.cur]]$replicates, width = 2, cont = ds.e.2)
+ds.e.2[3, 3:4] <- gbutton("Generate empty grid", cont = ds.e.2,
+ handler = update_dataset_handler)
+visible(ds.e.2) <- TRUE
+# 1}}}
# vim: set foldmethod=marker ts=2 sw=2 expandtab:

Contact - Imprint