Skip to content
This repository has been archived by the owner on Jul 13, 2021. It is now read-only.

Commit

Permalink
Update Stepper documentation, allow custom format (#197)
Browse files Browse the repository at this point in the history
* Update Stepper documentation, allow custom format

* better variable setting 

if no opengl then minimal true

* add xorg-dev

* minimal package set for gitlab

* add missing signature for stepper

* fix method signature in constructor

* reactivate opengl checking
  • Loading branch information
asinghvi17 committed Sep 2, 2019
1 parent 4f2f18a commit c60db56
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 13 deletions.
5 changes: 1 addition & 4 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@ test:
before_script:
- apt-get -qq update
# glfw
- apt-get install -y cmake libxrandr-dev libxinerama-dev libxcursor-dev mesa-utils
# cairo etc
- apt-get install -y gettext libpango1.0-0 libcairo2 libmagickwand-6.q16
- apt-get install -y p7zip-full
- apt-get install -y cmake xorg-dev mesa-utils

script:
- mkdir $JULIA_DEPOT_PATH # Pkg.jl#325
Expand Down
17 changes: 13 additions & 4 deletions src/display.jl
Original file line number Diff line number Diff line change
Expand Up @@ -155,17 +155,26 @@ end


"""
Stepper for generating progressive plot examples.
Stepper(scene, path; format = :jpg)
Creates a Stepper for generating progressive plot examples.
Each "step" is saved as a separate file in the folder
pointed to by `path`, and the format is customizable by
`format`, which can be any output type your backend supports.
"""
mutable struct Stepper
scene::Scene
folder::String
format::Symbol
step::Int
end

function Stepper(scene, path)
Stepper(scene::Scene, path::String, step::Int; format=:jpg) = Stepper(scene, path, format, step)

function Stepper(scene::Scene, path::String; format = :jpg)
ispath(path) || mkpath(path)
Stepper(scene, path, 1)
Stepper(scene, path, format, 1)
end

format2mime(::Type{FileIO.format"PNG"}) = MIME"image/png"()
Expand Down Expand Up @@ -201,7 +210,7 @@ steps through a `Makie.Stepper` and outputs a file with filename `filename-step.
This is useful for generating progressive plot examples.
"""
function step!(s::Stepper)
FileIO.save(joinpath(s.folder, basename(s.folder) * "-$(s.step).jpg"), s.scene)
FileIO.save(joinpath(s.folder, basename(s.folder) * "-$(s.step).$(s.format)"), s.scene)
s.step += 1
return s
end
Expand Down
12 changes: 7 additions & 5 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,17 @@ using AbstractPlotting
using MakieGallery
using Test

const MINIMAL = get(ENV, "ABSTRACTPLOTTING_MINIMAL", "false")

# does this machine have a OPENGL?
const OPENGL = false#haskey(ENV, "OPENGL") || haskey(ENV, "GITLAB_CI") || try success(pipeline(`glxinfo`, `grep version`)) catch; false end # if it's Gitlab, it must be JuliaGPU
const OPENGL = haskey(ENV, "OPENGL") || haskey(ENV, "GITLAB_CI") || try success(pipeline(`glxinfo`, `grep version`)) catch; false end # if it's Gitlab, it must be JuliaGPU
OPENGL || (MINIMAL = "true")

@show OPENGL MINIMAL

OPENGL && begin @info "OpenGL detected"; using GLMakie end
OPENGL || @warn "No OpenGL detected! Software tests only."

# does this machine have FFMPEG? We'll take it on faith if you tell us...
const _MINIMAL = get(ENV, "ABSTRACTPLOTTING_MINIMAL", "false")

include("conversions.jl")
include("quaternions.jl")
include("projection_math.jl")
Expand All @@ -23,7 +25,7 @@ include("projection_math.jl")
end


if _MINIMAL == "false"
if MINIMAL == "false"

# Load all entries in the database

Expand Down

0 comments on commit c60db56

Please sign in to comment.