1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
# 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) {
if (missing(script_name)) {
script_name = system.file("GUI/gmkin.R", package = "gmkin")
}
session_manager = gWidgetsWWW2:::make_session_manager()
r_httpd <- gWidgetsWWW2:::R_http$get_instance()
r_httpd$start()
r_httpd$load_gw(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)
}
|