From b116635d05647eec6909e844be6034e17ca2f821 Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Fri, 6 Nov 2015 14:01:56 +0100 Subject: Return the gmkin app from gmkin() and update its documentation --- R/gmkin.R | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) (limited to 'R') diff --git a/R/gmkin.R b/R/gmkin.R index 424054e..a5d16fb 100644 --- a/R/gmkin.R +++ b/R/gmkin.R @@ -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 + # 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) } -- cgit v1.2.1