Skip to content
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
7 changes: 4 additions & 3 deletions src/utils_GUI/GUI_utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,8 @@ function initialize_available_data!(gui)
structure = String(nameof(typeof(element)))
name = "$field_name"
key_str = "structures.$structure.$name"
add_description!(field, name, key_str, "", element, available_data, gui)
selection = Vector{Any}([element])
add_description!(field, name, key_str, "", selection, available_data, gui)
end
append!(get_available_data(gui)[element], available_data)
end
Expand Down Expand Up @@ -539,10 +540,10 @@ function update_descriptive_names!(gui::GUI)

# Search through EMX packages if icons are available there
for package ∈ emx_packages
package_path::Union{String,Nothing} = Base.find_package(package)
package_path::Union{String,Nothing} = dirname(dirname(Base.find_package(package)))
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The dirname(dirname()) approach seems a bit heavy, although it is pretty much the same as before. I know that pkgdir is directly providing the root folder, but it is only working on the module which we do not get here.

Note that this is just a comment.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, there was occations where the previous approach did not work. One could have used the abspath-function, but I thought this was better.

if !isnothing(package_path)
path_to_descriptive_names_ext = joinpath(
package_path, "..", "..", "ext", "EMGUIExt", "descriptive_names.yml",
package_path, "ext", "EMGUIExt", "descriptive_names.yml",
)
if isfile(path_to_descriptive_names_ext)
descriptive_names_dict_ext_file = YAML.load_file(
Expand Down
60 changes: 33 additions & 27 deletions src/utils_GUI/results_axis_utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ end
name::String,
key_str::String,
pre_desc::String,
element,
selection::Vector,
available_data::Vector{Dict},
gui::GUI,
)
Expand All @@ -39,14 +39,14 @@ function add_description!(
name::String,
key_str::String,
pre_desc::String,
element,
selection::Vector,
available_data::Vector{Dict},
gui::GUI,
)
container = Dict(
:name => name,
:is_jump_data => false,
:selection => [element],
:selection => selection,
:field_data => field,
:description => create_description(gui, key_str; pre_desc),
)
Expand All @@ -59,7 +59,7 @@ end
name::String,
key_str::String,
pre_desc::String,
element,
selection::Vector,
available_data::Vector{Dict},
gui::GUI,
)
Expand All @@ -72,15 +72,23 @@ function add_description!(
name::String,
key_str::String,
pre_desc::String,
element,
selection::Vector,
available_data::Vector{Dict},
gui::GUI,
)
for (dictname, dictvalue) ∈ field
name_field = "$name.$dictname"
key_str_field = "$key_str.$dictname"
name_field = "$name"
key_str_field = "$key_str"
ext_selection = deepcopy(selection)
if isa(dictname, Resource)
push!(ext_selection, dictname)
else
name_field *= ".$dictname"
key_str_field *= ".$dictname"
end
add_description!(
dictvalue, name_field, key_str_field, pre_desc, element, available_data, gui,
dictvalue, name_field, key_str_field, pre_desc, ext_selection, available_data,
gui,
)
end
end
Expand All @@ -91,7 +99,7 @@ end
name::String,
key_str::String,
pre_desc::String,
element,
selection::Vector,
available_data::Vector{Dict},
gui::GUI,
)
Expand All @@ -104,7 +112,7 @@ function add_description!(
name::String,
key_str::String,
pre_desc::String,
element,
selection::Vector,
available_data::Vector{Dict},
gui::GUI,
)
Expand All @@ -113,7 +121,7 @@ function add_description!(
name_field = "$name.$data_type"
key_str_field = "$key_str.$data_type"
add_description!(
data, name_field, key_str_field, pre_desc, element, available_data, gui,
data, name_field, key_str_field, pre_desc, selection, available_data, gui,
)
end
end
Expand All @@ -137,7 +145,7 @@ function add_description!(
name::String,
key_str::String,
pre_desc::String,
element,
selection::Vector,
available_data::Vector{Dict},
gui::GUI,
)
Expand All @@ -153,7 +161,7 @@ function add_description!(
pre_desc_sub = "$pre_desc$name_field_type: "
key_str = "structures.$name_field_type.$sub_field_name"
add_description!(
sub_field, name_field, key_str, pre_desc_sub, element, available_data, gui,
sub_field, name_field, key_str, pre_desc_sub, selection, available_data, gui,
)
end
end
Expand Down Expand Up @@ -305,22 +313,20 @@ function create_label(selection::Dict{Symbol,Any})
label *= selection[:name]
end
otherRes::Bool = false
if length(selection) > 1
for select ∈ selection[:selection]
if isa(select, Resource)
if !otherRes
label *= " ("
otherRes = true
end
label *= "$(select)"
if select != selection[:selection][end]
label *= ", "
end
for select ∈ selection[:selection]
if isa(select, Resource)
if !otherRes
label *= " ("
otherRes = true
end
label *= "$(select)"
if select != selection[:selection][end]
label *= ", "
end
end
if otherRes
label *= ")"
end
end
if otherRes
label *= ")"
end
return label
end
Expand Down
Loading