Hi all,

I'm posting to report two bugs in 'backend_qt4.py' with the latest PyQt release:
(see eventually the attached test script)

(1) in class 'NavigationToolbar2QT' l. 285-300 : I had to replace '.svg' by '.png' for all the icons to be displayed correctly on the navigation toolbar (only one was already loaded in the right file format).

(2) I still experience slow performance of pan/zoom feature with the latest PyQt release (the last release for which I had no problem is the 4.3.3 release). You'll find attached a simple test script: with PyQt 4.3.3 pan/zoom is real-time, and with PyQt 4.4.3 it's really slower (in fact, zooming and panning are happening at the right speed but after a short delay from the mouse click)

Regards,
Pierre Raybaut
#!/usr/bin/env python

import sys, os
from PyQt4 import QtGui, QtCore
from numpy import arange, sin, pi
from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas
from matplotlib.figure import Figure
from matplotlib.backends.backend_qt4 import NavigationToolbar2QT
from matplotlib.backend_bases import NavigationToolbar2

class MplCanvas(FigureCanvas):
    def __init__(self, parent=None, width=5, height=4, dpi=100):
        fig = Figure(figsize=(width, height), dpi=dpi)
        self.axes = fig.add_subplot(111)
        self.axes.hold(False)
        self.compute_initial_figure()
        FigureCanvas.__init__(self, fig)
        self.setParent(parent)
        
FigureCanvas.setSizePolicy(self,QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Expanding)
        FigureCanvas.updateGeometry(self)
    def compute_initial_figure(self):
        t = arange(0.0, 3.0, 0.01)
        self.axes.plot(t, sin(2*pi*t))

class Toolbar(NavigationToolbar2QT) :
    def __init__(self , parent , canvas, coordinates=True) :
        self.canvas = canvas
        self.coordinates = coordinates
        QtGui.QWidget.__init__( self, parent )
        NavigationToolbar2.__init__( self, canvas )
        NavigationToolbar2.pan(self)

class ApplicationWindow(QtGui.QMainWindow):
    def __init__(self):
        QtGui.QMainWindow.__init__(self)
        self.setAttribute(QtCore.Qt.WA_DeleteOnClose)
        self.main_widget = QtGui.QWidget(self)
        l = QtGui.QVBoxLayout(self.main_widget)
        sc = MplCanvas(self.main_widget, width=5, height=4, dpi=100)
        l.addWidget(sc)
        l.addWidget(Toolbar(sc , sc))
        self.main_widget.setFocus()
        self.setCentralWidget(self.main_widget)

qApp = QtGui.QApplication(sys.argv)
aw = ApplicationWindow()
aw.show()
sys.exit(qApp.exec_())
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel

Reply via email to