From daf70cc56e44ed0e3f642ee39fcba3c8cd6e4b3c Mon Sep 17 00:00:00 2001 From: aheinri5 <Anna@netzkritzler.de> Date: Fri, 19 Mar 2021 18:28:29 +0100 Subject: [PATCH] [base] added call to config package to onLoad method --- R/zzz.R | 48 +++++++++++++----------------------------------- 1 file changed, 13 insertions(+), 35 deletions(-) diff --git a/R/zzz.R b/R/zzz.R index 7feaeb7..f1f1255 100644 --- a/R/zzz.R +++ b/R/zzz.R @@ -9,49 +9,27 @@ vtk <- NULL op <- options() op.r2ogs6 <- list( # Default paths - r2ogs6.default_sim_path = "", - r2ogs6.default_script_path = "", - r2ogs6.default_benchmark_path = "", - r2ogs6.default_ogs6_processlib_path = "", - r2ogs6.default_ogs6_bin_path = "", - r2ogs6.max_lines_gml = 300, - - # External file reference tags - - # Reticulate setting for reading in VTK - r2ogs6.use_python = "" + r2ogs6.default_sim_path = NULL, + r2ogs6.default_script_path = NULL, + r2ogs6.default_benchmark_path = NULL, + r2ogs6.default_ogs6_processlib_path = NULL, + r2ogs6.default_ogs6_bin_path = NULL, + r2ogs6.max_lines_gml = NULL ) toset <- !(names(op.r2ogs6) %in% names(op)) if (any(toset)) options(op.r2ogs6[toset]) - # use superassignments to update global Python references - vtk <<- reticulate::import("vtk", delay_load = TRUE) - - test_config <- TRUE + cfg <- config::get() - if (test_config) { - options( - r2ogs6.default_sim_path = "D:/OGS_sims/", - r2ogs6.default_script_path = "D:/OGS_scripts/", - r2ogs6.default_benchmark_path = - "D:/Programme/OpenGeoSys/ogs-master/Tests/Data/", - r2ogs6.default_ogs6_processlib_path = - "D:/Programme/OpenGeoSys/ogs-master/ProcessLib/", - r2ogs6.default_ogs6_bin_path = - paste0( - "D:/Programme/OpenGeoSys/", - "ogs-6.3.3-Windows-10.0.14393-python-3.7.2-de-utils", - "/bin/" - ), - r2ogs6.max_lines_gml = 300, - r2ogs6.use_python = "D:/Programme/anaconda3/envs/rtest/python.exe" - ) - - reticulate::use_virtualenv(unlist(options("r2ogs6.use_python"))) + for(i in names(op.r2ogs6)){ + eval(parse(text = paste0("options(", i, " = cfg$", i, ")"))) } - invisible() + # use superassignments to update global Python references + vtk <<- reticulate::import("vtk", delay_load = TRUE) + + return(invisible()) } -- GitLab