mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-01-18 06:29:44 +08:00
Merge branch 'master' into dotnet-core-upgrade
# Conflicts: # src/modules/launcher/Wox.Core/Wox.Core.csproj
This commit is contained in:
commit
c5df7d4249
@ -42,20 +42,6 @@ namespace Wox.Core.Plugin
|
||||
}
|
||||
}
|
||||
|
||||
private static void DeletePythonBinding()
|
||||
{
|
||||
const string binding = "wox.py";
|
||||
var directory = Constant.PluginsDirectory;
|
||||
foreach (var subDirectory in Directory.GetDirectories(directory))
|
||||
{
|
||||
var path = Path.Combine(subDirectory, binding);
|
||||
if (File.Exists(path))
|
||||
{
|
||||
File.Delete(path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void Save()
|
||||
{
|
||||
foreach (var plugin in AllPlugins)
|
||||
@ -77,8 +63,6 @@ namespace Wox.Core.Plugin
|
||||
static PluginManager()
|
||||
{
|
||||
ValidateUserDirectory();
|
||||
// force old plugins use new python binding
|
||||
DeletePythonBinding();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -15,15 +15,12 @@ namespace Wox.Core.Plugin
|
||||
public static class PluginsLoader
|
||||
{
|
||||
public const string PATH = "PATH";
|
||||
public const string Python = "python";
|
||||
public const string PythonExecutable = "pythonw.exe";
|
||||
|
||||
public static List<PluginPair> Plugins(List<PluginMetadata> metadatas, PluginsSettings settings)
|
||||
{
|
||||
var csharpPlugins = CSharpPlugins(metadatas).ToList();
|
||||
var pythonPlugins = PythonPlugins(metadatas, settings.PythonDirectory);
|
||||
var executablePlugins = ExecutablePlugins(metadatas);
|
||||
var plugins = csharpPlugins.Concat(pythonPlugins).Concat(executablePlugins).ToList();
|
||||
var plugins = csharpPlugins.Concat(executablePlugins).ToList();
|
||||
return plugins;
|
||||
}
|
||||
|
||||
@ -88,55 +85,6 @@ namespace Wox.Core.Plugin
|
||||
return plugins;
|
||||
}
|
||||
|
||||
public static IEnumerable<PluginPair> PythonPlugins(List<PluginMetadata> 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("|PluginsLoader.PythonPlugins|Python can't be found in PATH.");
|
||||
return new List<PluginPair>();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Log.Error("|PluginsLoader.PythonPlugins|PATH environment variable is not set.");
|
||||
return new List<PluginPair>();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var path = Path.Combine(pythonDirecotry, PythonExecutable);
|
||||
if (File.Exists(path))
|
||||
{
|
||||
filename = path;
|
||||
}
|
||||
else
|
||||
{
|
||||
Log.Error("|PluginsLoader.PythonPlugins|Can't find python executable in <b ");
|
||||
return new List<PluginPair>();
|
||||
}
|
||||
}
|
||||
Constant.PythonPath = filename;
|
||||
var plugins = metadatas.Select(metadata => new PluginPair
|
||||
{
|
||||
Plugin = new PythonPlugin(filename),
|
||||
Metadata = metadata
|
||||
});
|
||||
return plugins;
|
||||
}
|
||||
|
||||
public static IEnumerable<PluginPair> ExecutablePlugins(IEnumerable<PluginMetadata> source)
|
||||
{
|
||||
var metadatas = source.Where(o => o.Language.ToUpper() == AllowedLanguage.Executable);
|
||||
|
@ -1,64 +0,0 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using Wox.Infrastructure;
|
||||
using Wox.Plugin;
|
||||
|
||||
namespace Wox.Core.Plugin
|
||||
{
|
||||
internal class PythonPlugin : JsonRPCPlugin
|
||||
{
|
||||
private readonly ProcessStartInfo _startInfo;
|
||||
public override string SupportedLanguage { get; set; } = AllowedLanguage.Python;
|
||||
|
||||
public PythonPlugin(string filename)
|
||||
{
|
||||
_startInfo = new ProcessStartInfo
|
||||
{
|
||||
FileName = filename,
|
||||
UseShellExecute = false,
|
||||
CreateNoWindow = true,
|
||||
RedirectStandardOutput = true,
|
||||
RedirectStandardError = true,
|
||||
};
|
||||
|
||||
// temp fix for issue #667
|
||||
var path = Path.Combine(Constant.ProgramDirectory, JsonRPC);
|
||||
_startInfo.EnvironmentVariables["PYTHONPATH"] = path;
|
||||
|
||||
}
|
||||
|
||||
protected override string ExecuteQuery(Query query)
|
||||
{
|
||||
JsonRPCServerRequestModel request = new JsonRPCServerRequestModel
|
||||
{
|
||||
Method = "query",
|
||||
Parameters = new object[] { query.Search },
|
||||
};
|
||||
//Add -B flag to tell python don't write .py[co] files. Because .pyc contains location infos which will prevent python portable
|
||||
_startInfo.Arguments = $"-B \"{context.CurrentPluginMetadata.ExecuteFilePath}\" \"{request}\"";
|
||||
// todo happlebao why context can't be used in constructor
|
||||
_startInfo.WorkingDirectory = context.CurrentPluginMetadata.PluginDirectory;
|
||||
|
||||
return Execute(_startInfo);
|
||||
}
|
||||
|
||||
protected override string ExecuteCallback(JsonRPCRequestModel rpcRequest)
|
||||
{
|
||||
_startInfo.Arguments = $"-B \"{context.CurrentPluginMetadata.ExecuteFilePath}\" \"{rpcRequest}\"";
|
||||
_startInfo.WorkingDirectory = context.CurrentPluginMetadata.PluginDirectory;
|
||||
return Execute(_startInfo);
|
||||
}
|
||||
|
||||
protected override string ExecuteContextMenu(Result selectedResult) {
|
||||
JsonRPCServerRequestModel request = new JsonRPCServerRequestModel {
|
||||
Method = "context_menu",
|
||||
Parameters = new object[] { selectedResult.ContextData },
|
||||
};
|
||||
_startInfo.Arguments = $"-B \"{context.CurrentPluginMetadata.ExecuteFilePath}\" \"{request}\"";
|
||||
_startInfo.WorkingDirectory = context.CurrentPluginMetadata.PluginDirectory;
|
||||
|
||||
return Execute(_startInfo);
|
||||
}
|
||||
}
|
||||
}
|
@ -66,7 +66,6 @@ namespace Wox.Infrastructure.Exception
|
||||
sb.AppendLine($"* OS Version: {Environment.OSVersion.VersionString}");
|
||||
sb.AppendLine($"* IntPtr Length: {IntPtr.Size}");
|
||||
sb.AppendLine($"* x64: {Environment.Is64BitOperatingSystem}");
|
||||
sb.AppendLine($"* Python Path: {Constant.PythonPath}");
|
||||
sb.AppendLine($"* Everything SDK Path: {Constant.EverythingSDKPath}");
|
||||
sb.AppendLine($"* CLR Version: {Environment.Version}");
|
||||
sb.AppendLine($"* Installed .NET Framework: ");
|
||||
|
@ -5,7 +5,6 @@ namespace Wox.Infrastructure.UserSettings
|
||||
{
|
||||
public class PluginsSettings : BaseModel
|
||||
{
|
||||
public string PythonDirectory { get; set; }
|
||||
public Dictionary<string, Plugin> Plugins { get; set; } = new Dictionary<string, Plugin>();
|
||||
|
||||
public void UpdatePluginSettings(List<PluginMetadata> metadatas)
|
||||
|
@ -40,7 +40,6 @@ namespace Wox.Infrastructure
|
||||
public static readonly string DefaultIcon = Path.Combine(ProgramDirectory, "Images", "app.png");
|
||||
public static readonly string ErrorIcon = Path.Combine(ProgramDirectory, "Images", "app_error.png");
|
||||
|
||||
public static string PythonPath;
|
||||
public static string EverythingSDKPath;
|
||||
}
|
||||
}
|
||||
|
@ -2,11 +2,6 @@
|
||||
{
|
||||
public static class AllowedLanguage
|
||||
{
|
||||
public static string Python
|
||||
{
|
||||
get { return "PYTHON"; }
|
||||
}
|
||||
|
||||
public static string CSharp
|
||||
{
|
||||
get { return "CSHARP"; }
|
||||
@ -19,8 +14,7 @@
|
||||
|
||||
public static bool IsAllowed(string language)
|
||||
{
|
||||
return language.ToUpper() == Python.ToUpper()
|
||||
|| language.ToUpper() == CSharp.ToUpper()
|
||||
return language.ToUpper() == CSharp.ToUpper()
|
||||
|| language.ToUpper() == Executable.ToUpper();
|
||||
}
|
||||
}
|
||||
|
@ -41,8 +41,7 @@ namespace Wox.Helper
|
||||
|
||||
public static string DependenciesInfo()
|
||||
{
|
||||
var info = $"\nPython Path: {Constant.PythonPath}" +
|
||||
$"\nEverything SDK Path: {Constant.EverythingSDKPath}";
|
||||
var info = $"\nEverything SDK Path: {Constant.EverythingSDKPath}";
|
||||
return info;
|
||||
}
|
||||
}
|
||||
|
@ -24,9 +24,7 @@
|
||||
<system:String x:Key="language">Sprog</system:String>
|
||||
<system:String x:Key="maxShowResults">Maksimum antal resultater vist</system:String>
|
||||
<system:String x:Key="ignoreHotkeysOnFullscreen">Ignorer genvejstaster i fuldskærmsmode</system:String>
|
||||
<system:String x:Key="pythonDirectory">Python bibliotek</system:String>
|
||||
<system:String x:Key="autoUpdates">Autoopdatering</system:String>
|
||||
<system:String x:Key="selectPythonDirectory">Vælg</system:String>
|
||||
<system:String x:Key="hideOnStartup">Skjul Wox ved opstart</system:String>
|
||||
|
||||
<!--Setting Plugin-->
|
||||
|
@ -24,9 +24,7 @@
|
||||
<system:String x:Key="language">Sprache</system:String>
|
||||
<system:String x:Key="maxShowResults">Maximale Anzahl Ergebnissen</system:String>
|
||||
<system:String x:Key="ignoreHotkeysOnFullscreen">Ignoriere Tastenkombination wenn Fenster im Vollbildmodus ist</system:String>
|
||||
<system:String x:Key="pythonDirectory">Python-Verzeichnis</system:String>
|
||||
<system:String x:Key="autoUpdates">Automatische Aktualisierung</system:String>
|
||||
<system:String x:Key="selectPythonDirectory">Auswählen</system:String>
|
||||
<system:String x:Key="hideOnStartup">Verstecke Wox bei Systemstart</system:String>
|
||||
|
||||
<!--Setting Plugin-->
|
||||
|
@ -28,9 +28,7 @@
|
||||
<system:String x:Key="LastQueryEmpty">Empty last Query</system:String>
|
||||
<system:String x:Key="maxShowResults">Maximum results shown</system:String>
|
||||
<system:String x:Key="ignoreHotkeysOnFullscreen">Ignore hotkeys in fullscreen mode</system:String>
|
||||
<system:String x:Key="pythonDirectory">Python Directory</system:String>
|
||||
<system:String x:Key="autoUpdates">Auto Update</system:String>
|
||||
<system:String x:Key="selectPythonDirectory">Select</system:String>
|
||||
<system:String x:Key="hideOnStartup">Hide Wox on startup</system:String>
|
||||
<system:String x:Key="hideNotifyIcon">Hide tray icon</system:String>
|
||||
<system:String x:Key="querySearchPrecision">Query Search Precision</system:String>
|
||||
|
@ -28,9 +28,7 @@
|
||||
<system:String x:Key="LastQueryEmpty">Ne pas afficher la dernière recherche</system:String>
|
||||
<system:String x:Key="maxShowResults">Résultats maximums à afficher</system:String>
|
||||
<system:String x:Key="ignoreHotkeysOnFullscreen">Ignore les raccourcis lorsqu'une application est en plein écran</system:String>
|
||||
<system:String x:Key="pythonDirectory">Répertoire de Python</system:String>
|
||||
<system:String x:Key="autoUpdates">Mettre à jour automatiquement</system:String>
|
||||
<system:String x:Key="selectPythonDirectory">Sélectionner</system:String>
|
||||
<system:String x:Key="hideOnStartup">Cacher Wox au démarrage</system:String>
|
||||
|
||||
<!--Setting Plugin-->
|
||||
|
@ -28,9 +28,7 @@
|
||||
<system:String x:Key="LastQueryEmpty">Cancella ultima ricerca</system:String>
|
||||
<system:String x:Key="maxShowResults">Numero massimo di risultati mostrati</system:String>
|
||||
<system:String x:Key="ignoreHotkeysOnFullscreen">Ignora i tasti di scelta rapida in applicazione a schermo pieno</system:String>
|
||||
<system:String x:Key="pythonDirectory">Cartella Python</system:String>
|
||||
<system:String x:Key="autoUpdates">Aggiornamento automatico</system:String>
|
||||
<system:String x:Key="selectPythonDirectory">Seleziona</system:String>
|
||||
<system:String x:Key="hideOnStartup">Nascondi Wox all'avvio</system:String>
|
||||
|
||||
<!--Setting Plugin-->
|
||||
|
@ -28,9 +28,7 @@
|
||||
<system:String x:Key="LastQueryEmpty">前回のクエリを消去</system:String>
|
||||
<system:String x:Key="maxShowResults">結果の最大表示件数</system:String>
|
||||
<system:String x:Key="ignoreHotkeysOnFullscreen">ウィンドウがフルスクリーン時にホットキーを無効にする</system:String>
|
||||
<system:String x:Key="pythonDirectory">Pythonのディレクトリ</system:String>
|
||||
<system:String x:Key="autoUpdates">自動更新</system:String>
|
||||
<system:String x:Key="selectPythonDirectory">選択</system:String>
|
||||
<system:String x:Key="hideOnStartup">起動時にWoxを隠す</system:String>
|
||||
<system:String x:Key="hideNotifyIcon">トレイアイコンを隠す</system:String>
|
||||
|
||||
|
@ -28,9 +28,7 @@
|
||||
<system:String x:Key="LastQueryEmpty">직전 쿼리 지우기</system:String>
|
||||
<system:String x:Key="maxShowResults">표시할 결과 수</system:String>
|
||||
<system:String x:Key="ignoreHotkeysOnFullscreen">전체화면 모드에서는 핫키 무시</system:String>
|
||||
<system:String x:Key="pythonDirectory">Python 디렉토리</system:String>
|
||||
<system:String x:Key="autoUpdates">자동 업데이트</system:String>
|
||||
<system:String x:Key="selectPythonDirectory">선택</system:String>
|
||||
<system:String x:Key="hideOnStartup">시작 시 Wox 숨김</system:String>
|
||||
|
||||
<!--Setting Plugin-->
|
||||
|
@ -28,9 +28,7 @@
|
||||
<system:String x:Key="LastQueryEmpty">Tøm siste spørring</system:String>
|
||||
<system:String x:Key="maxShowResults">Maks antall resultater vist</system:String>
|
||||
<system:String x:Key="ignoreHotkeysOnFullscreen">Ignorer hurtigtaster i fullskjermsmodus</system:String>
|
||||
<system:String x:Key="pythonDirectory">Python-mappe</system:String>
|
||||
<system:String x:Key="autoUpdates">Oppdater automatisk</system:String>
|
||||
<system:String x:Key="selectPythonDirectory">Velg</system:String>
|
||||
<system:String x:Key="hideOnStartup">Skjul Wox ved oppstart</system:String>
|
||||
|
||||
<!--Setting Plugin-->
|
||||
|
@ -24,9 +24,7 @@
|
||||
<system:String x:Key="language">Taal</system:String>
|
||||
<system:String x:Key="maxShowResults">Laat maximale resultaten zien</system:String>
|
||||
<system:String x:Key="ignoreHotkeysOnFullscreen">Negeer sneltoetsen in fullscreen mode</system:String>
|
||||
<system:String x:Key="pythonDirectory">Python map</system:String>
|
||||
<system:String x:Key="autoUpdates">Automatische Update</system:String>
|
||||
<system:String x:Key="selectPythonDirectory">Selecteer</system:String>
|
||||
<system:String x:Key="hideOnStartup">Verberg Wox als systeem opstart</system:String>
|
||||
|
||||
<!--Setting Plugin-->
|
||||
|
@ -24,9 +24,7 @@
|
||||
<system:String x:Key="language">Język</system:String>
|
||||
<system:String x:Key="maxShowResults">Maksymalna liczba wyników</system:String>
|
||||
<system:String x:Key="ignoreHotkeysOnFullscreen">Ignoruj skróty klawiszowe w trybie pełnego ekranu</system:String>
|
||||
<system:String x:Key="pythonDirectory">Folder biblioteki Python</system:String>
|
||||
<system:String x:Key="autoUpdates">Automatyczne aktualizacje</system:String>
|
||||
<system:String x:Key="selectPythonDirectory">Wybierz</system:String>
|
||||
<system:String x:Key="hideOnStartup">Uruchamiaj Wox zminimalizowany</system:String>
|
||||
|
||||
<!--Setting Plugin-->
|
||||
|
@ -28,9 +28,7 @@
|
||||
<system:String x:Key="LastQueryEmpty">Limpar última consulta</system:String>
|
||||
<system:String x:Key="maxShowResults">Máximo de resultados mostrados</system:String>
|
||||
<system:String x:Key="ignoreHotkeysOnFullscreen">Ignorar atalhos em tela cheia</system:String>
|
||||
<system:String x:Key="pythonDirectory">Diretório Python</system:String>
|
||||
<system:String x:Key="autoUpdates">Atualizar Automaticamente</system:String>
|
||||
<system:String x:Key="selectPythonDirectory">Selecionar</system:String>
|
||||
<system:String x:Key="hideOnStartup">Esconder Wox na inicialização</system:String>
|
||||
|
||||
<!--Setting Plugin-->
|
||||
|
@ -24,9 +24,7 @@
|
||||
<system:String x:Key="language">Язык</system:String>
|
||||
<system:String x:Key="maxShowResults">Максимальное количество результатов</system:String>
|
||||
<system:String x:Key="ignoreHotkeysOnFullscreen">Игнорировать горячие клавиши, если окно в полноэкранном режиме</system:String>
|
||||
<system:String x:Key="pythonDirectory">Python Directory</system:String>
|
||||
<system:String x:Key="autoUpdates">Auto Update</system:String>
|
||||
<system:String x:Key="selectPythonDirectory">Select</system:String>
|
||||
<system:String x:Key="hideOnStartup">Hide Wox on startup</system:String>
|
||||
|
||||
<!--Setting Plugin-->
|
||||
|
@ -28,9 +28,7 @@
|
||||
<system:String x:Key="LastQueryEmpty">Prázdne</system:String>
|
||||
<system:String x:Key="maxShowResults">Max. výsledkov</system:String>
|
||||
<system:String x:Key="ignoreHotkeysOnFullscreen">Ignorovať klávesové skraty v režime na celú obrazovku</system:String>
|
||||
<system:String x:Key="pythonDirectory">Priečinok s Pythonom</system:String>
|
||||
<system:String x:Key="autoUpdates">Automatická aktualizácia</system:String>
|
||||
<system:String x:Key="selectPythonDirectory">Vybrať</system:String>
|
||||
<system:String x:Key="hideOnStartup">Schovať Wox po spustení</system:String>
|
||||
<system:String x:Key="hideNotifyIcon">Schovať ikonu v oblasti oznámení</system:String>
|
||||
|
||||
|
@ -28,9 +28,7 @@
|
||||
<system:String x:Key="LastQueryEmpty">Isprazni poslednji Upit</system:String>
|
||||
<system:String x:Key="maxShowResults">Maksimum prikazanih rezultata</system:String>
|
||||
<system:String x:Key="ignoreHotkeysOnFullscreen">Ignoriši prečice u fullscreen režimu</system:String>
|
||||
<system:String x:Key="pythonDirectory">Python direktorijum</system:String>
|
||||
<system:String x:Key="autoUpdates">Auto ažuriranje</system:String>
|
||||
<system:String x:Key="selectPythonDirectory">Izaberi</system:String>
|
||||
<system:String x:Key="hideOnStartup">Sakrij Wox pri podizanju sistema</system:String>
|
||||
|
||||
<!--Setting Plugin-->
|
||||
|
@ -28,9 +28,7 @@
|
||||
<system:String x:Key="LastQueryEmpty">Sorgu kutusunu temizle</system:String>
|
||||
<system:String x:Key="maxShowResults">Maksimum sonuç sayısı</system:String>
|
||||
<system:String x:Key="ignoreHotkeysOnFullscreen">Tam ekran modunda kısayol tuşunu gözardı et</system:String>
|
||||
<system:String x:Key="pythonDirectory">Python Konumu</system:String>
|
||||
<system:String x:Key="autoUpdates">Otomatik Güncelle</system:String>
|
||||
<system:String x:Key="selectPythonDirectory">Seç</system:String>
|
||||
<system:String x:Key="hideOnStartup">Başlangıçta Wox'u gizle</system:String>
|
||||
<system:String x:Key="hideNotifyIcon">Sistem çekmecesi simgesini gizle</system:String>
|
||||
<system:String x:Key="querySearchPrecision">Sorgu Arama Hassasiyeti</system:String>
|
||||
|
@ -24,9 +24,7 @@
|
||||
<system:String x:Key="language">Мова</system:String>
|
||||
<system:String x:Key="maxShowResults">Максимальна кількість результатів</system:String>
|
||||
<system:String x:Key="ignoreHotkeysOnFullscreen">Ігнорувати гарячі клавіші в повноекранному режимі</system:String>
|
||||
<system:String x:Key="pythonDirectory">Директорія Python</system:String>
|
||||
<system:String x:Key="autoUpdates">Автоматичне оновлення</system:String>
|
||||
<system:String x:Key="selectPythonDirectory">Вибрати</system:String>
|
||||
<system:String x:Key="hideOnStartup">Сховати Wox при запуску системи</system:String>
|
||||
|
||||
<!--Setting Plugin-->
|
||||
|
@ -28,9 +28,7 @@
|
||||
<system:String x:Key="LastQueryEmpty">清空上次搜索关键字</system:String>
|
||||
<system:String x:Key="maxShowResults">最大结果显示个数</system:String>
|
||||
<system:String x:Key="ignoreHotkeysOnFullscreen">全屏模式下忽略热键</system:String>
|
||||
<system:String x:Key="pythonDirectory">Python 路径</system:String>
|
||||
<system:String x:Key="autoUpdates">自动更新</system:String>
|
||||
<system:String x:Key="selectPythonDirectory">Select</system:String>
|
||||
<system:String x:Key="hideOnStartup">启动时不显示主窗口</system:String>
|
||||
<system:String x:Key="hideNotifyIcon">隐藏任务栏图标</system:String>
|
||||
|
||||
|
@ -24,9 +24,7 @@
|
||||
<system:String x:Key="language">語言</system:String>
|
||||
<system:String x:Key="maxShowResults">最大結果顯示個數</system:String>
|
||||
<system:String x:Key="ignoreHotkeysOnFullscreen">全螢幕模式下忽略熱鍵</system:String>
|
||||
<system:String x:Key="pythonDirectory">Python 路徑</system:String>
|
||||
<system:String x:Key="autoUpdates">自動更新</system:String>
|
||||
<system:String x:Key="selectPythonDirectory">選擇</system:String>
|
||||
<system:String x:Key="hideOnStartup">啟動時不顯示主視窗</system:String>
|
||||
|
||||
<!--設置,外掛-->
|
||||
|
Loading…
Reference in New Issue
Block a user