diff --git a/src/calibre/gui2/preferences/__init__.py b/src/calibre/gui2/preferences/__init__.py index 6d9472b260..57324e59f9 100644 --- a/src/calibre/gui2/preferences/__init__.py +++ b/src/calibre/gui2/preferences/__init__.py @@ -98,6 +98,16 @@ class ConfigWidgetInterface: pass +def set_help_tips(gui_obj, tt): + if tt: + if not str(gui_obj.whatsThis()): + gui_obj.setWhatsThis(tt) + if not str(gui_obj.statusTip()): + gui_obj.setStatusTip(tt) + tt = '\n'.join(textwrap.wrap(tt, 70)) + gui_obj.setToolTip(tt) + + class Setting: CHOICES_SEARCH_FLAGS = Qt.MatchFlag.MatchExactly | Qt.MatchFlag.MatchCaseSensitive @@ -138,13 +148,7 @@ class Setting: if h: self.gui_obj.setToolTip(h) tt = str(self.gui_obj.toolTip()) - if tt: - if not str(self.gui_obj.whatsThis()): - self.gui_obj.setWhatsThis(tt) - if not str(self.gui_obj.statusTip()): - self.gui_obj.setStatusTip(tt) - tt = '\n'.join(textwrap.wrap(tt, 70)) - self.gui_obj.setToolTip(tt) + set_help_tips(self.gui_obj, tt) def changed(self, *args): self.widget.changed_signal.emit() diff --git a/src/calibre/gui2/preferences/look_feel.py b/src/calibre/gui2/preferences/look_feel.py index 70c4e83648..4fd18c28e4 100644 --- a/src/calibre/gui2/preferences/look_feel.py +++ b/src/calibre/gui2/preferences/look_feel.py @@ -32,7 +32,9 @@ from calibre.gui2.custom_column_widgets import get_field_list as em_get_field_li from calibre.gui2.dialogs.quickview import get_qv_field_list from calibre.gui2.dialogs.template_dialog import TemplateDialog from calibre.gui2.library.alternate_views import CM_TO_INCH, auto_height -from calibre.gui2.preferences import ConfigWidgetBase, Setting, test_widget +from calibre.gui2.preferences import ( + ConfigWidgetBase, Setting, set_help_tips, test_widget, +) from calibre.gui2.preferences.coloring import EditRules from calibre.gui2.preferences.look_feel_ui import Ui_Form from calibre.gui2.widgets import BusyCursor @@ -833,6 +835,7 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form): self.opt_gui_layout.addItem(_('Wide'), 'wide') self.opt_gui_layout.addItem(_('Narrow'), 'narrow') self.opt_gui_layout.currentIndexChanged.connect(self.changed_signal) + set_help_tips(self.opt_gui_layout, config.help('gui_layout')) def initial_tab_changed(self): self.sections_view.setCurrentRow(self.tabWidget.currentIndex())