Skip to content

Commit 514af2e

Browse files
committed
- Add makie.jl to be used by Makie backends.
- For backwards compatibilty to ModiaResult, also accept ENV["MODIA_PLOT_PACKAGE"] instead of ENV["SignalTablesPlotPackage"] to define plot package - at all places (some parts have been missing).
1 parent 5f3b5b6 commit 514af2e

File tree

6 files changed

+402
-18
lines changed

6 files changed

+402
-18
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "SignalTables"
22
uuid = "3201582d-3078-4276-ba5d-0a1254d79d7c"
33
authors = ["Martin.Otter@dlr.de <Martin.Otter@dlr.de>"]
4-
version = "0.3.1"
4+
version = "0.3.2"
55

66
[deps]
77
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"

docs/src/index.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,13 @@ are different to the Python 2.x version.
183183

184184
## Release Notes
185185

186+
### version 0.3.2
187+
188+
- Add makie.jl to be used by Makie backends.
189+
- For backwards compatibilty to ModiaResult, also accept ENV["MODIA_PLOT_PACKAGE"] instead of ENV["SignalTablesPlotPackage"]
190+
to define plot package - at all places (some parts have been missing).
191+
192+
186193
### Version 0.3.1
187194

188195
- writeSignalTable(..): Do not store elements, that cannot be mapped to JSON + add _classVersion to signal table on file.

src/PlotPackageDefinition.jl

Lines changed: 37 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ macro usingPlotPackage()
4444
println("$expr")
4545
return esc( :(using $PlotPackage) )
4646
end
47-
47+
4848
else
4949
@info "No plot package activated. Using \"SilentNoPlot\"."
5050
@goto USE_NO_PLOT
@@ -91,23 +91,47 @@ end
9191
function usePlotPackage(plotPackage::String; pushPreviousOnStack=true)::Bool
9292
success = true
9393
if plotPackage == "NoPlot" || plotPackage == "SilentNoPlot"
94-
if pushPreviousOnStack && haskey(ENV, "SignalTablesPlotPackage")
95-
push!(PlotPackagesStack, ENV["SignalTablesPlotPackage"])
94+
newPlot = true
95+
if pushPreviousOnStack
96+
if haskey(ENV, "SignalTablesPlotPackage")
97+
push!(PlotPackagesStack, ENV["SignalTablesPlotPackage"])
98+
elseif haskey(ENV, "MODIA_PLOT_PACKAGE")
99+
push!(PlotPackagesStack, ENV["MODIA_PLOT_PACKAGE"])
100+
newPlot=false
101+
end
96102
end
97103
if plotPackage == "NoPlot"
98-
ENV["SignalTablesPlotPackage"] = "NoPlot"
104+
if newPlot
105+
ENV["SignalTablesPlotPackage"] = "NoPlot"
106+
else
107+
ENV["MODIA_PLOT_PACKAGE"] = "NoPlot"
108+
end
99109
else
100-
ENV["SignalTablesPlotPackage"] = "SilentNoPlot"
110+
if newPlot
111+
ENV["SignalTablesPlotPackage"] = "SilentNoPlot"
112+
else
113+
ENV["MODIA_PLOT_PACKAGE"] = "SilentNoPlot"
114+
end
101115
end
102116
else
103117
plotPackageName = "SignalTablesInterface_" * plotPackage
104118
if plotPackage in AvailablePlotPackages
105119
# Check that plotPackage is defined in current environment
106120
if isinstalled(plotPackageName)
107-
if pushPreviousOnStack && haskey(ENV, "SignalTablesPlotPackage")
108-
push!(PlotPackagesStack, ENV["SignalTablesPlotPackage"])
121+
newPlot = true
122+
if pushPreviousOnStack
123+
if haskey(ENV, "SignalTablesPlotPackage")
124+
push!(PlotPackagesStack, ENV["SignalTablesPlotPackage"])
125+
elseif haskey(ENV, "MODIA_PLOT_PACKAGE")
126+
push!(PlotPackagesStack, ENV["MODIA_PLOT_PACKAGE"])
127+
newPlot=false
128+
end
129+
end
130+
if newPlot
131+
ENV["SignalTablesPlotPackage"] = plotPackage
132+
else
133+
ENV["MODIA_PLOT_PACKAGE"] = plotPackage
109134
end
110-
ENV["SignalTablesPlotPackage"] = plotPackage
111135
else
112136
@warn "... usePlotPackage(\"$plotPackage\"): Call ignored, since package $plotPackageName is not in your current environment"
113137
success = false
@@ -132,9 +156,9 @@ function usePreviousPlotPackage()::Bool
132156
if length(PlotPackagesStack) > 0
133157
plotPackage = pop!(PlotPackagesStack)
134158
success = usePlotPackage(plotPackage, pushPreviousOnStack=false)
135-
else
136-
@warn "usePreviousPlotPackage(): Call ignored, because nothing saved."
137-
success = false
159+
#else
160+
# @warn "usePreviousPlotPackage(): Call ignored, because nothing saved."
161+
# success = false
138162
end
139163
return success
140164
end
@@ -148,7 +172,5 @@ defined with [`usePlotPackage`](@ref).
148172
For example, the function may return "GLMakie", "PyPlot" or "NoPlot" or
149173
or "", if no PlotPackage is defined.
150174
"""
151-
currentPlotPackage() = haskey(ENV, "SignalTablesPlotPackage") ? ENV["SignalTablesPlotPackage"] : ""
152-
153-
154-
175+
currentPlotPackage() = haskey(ENV, "SignalTablesPlotPackage") ? ENV["SignalTablesPlotPackage"] :
176+
(haskey(ENV, "MODIA_PLOT_PACKAGE") ? ENV["MODIA_PLOT_PACKAGE"] : "" )

src/SignalTableFunctions.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -676,7 +676,7 @@ the corresponding signals are encoded.
676676
function encodeSignalTable(signalTable; signalNames=nothing)
677677
if isSignalTable(signalTable)
678678
jdict = OrderedDict{String,Any}("_class" => "SignalTable",
679-
"_classVersion" => version)
679+
"_classVersion" => version_SignalTable_JSON)
680680
if isnothing(signalNames)
681681
signalNames = getSignalNames(signalTable)
682682
end

src/SignalTables.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
module SignalTables
22

33
const path = dirname(dirname(@__FILE__))
4-
const version = "0.3.1" # version tag of SignalTables release without "v"
4+
const version = "0.3.2"
5+
const version_SignalTable_JSON = "0.3.1" # version tag to be stored in JSON files
56

67
using OrderedCollections
78
using Unitful

0 commit comments

Comments
 (0)