mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-05-09 07:03:41 +02:00
Get rid of busy loop retries for connecting to inspector dock
This commit is contained in:
parent
d2d188215c
commit
34d3011726
2 changed files with 1 additions and 9 deletions
|
|
@ -320,17 +320,8 @@ def __init__(self, parent=None):
|
|||
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():
|
||||
|
|
|
|||
|
|
@ -748,6 +748,7 @@ def create(name, oname):
|
|||
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)
|
||||
|
|
|
|||
Loading…
Reference in a new issue