Revision: 5396
          http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5396&view=rev
Author:   jdh2358
Date:     2008-06-05 07:37:03 -0700 (Thu, 05 Jun 2008)

Log Message:
-----------
fixed classic toolbar bugs

Modified Paths:
--------------
    branches/v0_91_maint/lib/matplotlib/backends/backend_gtk.py
    branches/v0_91_maint/lib/matplotlib/backends/backend_tkagg.py

Modified: branches/v0_91_maint/lib/matplotlib/backends/backend_gtk.py
===================================================================
--- branches/v0_91_maint/lib/matplotlib/backends/backend_gtk.py 2008-06-05 
14:18:31 UTC (rev 5395)
+++ branches/v0_91_maint/lib/matplotlib/backends/backend_gtk.py 2008-06-05 
14:37:03 UTC (rev 5396)
@@ -353,12 +353,12 @@
             # for self.window(for pixmap) and has a side effect of altering
             # figure width,height (via configure-event?)
             gtk.DrawingArea.realize(self)
-        
+
         width, height = self.get_width_height()
         pixmap = gdk.Pixmap (self.window, width, height)
         self._renderer.set_pixmap (pixmap)
         self._render_figure(pixmap, width, height)
-        
+
         # jpg colors don't match the display very well, png colors match
         # better
         pixbuf = gdk.Pixbuf(gdk.COLORSPACE_RGB, 0, 8, width, height)
@@ -382,11 +382,11 @@
                 raise ValueError("Saving to a Python file-like object is only 
supported by PyGTK >= 2.8")
         else:
             raise ValueError("filename must be a path or a file-like object")
-            
+
     def get_default_filetype(self):
         return 'png'
 
-            
+
 class FigureManagerGTK(FigureManagerBase):
     """
     Public attributes
@@ -403,7 +403,7 @@
 
         self.window = gtk.Window()
         self.window.set_title("Figure %d" % num)
-        
+
         self.vbox = gtk.VBox()
         self.window.add(self.vbox)
         self.vbox.show()
@@ -455,7 +455,7 @@
     def show(self):
         # show the figure window
         self.window.show()
-        
+
     def full_screen_toggle (self):
         self._full_screen_flag = not self._full_screen_flag
         if self._full_screen_flag:
@@ -735,8 +735,8 @@
             self.fileselect = FileChooserDialog(
                 title='Save the figure',
                 parent=self.win,
-                formats=self.canvas.get_supported_filetypes(),
-                default_type=self.canvas.get_default_filetype())
+                filetypes=self.canvas.get_supported_filetypes(),
+                default_filetype=self.canvas.get_default_filetype())
         else:
             self._create_toolitems_2_2()
             self.update = self._update_2_2
@@ -905,53 +905,32 @@
         self._ind = ind
         self._active = [ self._axes[i] for i in self._ind ]
 
-    def panx(self, button, arg):
-        """arg is either user callback data or a scroll event
-        """
-        try:
-            if arg.direction == gdk.SCROLL_UP: direction=1
-            else: direction=-1
-        except AttributeError:
-            direction = arg
+    def panx(self, button, direction):
+        'panx in direction'
 
         for a in self._active:
-            a.panx(direction)
+            a.xaxis.pan(direction)
         self.canvas.draw()
         return True
 
-    def pany(self, button, arg):
-        try:
-            if arg.direction == gdk.SCROLL_UP: direction=1
-            else: direction=-1
-        except AttributeError:
-            direction = arg
-
+    def pany(self, button, direction):
+        'pany in direction'
         for a in self._active:
-            a.pany(direction)
+            a.yaxis.pan(direction)
         self.canvas.draw()
         return True
 
-    def zoomx(self, button, arg):
-        try:
-            if arg.direction == gdk.SCROLL_UP: direction=1
-            else: direction=-1
-        except AttributeError:
-            direction = arg
-
+    def zoomx(self, button, direction):
+        'zoomx in direction'
         for a in self._active:
-            a.zoomx(direction)
+            a.xaxis.zoom(direction)
         self.canvas.draw()
         return True
 
-    def zoomy(self, button, arg):
-        try:
-            if arg.direction == gdk.SCROLL_UP: direction=1
-            else: direction=-1
-        except AttributeError:
-            direction = arg
-
+    def zoomy(self, button, direction):
+        'zoomy in direction'
         for a in self._active:
-            a.zoomy(direction)
+            a.yaxis.zoom(direction)
         self.canvas.draw()
         return True
 
@@ -964,6 +943,7 @@
             except Exception, e:
                 error_msg_gtk(str(e), parent=self)
 
+
 if gtk.pygtk_version >= (2,4,0):
     class FileChooserDialog(gtk.FileChooserDialog):
         """GTK+ 2.4 file selector which remembers the last file/directory
@@ -1036,7 +1016,7 @@
                     break
                 filename = self.get_filename()
                 break
-                
+
             self.hide()
             return filename, self.ext
 else:
@@ -1068,8 +1048,8 @@
                 if ext.startswith('.'):
                     ext = ext[1:]
             return filename, ext
-        
 
+
 class DialogLineprops:
     """
     A GUI dialog for controlling lineprops

Modified: branches/v0_91_maint/lib/matplotlib/backends/backend_tkagg.py
===================================================================
--- branches/v0_91_maint/lib/matplotlib/backends/backend_tkagg.py       
2008-06-05 14:18:31 UTC (rev 5395)
+++ branches/v0_91_maint/lib/matplotlib/backends/backend_tkagg.py       
2008-06-05 14:37:03 UTC (rev 5396)
@@ -486,46 +486,26 @@
         self._ind = ind
         self._active = [ self._axes[i] for i in self._ind ]
 
-    def panx(self, arg):
-        try: arg.direction
-        except AttributeError: direction = arg
-        else:
-            if arg.direction == Tk.SCROLL_UP: direction=1
-            else: direction=-1
+    def panx(self, direction):
         for a in self._active:
-            a.panx(direction)
+            a.xaxis.pan(direction)
         self.canvas.draw()
 
-    def pany(self, arg):
-        try: arg.direction
-        except AttributeError: direction = arg
-        else:
-            if arg.direction == Tk.SCROLL_UP: direction=1
-            else: direction=-1
+    def pany(self, direction):
         for a in self._active:
-            a.pany(direction)
+            a.yaxis.pan(direction)
         self.canvas.draw()
 
-    def zoomx(self, arg):
-        try: arg.direction
-        except AttributeError: direction = arg
-        else:
-            if arg.direction == Tk.SCROLL_UP: direction=1
-            else: direction=-1
+    def zoomx(self, direction):
 
         for a in self._active:
-            a.zoomx(direction)
+            a.xaxis.zoom(direction)
         self.canvas.draw()
 
-    def zoomy(self, arg):
-        try: arg.direction
-        except AttributeError: direction = arg
-        else:
-            if arg.direction == Tk.SCROLL_UP: direction=1
-            else: direction=-1
+    def zoomy(self, direction):
 
         for a in self._active:
-            a.zoomy(direction)
+            a.yaxis.zoom(direction)
         self.canvas.draw()
 
     def save_figure(self):
@@ -665,14 +645,14 @@
         # so we just have to put it first
         default_filetype_name = filetypes[default_filetype]
         del filetypes[default_filetype]
-        
+
         sorted_filetypes = filetypes.items()
         sorted_filetypes.sort()
         sorted_filetypes.insert(0, (default_filetype, default_filetype_name))
-        
+
         tk_filetypes = [
             (name, '*.%s' % ext) for (ext, name) in sorted_filetypes]
-        
+
         fname = asksaveasfilename(
             master=self.window,
             title='Save the figure',


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

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins

Reply via email to