コード例 #1
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);
            }
        }
コード例 #2
0
        public StandaloneTargetView(IServiceProvider serviceProvider)
        {
            var componentService   = (IComponentModel)(serviceProvider.GetService(typeof(SComponentModel)));
            var interpreterService = componentService.GetService <IInterpreterOptionsService>();

            var availableInterpreters = interpreterService.Interpreters.Select(factory => new PythonInterpreterView(factory)).ToList();

            _customInterpreter = new PythonInterpreterView("Other...", Guid.Empty, new Version(), 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      = interpreterService.DefaultInterpreter.Id;
                var defaultVersion = interpreterService.DefaultInterpreter.Configuration.Version;
                Interpreter = AvailableInterpreters.FirstOrDefault(v => v.Id == defaultId && v.Version == defaultVersion);
            }
        }
コード例 #3
0
ファイル: StandaloneTargetView.cs プロジェクト: omnimark/PTVS
        public StandaloneTargetView(IServiceProvider serviceProvider) {
            var componentService = (IComponentModel)(serviceProvider.GetService(typeof(SComponentModel)));
            var interpreterService = componentService.GetService<IInterpreterOptionsService>();

            var availableInterpreters = interpreterService.Interpreters.Select(factory => new PythonInterpreterView(factory)).ToList();

            _customInterpreter = new PythonInterpreterView("Other...", Guid.Empty, new Version(), 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 = interpreterService.DefaultInterpreter.Id;
                var defaultVersion = interpreterService.DefaultInterpreter.Configuration.Version;
                Interpreter = AvailableInterpreters.FirstOrDefault(v => v.Id == defaultId && v.Version == defaultVersion);
            }
        }
コード例 #4
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);
            }
        }