diff options
author | Johannes Ranke <jranke@uni-bremen.de> | 2014-11-23 15:12:05 +0100 |
---|---|---|
committer | Johannes Ranke <jranke@uni-bremen.de> | 2014-11-23 15:12:05 +0100 |
commit | 0ad5915830bf03aac6c4cc70becc886e2d02f5b9 (patch) | |
tree | aa6b813fc7de2fbe04fed43f643936ec930b730d | |
parent | eb615c9bd374640fc57c7d433a3f6d51a1a79ea7 (diff) |
Create separate handler function for deleting fits
This was done to make it possible to debug this function
-rw-r--r-- | inst/GUI/gmkin.R | 43 |
1 files changed, 23 insertions, 20 deletions
diff --git a/inst/GUI/gmkin.R b/inst/GUI/gmkin.R index 693a038..0bd3c9b 100644 --- a/inst/GUI/gmkin.R +++ b/inst/GUI/gmkin.R @@ -894,26 +894,29 @@ keep.fit.gb <- gbutton("Keep fit", }, cont = f.gg.buttons)
tooltip(keep.fit.gb) <- "Store the optimised model with all settings and the current dataset in the fit list"
-delete.fit.gb <- gbutton("Delete fit", handler = function(h, ...) {
- if (length(f) > 0) {
- f[[f.cur]] <<- NULL
- s[[f.cur]] <<- NULL
- }
- if (length(f) > 0) {
- names(f) <<- as.character(1:length(f))
- names(s) <<- as.character(1:length(f))
- update_f.df()
- f.cur <<- "1"
- ftmp <<- f[[f.cur]]
- stmp <<- s[[f.cur]]
- ds.i <<- ftmp$ds.index
- update_plotting_and_fitting()
- } else {
- f.df <<- f.df.empty
- f.cur <<- "0"
- }
- f.gtable[,] <<- f.df
- }, cont = f.gg.buttons)
+delete_fit_handler <- function(h, ...) {
+ if (length(f) > 0) {
+ f[[f.cur]] <<- NULL
+ s[[f.cur]] <<- NULL
+ }
+ if (length(f) > 0) {
+ names(f) <<- as.character(1:length(f))
+ names(s) <<- as.character(1:length(f))
+ update_f.df()
+ f.cur <<- "1"
+ ftmp <<- f[[f.cur]]
+ stmp <<- s[[f.cur]]
+ ds.i <<- ftmp$ds.index
+ update_plotting_and_fitting()
+ } else {
+ f.df <<- f.df.empty
+ f.cur <<- "0"
+ }
+ f.gtable[,] <<- f.df
+}
+
+delete.fit.gb <- gbutton("Delete fit", handler = delete_fit_handler,
+ cont = f.gg.buttons)
tooltip(delete.fit.gb) <- "Delete the currently loaded fit from the fit list"
show.initial.gb <- gbutton("Show initial",
|