From 17d39f9eb94d7eeb4587942320079fa17b01e9e0 Mon Sep 17 00:00:00 2001 From: jranke Date: Tue, 1 Oct 2013 15:27:30 +0000 Subject: - Remove mkin GUI project files, as they can be a source of error during development - Make the index to the dataset list ds a character, in order to be able to count the entries correctly after deleting an entry - Make the dataset switcher a handler only for the click event, as otherwise it was called by the assignment of the new data to the gtable widget git-svn-id: svn+ssh://svn.r-forge.r-project.org/svnroot/kinfit/pkg/mkin@98 edb9625f-4e0d-4859-8d74-9fd3b1da38cb --- inst/GUI/mkin_project_1.RData | Bin 277 -> 0 bytes inst/GUI/mkin_project_2.RData | Bin 185 -> 0 bytes inst/GUI/mkin_project_3.RData | Bin 217 -> 0 bytes inst/GUI/simple.R | 41 ++++++++++++++++++++++++----------------- 4 files changed, 24 insertions(+), 17 deletions(-) delete mode 100644 inst/GUI/mkin_project_1.RData delete mode 100644 inst/GUI/mkin_project_2.RData delete mode 100644 inst/GUI/mkin_project_3.RData (limited to 'inst') diff --git a/inst/GUI/mkin_project_1.RData b/inst/GUI/mkin_project_1.RData deleted file mode 100644 index c1d956f9..00000000 Binary files a/inst/GUI/mkin_project_1.RData and /dev/null differ diff --git a/inst/GUI/mkin_project_2.RData b/inst/GUI/mkin_project_2.RData deleted file mode 100644 index 1e37de70..00000000 Binary files a/inst/GUI/mkin_project_2.RData and /dev/null differ diff --git a/inst/GUI/mkin_project_3.RData b/inst/GUI/mkin_project_3.RData deleted file mode 100644 index cdf942d9..00000000 Binary files a/inst/GUI/mkin_project_3.RData and /dev/null differ diff --git a/inst/GUI/simple.R b/inst/GUI/simple.R index 7ec03d57..40c1a432 100644 --- a/inst/GUI/simple.R +++ b/inst/GUI/simple.R @@ -18,7 +18,8 @@ observed.df = data.frame(Index = 1:n.observed, # Studies {{{2 studies.df <- data.frame(Index = as.integer(1), Author = "FOCUS kinetics workgroup", - Year = "2006", Title = "FOCUS Kinetics", + Year = "2006", + Title = "FOCUS Kinetics", stringsAsFactors = FALSE) # Datasets {{{2 @@ -26,10 +27,10 @@ ds <- list() # FOCUS 2006 datasets {{{3 for (i in 1:6) { ds.letter = LETTERS[i] + ds.index <- as.character(i) ds.name = paste0("FOCUS_2006_", ds.letter) - ds[[i]] <- list( + ds[[ds.index]] <- list( study_nr = 1, - dataset_nr = i, title = paste("FOCUS example dataset", ds.letter), sampling_times = unique(get(ds.name)$time), time_unit = "NA", @@ -38,25 +39,29 @@ for (i in 1:6) { replicates = 1, data = get(ds.name) ) - ds[[i]]$data$override = "NA" - ds[[i]]$data$weight = 1 + ds[[ds.index]]$data$override = "NA" + ds[[ds.index]]$data$weight = 1 } -# Dataframe with datasets for selecting them with the gtable widget {{{2 -ds.df <- data.frame() -update_ds.df <- function() { +# Dataframe with datasets for selection with the gtable widget {{{2 +update_ds.df <- function() { # {{{3 ds.n <- length(ds) - ds.df <<- data.frame(Index = 1:ds.n, Study = character(ds.n), Title = character(ds.n), - icon = asIcon(rep("editor", ds.n)), stringsAsFactors = FALSE) + ds.df <<- data.frame(Index = 1:ds.n, + Study = character(ds.n), + Title = character(ds.n), + icon = asIcon(rep("editor", ds.n)), + stringsAsFactors = FALSE) for (i in 1:ds.n) { - ds.df[i, "Study"] <<- ds[[i]]$study_nr - ds.df[i, "Title"] <<- ds[[i]]$title + ds.index <- names(ds)[[i]] + ds.df[i, "Study"] <<- ds[[ds.index]]$study_nr + ds.df[i, "Title"] <<- ds[[ds.index]]$title } } +ds.df <- data.frame() update_ds.df() -# Set the initial dataset number -ds.cur = 1 +# Set the initial dataset number globally +ds.cur = "1" # Project data management {{{1 upload_file_handler <- function(h, ...) # {{{2 { @@ -110,13 +115,15 @@ studies.gdf$set_column_width(2, 200) # Expandable group for datasets {{{1 dsg <- gexpandgroup("Datasets", cont = g, horizontal = FALSE) -ds.handler <- function(h, ...) { - ds.cur <<- svalue(h$obj, index = FALSE) +# Renew dataset editor when a different dataset is selected +ds.switcher <- function(h, ...) { + ds.cur <<- as.character(svalue(h$obj)) delete(ds.editor, ds.e.head) delete(ds.editor, ds.e.data) show_ds_editor() } -ds.gtable <- gtable(ds.df, handler = ds.handler, cont = dsg) +ds.gtable <- gtable(ds.df, cont = dsg) +addHandlerClicked(ds.gtable, ds.switcher) size(ds.gtable) <- list(columnWidths = c(40, 40, 200, 40)) # Dataset editor {{{2 -- cgit v1.2.1