aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Ranke <jranke@uni-bremen.de>2014-10-16 09:22:17 +0200
committerJohannes Ranke <jranke@uni-bremen.de>2014-10-16 09:22:17 +0200
commit520cd0fcea385454460b3958ce864828f0ae6542 (patch)
tree82445a182a438e02ceb423af1478dd15d8f87687
parent1c1106777a98119cf29c05c3f6e0de7077eb19b5 (diff)
Prevent loading of incompatible workspace files from previous version
-rw-r--r--DESCRIPTION2
-rw-r--r--NEWS.md4
-rw-r--r--inst/GUI/gmkin.R81
3 files changed, 52 insertions, 35 deletions
diff --git a/DESCRIPTION b/DESCRIPTION
index a09e486..8acf6e7 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -2,7 +2,7 @@ Package: gmkin
Type: Package
Title: GUI for Fitting Kinetic Models to Chemical Degradation Data with mkin
Version: 0.5-5
-Date: 2014-10-14
+Date: 2014-10-16
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 9ffbff1..9f8da9d 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -1,5 +1,9 @@
# CHANGES in gmkin VERSION 0.5-5
+## BUG FIXES
+
+- Prevent loading old gmkin workspace files created with mkin < 0.9-32 as they do not load properly
+
# CHANGES in gmkin VERSION 0.5-4
## BUG FIXES
diff --git a/inst/GUI/gmkin.R b/inst/GUI/gmkin.R
index 50cd4ed..9a19732 100644
--- a/inst/GUI/gmkin.R
+++ b/inst/GUI/gmkin.R
@@ -111,48 +111,61 @@ upload_file_handler <- function(h, ...)
project_name <<- try(load(tmpfile))
if (inherits(project_name, "try-error")) {
galert(paste("Failed to load", project_file), parent = w)
- }
+ }
- svalue(sb) <- paste("Loaded project file", project_file)
- svalue(pr.ge) <- project_name
workspace <- get(project_name)
- # Studies
- studies.gdf[,] <- studies.df <- workspace$studies.df
+ # Check for old workspaces created using mkin < 0.9-32 that aren't loaded properly
+ if (is.null(workspace$f[[1]]$method.modFit)) {
+ stopmessage <- paste("Could not load workspace ",
+ project_file,
+ ". It seems it was created using mkin with version < 0.9-32",
+ sep = "")
+ galert(stopmessage, parent = w)
+ svalue(sb) <- stopmessage
+ } else {
- # Datasets
- ds.cur <<- workspace$ds.cur
- ds <<- workspace$ds
- update_ds.df()
- ds.gtable[,] <- ds.df
- update_ds_editor()
+ # Update project file name and status bar
+ svalue(pr.ge) <- project_name
+ svalue(sb) <- paste("Loaded project file", project_file)
- # Models
- m.cur <<- workspace$m.cur
- m <<- workspace$m
- update_m.df()
- m.gtable[,] <- m.df
- update_m_editor()
+ # Studies
+ studies.gdf[,] <- studies.df <- workspace$studies.df
- # Fits
- f.cur <<- workspace$f.cur
- f <<- workspace$f
- s <<- workspace$s
- if (length(f) > 0) {
- update_f.df()
- ftmp <<- f[[f.cur]]
- stmp <<- s[[f.cur]]
- ds.i <<- ds.cur
- delete(f.gg.plotopts, f.gg.po.obssel)
- f.gg.po.obssel <<- gcheckboxgroup(names(ftmp$mkinmod$spec), cont = f.gg.plotopts,
- checked = TRUE)
- update_plotting_and_fitting()
- } else {
- f.df <<- f.df.empty
+ # Datasets
+ ds.cur <<- workspace$ds.cur
+ ds <<- workspace$ds
+ update_ds.df()
+ ds.gtable[,] <- ds.df
update_ds_editor()
- svalue(center) <- 1
+
+ # Models
+ m.cur <<- workspace$m.cur
+ m <<- workspace$m
+ update_m.df()
+ m.gtable[,] <- m.df
+ update_m_editor()
+
+ # Fits
+ f.cur <<- workspace$f.cur
+ f <<- workspace$f
+ s <<- workspace$s
+ if (length(f) > 0) {
+ update_f.df()
+ ftmp <<- f[[f.cur]]
+ stmp <<- s[[f.cur]]
+ ds.i <<- ds.cur
+ delete(f.gg.plotopts, f.gg.po.obssel)
+ f.gg.po.obssel <<- gcheckboxgroup(names(ftmp$mkinmod$spec), cont = f.gg.plotopts,
+ checked = TRUE)
+ update_plotting_and_fitting()
+ } else {
+ f.df <<- f.df.empty
+ update_ds_editor()
+ svalue(center) <- 1
+ }
+ f.gtable[,] <- f.df
}
- f.gtable[,] <- f.df
}
save_to_file_handler <- function(h, ...)
{

Contact - Imprint