private void AddInterpreterClick(object sender, EventArgs e)
        {
            var newInterp = new NewInterpreter();

            if (newInterp.ShowDialog() == DialogResult.OK)
            {
                if (!_showSettingsFor.Enabled)
                {
                    // previously we had no interpreters, re-enable the control
                    _showSettingsFor.Items.Clear();
                    _defaultInterpreter.Items.Clear();
                    _defaultInterpreter.Enabled = true;
                    _showSettingsFor.Enabled    = true;
                }
                OptionsPage._options.Add(
                    new InterpreterOptions()
                {
                    Display = newInterp.InterpreterDescription, Added = true, IsConfigurable = true
                }
                    );
                _showSettingsFor.Items.Add(newInterp.InterpreterDescription);
                _showSettingsFor.SelectedIndex = _showSettingsFor.Items.Count - 1;
                _defaultInterpreter.Items.Add(newInterp.InterpreterDescription);
                if (_defaultInterpreter.SelectedIndex == -1)
                {
                    _defaultInterpreter.SelectedIndex = 0;
                }
            }
        }
Exemplo n.º 2
0
        private void AddInterpreterClick(object sender, EventArgs e)
        {
            var newInterp = new NewInterpreter();

            newInterp.Font = Font;
            if (newInterp.ShowDialog() == DialogResult.OK)
            {
                if (!_showSettingsFor.Enabled)
                {
                    // previously we had no interpreters, re-enable the control
                    _showSettingsFor.Items.Clear();
                    _defaultInterpreter.Items.Clear();
                    _defaultInterpreter.Enabled = true;
                    _showSettingsFor.Enabled    = true;
                }
                var id         = Guid.NewGuid();
                var factory    = new InterpreterPlaceholder(id, newInterp.InterpreterDescription);
                var newOptions = new InterpreterOptions(_serviceProvider.GetPythonToolsService(), factory)
                {
                    Display              = newInterp.InterpreterDescription,
                    Added                = true,
                    IsConfigurable       = true,
                    SupportsCompletionDb = true,
                    Id                 = id,
                    Factory            = factory,
                    InteractiveOptions = new PythonInteractiveOptions(
                        _serviceProvider,
                        _serviceProvider.GetPythonToolsService(),
                        "Interactive Windows",
                        ""
                        )
                };

                _serviceProvider.GetPythonToolsService().AddInterpreterOptions(newOptions.Factory, newOptions, true);
                _showSettingsFor.BeginUpdate();
                UpdateInterpreters();
                _showSettingsFor.SelectedItem = newOptions.Factory;
                _showSettingsFor.EndUpdate();
            }
        }
        private void AddInterpreterClick(object sender, EventArgs e) {
            var newInterp = new NewInterpreter();
            newInterp.Font = Font;
            if (newInterp.ShowDialog() == DialogResult.OK) {
                if (!_showSettingsFor.Enabled) {
                    // previously we had no interpreters, re-enable the control
                    _showSettingsFor.Items.Clear();
                    _defaultInterpreter.Items.Clear();
                    _defaultInterpreter.Enabled = true;
                    _showSettingsFor.Enabled = true;
                }
                var id = Guid.NewGuid();
                var factory = new InterpreterPlaceholder(id, newInterp.InterpreterDescription);
                var newOptions = new InterpreterOptions(_serviceProvider.GetPythonToolsService(), factory) {
                    Display = newInterp.InterpreterDescription,
                    Added = true,
                    IsConfigurable = true,
                    SupportsCompletionDb = true,
                    Id = id,
                    Factory = factory,
                    InteractiveOptions = new PythonInteractiveOptions(
                        _serviceProvider,
                        _serviceProvider.GetPythonToolsService(), 
                        "Interactive Windows", 
                        ""
                    )
                };

                _serviceProvider.GetPythonToolsService().AddInterpreterOptions(newOptions.Factory, newOptions, true);
                _showSettingsFor.BeginUpdate();
                UpdateInterpreters();
                _showSettingsFor.SelectedItem = newOptions.Factory;
                _showSettingsFor.EndUpdate();
            }
        }