From 4d2c15bfe9d78ccb37f3ef3d7ab20ee89ced1c72 Mon Sep 17 00:00:00 2001 From: jsbautista Date: Mon, 15 May 2023 13:26:23 -0500 Subject: [PATCH 01/17] add help image label --- spyder/plugins/application/confpage.py | 14 ++-- spyder/plugins/completion/confpage.py | 2 +- .../languageserver/conftabs/advanced.py | 24 +++--- .../languageserver/conftabs/docstring.py | 2 +- .../languageserver/conftabs/formatting.py | 2 +- .../languageserver/conftabs/introspection.py | 2 +- .../languageserver/conftabs/linting.py | 2 +- spyder/plugins/editor/confpage.py | 8 +- .../externalconsole/widgets/run_conf.py | 8 +- spyder/plugins/ipythonconsole/confpage.py | 8 +- .../plugins/ipythonconsole/widgets/config.py | 2 +- spyder/plugins/maininterpreter/confpage.py | 4 +- spyder/plugins/preferences/api.py | 81 +++++++++++++++---- spyder/plugins/statusbar/confpage.py | 4 +- spyder/plugins/variableexplorer/confpage.py | 4 +- spyder/plugins/workingdirectory/confpage.py | 10 +-- 16 files changed, 114 insertions(+), 63 deletions(-) diff --git a/spyder/plugins/application/confpage.py b/spyder/plugins/application/confpage.py index 38df265a0b4..68b35850c9c 100644 --- a/spyder/plugins/application/confpage.py +++ b/spyder/plugins/application/confpage.py @@ -102,8 +102,8 @@ def setup_page(self): 'use_custom_margin') margin_spin = self.create_spinbox("", _("pixels"), 'custom_margin', default=0, min_=0, max_=30) - margin_box.toggled.connect(margin_spin.spinbox.setEnabled) - margin_box.toggled.connect(margin_spin.slabel.setEnabled) + margin_box.checkbox.toggled.connect(margin_spin.spinbox.setEnabled) + margin_box.checkbox.toggled.connect(margin_spin.slabel.setEnabled) margin_spin.spinbox.setEnabled(self.get_option('use_custom_margin')) margin_spin.slabel.setEnabled(self.get_option('use_custom_margin')) @@ -114,8 +114,8 @@ def setup_page(self): 'custom_cursor_blinking', default=QApplication.cursorFlashTime(), min_=0, max_=5000, step=100) - cursor_box.toggled.connect(cursor_spin.spinbox.setEnabled) - cursor_box.toggled.connect(cursor_spin.slabel.setEnabled) + cursor_box.checkbox.toggled.connect(cursor_spin.spinbox.setEnabled) + cursor_box.checkbox.toggled.connect(cursor_spin.slabel.setEnabled) cursor_spin.spinbox.setEnabled( self.get_option('use_custom_cursor_blinking')) cursor_spin.slabel.setEnabled( @@ -207,9 +207,9 @@ def set_open_file(state): regex=r"[0-9]+(?:\.[0-9]*)(;[0-9]+(?:\.[0-9]*))*", restart=True) - normal_radio.toggled.connect(self.custom_scaling_edit.setDisabled) - auto_scale_radio.toggled.connect(self.custom_scaling_edit.setDisabled) - custom_scaling_radio.toggled.connect( + normal_radio.radiobutton.toggled.connect(self.custom_scaling_edit.setDisabled) + auto_scale_radio.radiobutton.toggled.connect(self.custom_scaling_edit.setDisabled) + custom_scaling_radio.radiobutton.toggled.connect( self.custom_scaling_edit.setEnabled) # Layout Screen resolution diff --git a/spyder/plugins/completion/confpage.py b/spyder/plugins/completion/confpage.py index dd30007314e..2077ea51087 100644 --- a/spyder/plugins/completion/confpage.py +++ b/spyder/plugins/completion/confpage.py @@ -78,7 +78,7 @@ def disable_completion_after_characters(state): completions_after_characters.plabel.setEnabled(state) completions_after_characters.spinbox.setEnabled(state) - automatic_completion_box.toggled.connect( + automatic_completion_box.checkbox.toggled.connect( disable_completion_after_characters) layout = QVBoxLayout() diff --git a/spyder/plugins/completion/providers/languageserver/conftabs/advanced.py b/spyder/plugins/completion/providers/languageserver/conftabs/advanced.py index 8b5c59b1d55..f1c7a75bd94 100644 --- a/spyder/plugins/completion/providers/languageserver/conftabs/advanced.py +++ b/spyder/plugins/completion/providers/languageserver/conftabs/advanced.py @@ -59,8 +59,8 @@ def __init__(self, parent): self.use_stdio = self.create_checkbox( _("Use stdio pipes to communicate with server"), 'advanced/stdio') - self.use_stdio.stateChanged.connect(self.disable_tcp) - self.external_server.stateChanged.connect(self.disable_stdio) + self.use_stdio.checkbox.stateChanged.connect(self.disable_tcp) + self.external_server.checkbox.stateChanged.connect(self.disable_stdio) # Advanced layout advanced_g_layout = QGridLayout() @@ -87,9 +87,9 @@ def __init__(self, parent): advanced_options_widget = QWidget() advanced_options_widget.setLayout(advanced_options_layout) advanced_options_widget.setEnabled(self.get_option('advanced/enabled')) - self.advanced_options_check.toggled.connect( + self.advanced_options_check.checkbox.toggled.connect( advanced_options_widget.setEnabled) - self.advanced_options_check.toggled.connect( + self.advanced_options_check.checkbox.toggled.connect( self.show_advanced_warning) # Advanced options layout @@ -108,15 +108,15 @@ def disable_tcp(self, state): if state == Qt.Checked: self.advanced_host.textbox.setEnabled(False) self.advanced_port.spinbox.setEnabled(False) - self.external_server.stateChanged.disconnect() - self.external_server.setChecked(False) - self.external_server.setEnabled(False) + self.external_server.checkbox.stateChanged.disconnect() + self.external_server.checkbox.setChecked(False) + self.external_server.checkbox.setEnabled(False) else: self.advanced_host.textbox.setEnabled(True) self.advanced_port.spinbox.setEnabled(True) - self.external_server.setChecked(False) - self.external_server.setEnabled(True) - self.external_server.stateChanged.connect(self.disable_stdio) + self.external_server.checkbox.setChecked(False) + self.external_server.checkbox.setEnabled(True) + self.external_server.checkbox.stateChanged.connect(self.disable_stdio) def disable_stdio(self, state): if state == Qt.Checked: @@ -167,10 +167,10 @@ def is_valid(self): # and we need to automatically check the corresponding # option if host not in ['127.0.0.1', 'localhost']: - self.external_server.setChecked(True) + self.external_server.checkbox.setChecked(True) # Checks for external PyLS - if self.external_server.isChecked(): + if self.external_server.checkbox.isChecked(): port = int(self.advanced_port.spinbox.text()) # Check that host and port of the current server are diff --git a/spyder/plugins/completion/providers/languageserver/conftabs/docstring.py b/spyder/plugins/completion/providers/languageserver/conftabs/docstring.py index e38d50ad0a8..f6d91093d7a 100644 --- a/spyder/plugins/completion/providers/languageserver/conftabs/docstring.py +++ b/spyder/plugins/completion/providers/languageserver/conftabs/docstring.py @@ -108,7 +108,7 @@ def __init__(self, parent): docstring_style_g_widget = QWidget() docstring_style_g_widget.setLayout(docstring_style_g_layout) docstring_style_g_widget.setEnabled(self.get_option('pydocstyle')) - self.docstring_style_check.toggled.connect( + self.docstring_style_check.checkbox.toggled.connect( docstring_style_g_widget.setEnabled) # Docstring style layout diff --git a/spyder/plugins/completion/providers/languageserver/conftabs/formatting.py b/spyder/plugins/completion/providers/languageserver/conftabs/formatting.py index 874ee394958..210546982dc 100644 --- a/spyder/plugins/completion/providers/languageserver/conftabs/formatting.py +++ b/spyder/plugins/completion/providers/languageserver/conftabs/formatting.py @@ -92,7 +92,7 @@ def __init__(self, parent): code_style_g_widget = QWidget() code_style_g_widget.setLayout(code_style_g_layout) code_style_g_widget.setEnabled(self.get_option('pycodestyle')) - self.code_style_check.toggled.connect(code_style_g_widget.setEnabled) + self.code_style_check.checkbox.toggled.connect(code_style_g_widget.setEnabled) # Code style layout code_style_group = QGroupBox(_("Code style")) diff --git a/spyder/plugins/completion/providers/languageserver/conftabs/introspection.py b/spyder/plugins/completion/providers/languageserver/conftabs/introspection.py index ec4405e1aa8..d2c30f02c31 100644 --- a/spyder/plugins/completion/providers/languageserver/conftabs/introspection.py +++ b/spyder/plugins/completion/providers/languageserver/conftabs/introspection.py @@ -54,7 +54,7 @@ def __init__(self, parent): introspection_layout.addWidget(enable_hover_hints_box) introspection_group.setLayout(introspection_layout) - goto_definition_box.toggled.connect(follow_imports_box.setEnabled) + goto_definition_box.checkbox.toggled.connect(follow_imports_box.setEnabled) # Advanced group advanced_group = QGroupBox(_("Advanced")) diff --git a/spyder/plugins/completion/providers/languageserver/conftabs/linting.py b/spyder/plugins/completion/providers/languageserver/conftabs/linting.py index 68e4780472c..dac11a1b817 100644 --- a/spyder/plugins/completion/providers/languageserver/conftabs/linting.py +++ b/spyder/plugins/completion/providers/languageserver/conftabs/linting.py @@ -48,4 +48,4 @@ def __init__(self, parent): linting_layout.addWidget(underline_errors_box) linting_layout.addWidget(linting_complexity_box) self.setLayout(linting_layout) - linting_check.toggled.connect(underline_errors_box.setEnabled) + linting_check.checkbox.toggled.connect(underline_errors_box.setEnabled) diff --git a/spyder/plugins/editor/confpage.py b/spyder/plugins/editor/confpage.py index 7464cff5cbe..250ef01bbea 100644 --- a/spyder/plugins/editor/confpage.py +++ b/spyder/plugins/editor/confpage.py @@ -65,8 +65,8 @@ def setup_page(self): "", _(" ms"), 'occurrence_highlighting/timeout', min_=100, max_=1000000, step=100) - occurrence_box.toggled.connect(occurrence_spin.spinbox.setEnabled) - occurrence_box.toggled.connect(occurrence_spin.slabel.setEnabled) + occurrence_box.checkbox.toggled.connect(occurrence_spin.spinbox.setEnabled) + occurrence_box.checkbox.toggled.connect(occurrence_spin.slabel.setEnabled) occurrence_spin.spinbox.setEnabled( self.get_option('occurrence_highlighting')) occurrence_spin.slabel.setEnabled( @@ -220,7 +220,7 @@ def enable_tabwidth_spin(index): _('seconds'), 'autosave_interval', min_=1, max_=3600) - autosave_checkbox.toggled.connect(autosave_spinbox.setEnabled) + autosave_checkbox.checkbox.toggled.connect(autosave_spinbox.setEnabled) autosave_layout = QVBoxLayout() autosave_layout.addWidget(autosave_checkbox) @@ -297,7 +297,7 @@ def enable_tabwidth_spin(index): eol_combo_choices, 'convert_eol_on_save_to', ) - convert_eol_on_save_box.toggled.connect( + convert_eol_on_save_box.checkbox.toggled.connect( convert_eol_on_save_combo.setEnabled) convert_eol_on_save_combo.setEnabled( self.get_option('convert_eol_on_save')) diff --git a/spyder/plugins/externalconsole/widgets/run_conf.py b/spyder/plugins/externalconsole/widgets/run_conf.py index cab8e225132..3180f1fa105 100644 --- a/spyder/plugins/externalconsole/widgets/run_conf.py +++ b/spyder/plugins/externalconsole/widgets/run_conf.py @@ -62,7 +62,7 @@ def __init__(self, parent, context: Context, input_extension: str, self.pclo_cb = QCheckBox(_("Command line options:")) external_layout.addWidget(self.pclo_cb, 3, 0) self.pclo_edit = QLineEdit() - self.pclo_cb.toggled.connect(self.pclo_edit.setEnabled) + self.pclo_cb.checkbox.toggled.connect(self.pclo_edit.setEnabled) self.pclo_edit.setEnabled(False) self.pclo_edit.setToolTip(_("-u<_b> is added to the " "other options you set here")) @@ -78,7 +78,7 @@ def __init__(self, parent, context: Context, input_extension: str, self.clo_cb = QCheckBox(_("Command line options:")) common_layout.addWidget(self.clo_cb, 0, 0) self.clo_edit = QLineEdit() - self.clo_cb.toggled.connect(self.clo_edit.setEnabled) + self.clo_cb.checkbox.toggled.connect(self.clo_edit.setEnabled) self.clo_edit.setEnabled(False) common_layout.addWidget(self.clo_edit, 0, 1) @@ -162,7 +162,7 @@ def __init__( self.interpreter_opts_cb = QCheckBox(_("Interpreter arguments:")) interpreter_layout.addWidget(self.interpreter_opts_cb, 1, 0) self.interpreter_opts_edit = QLineEdit() - self.interpreter_opts_cb.toggled.connect( + self.interpreter_opts_cb.checkbox.toggled.connect( self.interpreter_opts_edit.setEnabled) self.interpreter_opts_edit.setEnabled(False) interpreter_layout.addWidget(self.interpreter_opts_edit, 1, 1) @@ -174,7 +174,7 @@ def __init__( self.script_opts_cb = QCheckBox(_("Script arguments:")) script_layout.addWidget(self.script_opts_cb, 1, 0) self.script_opts_edit = QLineEdit() - self.script_opts_cb.toggled.connect( + self.script_opts_cb.checkbox.toggled.connect( self.script_opts_edit.setEnabled) self.script_opts_edit.setEnabled(False) script_layout.addWidget(self.script_opts_edit, 1, 1) diff --git a/spyder/plugins/ipythonconsole/confpage.py b/spyder/plugins/ipythonconsole/confpage.py index 22d3defa639..1231c7b44d7 100644 --- a/spyder/plugins/ipythonconsole/confpage.py +++ b/spyder/plugins/ipythonconsole/confpage.py @@ -94,7 +94,7 @@ def setup_page(self): "plotting libraries different to Matplotlib or to develop\n" "GUIs with Spyder.")) autoload_pylab_box.setEnabled(self.get_option('pylab')) - pylab_box.toggled.connect(autoload_pylab_box.setEnabled) + pylab_box.checkbox.toggled.connect(autoload_pylab_box.setEnabled) pylab_layout = QVBoxLayout() pylab_layout.addWidget(pylab_box) @@ -131,7 +131,7 @@ def setup_page(self): backend_layout.addWidget(backend_box) backend_group.setLayout(backend_layout) backend_group.setEnabled(self.get_option('pylab')) - pylab_box.toggled.connect(backend_group.setEnabled) + pylab_box.checkbox.toggled.connect(backend_group.setEnabled) # Inline backend Group inline_group = QGroupBox(_("Inline backend")) @@ -186,7 +186,7 @@ def setup_page(self): inline_v_layout.addLayout(inline_h_layout) inline_group.setLayout(inline_v_layout) inline_group.setEnabled(self.get_option('pylab')) - pylab_box.toggled.connect(inline_group.setEnabled) + pylab_box.checkbox.toggled.connect(inline_group.setEnabled) # --- Startup --- # Run lines Group @@ -215,7 +215,7 @@ def setup_page(self): 'startup/use_run_file', False) run_file_browser = self.create_browsefile('', 'startup/run_file', '') run_file_browser.setEnabled(False) - file_radio.toggled.connect(run_file_browser.setEnabled) + file_radio.checkbox.toggled.connect(run_file_browser.setEnabled) run_file_layout = QVBoxLayout() run_file_layout.addWidget(run_file_label) diff --git a/spyder/plugins/ipythonconsole/widgets/config.py b/spyder/plugins/ipythonconsole/widgets/config.py index bcd2bfdfa60..92c729dadf6 100644 --- a/spyder/plugins/ipythonconsole/widgets/config.py +++ b/spyder/plugins/ipythonconsole/widgets/config.py @@ -74,7 +74,7 @@ def __init__(self, parent, context: Context, input_extension: str, self.clo_cb = QCheckBox(_("Command line options:")) common_layout.addWidget(self.clo_cb, 3, 0) self.clo_edit = QLineEdit() - self.clo_cb.toggled.connect(self.clo_edit.setEnabled) + self.clo_cb.checkbox.toggled.connect(self.clo_edit.setEnabled) self.clo_edit.setEnabled(False) common_layout.addWidget(self.clo_edit, 3, 1) diff --git a/spyder/plugins/maininterpreter/confpage.py b/spyder/plugins/maininterpreter/confpage.py index 368a4bc58ae..cd9db92a172 100644 --- a/spyder/plugins/maininterpreter/confpage.py +++ b/spyder/plugins/maininterpreter/confpage.py @@ -99,8 +99,8 @@ def setup_page(self): adjust_to_contents=True, validate_callback=programs.is_python_interpreter, ) - self.def_exec_radio.toggled.connect(self.cus_exec_combo.setDisabled) - self.cus_exec_radio.toggled.connect(self.cus_exec_combo.setEnabled) + self.def_exec_radio.radiobutton.toggled.connect(self.cus_exec_combo.setDisabled) + self.cus_exec_radio.radiobutton.toggled.connect(self.cus_exec_combo.setEnabled) pyexec_layout.addWidget(self.cus_exec_combo) pyexec_group.setLayout(pyexec_layout) diff --git a/spyder/plugins/preferences/api.py b/spyder/plugins/preferences/api.py index 28a0aae3552..adf79d9a4e4 100644 --- a/spyder/plugins/preferences/api.py +++ b/spyder/plugins/preferences/api.py @@ -16,8 +16,8 @@ from qtpy import API from qtpy.compat import (getexistingdirectory, getopenfilename, from_qvariant, to_qvariant) -from qtpy.QtCore import Qt, Signal, Slot, QRegExp -from qtpy.QtGui import QColor, QRegExpValidator, QTextOption +from qtpy.QtCore import Qt, Signal, Slot, QRegExp, QSize +from qtpy.QtGui import QColor, QRegExpValidator, QTextOption, QPixmap from qtpy.QtWidgets import (QButtonGroup, QCheckBox, QComboBox, QDoubleSpinBox, QFileDialog, QFontComboBox, QGridLayout, QGroupBox, QHBoxLayout, QLabel, QLineEdit, QMessageBox, @@ -30,6 +30,7 @@ from spyder.config.user import NoDefault from spyder.py3compat import to_text_string from spyder.utils.icon_manager import ima +from spyder.utils.image_path_manager import get_image_path from spyder.utils.misc import getcwd_or_home from spyder.widgets.colors import ColorLayout from spyder.widgets.comboboxes import FileComboBox @@ -426,10 +427,23 @@ def has_been_modified(self, section, option): else: self.changed_options.add((section, option)) + def add_help_info_label(self, layout, help_info): + image_path = get_image_path('help') + image = QPixmap(image_path) + help_label = QLabel() + help_label.setPixmap(ima.icon('help').pixmap(QSize(16, 16))) + help_label.setToolTip(help_info) + layout.addWidget(help_label) + return layout + def create_checkbox(self, text, option, default=NoDefault, tip=None, msg_warning=None, msg_info=None, - msg_if_enabled=False, section=None, restart=False): + msg_if_enabled=False, section=None, restart=False, + help_info=None): + layout = QHBoxLayout() + layout.setContentsMargins(0, 0, 0, 0) checkbox = QCheckBox(text) + layout.addWidget(checkbox) self.checkboxes[checkbox] = (section, option, default) if section is not None and section != self.CONF_SECTION: self.cross_section_options[option] = section @@ -446,13 +460,21 @@ def show_message(is_checked=False): msg_info, QMessageBox.Ok) checkbox.clicked.connect(show_message) checkbox.restart_required = restart - return checkbox + if help_info: + layout = self.add_help_info_label(layout, help_info) + widget = QWidget(self) + widget.checkbox = checkbox + widget.setLayout(layout) + return widget def create_radiobutton(self, text, option, default=NoDefault, tip=None, msg_warning=None, msg_info=None, msg_if_enabled=False, button_group=None, - restart=False, section=None): + restart=False, section=None, help_info=None): + layout = QHBoxLayout() + layout.setContentsMargins(0, 0, 0, 0) radiobutton = QRadioButton(text) + layout.addWidget(radiobutton) if section is not None and section != self.CONF_SECTION: self.cross_section_options[option] = section if button_group is None: @@ -475,12 +497,17 @@ def show_message(is_checked): radiobutton.toggled.connect(show_message) radiobutton.restart_required = restart radiobutton.label_text = text - return radiobutton + if help_info: + layout = self.add_help_info_label(layout, help_info) + widget = QWidget(self) + widget.radiobutton = radiobutton + widget.setLayout(layout) + return widget def create_lineedit(self, text, option, default=NoDefault, tip=None, alignment=Qt.Vertical, regex=None, restart=False, word_wrap=True, placeholder=None, - content_type=None, section=None): + content_type=None, section=None, help_info=None): if section is not None and section != self.CONF_SECTION: self.cross_section_options[option] = section label = QLabel(text) @@ -498,6 +525,8 @@ def create_lineedit(self, text, option, default=NoDefault, if placeholder: edit.setPlaceholderText(placeholder) self.lineedits[edit] = (section, option, default) + if help_info: + layout = self.add_help_info_label(layout, help_info) widget = QWidget(self) widget.label = label widget.textbox = edit @@ -508,7 +537,7 @@ def create_lineedit(self, text, option, default=NoDefault, def create_textedit(self, text, option, default=NoDefault, tip=None, restart=False, content_type=None, - section=None): + section=None, help_info=None): if section is not None and section != self.CONF_SECTION: self.cross_section_options[option] = section label = QLabel(text) @@ -523,6 +552,8 @@ def create_textedit(self, text, option, default=NoDefault, if tip: edit.setToolTip(tip) self.textedits[edit] = (section, option, default) + if help_info: + layout = self.add_help_info_label(layout, help_info) widget = QWidget(self) widget.label = label widget.textbox = edit @@ -532,7 +563,7 @@ def create_textedit(self, text, option, default=NoDefault, return widget def create_browsedir(self, text, option, default=NoDefault, tip=None, - section=None): + section=None, help_info=None): widget = self.create_lineedit(text, option, default, section=section, alignment=Qt.Horizontal) for edit in self.lineedits: @@ -547,6 +578,8 @@ def create_browsedir(self, text, option, default=NoDefault, tip=None, layout.addWidget(widget) layout.addWidget(browse_btn) layout.setContentsMargins(0, 0, 0, 0) + if help_info: + layout = self.add_help_info_label(layout, help_info) browsedir = QWidget(self) browsedir.setLayout(layout) return browsedir @@ -562,7 +595,7 @@ def select_directory(self, edit): edit.setText(directory) def create_browsefile(self, text, option, default=NoDefault, tip=None, - filters=None, section=None): + filters=None, section=None, help_info=None): widget = self.create_lineedit(text, option, default, section=section, alignment=Qt.Horizontal) for edit in self.lineedits: @@ -577,6 +610,8 @@ def create_browsefile(self, text, option, default=NoDefault, tip=None, layout.addWidget(widget) layout.addWidget(browse_btn) layout.setContentsMargins(0, 0, 0, 0) + if help_info: + layout = self.add_help_info_label(layout, help_info) browsedir = QWidget(self) browsedir.setLayout(layout) return browsedir @@ -596,7 +631,7 @@ def select_file(self, edit, filters=None, **kwargs): def create_spinbox(self, prefix, suffix, option, default=NoDefault, min_=None, max_=None, step=None, tip=None, - section=None): + section=None, help_info=None): if section is not None and section != self.CONF_SECTION: self.cross_section_options[option] = section widget = QWidget(self) @@ -632,12 +667,14 @@ def create_spinbox(self, prefix, suffix, option, default=NoDefault, layout.addWidget(subwidget) layout.addStretch(1) layout.setContentsMargins(0, 0, 0, 0) + if help_info: + layout = self.add_help_info_label(layout, help_info) widget.spinbox = spinbox widget.setLayout(layout) return widget def create_coloredit(self, text, option, default=NoDefault, tip=None, - without_layout=False, section=None): + without_layout=False, section=None, help_info=None): if section is not None and section != self.CONF_SECTION: self.cross_section_options[option] = section label = QLabel(text) @@ -653,12 +690,14 @@ def create_coloredit(self, text, option, default=NoDefault, tip=None, layout.addLayout(clayout) layout.addStretch(1) layout.setContentsMargins(0, 0, 0, 0) + if help_info: + layout = self.add_help_info_label(layout, help_info) widget = QWidget(self) widget.setLayout(layout) return widget def create_scedit(self, text, option, default=NoDefault, tip=None, - without_layout=False, section=None): + without_layout=False, section=None, help_info=None): if section is not None and section != self.CONF_SECTION: self.cross_section_options[option] = section label = QLabel(text) @@ -684,12 +723,14 @@ def create_scedit(self, text, option, default=NoDefault, tip=None, layout.addWidget(cb_italic) layout.addStretch(1) layout.setContentsMargins(0, 0, 0, 0) + if help_info: + layout = self.add_help_info_label(layout, help_info) widget = QWidget(self) widget.setLayout(layout) return widget def create_combobox(self, text, choices, option, default=NoDefault, - tip=None, restart=False, section=None): + tip=None, restart=False, section=None, help_info=None): """choices: couples (name, key)""" if section is not None and section != self.CONF_SECTION: self.cross_section_options[option] = section @@ -713,6 +754,8 @@ def create_combobox(self, text, choices, option, default=NoDefault, layout.addWidget(combobox) layout.addStretch(1) layout.setContentsMargins(0, 0, 0, 0) + if help_info: + layout = self.add_help_info_label(layout, help_info) widget = QWidget(self) widget.label = label widget.combobox = combobox @@ -725,7 +768,7 @@ def create_file_combobox(self, text, choices, option, default=NoDefault, tip=None, restart=False, filters=None, adjust_to_contents=False, default_line_edit=False, section=None, - validate_callback=None): + validate_callback=None, help_info=None): """choices: couples (name, key)""" if section is not None and section != self.CONF_SECTION: self.cross_section_options[option] = section @@ -757,6 +800,8 @@ def create_file_combobox(self, text, choices, option, default=NoDefault, layout.addWidget(combobox, 0, 0, 0, 9) layout.addWidget(browse_btn, 0, 10) layout.setContentsMargins(0, 0, 0, 0) + if help_info: + layout = self.add_help_info_label(layout, help_info) widget = QWidget(self) widget.combobox = combobox widget.browse_btn = browse_btn @@ -765,7 +810,8 @@ def create_file_combobox(self, text, choices, option, default=NoDefault, return widget def create_fontgroup(self, option=None, text=None, title=None, - tip=None, fontfilters=None, without_group=False): + tip=None, fontfilters=None, without_group=False, + help_info=None): """Option=None -> setting plugin font""" if title: @@ -787,6 +833,9 @@ def create_fontgroup(self, option=None, text=None, title=None, layout.addWidget(subwidget) layout.addStretch(1) + if help_info: + layout = self.add_help_info_label(layout, help_info) + widget = QWidget(self) widget.fontlabel = fontlabel widget.sizelabel = sizelabel diff --git a/spyder/plugins/statusbar/confpage.py b/spyder/plugins/statusbar/confpage.py index 3119a1d0cc8..054e89633aa 100644 --- a/spyder/plugins/statusbar/confpage.py +++ b/spyder/plugins/statusbar/confpage.py @@ -26,14 +26,14 @@ def setup_page(self): tip=self.plugin.mem_status.toolTip()) memory_spin = self.create_spinbox("", _(" ms"), 'memory_usage/timeout', min_=100, max_=1000000, step=100) - memory_box.toggled.connect(memory_spin.setEnabled) + memory_box.checkbox.toggled.connect(memory_spin.setEnabled) memory_spin.setEnabled(self.get_option('memory_usage/enable')) cpu_box = newcb(_("Show CPU usage every"), 'cpu_usage/enable', tip=self.plugin.cpu_status.toolTip()) cpu_spin = self.create_spinbox("", _(" ms"), 'cpu_usage/timeout', min_=100, max_=1000000, step=100) - cpu_box.toggled.connect(cpu_spin.setEnabled) + cpu_box.checkbox.toggled.connect(cpu_spin.setEnabled) cpu_spin.setEnabled(self.get_option('cpu_usage/enable')) clock_box = newcb(_("Show clock"), 'clock/enable') diff --git a/spyder/plugins/variableexplorer/confpage.py b/spyder/plugins/variableexplorer/confpage.py index a2e7a8d0ecd..d047dda5f23 100644 --- a/spyder/plugins/variableexplorer/confpage.py +++ b/spyder/plugins/variableexplorer/confpage.py @@ -25,7 +25,9 @@ def setup_page(self): ('exclude_callables_and_modules', _("Exclude callables and modules")) ] - filter_boxes = [self.create_checkbox(text, option) + filter_boxes = [self.create_checkbox( + text, option, + help_info='Excludes variables that fit the description') for option, text in filter_data] display_group = QGroupBox(_("Display")) diff --git a/spyder/plugins/workingdirectory/confpage.py b/spyder/plugins/workingdirectory/confpage.py index 66133682a00..0112345ce9d 100644 --- a/spyder/plugins/workingdirectory/confpage.py +++ b/spyder/plugins/workingdirectory/confpage.py @@ -57,8 +57,8 @@ def setup_page(self): 'startup/fixed_directory', getcwd_or_home() ) - thisdir_radio.toggled.connect(thisdir_bd.setEnabled) - lastdir_radio.toggled.connect(thisdir_bd.setDisabled) + thisdir_radio.radiobutton.toggled.connect(thisdir_bd.setEnabled) + lastdir_radio.radiobutton.toggled.connect(thisdir_bd.setDisabled) thisdir_layout = QHBoxLayout() thisdir_layout.addWidget(thisdir_radio) thisdir_layout.addWidget(thisdir_bd) @@ -100,9 +100,9 @@ def setup_page(self): 'console/fixed_directory', getcwd_or_home() ) - console_dir_radio.toggled.connect(console_dir_bd.setEnabled) - console_project_radio.toggled.connect(console_dir_bd.setDisabled) - console_cwd_radio.toggled.connect(console_dir_bd.setDisabled) + console_dir_radio.radiobutton.toggled.connect(console_dir_bd.setEnabled) + console_project_radio.radiobutton.toggled.connect(console_dir_bd.setDisabled) + console_cwd_radio.radiobutton.toggled.connect(console_dir_bd.setDisabled) console_dir_layout = QHBoxLayout() console_dir_layout.addWidget(console_dir_radio) console_dir_layout.addWidget(console_dir_bd) From 73fc5638253cbdd36a1cf21a0e4299d1d14b7a3f Mon Sep 17 00:00:00 2001 From: jsbautista Date: Mon, 15 May 2023 14:43:07 -0500 Subject: [PATCH 02/17] Apply suggestions --- spyder/plugins/preferences/api.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/spyder/plugins/preferences/api.py b/spyder/plugins/preferences/api.py index adf79d9a4e4..f8d9d589d4c 100644 --- a/spyder/plugins/preferences/api.py +++ b/spyder/plugins/preferences/api.py @@ -427,9 +427,7 @@ def has_been_modified(self, section, option): else: self.changed_options.add((section, option)) - def add_help_info_label(self, layout, help_info): - image_path = get_image_path('help') - image = QPixmap(image_path) + def add_help_info_label(self, layout, help_info): help_label = QLabel() help_label.setPixmap(ima.icon('help').pixmap(QSize(16, 16))) help_label.setToolTip(help_info) From 882851e98ad304b85fd6c160c361b0bdb7ebbfb5 Mon Sep 17 00:00:00 2001 From: jsbautista Date: Tue, 23 May 2023 20:06:25 -0500 Subject: [PATCH 03/17] Apply suggestions --- spyder/plugins/preferences/api.py | 61 +++++++++++---------- spyder/plugins/variableexplorer/confpage.py | 5 +- 2 files changed, 35 insertions(+), 31 deletions(-) diff --git a/spyder/plugins/preferences/api.py b/spyder/plugins/preferences/api.py index f8d9d589d4c..2b5a156c1bd 100644 --- a/spyder/plugins/preferences/api.py +++ b/spyder/plugins/preferences/api.py @@ -22,7 +22,7 @@ QFileDialog, QFontComboBox, QGridLayout, QGroupBox, QHBoxLayout, QLabel, QLineEdit, QMessageBox, QPlainTextEdit, QPushButton, QRadioButton, - QSpinBox, QTabWidget, QVBoxLayout, QWidget) + QSpinBox, QTabWidget, QVBoxLayout, QWidget, QSizePolicy) # Local imports from spyder.config.base import _ @@ -427,9 +427,12 @@ def has_been_modified(self, section, option): else: self.changed_options.add((section, option)) - def add_help_info_label(self, layout, help_info): + def add_help_info_label(self, layout, help_info): help_label = QLabel() - help_label.setPixmap(ima.icon('help').pixmap(QSize(16, 16))) + image = ima.icon('help').pixmap(QSize(20, 20)) + help_label.setPixmap(image) + help_label.setFixedWidth(23) + help_label.setFixedHeight(23) help_label.setToolTip(help_info) layout.addWidget(help_label) return layout @@ -437,7 +440,7 @@ def add_help_info_label(self, layout, help_info): def create_checkbox(self, text, option, default=NoDefault, tip=None, msg_warning=None, msg_info=None, msg_if_enabled=False, section=None, restart=False, - help_info=None): + help_info=False): layout = QHBoxLayout() layout.setContentsMargins(0, 0, 0, 0) checkbox = QCheckBox(text) @@ -445,7 +448,7 @@ def create_checkbox(self, text, option, default=NoDefault, self.checkboxes[checkbox] = (section, option, default) if section is not None and section != self.CONF_SECTION: self.cross_section_options[option] = section - if tip is not None: + if tip is not None and not help_info: checkbox.setToolTip(tip) if msg_warning is not None or msg_info is not None: def show_message(is_checked=False): @@ -458,8 +461,8 @@ def show_message(is_checked=False): msg_info, QMessageBox.Ok) checkbox.clicked.connect(show_message) checkbox.restart_required = restart - if help_info: - layout = self.add_help_info_label(layout, help_info) + if help_info and tip is not None: + layout = self.add_help_info_label(layout, tip) widget = QWidget(self) widget.checkbox = checkbox widget.setLayout(layout) @@ -468,7 +471,7 @@ def show_message(is_checked=False): def create_radiobutton(self, text, option, default=NoDefault, tip=None, msg_warning=None, msg_info=None, msg_if_enabled=False, button_group=None, - restart=False, section=None, help_info=None): + restart=False, section=None, help_info=False): layout = QHBoxLayout() layout.setContentsMargins(0, 0, 0, 0) radiobutton = QRadioButton(text) @@ -496,7 +499,7 @@ def show_message(is_checked): radiobutton.restart_required = restart radiobutton.label_text = text if help_info: - layout = self.add_help_info_label(layout, help_info) + layout = self.add_help_info_label(layout, tip) widget = QWidget(self) widget.radiobutton = radiobutton widget.setLayout(layout) @@ -505,7 +508,7 @@ def show_message(is_checked): def create_lineedit(self, text, option, default=NoDefault, tip=None, alignment=Qt.Vertical, regex=None, restart=False, word_wrap=True, placeholder=None, - content_type=None, section=None, help_info=None): + content_type=None, section=None, help_info=False): if section is not None and section != self.CONF_SECTION: self.cross_section_options[option] = section label = QLabel(text) @@ -524,7 +527,7 @@ def create_lineedit(self, text, option, default=NoDefault, edit.setPlaceholderText(placeholder) self.lineedits[edit] = (section, option, default) if help_info: - layout = self.add_help_info_label(layout, help_info) + layout = self.add_help_info_label(layout, tip) widget = QWidget(self) widget.label = label widget.textbox = edit @@ -535,7 +538,7 @@ def create_lineedit(self, text, option, default=NoDefault, def create_textedit(self, text, option, default=NoDefault, tip=None, restart=False, content_type=None, - section=None, help_info=None): + section=None, help_info=False): if section is not None and section != self.CONF_SECTION: self.cross_section_options[option] = section label = QLabel(text) @@ -551,7 +554,7 @@ def create_textedit(self, text, option, default=NoDefault, edit.setToolTip(tip) self.textedits[edit] = (section, option, default) if help_info: - layout = self.add_help_info_label(layout, help_info) + layout = self.add_help_info_label(layout, tip) widget = QWidget(self) widget.label = label widget.textbox = edit @@ -561,7 +564,7 @@ def create_textedit(self, text, option, default=NoDefault, return widget def create_browsedir(self, text, option, default=NoDefault, tip=None, - section=None, help_info=None): + section=None, help_info=False): widget = self.create_lineedit(text, option, default, section=section, alignment=Qt.Horizontal) for edit in self.lineedits: @@ -577,7 +580,7 @@ def create_browsedir(self, text, option, default=NoDefault, tip=None, layout.addWidget(browse_btn) layout.setContentsMargins(0, 0, 0, 0) if help_info: - layout = self.add_help_info_label(layout, help_info) + layout = self.add_help_info_label(layout, tip) browsedir = QWidget(self) browsedir.setLayout(layout) return browsedir @@ -593,7 +596,7 @@ def select_directory(self, edit): edit.setText(directory) def create_browsefile(self, text, option, default=NoDefault, tip=None, - filters=None, section=None, help_info=None): + filters=None, section=None, help_info=False): widget = self.create_lineedit(text, option, default, section=section, alignment=Qt.Horizontal) for edit in self.lineedits: @@ -609,7 +612,7 @@ def create_browsefile(self, text, option, default=NoDefault, tip=None, layout.addWidget(browse_btn) layout.setContentsMargins(0, 0, 0, 0) if help_info: - layout = self.add_help_info_label(layout, help_info) + layout = self.add_help_info_label(layout, tip) browsedir = QWidget(self) browsedir.setLayout(layout) return browsedir @@ -629,7 +632,7 @@ def select_file(self, edit, filters=None, **kwargs): def create_spinbox(self, prefix, suffix, option, default=NoDefault, min_=None, max_=None, step=None, tip=None, - section=None, help_info=None): + section=None, help_info=False): if section is not None and section != self.CONF_SECTION: self.cross_section_options[option] = section widget = QWidget(self) @@ -666,13 +669,13 @@ def create_spinbox(self, prefix, suffix, option, default=NoDefault, layout.addStretch(1) layout.setContentsMargins(0, 0, 0, 0) if help_info: - layout = self.add_help_info_label(layout, help_info) + layout = self.add_help_info_label(layout, tip) widget.spinbox = spinbox widget.setLayout(layout) return widget def create_coloredit(self, text, option, default=NoDefault, tip=None, - without_layout=False, section=None, help_info=None): + without_layout=False, section=None, help_info=False): if section is not None and section != self.CONF_SECTION: self.cross_section_options[option] = section label = QLabel(text) @@ -689,13 +692,13 @@ def create_coloredit(self, text, option, default=NoDefault, tip=None, layout.addStretch(1) layout.setContentsMargins(0, 0, 0, 0) if help_info: - layout = self.add_help_info_label(layout, help_info) + layout = self.add_help_info_label(layout, tip) widget = QWidget(self) widget.setLayout(layout) return widget def create_scedit(self, text, option, default=NoDefault, tip=None, - without_layout=False, section=None, help_info=None): + without_layout=False, section=None, help_info=False): if section is not None and section != self.CONF_SECTION: self.cross_section_options[option] = section label = QLabel(text) @@ -722,13 +725,13 @@ def create_scedit(self, text, option, default=NoDefault, tip=None, layout.addStretch(1) layout.setContentsMargins(0, 0, 0, 0) if help_info: - layout = self.add_help_info_label(layout, help_info) + layout = self.add_help_info_label(layout, tip) widget = QWidget(self) widget.setLayout(layout) return widget def create_combobox(self, text, choices, option, default=NoDefault, - tip=None, restart=False, section=None, help_info=None): + tip=None, restart=False, section=None, help_info=False): """choices: couples (name, key)""" if section is not None and section != self.CONF_SECTION: self.cross_section_options[option] = section @@ -753,7 +756,7 @@ def create_combobox(self, text, choices, option, default=NoDefault, layout.addStretch(1) layout.setContentsMargins(0, 0, 0, 0) if help_info: - layout = self.add_help_info_label(layout, help_info) + layout = self.add_help_info_label(layout, tip) widget = QWidget(self) widget.label = label widget.combobox = combobox @@ -766,7 +769,7 @@ def create_file_combobox(self, text, choices, option, default=NoDefault, tip=None, restart=False, filters=None, adjust_to_contents=False, default_line_edit=False, section=None, - validate_callback=None, help_info=None): + validate_callback=None, help_info=False): """choices: couples (name, key)""" if section is not None and section != self.CONF_SECTION: self.cross_section_options[option] = section @@ -799,7 +802,7 @@ def create_file_combobox(self, text, choices, option, default=NoDefault, layout.addWidget(browse_btn, 0, 10) layout.setContentsMargins(0, 0, 0, 0) if help_info: - layout = self.add_help_info_label(layout, help_info) + layout = self.add_help_info_label(layout, tip) widget = QWidget(self) widget.combobox = combobox widget.browse_btn = browse_btn @@ -809,7 +812,7 @@ def create_file_combobox(self, text, choices, option, default=NoDefault, def create_fontgroup(self, option=None, text=None, title=None, tip=None, fontfilters=None, without_group=False, - help_info=None): + help_info=False): """Option=None -> setting plugin font""" if title: @@ -832,7 +835,7 @@ def create_fontgroup(self, option=None, text=None, title=None, layout.addStretch(1) if help_info: - layout = self.add_help_info_label(layout, help_info) + layout = self.add_help_info_label(layout, tip) widget = QWidget(self) widget.fontlabel = fontlabel diff --git a/spyder/plugins/variableexplorer/confpage.py b/spyder/plugins/variableexplorer/confpage.py index d047dda5f23..eb27b51ea1d 100644 --- a/spyder/plugins/variableexplorer/confpage.py +++ b/spyder/plugins/variableexplorer/confpage.py @@ -13,6 +13,7 @@ from spyder.config.base import _ from spyder.api.preferences import PluginConfigPage + class VariableExplorerConfigPage(PluginConfigPage): def setup_page(self): @@ -26,8 +27,8 @@ def setup_page(self): _("Exclude callables and modules")) ] filter_boxes = [self.create_checkbox( - text, option, - help_info='Excludes variables that fit the description') + text, option, help_info=True, + tip='Excludes variables that fit the description') for option, text in filter_data] display_group = QGroupBox(_("Display")) From ad5c01e3f7138f7b6972f37cffa4bc50429016f5 Mon Sep 17 00:00:00 2001 From: jsbautista Date: Tue, 23 May 2023 22:08:36 -0500 Subject: [PATCH 04/17] Apply suggestions --- spyder/plugins/application/confpage.py | 4 +++- spyder/plugins/completion/confpage.py | 5 +++-- spyder/plugins/preferences/api.py | 2 +- spyder/utils/icon_manager.py | 1 + 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/spyder/plugins/application/confpage.py b/spyder/plugins/application/confpage.py index 68b35850c9c..347151d7c5a 100644 --- a/spyder/plugins/application/confpage.py +++ b/spyder/plugins/application/confpage.py @@ -60,7 +60,8 @@ def setup_page(self): 'single_instance', tip=_("Set this to open external
" "Python files in an already running " - "instance (Requires a restart)")) + "instance (Requires a restart)"), + help_info=True) prompt_box = newcb(_("Prompt when exiting"), 'prompt_on_exit') popup_console_box = newcb(_("Show internal Spyder errors to report " @@ -187,6 +188,7 @@ def set_open_file(state): 'high_dpi_scaling', button_group=screen_resolution_bg, tip=_("Set this for high DPI displays"), + help_info=True, restart=True) custom_scaling_radio = self.create_radiobutton( diff --git a/spyder/plugins/completion/confpage.py b/spyder/plugins/completion/confpage.py index 2077ea51087..235f2791734 100644 --- a/spyder/plugins/completion/confpage.py +++ b/spyder/plugins/completion/confpage.py @@ -38,7 +38,8 @@ def setup_page(self): _("Time to wait for all providers to return (ms):"), None, 'completions_wait_for_ms', min_=0, max_=10000, step=10, tip=_("Beyond this timeout the first available provider " - "will be returned")) + "will be returned"), + help_info=True) completion_hint_box = newcb( _("Show completion details"), 'completions_hint', @@ -50,7 +51,7 @@ def setup_page(self): completions_after_characters = self.create_spinbox( _("Show automatic completions after characters entered:"), None, 'automatic_completions_after_chars', min_=1, step=1, - tip=_("Default is 1"), section='editor') + tip=_("Default is 1"), section='editor', help_info=True) code_snippets_box = newcb( _("Enable code snippets"), 'enable_code_snippets') completions_hint_after_idle = self.create_spinbox( diff --git a/spyder/plugins/preferences/api.py b/spyder/plugins/preferences/api.py index 2b5a156c1bd..d92073f0e6d 100644 --- a/spyder/plugins/preferences/api.py +++ b/spyder/plugins/preferences/api.py @@ -429,7 +429,7 @@ def has_been_modified(self, section, option): def add_help_info_label(self, layout, help_info): help_label = QLabel() - image = ima.icon('help').pixmap(QSize(20, 20)) + image = ima.icon('help_gray').pixmap(QSize(20, 20)) help_label.setPixmap(image) help_label.setFixedWidth(23) help_label.setFixedHeight(23) diff --git a/spyder/utils/icon_manager.py b/spyder/utils/icon_manager.py index b607097b1a8..c65dc9ded85 100644 --- a/spyder/utils/icon_manager.py +++ b/spyder/utils/icon_manager.py @@ -167,6 +167,7 @@ def __init__(self): 'pythonpath': [('spyder.python-logo-up', 'spyder.python-logo-down'), {'options': [{'color': SpyderPalette.PYTHON_LOGO_UP}, {'color': SpyderPalette.PYTHON_LOGO_DOWN}]}], 'findf': [('mdi.file-find',), {'color': self.MAIN_FG_COLOR}], 'history': [('mdi.history',), {'color': self.MAIN_FG_COLOR}], + 'help_gray': [('mdi.help-circle-outline',), {'color': SpyderPalette.COLOR_OCCURRENCE_4}], 'help': [('mdi.help-circle',), {'color': self.MAIN_FG_COLOR}], 'lock': [('mdi.lock',), {'color': self.MAIN_FG_COLOR}], 'lock_open': [('mdi.lock-open',), {'color': self.MAIN_FG_COLOR}], From f71a31c0ab0d63a25a2db35d1109bd7291969517 Mon Sep 17 00:00:00 2001 From: jsbautista Date: Mon, 5 Jun 2023 09:55:32 -0500 Subject: [PATCH 05/17] Apply suggestions --- spyder/plugins/preferences/api.py | 1 + 1 file changed, 1 insertion(+) diff --git a/spyder/plugins/preferences/api.py b/spyder/plugins/preferences/api.py index d92073f0e6d..5854eadac3d 100644 --- a/spyder/plugins/preferences/api.py +++ b/spyder/plugins/preferences/api.py @@ -435,6 +435,7 @@ def add_help_info_label(self, layout, help_info): help_label.setFixedHeight(23) help_label.setToolTip(help_info) layout.addWidget(help_label) + layout.addStretch(1) return layout def create_checkbox(self, text, option, default=NoDefault, From accf5fb332097d0fa0a147db7dd48b427ef0ba5a Mon Sep 17 00:00:00 2001 From: jsbautista Date: Mon, 5 Jun 2023 10:12:53 -0500 Subject: [PATCH 06/17] Apply suggestions --- spyder/plugins/preferences/api.py | 73 +++++++++++++++++-------------- 1 file changed, 40 insertions(+), 33 deletions(-) diff --git a/spyder/plugins/preferences/api.py b/spyder/plugins/preferences/api.py index 5854eadac3d..03d46368a2b 100644 --- a/spyder/plugins/preferences/api.py +++ b/spyder/plugins/preferences/api.py @@ -449,8 +449,6 @@ def create_checkbox(self, text, option, default=NoDefault, self.checkboxes[checkbox] = (section, option, default) if section is not None and section != self.CONF_SECTION: self.cross_section_options[option] = section - if tip is not None and not help_info: - checkbox.setToolTip(tip) if msg_warning is not None or msg_info is not None: def show_message(is_checked=False): if is_checked or not msg_if_enabled: @@ -462,8 +460,11 @@ def show_message(is_checked=False): msg_info, QMessageBox.Ok) checkbox.clicked.connect(show_message) checkbox.restart_required = restart - if help_info and tip is not None: - layout = self.add_help_info_label(layout, tip) + if tip is not None: + if help_info: + layout = self.add_help_info_label(layout, tip) + else: + checkbox.setToolTip(tip) widget = QWidget(self) widget.checkbox = checkbox widget.setLayout(layout) @@ -485,7 +486,10 @@ def create_radiobutton(self, text, option, default=NoDefault, button_group = self.default_button_group button_group.addButton(radiobutton) if tip is not None: - radiobutton.setToolTip(tip) + if help_info: + layout = self.add_help_info_label(layout, tip) + else: + radiobutton.setToolTip(tip) self.radiobuttons[radiobutton] = (section, option, default) if msg_warning is not None or msg_info is not None: def show_message(is_checked): @@ -499,8 +503,6 @@ def show_message(is_checked): radiobutton.toggled.connect(show_message) radiobutton.restart_required = restart radiobutton.label_text = text - if help_info: - layout = self.add_help_info_label(layout, tip) widget = QWidget(self) widget.radiobutton = radiobutton widget.setLayout(layout) @@ -659,9 +661,7 @@ def create_spinbox(self, prefix, suffix, option, default=NoDefault, if min_ is not None: spinbox.setMinimum(min_) if max_ is not None: - spinbox.setMaximum(max_) - if tip is not None: - spinbox.setToolTip(tip) + spinbox.setMaximum(max_) self.spinboxes[spinbox] = (section, option, default) layout = QHBoxLayout() for subwidget in (plabel, spinbox, slabel): @@ -669,8 +669,11 @@ def create_spinbox(self, prefix, suffix, option, default=NoDefault, layout.addWidget(subwidget) layout.addStretch(1) layout.setContentsMargins(0, 0, 0, 0) - if help_info: - layout = self.add_help_info_label(layout, tip) + if tip is not None: + if help_info: + layout = self.add_help_info_label(layout, tip) + else: + spinbox.setToolTip(tip) widget.spinbox = spinbox widget.setLayout(layout) return widget @@ -682,8 +685,6 @@ def create_coloredit(self, text, option, default=NoDefault, tip=None, label = QLabel(text) clayout = ColorLayout(QColor(Qt.black), self) clayout.lineedit.setMaximumWidth(80) - if tip is not None: - clayout.setToolTip(tip) self.coloredits[clayout] = (section, option, default) if without_layout: return label, clayout @@ -692,8 +693,11 @@ def create_coloredit(self, text, option, default=NoDefault, tip=None, layout.addLayout(clayout) layout.addStretch(1) layout.setContentsMargins(0, 0, 0, 0) - if help_info: - layout = self.add_help_info_label(layout, tip) + if tip is not None: + if help_info: + layout = self.add_help_info_label(layout, tip) + else: + clayout.setToolTip(tip) widget = QWidget(self) widget.setLayout(layout) return widget @@ -705,8 +709,6 @@ def create_scedit(self, text, option, default=NoDefault, tip=None, label = QLabel(text) clayout = ColorLayout(QColor(Qt.black), self) clayout.lineedit.setMaximumWidth(80) - if tip is not None: - clayout.setToolTip(tip) cb_bold = QCheckBox() cb_bold.setIcon(ima.icon('bold')) cb_bold.setToolTip(_("Bold")) @@ -725,8 +727,11 @@ def create_scedit(self, text, option, default=NoDefault, tip=None, layout.addWidget(cb_italic) layout.addStretch(1) layout.setContentsMargins(0, 0, 0, 0) - if help_info: - layout = self.add_help_info_label(layout, tip) + if tip is not None: + if help_info: + layout = self.add_help_info_label(layout, tip) + else: + clayout.setToolTip(tip) widget = QWidget(self) widget.setLayout(layout) return widget @@ -738,8 +743,6 @@ def create_combobox(self, text, choices, option, default=NoDefault, self.cross_section_options[option] = section label = QLabel(text) combobox = QComboBox() - if tip is not None: - combobox.setToolTip(tip) for name, key in choices: if not (name is None and key is None): combobox.addItem(name, to_qvariant(key)) @@ -756,8 +759,11 @@ def create_combobox(self, text, choices, option, default=NoDefault, layout.addWidget(combobox) layout.addStretch(1) layout.setContentsMargins(0, 0, 0, 0) - if help_info: - layout = self.add_help_info_label(layout, tip) + if tip is not None: + if help_info: + layout = self.add_help_info_label(layout, tip) + else: + combobox.setToolTip(tip) widget = QWidget(self) widget.label = label widget.combobox = combobox @@ -782,9 +788,6 @@ def create_file_combobox(self, text, choices, option, default=NoDefault, edit.label_text = text edit.restart_required = restart self.lineedits[edit] = (section, option, default) - - if tip is not None: - combobox.setToolTip(tip) combobox.addItems(choices) combobox.choices = choices @@ -801,9 +804,12 @@ def create_file_combobox(self, text, choices, option, default=NoDefault, layout = QGridLayout() layout.addWidget(combobox, 0, 0, 0, 9) layout.addWidget(browse_btn, 0, 10) - layout.setContentsMargins(0, 0, 0, 0) - if help_info: - layout = self.add_help_info_label(layout, tip) + layout.setContentsMargins(0, 0, 0, 0) + if tip is not None: + if help_info: + layout = self.add_help_info_label(layout, tip) + else: + combobox.setToolTip(tip) widget = QWidget(self) widget.combobox = combobox widget.browse_btn = browse_btn @@ -835,8 +841,6 @@ def create_fontgroup(self, option=None, text=None, title=None, layout.addWidget(subwidget) layout.addStretch(1) - if help_info: - layout = self.add_help_info_label(layout, tip) widget = QWidget(self) widget.fontlabel = fontlabel @@ -853,7 +857,10 @@ def create_fontgroup(self, option=None, text=None, title=None, group.setLayout(layout) if tip is not None: - group.setToolTip(tip) + if help_info: + layout = self.add_help_info_label(layout, tip) + else: + group.setToolTip(tip) return group else: From 0e8111b76f00403d3387d43705515bf01bcf2d57 Mon Sep 17 00:00:00 2001 From: jsbautista Date: Mon, 26 Jun 2023 09:56:51 -0500 Subject: [PATCH 07/17] Apply suggestions --- spyder/plugins/externalconsole/widgets/run_conf.py | 4 ++-- spyder/plugins/ipythonconsole/widgets/config.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/spyder/plugins/externalconsole/widgets/run_conf.py b/spyder/plugins/externalconsole/widgets/run_conf.py index 3180f1fa105..273124b0382 100644 --- a/spyder/plugins/externalconsole/widgets/run_conf.py +++ b/spyder/plugins/externalconsole/widgets/run_conf.py @@ -62,7 +62,7 @@ def __init__(self, parent, context: Context, input_extension: str, self.pclo_cb = QCheckBox(_("Command line options:")) external_layout.addWidget(self.pclo_cb, 3, 0) self.pclo_edit = QLineEdit() - self.pclo_cb.checkbox.toggled.connect(self.pclo_edit.setEnabled) + self.pclo_cb.toggled.connect(self.pclo_edit.setEnabled) self.pclo_edit.setEnabled(False) self.pclo_edit.setToolTip(_("-u<_b> is added to the " "other options you set here")) @@ -78,7 +78,7 @@ def __init__(self, parent, context: Context, input_extension: str, self.clo_cb = QCheckBox(_("Command line options:")) common_layout.addWidget(self.clo_cb, 0, 0) self.clo_edit = QLineEdit() - self.clo_cb.checkbox.toggled.connect(self.clo_edit.setEnabled) + self.clo_cb.toggled.connect(self.clo_edit.setEnabled) self.clo_edit.setEnabled(False) common_layout.addWidget(self.clo_edit, 0, 1) diff --git a/spyder/plugins/ipythonconsole/widgets/config.py b/spyder/plugins/ipythonconsole/widgets/config.py index 92c729dadf6..bcd2bfdfa60 100644 --- a/spyder/plugins/ipythonconsole/widgets/config.py +++ b/spyder/plugins/ipythonconsole/widgets/config.py @@ -74,7 +74,7 @@ def __init__(self, parent, context: Context, input_extension: str, self.clo_cb = QCheckBox(_("Command line options:")) common_layout.addWidget(self.clo_cb, 3, 0) self.clo_edit = QLineEdit() - self.clo_cb.checkbox.toggled.connect(self.clo_edit.setEnabled) + self.clo_cb.toggled.connect(self.clo_edit.setEnabled) self.clo_edit.setEnabled(False) common_layout.addWidget(self.clo_edit, 3, 1) From fc34ae08288e0239832a400a8684b81beddceb40 Mon Sep 17 00:00:00 2001 From: jsbautista Date: Mon, 26 Jun 2023 11:08:15 -0500 Subject: [PATCH 08/17] Apply suggestions --- spyder/app/tests/test_mainwindow.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spyder/app/tests/test_mainwindow.py b/spyder/app/tests/test_mainwindow.py index 6e1192383f8..f07957539be 100644 --- a/spyder/app/tests/test_mainwindow.py +++ b/spyder/app/tests/test_mainwindow.py @@ -3148,7 +3148,7 @@ def test_preferences_change_interpreter(qtbot, main_window): # Change main interpreter on preferences dlg, index, page = preferences_dialog_helper(qtbot, main_window, 'main_interpreter') - page.cus_exec_radio.setChecked(True) + page.cus_exec_radio.radiobutton.setChecked(True) page.cus_exec_combo.combobox.setCurrentText(sys.executable) mi_container = main_window.main_interpreter.get_container() From 3978d61bdfdc88445124d631f67c6d402ffbd8a7 Mon Sep 17 00:00:00 2001 From: jsbautista Date: Mon, 26 Jun 2023 12:19:14 -0500 Subject: [PATCH 09/17] Apply suggestions --- spyder/plugins/externalconsole/widgets/run_conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spyder/plugins/externalconsole/widgets/run_conf.py b/spyder/plugins/externalconsole/widgets/run_conf.py index 273124b0382..56c63f814ae 100644 --- a/spyder/plugins/externalconsole/widgets/run_conf.py +++ b/spyder/plugins/externalconsole/widgets/run_conf.py @@ -162,7 +162,7 @@ def __init__( self.interpreter_opts_cb = QCheckBox(_("Interpreter arguments:")) interpreter_layout.addWidget(self.interpreter_opts_cb, 1, 0) self.interpreter_opts_edit = QLineEdit() - self.interpreter_opts_cb.checkbox.toggled.connect( + self.interpreter_opts_cb.toggled.connect( self.interpreter_opts_edit.setEnabled) self.interpreter_opts_edit.setEnabled(False) interpreter_layout.addWidget(self.interpreter_opts_edit, 1, 1) From 7583ca80132c5189cbed227c113d0f433d1d2b8b Mon Sep 17 00:00:00 2001 From: jsbautista Date: Mon, 26 Jun 2023 13:03:43 -0500 Subject: [PATCH 10/17] Apply suggestions --- spyder/plugins/externalconsole/widgets/run_conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spyder/plugins/externalconsole/widgets/run_conf.py b/spyder/plugins/externalconsole/widgets/run_conf.py index 56c63f814ae..cab8e225132 100644 --- a/spyder/plugins/externalconsole/widgets/run_conf.py +++ b/spyder/plugins/externalconsole/widgets/run_conf.py @@ -174,7 +174,7 @@ def __init__( self.script_opts_cb = QCheckBox(_("Script arguments:")) script_layout.addWidget(self.script_opts_cb, 1, 0) self.script_opts_edit = QLineEdit() - self.script_opts_cb.checkbox.toggled.connect( + self.script_opts_cb.toggled.connect( self.script_opts_edit.setEnabled) self.script_opts_edit.setEnabled(False) script_layout.addWidget(self.script_opts_edit, 1, 1) From 0bb5811e5283bf9bd3f42a570927d80adead3f47 Mon Sep 17 00:00:00 2001 From: jsbautista Date: Mon, 26 Jun 2023 14:04:41 -0500 Subject: [PATCH 11/17] Apply suggestions --- spyder/app/tests/test_mainwindow.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spyder/app/tests/test_mainwindow.py b/spyder/app/tests/test_mainwindow.py index f07957539be..37e8f0116dd 100644 --- a/spyder/app/tests/test_mainwindow.py +++ b/spyder/app/tests/test_mainwindow.py @@ -2974,7 +2974,7 @@ def test_preferences_checkboxes_not_checked_regression(main_window, qtbot): check_name = tab_widgets[tabname] check = getattr(tab, check_name) page.tabs.setCurrentIndex(idx) - check.animateClick() + check.checkbox.animateClick() qtbot.wait(500) dlg.ok_btn.animateClick() From 3b3b399c0edf6adb10325afdb5012a22755e4e59 Mon Sep 17 00:00:00 2001 From: jsbautista Date: Tue, 4 Jul 2023 09:12:04 -0500 Subject: [PATCH 12/17] Apply suggestions --- spyder/plugins/application/confpage.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spyder/plugins/application/confpage.py b/spyder/plugins/application/confpage.py index 347151d7c5a..39147dc5845 100644 --- a/spyder/plugins/application/confpage.py +++ b/spyder/plugins/application/confpage.py @@ -154,7 +154,7 @@ def set_open_file(state): _("Open files from Finder with Spyder"), 'mac_open_file', tip=_("Register Spyder with the Launch Services")) - mac_open_file_box.toggled.connect(set_open_file) + mac_open_file_box.checkbox.toggled.connect(set_open_file) macOS_layout = QVBoxLayout() macOS_layout.addWidget(mac_open_file_box) if als.get_bundle_identifier() is None: From 226dbe1b23e955ec29875de9b929d3db0f1fbb75 Mon Sep 17 00:00:00 2001 From: jsbautista Date: Thu, 6 Jul 2023 20:57:40 -0500 Subject: [PATCH 13/17] Apply suggestions --- spyder/plugins/appearance/confpage.py | 6 +++--- spyder/plugins/application/confpage.py | 4 +--- spyder/plugins/completion/confpage.py | 5 ++--- spyder/plugins/preferences/api.py | 24 ++++++++++----------- spyder/plugins/variableexplorer/confpage.py | 2 +- 5 files changed, 19 insertions(+), 22 deletions(-) diff --git a/spyder/plugins/appearance/confpage.py b/spyder/plugins/appearance/confpage.py index bc072c7fb41..bbd8c6b9b5b 100644 --- a/spyder/plugins/appearance/confpage.py +++ b/spyder/plugins/appearance/confpage.py @@ -181,7 +181,7 @@ def setup_page(self): self.delete_button.clicked.connect(self.delete_scheme) self.schemes_combobox.currentIndexChanged.connect(self.update_preview) self.schemes_combobox.currentIndexChanged.connect(self.update_buttons) - system_font_checkbox.stateChanged.connect(self.update_app_font_group) + system_font_checkbox.checkbox.stateChanged.connect(self.update_app_font_group) # Setup for name in names: @@ -191,8 +191,8 @@ def setup_page(self): self.scheme_editor_dialog.add_color_scheme_stack(name, custom=True) if sys.platform == 'darwin': - system_font_checkbox.setEnabled(False) - self.update_app_font_group(system_font_checkbox.isChecked()) + system_font_checkbox.checkbox.setEnabled(False) + self.update_app_font_group(system_font_checkbox.checkbox.isChecked()) self.update_combobox() self.update_preview() diff --git a/spyder/plugins/application/confpage.py b/spyder/plugins/application/confpage.py index 39147dc5845..1c47c4825e2 100644 --- a/spyder/plugins/application/confpage.py +++ b/spyder/plugins/application/confpage.py @@ -60,8 +60,7 @@ def setup_page(self): 'single_instance', tip=_("Set this to open external
" "Python files in an already running " - "instance (Requires a restart)"), - help_info=True) + "instance (Requires a restart)")) prompt_box = newcb(_("Prompt when exiting"), 'prompt_on_exit') popup_console_box = newcb(_("Show internal Spyder errors to report " @@ -188,7 +187,6 @@ def set_open_file(state): 'high_dpi_scaling', button_group=screen_resolution_bg, tip=_("Set this for high DPI displays"), - help_info=True, restart=True) custom_scaling_radio = self.create_radiobutton( diff --git a/spyder/plugins/completion/confpage.py b/spyder/plugins/completion/confpage.py index 235f2791734..2077ea51087 100644 --- a/spyder/plugins/completion/confpage.py +++ b/spyder/plugins/completion/confpage.py @@ -38,8 +38,7 @@ def setup_page(self): _("Time to wait for all providers to return (ms):"), None, 'completions_wait_for_ms', min_=0, max_=10000, step=10, tip=_("Beyond this timeout the first available provider " - "will be returned"), - help_info=True) + "will be returned")) completion_hint_box = newcb( _("Show completion details"), 'completions_hint', @@ -51,7 +50,7 @@ def setup_page(self): completions_after_characters = self.create_spinbox( _("Show automatic completions after characters entered:"), None, 'automatic_completions_after_chars', min_=1, step=1, - tip=_("Default is 1"), section='editor', help_info=True) + tip=_("Default is 1"), section='editor') code_snippets_box = newcb( _("Enable code snippets"), 'enable_code_snippets') completions_hint_after_idle = self.create_spinbox( diff --git a/spyder/plugins/preferences/api.py b/spyder/plugins/preferences/api.py index 98d96864033..1421f6ab03a 100644 --- a/spyder/plugins/preferences/api.py +++ b/spyder/plugins/preferences/api.py @@ -455,7 +455,7 @@ def add_help_info_label(self, layout, help_info): def create_checkbox(self, text, option, default=NoDefault, tip=None, msg_warning=None, msg_info=None, msg_if_enabled=False, section=None, restart=False, - help_info=False): + help_info=True): layout = QHBoxLayout() layout.setContentsMargins(0, 0, 0, 0) checkbox = QCheckBox(text) @@ -487,7 +487,7 @@ def show_message(is_checked=False): def create_radiobutton(self, text, option, default=NoDefault, tip=None, msg_warning=None, msg_info=None, msg_if_enabled=False, button_group=None, - restart=False, section=None, help_info=False): + restart=False, section=None, help_info=True): layout = QHBoxLayout() layout.setContentsMargins(0, 0, 0, 0) radiobutton = QRadioButton(text) @@ -525,7 +525,7 @@ def show_message(is_checked): def create_lineedit(self, text, option, default=NoDefault, tip=None, alignment=Qt.Vertical, regex=None, restart=False, word_wrap=True, placeholder=None, - content_type=None, section=None, help_info=False): + content_type=None, section=None, help_info=True): if section is not None and section != self.CONF_SECTION: self.cross_section_options[option] = section label = QLabel(text) @@ -555,7 +555,7 @@ def create_lineedit(self, text, option, default=NoDefault, def create_textedit(self, text, option, default=NoDefault, tip=None, restart=False, content_type=None, - section=None, help_info=False): + section=None, help_info=True): if section is not None and section != self.CONF_SECTION: self.cross_section_options[option] = section label = QLabel(text) @@ -581,7 +581,7 @@ def create_textedit(self, text, option, default=NoDefault, return widget def create_browsedir(self, text, option, default=NoDefault, tip=None, - section=None, help_info=False): + section=None, help_info=True): widget = self.create_lineedit(text, option, default, section=section, alignment=Qt.Horizontal) for edit in self.lineedits: @@ -613,7 +613,7 @@ def select_directory(self, edit): edit.setText(directory) def create_browsefile(self, text, option, default=NoDefault, tip=None, - filters=None, section=None, help_info=False): + filters=None, section=None, help_info=True): widget = self.create_lineedit(text, option, default, section=section, alignment=Qt.Horizontal) for edit in self.lineedits: @@ -649,7 +649,7 @@ def select_file(self, edit, filters=None, **kwargs): def create_spinbox(self, prefix, suffix, option, default=NoDefault, min_=None, max_=None, step=None, tip=None, - section=None, help_info=False): + section=None, help_info=True): if section is not None and section != self.CONF_SECTION: self.cross_section_options[option] = section widget = QWidget(self) @@ -693,7 +693,7 @@ def create_spinbox(self, prefix, suffix, option, default=NoDefault, return widget def create_coloredit(self, text, option, default=NoDefault, tip=None, - without_layout=False, section=None, help_info=False): + without_layout=False, section=None, help_info=True): if section is not None and section != self.CONF_SECTION: self.cross_section_options[option] = section label = QLabel(text) @@ -717,7 +717,7 @@ def create_coloredit(self, text, option, default=NoDefault, tip=None, return widget def create_scedit(self, text, option, default=NoDefault, tip=None, - without_layout=False, section=None, help_info=False): + without_layout=False, section=None, help_info=True): if section is not None and section != self.CONF_SECTION: self.cross_section_options[option] = section label = QLabel(text) @@ -751,7 +751,7 @@ def create_scedit(self, text, option, default=NoDefault, tip=None, return widget def create_combobox(self, text, choices, option, default=NoDefault, - tip=None, restart=False, section=None, help_info=False): + tip=None, restart=False, section=None, help_info=True): """choices: couples (name, key)""" if section is not None and section != self.CONF_SECTION: self.cross_section_options[option] = section @@ -790,7 +790,7 @@ def create_file_combobox(self, text, choices, option, default=NoDefault, tip=None, restart=False, filters=None, adjust_to_contents=False, default_line_edit=False, section=None, - validate_callback=None, help_info=False): + validate_callback=None, help_info=True): """choices: couples (name, key)""" if section is not None and section != self.CONF_SECTION: self.cross_section_options[option] = section @@ -833,7 +833,7 @@ def create_file_combobox(self, text, choices, option, default=NoDefault, def create_fontgroup(self, option=None, text=None, title=None, tip=None, fontfilters=None, without_group=False, - help_info=False, restart=False): + help_info=True, restart=False): """Option=None -> setting plugin font""" if title: diff --git a/spyder/plugins/variableexplorer/confpage.py b/spyder/plugins/variableexplorer/confpage.py index eb27b51ea1d..7b2e8693549 100644 --- a/spyder/plugins/variableexplorer/confpage.py +++ b/spyder/plugins/variableexplorer/confpage.py @@ -27,7 +27,7 @@ def setup_page(self): _("Exclude callables and modules")) ] filter_boxes = [self.create_checkbox( - text, option, help_info=True, + text, option, tip='Excludes variables that fit the description') for option, text in filter_data] From fd2032d6afbf651583d2659d32add6d59d46cdb6 Mon Sep 17 00:00:00 2001 From: dalthviz Date: Fri, 14 Jul 2023 16:24:28 -0500 Subject: [PATCH 14/17] Fix some layout issues with the help label --- spyder/plugins/application/confpage.py | 23 ++++-- spyder/plugins/completion/confpage.py | 7 +- spyder/plugins/ipythonconsole/confpage.py | 2 + spyder/plugins/preferences/api.py | 97 +++++++++++++---------- 4 files changed, 78 insertions(+), 51 deletions(-) diff --git a/spyder/plugins/application/confpage.py b/spyder/plugins/application/confpage.py index 1c47c4825e2..67ab45f22f9 100644 --- a/spyder/plugins/application/confpage.py +++ b/spyder/plugins/application/confpage.py @@ -207,10 +207,12 @@ def set_open_file(state): regex=r"[0-9]+(?:\.[0-9]*)(;[0-9]+(?:\.[0-9]*))*", restart=True) - normal_radio.radiobutton.toggled.connect(self.custom_scaling_edit.setDisabled) - auto_scale_radio.radiobutton.toggled.connect(self.custom_scaling_edit.setDisabled) + normal_radio.radiobutton.toggled.connect( + self.custom_scaling_edit.textbox.setDisabled) + auto_scale_radio.radiobutton.toggled.connect( + self.custom_scaling_edit.textbox.setDisabled) custom_scaling_radio.radiobutton.toggled.connect( - self.custom_scaling_edit.setEnabled) + self.custom_scaling_edit.textbox.setEnabled) # Layout Screen resolution screen_resolution_layout = QVBoxLayout() @@ -218,10 +220,19 @@ def set_open_file(state): screen_resolution_inner_layout = QGridLayout() screen_resolution_inner_layout.addWidget(normal_radio, 0, 0) - screen_resolution_inner_layout.addWidget(auto_scale_radio, 1, 0) - screen_resolution_inner_layout.addWidget(custom_scaling_radio, 2, 0) screen_resolution_inner_layout.addWidget( - self.custom_scaling_edit, 2, 1) + auto_scale_radio.radiobutton, 1, 0) + screen_resolution_inner_layout.addWidget( + auto_scale_radio.radiobutton.help_label, 1, 1) + screen_resolution_inner_layout.addWidget( + custom_scaling_radio.radiobutton, 2, 0) + screen_resolution_inner_layout.addWidget( + custom_scaling_radio.radiobutton.help_label, 2, 1) + screen_resolution_inner_layout.addWidget( + self.custom_scaling_edit.textbox, 2, 2) + screen_resolution_inner_layout.addWidget( + self.custom_scaling_edit.help_label, 2, 3) + screen_resolution_inner_layout.setColumnStretch(2, 1) screen_resolution_layout.addLayout(screen_resolution_inner_layout) screen_resolution_group.setLayout(screen_resolution_layout) diff --git a/spyder/plugins/completion/confpage.py b/spyder/plugins/completion/confpage.py index 2077ea51087..1ff6ff239c2 100644 --- a/spyder/plugins/completion/confpage.py +++ b/spyder/plugins/completion/confpage.py @@ -67,11 +67,16 @@ def setup_page(self): completions_layout.addWidget(completions_after_characters.plabel, 3, 0) completions_layout.addWidget( completions_after_characters.spinbox, 3, 1) + completions_layout.addWidget( + completions_after_characters.help_label, 3, 2) completions_layout.addWidget(completions_hint_after_idle.plabel, 5, 0) completions_layout.addWidget(completions_hint_after_idle.spinbox, 5, 1) + completions_layout.addWidget( + completions_hint_after_idle.help_label, 5, 2) completions_layout.addWidget(completions_wait_for_ms.plabel, 6, 0) completions_layout.addWidget(completions_wait_for_ms.spinbox, 6, 1) - completions_layout.setColumnStretch(2, 6) + completions_layout.addWidget(completions_wait_for_ms.help_label, 6, 2) + completions_layout.setColumnStretch(3, 6) self.completions_group.setLayout(completions_layout) def disable_completion_after_characters(state): diff --git a/spyder/plugins/ipythonconsole/confpage.py b/spyder/plugins/ipythonconsole/confpage.py index 1231c7b44d7..19f37b029e3 100644 --- a/spyder/plugins/ipythonconsole/confpage.py +++ b/spyder/plugins/ipythonconsole/confpage.py @@ -338,8 +338,10 @@ def setup_page(self): prompts_g_layout = QGridLayout() prompts_g_layout.addWidget(in_prompt_edit.label, 0, 0) prompts_g_layout.addWidget(in_prompt_edit.textbox, 0, 1) + prompts_g_layout.addWidget(in_prompt_edit.help_label, 0, 2) prompts_g_layout.addWidget(out_prompt_edit.label, 1, 0) prompts_g_layout.addWidget(out_prompt_edit.textbox, 1, 1) + prompts_g_layout.addWidget(out_prompt_edit.help_label, 1, 2) prompts_layout.addLayout(prompts_g_layout) prompts_group.setLayout(prompts_layout) diff --git a/spyder/plugins/preferences/api.py b/spyder/plugins/preferences/api.py index 1421f6ab03a..dc18598fa40 100644 --- a/spyder/plugins/preferences/api.py +++ b/spyder/plugins/preferences/api.py @@ -449,8 +449,9 @@ def add_help_info_label(self, layout, help_info): help_label.setFixedHeight(23) help_label.setToolTip(help_info) layout.addWidget(help_label) - layout.addStretch(1) - return layout + layout.addStretch(100) + + return layout, help_label def create_checkbox(self, text, option, default=NoDefault, tip=None, msg_warning=None, msg_info=None, @@ -474,13 +475,14 @@ def show_message(is_checked=False): msg_info, QMessageBox.Ok) checkbox.clicked.connect(show_message) checkbox.restart_required = restart + widget = QWidget(self) + widget.checkbox = checkbox if tip is not None: if help_info: - layout = self.add_help_info_label(layout, tip) + layout, help_label = self.add_help_info_label(layout, tip) + widget.help_label = help_label else: checkbox.setToolTip(tip) - widget = QWidget(self) - widget.checkbox = checkbox widget.setLayout(layout) return widget @@ -499,11 +501,6 @@ def create_radiobutton(self, text, option, default=NoDefault, self.default_button_group = QButtonGroup(self) button_group = self.default_button_group button_group.addButton(radiobutton) - if tip is not None: - if help_info: - layout = self.add_help_info_label(layout, tip) - else: - radiobutton.setToolTip(tip) self.radiobuttons[radiobutton] = (section, option, default) if msg_warning is not None or msg_info is not None: def show_message(is_checked): @@ -517,6 +514,12 @@ def show_message(is_checked): radiobutton.toggled.connect(show_message) radiobutton.restart_required = restart radiobutton.label_text = text + if tip is not None: + if help_info: + layout, help_label = self.add_help_info_label(layout, tip) + radiobutton.help_label = help_label + else: + radiobutton.setToolTip(tip) widget = QWidget(self) widget.radiobutton = radiobutton widget.setLayout(layout) @@ -536,18 +539,20 @@ def create_lineedit(self, text, option, default=NoDefault, layout.addWidget(label) layout.addWidget(edit) layout.setContentsMargins(0, 0, 0, 0) - if tip: - edit.setToolTip(tip) if regex: edit.setValidator(QRegExpValidator(QRegExp(regex))) if placeholder: edit.setPlaceholderText(placeholder) self.lineedits[edit] = (section, option, default) - if help_info: - layout = self.add_help_info_label(layout, tip) widget = QWidget(self) widget.label = label widget.textbox = edit + if tip: + if help_info: + layout, help_label = self.add_help_info_label(layout, tip) + widget.help_label = help_label + else: + edit.setToolTip(tip) widget.setLayout(layout) edit.restart_required = restart edit.label_text = text @@ -567,14 +572,16 @@ def create_textedit(self, text, option, default=NoDefault, layout.addWidget(label) layout.addWidget(edit) layout.setContentsMargins(0, 0, 0, 0) - if tip: - edit.setToolTip(tip) self.textedits[edit] = (section, option, default) - if help_info: - layout = self.add_help_info_label(layout, tip) widget = QWidget(self) widget.label = label widget.textbox = edit + if tip: + if help_info: + layout, help_label = self.add_help_info_label(layout, tip) + widget.help_label = help_label + else: + edit.setToolTip(tip) widget.setLayout(layout) edit.restart_required = restart edit.label_text = text @@ -596,8 +603,8 @@ def create_browsedir(self, text, option, default=NoDefault, tip=None, layout.addWidget(widget) layout.addWidget(browse_btn) layout.setContentsMargins(0, 0, 0, 0) - if help_info: - layout = self.add_help_info_label(layout, tip) + if tip and help_info: + layout, help_label = self.add_help_info_label(layout, tip) browsedir = QWidget(self) browsedir.setLayout(layout) return browsedir @@ -628,8 +635,8 @@ def create_browsefile(self, text, option, default=NoDefault, tip=None, layout.addWidget(widget) layout.addWidget(browse_btn) layout.setContentsMargins(0, 0, 0, 0) - if help_info: - layout = self.add_help_info_label(layout, tip) + if tip and help_info: + layout, help_label = self.add_help_info_label(layout, tip) browsedir = QWidget(self) browsedir.setLayout(layout) return browsedir @@ -683,12 +690,13 @@ def create_spinbox(self, prefix, suffix, option, default=NoDefault, layout.addWidget(subwidget) layout.addStretch(1) layout.setContentsMargins(0, 0, 0, 0) + widget.spinbox = spinbox if tip is not None: if help_info: - layout = self.add_help_info_label(layout, tip) + layout, help_label = self.add_help_info_label(layout, tip) + widget.help_label = help_label else: spinbox.setToolTip(tip) - widget.spinbox = spinbox widget.setLayout(layout) return widget @@ -709,7 +717,7 @@ def create_coloredit(self, text, option, default=NoDefault, tip=None, layout.setContentsMargins(0, 0, 0, 0) if tip is not None: if help_info: - layout = self.add_help_info_label(layout, tip) + layout, help_label = self.add_help_info_label(layout, tip) else: clayout.setToolTip(tip) widget = QWidget(self) @@ -743,7 +751,7 @@ def create_scedit(self, text, option, default=NoDefault, tip=None, layout.setContentsMargins(0, 0, 0, 0) if tip is not None: if help_info: - layout = self.add_help_info_label(layout, tip) + layout, help_label = self.add_help_info_label(layout, tip) else: clayout.setToolTip(tip) widget = QWidget(self) @@ -773,14 +781,15 @@ def create_combobox(self, text, choices, option, default=NoDefault, layout.addWidget(combobox) layout.addStretch(1) layout.setContentsMargins(0, 0, 0, 0) + widget = QWidget(self) + widget.label = label + widget.combobox = combobox if tip is not None: if help_info: - layout = self.add_help_info_label(layout, tip) + layout, help_label = self.add_help_info_label(layout, tip) + widget.help_label = help_label else: combobox.setToolTip(tip) - widget = QWidget(self) - widget.label = label - widget.combobox = combobox widget.setLayout(layout) combobox.restart_required = restart combobox.label_text = text @@ -818,15 +827,16 @@ def create_file_combobox(self, text, choices, option, default=NoDefault, layout = QGridLayout() layout.addWidget(combobox, 0, 0, 0, 9) layout.addWidget(browse_btn, 0, 10) - layout.setContentsMargins(0, 0, 0, 0) + layout.setContentsMargins(0, 0, 0, 0) + widget = QWidget(self) + widget.combobox = combobox + widget.browse_btn = browse_btn if tip is not None: if help_info: - layout = self.add_help_info_label(layout, tip) + layout, help_label = self.add_help_info_label(layout, tip) + widget.help_label = help_label else: combobox.setToolTip(tip) - widget = QWidget(self) - widget.combobox = combobox - widget.browse_btn = browse_btn widget.setLayout(layout) return widget @@ -861,14 +871,6 @@ def create_fontgroup(self, option=None, text=None, title=None, layout.addWidget(subwidget) layout.addStretch(1) - - widget = QWidget(self) - widget.fontlabel = fontlabel - widget.sizelabel = sizelabel - widget.fontbox = fontbox - widget.sizebox = sizebox - widget.setLayout(layout) - if not without_group: if text is None: text = _("Font style") @@ -878,12 +880,19 @@ def create_fontgroup(self, option=None, text=None, title=None, if tip is not None: if help_info: - layout = self.add_help_info_label(layout, tip) + layout, help_label = self.add_help_info_label(layout, tip) else: group.setToolTip(tip) return group else: + widget = QWidget(self) + widget.fontlabel = fontlabel + widget.sizelabel = sizelabel + widget.fontbox = fontbox + widget.sizebox = sizebox + widget.setLayout(layout) + return widget def create_button(self, text, callback): From 24a25d0631098fe3b366ba7f18424812313a1be8 Mon Sep 17 00:00:00 2001 From: dalthviz Date: Fri, 14 Jul 2023 16:35:50 -0500 Subject: [PATCH 15/17] Fix status bar preferences page layout --- spyder/plugins/statusbar/confpage.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/spyder/plugins/statusbar/confpage.py b/spyder/plugins/statusbar/confpage.py index 054e89633aa..9c7fdc3e14c 100644 --- a/spyder/plugins/statusbar/confpage.py +++ b/spyder/plugins/statusbar/confpage.py @@ -22,17 +22,17 @@ def setup_page(self): # --- Status bar sbar_group = QGroupBox(_("Display")) - memory_box = newcb(_("Show memory usage every"), 'memory_usage/enable', - tip=self.plugin.mem_status.toolTip()) + memory_box = newcb(_("Show memory usage every"), 'memory_usage/enable') memory_spin = self.create_spinbox("", _(" ms"), 'memory_usage/timeout', - min_=100, max_=1000000, step=100) + min_=100, max_=1000000, step=100, + tip=self.plugin.mem_status.toolTip()) memory_box.checkbox.toggled.connect(memory_spin.setEnabled) memory_spin.setEnabled(self.get_option('memory_usage/enable')) - cpu_box = newcb(_("Show CPU usage every"), 'cpu_usage/enable', - tip=self.plugin.cpu_status.toolTip()) + cpu_box = newcb(_("Show CPU usage every"), 'cpu_usage/enable') cpu_spin = self.create_spinbox("", _(" ms"), 'cpu_usage/timeout', - min_=100, max_=1000000, step=100) + min_=100, max_=1000000, step=100, + tip=self.plugin.cpu_status.toolTip()) cpu_box.checkbox.toggled.connect(cpu_spin.setEnabled) cpu_spin.setEnabled(self.get_option('cpu_usage/enable')) From 3c401c6b2d7ec37d8dead560c424eb49812ee522 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Althviz=20Mor=C3=A9?= Date: Mon, 17 Jul 2023 16:42:54 -0500 Subject: [PATCH 16/17] Apply suggestions from code review Co-authored-by: Carlos Cordoba --- spyder/plugins/appearance/confpage.py | 3 ++- .../providers/languageserver/conftabs/advanced.py | 3 ++- .../providers/languageserver/conftabs/formatting.py | 3 ++- .../languageserver/conftabs/introspection.py | 3 ++- spyder/plugins/editor/confpage.py | 6 ++++-- spyder/plugins/maininterpreter/confpage.py | 6 ++++-- spyder/plugins/preferences/api.py | 8 ++++++++ spyder/plugins/variableexplorer/confpage.py | 12 ++++++++---- 8 files changed, 32 insertions(+), 12 deletions(-) diff --git a/spyder/plugins/appearance/confpage.py b/spyder/plugins/appearance/confpage.py index bbd8c6b9b5b..4c3943ddf99 100644 --- a/spyder/plugins/appearance/confpage.py +++ b/spyder/plugins/appearance/confpage.py @@ -181,7 +181,8 @@ def setup_page(self): self.delete_button.clicked.connect(self.delete_scheme) self.schemes_combobox.currentIndexChanged.connect(self.update_preview) self.schemes_combobox.currentIndexChanged.connect(self.update_buttons) - system_font_checkbox.checkbox.stateChanged.connect(self.update_app_font_group) + system_font_checkbox.checkbox.stateChanged.connect( + self.update_app_font_group) # Setup for name in names: diff --git a/spyder/plugins/completion/providers/languageserver/conftabs/advanced.py b/spyder/plugins/completion/providers/languageserver/conftabs/advanced.py index f1c7a75bd94..5bbee615779 100644 --- a/spyder/plugins/completion/providers/languageserver/conftabs/advanced.py +++ b/spyder/plugins/completion/providers/languageserver/conftabs/advanced.py @@ -116,7 +116,8 @@ def disable_tcp(self, state): self.advanced_port.spinbox.setEnabled(True) self.external_server.checkbox.setChecked(False) self.external_server.checkbox.setEnabled(True) - self.external_server.checkbox.stateChanged.connect(self.disable_stdio) + self.external_server.checkbox.stateChanged.connect( + self.disable_stdio) def disable_stdio(self, state): if state == Qt.Checked: diff --git a/spyder/plugins/completion/providers/languageserver/conftabs/formatting.py b/spyder/plugins/completion/providers/languageserver/conftabs/formatting.py index 210546982dc..42e90472cd4 100644 --- a/spyder/plugins/completion/providers/languageserver/conftabs/formatting.py +++ b/spyder/plugins/completion/providers/languageserver/conftabs/formatting.py @@ -92,7 +92,8 @@ def __init__(self, parent): code_style_g_widget = QWidget() code_style_g_widget.setLayout(code_style_g_layout) code_style_g_widget.setEnabled(self.get_option('pycodestyle')) - self.code_style_check.checkbox.toggled.connect(code_style_g_widget.setEnabled) + self.code_style_check.checkbox.toggled.connect( + code_style_g_widget.setEnabled) # Code style layout code_style_group = QGroupBox(_("Code style")) diff --git a/spyder/plugins/completion/providers/languageserver/conftabs/introspection.py b/spyder/plugins/completion/providers/languageserver/conftabs/introspection.py index d2c30f02c31..e43afb84c0d 100644 --- a/spyder/plugins/completion/providers/languageserver/conftabs/introspection.py +++ b/spyder/plugins/completion/providers/languageserver/conftabs/introspection.py @@ -54,7 +54,8 @@ def __init__(self, parent): introspection_layout.addWidget(enable_hover_hints_box) introspection_group.setLayout(introspection_layout) - goto_definition_box.checkbox.toggled.connect(follow_imports_box.setEnabled) + goto_definition_box.checkbox.toggled.connect( + follow_imports_box.setEnabled) # Advanced group advanced_group = QGroupBox(_("Advanced")) diff --git a/spyder/plugins/editor/confpage.py b/spyder/plugins/editor/confpage.py index 250ef01bbea..5f3ac1d0feb 100644 --- a/spyder/plugins/editor/confpage.py +++ b/spyder/plugins/editor/confpage.py @@ -65,8 +65,10 @@ def setup_page(self): "", _(" ms"), 'occurrence_highlighting/timeout', min_=100, max_=1000000, step=100) - occurrence_box.checkbox.toggled.connect(occurrence_spin.spinbox.setEnabled) - occurrence_box.checkbox.toggled.connect(occurrence_spin.slabel.setEnabled) + occurrence_box.checkbox.toggled.connect( + occurrence_spin.spinbox.setEnabled) + occurrence_box.checkbox.toggled.connect( + occurrence_spin.slabel.setEnabled) occurrence_spin.spinbox.setEnabled( self.get_option('occurrence_highlighting')) occurrence_spin.slabel.setEnabled( diff --git a/spyder/plugins/maininterpreter/confpage.py b/spyder/plugins/maininterpreter/confpage.py index cd9db92a172..b568edcef44 100644 --- a/spyder/plugins/maininterpreter/confpage.py +++ b/spyder/plugins/maininterpreter/confpage.py @@ -99,8 +99,10 @@ def setup_page(self): adjust_to_contents=True, validate_callback=programs.is_python_interpreter, ) - self.def_exec_radio.radiobutton.toggled.connect(self.cus_exec_combo.setDisabled) - self.cus_exec_radio.radiobutton.toggled.connect(self.cus_exec_combo.setEnabled) + self.def_exec_radio.radiobutton.toggled.connect( + self.cus_exec_combo.setDisabled) + self.cus_exec_radio.radiobutton.toggled.connect( + self.cus_exec_combo.setEnabled) pyexec_layout.addWidget(self.cus_exec_combo) pyexec_group.setLayout(pyexec_layout) diff --git a/spyder/plugins/preferences/api.py b/spyder/plugins/preferences/api.py index dc18598fa40..7757abae4a7 100644 --- a/spyder/plugins/preferences/api.py +++ b/spyder/plugins/preferences/api.py @@ -461,6 +461,7 @@ def create_checkbox(self, text, option, default=NoDefault, layout.setContentsMargins(0, 0, 0, 0) checkbox = QCheckBox(text) layout.addWidget(checkbox) + self.checkboxes[checkbox] = (section, option, default) if section is not None and section != self.CONF_SECTION: self.cross_section_options[option] = section @@ -475,6 +476,7 @@ def show_message(is_checked=False): msg_info, QMessageBox.Ok) checkbox.clicked.connect(show_message) checkbox.restart_required = restart + widget = QWidget(self) widget.checkbox = checkbox if tip is not None: @@ -494,6 +496,7 @@ def create_radiobutton(self, text, option, default=NoDefault, layout.setContentsMargins(0, 0, 0, 0) radiobutton = QRadioButton(text) layout.addWidget(radiobutton) + if section is not None and section != self.CONF_SECTION: self.cross_section_options[option] = section if button_group is None: @@ -514,6 +517,7 @@ def show_message(is_checked): radiobutton.toggled.connect(show_message) radiobutton.restart_required = restart radiobutton.label_text = text + if tip is not None: if help_info: layout, help_label = self.add_help_info_label(layout, tip) @@ -544,6 +548,7 @@ def create_lineedit(self, text, option, default=NoDefault, if placeholder: edit.setPlaceholderText(placeholder) self.lineedits[edit] = (section, option, default) + widget = QWidget(self) widget.label = label widget.textbox = edit @@ -573,6 +578,7 @@ def create_textedit(self, text, option, default=NoDefault, layout.addWidget(edit) layout.setContentsMargins(0, 0, 0, 0) self.textedits[edit] = (section, option, default) + widget = QWidget(self) widget.label = label widget.textbox = edit @@ -720,6 +726,7 @@ def create_coloredit(self, text, option, default=NoDefault, tip=None, layout, help_label = self.add_help_info_label(layout, tip) else: clayout.setToolTip(tip) + widget = QWidget(self) widget.setLayout(layout) return widget @@ -828,6 +835,7 @@ def create_file_combobox(self, text, choices, option, default=NoDefault, layout.addWidget(combobox, 0, 0, 0, 9) layout.addWidget(browse_btn, 0, 10) layout.setContentsMargins(0, 0, 0, 0) + widget = QWidget(self) widget.combobox = combobox widget.browse_btn = browse_btn diff --git a/spyder/plugins/variableexplorer/confpage.py b/spyder/plugins/variableexplorer/confpage.py index 7b2e8693549..a304894db70 100644 --- a/spyder/plugins/variableexplorer/confpage.py +++ b/spyder/plugins/variableexplorer/confpage.py @@ -26,10 +26,14 @@ def setup_page(self): ('exclude_callables_and_modules', _("Exclude callables and modules")) ] - filter_boxes = [self.create_checkbox( - text, option, - tip='Excludes variables that fit the description') - for option, text in filter_data] + filter_boxes = [ + self.create_checkbox( + text, + option, + tip='Excludes variables that fit the description' + ) + for option, text in filter_data + ] display_group = QGroupBox(_("Display")) display_data = [('minmax', _("Show arrays min/max"), '')] From 0a2ce348509c8d54bd1623ff0bb26cf38971dc61 Mon Sep 17 00:00:00 2001 From: dalthviz Date: Mon, 17 Jul 2023 17:10:28 -0500 Subject: [PATCH 17/17] Remove help_info kwarg --- spyder/plugins/preferences/api.py | 101 +++++++++++------------------- 1 file changed, 35 insertions(+), 66 deletions(-) diff --git a/spyder/plugins/preferences/api.py b/spyder/plugins/preferences/api.py index 7757abae4a7..f0626125476 100644 --- a/spyder/plugins/preferences/api.py +++ b/spyder/plugins/preferences/api.py @@ -441,13 +441,13 @@ def has_been_modified(self, section, option): else: self.changed_options.add((section, option)) - def add_help_info_label(self, layout, help_info): + def add_help_info_label(self, layout, tip_text): help_label = QLabel() image = ima.icon('help_gray').pixmap(QSize(20, 20)) help_label.setPixmap(image) help_label.setFixedWidth(23) help_label.setFixedHeight(23) - help_label.setToolTip(help_info) + help_label.setToolTip(tip_text) layout.addWidget(help_label) layout.addStretch(100) @@ -455,8 +455,7 @@ def add_help_info_label(self, layout, help_info): def create_checkbox(self, text, option, default=NoDefault, tip=None, msg_warning=None, msg_info=None, - msg_if_enabled=False, section=None, restart=False, - help_info=True): + msg_if_enabled=False, section=None, restart=False): layout = QHBoxLayout() layout.setContentsMargins(0, 0, 0, 0) checkbox = QCheckBox(text) @@ -480,18 +479,15 @@ def show_message(is_checked=False): widget = QWidget(self) widget.checkbox = checkbox if tip is not None: - if help_info: - layout, help_label = self.add_help_info_label(layout, tip) - widget.help_label = help_label - else: - checkbox.setToolTip(tip) + layout, help_label = self.add_help_info_label(layout, tip) + widget.help_label = help_label widget.setLayout(layout) return widget def create_radiobutton(self, text, option, default=NoDefault, tip=None, msg_warning=None, msg_info=None, msg_if_enabled=False, button_group=None, - restart=False, section=None, help_info=True): + restart=False, section=None): layout = QHBoxLayout() layout.setContentsMargins(0, 0, 0, 0) radiobutton = QRadioButton(text) @@ -519,11 +515,8 @@ def show_message(is_checked): radiobutton.label_text = text if tip is not None: - if help_info: - layout, help_label = self.add_help_info_label(layout, tip) - radiobutton.help_label = help_label - else: - radiobutton.setToolTip(tip) + layout, help_label = self.add_help_info_label(layout, tip) + radiobutton.help_label = help_label widget = QWidget(self) widget.radiobutton = radiobutton widget.setLayout(layout) @@ -532,7 +525,7 @@ def show_message(is_checked): def create_lineedit(self, text, option, default=NoDefault, tip=None, alignment=Qt.Vertical, regex=None, restart=False, word_wrap=True, placeholder=None, - content_type=None, section=None, help_info=True): + content_type=None, section=None): if section is not None and section != self.CONF_SECTION: self.cross_section_options[option] = section label = QLabel(text) @@ -552,12 +545,9 @@ def create_lineedit(self, text, option, default=NoDefault, widget = QWidget(self) widget.label = label widget.textbox = edit - if tip: - if help_info: - layout, help_label = self.add_help_info_label(layout, tip) - widget.help_label = help_label - else: - edit.setToolTip(tip) + if tip is not None: + layout, help_label = self.add_help_info_label(layout, tip) + widget.help_label = help_label widget.setLayout(layout) edit.restart_required = restart edit.label_text = text @@ -565,7 +555,7 @@ def create_lineedit(self, text, option, default=NoDefault, def create_textedit(self, text, option, default=NoDefault, tip=None, restart=False, content_type=None, - section=None, help_info=True): + section=None): if section is not None and section != self.CONF_SECTION: self.cross_section_options[option] = section label = QLabel(text) @@ -582,19 +572,16 @@ def create_textedit(self, text, option, default=NoDefault, widget = QWidget(self) widget.label = label widget.textbox = edit - if tip: - if help_info: - layout, help_label = self.add_help_info_label(layout, tip) - widget.help_label = help_label - else: - edit.setToolTip(tip) + if tip is not None: + layout, help_label = self.add_help_info_label(layout, tip) + widget.help_label = help_label widget.setLayout(layout) edit.restart_required = restart edit.label_text = text return widget def create_browsedir(self, text, option, default=NoDefault, tip=None, - section=None, help_info=True): + section=None): widget = self.create_lineedit(text, option, default, section=section, alignment=Qt.Horizontal) for edit in self.lineedits: @@ -609,7 +596,7 @@ def create_browsedir(self, text, option, default=NoDefault, tip=None, layout.addWidget(widget) layout.addWidget(browse_btn) layout.setContentsMargins(0, 0, 0, 0) - if tip and help_info: + if tip is not None: layout, help_label = self.add_help_info_label(layout, tip) browsedir = QWidget(self) browsedir.setLayout(layout) @@ -626,7 +613,7 @@ def select_directory(self, edit): edit.setText(directory) def create_browsefile(self, text, option, default=NoDefault, tip=None, - filters=None, section=None, help_info=True): + filters=None, section=None): widget = self.create_lineedit(text, option, default, section=section, alignment=Qt.Horizontal) for edit in self.lineedits: @@ -641,7 +628,7 @@ def create_browsefile(self, text, option, default=NoDefault, tip=None, layout.addWidget(widget) layout.addWidget(browse_btn) layout.setContentsMargins(0, 0, 0, 0) - if tip and help_info: + if tip is not None: layout, help_label = self.add_help_info_label(layout, tip) browsedir = QWidget(self) browsedir.setLayout(layout) @@ -662,7 +649,7 @@ def select_file(self, edit, filters=None, **kwargs): def create_spinbox(self, prefix, suffix, option, default=NoDefault, min_=None, max_=None, step=None, tip=None, - section=None, help_info=True): + section=None): if section is not None and section != self.CONF_SECTION: self.cross_section_options[option] = section widget = QWidget(self) @@ -698,16 +685,13 @@ def create_spinbox(self, prefix, suffix, option, default=NoDefault, layout.setContentsMargins(0, 0, 0, 0) widget.spinbox = spinbox if tip is not None: - if help_info: - layout, help_label = self.add_help_info_label(layout, tip) - widget.help_label = help_label - else: - spinbox.setToolTip(tip) + layout, help_label = self.add_help_info_label(layout, tip) + widget.help_label = help_label widget.setLayout(layout) return widget def create_coloredit(self, text, option, default=NoDefault, tip=None, - without_layout=False, section=None, help_info=True): + without_layout=False, section=None): if section is not None and section != self.CONF_SECTION: self.cross_section_options[option] = section label = QLabel(text) @@ -722,17 +706,14 @@ def create_coloredit(self, text, option, default=NoDefault, tip=None, layout.addStretch(1) layout.setContentsMargins(0, 0, 0, 0) if tip is not None: - if help_info: - layout, help_label = self.add_help_info_label(layout, tip) - else: - clayout.setToolTip(tip) + layout, help_label = self.add_help_info_label(layout, tip) widget = QWidget(self) widget.setLayout(layout) return widget def create_scedit(self, text, option, default=NoDefault, tip=None, - without_layout=False, section=None, help_info=True): + without_layout=False, section=None): if section is not None and section != self.CONF_SECTION: self.cross_section_options[option] = section label = QLabel(text) @@ -757,16 +738,13 @@ def create_scedit(self, text, option, default=NoDefault, tip=None, layout.addStretch(1) layout.setContentsMargins(0, 0, 0, 0) if tip is not None: - if help_info: - layout, help_label = self.add_help_info_label(layout, tip) - else: - clayout.setToolTip(tip) + layout, help_label = self.add_help_info_label(layout, tip) widget = QWidget(self) widget.setLayout(layout) return widget def create_combobox(self, text, choices, option, default=NoDefault, - tip=None, restart=False, section=None, help_info=True): + tip=None, restart=False, section=None): """choices: couples (name, key)""" if section is not None and section != self.CONF_SECTION: self.cross_section_options[option] = section @@ -792,11 +770,8 @@ def create_combobox(self, text, choices, option, default=NoDefault, widget.label = label widget.combobox = combobox if tip is not None: - if help_info: - layout, help_label = self.add_help_info_label(layout, tip) - widget.help_label = help_label - else: - combobox.setToolTip(tip) + layout, help_label = self.add_help_info_label(layout, tip) + widget.help_label = help_label widget.setLayout(layout) combobox.restart_required = restart combobox.label_text = text @@ -806,7 +781,7 @@ def create_file_combobox(self, text, choices, option, default=NoDefault, tip=None, restart=False, filters=None, adjust_to_contents=False, default_line_edit=False, section=None, - validate_callback=None, help_info=True): + validate_callback=None): """choices: couples (name, key)""" if section is not None and section != self.CONF_SECTION: self.cross_section_options[option] = section @@ -840,18 +815,15 @@ def create_file_combobox(self, text, choices, option, default=NoDefault, widget.combobox = combobox widget.browse_btn = browse_btn if tip is not None: - if help_info: - layout, help_label = self.add_help_info_label(layout, tip) - widget.help_label = help_label - else: - combobox.setToolTip(tip) + layout, help_label = self.add_help_info_label(layout, tip) + widget.help_label = help_label widget.setLayout(layout) return widget def create_fontgroup(self, option=None, text=None, title=None, tip=None, fontfilters=None, without_group=False, - help_info=True, restart=False): + restart=False): """Option=None -> setting plugin font""" if title: @@ -887,10 +859,7 @@ def create_fontgroup(self, option=None, text=None, title=None, group.setLayout(layout) if tip is not None: - if help_info: - layout, help_label = self.add_help_info_label(layout, tip) - else: - group.setToolTip(tip) + layout, help_label = self.add_help_info_label(layout, tip) return group else: