Reveal model folder in Finder

main
Pedro Cuenca 2 years ago
parent ed15f78628
commit d78d430065

@ -88,6 +88,8 @@ struct ControlsView: View {
}
func modelDidChange(model: ModelInfo) {
guard pipelineLoader?.model != model else { return }
print("Loading model \(model)")
Settings.shared.currentModel = model
@ -144,13 +146,21 @@ struct ControlsView: View {
ScrollView {
Group {
DisclosureGroup(isExpanded: $disclosedModel) {
let revealOption = "-- reveal --"
Picker("", selection: $model) {
ForEach(Self.models, id: \.modelVersion) {
modelLabel($0)
}
Text("Reveal in Finder…").tag(revealOption)
}
.onChange(of: model) { selection in
guard selection != revealOption else {
let selected = pipelineLoader?.compiledPath
NSWorkspace.shared.selectFile(selected?.string, inFileViewerRootedAtPath: PipelineLoader.models.string)
model = Settings.shared.currentModel.modelVersion
return
}
.onChange(of: model) { theModel in
guard let model = ModelInfo.from(modelVersion: theModel) else { return }
guard let model = ModelInfo.from(modelVersion: selection) else { return }
modelDidChange(model: model)
}
} label: {

Loading…
Cancel
Save