From b4e9b1ad8c0f0e51c305c7f2f415eae291a21d5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Laurent?= <francois.laurent@posteo.net> Date: Fri, 27 May 2022 18:15:11 +0200 Subject: [PATCH] all existing trx.mat tags are colored --- src/files.jl | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/src/files.jl b/src/files.jl index 80dc877..022ea3e 100644 --- a/src/files.jl +++ b/src/files.jl @@ -118,20 +118,42 @@ function tryopenfile(controller, path; reload::Bool=false) push!(tag_lut, ObservableTag(original; color=color, active=true)) end elseif hasproperty(records, :tags) + # trx.mat tags default_convention = Dict( - :small_motion => :grey50, - :stop_large => :green, - :run_large => :black, + :back_large => :cyan, :cast_large => :red, :hunch_large => :blue, - :back_large => :cyan, :roll_large => :yellow, + :run_large => :black, + :small_motion => :grey50, + :stop_large => :green, ) + related_tags = Dict( + :back => :back_large, + :back_weak => :back_large, + :back_strong => :back_large, + :cast => :cast_large, + :cast_weak => :cast_large, + :cast_strong => :cast_large, + :hunch => :hunch_large, + :hunch_weak => :hunch_large, + :hunch_strong => :hunch_large, + :roll => :roll_large, + :roll_weak => :roll_large, + :roll_strong => :roll_large, + :run => :run_large, + :run_weak => :run_large, + :run_strong => :run_large, + :stop => :stop_large, + :stop_weak => :stop_large, + :stop_strong => :stop_large, + ) fallback_color = theme[:LarvaPlot][:fallback_color] existingtags = records.tags for tag in existingtags active = tag in keys(default_convention) - color = active ? default_convention[tag] : fallback_color + tag′= active ? tag : get(related_tags, tag, tag) + color = get(default_convention, tag′, fallback_color) original = TagModel(tag) push!(tag_lut, ObservableTag(original; color=color, active=active)) end -- GitLab