aboutsummaryrefslogtreecommitdiff
path: root/inst/GUI/gmkin.R
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 /inst/GUI/gmkin.R
parent1c1106777a98119cf29c05c3f6e0de7077eb19b5 (diff)
Prevent loading of incompatible workspace files from previous version
Diffstat (limited to 'inst/GUI/gmkin.R')
-rw-r--r--inst/GUI/gmkin.R81
1 files changed, 47 insertions, 34 deletions
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