aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Ranke <jranke@uni-bremen.de>2015-12-09 11:31:52 +0100
committerJohannes Ranke <jranke@uni-bremen.de>2015-12-09 11:31:52 +0100
commit54729e55912608fefc1b1be08d01d9cbeb381d12 (patch)
tree6db9f11e34e1c70593ff4b1fe798f777c9d2c69b
parent0d00fbefa7a76fd9363d1ae8ade4721a953d6a4d (diff)
Fix keeping models/datasets when current selection is empty
-rw-r--r--inst/GUI/gmkin.R24
1 files changed, 11 insertions, 13 deletions
diff --git a/inst/GUI/gmkin.R b/inst/GUI/gmkin.R
index 8d85d64..954fe74 100644
--- a/inst/GUI/gmkin.R
+++ b/inst/GUI/gmkin.R
@@ -584,7 +584,6 @@ delete_dataset_handler <- function(h, ...) {
keep_ds_changes_handler <- function(h, ...) {
ds.i <- svalue(ds.gtable, index = TRUE)
- if (is.null(ds.i)) ds.i <- 1
editor_title <- svalue(ds.title.ge)
editor_ds <- mkinds$new(
@@ -593,16 +592,16 @@ keep_ds_changes_handler <- function(h, ...) {
time_unit = svalue(ds.e.stu),
unit = svalue(ds.e.obu))
- if (ws$ds[[ds.i]]$title == editor_title) {
- gconfirm(paste("Do you want to overwrite dataset", editor_title, "?"), parent = w,
- handler = function(h, ...) {
- ws$ds[[ds.i]] <<- editor_ds
- ds.cur <<- editor_ds
- update_ds.df()
- svalue(p.observed) <- paste(ws$observed, collapse = ", ")
- p.modified <<- TRUE
- update_ds_editor()
- })
+ if (!is.null(ds.i) && !is.na(ds.i) && ws$ds[[ds.i]]$title == editor_title) {
+ gconfirm(paste("Do you want to overwrite dataset", editor_title, "?"), parent = w,
+ handler = function(h, ...) {
+ ws$ds[[ds.i]] <<- editor_ds
+ ds.cur <<- editor_ds
+ update_ds.df()
+ svalue(p.observed) <- paste(ws$observed, collapse = ", ")
+ p.modified <<- TRUE
+ update_ds_editor()
+ })
} else {
ws$add_ds(list(editor_ds))
ds.cur <<- editor_ds
@@ -819,8 +818,7 @@ keep_m_changes_handler <- function(h, ...) {
m.cur$name <<- svalue(m.name.ge)
m.i <- svalue(m.gtable, index = TRUE)
- if (is.null(m.i)) m.i <- 1
- if (ws$m[[m.i]]$name == m.cur$name) {
+ if (!is.null(m.i) && !is.na(m.i) && ws$m[[m.i]]$name == m.cur$name) {
gconfirm(paste("Do you want to overwrite model", m.cur$name, "?"), parent = w,
handler = function(h, ...) {
ws$m[[m.i]] <- m.cur

Contact - Imprint