Skip to content

Commit 42055ad

Browse files
authored
Merge pull request matplotlib#10426 from QuLogic/delete-backends
Delete deprecated backends
2 parents 4f5715a + d6e93a3 commit 42055ad

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+107
-3047
lines changed

INSTALL.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,6 @@ optional Matplotlib backends and the capabilities they provide.
159159
* `PyQt4 <https://pypi.python.org/pypi/PyQt4>`_ (>= 4.4) or
160160
`PySide <https://pypi.python.org/pypi/PySide>`_: for the Qt4Agg backend;
161161
* `PyQt5 <https://pypi.python.org/pypi/PyQt5>`_: for the Qt5Agg backend;
162-
* :term:`pygtk` (>= 2.4): for the GTK and the GTKAgg backend;
163162
* :term:`wxpython` (>= 2.9 or later): for the WX or WXAgg backend;
164163
* `cairocffi <https://cairocffi.readthedocs.io/en/latest/>`__ (>=
165164
v0.8): for cairo based backends;

MANIFEST.in

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ include pytest.ini
44
include Makefile MANIFEST.in
55
include matplotlibrc.template setup.cfg.template
66
include setupext.py setup.py distribute_setup.py
7-
include lib/matplotlib/mpl-data/lineprops.glade
87
include lib/matplotlib/mpl-data/matplotlibrc
98
include lib/matplotlib/mpl-data/images/*
109
include lib/matplotlib/mpl-data/fonts/ttf/*

doc/api/backend_gtkagg_api.rst

Lines changed: 0 additions & 11 deletions
This file was deleted.

doc/api/backend_gtkcairo_api.rst

Lines changed: 0 additions & 11 deletions
This file was deleted.

doc/api/index_backend_api.rst

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ backends
1010
backend_tools_api.rst
1111
backend_agg_api.rst
1212
backend_cairo_api.rst
13-
backend_gtkagg_api.rst
14-
backend_gtkcairo_api.rst
1513
backend_gtk3agg_api.rst
1614
backend_gtk3cairo_api.rst
1715
backend_nbagg_api.rst
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
Removal of deprecated backends
2+
------------------------------
3+
4+
Deprecated backends have been removed:
5+
6+
* GTKAgg
7+
* GTKCairo
8+
* GTK
9+
* GDK

doc/glossary/index.rst

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -74,16 +74,9 @@ Glossary
7474
features of PyGObject. However Matplotlib does not use any of these
7575
missing features.
7676

77-
pygtk
78-
`pygtk <http://www.pygtk.org/>`_ provides python wrappers for
79-
the :term:`GTK` widgets library for use with the GTK or GTKAgg
80-
backend. Widely used on linux, and is often packages as
81-
'python-gtk2'
82-
8377
PyGObject
84-
Like :term:`pygtk`, `PyGObject <http://www.pygtk.org/>` provides
85-
python wrappers for the :term:`GTK` widgets library; unlike pygtk,
86-
PyGObject wraps GTK3 instead of the now obsolete GTK2.
78+
`PyGObject <http://www.pygtk.org/>`_ provides Python wrappers for the
79+
:term:`GTK` widgets library
8780

8881
pyqt
8982
`pyqt <https://wiki.python.org/moin/PyQt>`_ provides python

doc/users/navigation_toolbar.rst

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -109,31 +109,34 @@ automatically for every figure. If you are writing your own user
109109
interface code, you can add the toolbar as a widget. The exact syntax
110110
depends on your UI, but we have examples for every supported UI in the
111111
``matplotlib/examples/user_interfaces`` directory. Here is some
112-
example code for GTK::
112+
example code for GTK+ 3::
113113

114114

115-
import gtk
115+
import gi
116+
gi.require_version('Gtk', '3.0')
117+
from gi.repository import Gtk
116118

117119
from matplotlib.figure import Figure
118-
from matplotlib.backends.backend_gtkagg import FigureCanvasGTKAgg as FigureCanvas
119-
from matplotlib.backends.backend_gtkagg import NavigationToolbar2GTKAgg as NavigationToolbar
120+
from matplotlib.backends.backend_gtk3agg import FigureCanvas
121+
from matplotlib.backends.backend_gtk3 import (
122+
NavigationToolbar2GTK3 as NavigationToolbar)
120123

121-
win = gtk.Window()
122-
win.connect("destroy", lambda x: gtk.main_quit())
124+
win = Gtk.Window()
125+
win.connect("destroy", lambda x: Gtk.main_quit())
123126
win.set_default_size(400,300)
124127
win.set_title("Embedding in GTK")
125128

126-
vbox = gtk.VBox()
129+
vbox = Gtk.VBox()
127130
win.add(vbox)
128131

129132
fig = Figure(figsize=(5,4), dpi=100)
130133
ax = fig.add_subplot(111)
131134
ax.plot([1,2,3])
132135

133-
canvas = FigureCanvas(fig) # a gtk.DrawingArea
134-
vbox.pack_start(canvas)
136+
canvas = FigureCanvas(fig) # a Gtk.DrawingArea
137+
vbox.pack_start(canvas, True, True, 0)
135138
toolbar = NavigationToolbar(canvas, win)
136-
vbox.pack_start(toolbar, False, False)
139+
vbox.pack_start(toolbar, False, False, 0)
137140

138141
win.show_all()
139-
gtk.main()
142+
Gtk.main()

doc/users/shell.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ up python. Then::
100100
>>> xlabel('hi mom')
101101

102102
should work out of the box. This is also likely to work with recent
103-
versions of the qt4agg and gtkagg backends, and with the macosx backend
103+
versions of the qt4agg and gtk3agg backends, and with the macosx backend
104104
on the Macintosh. Note, in batch mode,
105105
i.e. when making
106106
figures from scripts, interactive mode can be slow since it redraws

examples/event_handling/ginput_manual_clabel_sgskip.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
waitforbuttonpress and manual clabel placement.
88
99
This script must be run interactively using a backend that has a
10-
graphical user interface (for example, using GTKAgg backend, but not
10+
graphical user interface (for example, using GTK3Agg backend, but not
1111
PS backend).
1212
1313
See also ginput_demo.py

examples/user_interfaces/embedding_in_gtk2_sgskip.py

Lines changed: 0 additions & 55 deletions
This file was deleted.

examples/user_interfaces/embedding_in_gtk3_panzoom_sgskip.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
Demonstrate NavigationToolbar with GTK3 accessed via pygobject.
77
"""
88

9+
import gi
10+
gi.require_version('Gtk', '3.0')
911
from gi.repository import Gtk
1012

1113
from matplotlib.backends.backend_gtk3 import (

examples/user_interfaces/embedding_in_gtk3_sgskip.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
GTK3 accessed via pygobject.
88
"""
99

10+
import gi
11+
gi.require_version('Gtk', '3.0')
1012
from gi.repository import Gtk
1113

1214
from matplotlib.backends.backend_gtk3agg import (

examples/user_interfaces/embedding_in_gtk_sgskip.py

Lines changed: 0 additions & 36 deletions
This file was deleted.

examples/user_interfaces/gtk_spreadsheet_sgskip.py

Lines changed: 27 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -8,55 +8,54 @@
88
data
99
1010
"""
11-
import pygtk
12-
pygtk.require('2.0')
13-
import gtk
14-
from gtk import gdk
11+
import gi
12+
gi.require_version('Gtk', '3.0')
13+
gi.require_version('Gdk', '3.0')
14+
from gi.repository import Gtk, Gdk
1515

16-
import matplotlib
17-
matplotlib.use('GTKAgg') # or 'GTK'
18-
from matplotlib.backends.backend_gtk import FigureCanvasGTK as FigureCanvas
16+
from matplotlib.backends.backend_gtk3agg import FigureCanvas
17+
# from matplotlib.backends.backend_gtk3cairo import FigureCanvas
1918

2019
from numpy.random import random
2120
from matplotlib.figure import Figure
2221

2322

24-
class DataManager(gtk.Window):
23+
class DataManager(Gtk.Window):
2524
numRows, numCols = 20, 10
2625

2726
data = random((numRows, numCols))
2827

2928
def __init__(self):
30-
gtk.Window.__init__(self)
29+
Gtk.Window.__init__(self)
3130
self.set_default_size(600, 600)
32-
self.connect('destroy', lambda win: gtk.main_quit())
31+
self.connect('destroy', lambda win: Gtk.main_quit())
3332

3433
self.set_title('GtkListStore demo')
3534
self.set_border_width(8)
3635

37-
vbox = gtk.VBox(False, 8)
36+
vbox = Gtk.VBox(False, 8)
3837
self.add(vbox)
3938

40-
label = gtk.Label('Double click a row to plot the data')
39+
label = Gtk.Label('Double click a row to plot the data')
4140

42-
vbox.pack_start(label, False, False)
41+
vbox.pack_start(label, False, False, 0)
4342

44-
sw = gtk.ScrolledWindow()
45-
sw.set_shadow_type(gtk.SHADOW_ETCHED_IN)
46-
sw.set_policy(gtk.POLICY_NEVER,
47-
gtk.POLICY_AUTOMATIC)
48-
vbox.pack_start(sw, True, True)
43+
sw = Gtk.ScrolledWindow()
44+
sw.set_shadow_type(Gtk.ShadowType.ETCHED_IN)
45+
sw.set_policy(Gtk.PolicyType.NEVER,
46+
Gtk.PolicyType.AUTOMATIC)
47+
vbox.pack_start(sw, True, True, 0)
4948

5049
model = self.create_model()
5150

52-
self.treeview = gtk.TreeView(model)
51+
self.treeview = Gtk.TreeView(model)
5352
self.treeview.set_rules_hint(True)
5453

5554
# matplotlib stuff
5655
fig = Figure(figsize=(6, 4))
5756

58-
self.canvas = FigureCanvas(fig) # a gtk.DrawingArea
59-
vbox.pack_start(self.canvas, True, True)
57+
self.canvas = FigureCanvas(fig) # a Gtk.DrawingArea
58+
vbox.pack_start(self.canvas, True, True, 0)
6059
ax = fig.add_subplot(111)
6160
self.line, = ax.plot(self.data[0, :], 'go') # plot the first row
6261

@@ -65,9 +64,9 @@ def __init__(self):
6564

6665
self.add_columns()
6766

68-
self.add_events(gdk.BUTTON_PRESS_MASK |
69-
gdk.KEY_PRESS_MASK |
70-
gdk.KEY_RELEASE_MASK)
67+
self.add_events(Gdk.EventMask.BUTTON_PRESS_MASK |
68+
Gdk.EventMask.KEY_PRESS_MASK |
69+
Gdk.EventMask.KEY_RELEASE_MASK)
7170

7271
def plot_row(self, treeview, path, view_column):
7372
ind, = path # get the index into data
@@ -77,18 +76,18 @@ def plot_row(self, treeview, path, view_column):
7776

7877
def add_columns(self):
7978
for i in range(self.numCols):
80-
column = gtk.TreeViewColumn('%d' % i, gtk.CellRendererText(), text=i)
79+
column = Gtk.TreeViewColumn(str(i), Gtk.CellRendererText(), text=i)
8180
self.treeview.append_column(column)
8281

8382
def create_model(self):
8483
types = [float]*self.numCols
85-
store = gtk.ListStore(*types)
84+
store = Gtk.ListStore(*types)
8685

8786
for row in self.data:
88-
store.append(row)
87+
store.append(tuple(row))
8988
return store
9089

9190

9291
manager = DataManager()
9392
manager.show_all()
94-
gtk.main()
93+
Gtk.main()

examples/user_interfaces/lineprops_dialog_gtk_sgskip.py

Lines changed: 0 additions & 30 deletions
This file was deleted.

0 commit comments

Comments
 (0)