Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit eaee1cf

Browse files
committed
small cursor fix
svn path=/trunk/matplotlib/; revision=1586
1 parent 05c6f21 commit eaee1cf

9 files changed

Lines changed: 46 additions & 11 deletions

File tree

CHANGELOG

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
New entries should be added at the top
22

3+
2005-08-05 Added Clovis Goldemberg patch to the tk save dialog
4+
35
2005-08-04 Removed origin kwarg from backend.draw_image. origin is
46
handled entirely by the frontend now.
57

examples/animation_blit.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# the wiki entry
33
# http://www.scipy.org/wikis/topical_software/MatplotlibAnimation
44
import matplotlib
5-
matplotlib.use('GTKAgg')
5+
#matplotlib.use('GTKAgg')
66
import sys
77
import gtk, gobject
88
import pylab as p
@@ -50,7 +50,7 @@ def update_line(*args):
5050
return True
5151
update_line.cnt = 0
5252

53-
gobject.idle_add(update_line)
53+
#gobject.idle_add(update_line)
5454
p.show()
5555

5656

lib/matplotlib/axes.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2363,6 +2363,10 @@ def pie(self, x, explode=None, labels=None,
23632363
shadow=False
23642364
):
23652365
"""
2366+
PIE(x, explode=None, labels=None,
2367+
colors=('b', 'g', 'r', 'c', 'm', 'y', 'k', 'w'),
2368+
autopct=None, shadow=False)
2369+
23662370
Make a pie chart of array x. The fractional area of each wedge is
23672371
given by x/sum(x). If sum(x)<=1, then the values of x give the
23682372
fractional area directly and the array will not be normalized.
@@ -2397,7 +2401,7 @@ def pie(self, x, explode=None, labels=None,
23972401
If autopct is not None, return (patches, texts, autotexts), where
23982402
patches and texts are as above, and autotexts is a list of text
23992403
instances for the numeric labels
2400-
"""
2404+
"""
24012405
self.set_frame_on(False)
24022406

24032407
x = asarray(x).astype(Float32)

lib/matplotlib/backends/backend_gtkagg.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ def _render_figure(self, pixmap, width, height):
7171
agg_to_gtk_drawable(pixmap, self.renderer._renderer, None)
7272

7373
def blit(self, bbox=None):
74+
7475
agg_to_gtk_drawable(self._pixmap, self.renderer._renderer, bbox)
7576
x, y, w, h = self.allocation
7677
self.window.draw_drawable (self.style.fg_gc[self.state], self._pixmap,

lib/matplotlib/backends/backend_tkagg.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -612,6 +612,30 @@ def configure_subplots(self):
612612
canvas.get_tk_widget().pack(side=Tk.TOP, fill=Tk.BOTH, expand=1)
613613

614614
def save_figure(self):
615+
from tkFileDialog import asksaveasfilename
616+
617+
fname = asksaveasfilename(
618+
master=self.window,
619+
title='Save the figure',
620+
filetypes=[
621+
('Portable Network Graphics','*.png'),
622+
('Encapsulated Postscript File','*.eps'),
623+
('Scalable Vector Graphics','*.svg'),
624+
625+
])
626+
627+
if fname == "" :
628+
return
629+
else:
630+
bname, fext = os.path.splitext(fname)
631+
if (fext.lower()=='.png'):
632+
self.canvas.print_figure(fname, dpi=300)
633+
elif (fext.lower()=='.eps'):
634+
self.canvas.print_figure(fname)
635+
elif (fext.lower()=='.svg'):
636+
self.canvas.print_figure(fname)
637+
638+
def _save_figure(self):
615639
fs = FileDialog.SaveFileDialog(master=self.window,
616640
title='Save the figure')
617641
try:

lib/matplotlib/font_manager.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -452,11 +452,11 @@ def createFontDict(fontfiles, fontext='ttf'):
452452
continue
453453
prop = afmFontProperty(font)
454454
else:
455-
#try:
456-
font = ft2font.FT2Font(str(fpath))
457-
#except RuntimeError:
458-
# warnings.warn("Could not open font file %s"%fpath)
459-
# continue
455+
try:
456+
font = ft2font.FT2Font(str(fpath))
457+
except RuntimeError:
458+
warnings.warn("Could not open font file %s"%fpath)
459+
continue
460460
try: prop = ttfFontProperty(font)
461461
except: continue
462462

lib/matplotlib/widgets.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -635,7 +635,8 @@ def __init__(self, ax, useblit=False, **lineprops):
635635

636636
def clear(self, event):
637637
'clear the cursor'
638-
self.background = self.canvas.copy_from_bbox(self.ax.bbox)
638+
if self.useblit:
639+
self.background = self.canvas.copy_from_bbox(self.ax.bbox)
639640
self.linev.set_visible(False)
640641
self.lineh.set_visible(False)
641642

@@ -652,9 +653,11 @@ def onmove(self, event):
652653
self.needclear = True
653654
if not self.visible: return
654655
self.linev.set_xdata((event.xdata, event.xdata))
656+
655657
self.lineh.set_ydata((event.ydata, event.ydata))
656658
self.linev.set_visible(self.visible and self.vertOn)
657659
self.lineh.set_visible(self.visible and self.horizOn)
660+
658661
self._update()
659662

660663

@@ -667,6 +670,7 @@ def _update(self):
667670
self.ax.draw_artist(self.lineh)
668671
self.canvas.blit(self.ax.bbox)
669672
else:
673+
670674
self.canvas.draw_idle()
671675

672676
return False

src/_backend_agg.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ RendererAgg::set_clipbox_rasterizer( double *cliprect) {
221221
//set the clip rectangle from the gc
222222

223223
_VERBOSE("RendererAgg::set_clipbox_rasterizer");
224-
224+
225225
if (cliprect==NULL) {
226226
theRasterizer->reset_clipping();
227227
rendererBase->reset_clipping(true);

src/_gtkagg.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ class _gtkagg_module : public Py::ExtensionModule<_gtkagg_module>
6969
deststride = srcstride;
7070
}
7171
else {
72-
//bbos is not None; copy the image in the bbox
72+
//bbox is not None; copy the image in the bbox
7373

7474
Bbox* clipbox = static_cast<Bbox*>(args[2].ptr());
7575
double l = clipbox->ll_api()->x_api()->val() ;

0 commit comments

Comments
 (0)