Restore tooltip for window layout preference

This commit is contained in:
Kovid Goyal 2024-01-07 14:17:06 +05:30
parent cfc21828d1
commit 3f35571f8d
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 15 additions and 8 deletions

View File

@ -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()

View File

@ -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())