Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PR: Improve UI/UX of the Run plugin configuration widgets #22141

Merged
merged 57 commits into from
Jun 18, 2024
Merged
Changes from 1 commit
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
e73518d
Run: Hide file combobox in RunDialog
ccordoba12 Oct 29, 2023
5e0182f
Run: Remove checkbox to always show RunDialog
ccordoba12 Oct 29, 2023
2c33b79
Run: Simplify layout of executor and parameters comboboxes in RunDialog
ccordoba12 Oct 29, 2023
91f2ddb
Run: Automatically save config if customized by users in RunDialog
ccordoba12 Oct 30, 2023
e52c13f
Run: Initial UX improvements for ExecutionParametersDialog and conf page
ccordoba12 Oct 31, 2023
bdbef37
Run: Fix deleting parameters from its config page
ccordoba12 Nov 3, 2023
1dcf7d5
Widgets: Make HoverRowsTableView highlight a hovered row on its own
ccordoba12 Nov 3, 2023
448cc85
Run: Make RunParametersTableView highlight its rows on hover
ccordoba12 Nov 3, 2023
db398f7
Run: Fix saving config parameters when the user has saved some before
ccordoba12 Nov 5, 2023
f57ba7b
Widgets: Add a new CollapsibleWidget to hide and show child widgets
ccordoba12 Nov 8, 2023
51063c8
Run: Group widgets to customize config into a collapsible one in RunD…
ccordoba12 Nov 8, 2023
530bc9a
Minor fixes to the run config group of several plugins
ccordoba12 Nov 8, 2023
3a48a87
Run: Center dialog after custom_config widget is expanded/collapsed
ccordoba12 Nov 8, 2023
8be23b4
Merge branch 'master' into improve-run-config-ux
ccordoba12 May 16, 2024
f5cc47c
Widgets: Change cursor shape when hovering toggle button of Collapsib…
ccordoba12 May 16, 2024
ebf949f
Run: Several fixes to its widgets
ccordoba12 May 17, 2024
543ad31
IPython console: Rename file that contains run conf options to run_conf
ccordoba12 May 17, 2024
5c00548
Set min width for command line options of run conf widgets
ccordoba12 May 17, 2024
34366eb
Run: Additional UI improvements for ExecutionParametersDialog
ccordoba12 May 18, 2024
03adbaf
Run: Correctly set bottom margins for QGroupBoxes shown in its dialogs
ccordoba12 May 18, 2024
f0a0aba
Run: Allow to delete and save globally config parameters in RunDialog
ccordoba12 May 18, 2024
2706ea3
Editor: Remove unnecessary run extensions
ccordoba12 May 20, 2024
4e07ae5
Simplify code related to Run options in plugins to make it easier to …
ccordoba12 May 20, 2024
a070cf6
Run: Save default executor configurations to our config system
ccordoba12 May 20, 2024
e22e6c9
Run: Don't allow to remove default executor parameters in its confpage
ccordoba12 May 21, 2024
736721b
Run: More UI improvements to its confpage
ccordoba12 May 21, 2024
fac3f3b
Run: Improve UI of ExecutorRunParametersTableModel
ccordoba12 May 21, 2024
3b5b773
Run: Add "Edit selected" button to its confpage
ccordoba12 May 22, 2024
ddb8541
Run: Improve ExecutionParametersDialog UI when displaying default params
ccordoba12 May 22, 2024
74d45fb
Run: Improve code and UX related to reset changes in its confpage
ccordoba12 May 22, 2024
02c753b
Stylesheet: Move style declaration to SidebarDialog
ccordoba12 May 23, 2024
daed316
Run: Fix saving and executing custom configs in RunDialog
ccordoba12 May 24, 2024
3375eb4
Run: Improve RunDialog layout and style
ccordoba12 May 24, 2024
5e1862d
Run: Prevent saving global configs for different conditions in RunDialog
ccordoba12 May 29, 2024
a1a7d7b
Run: Add tip widgets in several places of RunDialog
ccordoba12 May 29, 2024
df272ec
Run: Fix content's right margin of custom_config widget in RunDialog
ccordoba12 May 29, 2024
16b070c
App: Filter warnings shown when uncollapsing CollapsibleWidget
ccordoba12 May 29, 2024
2d14675
Run: Fix a couple of errors with its dialogs
ccordoba12 May 31, 2024
ebab9c6
External terminal: Improve UI of ExternalTerminalShConfiguration widget
ccordoba12 Jun 1, 2024
e5fa369
Merge branch 'master' into improve-run-config-ux
ccordoba12 Jun 2, 2024
9910e1b
Testing: Fix failing main windows tests
ccordoba12 Jun 2, 2024
ce66902
Run: UI fixes for Mac and Windows
ccordoba12 Jun 3, 2024
36dea53
API: Add kwarg to force rendering a SpyderMenu
ccordoba12 Jun 4, 2024
4c660c2
Run: Fix style of buttons used to select a directory
ccordoba12 Jun 4, 2024
ffc08a5
Run: Remove "Save globally" button and move "Delete" one to button box
ccordoba12 Jun 8, 2024
9e87ea5
Run: Don't allow to save file parameters with a repeated name
ccordoba12 Jun 8, 2024
a6eb582
Run: Improve validation of global configuration names
ccordoba12 Jun 8, 2024
06e35bd
Run: Fix disabling edit/delete/clone buttons after some operations
ccordoba12 Jun 8, 2024
dcc838a
Run: Simplify layout of buttons in its confpage
ccordoba12 Jun 8, 2024
5598cf1
Run: Fix Reset button in ExecutionParametersDialog
ccordoba12 Jun 9, 2024
3d85d44
Run: Remove "Runner settings" groupbox to simplify its dialogs
ccordoba12 Jun 9, 2024
b741f4e
Run: Add menu entry to go to its Preferences page
ccordoba12 Jun 10, 2024
554ed05
Run: Use table_model current executor params when deleting confs
ccordoba12 Jun 11, 2024
353e4bd
Run: Make customizing global configs for files easier in RunDialog
ccordoba12 Jun 11, 2024
ef830c7
Apply suggestions from code review
ccordoba12 Jun 17, 2024
b1e6280
Utils: Add accessors to SpyderApplication for main window properties
ccordoba12 Jun 18, 2024
5e801e3
Testing: Fix failing tests due to the Numpy 2.0 release
ccordoba12 Jun 18, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Run: Hide file combobox in RunDialog
- Instead, show label with the current file name.
- That helps to decrease the complexity of this dialog.
  • Loading branch information
ccordoba12 committed Dec 10, 2023
commit e73518d04105409254af0e2a14bbe1bab367539a
84 changes: 71 additions & 13 deletions spyder/plugins/run/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,25 @@
# Third party imports
from qtpy.compat import getexistingdirectory
from qtpy.QtCore import QSize, Qt, Signal
from qtpy.QtGui import QFontMetrics
from qtpy.QtWidgets import (QCheckBox, QDialog, QDialogButtonBox,
QGroupBox, QHBoxLayout, QLabel, QLineEdit, QLayout,
QRadioButton, QStackedWidget, QVBoxLayout, QWidget)
import qstylizer.style

# Local imports
from spyder.api.translations import _
from spyder.api.config.fonts import SpyderFontType, SpyderFontsMixin
from spyder.api.widgets.comboboxes import SpyderComboBox
from spyder.plugins.run.api import (
RunParameterFlags, WorkingDirSource, WorkingDirOpts,
RunExecutionParameters, ExtendedRunExecutionParameters,
RunExecutorConfigurationGroup, SupportedExecutionRunConfiguration)
from spyder.utils.icon_manager import ima
from spyder.utils.misc import getcwd_or_home
from spyder.utils.palette import QStylePalette
from spyder.utils.qthelpers import create_toolbutton
from spyder.utils.stylesheet import AppStyle



Expand Down Expand Up @@ -413,7 +418,7 @@ def get_configuration(
return self.saved_conf


class RunDialog(BaseRunConfigDialog):
class RunDialog(BaseRunConfigDialog, SpyderFontsMixin):
"""Run dialog used to configure run executors."""

def __init__(
Expand All @@ -430,12 +435,19 @@ def __init__(
self.parameter_model = parameter_model
self.current_widget = None
self.status = RunDialogStatus.Close
self._is_shown = False

# ---- Public methods
def setup(self):
combo_label = QLabel(_("Select a run configuration:"))
executor_label = QLabel(_("Select a run executor:"))
# Header
self.header_label = QLabel(self)
self.header_label.setObjectName("header-label")

# Hide this combobox to decrease the dialog complexity
self.configuration_combo = SpyderComboBox(self)
self.configuration_combo.hide()

executor_label = QLabel(_("Select an executor:"))
self.executor_combo = SpyderComboBox(self)

parameters_label = QLabel(_("Select the run parameters:"))
Expand Down Expand Up @@ -464,7 +476,7 @@ def setup(self):
fixed_dir_layout = QHBoxLayout()
self.fixed_dir_radio = QRadioButton(FIXED_DIR)
fixed_dir_layout.addWidget(self.fixed_dir_radio)
self.wd_edit = QLineEdit()
self.wd_edit = QLineEdit(self)
self.fixed_dir_radio.toggled.connect(self.wd_edit.setEnabled)
self.wd_edit.setEnabled(False)
fixed_dir_layout.addWidget(self.wd_edit)
Expand All @@ -479,7 +491,7 @@ def setup(self):

# --- Store new custom configuration
self.store_params_cb = QCheckBox(STORE_PARAMS)
self.store_params_text = QLineEdit()
self.store_params_text = QLineEdit(self)
store_params_layout = QHBoxLayout()
store_params_layout.addWidget(self.store_params_cb)
store_params_layout.addWidget(self.store_params_text)
Expand All @@ -491,10 +503,18 @@ def setup(self):

self.firstrun_cb = QCheckBox(ALWAYS_OPEN_FIRST_RUN % _("this dialog"))

layout = self.add_widgets(combo_label, self.configuration_combo,
executor_label, self.executor_combo,
10, self.executor_group, self.firstrun_cb)
layout = self.add_widgets(
self.header_label,
5,
self.configuration_combo,
executor_label,
self.executor_combo,
10,
self.executor_group,
self.firstrun_cb
)

# Settings
self.executor_combo.currentIndexChanged.connect(
self.display_executor_configuration)
self.executor_combo.setModel(self.executors_model)
Expand All @@ -504,10 +524,7 @@ def setup(self):
self.configuration_combo.setModel(self.run_conf_model)
self.configuration_combo.setCurrentIndex(
self.run_conf_model.get_initial_index())

self.configuration_combo.setMaxVisibleItems(20)
self.configuration_combo.view().setVerticalScrollBarPolicy(
Qt.ScrollBarAsNeeded)
self.configuration_combo.setMaxVisibleItems(1)

self.executor_combo.setMaxVisibleItems(20)
self.executor_combo.view().setVerticalScrollBarPolicy(
Expand All @@ -517,7 +534,7 @@ def setup(self):
self.update_parameter_set)
self.parameters_combo.setModel(self.parameter_model)

widget_dialog = QWidget()
widget_dialog = QWidget(self)
widget_dialog.setMinimumWidth(600)
widget_dialog.setLayout(layout)
scroll_layout = QVBoxLayout(self)
Expand All @@ -527,6 +544,8 @@ def setup(self):
self.setWindowTitle(_("Run configuration per file"))
self.layout().setSizeConstraint(QLayout.SetFixedSize)

self.setStyleSheet(self._stylesheet)

def select_directory(self):
"""Select directory"""
basedir = str(self.wd_edit.text())
Expand Down Expand Up @@ -700,3 +719,42 @@ def get_configuration(
) -> Tuple[str, str, ExtendedRunExecutionParameters, bool]:

return self.saved_conf

# ---- Qt methods
def showEvent(self, event):
"""Adjustments when the widget is shown."""
if not self._is_shown:
# Set file name as the header
fname = self.configuration_combo.currentText()
header_font = (
self.get_font(SpyderFontType.Interface, font_size_delta=1)
)

# Elide fname in case fname is too long
fm = QFontMetrics(header_font)
text = fm.elidedText(
fname, Qt.ElideLeft, self.header_label.width()
)

self.header_label.setFont(header_font)
self.header_label.setAlignment(Qt.AlignCenter)
self.header_label.setText(text)
if text != fname:
self.header_label.setToolTip(fname)

self._is_shown = True

super().showEvent(event)

# ---- Private methods
@property
def _stylesheet(self):
css = qstylizer.style.StyleSheet()

css["QLabel#header-label"].setValues(
backgroundColor=QStylePalette.COLOR_BACKGROUND_3,
padding=f"{2 * AppStyle.MarginSize} {4 * AppStyle.MarginSize}",
borderRadius=QStylePalette.SIZE_BORDER_RADIUS
)

return css.toString()