diff --git a/Plugins/HelloWorldPython/Images/app.png b/Plugins/HelloWorldPython/Images/app.png new file mode 100644 index 0000000000..8c9ca7971a Binary files /dev/null and b/Plugins/HelloWorldPython/Images/app.png differ diff --git a/Plugins/HelloWorldPython/main.py b/Plugins/HelloWorldPython/main.py new file mode 100644 index 0000000000..e2f54050a7 --- /dev/null +++ b/Plugins/HelloWorldPython/main.py @@ -0,0 +1,17 @@ +# -*- coding: utf-8 -*- + +from wox import Wox + +class HelloWorld(Wox): + + def query(self, query): + results = [] + results.append({ + "Title": "Hello World", + "SubTitle": "Query: {}".format(query), + "IcoPath":"Images/app.ico" + }) + return results + +if __name__ == "__main__": + HelloWorld() \ No newline at end of file diff --git a/Plugins/HelloWorldPython/plugin.json b/Plugins/HelloWorldPython/plugin.json new file mode 100644 index 0000000000..889f3c8848 --- /dev/null +++ b/Plugins/HelloWorldPython/plugin.json @@ -0,0 +1,12 @@ +{ + "ID":"2f4e384e-76ce-45c3-aea2-b16f5e5c328f", + "ActionKeyword":"h", + "Name":"Hello World Python", + "Description":"Hello World", + "Author":"happlebao", + "Version":"1.0", + "Language":"python", + "Website":"https://github.com/Wox-launche/Wox", + "IcoPath":"Images\\app.png", + "ExecuteFileName":"main.py" +} diff --git a/Plugins/HelloWorldPython/wox.py b/Plugins/HelloWorldPython/wox.py new file mode 100644 index 0000000000..084eac8eb2 --- /dev/null +++ b/Plugins/HelloWorldPython/wox.py @@ -0,0 +1,107 @@ +# -*- coding: utf-8 -*- +from __future__ import print_function +import json +import sys +import inspect + +class Wox(object): + """ + Wox python plugin base + """ + + def __init__(self): + rpc_request = json.loads(sys.argv[1]) + self.proxy = rpc_request.get("proxy",{}) + request_method_name = rpc_request.get("method") + request_parameters = rpc_request.get("parameters") + methods = inspect.getmembers(self, predicate=inspect.ismethod) + + request_method = dict(methods)[request_method_name] + results = request_method(*request_parameters) + if request_method_name == "query": + print(json.dumps({"result": results})) + + def query(self,query): + """ + sub class need to override this method + """ + return [] + + def debug(self,msg): + """ + alert msg + """ + print("DEBUG:{}".format(msg)) + sys.exit() + +class WoxAPI(object): + + @classmethod + def change_query(cls,query,requery = False): + """ + change wox query + """ + print(json.dumps({"method": "Wox.ChangeQuery","parameters":[query,requery]})) + + @classmethod + def shell_run(cls,cmd): + """ + run shell commands + """ + print(json.dumps({"method": "Wox.ShellRun","parameters":[cmd]})) + + @classmethod + def close_app(cls): + """ + close wox + """ + print(json.dumps({"method": "Wox.CloseApp","parameters":[]})) + + @classmethod + def hide_app(cls): + """ + hide wox + """ + print(json.dumps({"method": "Wox.HideApp","parameters":[]})) + + @classmethod + def show_app(cls): + """ + show wox + """ + print(json.dumps({"method": "Wox.ShowApp","parameters":[]})) + + @classmethod + def show_msg(cls,title,sub_title,ico_path=""): + """ + show messagebox + """ + print(json.dumps({"method": "Wox.ShowMsg","parameters":[title,sub_title,ico_path]})) + + @classmethod + def open_setting_dialog(cls): + """ + open setting dialog + """ + print(json.dumps({"method": "Wox.OpenSettingDialog","parameters":[]})) + + @classmethod + def start_loadingbar(cls): + """ + start loading animation in wox + """ + print(json.dumps({"method": "Wox.StartLoadingBar","parameters":[]})) + + @classmethod + def stop_loadingbar(cls): + """ + stop loading animation in wox + """ + print(json.dumps({"method": "Wox.StopLoadingBar","parameters":[]})) + + @classmethod + def reload_plugins(cls): + """ + reload all wox plugins + """ + print(json.dumps({"method": "Wox.ReloadPlugins","parameters":[]})) diff --git a/PythonHome/wox.py b/PythonHome/wox.py index f31a5f072d..084eac8eb2 100644 --- a/PythonHome/wox.py +++ b/PythonHome/wox.py @@ -1,8 +1,8 @@ -#encoding=utf8 +# -*- coding: utf-8 -*- +from __future__ import print_function import json import sys import inspect -import chardet class Wox(object): """ @@ -10,7 +10,7 @@ class Wox(object): """ def __init__(self): - rpc_request = json.loads(sys.argv[1],encoding=chardet.detect(sys.argv[1])["encoding"]) + rpc_request = json.loads(sys.argv[1]) self.proxy = rpc_request.get("proxy",{}) request_method_name = rpc_request.get("method") request_parameters = rpc_request.get("parameters") @@ -19,7 +19,7 @@ class Wox(object): request_method = dict(methods)[request_method_name] results = request_method(*request_parameters) if request_method_name == "query": - print json.dumps({"result": results}) + print(json.dumps({"result": results})) def query(self,query): """ @@ -31,7 +31,7 @@ class Wox(object): """ alert msg """ - print "DEBUG:{}".format(msg) + print("DEBUG:{}".format(msg)) sys.exit() class WoxAPI(object): @@ -41,67 +41,67 @@ class WoxAPI(object): """ change wox query """ - print json.dumps({"method": "Wox.ChangeQuery","parameters":[query,requery]}) + print(json.dumps({"method": "Wox.ChangeQuery","parameters":[query,requery]})) @classmethod def shell_run(cls,cmd): """ run shell commands """ - print json.dumps({"method": "Wox.ShellRun","parameters":[cmd]}) + print(json.dumps({"method": "Wox.ShellRun","parameters":[cmd]})) @classmethod def close_app(cls): """ close wox """ - print json.dumps({"method": "Wox.CloseApp","parameters":[]}) + print(json.dumps({"method": "Wox.CloseApp","parameters":[]})) @classmethod def hide_app(cls): """ hide wox """ - print json.dumps({"method": "Wox.HideApp","parameters":[]}) + print(json.dumps({"method": "Wox.HideApp","parameters":[]})) @classmethod def show_app(cls): """ show wox """ - print json.dumps({"method": "Wox.ShowApp","parameters":[]}) + print(json.dumps({"method": "Wox.ShowApp","parameters":[]})) @classmethod def show_msg(cls,title,sub_title,ico_path=""): """ show messagebox """ - print json.dumps({"method": "Wox.ShowMsg","parameters":[title,sub_title,ico_path]}) + print(json.dumps({"method": "Wox.ShowMsg","parameters":[title,sub_title,ico_path]})) @classmethod def open_setting_dialog(cls): """ open setting dialog """ - print json.dumps({"method": "Wox.OpenSettingDialog","parameters":[]}) + print(json.dumps({"method": "Wox.OpenSettingDialog","parameters":[]})) @classmethod def start_loadingbar(cls): """ start loading animation in wox """ - print json.dumps({"method": "Wox.StartLoadingBar","parameters":[]}) + print(json.dumps({"method": "Wox.StartLoadingBar","parameters":[]})) @classmethod def stop_loadingbar(cls): """ stop loading animation in wox """ - print json.dumps({"method": "Wox.StopLoadingBar","parameters":[]}) + print(json.dumps({"method": "Wox.StopLoadingBar","parameters":[]})) @classmethod def reload_plugins(cls): """ reload all wox plugins """ - print json.dumps({"method": "Wox.ReloadPlugins","parameters":[]}) + print(json.dumps({"method": "Wox.ReloadPlugins","parameters":[]})) diff --git a/Wox.Core/Plugin/CSharpPluginLoader.cs b/Wox.Core/Plugin/CSharpPluginLoader.cs index 7fb02fbd1d..e46b468c0e 100644 --- a/Wox.Core/Plugin/CSharpPluginLoader.cs +++ b/Wox.Core/Plugin/CSharpPluginLoader.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.IO; using System.Linq; using System.Reflection; using Wox.Infrastructure.Exception; @@ -8,42 +9,105 @@ using Wox.Plugin; namespace Wox.Core.Plugin { - internal class CSharpPluginLoader : IPluginLoader + public static class PluginsLoader { - public IEnumerable LoadPlugin(List pluginMetadatas) + public const string PATH = "PATH"; + public const string Python = "python"; + public const string PythonExecutable = "pythonw.exe"; + + public static IEnumerable CSharpPlugins(IEnumerable source) { var plugins = new List(); - List CSharpPluginMetadatas = pluginMetadatas.Where(o => o.Language.ToUpper() == AllowedLanguage.CSharp.ToUpper()).ToList(); + var metadatas = source.Where(o => o.Language.ToUpper() == AllowedLanguage.CSharp); - foreach (PluginMetadata metadata in CSharpPluginMetadatas) + foreach (var metadata in metadatas) { + Assembly assembly; try { - Assembly asm = Assembly.Load(AssemblyName.GetAssemblyName(metadata.ExecuteFilePath)); - List types = asm.GetTypes().Where(o => o.IsClass && !o.IsAbstract && o.GetInterfaces().Contains(typeof(IPlugin))).ToList(); - if (types.Count == 0) - { - Log.Warn($"Couldn't load plugin {metadata.Name}: didn't find the class that implement IPlugin"); - continue; - } - - foreach (Type type in types) - { - PluginPair pair = new PluginPair - { - Plugin = Activator.CreateInstance(type) as IPlugin, - Metadata = metadata - }; - - plugins.Add(pair); - } + assembly = Assembly.Load(AssemblyName.GetAssemblyName(metadata.ExecuteFilePath)); } catch (Exception e) { - Log.Error(new WoxPluginException(metadata.Name, $"Couldn't load plugin", e)); + Log.Error(new WoxPluginException(metadata.Name, "Couldn't load assembly", e)); + continue; + } + var types = assembly.GetTypes(); + Type type; + try + { + type = types.First(o => o.IsClass && !o.IsAbstract && o.GetInterfaces().Contains(typeof(IPlugin))); + } + catch (InvalidOperationException e) + { + Log.Error(new WoxPluginException(metadata.Name, "Can't find class implement IPlugin", e)); + continue; + } + IPlugin plugin; + try + { + plugin = (IPlugin)Activator.CreateInstance(type); + } + catch (Exception e) + { + Log.Error(new WoxPluginException(metadata.Name, "Can't create instance", e)); + continue; + } + PluginPair pair = new PluginPair + { + Plugin = plugin, + Metadata = metadata + }; + plugins.Add(pair); + } + return plugins; + } + + public static IEnumerable PythonPlugins(IEnumerable source, string pythonDirecotry) + { + var metadatas = source.Where(o => o.Language.ToUpper() == AllowedLanguage.Python); + string filename; + + if (string.IsNullOrEmpty(pythonDirecotry)) + { + var paths = Environment.GetEnvironmentVariable(PATH); + if (paths != null) + { + var pythonPaths = paths.Split(';').Where(p => p.ToLower().Contains(Python)); + if (pythonPaths.Any()) + { + filename = PythonExecutable; + } + else + { + Log.Error(new WoxException("Python can't be found in PATH.")); + return new List(); + } + } + else + { + Log.Error(new WoxException("Path variable is not set.")); + return new List(); } } - + else + { + var path = Path.Combine(pythonDirecotry, PythonExecutable); + if (File.Exists(path)) + { + filename = path; + } + else + { + Log.Error(new WoxException("Can't find python executable in python directory")); + return new List(); + } + } + var plugins = metadatas.Select(metadata => new PluginPair + { + Plugin = new PythonPlugin(filename), + Metadata = metadata + }); return plugins; } } diff --git a/Wox.Core/Plugin/IPluginLoader.cs b/Wox.Core/Plugin/IPluginLoader.cs deleted file mode 100644 index a85e7e361e..0000000000 --- a/Wox.Core/Plugin/IPluginLoader.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System.Collections.Generic; -using Wox.Plugin; - -namespace Wox.Core.Plugin -{ - internal interface IPluginLoader - { - IEnumerable LoadPlugin(List pluginMetadatas); - } -} diff --git a/Wox.Core/Plugin/JsonRPCPlugin.cs b/Wox.Core/Plugin/JsonRPCPlugin.cs index c0654336d7..16e39c1a5a 100644 --- a/Wox.Core/Plugin/JsonRPCPlugin.cs +++ b/Wox.Core/Plugin/JsonRPCPlugin.cs @@ -14,6 +14,7 @@ namespace Wox.Core.Plugin { /// /// Represent the plugin that using JsonPRC + /// every JsonRPC plugin should has its own plugin instance /// internal abstract class JsonRPCPlugin : IPlugin { @@ -22,7 +23,7 @@ namespace Wox.Core.Plugin /// /// The language this JsonRPCPlugin support /// - public abstract string SupportedLanguage { get; } + public abstract string SupportedLanguage { get; set; } protected abstract string ExecuteQuery(Query query); protected abstract string ExecuteCallback(JsonRPCRequestModel rpcRequest); @@ -30,7 +31,7 @@ namespace Wox.Core.Plugin public List Query(Query query) { string output = ExecuteQuery(query); - if (!string.IsNullOrEmpty(output)) + if (!String.IsNullOrEmpty(output)) { try { @@ -46,7 +47,7 @@ namespace Wox.Core.Plugin { if (result1.JsonRPCAction == null) return false; - if (!string.IsNullOrEmpty(result1.JsonRPCAction.Method)) + if (!String.IsNullOrEmpty(result1.JsonRPCAction.Method)) { if (result1.JsonRPCAction.Method.StartsWith("Wox.")) { @@ -59,7 +60,7 @@ namespace Wox.Core.Plugin string actionReponse = ExecuteCallback(result1.JsonRPCAction); JsonRPCRequestModel jsonRpcRequestModel = JsonConvert.DeserializeObject(actionReponse); if (jsonRpcRequestModel != null - && !string.IsNullOrEmpty(jsonRpcRequestModel.Method) + && !String.IsNullOrEmpty(jsonRpcRequestModel.Method) && jsonRpcRequestModel.Method.StartsWith("Wox.")) { ExecuteWoxAPI(jsonRpcRequestModel.Method.Substring(4), jsonRpcRequestModel.Parameters); @@ -125,7 +126,7 @@ namespace Wox.Core.Plugin { using (Process process = Process.Start(startInfo)) { - if (process != null) + if (process != null) { using (StreamReader reader = process.StandardOutput) { @@ -135,12 +136,12 @@ namespace Wox.Core.Plugin MessageBox.Show(new Form { TopMost = true }, result.Substring(6)); return ""; } - if (string.IsNullOrEmpty(result)) + if (String.IsNullOrEmpty(result)) { using (StreamReader errorReader = process.StandardError) { string error = errorReader.ReadToEnd(); - if (!string.IsNullOrEmpty(error)) + if (!String.IsNullOrEmpty(error)) { throw new WoxJsonRPCException(error); } diff --git a/Wox.Core/Plugin/JsonRPCPluginLoader.cs b/Wox.Core/Plugin/JsonRPCPluginLoader.cs deleted file mode 100644 index eb88356719..0000000000 --- a/Wox.Core/Plugin/JsonRPCPluginLoader.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System.Collections.Generic; -using System.Linq; -using Wox.Plugin; - -namespace Wox.Core.Plugin -{ - internal class JsonRPCPluginLoader : IPluginLoader where T : JsonRPCPlugin, new() - { - public IEnumerable LoadPlugin(List pluginMetadatas) - { - T jsonRPCPlugin = new T(); - List jsonRPCPluginMetadatas = pluginMetadatas.Where(o => o.Language.ToUpper() == jsonRPCPlugin.SupportedLanguage.ToUpper()).ToList(); - - return jsonRPCPluginMetadatas.Select(metadata => new PluginPair - { - Plugin = new T(), //every JsonRPC plugin should has its own plugin instance - Metadata = metadata - }).ToList(); - } - } -} diff --git a/Wox.Core/Plugin/PluginManager.cs b/Wox.Core/Plugin/PluginManager.cs index b0cd7cfd97..7f32819dce 100644 --- a/Wox.Core/Plugin/PluginManager.cs +++ b/Wox.Core/Plugin/PluginManager.cs @@ -25,13 +25,11 @@ namespace Wox.Core.Plugin /// public static List AllPlugins { get; private set; } - public static readonly List GlobalPlugins = new List(); - public static readonly Dictionary NonGlobalPlugins = new Dictionary(); - private static IEnumerable InstantQueryPlugins { get; set; } public static IPublicAPI API { private set; get; } + private static PluginsSettings _settings; private static readonly string[] Directories = {Infrastructure.Wox.PreinstalledDirectory, Infrastructure.Wox.UserDirectory }; @@ -57,12 +55,15 @@ namespace Wox.Core.Plugin } } - public static void InitializePlugins(IPublicAPI api) + public static void InitializePlugins(IPublicAPI api, PluginsSettings settings) { + _settings = settings; + var metadatas = PluginConfig.Parse(Directories); - var plugins1 = new CSharpPluginLoader().LoadPlugin(metadatas); - var plugins2 = new JsonRPCPluginLoader().LoadPlugin(metadatas); + var plugins1 = PluginsLoader.CSharpPlugins(metadatas); + var plugins2 = PluginsLoader.PythonPlugins(metadatas, _settings.PythonDirectory); AllPlugins = plugins1.Concat(plugins2).ToList(); + _settings.UpdatePluginSettings(AllPlugins); //load plugin i18n languages ResourceMerger.UpdatePluginLanguages(); diff --git a/Wox.Core/Plugin/PythonPlugin.cs b/Wox.Core/Plugin/PythonPlugin.cs index fc74a1d7ab..7022512aee 100644 --- a/Wox.Core/Plugin/PythonPlugin.cs +++ b/Wox.Core/Plugin/PythonPlugin.cs @@ -1,37 +1,25 @@ -using System.Diagnostics; -using System.IO; +using System; +using System.Diagnostics; using Wox.Core.UserSettings; -using Wox.Infrastructure; using Wox.Plugin; namespace Wox.Core.Plugin { internal class PythonPlugin : JsonRPCPlugin { - private static readonly string PythonHome = Path.Combine(Infrastructure.Wox.ProgramPath, "PythonHome"); private readonly ProcessStartInfo _startInfo; + public override string SupportedLanguage { get; set; } = AllowedLanguage.Python; - public override string SupportedLanguage => AllowedLanguage.Python; - - public PythonPlugin() + public PythonPlugin(string filename) { _startInfo = new ProcessStartInfo { + FileName = @"C:\Program Files\Python 3.5\pythonw.exe", UseShellExecute = false, CreateNoWindow = true, RedirectStandardOutput = true, RedirectStandardError = true }; - string additionalPythonPath = $"{Path.Combine(PythonHome, "DLLs")};{Path.Combine(PythonHome, "Lib", "site-packages")}"; - if (!_startInfo.EnvironmentVariables.ContainsKey("PYTHONPATH")) - { - - _startInfo.EnvironmentVariables.Add("PYTHONPATH", additionalPythonPath); - } - else - { - _startInfo.EnvironmentVariables["PYTHONPATH"] = additionalPythonPath; - } } protected override string ExecuteQuery(Query query) @@ -39,11 +27,10 @@ namespace Wox.Core.Plugin JsonRPCServerRequestModel request = new JsonRPCServerRequestModel { Method = "query", - Parameters = new object[] { query.GetAllRemainingParameter() }, + Parameters = new object[] { query.Search }, HttpProxy = HttpProxy.Instance }; //Add -B flag to tell python don't write .py[co] files. Because .pyc contains location infos which will prevent python portable - _startInfo.FileName = Path.Combine(PythonHome, "pythonw.exe"); _startInfo.Arguments = $"-B \"{context.CurrentPluginMetadata.ExecuteFilePath}\" \"{request}\""; return Execute(_startInfo); @@ -51,7 +38,6 @@ namespace Wox.Core.Plugin protected override string ExecuteCallback(JsonRPCRequestModel rpcRequest) { - _startInfo.FileName = Path.Combine(PythonHome, "pythonw.exe"); _startInfo.Arguments = $"-B \"{context.CurrentPluginMetadata.ExecuteFilePath}\" \"{rpcRequest}\""; return Execute(_startInfo); } diff --git a/Wox.Core/UserSettings/PluginSettings.cs b/Wox.Core/UserSettings/PluginSettings.cs index 80267a2015..926cc62361 100644 --- a/Wox.Core/UserSettings/PluginSettings.cs +++ b/Wox.Core/UserSettings/PluginSettings.cs @@ -1,16 +1,53 @@ using System.Collections.Generic; +using System.Linq; +using Wox.Core.Plugin; +using Wox.Plugin; namespace Wox.Core.UserSettings { + public class PluginsSettings + { + public string PythonDirectory { get; set; } + public Dictionary Plugins { get; set; } = new Dictionary(); - public class PluginSettings + public void UpdatePluginSettings(List plugins) + { + var metadatas = plugins.Select(p => p.Metadata); + foreach (var metadata in metadatas) + { + if (Plugins.ContainsKey(metadata.ID)) + { + var settings = Plugins[metadata.ID]; + if (settings.ActionKeywords?.Count > 0) + { + metadata.ActionKeywords = settings.ActionKeywords; + metadata.ActionKeyword = settings.ActionKeywords[0]; + } + } + else + { + Plugins[metadata.ID] = new Plugin + { + ID = metadata.ID, + Name = metadata.Name, + ActionKeywords = metadata.ActionKeywords, + Disabled = false + }; + } + } + } + + public void UpdateActionKeyword(PluginMetadata metadata) + { + var settings = Plugins[metadata.ID]; + settings.ActionKeywords = metadata.ActionKeywords; + } + } + public class Plugin { public string ID { get; set; } - public string Name { get; set; } - public List ActionKeywords { get; set; } - public bool Disabled { get; set; } } } diff --git a/Wox.Core/UserSettings/Settings.cs b/Wox.Core/UserSettings/Settings.cs index 8ee4a375b0..70deb9c46b 100644 --- a/Wox.Core/UserSettings/Settings.cs +++ b/Wox.Core/UserSettings/Settings.cs @@ -1,10 +1,8 @@ using System; using System.Collections.Generic; -using System.ComponentModel; using System.Drawing; using System.Linq; using Wox.Core.Plugin; -using Wox.Infrastructure.Storage; using Wox.Plugin; using Newtonsoft.Json; @@ -31,7 +29,7 @@ namespace Wox.Core.UserSettings // Order defaults to 0 or -1, so 1 will let this property appear last [JsonProperty(Order = 1)] - public Dictionary PluginSettings { get; set; } = new Dictionary(); + public PluginsSettings PluginSettings { get; set; } = new PluginsSettings(); public List CustomPluginHotkeys { get; set; } = new List(); [Obsolete] @@ -54,61 +52,9 @@ namespace Wox.Core.UserSettings public int ProxyPort { get; set; } public string ProxyUserName { get; set; } public string ProxyPassword { get; set; } - - public void UpdatePluginSettings() - { - var metadatas = PluginManager.AllPlugins.Select(p => p.Metadata); - if (PluginSettings == null) - { - var configs = new Dictionary(); - foreach (var metadata in metadatas) - { - addPluginMetadata(configs, metadata); - } - PluginSettings = configs; - } - else - { - var configs = PluginSettings; - foreach (var metadata in metadatas) - { - if (configs.ContainsKey(metadata.ID)) - { - var config = configs[metadata.ID]; - if (config.ActionKeywords?.Count > 0) - { - metadata.ActionKeywords = config.ActionKeywords; - metadata.ActionKeyword = config.ActionKeywords[0]; - } - } - else - { - addPluginMetadata(configs, metadata); - } - } - } - } - - - private void addPluginMetadata(Dictionary configs, PluginMetadata metadata) - { - configs[metadata.ID] = new PluginSettings - { - ID = metadata.ID, - Name = metadata.Name, - ActionKeywords = metadata.ActionKeywords, - Disabled = false - }; - } - - public void UpdateActionKeyword(PluginMetadata metadata) - { - var config = PluginSettings[metadata.ID]; - config.ActionKeywords = metadata.ActionKeywords; - } - } + [Obsolete] public enum OpacityMode { Normal = 0, diff --git a/Wox.Core/Wox.Core.csproj b/Wox.Core/Wox.Core.csproj index 25474b6c61..bf68ebaa7b 100644 --- a/Wox.Core/Wox.Core.csproj +++ b/Wox.Core/Wox.Core.csproj @@ -78,9 +78,7 @@ - - diff --git a/Wox/ActionKeywords.xaml.cs b/Wox/ActionKeywords.xaml.cs index ffcdb8a10e..8d3769d703 100644 --- a/Wox/ActionKeywords.xaml.cs +++ b/Wox/ActionKeywords.xaml.cs @@ -50,7 +50,7 @@ namespace Wox return; } // update persistant data - _settings.UpdateActionKeyword(_plugin.Metadata); + _settings.PluginSettings.UpdateActionKeyword(_plugin.Metadata); MessageBox.Show(InternationalizationManager.Instance.GetTranslation("succeed")); Close(); diff --git a/Wox/App.xaml.cs b/Wox/App.xaml.cs index 9fc782a359..fb05f85cb6 100644 --- a/Wox/App.xaml.cs +++ b/Wox/App.xaml.cs @@ -42,10 +42,10 @@ namespace Wox ImageLoader.PreloadImages(); MainViewModel mainVM = new MainViewModel(); + var pluginsSettings = mainVM._settings.PluginSettings; API = new PublicAPIInstance(mainVM, mainVM._settings); - PluginManager.InitializePlugins(API); + PluginManager.InitializePlugins(API, pluginsSettings); - mainVM._settings.UpdatePluginSettings(); Window = new MainWindow(mainVM._settings, mainVM); NotifyIconManager notifyIconManager = new NotifyIconManager(API); diff --git a/Wox/Languages/de.xaml b/Wox/Languages/de.xaml index e12307d573..9120f6de9c 100644 --- a/Wox/Languages/de.xaml +++ b/Wox/Languages/de.xaml @@ -24,7 +24,8 @@ Sprache Maximale Anzahl Ergebnisse Ignoriere Tastenkombination wenn Fenster im Vollbildmodus ist - + Python Directory + Plugin Suche weitere Plugins diff --git a/Wox/Languages/en.xaml b/Wox/Languages/en.xaml index 2e75ca24a8..71065ba6b6 100644 --- a/Wox/Languages/en.xaml +++ b/Wox/Languages/en.xaml @@ -24,6 +24,9 @@ Language Maximum show results Ignore hotkeys if window is fullscreen + Python Directory + Select + Plugin diff --git a/Wox/Languages/fr.xaml b/Wox/Languages/fr.xaml index 839fae4f23..df84a678e3 100644 --- a/Wox/Languages/fr.xaml +++ b/Wox/Languages/fr.xaml @@ -24,7 +24,8 @@ Langue Résultats à afficher Ignore les raccourcis lorsqu'une application est en plein écran - + Python Directory + Modules Trouver plus de modules diff --git a/Wox/Languages/ja.xaml b/Wox/Languages/ja.xaml index 24e1bd90ea..2b4901c0b3 100644 --- a/Wox/Languages/ja.xaml +++ b/Wox/Languages/ja.xaml @@ -24,6 +24,8 @@ 言語 結果の最大表示件数 ウィンドウがフルスクリーン時にホットキーを無効にする + Python Directory + プラグイン diff --git a/Wox/Languages/ru.xaml b/Wox/Languages/ru.xaml index 13a7be86cc..3ba2c70057 100644 --- a/Wox/Languages/ru.xaml +++ b/Wox/Languages/ru.xaml @@ -24,7 +24,8 @@ Язык Максимальное количество результатов Игнорировать горячие клавиши, если окно в полноэкранном режиме - + Python Directory + Плагины Найти больше плагинов diff --git a/Wox/Languages/zh-cn.xaml b/Wox/Languages/zh-cn.xaml index f69b5511be..b44a0c111d 100644 --- a/Wox/Languages/zh-cn.xaml +++ b/Wox/Languages/zh-cn.xaml @@ -24,6 +24,7 @@ 语言 最大结果显示个数 全屏模式下忽略热键 + Python 路径 插件 diff --git a/Wox/Languages/zh-tw.xaml b/Wox/Languages/zh-tw.xaml index ed60457dad..a3bac1ffa7 100644 --- a/Wox/Languages/zh-tw.xaml +++ b/Wox/Languages/zh-tw.xaml @@ -24,6 +24,7 @@ 語言 最大結果顯示個數 全屏模式下忽略熱鍵 + Python Directory 插件 diff --git a/Wox/SettingWindow.xaml b/Wox/SettingWindow.xaml index b0fc8b93e1..016668f75b 100644 --- a/Wox/SettingWindow.xaml +++ b/Wox/SettingWindow.xaml @@ -45,6 +45,11 @@ + + + +