'Add to parent QMainWindow as a dock widget'

def create_dockwidget(self):

    dock = SpyderDockWidget(self.get_plugin_title(), self.main)
    dock.setObjectName((self.__class__.__name__ + '_dw'))
    dock.setAllowedAreas(self.ALLOWED_AREAS)
    dock.setFeatures(self.FEATURES)
    dock.setWidget(self)
    self.update_margins()
    dock.visibilityChanged.connect(self.visibility_changed)
    dock.plugin_closed.connect(self.plugin_closed)
    self.dockwidget = dock
    if (self.shortcut is not None):
        sc = QShortcut(QKeySequence(self.shortcut), self.main, self.switch_to_plugin)
        self.register_shortcut(sc, '_', ('Switch    to    %s' % self.CONF_SECTION))
    return (dock, self.LOCATION)
