From 6b6909144327ba2b1a94d88e40373c7cd79e0d33 Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Tue, 29 Apr 2025 10:16:42 +0800 Subject: [PATCH 1/6] Support filtering dotnet, python, node.js, executable plugins --- Flow.Launcher.Plugin/AllowedLanguage.cs | 49 ++++-- .../SettingsPanePluginStoreViewModel.cs | 95 +++++++++++- .../Views/SettingsPanePluginStore.xaml | 140 +++++++++++------- .../Views/SettingsPanePluginStore.xaml.cs | 10 +- 4 files changed, 226 insertions(+), 68 deletions(-) diff --git a/Flow.Launcher.Plugin/AllowedLanguage.cs b/Flow.Launcher.Plugin/AllowedLanguage.cs index 619a94deb..0d22756a7 100644 --- a/Flow.Launcher.Plugin/AllowedLanguage.cs +++ b/Flow.Launcher.Plugin/AllowedLanguage.cs @@ -65,7 +65,42 @@ namespace Flow.Launcher.Plugin public static bool IsDotNet(string language) { return language.Equals(CSharp, StringComparison.OrdinalIgnoreCase) - || language.Equals(FSharp, StringComparison.OrdinalIgnoreCase); + || language.Equals(FSharp, StringComparison.OrdinalIgnoreCase); + } + + /// + /// Determines if this language is a Python language + /// + /// + /// + public static bool IsPython(string language) + { + return language.Equals(Python, StringComparison.OrdinalIgnoreCase) + || language.Equals(PythonV2, StringComparison.OrdinalIgnoreCase); + } + + /// + /// Determines if this language is a Node.js language + /// + /// + /// + public static bool IsNodeJs(string language) + { + return language.Equals(TypeScript, StringComparison.OrdinalIgnoreCase) + || language.Equals(TypeScriptV2, StringComparison.OrdinalIgnoreCase) + || language.Equals(JavaScript, StringComparison.OrdinalIgnoreCase) + || language.Equals(JavaScriptV2, StringComparison.OrdinalIgnoreCase); + } + + /// + /// Determines if this language is a executable language + /// + /// + /// + public static bool IsExecutable(string language) + { + return language.Equals(Executable, StringComparison.OrdinalIgnoreCase) + || language.Equals(ExecutableV2, StringComparison.OrdinalIgnoreCase); } /// @@ -76,15 +111,9 @@ namespace Flow.Launcher.Plugin public static bool IsAllowed(string language) { return IsDotNet(language) - || language.Equals(Python, StringComparison.OrdinalIgnoreCase) - || language.Equals(PythonV2, StringComparison.OrdinalIgnoreCase) - || language.Equals(Executable, StringComparison.OrdinalIgnoreCase) - || language.Equals(TypeScript, StringComparison.OrdinalIgnoreCase) - || language.Equals(JavaScript, StringComparison.OrdinalIgnoreCase) - || language.Equals(ExecutableV2, StringComparison.OrdinalIgnoreCase) - || language.Equals(TypeScriptV2, StringComparison.OrdinalIgnoreCase) - || language.Equals(JavaScriptV2, StringComparison.OrdinalIgnoreCase); - ; + || IsPython(language) + || IsNodeJs(language) + || IsExecutable(language); } } } diff --git a/Flow.Launcher/SettingPages/ViewModels/SettingsPanePluginStoreViewModel.cs b/Flow.Launcher/SettingPages/ViewModels/SettingsPanePluginStoreViewModel.cs index 68c69f841..249e4dd42 100644 --- a/Flow.Launcher/SettingPages/ViewModels/SettingsPanePluginStoreViewModel.cs +++ b/Flow.Launcher/SettingPages/ViewModels/SettingsPanePluginStoreViewModel.cs @@ -9,7 +9,75 @@ namespace Flow.Launcher.SettingPages.ViewModels; public partial class SettingsPanePluginStoreViewModel : BaseModel { - public string FilterText { get; set; } = string.Empty; + private string filterText = string.Empty; + public string FilterText + { + get => filterText; + set + { + if (filterText != value) + { + filterText = value; + OnPropertyChanged(); + } + } + } + + private bool showDotNet = true; + public bool ShowDotNet + { + get => showDotNet; + set + { + if (showDotNet != value) + { + showDotNet = value; + OnPropertyChanged(); + } + } + } + + private bool showPython = true; + public bool ShowPython + { + get => showPython; + set + { + if (showPython != value) + { + showPython = value; + OnPropertyChanged(); + } + } + } + + private bool showNodeJs = true; + public bool ShowNodeJs + { + get => showNodeJs; + set + { + if (showNodeJs != value) + { + showNodeJs = value; + OnPropertyChanged(); + } + } + } + + private bool showExecutable = true; + public bool ShowExecutable + { + get => showExecutable; + set + { + if (showExecutable != value) + { + showExecutable = value; + OnPropertyChanged(); + } + } + } public IList ExternalPlugins => App.API.GetPluginManifest()?.Select(p => new PluginStoreItemViewModel(p)) @@ -30,8 +98,29 @@ public partial class SettingsPanePluginStoreViewModel : BaseModel public bool SatisfiesFilter(PluginStoreItemViewModel plugin) { + // Check plugin language + var pluginShown = false; + if (AllowedLanguage.IsDotNet(plugin.Language)) + { + pluginShown = ShowDotNet; + } + else if (AllowedLanguage.IsPython(plugin.Language)) + { + pluginShown = ShowPython; + } + else if (AllowedLanguage.IsNodeJs(plugin.Language)) + { + pluginShown = ShowNodeJs; + } + else if (AllowedLanguage.IsExecutable(plugin.Language)) + { + pluginShown = ShowExecutable; + } + if (!pluginShown) return false; + + // Check plugin name & description return string.IsNullOrEmpty(FilterText) || - App.API.FuzzySearch(FilterText, plugin.Name).IsSearchPrecisionScoreMet() || - App.API.FuzzySearch(FilterText, plugin.Description).IsSearchPrecisionScoreMet(); + App.API.FuzzySearch(FilterText, plugin.Name).IsSearchPrecisionScoreMet() || + App.API.FuzzySearch(FilterText, plugin.Description).IsSearchPrecisionScoreMet(); } } diff --git a/Flow.Launcher/SettingPages/Views/SettingsPanePluginStore.xaml b/Flow.Launcher/SettingPages/Views/SettingsPanePluginStore.xaml index 5f9e57faa..7867fa980 100644 --- a/Flow.Launcher/SettingPages/Views/SettingsPanePluginStore.xaml +++ b/Flow.Launcher/SettingPages/Views/SettingsPanePluginStore.xaml @@ -27,8 +27,8 @@ - - + + @@ -51,60 +51,94 @@ Grid.Column="1" Margin="5 24 0 0"> - - - - - - From 9b666d31363796bef10e8f031fe99b7d7e13ee73 Mon Sep 17 00:00:00 2001 From: DB p Date: Tue, 29 Apr 2025 20:06:46 +0900 Subject: [PATCH 4/6] Add Flyout UI for Filter --- .../Views/SettingsPanePluginStore.xaml | 55 +++++++++---------- 1 file changed, 27 insertions(+), 28 deletions(-) diff --git a/Flow.Launcher/SettingPages/Views/SettingsPanePluginStore.xaml b/Flow.Launcher/SettingPages/Views/SettingsPanePluginStore.xaml index 66c1cb1bf..fde022da7 100644 --- a/Flow.Launcher/SettingPages/Views/SettingsPanePluginStore.xaml +++ b/Flow.Launcher/SettingPages/Views/SettingsPanePluginStore.xaml @@ -65,34 +65,33 @@ Command="{Binding RefreshExternalPluginsCommand}" Content="{DynamicResource refresh}" FontSize="13" /> - - - - + Date: Tue, 29 Apr 2025 19:31:37 +0800 Subject: [PATCH 5/6] Adjust margin & Improve ui --- .../SettingPages/Views/SettingsPanePluginStore.xaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Flow.Launcher/SettingPages/Views/SettingsPanePluginStore.xaml b/Flow.Launcher/SettingPages/Views/SettingsPanePluginStore.xaml index fde022da7..df9cc3556 100644 --- a/Flow.Launcher/SettingPages/Views/SettingsPanePluginStore.xaml +++ b/Flow.Launcher/SettingPages/Views/SettingsPanePluginStore.xaml @@ -58,14 +58,14 @@ Orientation="Horizontal">