In my example attached, I noticed that if I try (*consecutively twice*) to 
drag a dock onto the bottom or top overlay of itself , it will always give 
me this error. (it usually takes 2 times dragging). This behavior does not 
happen if i drag it onto the left or right overlay.
Traceback (most recent call last):

  File "..\pyqtgraph\dockarea\Dock.py", line 247, in dropEvent
    DockDrop.dropEvent(self, *args)
  File "..\pyqtgraph\dockarea\DockDrop.py", line 78, in dropEvent
    self.area.moveDock(ev.source(), area, self)
AttributeError: 'NoneType' object has no attribute 'moveDock' 

Case2: 
I also tested the scenario in which the docks are added to the dock area 
with the position parameter = "bottom" => resulting into 2 widgets in a 
vertical column. Then if we take a widget and drag it twice on it's own 
overlay on the left or right we get the same error. 
For now I fixed this by adding this check in the dockarea moveDock() 
function:     
          
              if neighbor is not dock:
                     ( continue with the old function)

Please let me know if I am doing anything wrong. 

-- 
You received this message because you are subscribed to the Google Groups 
"pyqtgraph" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/pyqtgraph/9b77bff5-269a-4454-9f79-c426cd3888e5%40googlegroups.com.
import pyqtgraph as pg
from pyqtgraph.Qt import QtCore, QtGui
from pyqtgraph.dockarea import *
from PySide2.QtWidgets import QWidget, QMainWindow, QSplitter

count =0


def addWidgetToWindow():

    mywidget = QWidget()
    mywidget.setStyleSheet("background-color : red;")
    global count
    mywidget.setWindowTitle("my widget"+str(count))
    d = Dock( name=mywidget.windowTitle(), size=(300, 200), closable=True)
    global area
    area.addDock(d, "bottom")

    d.addWidget(mywidget)


    count= count+1


def addWidgetToWindowModif():

    mywidget = QWidget()
    mywidget.setStyleSheet("background-color : red;")
    global count
    mywidget.setWindowTitle("my widget" + str(count))
    d = Dock(name=mywidget.windowTitle(), size=(300, 200), closable=True)
    global area
    a = DockArea.addTempArea(area)
    a.addDock(d, "left")

    d.addWidget(mywidget)
    area.moveDock(d,"bottom", None)
    count = count + 1
    d.container().setChildrenCollapsible(False)


if __name__ == '__main__':
    import sys
    global area

    app = QtGui.QApplication([])
    win = QMainWindow()
    area = DockArea()
    win.setCentralWidget(area)
    win.resize(1000, 500)

    menu = win.menuBar()
    AddWidget_act = menu.addAction("AddWidget")
    AddWidget_act.triggered.connect(addWidgetToWindow)
    AddWidgetHack_act = menu.addAction("AddWidgetHack")
    AddWidgetHack_act.triggered.connect(addWidgetToWindowModif)

    addWidgetToWindow()
    addWidgetToWindow()


    win.show()

    if (sys.flags.interactive != 1) or not hasattr(QtCore, 'PYQT_VERSION'):
        QtGui.QApplication.instance().exec_()

Reply via email to