From addb6359238596ca98f696da2d33271b851c08ac Mon Sep 17 00:00:00 2001 From: jranke Date: Thu, 5 Sep 2013 13:18:19 +0000 Subject: Clean up the GUI directory, the old stuff does not really help a lot git-svn-id: svn+ssh://svn.r-forge.r-project.org/svnroot/kinfit/pkg/mkin@89 edb9625f-4e0d-4859-8d74-9fd3b1da38cb --- inst/GUI/gdf-test.R | 12 ---- inst/GUI/mkinGUItest.RData | Bin 184 -> 169 bytes inst/GUI/mkin_project_1.RData | Bin 156 -> 189 bytes inst/GUI/mkin_project_2.RData | Bin 161 -> 185 bytes inst/GUI/mkin_project_3.RData | Bin 172 -> 217 bytes inst/GUI/run_simple.R | 3 + inst/GUI/server.R | 9 --- inst/GUI/shiny-test.R | 4 -- inst/GUI/simple-Gtk.R | 33 ----------- inst/GUI/simple.R | 125 +++++++++++++++++++----------------------- inst/GUI/simple2.R | 65 ---------------------- inst/GUI/simple3.R | 55 ------------------- inst/GUI/test-simple2.R | 2 - inst/GUI/test-simple3.R | 2 - inst/GUI/test.R | 17 ------ inst/GUI/ui.R | 14 ----- 16 files changed, 60 insertions(+), 281 deletions(-) delete mode 100644 inst/GUI/gdf-test.R create mode 100644 inst/GUI/run_simple.R delete mode 100644 inst/GUI/server.R delete mode 100644 inst/GUI/shiny-test.R delete mode 100644 inst/GUI/simple-Gtk.R delete mode 100644 inst/GUI/simple2.R delete mode 100644 inst/GUI/simple3.R delete mode 100644 inst/GUI/test-simple2.R delete mode 100644 inst/GUI/test-simple3.R delete mode 100644 inst/GUI/test.R delete mode 100644 inst/GUI/ui.R (limited to 'inst') diff --git a/inst/GUI/gdf-test.R b/inst/GUI/gdf-test.R deleted file mode 100644 index b1ec20a..0000000 --- a/inst/GUI/gdf-test.R +++ /dev/null @@ -1,12 +0,0 @@ -w <- gwindow("gdf test") -g <- ggroup(horizontal=FALSE, cont=w) -d <- gdf(data.frame(a=c(1.1, 2.2, 3.3), b= c("one", "two", "three"), stringsAsFactors=FALSE), - name = "Test for editing character columns", cont=g) -size(d) <- c(400,400) -gbutton("Change [1,2]", handler=function(h,...) { - d[1,2] <- "test" -}, container=g) -gbutton("Value of [1,2]", handler=function(h,...) { - galert(d[1,2], parent=d) -}, cont=g) -visible(w) <- TRUE diff --git a/inst/GUI/mkinGUItest.RData b/inst/GUI/mkinGUItest.RData index 21ec792..82b7086 100644 Binary files a/inst/GUI/mkinGUItest.RData and b/inst/GUI/mkinGUItest.RData differ diff --git a/inst/GUI/mkin_project_1.RData b/inst/GUI/mkin_project_1.RData index 24ad761..827a148 100644 Binary files a/inst/GUI/mkin_project_1.RData and b/inst/GUI/mkin_project_1.RData differ diff --git a/inst/GUI/mkin_project_2.RData b/inst/GUI/mkin_project_2.RData index 005e765..1e37de7 100644 Binary files a/inst/GUI/mkin_project_2.RData and b/inst/GUI/mkin_project_2.RData differ diff --git a/inst/GUI/mkin_project_3.RData b/inst/GUI/mkin_project_3.RData index f92ed59..cdf942d 100644 Binary files a/inst/GUI/mkin_project_3.RData and b/inst/GUI/mkin_project_3.RData differ diff --git a/inst/GUI/run_simple.R b/inst/GUI/run_simple.R new file mode 100644 index 0000000..1220e6e --- /dev/null +++ b/inst/GUI/run_simple.R @@ -0,0 +1,3 @@ +require(gWidgetsWWW2) +load_app("simple3.R") +# vim: set filetype=r: diff --git a/inst/GUI/server.R b/inst/GUI/server.R deleted file mode 100644 index 12386f2..0000000 --- a/inst/GUI/server.R +++ /dev/null @@ -1,9 +0,0 @@ -library(shiny) - -shinyServer(function(input, output) { - output$test <- renderText({ - input$test - }) -}) - -# vim: set ts=2 sw=2 foldmethod=marker expandtab: diff --git a/inst/GUI/shiny-test.R b/inst/GUI/shiny-test.R deleted file mode 100644 index 712c0b2..0000000 --- a/inst/GUI/shiny-test.R +++ /dev/null @@ -1,4 +0,0 @@ -library(shiny) -runApp("./") - -# vim: set foldmethod=marker ts=2 sw=2 expandtab: diff --git a/inst/GUI/simple-Gtk.R b/inst/GUI/simple-Gtk.R deleted file mode 100644 index 8affdcc..0000000 --- a/inst/GUI/simple-Gtk.R +++ /dev/null @@ -1,33 +0,0 @@ -# Work in progress - simple Gtk2 GUI for mkin -require(gWidgets) -options("guiToolkit"="RGtk2") - -w <- gwindow("Simple R GUI for kinetic evaluations", - width=800, height=500) - -# Project definition expanding group -pr <- gexpandgroup("Project definition", container=w) - -n.observed <- 1 -max.n.observed <- 9 -observed.names = c("parent", paste("M", 1:(max.n.observed - 1), sep="")) - -prg <- ggroup(horizontal=FALSE, cont = w) -prl <- glayout(cont = prg) -prl[1,1] <- glabel("Number of observed variables", cont=prl) -prl[1,2] <- (n.observed.gw = gcombobox( - 1:max.n.observed, - handler = function(h, ...) { - n.observed <- svalue(n.observed.gw) - visible(observed.gw) <- c( - rep(TRUE, svalue(n.observed)), - rep(FALSE, max.n.observed - n.observed)) - }, - cont=prl)) - -observed.gw <- gdf( - items = data.frame(Index = 1:max.n.observed, - Name = observed.names, stringsAsFactors=FALSE), - name = "Names of observed variables", - cont=prg) - diff --git a/inst/GUI/simple.R b/inst/GUI/simple.R index c187414..33ab259 100644 --- a/inst/GUI/simple.R +++ b/inst/GUI/simple.R @@ -1,68 +1,57 @@ -# Work in progress - simple GUI for mkin -w <- gwindow('Simple R GUI for kinetic evaluations', visible=FALSE) -# Project definition {{{ -pr <- gexpandgroup("Project", cont=w) - -n.observed <- 1 -max.n.observed <- 9 -observed.names = c("parent", paste("M", 1:(max.n.observed - 1), sep="")) - -prg <- ggroup(horizontal=FALSE, cont = pr) -prl <- glayout(cont = prg) -prl[1,1] <- glabel("Number of observed variables", cont=prl) -prl[1,2] <- (n.observed.gw = gcombobox( - 1:max.n.observed, - handler = function(h, ...) { - n.observed <<- svalue(n.observed.gw) - filter.expression <- paste("^[1-", n.observed, "]$", sep="") - observed.gw$filter("Index", filter.expression) - }, - cont=prl)) - -observed.gw <- gdf( - items = data.frame(Index = 1:max.n.observed, - Name = observed.names, stringsAsFactors=FALSE), - name = "Names of observed variables", - width = 500, height=250, cont=prg) - -addSpace(prg, 15) -prf <- gfile("Project file in binary R format (preferably use .RData as extension)", - container = prg) -addSpring(prg) -addSpace(prg, 15) -pr.ok <- gbutton("save", - handler=function(h,...) { - galert(svalue(prf), parent=w) - }, container=prg) - -gbutton("ok", handler = function(h, ...) { - observed <- observed.gw[1:n.observed,2] - save(observed, file="observed.RData") - visible(pr) <- FALSE - }, - cont=prg -) - -visible(pr) <- TRUE -# }}} - -# Dataset definition -ds <- gexpandgroup("Datasets", cont=w) -s <- gdf(data.frame( Author = c("Meier"), Year = "3", Title = "4"), - name = "Studies", -cont=ds) - -size(s) <- c(800,200) -visible(ds) <- TRUE - -# Model definition -ms <- gexpandgroup("Models", cont=w) -visible(ms) <- FALSE - -# Evaluation window -mw <- gframe("Evaluations", cont=w) - -# Status bar -gstatusbar("Powered by gWidgetsWWW", cont = w) -visible(w) <- TRUE -# vim: set foldmethod=marker: +# 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, + Chemical = "NA", + 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) +} + +# Add widgets for project definition to an expandable group {{{1 +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/simple2.R b/inst/GUI/simple2.R deleted file mode 100644 index 2f725d1..0000000 --- a/inst/GUI/simple2.R +++ /dev/null @@ -1,65 +0,0 @@ -# Simple gWidgetsWWW2 GUI for mkin -w <- gwindow("Simple R GUI for kinetic evaluations") -sb <- gstatusbar("Powered by gWidgetsWWW2 and Rook", cont = w) -g <- gframe("Simple R GUI for kinetic evaluations", cont = w, - use.scrollwindow = TRUE, horizontal = FALSE) - -# Project definition {{{1 -prg <- gexpandgroup("Project definition", cont = g) -visible(prg) <- TRUE - -make_observed <- function(observed.df) { - if (!exists("observed.df")) { - 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) - } - - observed.gdf <- gdf(observed.df, - name = "Names of observed variables", - width = 500, height = 250, cont = prg) - observed.gdf$set_column_width(1, 40) -} - -f <- gfile(text = "Set project file", cont = prg, - handler = function(h, ...) - { - tmpfile <- normalizePath(svalue(h$obj), winslash = "/") - load(tmpfile) - make_observed(observed.df) - }) - -# Editable table of studies {{{1 -stg <- gexpandgroup("Studies", cont = g) -visible(stg) <- FALSE -studies.df <- data.frame(Index = as.integer(1), - Author = "FOCUS kinetics workgroup", - Year = "2006", - Title = "FOCUS Kinetics", - Datasets = as.integer(3), - stringsAsFactors = FALSE) -studies.gdf <- gdf(studies.df, - name = "Editable list of studies in the project", - width = "auto", - cont = stg) -studies.gdf$set_column_width(1, 40) -studies.gdf$set_column_width(2, 200) - -# Table of datasets to select them for editing {{{1 -dsg <- gexpandgroup("Datasets", cont = g) -visible(dsg) <- FALSE -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) - - -# 1}}} -# vim: set foldmethod=marker ts=2 sw=2 expandtab: diff --git a/inst/GUI/simple3.R b/inst/GUI/simple3.R deleted file mode 100644 index 0b12d0f..0000000 --- a/inst/GUI/simple3.R +++ /dev/null @@ -1,55 +0,0 @@ -# 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 deleted file mode 100644 index 3d33884..0000000 --- a/inst/GUI/test-simple2.R +++ /dev/null @@ -1,2 +0,0 @@ -require(gWidgetsWWW2) -load_app("simple2.R") diff --git a/inst/GUI/test-simple3.R b/inst/GUI/test-simple3.R deleted file mode 100644 index bdac326..0000000 --- a/inst/GUI/test-simple3.R +++ /dev/null @@ -1,2 +0,0 @@ -require(gWidgetsWWW2) -load_app("simple3.R") diff --git a/inst/GUI/test.R b/inst/GUI/test.R deleted file mode 100644 index e33e077..0000000 --- a/inst/GUI/test.R +++ /dev/null @@ -1,17 +0,0 @@ -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") diff --git a/inst/GUI/ui.R b/inst/GUI/ui.R deleted file mode 100644 index 2b0b868..0000000 --- a/inst/GUI/ui.R +++ /dev/null @@ -1,14 +0,0 @@ -library(shiny) -shinyUI(pageWithSidebar( - - headerPanel("shiny GUI for mkin"), - - sidebarPanel( - textInput("test", "Test:", "test input") - ), - - mainPanel( - textOutput("test") - ) -)) -# vim: set ts=2 sw=2 foldmethod=marker expandtab: -- cgit v1.2.1