Ticket #37408: pyqt4_qsize.patch

File pyqt4_qsize.patch, 1.6 KB (added by jjstickel (Jonathan Stickel), 12 years ago)
  • chaco/shell/plot_window.py

    From e6249d1b0a13294a4894c0e2c7fce5a5929e7ffe Mon Sep 17 00:00:00 2001
    From: Robert Kern <rkern@enthought.com>
    Date: Tue, 10 Jul 2012 10:34:17 +0100
    Subject: [PATCH] BUG: Be sure to use a QSize instead of a tuple for PyQt4
     compatibility.
    
    ---
     chaco/shell/plot_window.py |    9 ++++++---
     1 file changed, 6 insertions(+), 3 deletions(-)
    
    diff --git a/chaco/shell/plot_window.py b/chaco/shell/plot_window.py
    index db8e5da..32fd969 100644
    a b def _on_window_close(self, event): 
    125125
    126126elif ETSConfig.toolkit == "qt4":
    127127
    128     from pyface.qt import QtGui
     128    from pyface.qt import QtCore, QtGui
    129129
    130130    class PlotWindow(QtGui.QFrame):
    131131        """ A window for holding top-level plot containers.
    class PlotWindow(QtGui.QFrame): 
    137137        def __init__(self, is_image=False, bgcolor="white",
    138138                     image_default_origin="top left", *args, **kw):
    139139
     140            if 'size' in kw and isinstance(kw['size'], tuple):
     141                # Convert to a QSize.
     142                kw['size'] = QtCore.QSize(*kw['size'])
    140143            super(PlotWindow, self).__init__(None, *args, **kw )
    141144
    142145            # Some defaults which should be overridden by preferences.
    def __init__(self, is_image=False, bgcolor="white", 
    163166            layout.addWidget(self.plot_window.control)
    164167            self.setLayout(layout)
    165168
    166             size = kw.setdefault("size", (600,600))
    167             self.set_size(*size)
     169            size = kw.get("size", QtCore.QSize(600,600))
     170            self.set_size(size.width(), size.height())
    168171
    169172            self.show()
    170173