|
14 | 14 | #' @example incl/ascii_alert_handler.R |
15 | 15 | #' |
16 | 16 | #' @export |
17 | | -ascii_alert_handler <- function(symbol = "\a", file = stderr(), intrusiveness = getOption("progressr.intrusiveness.auditory", 5.0), ...) { |
| 17 | +ascii_alert_handler <- function(symbol = "\a", file = stderr(), intrusiveness = getOption("progressr.intrusiveness.auditory", 5.0), target = c("terminal", "audio"), ...) { |
18 | 18 | reporter <- local({ |
19 | 19 | list( |
20 | 20 | update = function(config, state, progression, ...) { |
@@ -44,7 +44,7 @@ ascii_alert_handler <- function(symbol = "\a", file = stderr(), intrusiveness = |
44 | 44 | #' |
45 | 45 | #' @importFrom utils file_test flush.console txtProgressBar setTxtProgressBar |
46 | 46 | #' @export |
47 | | -txtprogressbar_handler <- function(style = 3L, file = stderr(), intrusiveness = getOption("progressr.intrusiveness.terminal", 1), ...) { |
| 47 | +txtprogressbar_handler <- function(style = 3L, file = stderr(), intrusiveness = getOption("progressr.intrusiveness.terminal", 1), target = "terminal", ...) { |
48 | 48 | reporter <- local({ |
49 | 49 | ## Import functions |
50 | 50 | eraseTxtProgressBar <- function(pb) { |
@@ -123,7 +123,7 @@ txtprogressbar_handler <- function(style = 3L, file = stderr(), intrusiveness = |
123 | 123 | #' @example incl/tkprogressbar_handler.R |
124 | 124 | #' |
125 | 125 | #' @export |
126 | | -tkprogressbar_handler <- function(intrusiveness = getOption("progressr.intrusiveness.gui", 1), ...) { |
| 126 | +tkprogressbar_handler <- function(intrusiveness = getOption("progressr.intrusiveness.gui", 1), target = "terminal", ...) { |
127 | 127 | ## Used for package testing purposes only when we want to perform |
128 | 128 | ## everything except the last part where the backend is called |
129 | 129 | if (!is_fake("tkprogressbar_handler")) { |
@@ -190,7 +190,7 @@ tkprogressbar_handler <- function(intrusiveness = getOption("progressr.intrusive |
190 | 190 | #' @param \ldots Additional arguments passed to [make_progression_handler()]. |
191 | 191 | #' |
192 | 192 | #' @export |
193 | | -winprogressbar_handler <- function(intrusiveness = getOption("progressr.intrusiveness.gui", 1), ...) { |
| 193 | +winprogressbar_handler <- function(intrusiveness = getOption("progressr.intrusiveness.gui", 1), target = "gui", ...) { |
194 | 194 | ## Used for package testing purposes only when we want to perform |
195 | 195 | ## everything except the last part where the backend is called |
196 | 196 | if (!is_fake("winprogressbar_handler")) { |
@@ -268,7 +268,7 @@ winprogressbar_handler <- function(intrusiveness = getOption("progressr.intrusiv |
268 | 268 | #' |
269 | 269 | #' @importFrom utils file_test flush.console txtProgressBar setTxtProgressBar |
270 | 270 | #' @export |
271 | | -pbmcapply_handler <- function(substyle = 3L, style = "ETA", file = stderr(), intrusiveness = getOption("progressr.intrusiveness.terminal", 1), ...) { |
| 271 | +pbmcapply_handler <- function(substyle = 3L, style = "ETA", file = stderr(), intrusiveness = getOption("progressr.intrusiveness.terminal", 1), target = "terminal", ...) { |
272 | 272 | if (!is_fake("pbmcapply_handler")) { |
273 | 273 | progressBar <- pbmcapply::progressBar |
274 | 274 | eraseTxtProgressBar <- function(pb) { |
@@ -366,7 +366,7 @@ pbmcapply_handler <- function(substyle = 3L, style = "ETA", file = stderr(), int |
366 | 366 | #' @example incl/progress_handler.R |
367 | 367 | #' |
368 | 368 | #' @export |
369 | | -progress_handler <- function(format = "[:bar] :percent :message", show_after = 0.0, intrusiveness = getOption("progressr.intrusiveness.terminal", 1), ...) { |
| 369 | +progress_handler <- function(format = "[:bar] :percent :message", show_after = 0.0, intrusiveness = getOption("progressr.intrusiveness.terminal", 1), target = "terminal", ...) { |
370 | 370 | if (!is_fake("progress_handler")) { |
371 | 371 | progress_bar <- progress::progress_bar |
372 | 372 | } else { |
@@ -440,7 +440,7 @@ progress_handler <- function(format = "[:bar] :percent :message", show_after = 0 |
440 | 440 | #' @example incl/beepr_handler.R |
441 | 441 | #' |
442 | 442 | #' @export |
443 | | -beepr_handler <- function(initiate = 2L, update = 10L, finish = 11L, intrusiveness = getOption("progressr.intrusiveness.auditory", 5.0), ...) { |
| 443 | +beepr_handler <- function(initiate = 2L, update = 10L, finish = 11L, intrusiveness = getOption("progressr.intrusiveness.auditory", 5.0), target = "audio", ...) { |
444 | 444 | ## Used for package testing purposes only when we want to perform |
445 | 445 | ## everything except the last part where the backend is called |
446 | 446 | if (!is_fake("beepr_handler")) { |
@@ -491,7 +491,7 @@ beepr_handler <- function(initiate = 2L, update = 10L, finish = 11L, intrusiven |
491 | 491 | #' @example incl/notifier_handler.R |
492 | 492 | #' |
493 | 493 | #' @export |
494 | | -notifier_handler <- function(intrusiveness = getOption("progressr.intrusiveness.notifier", 10), ...) { |
| 494 | +notifier_handler <- function(intrusiveness = getOption("progressr.intrusiveness.notifier", 10), target = "gui", ...) { |
495 | 495 | ## Used for package testing purposes only when we want to perform |
496 | 496 | ## everything except the last part where the backend is called |
497 | 497 | if (!is_fake("notifier_handler")) { |
@@ -548,7 +548,7 @@ notifier_handler <- function(intrusiveness = getOption("progressr.intrusiveness. |
548 | 548 | #' @example incl/debug_handler.R |
549 | 549 | #' |
550 | 550 | #' @export |
551 | | -debug_handler <- function(interval = getOption("progressr.interval", 0), intrusiveness = getOption("progressr.intrusiveness.debug", 0), ...) { |
| 551 | +debug_handler <- function(interval = getOption("progressr.interval", 0), intrusiveness = getOption("progressr.intrusiveness.debug", 0), target = "terminal", ...) { |
552 | 552 | reporter <- local({ |
553 | 553 | t_init <- NULL |
554 | 554 |
|
@@ -599,7 +599,7 @@ debug_handler <- function(interval = getOption("progressr.interval", 0), intrusi |
599 | 599 | #' @param \ldots Additional arguments passed to [make_progression_handler()]. |
600 | 600 | #' |
601 | 601 | #' @export |
602 | | -newline_handler <- function(symbol = "\n", file = stderr(), intrusiveness = getOption("progressr.intrusiveness.debug", 0), ...) { |
| 602 | +newline_handler <- function(symbol = "\n", file = stderr(), intrusiveness = getOption("progressr.intrusiveness.debug", 0), target = "terminal", ...) { |
603 | 603 | reporter <- local({ |
604 | 604 | list( |
605 | 605 | initiate = function(...) cat(file = file, symbol), |
@@ -630,7 +630,7 @@ newline_handler <- function(symbol = "\n", file = stderr(), intrusiveness = getO |
630 | 630 | #' |
631 | 631 | #' @importFrom utils file_test |
632 | 632 | #' @export |
633 | | -filesize_handler <- function(file = "default.progress", intrusiveness = getOption("progressr.intrusiveness.file", 5), ...) { |
| 633 | +filesize_handler <- function(file = "default.progress", intrusiveness = getOption("progressr.intrusiveness.file", 5), target = "file", ...) { |
634 | 634 | reporter <- local({ |
635 | 635 | set_file_size <- function(config, state, progression) { |
636 | 636 | ratio <- state$step / config$max_steps |
@@ -696,7 +696,7 @@ filesize_handler <- function(file = "default.progress", intrusiveness = getOptio |
696 | 696 | #' }} |
697 | 697 | #' |
698 | 698 | #' @export |
699 | | -shiny_handler <- function(intrusiveness = getOption("progressr.intrusiveness.gui", 1), ...) { |
| 699 | +shiny_handler <- function(intrusiveness = getOption("progressr.intrusiveness.gui", 1), target = "gui", ...) { |
700 | 700 | reporter <- local({ |
701 | 701 | list( |
702 | 702 | update = function(config, state, progression, ...) { |
|
0 commit comments