diff --git a/src/calibre/gui2/preferences/__init__.py b/src/calibre/gui2/preferences/__init__.py index 0d1641ba85..3272664ddc 100644 --- a/src/calibre/gui2/preferences/__init__.py +++ b/src/calibre/gui2/preferences/__init__.py @@ -91,6 +91,12 @@ class ConfigWidgetInterface: ''' pass + def initial_tab_changed(self): + ''' + Called if the initially displayed tab is changed before the widget is shown, but after it is initialized. + ''' + pass + class Setting: diff --git a/src/calibre/gui2/preferences/look_feel.py b/src/calibre/gui2/preferences/look_feel.py index eff13e1890..750ca86ce8 100644 --- a/src/calibre/gui2/preferences/look_feel.py +++ b/src/calibre/gui2/preferences/look_feel.py @@ -774,6 +774,9 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form): self.tabWidget.currentWidget().setFocus(Qt.FocusReason.OtherFocusReason) self.opt_ui_style.currentIndexChanged.connect(self.update_color_palette_state) + def initial_tab_changed(self): + self.sections_view.setCurrentRow(self.tabWidget.currentIndex()) + def fill_tb_search_order_box(self): # The tb_search_order is a directed graph of nodes with an arc to the next # node in the sequence. Node 0 (zero) is the start node with the last node diff --git a/src/calibre/gui2/preferences/main.py b/src/calibre/gui2/preferences/main.py index 3777b75e33..9fdd0220a6 100644 --- a/src/calibre/gui2/preferences/main.py +++ b/src/calibre/gui2/preferences/main.py @@ -282,6 +282,10 @@ class Preferences(QDialog): idx = c.indexOf(w) if idx > -1: c.setCurrentIndex(idx) + try: + self.showing_widget.initial_tab_changed() + except Exception: + pass break else: self.hide_plugin()