本文整理汇总了C#中PythonProjectNode类的典型用法代码示例。如果您正苦于以下问题:C# PythonProjectNode类的具体用法?C# PythonProjectNode怎么用?C# PythonProjectNode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PythonProjectNode类属于命名空间,在下文中一共展示了PythonProjectNode类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: AddInterpreter
private AddInterpreter(PythonProjectNode project, IInterpreterOptionsService service) {
_view = new AddInterpreterView(project, project.Site, project.InterpreterFactories);
_view.PropertyChanged += View_PropertyChanged;
DataContext = _view;
InitializeComponent();
}
开发者ID:RussBaz,项目名称:PTVS,代码行数:7,代码来源:AddInterpreter.xaml.cs
示例2: AddVirtualEnvironmentView
public AddVirtualEnvironmentView(
PythonProjectNode project,
IInterpreterRegistryService interpreterService,
IPythonInterpreterFactory selectInterpreter
) {
_interpreterService = interpreterService;
_project = project;
VirtualEnvBasePath = _projectHome = project.ProjectHome;
Interpreters = new ObservableCollection<InterpreterView>(InterpreterView.GetInterpreters(project.Site, project));
var selection = Interpreters.FirstOrDefault(v => v.Interpreter == selectInterpreter);
if (selection == null) {
selection = Interpreters.FirstOrDefault(v => v.Interpreter == project.GetInterpreterFactory())
?? Interpreters.LastOrDefault();
}
BaseInterpreter = selection;
_project.InterpreterFactoriesChanged += OnInterpretersChanged;
var venvName = "env";
for (int i = 1; Directory.Exists(Path.Combine(_projectHome, venvName)); ++i) {
venvName = "env" + i.ToString();
}
VirtualEnvName = venvName;
CanInstallRequirementsTxt = File.Exists(PathUtils.GetAbsoluteFilePath(_projectHome, "requirements.txt"));
WillInstallRequirementsTxt = CanInstallRequirementsTxt;
}
开发者ID:RussBaz,项目名称:PTVS,代码行数:27,代码来源:AddVirtualEnvironmentView.cs
示例3: AddInterpreterView
public AddInterpreterView(
PythonProjectNode project,
IServiceProvider serviceProvider,
IEnumerable<IPythonInterpreterFactory> selected
) {
_project = project;
Interpreters = new ObservableCollection<InterpreterView>(InterpreterView.GetInterpreters(serviceProvider, project));
var map = new Dictionary<IPythonInterpreterFactory, InterpreterView>();
foreach (var view in Interpreters) {
map[view.Interpreter] = view;
view.IsSelected = false;
}
foreach (var interp in selected) {
InterpreterView view;
if (map.TryGetValue(interp, out view)) {
view.IsSelected = true;
} else {
view = new InterpreterView(interp, interp.Configuration.FullDescription, false);
view.IsSelected = true;
Interpreters.Add(view);
}
}
_project.InterpreterFactoriesChanged += OnInterpretersChanged;
}
开发者ID:RussBaz,项目名称:PTVS,代码行数:27,代码来源:AddInterpreterView.cs
示例4: CustomCommand
private CustomCommand(
PythonProjectNode project,
string target,
string label
) {
_project = project;
_target = target;
_label = string.IsNullOrWhiteSpace(label) ? target : label;
var match = _customCommandLabelRegex.Match(label);
if (match.Success) {
DisplayLabel = LoadResourceFromAssembly(
match.Groups["assembly"].Value,
match.Groups["namespace"].Value,
match.Groups["key"].Value
);
} else {
DisplayLabel = _label;
}
DisplayLabel = PerformSubstitutions(project, DisplayLabel);
_canExecute = !string.IsNullOrEmpty(target);
Verb = "Project." + Regex.Replace(
DisplayLabelWithoutAccessKeys,
"[^a-z0-9]+",
"",
RegexOptions.CultureInvariant | RegexOptions.IgnoreCase
);
AlternateCmdId = AddNamedCommand(project.Site, Verb);
_errorListProvider = new ErrorListProvider(_project.Site);
}
开发者ID:smallwave,项目名称:PTVS,代码行数:32,代码来源:CustomCommand.cs
示例5: EnsureReplWindow
internal static IVsInteractiveWindow/*!*/ EnsureReplWindow(IServiceProvider serviceProvider, IPythonInterpreterFactory factory, PythonProjectNode project) {
var compModel = serviceProvider.GetComponentModel();
var provider = compModel.GetService<InteractiveWindowProvider>();
string replId = PythonReplEvaluatorProvider.GetReplId(factory, project);
var window = provider.FindReplWindow(replId);
if (window == null) {
window = provider.CreateInteractiveWindow(
serviceProvider.GetPythonContentType(),
factory.Description + " Interactive",
typeof(PythonLanguageInfo).GUID,
replId
);
var toolWindow = window as ToolWindowPane;
if (toolWindow != null) {
toolWindow.BitmapImageMoniker = KnownMonikers.PYInteractiveWindow;
}
var pyService = serviceProvider.GetPythonToolsService();
window.InteractiveWindow.SetSmartUpDown(pyService.GetInteractiveOptions(factory).ReplSmartHistory);
}
if (project != null && project.Interpreters.IsProjectSpecific(factory)) {
project.AddActionOnClose(window, BasePythonReplEvaluator.CloseReplWindow);
}
return window;
}
开发者ID:omnimark,项目名称:PTVS,代码行数:29,代码来源:ExecuteInReplCommand.cs
示例6: PythonExtensionReferenceNode
internal PythonExtensionReferenceNode(PythonProjectNode root, ProjectElement element, string filename)
: base(root, element) {
Utilities.ArgumentNotNullOrEmpty("filename", filename);
_filename = CommonUtils.GetAbsoluteFilePath(root.ProjectHome, filename);
AnalyzeReference(root.GetInterpreter() as IPythonInterpreterWithProjectReferences);
InitializeFileChangeEvents();
}
开发者ID:omnimark,项目名称:PTVS,代码行数:8,代码来源:PythonExtensionReferenceNode.cs
示例7: ShowDialog
public static IEnumerable<IPythonInterpreterFactory> ShowDialog(
PythonProjectNode project,
IInterpreterOptionsService service) {
using (var wnd = new AddInterpreter(project, service)) {
if (wnd.ShowModal() ?? false) {
return wnd._view.Interpreters.Where(iv => iv.IsSelected).Select(iv => iv.Interpreter);
}
}
return null;
}
开发者ID:RussBaz,项目名称:PTVS,代码行数:10,代码来源:AddInterpreter.xaml.cs
示例8: OpenProject
internal void OpenProject(VisualStudioApp app, string slnName, out PythonProjectNode projectNode, out EnvDTE.Project dteProject) {
PythonVersion.AssertInstalled();
dteProject = app.OpenProject("TestData\\Targets\\" + slnName);
projectNode = dteProject.GetPythonProject();
var fact = projectNode.InterpreterFactories.Where(x => x.Configuration.Id == PythonVersion.Id).FirstOrDefault();
Assert.IsNotNull(fact, "Project does not contain expected interpreter");
projectNode.ActiveInterpreter = fact;
dteProject.Save();
}
开发者ID:jsschultz,项目名称:PTVS,代码行数:10,代码来源:BuildTasksUITests.cs
示例9: InterpretersPackageNode
public InterpretersPackageNode(PythonProjectNode project, PackageSpec spec)
: base(project, new VirtualProjectElement(project)) {
ExcludeNodeFromScc = true;
_package = spec.Clone();
_packageName = spec.FullSpec;
if (spec.ExactVersion.IsEmpty) {
_caption = spec.Name;
_canUninstall = false;
} else {
_caption = string.Format("{0} ({1})", spec.Name, spec.ExactVersion);
_canUninstall = !CannotUninstall.Contains(spec.Name);
}
}
开发者ID:jsschultz,项目名称:PTVS,代码行数:13,代码来源:InterpretersPackageNode.cs
示例10: UpdateProject
public void UpdateProject(PythonProjectNode node, MSBuild.Project project) {
lock (_projects) {
if (project == null) {
_projects.Remove(node);
} else if (!_projects.ContainsKey(node) || _projects[node] != project) {
_projects[node] = project;
}
}
// Always raise the event, this also occurs when we're adding projects
// to the MSBuild.Project.
ProjectsChanaged?.Invoke(this, EventArgs.Empty);
}
开发者ID:jsschultz,项目名称:PTVS,代码行数:13,代码来源:LoadedProjectInterpreterFactoryProvider.cs
示例11: EnsureReplWindow
internal static IVsInteractiveWindow/*!*/ EnsureReplWindow(IServiceProvider serviceProvider, InterpreterConfiguration config, PythonProjectNode project) {
var compModel = serviceProvider.GetComponentModel();
var provider = compModel.GetService<InteractiveWindowProvider>();
var vsProjectContext = compModel.GetService<VsProjectContextProvider>();
string replId = config != null ?
PythonReplEvaluatorProvider.GetEvaluatorId(config) :
PythonReplEvaluatorProvider.GetEvaluatorId(project);
var window = provider.OpenOrCreate(replId);
project?.AddActionOnClose(window, InteractiveWindowProvider.Close);
return window;
}
开发者ID:jsschultz,项目名称:PTVS,代码行数:13,代码来源:ExecuteInReplCommand.cs
示例12: InterpretersPackageNode
public InterpretersPackageNode(PythonProjectNode project, string name)
: base(project, new VirtualProjectElement(project)) {
ExcludeNodeFromScc = true;
_packageName = name;
var match = PipFreezeRegex.Match(name);
if (match.Success) {
var namePart = match.Groups["name"].Value;
_caption = string.Format("{0} ({1})", namePart, match.Groups["version"]);
_canUninstall = !CannotUninstall.Contains(namePart);
} else {
_caption = name;
_canUninstall = false;
}
}
开发者ID:smallwave,项目名称:PTVS,代码行数:14,代码来源:InterpretersPackageNode.cs
示例13: AddVirtualEnvironmentOperation
public AddVirtualEnvironmentOperation(
PythonProjectNode project,
string virtualEnvPath,
IPythonInterpreterFactory baseInterpreter,
bool create,
bool useVEnv,
bool installRequirements,
Redirector output = null
) {
_project = project;
_virtualEnvPath = virtualEnvPath;
_baseInterpreter = baseInterpreter;
_create = create;
_useVEnv = useVEnv;
_installRequirements = installRequirements;
_output = output;
}
开发者ID:smallwave,项目名称:PTVS,代码行数:17,代码来源:AddVirtualEnvironmentOperation.cs
示例14: EnsureReplWindow
internal static IVsInteractiveWindow/*!*/ EnsureReplWindow(IServiceProvider serviceProvider, InterpreterConfiguration config, PythonProjectNode project) {
var compModel = serviceProvider.GetComponentModel();
var provider = compModel.GetService<InteractiveWindowProvider>();
var vsProjectContext = compModel.GetService<VsProjectContextProvider>();
var projectId = project != null ? PythonReplEvaluatorProvider.GetEvaluatorId(project) : null;
var configId = config != null ? PythonReplEvaluatorProvider.GetEvaluatorId(config) : null;
IVsInteractiveWindow window;
// If we find an open window for the project, prefer that to a per-config one
if (!string.IsNullOrEmpty(projectId)) {
window = provider.Open(projectId);
if (window != null) {
if (window.InteractiveWindow.GetPythonEvaluator()?.AssociatedProjectHasChanged == true) {
// We have an existing window, but it needs to be reset.
// Let's create a new one
window = provider.Create(projectId);
project.AddActionOnClose(window, InteractiveWindowProvider.Close);
}
return window;
}
}
// If we find an open window for the configuration, return that
if (!string.IsNullOrEmpty(configId)) {
window = provider.Open(configId);
if (window != null) {
return window;
}
}
// No window found, so let's create one
if (!string.IsNullOrEmpty(projectId)) {
window = provider.Create(projectId);
project.AddActionOnClose(window, InteractiveWindowProvider.Close);
} else if (!string.IsNullOrEmpty(configId)) {
window = provider.Create(configId);
} else {
var interpService = compModel.GetService<IInterpreterOptionsService>();
window = provider.Create(PythonReplEvaluatorProvider.GetEvaluatorId(interpService.DefaultInterpreter.Configuration));
}
return window;
}
开发者ID:zooba,项目名称:PTVS,代码行数:46,代码来源:ExecuteInReplCommand.cs
示例15: InterpretersNode
public InterpretersNode(
PythonProjectNode project,
ProjectItem item,
IPythonInterpreterFactory factory,
bool isInterpreterReference,
bool canDelete,
bool isGlobalDefault = false
)
: base(project, ChooseElement(project, item)) {
ExcludeNodeFromScc = true;
_interpreters = project.Interpreters;
_interpreterService = project.Site.GetComponentModel().GetService<IInterpreterOptionsService>();
_factory = factory;
_isReference = isInterpreterReference;
_canDelete = canDelete;
_isGlobalDefault = isGlobalDefault;
_canRemove = !isGlobalDefault;
_captionSuffix = isGlobalDefault ? SR.GetString(SR.GlobalDefaultSuffix) : "";
if (Directory.Exists(_factory.Configuration.LibraryPath)) {
// TODO: Need to handle watching for creation
try {
_fileWatcher = new FileSystemWatcher(_factory.Configuration.LibraryPath);
} catch (ArgumentException) {
// Path was not actually valid, despite Directory.Exists
// returning true.
}
if (_fileWatcher != null) {
try {
_fileWatcher.IncludeSubdirectories = true;
_fileWatcher.Deleted += PackagesChanged;
_fileWatcher.Created += PackagesChanged;
_fileWatcher.EnableRaisingEvents = true;
// Only create the timer if the file watcher is running.
_timer = new Timer(CheckPackages);
} catch (IOException) {
// Raced with directory deletion
_fileWatcher.Dispose();
_fileWatcher = null;
}
}
}
}
开发者ID:wenh123,项目名称:PTVS,代码行数:44,代码来源:InterpretersNode.cs
示例16: InterpretersNode
public InterpretersNode(
PythonProjectNode project,
IPythonInterpreterFactory factory,
bool isInterpreterReference,
bool canDelete,
bool isGlobalDefault = false,
bool? canRemove = null
)
: base(project, MakeElement(project)) {
ExcludeNodeFromScc = true;
_interpreterService = project.Site.GetComponentModel().GetService<IInterpreterRegistryService>();
_factory = factory;
_isReference = isInterpreterReference;
_canDelete = canDelete;
_isGlobalDefault = isGlobalDefault;
_canRemove = canRemove.HasValue ? canRemove.Value : !isGlobalDefault;
_captionSuffix = isGlobalDefault ? Strings.GlobalDefaultSuffix : "";
if (_factory.PackageManager != null) {
_factory.PackageManager.InstalledPackagesChanged += InstalledPackagesChanged;
}
}
开发者ID:jsschultz,项目名称:PTVS,代码行数:23,代码来源:InterpretersNode.cs
示例17: AddInterpreterView
public AddInterpreterView(
PythonProjectNode project,
IServiceProvider serviceProvider,
IEnumerable<string> selectedIds
) {
_project = project;
Interpreters = new ObservableCollection<InterpreterView>(InterpreterView.GetInterpreters(serviceProvider, project));
var map = new Dictionary<string, InterpreterView>();
foreach (var view in Interpreters) {
map[view.Id] = view;
view.IsSelected = false;
}
foreach (var id in selectedIds) {
InterpreterView view;
if (map.TryGetValue(id, out view)) {
view.IsSelected = true;
}
}
_project.InterpreterFactoriesChanged += OnInterpretersChanged;
}
开发者ID:zooba,项目名称:PTVS,代码行数:23,代码来源:AddInterpreterView.cs
示例18: ShowDialog
public static async Task ShowDialog(
PythonProjectNode project,
IInterpreterOptionsService service,
bool browseForExisting = false
) {
using (var view = new AddVirtualEnvironmentView(project, service, project.Interpreters.ActiveInterpreter)) {
var wnd = new AddVirtualEnvironment(view);
if (browseForExisting) {
var path = project.Site.BrowseForDirectory(IntPtr.Zero, project.ProjectHome);
if (string.IsNullOrEmpty(path)) {
throw new OperationCanceledException();
}
view.VirtualEnvName = path;
view.WillInstallRequirementsTxt = false;
await view.WaitForReady();
if (view.WillAddVirtualEnv) {
await view.Create().HandleAllExceptions(SR.ProductName, typeof(AddVirtualEnvironment));
return;
}
view.ShowBrowsePathError = true;
view.BrowseOrigPrefix = DerivedInterpreterFactory.GetOrigPrefixPath(path);
}
wnd.VirtualEnvPathTextBox.ScrollToEnd();
wnd.VirtualEnvPathTextBox.SelectAll();
wnd.VirtualEnvPathTextBox.Focus();
wnd.ShowModal();
var op = wnd._currentOperation;
if (op != null) {
await op;
}
}
}
开发者ID:omnimark,项目名称:PTVS,代码行数:36,代码来源:AddVirtualEnvironment.xaml.cs
示例19: CurrentWorkingDirectoryNode
public CurrentWorkingDirectoryNode(PythonProjectNode project, string path)
: base(project, path, new VirtualProjectElement(project)) { }
开发者ID:wenh123,项目名称:PTVS,代码行数:2,代码来源:CurrentWorkingDirectoryNode.cs
示例20: CommonSearchPathContainerNode
public CommonSearchPathContainerNode(PythonProjectNode project)
: base(project.ProjectMgr) {
_projectNode = project;
this.ExcludeNodeFromScc = true;
}
开发者ID:omnimark,项目名称:PTVS,代码行数:5,代码来源:CommonSearchPathContainerNode.cs
注:本文中的PythonProjectNode类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论