Exemplo n.º 1
0
 internal void UpdateIsValid()
 {
     SetValue(IsValidPropertyKey,
              PathUtils.IsValidPath(SourcePath) &&
              PathUtils.IsValidPath(ProjectPath) &&
              Directory.Exists(SourcePath) &&
              SelectedInterpreter != null &&
              AvailableInterpreters.Contains(SelectedInterpreter)
              );
 }
Exemplo n.º 2
0
 public StandaloneTargetView(IServiceProvider serviceProvider, StandaloneTarget template)
     : this(serviceProvider) {
     if (template.PythonInterpreter != null)
     {
         if (IsAnyAvailableInterpreters)
         {
             Interpreter = AvailableInterpreters
                           .FirstOrDefault(v => v.Id == template.PythonInterpreter.Id);
         }
         else
         {
             Interpreter = _customInterpreter;
         }
     }
     else
     {
         InterpreterPath = template.InterpreterPath;
     }
     ScriptPath       = template.Script;
     WorkingDirectory = template.WorkingDirectory;
     Arguments        = template.Arguments;
 }
Exemplo n.º 3
0
        public StandaloneTargetView(IServiceProvider serviceProvider)
        {
            var componentService = serviceProvider.GetComponentModel();

            var interpreterProviders = componentService.DefaultExportProvider.GetExports <IPythonInterpreterFactoryProvider, Dictionary <string, object> >();
            var interpreterOptions   = componentService.GetService <IInterpreterOptionsService>();
            var registry             = componentService.GetService <IInterpreterRegistryService>();
            var pythonService        = serviceProvider.GetPythonToolsService();

            var availableInterpreters = registry.Configurations.Select(
                config => new PythonInterpreterView(
                    config.Description,
                    config.Id,
                    config.InterpreterPath
                    )
                ).ToList();

            _customInterpreter = new PythonInterpreterView("Other...", "", null);
            availableInterpreters.Add(_customInterpreter);
            _availableInterpreters = new ReadOnlyCollection <PythonInterpreterView>(availableInterpreters);

            _interpreterPath           = null;
            _canSpecifyInterpreterPath = false;
            _scriptPath       = null;
            _workingDirectory = null;
            _arguments        = null;

            _isValid = false;

            PropertyChanged += new PropertyChangedEventHandler(StandaloneTargetView_PropertyChanged);

            if (IsAnyAvailableInterpreters)
            {
                var defaultId = interpreterOptions.DefaultInterpreterId;
                Interpreter = AvailableInterpreters.FirstOrDefault(v => v.Id == defaultId);
            }
        }