Skip to content

Commit

Permalink
Merge pull request #2286 from pijyoi/double_dockdrop
Browse files Browse the repository at this point in the history
avoid double __init__ of DockDrop
  • Loading branch information
j9ac9k committed May 3, 2022
2 parents 4ef3762 + d15f70d commit e0b3a30
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
10 changes: 7 additions & 3 deletions pyqtgraph/dockarea/Dock.py
@@ -1,6 +1,6 @@
import warnings

from ..Qt import QtCore, QtGui, QtWidgets
from ..Qt import QT_LIB, QtCore, QtGui, QtWidgets
from ..widgets.VerticalLabel import VerticalLabel
from .DockDrop import DockDrop

Expand All @@ -11,8 +11,12 @@ class Dock(QtWidgets.QWidget, DockDrop):
sigClosed = QtCore.Signal(object)

def __init__(self, name, area=None, size=(10, 10), widget=None, hideTitle=False, autoOrientation=True, label=None, **kargs):
QtWidgets.QWidget.__init__(self)
DockDrop.__init__(self)
allowedAreas = None
if QT_LIB.startswith('PyQt'):
QtWidgets.QWidget.__init__(self, allowedAreas=allowedAreas)
else:
QtWidgets.QWidget.__init__(self)
DockDrop.__init__(self, allowedAreas=allowedAreas)
self._container = None
self._name = name
self.area = area
Expand Down
10 changes: 7 additions & 3 deletions pyqtgraph/dockarea/DockArea.py
@@ -1,6 +1,6 @@
import weakref

from ..Qt import QtWidgets
from ..Qt import QT_LIB, QtWidgets
from .Container import Container, HContainer, TContainer, VContainer
from .Dock import Dock
from .DockDrop import DockDrop
Expand All @@ -9,8 +9,12 @@
class DockArea(Container, QtWidgets.QWidget, DockDrop):
def __init__(self, parent=None, temporary=False, home=None):
Container.__init__(self, self)
QtWidgets.QWidget.__init__(self, parent=parent)
DockDrop.__init__(self, allowedAreas=['left', 'right', 'top', 'bottom'])
allowedAreas=['left', 'right', 'top', 'bottom']
if QT_LIB.startswith('PyQt'):
QtWidgets.QWidget.__init__(self, parent=parent, allowedAreas=allowedAreas)
else:
QtWidgets.QWidget.__init__(self, parent=parent)
DockDrop.__init__(self, allowedAreas=allowedAreas)
self.layout = QtWidgets.QVBoxLayout()
self.layout.setContentsMargins(0,0,0,0)
self.layout.setSpacing(0)
Expand Down

0 comments on commit e0b3a30

Please sign in to comment.