From: <md...@us...> - 2010-06-15 13:01:29
|
Revision: 8436 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8436&view=rev Author: mdboom Date: 2010-06-15 13:01:22 +0000 (Tue, 15 Jun 2010) Log Message: ----------- Support the "Enter" key event in the Qt4 backend. Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/backends/backend_qt4.py Modified: trunk/matplotlib/lib/matplotlib/backends/backend_qt4.py =================================================================== --- trunk/matplotlib/lib/matplotlib/backends/backend_qt4.py 2010-06-14 05:51:06 UTC (rev 8435) +++ trunk/matplotlib/lib/matplotlib/backends/backend_qt4.py 2010-06-15 13:01:22 UTC (rev 8436) @@ -129,6 +129,7 @@ keyvald = { QtCore.Qt.Key_Control : 'control', QtCore.Qt.Key_Shift : 'shift', QtCore.Qt.Key_Alt : 'alt', + QtCore.Qt.Key_Return : 'enter' } # left 1, middle 2, right 3 buttond = {1:1, 2:3, 4:2} @@ -314,16 +315,19 @@ self.window._destroying = False self.toolbar = self._get_toolbar(self.canvas, self.window) - self.window.addToolBar(self.toolbar) - QtCore.QObject.connect(self.toolbar, QtCore.SIGNAL("message"), - self.window.statusBar().showMessage) + if self.toolbar is not None: + self.window.addToolBar(self.toolbar) + QtCore.QObject.connect(self.toolbar, QtCore.SIGNAL("message"), + self.window.statusBar().showMessage) + tbs_height = self.toolbar.sizeHint().height() + else: + tbs_height = 0 # resize the main window so it will display the canvas with the # requested size: cs = canvas.sizeHint() - tbs = self.toolbar.sizeHint() sbs = self.window.statusBar().sizeHint() - self.window.resize(cs.width(), cs.height()+tbs.height()+sbs.height()) + self.window.resize(cs.width(), cs.height()+tbs_height+sbs.height()) self.window.setCentralWidget(self.canvas) @@ -335,7 +339,8 @@ def notify_axes_change( fig ): # This will be called whenever the current axes is changed - if self.toolbar != None: self.toolbar.update() + if self.toolbar is not None: + self.toolbar.update() self.canvas.figure.add_axobserver( notify_axes_change ) def _widgetclosed( self ): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |