Skip to content

Commit 4297473

Browse files
committed
Change from reading installed packages to loaded packages
1 parent bf8ea91 commit 4297473

2 files changed

Lines changed: 10 additions & 4 deletions

File tree

src/utils_GUI/GUI_utils.jl

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -625,12 +625,11 @@ function update_descriptive_names!(gui::GUI)
625625
joinpath(@__DIR__, "..", "descriptive_names.yml"); dicttype = Dict{Symbol,Any},
626626
)
627627

628-
# Get a dictionary of installed packages
629-
installed_packages = installed()
628+
# Get a dictionary of loaded packages
629+
loaded_packages = loaded()
630630

631631
# Filter packages with names matching the pattern "EnergyModels*"
632-
emx_packages = filter(pkg -> occursin(r"EnergyModels", pkg), keys(installed_packages))
633-
632+
emx_packages = filter(pkg -> occursin(r"EnergyModels", pkg), loaded_packages)
634633
# apply inheritances for fetching descriptive names
635634
# create a dictionary were the keys are all the types defined in emx_packages and the values are the types they inherit from
636635
emx_supertypes_dict = get_supertypes(emx_packages)

src/utils_gen/structures_utils.jl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,13 @@ function installed()
1414
return installs
1515
end
1616

17+
"""
18+
function loaded()
19+
20+
Get a list of loaded packages.
21+
"""
22+
loaded() = filter((x) -> typeof(eval(x)) <: Module, names(Main,imported=true))
23+
1724
"""
1825
place_nodes_in_circle(total_nodes::Int64, current_node::Int64, r::Float32, xₒ::Float32, yₒ::Float32)
1926

0 commit comments

Comments
 (0)