From 2fea32c136d01771e61ab27c78a6a27c3f4ecc39 Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Fri, 8 Jan 2016 17:12:37 +0100 Subject: Fixed some bugs, thanks to Stefan Meinecke for reporting --- DESCRIPTION | 4 +-- NEWS.md | 18 +++++++++++++ inst/GUI/gmkin.R | 66 ++++++++++++++++++++++++++++----------------- vignettes/gmkin_manual.Rmd | 5 ++-- vignettes/gmkin_manual.html | 22 +++++++-------- 5 files changed, 75 insertions(+), 40 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 0f8ca9d..f837941 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,8 @@ Package: gmkin Type: Package Title: Graphical User Interface for Fitting Kinetic Models to Chemical Degradation Data -Version: 0.6.5 -Date: 2015-12-11 +Version: 0.6.6 +Date: 2016-01-08 Authors@R: c(person("Johannes", "Ranke", role = c("aut", "cre", "cph"), email = "jranke@uni-bremen.de"), person("Eurofins Regulatory AG", role = "cph")) diff --git a/NEWS.md b/NEWS.md index 7ee36ab..0b23f4a 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,23 @@ # NEWS for package 'gmkin' +## gmkin 0.6-6 (2016-01-08) + +### Bug fixes + +- Activate the button "Keep changes" as soon as a dataset title is entered in the dataset editor so entered data can be kept. + +- Entering "x" into an input field triggered saving the file due to a peculiarity of the GAction implementation in gWidgetsWWW2. The keybinding was changed to "Shift-F12" (see below). + +- When data was entered manually, sometimes it could not be fitted as the override column was of type "character" instead of "numeric". + +### Major changes + +- Changed the keybinding for saving the current workspace to "Shift-F12" + +### Minor changes + +- The project file is now immediately shown with its full path in the project editor window after saving a file. + ## gmkin 0.6-5 (2015-12-11) ### Bug fixes diff --git a/inst/GUI/gmkin.R b/inst/GUI/gmkin.R index 8e8e445..747420e 100644 --- a/inst/GUI/gmkin.R +++ b/inst/GUI/gmkin.R @@ -26,7 +26,7 @@ right_width = 500 ds_height = 142 m_height = 142 f_height = 142 -save_keybinding = "Ctrl-X" +save_keybinding = "Shift-F12" gcb_observed_width = 100 gcb_type_width = 70 gcb_to_width = 160 @@ -149,7 +149,7 @@ ds.empty <- mkinds$new( name = rep(c("parent", "m1"), each = 5), time = rep(c(0, 1, 4, 7, 14), 2), value = c(100, rep(NA, 9)), - override = "NA", err = 1, + override = as.numeric(NA), err = 1, stringsAsFactors = FALSE)) ds.cur <- ds.empty$clone() ds.df <- ds.df.empty <- data.frame(Title = "", stringsAsFactors = FALSE) @@ -395,6 +395,7 @@ p.editor <- gframe("", horizontal = FALSE, cont = center, label = "Project") # Line with buttons {{{2 p.line.buttons <- ggroup(cont = p.editor, horizontal = TRUE) +# New {{{3 p.new.handler <- function(h, ...) { project_name <- "New project" svalue(p.name) <- project_name @@ -407,6 +408,8 @@ p.new.handler <- function(h, ...) { update_f.df() } p.new <- gbutton("New project", cont = p.line.buttons, handler = p.new.handler) + +# Delete {{{3 p.delete.handler = function(h, ...) { filename <- file.path(getwd(), paste0(svalue(p.name), ".gmkinws")) gconfirm(paste0("Are you sure you want to delete ", filename, "?"), @@ -426,41 +429,53 @@ p.delete.handler = function(h, ...) { p.delete <- gbutton("Delete project", cont = p.line.buttons, handler = p.delete.handler, ext.args = list(disabled = TRUE)) -# Project name {{{2 -p.line.name <- ggroup(cont = p.editor, horizontal = TRUE) -p.name <- gedit("New project", label = "Project name", - width = 50, cont = p.line.name) +# Save {{{3 p.save.action <- gaction("Save project to project file", parent = w, handler = function(h, ...) { filename <- paste0(svalue(p.name), ".gmkinws") - try_to_save <- function (filename) { - ws$clear_compiled() - if (!inherits(try(save(ws, file = filename)), - "try-error")) { - svalue(sb) <- paste("Saved project to file", filename, - "in working directory", getwd()) - update_p.df() - p.modified <<- FALSE - } else { - gmessage("Saving failed for an unknown reason", parent = w) + if (filename == ".gmkinws") { + gmessage("Please enter a project name", parent = w) + } else { + try_to_save <- function (filename) { + ws$clear_compiled() + if (!inherits(try(save(ws, file = filename)), + "try-error")) { + svalue(sb) <- paste("Saved project to file", filename, + "in working directory", getwd()) + update_p.df() + p.modified <<- FALSE + p.cur <- nrow(p.df) + svalue(p.filename) <<- file.path(getwd(), filename) + p.delete$call_Ext("enable") + svalue(p.observed) <- paste(ws$observed, collapse = ", ") + # gWidgetsWWW2 problem: + #svalue(p.gtable) <<- p.cur # does not set the selection + } else { + gmessage("Saving failed for an unknown reason", parent = w) + } } - } - if (file.exists(filename)) { - gconfirm(paste("File", filename, "exists. Overwrite?"), - parent = w, - handler = function(h, ...) { + if (file.exists(filename)) { + gconfirm(paste("File", filename, "exists. Overwrite?"), + parent = w, + handler = function(h, ...) { + try_to_save(filename) + }) + } else { try_to_save(filename) - }) - } else { - try_to_save(filename) + } } }) p.save.action$add_keybinding(save_keybinding) p.save <- gbutton(action = p.save.action, cont = p.line.buttons) -# cont = p.line.name) tooltip(p.save) <- paste("Press", save_keybinding, "to save") +# Project name {{{2 +p.line.name <- ggroup(cont = p.editor, horizontal = TRUE) +p.name <- gedit(label = "Project name", + initial.msg = "Enter project name", + width = 50, cont = p.line.name) + update_p_editor <- function(p.cur) { project_name <- as.character(p.df[p.cur, "Name"]) svalue(p.name) <- project_name @@ -719,6 +734,7 @@ ds.keep$call_Ext("disable") # Formlayout for meta data {{{3 ds.e.gfl <- gformlayout(cont = ds.editor) ds.title.ge <- gedit(label = "Dataset title", width = 60, cont = ds.e.gfl) +addHandlerChanged(ds.title.ge, handler = function(h, ...) ds.keep$call_Ext("enable")) ds.e.st <- gedit(width = 60, label = "Sampling times", cont = ds.e.gfl) ds.e.stu <- gedit(width = 20, label = "Unit", cont = ds.e.gfl) ds.e.rep <- gedit(width = 20, label = "Replicates", cont = ds.e.gfl) diff --git a/vignettes/gmkin_manual.Rmd b/vignettes/gmkin_manual.Rmd index bede7ba..6d9e94f 100644 --- a/vignettes/gmkin_manual.Rmd +++ b/vignettes/gmkin_manual.Rmd @@ -97,8 +97,9 @@ project list. The current state of a project should repeatedly be saved during the work in order to avoid loosing data. This can be achieved by selecting the 'Project' tab in the center and pressing -the 'Save project to project file' button. More conveniently, the keyboard shortcut Ctrl-X -can be used to save the current status of the project. +the 'Save project to project file' button. More conveniently, the keyboard shortcut Shift-F12 +(was Ctrl-X in gmkin < 0.6.6) can be used to save the current status of the +project. In the project file management area, datasets and models can be imported from one of the projects in the project list, once it has been selected in the diff --git a/vignettes/gmkin_manual.html b/vignettes/gmkin_manual.html index b01877e..8b69a86 100644 --- a/vignettes/gmkin_manual.html +++ b/vignettes/gmkin_manual.html @@ -10,20 +10,20 @@ - + Manual for gmkin - + - - - - + + + + - - + +