SF.net SVN: matplotlib:[8417] trunk/matplotlib

2010-06-12 Thread mdehoon
Revision: 8417
  http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8417&view=rev
Author:   mdehoon
Date: 2010-06-12 07:48:54 + (Sat, 12 Jun 2010)

Log Message:
---
No CGContextGetLineWidth in Cocoa; pass the line width from Python instead.

Modified Paths:
--
trunk/matplotlib/lib/matplotlib/backends/backend_macosx.py
trunk/matplotlib/src/_macosx.m

Modified: trunk/matplotlib/lib/matplotlib/backends/backend_macosx.py
===
--- trunk/matplotlib/lib/matplotlib/backends/backend_macosx.py  2010-06-12 
06:53:03 UTC (rev 8416)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_macosx.py  2010-06-12 
07:48:54 UTC (rev 8417)
@@ -52,12 +52,14 @@
 def draw_path(self, gc, path, transform, rgbFace=None):
 if rgbFace is not None:
 rgbFace = tuple(rgbFace)
-gc.draw_path(path, transform, rgbFace)
+linewidth = gc.get_linewidth()
+gc.draw_path(path, transform, linewidth, rgbFace)
 
 def draw_markers(self, gc, marker_path, marker_trans, path, trans, 
rgbFace=None):
 if rgbFace is not None:
 rgbFace = tuple(rgbFace)
-gc.draw_markers(marker_path, marker_trans, path, trans, rgbFace)
+linewidth = gc.get_linewidth()
+gc.draw_markers(marker_path, marker_trans, path, trans, linewidth, 
rgbFace)
 
 def draw_path_collection(self, gc, master_transform, paths, all_transforms,
  offsets, offsetTrans, facecolors, edgecolors,

Modified: trunk/matplotlib/src/_macosx.m
===
--- trunk/matplotlib/src/_macosx.m  2010-06-12 06:53:03 UTC (rev 8416)
+++ trunk/matplotlib/src/_macosx.m  2010-06-12 07:48:54 UTC (rev 8417)
@@ -864,6 +864,7 @@
 PyObject* path;
 PyObject* transform;
 PyObject* rgbFace;
+float linewidth;
 
 int n;
 
@@ -878,9 +879,10 @@
 return NULL;
 }
 
-if(!PyArg_ParseTuple(args, "OO|O",
+if(!PyArg_ParseTuple(args, "OOf|O",
&path,
&transform,
+   &linewidth,
&rgbFace)) return NULL;
 
 if(rgbFace==Py_None) rgbFace = NULL;
@@ -891,7 +893,7 @@
   0,
   rect,
   QUANTIZE_AUTO,
-  CGContextGetLineWidth(self),
+  linewidth,
   rgbFace == NULL);
 if (!iterator)
 {
@@ -969,7 +971,7 @@
   0,
   rect,
   QUANTIZE_AUTO,
-  CGContextGetLineWidth(self),
+  linewidth,
   0);
 if (!iterator)
 {
@@ -995,6 +997,7 @@
 PyObject* marker_transform;
 PyObject* path;
 PyObject* transform;
+float linewidth;
 PyObject* rgbFace;
 
 int ok;
@@ -1015,11 +1018,12 @@
 return NULL;
 }
 
-if(!PyArg_ParseTuple(args, "|O",
+if(!PyArg_ParseTuple(args, "f|O",
&marker_path,
&marker_transform,
&path,
&transform,
+   &linewidth,
&rgbFace)) return NULL;
 
 if(rgbFace==Py_None) rgbFace = NULL;
@@ -1046,7 +1050,7 @@
  0,
  rect,
  mode,
- CGContextGetLineWidth(self),
+ linewidth,
  0);
 if (!iterator)
 {


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

--
ThinkGeek and WIRED's GeekDad team up for the Ultimate 
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
lucky parental unit.  See the prize list and enter to win: 
http://p.sf.net/sfu/thinkgeek-promo
___
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins


SF.net SVN: matplotlib:[8418] trunk/matplotlib/lib/matplotlib/legend.py

2010-06-12 Thread leejjoon
Revision: 8418
  http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8418&view=rev
Author:   leejjoon
Date: 2010-06-12 16:07:42 + (Sat, 12 Jun 2010)

Log Message:
---
Fix markerscale and scatterpoints keyword arguments in legend. Thanks to Erik 
Tollerud

Modified Paths:
--
trunk/matplotlib/lib/matplotlib/legend.py

Modified: trunk/matplotlib/lib/matplotlib/legend.py
===
--- trunk/matplotlib/lib/matplotlib/legend.py   2010-06-12 07:48:54 UTC (rev 
8417)
+++ trunk/matplotlib/lib/matplotlib/legend.py   2010-06-12 16:07:42 UTC (rev 
8418)
@@ -53,9 +53,9 @@
 bbox = self.legend.get_bbox_to_anchor()
 _bbox_transform = BboxTransformFrom(bbox)
 self.legend._loc = 
tuple(_bbox_transform.transform_point(loc_in_canvas))
-
 
 
+
 class Legend(Artist):
 """
 Place a legend on the axes at location loc.  Labels are a
@@ -256,7 +256,7 @@
 self._scatteryoffsets = np.array([3./8., 4./8., 2.5/8.])
 else:
 self._scatteryoffsets = np.asarray(scatteryoffsets)
-reps =  int(self.numpoints / len(self._scatteryoffsets)) + 1
+reps =  int(self.scatterpoints / len(self._scatteryoffsets)) + 1
 self._scatteryoffsets = np.tile(self._scatteryoffsets, 
reps)[:self.scatterpoints]
 
 # _legend_box is an OffsetBox instance that contains all
@@ -519,6 +519,9 @@
 legline_marker.set_clip_box(None)
 legline_marker.set_clip_path(None)
 legline_marker.set_linestyle('None')
+if self.markerscale !=1:
+newsz = legline_marker.get_markersize()*self.markerscale
+legline_marker.set_markersize(newsz)
 # we don't want to add this to the return list because
 # the texts and handles are assumed to be in one-to-one
 # correpondence.
@@ -554,11 +557,8 @@
 #ydata = self._scatteryoffsets
 ydata = height*self._scatteryoffsets
 
-size_max, size_min = max(handle.get_sizes()),\
- min(handle.get_sizes())
-# we may need to scale these sizes by "markerscale"
-# attribute. But other handle types does not seem
-# to care about this attribute and it is currently ignored.
+size_max, size_min = 
max(handle.get_sizes())*self.markerscale**2,\
+ 
min(handle.get_sizes())*self.markerscale**2
 if self.scatterpoints < 4:
 sizes = [.5*(size_max+size_min), size_max,
  size_min]
@@ -582,11 +582,8 @@
 
 ydata = height*self._scatteryoffsets
 
-size_max, size_min = max(handle.get_sizes()),\
- min(handle.get_sizes())
-# we may need to scale these sizes by "markerscale"
-# attribute. But other handle types does not seem
-# to care about this attribute and it is currently ignored.
+size_max, size_min = 
max(handle.get_sizes())*self.markerscale**2,\
+ 
min(handle.get_sizes())*self.markerscale**2
 if self.scatterpoints < 4:
 sizes = [.5*(size_max+size_min), size_max,
  size_min]
@@ -937,7 +934,7 @@
   * True : turn draggable on
 
   * False : turn draggable off
-  
+
 If draggable is on, you can drag the legend on the canvas with
 the mouse.  The DraggableLegend helper instance is returned if
 draggable is on.
@@ -947,7 +944,7 @@
 # if state is None we'll toggle
 if state is None:
 state = not is_draggable
-
+
 if state:
 if self._draggable is None:
 self._draggable = DraggableLegend(self, use_blit)


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

--
ThinkGeek and WIRED's GeekDad team up for the Ultimate 
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
lucky parental unit.  See the prize list and enter to win: 
http://p.sf.net/sfu/thinkgeek-promo
___
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins


SF.net SVN: matplotlib:[8419] trunk/matplotlib/lib/matplotlib/windowing.py

2010-06-12 Thread efiring
Revision: 8419
  http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8419&view=rev
Author:   efiring
Date: 2010-06-12 21:30:38 + (Sat, 12 Jun 2010)

Log Message:
---
windowing: add module docstring, fix import

Modified Paths:
--
trunk/matplotlib/lib/matplotlib/windowing.py

Modified: trunk/matplotlib/lib/matplotlib/windowing.py
===
--- trunk/matplotlib/lib/matplotlib/windowing.py2010-06-12 16:07:42 UTC 
(rev 8418)
+++ trunk/matplotlib/lib/matplotlib/windowing.py2010-06-12 21:30:38 UTC 
(rev 8419)
@@ -1,3 +1,11 @@
+"""
+MS Windows-specific helper for TkAgg and FltkAgg backends.
+
+With rcParams['tk.window_focus'] default of False, it is
+effectively disabled.
+
+It uses a tiny C++ extension module to access MS Win functions.
+"""
 from matplotlib import rcParams
 
 try:
@@ -3,5 +11,5 @@
 if not rcParams['tk.window_focus']:
 raise ImportError
-from _windowing import GetForegroundWindow, SetForegroundWindow
+from matplotlib._windowing import GetForegroundWindow, SetForegroundWindow
 except ImportError:
 def GetForegroundWindow():


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

--
ThinkGeek and WIRED's GeekDad team up for the Ultimate 
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
lucky parental unit.  See the prize list and enter to win: 
http://p.sf.net/sfu/thinkgeek-promo
___
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins


SF.net SVN: matplotlib:[8420] trunk/matplotlib/lib/matplotlib/backends/ backend_tkagg.py

2010-06-12 Thread efiring
Revision: 8420
  http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8420&view=rev
Author:   efiring
Date: 2010-06-12 22:08:16 + (Sat, 12 Jun 2010)

Log Message:
---
backend_tkagg: show() gets an experimental kwarg for testing blocking mode.
By default, the behavior of show() is unchanged--it does not block, and
it forces interactive mode on.  show(block=True) is intended to make
it behave the same as in the other common backends, blocking until
all figures have been closed.

Modified Paths:
--
trunk/matplotlib/lib/matplotlib/backends/backend_tkagg.py

Modified: trunk/matplotlib/lib/matplotlib/backends/backend_tkagg.py
===
--- trunk/matplotlib/lib/matplotlib/backends/backend_tkagg.py   2010-06-12 
21:30:38 UTC (rev 8419)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_tkagg.py   2010-06-12 
22:08:16 UTC (rev 8420)
@@ -3,17 +3,20 @@
 from __future__ import division
 
 import os, sys, math
+import os.path
 
 import Tkinter as Tk, FileDialog
-import tkagg # Paint image to Tk photo blitter extension
-from backend_agg import FigureCanvasAgg
 
-import os.path
+# Paint image to Tk photo blitter extension
+import import matplotlib.backends.tkagg as tkagg
 
+from matplotlib.backends.backend_agg import FigureCanvasAgg
+
 import matplotlib
 from matplotlib.cbook import is_string_like
-from matplotlib.backend_bases import RendererBase, GraphicsContextBase, \
- FigureManagerBase, FigureCanvasBase, NavigationToolbar2, cursors, 
TimerBase
+from matplotlib.backend_bases import RendererBase, GraphicsContextBase
+from matplotlib.backend_bases import FigureManagerBase, FigureCanvasBase,
+from matplotlib.backend_bases import NavigationToolbar2, cursors, TimerBase
 
 from matplotlib.figure import Figure
 from matplotlib._pylab_helpers import Gcf
@@ -61,25 +64,43 @@
 figManager.show()
 
 
-def show():
+def show(block=False):
 """
-Show all the figures and enter the gtk mainloop
+Show all figures.
 
-This should be the last line of your script.  This function sets
-interactive mode to True, as detailed on
-http://matplotlib.sf.net/interactive.html
+Temporary, experimental kwarg *block* defaults to False to
+provide the behavior present throughout mpl history to date:
+interactive mode is forced on, and show does not block.
+
+Set *block* to True to test the proposed new behavior,
+consistent with other backends, in which show does not affect
+interactive mode, and always blocks until all figures are closed.
+In addition, the rcParam['tk.pythoninspect'] is ignored.
+
+Use this kwarg only for testing; other backends do not accept
+a kwarg to show, and might never do so.
 """
 for manager in Gcf.get_all_fig_managers():
 manager.show()
-import matplotlib
-matplotlib.interactive(True)
-if rcParams['tk.pythoninspect']:
-os.environ['PYTHONINSPECT'] = '1'
-if show._needmain:
+if block:
+# proposed new behavior; seems to make this backend consistent
+# with others, with no drawbacks identified yet.
 Tk.mainloop()
-show._needmain = False
-show._needmain = True
+else:
+# long-time behavior: non-blocking, forces interactive mode
+import matplotlib
+matplotlib.interactive(True)
+if rcParams['tk.pythoninspect']:
+os.environ['PYTHONINSPECT'] = '1'
+if show._needmain:
+Tk.mainloop()
+show._needmain = False
 
+show._needmain = True   # This can go away if we eliminate block=False option.
+
+
+
+
 def new_figure_manager(num, *args, **kwargs):
 """
 Create a new figure manager instance
@@ -98,7 +119,7 @@
 class TimerTk(TimerBase):
 '''
 Subclass of :class:`backend_bases.TimerBase` that uses Tk's timer events.
-
+
 Attributes:
 * interval: The time between timer events in milliseconds. Default
 is 1000 ms.
@@ -213,7 +234,7 @@
 root = self._tkcanvas.winfo_toplevel()
 root.bind("", self.scroll_event_windows)
 
-# Can't get destroy events by binding ot _tkcanvas. Therefore, bind
+# Can't get destroy events by binding to _tkcanvas. Therefore, bind
 # to the window and filter.
 def filter_destroy(evt):
 if evt.widget is self._tkcanvas:
@@ -363,9 +384,9 @@
 Creates a new backend-specific subclass of 
:class:`backend_bases.Timer`.
 This is useful for getting periodic events through the backend's native
 event loop. Implemented only for backends with GUIs.
-
+
 optional arguments:
-
+
 *interval*
   Timer interval in milliseconds
 *callbacks*
@@ -449,17 +470,15 @@
 this function doesn't segfault but causes the
 PyEval_RestoreThread: NULL state bug on win32
 """
-
-def destroy(*args):
-self.window

SF.net SVN: matplotlib:[8421] trunk/matplotlib/lib/matplotlib/backends/ backend_tkagg.py

2010-06-12 Thread efiring
Revision: 8421
  http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8421&view=rev
Author:   efiring
Date: 2010-06-12 22:32:18 + (Sat, 12 Jun 2010)

Log Message:
---
backend_tkagg: fix major typo from last commit

Modified Paths:
--
trunk/matplotlib/lib/matplotlib/backends/backend_tkagg.py

Modified: trunk/matplotlib/lib/matplotlib/backends/backend_tkagg.py
===
--- trunk/matplotlib/lib/matplotlib/backends/backend_tkagg.py   2010-06-12 
22:08:16 UTC (rev 8420)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_tkagg.py   2010-06-12 
22:32:18 UTC (rev 8421)
@@ -8,7 +8,7 @@
 import Tkinter as Tk, FileDialog
 
 # Paint image to Tk photo blitter extension
-import import matplotlib.backends.tkagg as tkagg
+import matplotlib.backends.tkagg as tkagg
 
 from matplotlib.backends.backend_agg import FigureCanvasAgg
 


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

--
ThinkGeek and WIRED's GeekDad team up for the Ultimate 
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
lucky parental unit.  See the prize list and enter to win: 
http://p.sf.net/sfu/thinkgeek-promo
___
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins


SF.net SVN: matplotlib:[8422] trunk/matplotlib/lib/matplotlib/backends/ backend_tkagg.py

2010-06-12 Thread efiring
Revision: 8422
  http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8422&view=rev
Author:   efiring
Date: 2010-06-12 23:08:11 + (Sat, 12 Jun 2010)

Log Message:
---
backend_tkagg: one more typo from commit before last

Modified Paths:
--
trunk/matplotlib/lib/matplotlib/backends/backend_tkagg.py

Modified: trunk/matplotlib/lib/matplotlib/backends/backend_tkagg.py
===
--- trunk/matplotlib/lib/matplotlib/backends/backend_tkagg.py   2010-06-12 
22:32:18 UTC (rev 8421)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_tkagg.py   2010-06-12 
23:08:11 UTC (rev 8422)
@@ -15,7 +15,7 @@
 import matplotlib
 from matplotlib.cbook import is_string_like
 from matplotlib.backend_bases import RendererBase, GraphicsContextBase
-from matplotlib.backend_bases import FigureManagerBase, FigureCanvasBase,
+from matplotlib.backend_bases import FigureManagerBase, FigureCanvasBase
 from matplotlib.backend_bases import NavigationToolbar2, cursors, TimerBase
 
 from matplotlib.figure import Figure


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

--
ThinkGeek and WIRED's GeekDad team up for the Ultimate 
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
lucky parental unit.  See the prize list and enter to win: 
http://p.sf.net/sfu/thinkgeek-promo
___
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins


SF.net SVN: matplotlib:[8423] trunk/matplotlib/lib/matplotlib

2010-06-12 Thread efiring
Revision: 8423
  http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8423&view=rev
Author:   efiring
Date: 2010-06-12 23:40:19 + (Sat, 12 Jun 2010)

Log Message:
---
backends: move windowing.py into backends--it is very backend-specific

Modified Paths:
--
trunk/matplotlib/lib/matplotlib/backends/backend_fltkagg.py
trunk/matplotlib/lib/matplotlib/backends/backend_tkagg.py

Added Paths:
---
trunk/matplotlib/lib/matplotlib/backends/windowing.py

Removed Paths:
-
trunk/matplotlib/lib/matplotlib/windowing.py

Modified: trunk/matplotlib/lib/matplotlib/backends/backend_fltkagg.py
===
--- trunk/matplotlib/lib/matplotlib/backends/backend_fltkagg.py 2010-06-12 
23:08:11 UTC (rev 8422)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_fltkagg.py 2010-06-12 
23:40:19 UTC (rev 8423)
@@ -26,7 +26,7 @@
  NavigationToolbar2, cursors
 from matplotlib.figure import Figure
 from matplotlib._pylab_helpers import Gcf
-import matplotlib.windowing as windowing
+import matplotlib.backends.windowing as windowing
 from matplotlib.widgets import SubplotTool
 
 

Modified: trunk/matplotlib/lib/matplotlib/backends/backend_tkagg.py
===
--- trunk/matplotlib/lib/matplotlib/backends/backend_tkagg.py   2010-06-12 
23:08:11 UTC (rev 8422)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_tkagg.py   2010-06-12 
23:40:19 UTC (rev 8423)
@@ -11,6 +11,7 @@
 import matplotlib.backends.tkagg as tkagg
 
 from matplotlib.backends.backend_agg import FigureCanvasAgg
+import matplotlib.backends.windowing as windowing
 
 import matplotlib
 from matplotlib.cbook import is_string_like
@@ -21,7 +22,6 @@
 from matplotlib.figure import Figure
 from matplotlib._pylab_helpers import Gcf
 
-import matplotlib.windowing as windowing
 from matplotlib.widgets import SubplotTool
 
 import matplotlib.cbook as cbook

Copied: trunk/matplotlib/lib/matplotlib/backends/windowing.py (from rev 8419, 
trunk/matplotlib/lib/matplotlib/windowing.py)
===
--- trunk/matplotlib/lib/matplotlib/backends/windowing.py   
(rev 0)
+++ trunk/matplotlib/lib/matplotlib/backends/windowing.py   2010-06-12 
23:40:19 UTC (rev 8423)
@@ -0,0 +1,26 @@
+"""
+MS Windows-specific helper for TkAgg and FltkAgg backends.
+
+With rcParams['tk.window_focus'] default of False, it is
+effectively disabled.
+
+It uses a tiny C++ extension module to access MS Win functions.
+"""
+from matplotlib import rcParams
+
+try:
+if not rcParams['tk.window_focus']:
+raise ImportError
+from matplotlib._windowing import GetForegroundWindow, SetForegroundWindow
+except ImportError:
+def GetForegroundWindow():
+return 0
+def SetForegroundWindow(hwnd):
+pass
+
+class FocusManager:
+def __init__(self):
+self._shellWindow = GetForegroundWindow()
+
+def __del__(self):
+SetForegroundWindow(self._shellWindow)

Deleted: trunk/matplotlib/lib/matplotlib/windowing.py
===
--- trunk/matplotlib/lib/matplotlib/windowing.py2010-06-12 23:08:11 UTC 
(rev 8422)
+++ trunk/matplotlib/lib/matplotlib/windowing.py2010-06-12 23:40:19 UTC 
(rev 8423)
@@ -1,26 +0,0 @@
-"""
-MS Windows-specific helper for TkAgg and FltkAgg backends.
-
-With rcParams['tk.window_focus'] default of False, it is
-effectively disabled.
-
-It uses a tiny C++ extension module to access MS Win functions.
-"""
-from matplotlib import rcParams
-
-try:
-if not rcParams['tk.window_focus']:
-raise ImportError
-from matplotlib._windowing import GetForegroundWindow, SetForegroundWindow
-except ImportError:
-def GetForegroundWindow():
-return 0
-def SetForegroundWindow(hwnd):
-pass
-
-class FocusManager:
-def __init__(self):
-self._shellWindow = GetForegroundWindow()
-
-def __del__(self):
-SetForegroundWindow(self._shellWindow)


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

--
ThinkGeek and WIRED's GeekDad team up for the Ultimate 
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
lucky parental unit.  See the prize list and enter to win: 
http://p.sf.net/sfu/thinkgeek-promo
___
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins