mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-09 04:37:30 +02:00
Merge branch 'master' of https://github.com/qianlifeng/WinAlfred.git
This commit is contained in:
@@ -22,4 +22,4 @@ Currently, Wox support using C# and Python to write your plugins. Please refer t
|
|||||||
Share plugin
|
Share plugin
|
||||||
=========
|
=========
|
||||||
|
|
||||||
Share your plugin through <a href="http://plugin.getwox.com/">WoxPlugins</a>. After you upload your plugin, other uses can download or search your plugin through `plugin` command (this is a plugin for plugin management, which is one of the default plugins inside Wox).
|
Share your plugin through <a href="http://www.getwox.com/plugin">WoxPlugins</a>. After you upload your plugin, other uses can download or search your plugin through `plugin` command (this is a plugin for plugin management, which is one of the default plugins inside Wox).
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ using System.Linq;
|
|||||||
using System.Threading;
|
using System.Threading;
|
||||||
using Python.Runtime;
|
using Python.Runtime;
|
||||||
using Wox.Plugin;
|
using Wox.Plugin;
|
||||||
|
using Wox.Helper;
|
||||||
|
|
||||||
namespace Wox.PluginLoader
|
namespace Wox.PluginLoader
|
||||||
{
|
{
|
||||||
@@ -11,6 +12,8 @@ namespace Wox.PluginLoader
|
|||||||
{
|
{
|
||||||
public override List<PluginPair> LoadPlugin()
|
public override List<PluginPair> LoadPlugin()
|
||||||
{
|
{
|
||||||
|
if (!CheckPythonEnvironmentInstalled()) return new List<PluginPair>();
|
||||||
|
|
||||||
List<PluginPair> plugins = new List<PluginPair>();
|
List<PluginPair> plugins = new List<PluginPair>();
|
||||||
List<PluginMetadata> metadatas = pluginMetadatas.Where(o => o.Language.ToUpper() == AllowedLanguage.Python.ToUpper()).ToList();
|
List<PluginMetadata> metadatas = pluginMetadatas.Where(o => o.Language.ToUpper() == AllowedLanguage.Python.ToUpper()).ToList();
|
||||||
foreach (PluginMetadata metadata in metadatas)
|
foreach (PluginMetadata metadata in metadatas)
|
||||||
@@ -26,5 +29,18 @@ namespace Wox.PluginLoader
|
|||||||
|
|
||||||
return plugins;
|
return plugins;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool CheckPythonEnvironmentInstalled() {
|
||||||
|
try
|
||||||
|
{
|
||||||
|
PythonEngine.Initialize();
|
||||||
|
PythonEngine.Shutdown();
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
Log.Error("Could't find python environment, all python plugins disabled.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user