mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-01-18 14:41:21 +08:00
Make python plugins optional
This commit is contained in:
parent
46e0656fe9
commit
ef63f11bbb
@ -11,6 +11,12 @@ namespace Wox.Infrastructure.UserSettings
|
||||
public List<WebSearch> WebSearches { get; set; }
|
||||
public List<CustomPluginHotkey> CustomPluginHotkeys { get; set; }
|
||||
public bool StartWoxOnSystemStartup { get; set; }
|
||||
public bool EnablePythonPlugins { get; set; }
|
||||
|
||||
public UserSetting()
|
||||
{
|
||||
EnablePythonPlugins = false;
|
||||
}
|
||||
|
||||
public List<WebSearch> LoadDefaultWebSearches()
|
||||
{
|
||||
|
@ -5,6 +5,7 @@ using System.Text;
|
||||
using System.Threading;
|
||||
using Microsoft.CSharp;
|
||||
using Wox.Helper;
|
||||
using Wox.Infrastructure;
|
||||
using Wox.Plugin;
|
||||
|
||||
namespace Wox.PluginLoader
|
||||
@ -18,7 +19,11 @@ namespace Wox.PluginLoader
|
||||
plugins.Clear();
|
||||
BasePluginLoader.ParsePluginsConfig();
|
||||
|
||||
plugins.AddRange(new PythonPluginLoader().LoadPlugin());
|
||||
if (CommonStorage.Instance.UserSetting.EnablePythonPlugins)
|
||||
{
|
||||
plugins.AddRange(new PythonPluginLoader().LoadPlugin());
|
||||
}
|
||||
|
||||
plugins.AddRange(new CSharpPluginLoader().LoadPlugin());
|
||||
foreach (IPlugin plugin in plugins.Select(pluginPair => pluginPair.Plugin))
|
||||
{
|
||||
|
@ -23,9 +23,6 @@
|
||||
<TextBlock Text="Theme:" />
|
||||
<ComboBox x:Name="themeComboBox" SelectionChanged="ThemeComboBox_OnSelectionChanged" HorizontalAlignment="Left" VerticalAlignment="Top" Width="120"/>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal" Margin="10">
|
||||
<Button x:Name="btnEnableInstaller" Click="BtnEnableInstaller_OnClick">enable plugin installer</Button>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</TabItem>
|
||||
<TabItem Header="Hotkey">
|
||||
@ -107,5 +104,16 @@
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</TabItem>
|
||||
<TabItem Header="Plugins">
|
||||
<StackPanel Orientation="Vertical" Margin="10">
|
||||
<StackPanel Orientation="Horizontal" Margin="10">
|
||||
<CheckBox x:Name="cbEnablePythonPlugins" />
|
||||
<TextBlock Text="Enable Python Plugins" />
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal" Margin="10">
|
||||
<Button x:Name="btnEnableInstaller" Click="BtnEnableInstaller_OnClick">enable plugin installer</Button>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</TabItem>
|
||||
</TabControl>
|
||||
</Window>
|
||||
|
@ -46,6 +46,17 @@ namespace Wox
|
||||
CommonStorage.Instance.Save();
|
||||
};
|
||||
|
||||
cbEnablePythonPlugins.Checked += (o, e) =>
|
||||
{
|
||||
CommonStorage.Instance.UserSetting.EnablePythonPlugins = true;
|
||||
CommonStorage.Instance.Save();
|
||||
};
|
||||
cbEnablePythonPlugins.Unchecked += (o, e) =>
|
||||
{
|
||||
CommonStorage.Instance.UserSetting.EnablePythonPlugins = false;
|
||||
CommonStorage.Instance.Save();
|
||||
};
|
||||
|
||||
|
||||
foreach (string theme in LoadAvailableThemes())
|
||||
{
|
||||
@ -57,6 +68,7 @@ namespace Wox
|
||||
cbReplaceWinR.IsChecked = CommonStorage.Instance.UserSetting.ReplaceWinR;
|
||||
webSearchView.ItemsSource = CommonStorage.Instance.UserSetting.WebSearches;
|
||||
lvCustomHotkey.ItemsSource = CommonStorage.Instance.UserSetting.CustomPluginHotkeys;
|
||||
cbEnablePythonPlugins.IsChecked = CommonStorage.Instance.UserSetting.EnablePythonPlugins;
|
||||
cbStartWithWindows.IsChecked = File.Exists(woxLinkPath);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user