diff --git a/src/calibre/gui2/tweak_book/preview.py b/src/calibre/gui2/tweak_book/preview.py index f9048cfdd2..7839bad725 100644 --- a/src/calibre/gui2/tweak_book/preview.py +++ b/src/calibre/gui2/tweak_book/preview.py @@ -320,17 +320,8 @@ class Inspector(QWidget): self.view = None self.layout = QHBoxLayout(self) self.layout.setContentsMargins(0, 0, 0, 0) - self.connection_attempts = 0 - QTimer.singleShot(0, self.connect_to_dock) def connect_to_dock(self): - if 'inspector-dock' not in actions: - self.connection_attempts += 1 - if self.connection_attempts < 1000: - QTimer.singleShot(10, self.connect_to_dock) - else: - print('Failed to connect to inspector dock') - return ac = actions['inspector-dock'] ac.toggled.connect(self.visibility_changed) if ac.isChecked(): diff --git a/src/calibre/gui2/tweak_book/ui.py b/src/calibre/gui2/tweak_book/ui.py index 3be117fad3..c6a10045e8 100644 --- a/src/calibre/gui2/tweak_book/ui.py +++ b/src/calibre/gui2/tweak_book/ui.py @@ -748,6 +748,7 @@ class Main(MainWindow): self.preview.inspector.setParent(d) self.addDockWidget(Qt.BottomDockWidgetArea, d) d.close() # By default the inspector window is closed + QTimer.singleShot(10, self.preview.inspector.connect_to_dock) d = create(_('Table of Contents'), 'toc-viewer') d.setAllowedAreas(Qt.LeftDockWidgetArea | Qt.RightDockWidgetArea | Qt.BottomDockWidgetArea | Qt.TopDockWidgetArea)