Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- pacletKeyOrdering =
- {
- "Name", "Version", "Creator",
- "Description", "Root", "WolframVersion",
- "MathematicaVersion", "Internal", "Loading",
- "Qualifier", "SystemID", "BuildNumber",
- "Tags", "Icon", "Categories",
- "Authors", "Extensions"
- };
- With[{keyOrdering = pacletKeyOrdering},
- pacletInfoAssociation[PacletManager`Paclet[k__]] :=
- KeySortBy[First@FirstPosition[keyOrdering, #] &]@
- With[
- {
- base =
- KeyMap[Replace[s_Symbol :> SymbolName[s]], <|k|>]
- },
- ReplacePart[base,
- "Extensions" ->
- AssociationThread[
- First /@ Lookup[base, "Extensions", {}],
- Association@*Rest /@ Lookup[base, "Extensions", {}]
- ]
- ]
- ]
- ];
- If[! AssociationQ@$pacletIconCache, $pacletIconCache = <||>];
- pacletGetIcon[a_Association] :=
- Replace[
- FileNames[
- Lookup[
- a,
- "Icon",
- "PacletIcon.m" | "PacletIcon.png"
- ],
- a["Location"]
- ],
- {
- {f_, ___} :>
- Lookup[$pacletIconCache, f, $pacletIconCache[f] = Import[f]],
- {} :>
- With[{f =
- "https://github.com/b3m2a1/mathematica-BTools/raw/master/
- Resources/Icons/PacletIcon.png"
- },
- Image[
- Lookup[$pacletIconCache, f, $pacletIconCache[f] = Import[f]],
- ImageSize -> 28
- ]
- ]
- }
- ];
- $formatPaclets = True;
- Format[p_PacletManager`Paclet /;
- ($formatPaclets && AssociationQ@
- pacletInfoAssociation[p])] :=
- With[{a = pacletInfoAssociation[p]},
- RawBoxes@
- BoxForm`ArrangeSummaryBox[
- "Paclet",
- p,
- pacletGetIcon[a],
- KeyValueMap[
- BoxForm`MakeSummaryItem[
- {Row[{#, ": "}], #2},
- StandardForm
- ] &,
- a[[{"Name", "Version"}]]
- ],
- Join[
- {
- If[KeyMemberQ[a, "Location"],
- BoxForm`MakeSummaryItem[
- {Row[{"Location", ": "}],
- With[{l = a["Location"]},
- Button[
- Hyperlink[l],
- SystemOpen[l],
- Appearance -> None,
- BaseStyle -> "Hyperlink"
- ]
- ]},
- StandardForm
- ],
- Nothing
- ]
- },
- KeyValueMap[
- BoxForm`MakeSummaryItem[
- {Row[{#, ": "}], #2},
- StandardForm
- ] &,
- KeyDrop[a, {"Name", "Version", "Location"}]
- ]
- ],
- StandardForm
- ]
- ];
- FormatValues[PacletManager`Paclet] =
- SortBy[
- FormatValues[PacletManager`Paclet],
- FreeQ[HoldPattern[$formatPaclets]]
- ];
- PacletFind /@ {"BTools", "ChemTools"} // Flatten
- PacletFind["MQTTLink"][[1]]
Add Comment
Please, Sign In to add comment