Replies: 5 comments 10 replies
-
Thanks for opening the first discussion! This would be very good indeed, added to the list. You can almost get something like this done with the current code if you need it urgently" # create custom columns layout
import Term.progress: DescriptionColumn, ElapsedColumn, AbstractColumn, ProgressBar, update, start, stop
import Term
# define a new column type
struct CountsColumn <: AbstractColumn
segments::Vector
measure::Measure
style::String
end
# constructor
CountsColumn(style::String) = CountsColumn([], Measure(10, 1), style)
# update method
update(col::CountsColumn, i::Int, args...)::String = apply_style("[$(col.style)]$i iterations[/$(col.style)]")
columns = [
DescriptionColumn("[green bold]Job running[/green bold]"),
CountsColumn("blue"),
ElapsedColumn(),
]
# create iterable
mutable struct MyItr
count
end
Base.iterate(mi::MyItr, state=mi.count) = state == 0 ? nothing : (state, state-1)
# ----------------------------- run progress bar ----------------------------- #
pbar = ProgressBar(; N=1000, columns=columns) # set to very high value so that it gets ignored
start(pbar)
for i in MyItr(100)
update(pbar)
sleep(0.1)
end
stop(pbar) The problem is that I can add it soon, but feel free to send a PR if you'd like! |
Beta Was this translation helpful? Give feedback.
-
Working on it, keep an eye here #62 |
Beta Was this translation helpful? Give feedback.
-
It will come with: #62 Usage: pbar = ProgressBar(; columns=:spinner) to use these preset columns. If you don't pass The spinner visualization is handled by a new Hope you'll like it! |
Beta Was this translation helpful? Give feedback.
-
I'd like to see the spinner change to a check mark when it is done. I'm also wondering how you got your previous spinners to stop. My first spinner restarts when I start the second one. function f()
with(progressbar) do
readjob = addjob!(progressbar, description = "Reading Input File")
start!(readjob)
sleep(5)
stop!(readjob)
transformjob = addjob!(progressbar, description = "Transforming Tables")
start!(transformjob)
sleep(5)
stop!(transformjob)
end
end
progressbar = ProgressBar(; columns=:minimal, columns_kwargs = Dict(:SpinnerColumn => Dict(:spinnertype => :circle)))
f() |
Beta Was this translation helpful? Give feedback.
-
From the next release, calling Thanks for the suggestion @nathanrboyer |
Beta Was this translation helpful? Give feedback.
-
I'm really enjoying getting to know Term.jl, and the docs are great! One thing that I'm missing is a progress bar for an iterator or loop with unknown length. Clearly, you could not have a percent or fraction, but something like a spinning ball + a counter for the number of iterations that have passed or time elapse would be really useful.
You can see
ProgressMeter.jl
for inspiration.Beta Was this translation helpful? Give feedback.
All reactions