Repository: pyqtgraph/pyqtgraph

Issue:
Unhandled TypeError When Click+ Drag Either Axis on Plot Customization Example
<!-- In the following, please describe your issue in detail! -->
<!-- If some of the sections do not apply, just remove them. -->

### Short description
TypeError Exception Generated When Clicking + Dragging on an Axis on `customPlot.py` example

### Code to reproduce

```
python -m pyqtgraph.examples
```

Select Custom Plot example, run it, click + drag the horizontal or vertical axis.

### Expected behavior
Axis should move (this occurs in other examples)

### Real behavior
Unhandled TypeError occurs

```
    |==============================>>
    |  Traceback (most recent call last):
    |    File "C:\Users\ogi\source\repos\j9ac9k\pyqtgraph\examples\customPlot.py", line 50, in <module>
    |      QtGui.QApplication.instance().exec_()
    |    File "C:\Users\ogi\source\repos\j9ac9k\pyqtgraph\pyqtgraph\widgets\GraphicsView.py", line 376, in mouseMoveEvent
    |      QtGui.QGraphicsView.mouseMoveEvent(self, ev)
    |    File "C:\Users\ogi\source\repos\j9ac9k\pyqtgraph\pyqtgraph\GraphicsScene\GraphicsScene.py", line 195, in mouseMoveEvent
    |      if self.sendDragEvent(ev, init=init):
    |    File "C:\Users\ogi\source\repos\j9ac9k\pyqtgraph\pyqtgraph\GraphicsScene\GraphicsScene.py", line 313, in sendDragEvent
    |      debug.printExc("Error sending drag event:")
    |    --- exception caught here ---
    |    File "C:\Users\ogi\source\repos\j9ac9k\pyqtgraph\pyqtgraph\GraphicsScene\GraphicsScene.py", line 311, in sendDragEvent
    |      item.mouseDragEvent(event)
    |    File "C:\Users\ogi\source\repos\j9ac9k\pyqtgraph\pyqtgraph\graphicsItems\AxisItem.py", line 1191, in mouseDragEvent
    |      return lv.mouseDragEvent(event, axis=0)
    |  TypeError: mouseDragEvent() got an unexpected keyword argument 'axis'
    |==============================<<
```

### Tested environment(s)

 * PyQtGraph version: 0.11.0 - current master branch ( b41c4a71e54006e51808bc9fdba8ccf342526955 )
 * Qt Python binding: 'PyQt5 5.15.0 Qt 5.15.0'
 * Python version:  3.7.7
 * NumPy version: 1.18.5
 * Operating system:  Windows 10
 * Installation method: pip

### Additional context

I attempted to git bisect this momentarily, but saw this issue was present even in 0.10.0, so this is definitely not something new!


Discussion:
Looks like the `CustomViewBox` in the example just needs to be updated.

https://github.com/pyqtgraph/pyqtgraph/blob/b41c4a71e54006e51808bc9fdba8ccf342526955/examples/customPlot.py#L25
I stumbled across this in the most random way, I was looking to test #1276 when I came across this ...I was really confused, but when I noticed how long the issue has been around for, ...what dumb luck!

Resolving patch:
diff --git a/examples/customPlot.py b/examples/customPlot.py
--- a/examples/customPlot.py
+++ b/examples/customPlot.py
@@ -14,6 +14,7 @@
 
 class CustomViewBox(pg.ViewBox):
     def __init__(self, *args, **kwds):
+        kwds['enableMenu'] = False
         pg.ViewBox.__init__(self, *args, **kwds)
         self.setMouseMode(self.RectMode)
         
@@ -21,12 +22,13 @@ def __init__(self, *args, **kwds):
     def mouseClickEvent(self, ev):
         if ev.button() == QtCore.Qt.RightButton:
             self.autoRange()
-            
-    def mouseDragEvent(self, ev):
-        if ev.button() == QtCore.Qt.RightButton:
+    
+    ## reimplement mouseDragEvent to disable continuous axis zoom
+    def mouseDragEvent(self, ev, axis=None):
+        if axis is not None and ev.button() == QtCore.Qt.RightButton:
             ev.ignore()
         else:
-            pg.ViewBox.mouseDragEvent(self, ev)
+            pg.ViewBox.mouseDragEvent(self, ev, axis=axis)
 
 
 app = pg.mkQApp()
diff --git a/pyqtgraph/graphicsItems/ViewBox/ViewBox.py b/pyqtgraph/graphicsItems/ViewBox/ViewBox.py
--- a/pyqtgraph/graphicsItems/ViewBox/ViewBox.py
+++ b/pyqtgraph/graphicsItems/ViewBox/ViewBox.py
@@ -1267,7 +1267,7 @@ def mouseDragEvent(self, ev, axis=None):
 
         ## Scale or translate based on mouse button
         if ev.button() & (QtCore.Qt.LeftButton | QtCore.Qt.MidButton):
-            if self.state['mouseMode'] == ViewBox.RectMode:
+            if self.state['mouseMode'] == ViewBox.RectMode and axis is None:
                 if ev.isFinish():  ## This is the final move in the drag; change the view scale now
                     #print "finish"
                     self.rbScaleBox.hide()


Test patch: