Skip to content

Commit

Permalink
Run: Remove "Runner settings" groupbox to simplify its dialogs
Browse files Browse the repository at this point in the history
This avoids an additional level of nesting that probably doesn't make
much sense to users (as suggested in review).
  • Loading branch information
ccordoba12 committed Jun 9, 2024
1 parent f1edd8c commit 81744d7
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 64 deletions.
20 changes: 2 additions & 18 deletions spyder/plugins/externalterminal/widgets/run_conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,6 @@ def __init__(self, parent, context: Context, input_extension: str,
# --- Interpreter ---
interpreter_group = QGroupBox(_("Python interpreter"))
interpreter_layout = QVBoxLayout(interpreter_group)
interpreter_layout.setContentsMargins(
*((3 * AppStyle.MarginSize,) * 4)
)

# --- System terminal ---
external_group = QWidget(self)
Expand All @@ -76,12 +73,6 @@ def __init__(self, parent, context: Context, input_extension: str,
# --- General settings ----
common_group = QGroupBox(_("Bash/Batch script settings"))
common_layout = QGridLayout(common_group)
common_layout.setContentsMargins(
3 * AppStyle.MarginSize,
3 * AppStyle.MarginSize,
3 * AppStyle.MarginSize,
0,
)

self.clo_cb = QCheckBox(_("Command line options:"))
common_layout.addWidget(self.clo_cb, 0, 0)
Expand All @@ -92,6 +83,7 @@ def __init__(self, parent, context: Context, input_extension: str,
common_layout.addWidget(self.clo_edit, 0, 1)

layout = QVBoxLayout(self)
layout.setContentsMargins(0, 0, 0, 0)
layout.addWidget(interpreter_group)
layout.addWidget(common_group)
layout.addStretch(100)
Expand Down Expand Up @@ -143,9 +135,6 @@ def __init__(
# --- Interpreter ---
interpreter_group = QGroupBox(_("Interpreter"))
interpreter_layout = QVBoxLayout(interpreter_group)
interpreter_layout.setContentsMargins(
*((3 * AppStyle.MarginSize,) * 4)
)

interpreter_label = QLabel(_("Shell interpreter:"))
self.interpreter_edit = QLineEdit(self)
Expand Down Expand Up @@ -178,12 +167,6 @@ def __init__(
# --- Script ---
script_group = QGroupBox(_('Script'))
script_layout = QVBoxLayout(script_group)
script_layout.setContentsMargins(
3 * AppStyle.MarginSize,
3 * AppStyle.MarginSize,
3 * AppStyle.MarginSize,
0,
)

self.script_opts_cb = QCheckBox(_("Script arguments:"))
self.script_opts_edit = QLineEdit(self)
Expand All @@ -203,6 +186,7 @@ def __init__(
script_layout.addWidget(self.close_after_exec_cb)

layout = QVBoxLayout(self)
layout.setContentsMargins(0, 0, 0, 0)
layout.addWidget(interpreter_group)
layout.addWidget(script_group)
layout.addStretch(100)
Expand Down
13 changes: 2 additions & 11 deletions spyder/plugins/ipythonconsole/widgets/run_conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
from spyder.plugins.run.api import (
RunExecutorConfigurationGroup, Context, RunConfigurationMetadata)
from spyder.utils.misc import getcwd_or_home
from spyder.utils.stylesheet import AppStyle


# Main constants
Expand All @@ -42,9 +41,6 @@ def __init__(self, parent, context: Context, input_extension: str,
# --- Interpreter ---
interpreter_group = QGroupBox(_("Console"))
interpreter_layout = QVBoxLayout(interpreter_group)
interpreter_layout.setContentsMargins(
*((3 * AppStyle.MarginSize,) * 4)
)

self.current_radio = QRadioButton(CURRENT_INTERPRETER)
interpreter_layout.addWidget(self.current_radio)
Expand All @@ -53,14 +49,8 @@ def __init__(self, parent, context: Context, input_extension: str,
interpreter_layout.addWidget(self.dedicated_radio)

# --- General settings ----
common_group = QGroupBox(_("General settings"))
common_group = QGroupBox(_("Advanced settings"))
common_layout = QVBoxLayout(common_group)
common_layout.setContentsMargins(
3 * AppStyle.MarginSize,
3 * AppStyle.MarginSize,
3 * AppStyle.MarginSize,
0,
)

self.clear_var_cb = QCheckBox(CLEAR_ALL_VARIABLES)
common_layout.addWidget(self.clear_var_cb)
Expand All @@ -83,6 +73,7 @@ def __init__(self, parent, context: Context, input_extension: str,
common_layout.addLayout(cli_layout)

layout = QVBoxLayout(self)
layout.setContentsMargins(0, 0, 0, 0)
layout.addWidget(interpreter_group)
layout.addWidget(common_group)
layout.addStretch(100)
Expand Down
8 changes: 1 addition & 7 deletions spyder/plugins/profiler/widgets/run_conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
from spyder.plugins.run.api import (
RunExecutorConfigurationGroup, Context, RunConfigurationMetadata)
from spyder.utils.misc import getcwd_or_home
from spyder.utils.stylesheet import AppStyle


class ProfilerPyConfigurationGroup(RunExecutorConfigurationGroup):
Expand All @@ -34,12 +33,6 @@ def __init__(self, parent, context: Context, input_extension: str,
# --- General settings ----
common_group = QGroupBox(_("File settings"))
common_layout = QGridLayout(common_group)
common_layout.setContentsMargins(
3 * AppStyle.MarginSize,
3 * AppStyle.MarginSize,
3 * AppStyle.MarginSize,
0,
)

self.clo_cb = QCheckBox(_("Command line options:"))
common_layout.addWidget(self.clo_cb, 0, 0)
Expand All @@ -50,6 +43,7 @@ def __init__(self, parent, context: Context, input_extension: str,
common_layout.addWidget(self.clo_edit, 0, 1)

layout = QVBoxLayout(self)
layout.setContentsMargins(0, 0, 0, 0)
layout.addWidget(common_group)
layout.addStretch(100)

Expand Down
37 changes: 9 additions & 28 deletions spyder/plugins/run/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@


# Main constants
FILE_DIR = _("The directory of the configuration being executed")
FILE_DIR = _("The directory of the file being executed")
CW_DIR = _("The current working directory")
FIXED_DIR = _("The following directory:")
EMPTY_NAME = _("Provide a name for this configuration")
Expand Down Expand Up @@ -257,15 +257,6 @@ def setup(self):

# --- Runner settings
self.stack = QStackedWidget(self)
self.executor_group = QGroupBox(_("Runner settings"))
executor_layout = QVBoxLayout(self.executor_group)
executor_layout.setContentsMargins(
3 * AppStyle.MarginSize,
3 * AppStyle.MarginSize,
3 * AppStyle.MarginSize,
0 if MAC else AppStyle.MarginSize,
)
executor_layout.addWidget(self.stack)

# --- Working directory settings
self.wdir_group = QGroupBox(_("Working directory settings"))
Expand Down Expand Up @@ -306,7 +297,7 @@ def setup(self):
4 * AppStyle.MarginSize,
ext_context_layout,
(3 if MAC else 4) * AppStyle.MarginSize,
self.executor_group,
self.stack,
self.wdir_group,
(-2 if MAC else 1) * AppStyle.MarginSize,
)
Expand Down Expand Up @@ -382,9 +373,9 @@ def context_changed(self, index: int, reset: bool = False):
RunExecutorConfigurationGroup)

if executor_conf_metadata['configuration_widget'] is None:
self.executor_group.setEnabled(False)
self.stack.setEnabled(False)
else:
self.executor_group.setEnabled(True)
self.stack.setEnabled(True)

self.wdir_group.setEnabled(requires_cwd)

Expand Down Expand Up @@ -434,8 +425,7 @@ def context_changed(self, index: int, reset: bool = False):
self.fixed_dir_radio.setChecked(True)
self.wd_edit.setText(path)

if (not self.executor_group.isEnabled() and not
self.wdir_group.isEnabled()):
if not self.stack.isEnabled() and not self.wdir_group.isEnabled():
ok_btn = self.bbox.button(QDialogButtonBox.Ok)
ok_btn.setEnabled(False)

Expand Down Expand Up @@ -657,16 +647,7 @@ def setup(self):
config_props_layout.addWidget(name_params_tip, 0, 2)

# --- Runner settings
self.stack = QStackedWidget()
self.executor_group = QGroupBox(_("Runner settings"))

parameters_layout = QVBoxLayout(self.executor_group)
parameters_layout.addWidget(self.stack)

# Remove bottom margin because it adds unnecessary space
parameters_layout_margins = parameters_layout.contentsMargins()
parameters_layout_margins.setBottom(0)
parameters_layout.setContentsMargins(parameters_layout_margins)
self.stack = QStackedWidget(self)

# --- Working directory settings
self.wdir_group = QGroupBox(_("Working directory settings"))
Expand Down Expand Up @@ -698,7 +679,7 @@ def setup(self):
# --- Group all customization widgets into a collapsible one
custom_config = CollapsibleWidget(self, _("Custom configuration"))
custom_config.addWidget(config_props_group)
custom_config.addWidget(self.executor_group)
custom_config.addWidget(self.stack)
custom_config.addWidget(self.wdir_group)

# Fix bottom and left margins.
Expand Down Expand Up @@ -842,9 +823,9 @@ def display_executor_configuration(self, index: int):
RunExecutorConfigurationGroup)

if executor_info['configuration_widget'] is None:
self.executor_group.setVisible(False)
self.stack.setVisible(False)
else:
self.executor_group.setVisible(True)
self.stack.setVisible(True)

metadata = self.run_conf_model.get_selected_metadata()
context = metadata['context']
Expand Down

0 comments on commit 81744d7

Please sign in to comment.