Re: [Matplotlib-users] Easy come easy go

2010-02-18 Thread Michiel de Hoon
I just uploaded a bugfix to the repository, using *args in all the save_figure 
methods and removing the extra argument in the call to save_Figure.

--Michiel.

--- On Wed, 2/17/10, John Hunter jdh2...@gmail.com wrote:

 From: John Hunter jdh2...@gmail.com
 Subject: Re: [Matplotlib-users] Easy come easy go
 To: Michiel de Hoon mjldeh...@yahoo.com
 Cc: matplotlib-users@lists.sourceforge.net, David Arnold 
 dwarnol...@suddenlink.net
 Date: Wednesday, February 17, 2010, 9:16 AM
 On Wed, Feb 17, 2010 at 7:41 AM,
 Michiel de Hoon mjldeh...@yahoo.com
 wrote:
  An inconsistency in the definition of save_figure
 between different backends is causing this problem.
 
  The GTK backends use
     def save_figure(self, button):
 
  but the tkagg, qt, qt4, and macosx backends use
     def save_figure(self):
 
  so without the second argument. The line that is
 causing the error is
 
           
  self.canvas.toolbar.save_figure(self.canvas.toolbar)
 
  in backend_bases.py. This assumes that the save_figure
 method is defined as in the GTK backends.
 
  As far as I can tell, the GTK backend has the second
 argument because that is what pygtk passes when save_figure
 is called as a callback. The second argument is not actually
 used inside the method.
 
  So I would suggest the following:
 
  In backend_bases.py, change the offending line to
 
             self.canvas.toolbar.save_figure()
 
  and the backend_gtk, change the definition of the
 save_figure method to
 
     def save_figure(self, button-None):
 
  Any objections, anybody?
 
 
 The base class signature is
 
     def save_figure(self, *args):
         'save the current figure'
         raise NotImplementedError
 
 But I think the problem is the line
 
  
 self.canvas.toolbar.save_figure(self.canvas.toolbar)
 
 it shouldn't be passing the toolbar in, but should just
 read
 
   self.canvas.toolbar.save_figure()
 
 We could make both changes -- make sure all the signatures
 of the
 derived classes comply with
 
      def save_figure(self, *args):
 
 and remove the self.canvas.toolbar argument from the
 save_figure call.
 
 Michiel, do you want to take the lead on this?
 
 JDH
 No?
 


  

--
Download Intelreg; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs 
proactively, and fine-tune applications for parallel performance. 
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Easy come easy go

2010-02-17 Thread Michiel de Hoon
An inconsistency in the definition of save_figure between different backends is 
causing this problem.

The GTK backends use
def save_figure(self, button):

but the tkagg, qt, qt4, and macosx backends use
def save_figure(self):

so without the second argument. The line that is causing the error is

self.canvas.toolbar.save_figure(self.canvas.toolbar)

in backend_bases.py. This assumes that the save_figure method is defined as in 
the GTK backends.

As far as I can tell, the GTK backend has the second argument because that is 
what pygtk passes when save_figure is called as a callback. The second argument 
is not actually used inside the method.

So I would suggest the following:

In backend_bases.py, change the offending line to

self.canvas.toolbar.save_figure()

and the backend_gtk, change the definition of the save_figure method to

def save_figure(self, button-None):

Any objections, anybody?

--Michiel


--- On Sun, 2/14/10, David Arnold dwarnol...@suddenlink.net wrote:

 From: David Arnold dwarnol...@suddenlink.net
 Subject: [Matplotlib-users] Easy come easy go
 To: matplotlib-users@lists.sourceforge.net
 Date: Sunday, February 14, 2010, 11:36 PM
 All,
 
 This example:  
 http://matplotlib.sourceforge.net/examples/event_handling/keypress_demo.html
 
 Raises this exception o my Macbook when the key 's' is
 pressed:
 
 The debugged program raised the exception unhandled
 TypeError
 save_figure() takes exactly 1 argument (2 given)
 File:
 /Library/Frameworks/Python.framework/Versions/6.0.0/lib/python2.6/site-packages/matplotlib/backend_bases.py,
 Line: 1703
 
 David
 --
 SOLARIS 10 is the OS for Data Centers - provides features
 such as DTrace,
 Predictive Self Healing and Award Winning ZFS. Get Solaris
 10 NOW
 http://p.sf.net/sfu/solaris-dev2dev
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users
 


  

--
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Easy come easy go

2010-02-17 Thread John Hunter
On Wed, Feb 17, 2010 at 7:41 AM, Michiel de Hoon mjldeh...@yahoo.com wrote:
 An inconsistency in the definition of save_figure between different backends 
 is causing this problem.

 The GTK backends use
    def save_figure(self, button):

 but the tkagg, qt, qt4, and macosx backends use
    def save_figure(self):

 so without the second argument. The line that is causing the error is

            self.canvas.toolbar.save_figure(self.canvas.toolbar)

 in backend_bases.py. This assumes that the save_figure method is defined as 
 in the GTK backends.

 As far as I can tell, the GTK backend has the second argument because that is 
 what pygtk passes when save_figure is called as a callback. The second 
 argument is not actually used inside the method.

 So I would suggest the following:

 In backend_bases.py, change the offending line to

            self.canvas.toolbar.save_figure()

 and the backend_gtk, change the definition of the save_figure method to

    def save_figure(self, button-None):

 Any objections, anybody?


The base class signature is

def save_figure(self, *args):
'save the current figure'
raise NotImplementedError

But I think the problem is the line

  self.canvas.toolbar.save_figure(self.canvas.toolbar)

it shouldn't be passing the toolbar in, but should just read

  self.canvas.toolbar.save_figure()

We could make both changes -- make sure all the signatures of the
derived classes comply with

 def save_figure(self, *args):

and remove the self.canvas.toolbar argument from the save_figure call.

Michiel, do you want to take the lead on this?

JDH
No?

--
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Easy come easy go

2010-02-15 Thread Jae-Joon Lee
I cannot reproduce this error both with 0.99.1 maintenance branch and
the current svn (with GtkAgg backend).
What version of matplotlib and what backend are you using?

http://matplotlib.sourceforge.net/faq/troubleshooting_faq.html

Regards,

-JJ


On Sun, Feb 14, 2010 at 11:36 PM, David Arnold
dwarnol...@suddenlink.net wrote:
 All,

 This example:  
 http://matplotlib.sourceforge.net/examples/event_handling/keypress_demo.html

 Raises this exception o my Macbook when the key 's' is pressed:

 The debugged program raised the exception unhandled TypeError
 save_figure() takes exactly 1 argument (2 given)
 File: 
 /Library/Frameworks/Python.framework/Versions/6.0.0/lib/python2.6/site-packages/matplotlib/backend_bases.py,
  Line: 1703

 David
 --
 SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
 Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
 http://p.sf.net/sfu/solaris-dev2dev
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Easy come easy go

2010-02-15 Thread Gökhan Sever
On Sun, Feb 14, 2010 at 10:36 PM, David Arnold dwarnol...@suddenlink.netwrote:

 All,

 This example:
 http://matplotlib.sourceforge.net/examples/event_handling/keypress_demo.html

 Raises this exception o my Macbook when the key 's' is pressed:

 The debugged program raised the exception unhandled TypeError
 save_figure() takes exactly 1 argument (2 given)
 File:
 /Library/Frameworks/Python.framework/Versions/6.0.0/lib/python2.6/site-packages/matplotlib/backend_bases.py,
 Line: 1703


I had reported this s key-handling issue before at
http://old.nabble.com/Assigning-%22k%22-key-for-xscaling-td27262672.html

(By the way, I and Matthias expanding the key-handling functionality a
little bit further -configuring and deassigning keys etc... Maybe by means
of this e-mail someone can review the patch at that mail and apply to the
trunk)

And yes I am getting a similar error when I hit s using Qt4Agg backend on
MPL svn8105

I[1]: plt.plot(range(10))
O[1]: [matplotlib.lines.Line2D object at 0x9fa096c]

I[2]:
---
TypeError Traceback (most recent call last)

/home/gsever/Desktop/python-repo/matplotlib/lib/matplotlib/backends/backend_qt4.pyc
in keyPressEvent(self, event)
150 def keyPressEvent( self, event ):
151 key = self._get_key( event )
-- 152 FigureCanvasBase.key_press_event( self, key )
153 if DEBUG: print 'key press', key
154

/home/gsever/Desktop/python-repo/matplotlib/lib/matplotlib/backend_bases.pyc
in key_press_event(self, key, guiEvent)
   1290 s = 'key_press_event'
   1291 event = KeyEvent(s, self, key, self._lastx, self._lasty,
guiEvent=guiEvent)
- 1292 self.callbacks.process(s, event)
   1293
   1294 def key_release_event(self, key, guiEvent=None):

/home/gsever/Desktop/python-repo/matplotlib/lib/matplotlib/cbook.pyc in
process(self, s, *args, **kwargs)
167 self._check_signal(s)
168 for func in self.callbacks[s].values():
-- 169 func(*args, **kwargs)
170
171

/home/gsever/Desktop/python-repo/matplotlib/lib/matplotlib/backend_bases.pyc
in key_press(self, event)
   1890 self.canvas.toolbar.zoom()
   1891 elif event.key == s:
- 1892 self.canvas.toolbar.save_figure(self.canvas.toolbar)
   1893
   1894 if event.inaxes is None:

TypeError: save_figure() takes exactly 1 argument (2 given)

[gse...@ccn various]$ python sysinfo.py

Platform :
Linux-2.6.31.9-174.fc12.i686.PAE-i686-with-fedora-12-Constantine
Python   : ('CPython', 'tags/r262', '71600')
IPython  : 0.10
NumPy: 1.5.0.dev8038
Matplotlib   : 1.0.svn (python setupegg.py develop newer shows
matplotlib.__version__ correctly :)


Thanks.



 David

 --
 SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
 Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
 http://p.sf.net/sfu/solaris-dev2dev
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users




-- 
Gökhan
--
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users