From 0b981408930ca34fd27f6c1dc3b094909b180544 Mon Sep 17 00:00:00 2001 From: Kenneth Lyons Date: Sat, 20 Jun 2020 12:27:29 -0700 Subject: [PATCH] Check for container before setting dock orientation --- pyqtgraph/dockarea/Dock.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pyqtgraph/dockarea/Dock.py b/pyqtgraph/dockarea/Dock.py index 15c87652..083756dc 100644 --- a/pyqtgraph/dockarea/Dock.py +++ b/pyqtgraph/dockarea/Dock.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- from ..Qt import QtCore, QtGui from .DockDrop import * @@ -138,6 +139,12 @@ class Dock(QtGui.QWidget, DockDrop): By default ('auto'), the orientation is determined based on the aspect ratio of the Dock. """ + # setOrientation may be called before the container is set in some cases + # (via resizeEvent), so there's no need to do anything here until called + # again by containerChanged + if self.container() is None: + return + if o == 'auto' and self.autoOrient: if self.container().type() == 'tab': o = 'horizontal'