diff options
| -rw-r--r-- | R/gmkin.R | 28 | ||||
| -rw-r--r-- | man/gmkin.Rd | 14 | 
2 files changed, 40 insertions, 2 deletions
| @@ -1,3 +1,21 @@ +# Copyright (C) 2015 Johannes Ranke +# Contact: jranke@uni-bremen.de + +# This file is part of the R package gmkin + +# gmkin is free software: you can redistribute it and/or modify it under the +# terms of the GNU General Public License as published by the Free Software +# Foundation, either version 3 of the License, or (at your option) any later +# version. + +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more +# details. + +# You should have received a copy of the GNU General Public License along with +# this program. If not, see <http://www.gnu.org/licenses/> +  # This makes use of the ::: operator  # To avoid this, gWidgetsWWW2 needs to be adapted  gmkin <- function(script_name, show.log = FALSE) { @@ -8,10 +26,18 @@ gmkin <- function(script_name, show.log = FALSE) {    r_httpd <- gWidgetsWWW2:::R_http$get_instance()    r_httpd$start()    r_httpd$load_gw(session_manager) -  r_httpd$load_app(script_name, "gmkin", session_manager, +  gmkin_app <- r_httpd$load_app(script_name, "gmkin", session_manager,                     open_page = TRUE, show.log = show.log)    gmkin_png <- Rook::Static$new(      urls = c("/"),      root = system.file("GUI/png", package="gmkin"))    r_httpd$R$add(Rook::RhttpdApp$new(gmkin_png, name="gmkin_png")) +  invisible(gmkin_app) +} + +get_current_session <- function(app) { +  s_names <- names(app$session_manager$sessions) +  names(app$session_manager$sessions[[s_names[length(s_names)]]]$e) +  s_env <- app$session_manager$sessions[[s_names[length(s_names)]]]$e +  return(s_env)  } diff --git a/man/gmkin.Rd b/man/gmkin.Rd index 2677aa9..f8540ff 100644 --- a/man/gmkin.Rd +++ b/man/gmkin.Rd @@ -23,9 +23,21 @@  }  \examples{    \dontrun{gmkin()} # Start the gmkin GUI +  \dontrun{ +    g <- gmkin() + +    # Only for debugging or other advanced usage: +    session <- gmkin:::get_current_session(g) +    session$p.df +    session$ds.df +    session$ds.cur +    session$m.cur +    session$ws +  }   }  \value{ -  The function is called for its side effect, namely starting the GUI in a browser. +  The function is called for its side effect, namely starting the GUI in a browser.  +  For the curious, the desperate or the adventurous, the gmkin app (a GWidgetsApp object) is returned.  }  \author{    Johannes Ranke | 
