Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
CSIRO-INRA
landsepi
Commits
0205b4e4
Commit
0205b4e4
authored
Jun 17, 2021
by
Jean-Francois Rey
☕
Browse files
Add a debug mode -> need to add more verbose
bugfix input no more in edit mode after simulation change icon splitscreen
parent
36aac719
Changes
3
Hide whitespace changes
Inline
Side-by-side
inst/shiny-landsepi/global.R
View file @
0205b4e4
...
...
@@ -12,6 +12,12 @@ library(promises)
library
(
tools
)
library
(
shinyalert
)
# Active debug level
# 0 : no print
# 1 : warning
# 2 : error
# 3 : all
ACTIVE_DEBUG
<-
3
library
(
"landsepiDev"
)
data
(
package
=
"landsepiDev"
)
...
...
@@ -54,6 +60,13 @@ simul_params_genes <- shiny::reactiveVal()
# Functions
##################################################################
# Print message in terminal
# msg : message to print
# level : level of output (0 no output, 3 all output)
printVerbose
<-
function
(
msg
,
level
=
ACTIVE_DEBUG
)
{
if
(
level
>=
3
)
cat
(
file
=
stderr
(),
"### DEBUG "
,
msg
,
"\n"
)
}
## Show message
## id : message id
## selectorafter : id element to place message after
...
...
inst/shiny-landsepi/server.R
View file @
0205b4e4
...
...
@@ -169,6 +169,7 @@ server <- function(input, output, session) {
observeEvent
(
input
$
Mode
,
{
advanced_mode
(
!
advanced_mode
())
if
(
advanced_mode
())
{
printVerbose
(
"enable mode edition"
,
level
=
3
)
shinyjs
::
disable
(
id
=
"demo"
)
shinyjs
::
enable
(
id
=
"rotationPeriod"
)
shinyjs
::
enable
(
id
=
"patho_infection_rate"
)
...
...
@@ -184,6 +185,7 @@ server <- function(input, output, session) {
shinyjs
::
enable
(
id
=
"patho_sigmoid_plateau"
)
}
else
{
printVerbose
(
"disable mode edition"
,
level
=
3
)
shinyjs
::
disable
(
id
=
"rotationPeriod"
)
shinyjs
::
enable
(
id
=
"demo"
)
shinyjs
::
disable
(
id
=
"patho_infection_rate"
)
...
...
@@ -656,23 +658,32 @@ server <- function(input, output, session) {
# Handle the "Run simulation" button
shiny
::
observeEvent
(
input
$
runSimulation
,
{
shinyjs
::
click
(
"showOutputside"
)
withProgress
(
message
=
"Running Simulation, please wait..."
,
value
=
0
,
{
print
(
simul_params
)
progressBar
<-
Progress
$
new
()
progressBar
$
set
(
value
=
NULL
,
message
=
"Running Simulation, please wait..."
)
# setwd(paste0(ROOT_PATH,"/www/tmp/"))
shinyjs
::
disable
(
id
=
"inputpanel"
)
shinyjs
::
disable
(
id
=
"generateLandscape"
)
shinyjs
::
disable
(
id
=
"runSimulation"
)
shinyjs
::
disable
(
id
=
"export"
)
shinyjs
::
enable
(
id
=
"stopSimulation"
)
shinyjs
::
disable
(
"showInputside"
)
shinyjs
::
disable
(
"showBothside"
)
shinyjs
::
click
(
"showOutputside"
)
# seems not working -> force it
shinyjs
::
showElement
(
id
=
"outputside"
)
shinyjs
::
hideElement
(
id
=
"inputside"
)
removeCssClass
(
"inputside"
,
"col-sm-12"
)
removeCssClass
(
"inputside"
,
"col-sm-6"
)
addCssClass
(
"inputside"
,
"col-sm-0"
)
removeCssClass
(
"outputside"
,
"col-sm-0"
)
removeCssClass
(
"outputside"
,
"col-sm-6"
)
addCssClass
(
"outputside"
,
"col-sm-12"
)
progressBar
$
set
(
value
=
0.4
)
plan
(
list
(
multicore
,
multi
process
))
plan
(
list
(
multicore
,
multi
session
))
future_process
<<-
future
({
res
<-
landsepiDev
::
runSimul
(
simul_params
,
...
...
@@ -684,11 +695,10 @@ server <- function(input, output, session) {
onFulfilled
=
function
(
value
)
{
progressBar
$
set
(
value
=
0.8
,
message
=
"Simulation ended : making video..."
)
shinyjs
::
enable
(
id
=
"inputpanel"
)
shinyjs
::
enable
(
id
=
"generateLandscape"
)
# shinyjs::enable(id = "runSimulation")
shinyjs
::
enable
(
id
=
"export"
)
shinyjs
::
dis
able
(
id
=
"runSimulation"
)
shinyjs
::
en
able
(
id
=
"runSimulation"
)
shinyjs
::
disable
(
id
=
"stopSimulation"
)
output
$
landscapeimg
<-
NULL
...
...
@@ -705,6 +715,8 @@ server <- function(input, output, session) {
height
=
"auto"
)
)
shinyjs
::
enable
(
"showInputside"
)
shinyjs
::
enable
(
"showBothside"
)
shinyjs
::
click
(
"showOutputside"
)
# setwd(dirname(getwd()))
},
...
...
@@ -712,7 +724,9 @@ server <- function(input, output, session) {
setwd
(
ROOT_PATH
)
cat
(
file
=
stderr
(),
"\n ### KILL'EM ALL ### -> Kill simulation \n"
)
cleanDir
(
simul_params
@
OutputDir
)
shinyjs
::
enable
(
id
=
"inputpanel"
)
shinyjs
::
enable
(
"showInputside"
)
shinyjs
::
enable
(
"showBothside"
)
shinyjs
::
click
(
"showBothside"
)
shinyjs
::
enable
(
id
=
"generateLandscape"
)
can_run_simul
$
landscape
<<-
FALSE
future_process
<-
NULL
...
...
inst/shiny-landsepi/ui.R
View file @
0205b4e4
...
...
@@ -311,9 +311,9 @@ ui <- {
align
=
"center"
),
shiny
::
br
(),
fluidRow
(
actionButton
(
"show
Out
putside"
,
label
=
""
,
icon
=
icon
(
"
angle-double-left
"
)
),
actionButton
(
"show
In
putside"
,
label
=
""
,
icon
=
icon
(
"
wpforms
"
)),
actionButton
(
"showBothside"
,
label
=
""
,
icon
=
icon
(
"columns"
)),
actionButton
(
"show
In
putside"
,
label
=
""
,
icon
=
icon
(
"
angle-double-right
"
)),
actionButton
(
"show
Out
putside"
,
label
=
""
,
icon
=
icon
(
"
chart-line
"
)
),
align
=
"center"
),
shiny
::
br
(),
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment