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

Skip to content

Commit 939a992

Browse files
committed
Initial pass of Gtk, Qt, Qt4, Fltk and Wx GUI backends. Lots more
examples passing. svn path=/branches/transforms/; revision=3996
1 parent 1692460 commit 939a992

24 files changed

Lines changed: 222 additions & 169 deletions

PASSED_DEMOS

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@ accented_text.py O
22
agg_buffer_to_array.py O
33
agg_oo.py O
44
agg_resize.py [BROKEN IN TRUNK]
5-
agg_test.py
5+
agg_test.py ???
66
alignment_test.py O
7-
animation_blit_fltk.py
8-
animation_blit.py
9-
animation_blit_qt4.py
10-
animation_blit_qt.py
11-
animation_blit_tk.py
12-
animation_blit_wx.py
7+
animation_blit_fltk.py [terminate called after throwing an instance of 'Swig::DirectorMethodException']
8+
animation_blit.py O
9+
animation_blit_qt4.py O
10+
animation_blit_qt.py O
11+
animation_blit_tk.py O
12+
animation_blit_wx.py O
1313
anim.py O [BUT SLOWER]
1414
annotation_demo.py O
1515
anscombe.py O
@@ -56,24 +56,24 @@ date_demo_convert.py O
5656
date_demo_rrule.py O
5757
date_index_formatter.py O
5858
dynamic_collection.py O
59-
dynamic_demo.py [GTK]
60-
dynamic_demo_wx.py [WX]
61-
dynamic_image_gtkagg.py
62-
dynamic_image_wxagg2.py
63-
dynamic_image_wxagg.py
59+
dynamic_demo.py O
60+
dynamic_demo_wx.py [REQUIRES NON-AGG WX RENDERER, WHICH IS NOT YET IMPLEMENTED]
61+
dynamic_image_gtkagg.py O
62+
dynamic_image_wxagg2.py O
63+
dynamic_image_wxagg.py
6464
ellipse_demo.py O
6565
ellipse_rotated.py O
66-
embedding_in_gtk2.py
67-
embedding_in_gtk3.py
68-
embedding_in_gtk.py
69-
embedding_in_qt4.py
70-
embedding_in_qt.py
71-
embedding_in_tk2.py
72-
embedding_in_tk.py
73-
embedding_in_wx2.py
74-
embedding_in_wx3.py
75-
embedding_in_wx4.py
76-
embedding_in_wx.py
66+
embedding_in_gtk2.py [REQUIRES NON-AGG GDK RENDERER, WHICH IS NOT YET IMPLEMENTED]
67+
embedding_in_gtk3.py O
68+
embedding_in_gtk.py [REQUIRES NON-AGG GDK RENDERER, WHICH IS NOT YET IMPLEMENTED]
69+
embedding_in_qt4.py O
70+
embedding_in_qt.py O
71+
embedding_in_tk2.py O
72+
embedding_in_tk.py O
73+
embedding_in_wx2.py [IDENTICAL BUG IN TRUNK -- Y-AXIS VALUES ARE TRUNCATED]
74+
embedding_in_wx3.py O
75+
embedding_in_wx4.py O
76+
embedding_in_wx.py [REQUIRES NON-AGG WX RENDERER, WHICH IS NOT YET IMPLEMENTED]
7777
errorbar_demo.py O
7878
errorbar_limits.py O
7979
figimage_demo.py O
@@ -91,20 +91,20 @@ fonts_demo.py O
9191
font_table_ttf.py [N/A]
9292
ftface_props.py [N/A]
9393
ganged_plots.py O
94-
glyph_to_path.py [Requires PIL]
94+
glyph_to_path.py O
9595
gradient_bar.py O
96-
gtk_spreadsheet.py
96+
gtk_spreadsheet.py [REQUIRES NON-AGG GDK RENDERER, WHICH IS NOT YET IMPLEMENTED]
9797
hatch_demo.py O
9898
histogram_demo_canvasagg.py [???]
9999
histogram_demo.py O
100100
image_demo2.py O
101-
image_demo3.py [Requires PIL]
101+
image_demo3.py O
102102
image_demo.py O
103103
image_interp.py O
104104
image_masked.py O [Whew!]
105105
image_origin.py O
106106
image_slices_viewer.py [BROKEN ON TRUNK]
107-
__init__.py
107+
__init__.py [N/A]
108108
integral_demo.py O
109109
interactive2.py [N/A]
110110
interactive.py [N/A]
@@ -119,7 +119,7 @@ legend_demo.py O
119119
legend_scatter.py O
120120
line_collection2.py O
121121
line_collection.py O
122-
lineprops_dialog_gtk.py
122+
lineprops_dialog_gtk.py O
123123
line_styles.py O
124124
load_converter.py O
125125
loadrec.py O
@@ -132,7 +132,7 @@ major_minor_demo2.py O
132132
masked_demo.py O
133133
mathtext_demo.py O
134134
mathtext_examples.py O
135-
mathtext_wx.py
135+
mathtext_wx.py O
136136
matplotlib_icon.py [N/A]
137137
matshow.py O
138138
movie_demo.py O

examples/dynamic_demo_wx.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@
6262
FigureManager, NavigationToolbar2Wx
6363

6464
from matplotlib.figure import Figure
65-
from matplotlib.axes import Subplot
6665
import numpy
6766
from wx import *
6867

examples/embedding_in_gtk.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
import gtk
88

9-
from matplotlib.axes import Subplot
109
from matplotlib.figure import Figure
1110
from numpy import arange, sin, pi
1211

examples/embedding_in_gtk2.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
"""
66
import gtk
77

8-
from matplotlib.axes import Subplot
98
from matplotlib.figure import Figure
109
from numpy import arange, sin, pi
1110

examples/embedding_in_gtk3.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
import gtk
77

8-
from matplotlib.axes import Subplot
98
from matplotlib.figure import Figure
109
from numpy import arange, sin, pi
1110

examples/embedding_in_tk.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
matplotlib.use('TkAgg')
44

55
from numpy import arange, sin, pi
6-
from matplotlib.axes import Subplot
76
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, NavigationToolbar2TkAgg
87
from matplotlib.figure import Figure
98

examples/embedding_in_tk2.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
matplotlib.use('TkAgg')
44

55
from numpy import arange, sin, pi
6-
from matplotlib.axes import Subplot
76
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, NavigationToolbar2TkAgg
87
from matplotlib.figure import Figure
98

examples/embedding_in_wx.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@
4343
FigureManager
4444

4545
from matplotlib.figure import Figure
46-
from matplotlib.axes import Subplot
4746
import numpy
4847
from wx import *
4948

lib/matplotlib/axes.py

Lines changed: 9 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1538,7 +1538,8 @@ def set_xlim(self, xmin=None, xmax=None, emit=True, **kwargs):
15381538
if other is not self:
15391539
other.set_xlim(self.viewLim.intervalx, emit=False)
15401540

1541-
self.figure.canvas.draw_idle()
1541+
if self.figure.canvas is not None:
1542+
self.figure.canvas.draw_idle()
15421543

15431544
return xmin, xmax
15441545

@@ -1697,7 +1698,8 @@ def set_ylim(self, ymin=None, ymax=None, emit=True, **kwargs):
16971698
if other is not self:
16981699
other.set_ylim(self.viewLim.ymin, self.viewLim.ymax, emit=False)
16991700

1700-
self.figure.canvas.draw_idle()
1701+
if self.figure.canvas is not None:
1702+
self.figure.canvas.draw_idle()
17011703
return ymin, ymax
17021704

17031705
def get_yscale(self):
@@ -3036,37 +3038,11 @@ def step(self, x, y, *args, **kwargs):
30363038
'''
30373039

30383040
where = kwargs.pop('where', 'pre')
3039-
3040-
if not cbook.iterable(x):
3041-
x = ma.array([x], dtype=npy.float_)
3042-
if not cbook.iterable(y):
3043-
y = ma.array([y], dtype=npy.float_)
3044-
3045-
if where=='pre':
3046-
x2 = ma.zeros((2*len(x)-1,), npy.float_)
3047-
y2 = ma.zeros((2*len(y)-1,), npy.float_)
3048-
3049-
x2[0::2], x2[1::2] = x, x[:-1]
3050-
y2[0::2], y2[1:-1:2] = y, y[1:]
3051-
3052-
elif where=='post':
3053-
x2 = ma.zeros((2*len(x)-1,), npy.float_)
3054-
y2 = ma.zeros((2*len(y)-1,), npy.float_)
3055-
3056-
x2[::2], x2[1:-1:2] = x, x[1:]
3057-
y2[0::2], y2[1::2] = y, y[:-1]
3058-
3059-
elif where=='mid':
3060-
x2 = ma.zeros((2*len(x),), npy.float_)
3061-
y2 = ma.zeros((2*len(y),), npy.float_)
3062-
3063-
x2[1:-1:2] = 0.5*(x[:-1]+x[1:])
3064-
x2[2::2] = 0.5*(x[:-1]+x[1:])
3065-
x2[0], x2[-1] = x[0], x[-1]
3066-
3067-
y2[0::2], y2[1::2] = y, y
3068-
3069-
return self.plot(x2, y2, *args, **kwargs)
3041+
if where not in ('pre', 'post', 'mid'):
3042+
raise ValueError("'where' argument to step must be 'pre', 'post' or 'mid'")
3043+
kwargs['linestyle'] = 'steps-' + where
3044+
3045+
return self.plot(x, y, *args, **kwargs)
30703046

30713047

30723048
def bar(self, left, height, width=0.8, bottom=None,

lib/matplotlib/backends/backend_fltkagg.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -140,16 +140,16 @@ def draw(self):
140140
self._oldsize =newsize
141141
self._source.resize(newsize)
142142
self._source.draw()
143-
t1,t2,w,h = self._source.figure.bbox.get_bounds()
143+
t1,t2,w,h = self._source.figure.bbox.bounds
144144
Fltk.fl_draw_image(self._source.buffer_rgba(0,0),0,0,int(w),int(h),4,0)
145145
self.redraw()
146146

147147
def blit(self,bbox=None):
148148
if bbox is None:
149-
t1,t2,w,h = self._source.figure.bbox.get_bounds()
149+
t1,t2,w,h = self._source.figure.bbox.bounds
150150
else:
151-
t1o,t2o,wo,ho = self._source.figure.bbox.get_bounds()
152-
t1,t2,w,h = bbox.get_bounds()
151+
t1o,t2o,wo,ho = self._source.figure.bbox.bounds
152+
t1,t2,w,h = bbox.bounds
153153
x,y=int(t1),int(t2)
154154
Fltk.fl_draw_image(self._source.buffer_rgba(x,y),x,y,int(w),int(h),4,int(wo)*4)
155155
#self.redraw()
@@ -222,7 +222,7 @@ def handle(self, event):
222222
class FigureCanvasFltkAgg(FigureCanvasAgg):
223223
def __init__(self, figure):
224224
FigureCanvasAgg.__init__(self,figure)
225-
t1,t2,w,h = self.figure.bbox.get_bounds()
225+
t1,t2,w,h = self.figure.bbox.bounds
226226
w, h = int(w), int(h)
227227
self.canvas=FltkCanvas(0, 0, w, h, "canvas",self)
228228
#self.draw()
@@ -263,7 +263,7 @@ class FigureManagerFltkAgg(FigureManagerBase):
263263
def __init__(self, canvas, num, window):
264264
FigureManagerBase.__init__(self, canvas, num)
265265
#Fltk container window
266-
t1,t2,w,h = canvas.figure.bbox.get_bounds()
266+
t1,t2,w,h = canvas.figure.bbox.bounds
267267
w, h = int(w), int(h)
268268
self.window = window
269269
self.window.size(w,h+30)
@@ -405,7 +405,7 @@ def __init__(self, canvas, figman):
405405
Fltk.Fl_File_Icon.load_system_icons()
406406
self._fc = Fltk.Fl_File_Chooser( ".", "*", Fltk.Fl_File_Chooser.CREATE, "Save Figure" )
407407
self._fc.hide()
408-
t1,t2,w,h = canvas.figure.bbox.get_bounds()
408+
t1,t2,w,h = canvas.figure.bbox.bounds
409409
w, h = int(w), int(h)
410410
self._group = Fltk.Fl_Pack(0,h+2,1000,26)
411411
self._group.type(Fltk.FL_HORIZONTAL)
@@ -591,7 +591,7 @@ def _init_toolbar(self):
591591
Fltk.Fl_File_Icon.load_system_icons()
592592
self._fc = Fltk.Fl_File_Chooser( ".", "*", Fltk.Fl_File_Chooser.CREATE, "Save Figure" )
593593
self._fc.hide()
594-
t1,t2,w,h = self.canvas.figure.bbox.get_bounds()
594+
t1,t2,w,h = self.canvas.figure.bbox.bounds
595595
w, h = int(w), int(h)
596596
self._group = Fltk.Fl_Pack(0,h+2,1000,26)
597597
self._group.type(Fltk.FL_HORIZONTAL)

0 commit comments

Comments
 (0)