aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Ranke <jranke@uni-bremen.de>2014-09-26 20:47:53 +0200
committerJohannes Ranke <jranke@uni-bremen.de>2014-09-26 20:48:48 +0200
commit144fd10b34a885a8038cc38266cd0e188b6a4490 (patch)
tree08ce0cf86ca1024893917082757c39acec6f93bd
parent04def8dc34c5557dd62b903e3249e5f5e98f289c (diff)
Disallow deleting the last dataset/model as this is not supported
-rw-r--r--README.md2
-rw-r--r--inst/GUI/gmkin.R32
2 files changed, 20 insertions, 14 deletions
diff --git a/README.md b/README.md
index dec2f9d..0f47434 100644
--- a/README.md
+++ b/README.md
@@ -61,7 +61,5 @@ save(FOCUS_2006_Z_gmkin, file = "FOCUS_2006_gmkin_Z.RData")
yourself.
- Please check the [issues](https://github.com/jranke/gmkin/issues) reported on github
- Starting the GUI takes some time. Once it is started, it is reasonably responsive.
-- Do not delete the last dataset or the last model from the respective lists,
- this is not supported.
- The fit list was not always updated when using Firefox version 28 on Windows. This
works with Firefox starting from version 29 and with Chrome.
diff --git a/inst/GUI/gmkin.R b/inst/GUI/gmkin.R
index c85d660..5932f37 100644
--- a/inst/GUI/gmkin.R
+++ b/inst/GUI/gmkin.R
@@ -311,12 +311,16 @@ copy_dataset_handler <- function(h, ...) {
}
delete_dataset_handler <- function(h, ...) {
- ds[[ds.cur]] <<- NULL
- names(ds) <<- as.character(1:length(ds))
- ds.cur <<- names(ds)[[1]]
- update_ds.df()
- ds.gtable[,] <- ds.df
- update_ds_editor()
+ if (length(ds) > 1) {
+ ds[[ds.cur]] <<- NULL
+ names(ds) <<- as.character(1:length(ds))
+ ds.cur <<- names(ds)[[1]]
+ update_ds.df()
+ ds.gtable[,] <- ds.df
+ update_ds_editor()
+ } else {
+ galert("Deleting the last dataset is not supported", parent = w)
+ }
}
new_dataset_handler <- function(h, ...) {
@@ -540,12 +544,16 @@ copy_model_handler <- function(h, ...) {
}
delete_model_handler <- function(h, ...) {
- m[[m.cur]] <<- NULL
- names(m) <<- as.character(1:length(m))
- m.cur <<- "1"
- update_m.df()
- m.gtable[,] <- m.df
- update_m_editor()
+ if (length(m) > 1) {
+ m[[m.cur]] <<- NULL
+ names(m) <<- as.character(1:length(m))
+ m.cur <<- "1"
+ update_m.df()
+ m.gtable[,] <- m.df
+ update_m_editor()
+ } else {
+ galert("Deleting the last model is not supported", parent = w)
+ }
}
add_observed_handler <- function(h, ...) {

Contact - Imprint