Skip to content

Commit

Permalink
Upgraded Plot module to comply with matplotlib 1.5.x API
Browse files Browse the repository at this point in the history
Plot.py will check the version of matplotlib imported using the
distutils.version.StrictVersion class.  If the version is less
than 1.5.0, it will import the legacy gt4agg NavigationToolbar
from matplotlib, otherwise the 1.5.x version.

Resolves #2421
  • Loading branch information
bblacey committed Jan 27, 2016
1 parent cbdd18c commit 9f907f5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions .travis.yml
Expand Up @@ -38,6 +38,7 @@ before_install:
- sudo apt-get install -y pyside-tools
- sudo apt-get install -y python-dev
- sudo apt-get install -y python-pyside
- sudo apt-get install -y python-matplotlib
- sudo apt-get install -y qt4-dev-tools
- sudo apt-get install -y qt4-qmake
- sudo apt-get install -y shiboken
Expand Down
7 changes: 6 additions & 1 deletion src/Mod/Plot/Plot.py
Expand Up @@ -25,14 +25,19 @@

import PySide
from PySide import QtCore, QtGui
from distutils.version import StrictVersion as V

try:
import matplotlib
matplotlib.use('Qt4Agg')
matplotlib.rcParams['backend.qt4']='PySide'
import matplotlib.pyplot as plt
from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas
from matplotlib.backends.backend_qt4agg import NavigationToolbar2QTAgg as NavigationToolbar
if V(matplotlib.__version__) < V("1.5.0"):
from matplotlib.backends.backend_qt4agg import NavigationToolbar2QTAgg as NavigationToolbar
else:
from matplotlib.backends.backend_qt4agg import NavigationToolbar2QT as NavigationToolbar

from matplotlib.figure import Figure
except ImportError:
msg = PySide.QtGui.QApplication.translate(
Expand Down

0 comments on commit 9f907f5

Please sign in to comment.