Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

move new funcs #305

Merged
merged 2 commits into from
Mar 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ jobs:
version:
- '1.6'
- '1'
- '1.11-nightly'
- 'nightly'
os:
- ubuntu-latest
Expand Down
32 changes: 16 additions & 16 deletions src/ProgressMeter.jl
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,22 @@ ProgressMeter

abstract type AbstractProgress end

# forward common core properties to main types
function Base.setproperty!(p::T, name::Symbol, value) where T<:AbstractProgress
if hasfield(T, name)
setfield!(p, name, value)
else
setproperty!(p.core, name, value)
end
end
function Base.getproperty(p::T, name::Symbol) where T<:AbstractProgress
if hasfield(T, name)
getfield(p, name)
else
getproperty(p.core, name)
end
end

"""
Holds the five characters that will be used to generate the progress bar.
"""
Expand Down Expand Up @@ -98,21 +114,6 @@ mutable struct Progress <: AbstractProgress
new(n, start, barlen, barglyphs, core)
end
end
# forward common core properties to main types
function Base.setproperty!(p::T, name::Symbol, value) where T<:AbstractProgress
if hasfield(T, name)
setfield!(p, name, value)
else
setproperty!(p.core, name, value)
end
end
function Base.getproperty(p::T, name::Symbol) where T<:AbstractProgress
if hasfield(T, name)
getfield(p, name)
else
getproperty(p.core, name)
end
end

"""
`prog = ProgressThresh(thresh; dt=0.1, desc="Progress: ",
Expand Down Expand Up @@ -140,7 +141,6 @@ mutable struct ProgressThresh{T<:Real} <: AbstractProgress
end
ProgressThresh(thresh::Real; kwargs...) = ProgressThresh{typeof(thresh)}(thresh; kwargs...)


"""
`prog = ProgressUnknown(; dt=0.1, desc="Progress: ",
color=:green, output=stderr)` creates a progress meter for a task
Expand Down
Loading