Georg Brandl  committed 2aa0f45

gui: key_press_handler exists only in later versions of mpl

  • Participants
  • Parent commits d827d80
  • Branches default

Comments (0)

Files changed (1)

File ufit/gui/

 from PyQt4.QtCore import QSize, QSettings, Qt
 from PyQt4.QtGui import QLineEdit, QSizePolicy, QWidget
-from matplotlib.backend_bases import key_press_handler
 from matplotlib.backends.backend_qt4agg import \
      FigureCanvasQTAgg as FigureCanvas, NavigationToolbar2QT
 from matplotlib.figure import Figure
+    from matplotlib.backend_bases import key_press_handler
+except ImportError:
+    key_press_handler = None
 from ufit.plotting import DataPlotter
         self.mpl_connect('key_press_event', self.key_press)
     def key_press(self, event):
-        key_press_handler(event, self)
+        if key_press_handler:
+            key_press_handler(event, self)
     def resizeEvent(self, event):
         # reimplemented to add tight_layout()