From 46e0656fe91bcb2609ce9f2433e84aaf1a47bbee Mon Sep 17 00:00:00 2001 From: Roy van Kaathoven Date: Tue, 18 Mar 2014 18:20:51 +0100 Subject: [PATCH 1/2] Save StartWoxOnSystemStartup setting --- Wox/SettingWindow.xaml.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Wox/SettingWindow.xaml.cs b/Wox/SettingWindow.xaml.cs index 79a7778fc8..0dab8ffd9f 100644 --- a/Wox/SettingWindow.xaml.cs +++ b/Wox/SettingWindow.xaml.cs @@ -46,6 +46,7 @@ namespace Wox CommonStorage.Instance.Save(); }; + foreach (string theme in LoadAvailableThemes()) { string themeName = theme.Substring(theme.LastIndexOf('\\') + 1).Replace(".xaml", ""); @@ -118,6 +119,8 @@ namespace Wox private void CbStartWithWindows_OnChecked(object sender, RoutedEventArgs e) { CreateStartupFolderShortcut(); + CommonStorage.Instance.UserSetting.StartWoxOnSystemStartup = true; + CommonStorage.Instance.Save(); } private void CbStartWithWindows_OnUnchecked(object sender, RoutedEventArgs e) @@ -126,6 +129,9 @@ namespace Wox { File.Delete(woxLinkPath); } + + CommonStorage.Instance.UserSetting.StartWoxOnSystemStartup = false; + CommonStorage.Instance.Save(); } private void CreateStartupFolderShortcut() From ef63f11bbbc4f471ca1686542c5518652a92e186 Mon Sep 17 00:00:00 2001 From: Roy van Kaathoven Date: Tue, 18 Mar 2014 18:27:59 +0100 Subject: [PATCH 2/2] Make python plugins optional --- Wox.Infrastructure/UserSettings/UserSetting.cs | 6 ++++++ Wox/PluginLoader/Plugins.cs | 7 ++++++- Wox/SettingWindow.xaml | 14 +++++++++++--- Wox/SettingWindow.xaml.cs | 12 ++++++++++++ 4 files changed, 35 insertions(+), 4 deletions(-) diff --git a/Wox.Infrastructure/UserSettings/UserSetting.cs b/Wox.Infrastructure/UserSettings/UserSetting.cs index c2309bae82..f132d34ad0 100644 --- a/Wox.Infrastructure/UserSettings/UserSetting.cs +++ b/Wox.Infrastructure/UserSettings/UserSetting.cs @@ -11,6 +11,12 @@ namespace Wox.Infrastructure.UserSettings public List WebSearches { get; set; } public List CustomPluginHotkeys { get; set; } public bool StartWoxOnSystemStartup { get; set; } + public bool EnablePythonPlugins { get; set; } + + public UserSetting() + { + EnablePythonPlugins = false; + } public List LoadDefaultWebSearches() { diff --git a/Wox/PluginLoader/Plugins.cs b/Wox/PluginLoader/Plugins.cs index 41d7033261..d1fe4b118d 100644 --- a/Wox/PluginLoader/Plugins.cs +++ b/Wox/PluginLoader/Plugins.cs @@ -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)) { diff --git a/Wox/SettingWindow.xaml b/Wox/SettingWindow.xaml index 442f34085f..41fdbe14a2 100644 --- a/Wox/SettingWindow.xaml +++ b/Wox/SettingWindow.xaml @@ -23,9 +23,6 @@ - - - @@ -107,5 +104,16 @@ + + + + + + + + + + + diff --git a/Wox/SettingWindow.xaml.cs b/Wox/SettingWindow.xaml.cs index 0dab8ffd9f..1bdb638bdd 100644 --- a/Wox/SettingWindow.xaml.cs +++ b/Wox/SettingWindow.xaml.cs @@ -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); }