code: def dockWidget(self, widget, title, area):
          
          assert widget.parent() is None, "Widget already has a parent"
  
          dockWidget = QtWidgets.QDockWidget(title, parent=self)
          dockWidget.setObjectName("dock_" + string_to_identifier(title))
          dockWidget.setWidget(widget)
  
          # Prevent parent context menu (with e.g. 'set inspector" option) to be displayed.
          dockWidget.setContextMenuPolicy(Qt.PreventContextMenu)
  
          self.addDockWidget(area, dockWidget)
          self.viewMenu.addAction(dockWidget.toggleViewAction())
          return dockWidget
docs: Adds a widget as a docked widget.
              Returns the added dockWidget