Revision: 3910
          http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3910&view=rev
Author:   jrevans
Date:     2007-10-03 15:23:48 -0700 (Wed, 03 Oct 2007)

Log Message:
-----------
Moved a couple of routines from the Agg version of the FigureCanvas to the base 
qt
version where they belong.  Added a couple of overloaded qt methods that should 
be
there and reduce having to inherit when embedding in another QWidget.

Modified Paths:
--------------
    trunk/matplotlib/lib/matplotlib/backends/backend_qt.py
    trunk/matplotlib/lib/matplotlib/backends/backend_qt4.py
    trunk/matplotlib/lib/matplotlib/backends/backend_qt4agg.py
    trunk/matplotlib/lib/matplotlib/backends/backend_qtagg.py

Modified: trunk/matplotlib/lib/matplotlib/backends/backend_qt.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_qt.py      2007-10-03 
12:51:16 UTC (rev 3909)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_qt.py      2007-10-03 
22:23:48 UTC (rev 3910)
@@ -135,11 +135,38 @@
 
     def resizeEvent( self, event ):
         if DEBUG: print 'resize (%d x %d)' % (event.size().width(), 
event.size().height())
+        print "JRE--DBG: qt : resizeEvent"
         qt.QWidget.resizeEvent( self, event )
+        w = event.size().width()
+        h = event.size().height()
+        if DEBUG: print "FigureCanvasQt.resizeEvent(", w, ",", h, ")"
+        dpival = self.figure.dpi.get()
+        winch = w/dpival
+        hinch = h/dpival
+        self.figure.set_size_inches( winch, hinch )
+        self.draw()
 
     def resize( self, w, h ):
+        print "JRE--DBG: qt : resize"
+        # Pass through to Qt to resize the widget.
         qt.QWidget.resize( self, w, h )
 
+        # Resize the figure by converting pixels to inches.
+        pixelPerInch = self.figure.dpi.get()
+        wInch = w / pixelPerInch
+        hInch = h / pixelPerInch
+        self.figure.set_size_inches( wInch, hInch )
+
+        # Redraw everything.
+        self.draw()
+
+    def sizeHint( self ):
+        w, h = self.get_width_height()
+        return qt.QSize( w, h )
+
+    def minumumSizeHint( self ):
+        return qt.QSize( 10, 10 )
+
     def _get_key( self, event ):
         if event.key() < 256:
             key = event.text().latin1()

Modified: trunk/matplotlib/lib/matplotlib/backends/backend_qt4.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_qt4.py     2007-10-03 
12:51:16 UTC (rev 3909)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_qt4.py     2007-10-03 
22:23:48 UTC (rev 3910)
@@ -135,10 +135,35 @@
     def resizeEvent( self, event ):
         if DEBUG: print 'resize (%d x %d)' % (event.size().width(), 
event.size().height())
         QtGui.QWidget.resizeEvent( self, event )
+        w = event.size().width()
+        h = event.size().height()
+        if DEBUG: print "FigureCanvasQtAgg.resizeEvent(", w, ",", h, ")"
+        dpival = self.figure.dpi.get()
+        winch = w/dpival
+        hinch = h/dpival
+        self.figure.set_size_inches( winch, hinch )
+        self.draw()
 
     def resize( self, w, h ):
+        # Pass through to Qt to resize the widget.
         QtGui.QWidget.resize( self, w, h )
 
+        # Resize the figure by converting pixels to inches.
+        pixelPerInch = self.figure.dpi.get()
+        wInch = w / pixelPerInch
+        hInch = h / pixelPerInch
+        self.figure.set_size_inches( wInch, hInch )
+
+        # Redraw everything.
+        self.draw()
+
+    def sizeHint( self ):
+        w, h = self.get_width_height()
+        return QtCore.QSize( w, h )
+
+    def minumumSizeHint( self ):
+        return QtCore.QSize( 10, 10 )
+
     def _get_key( self, event ):
         if event.key() < 256:
             key = str(event.text())

Modified: trunk/matplotlib/lib/matplotlib/backends/backend_qt4agg.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_qt4agg.py  2007-10-03 
12:51:16 UTC (rev 3909)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_qt4agg.py  2007-10-03 
22:23:48 UTC (rev 3910)
@@ -65,14 +65,6 @@
 
     def resizeEvent( self, e ):
         FigureCanvasQT.resizeEvent( self, e )
-        w = e.size().width()
-        h = e.size().height()
-        if DEBUG: print "FigureCanvasQtAgg.resizeEvent(", w, ",", h, ")"
-        dpival = self.figure.dpi.get()
-        winch = w/dpival
-        hinch = h/dpival
-        self.figure.set_size_inches( winch, hinch )
-        self.draw()
 
     def drawRectangle( self, rect ):
         self.rect = rect

Modified: trunk/matplotlib/lib/matplotlib/backends/backend_qtagg.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_qtagg.py   2007-10-03 
12:51:16 UTC (rev 3909)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_qtagg.py   2007-10-03 
22:23:48 UTC (rev 3910)
@@ -64,14 +64,6 @@
 
     def resizeEvent( self, e ):
         FigureCanvasQT.resizeEvent( self, e )
-        w = e.size().width()
-        h = e.size().height()
-        if DEBUG: print "FigureCanvasQtAgg.resizeEvent(", w, ",", h, ")"
-        dpival = self.figure.dpi.get()
-        winch = w/dpival
-        hinch = h/dpival
-        self.figure.set_size_inches( winch, hinch )
-        self.draw()
 
     def drawRectangle( self, rect ):
         self.rect = rect


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins

Reply via email to