From 0764eb2b69d308b7b90f03c1bf1d2360990e119b Mon Sep 17 00:00:00 2001 From: Antony Lee Date: Mon, 25 Jun 2018 13:15:38 +0200 Subject: [PATCH] Remove various mentions of the now removed GTK(2) backend. --- lib/matplotlib/backends/backend_template.py | 34 +++++++++------------ lib/matplotlib/path.py | 2 +- tutorials/introductory/usage.py | 2 -- 3 files changed, 15 insertions(+), 23 deletions(-) diff --git a/lib/matplotlib/backends/backend_template.py b/lib/matplotlib/backends/backend_template.py index 1702c9fe85bb..a4ae747816f0 100644 --- a/lib/matplotlib/backends/backend_template.py +++ b/lib/matplotlib/backends/backend_template.py @@ -135,17 +135,17 @@ def points_to_pixels(self, points): class GraphicsContextTemplate(GraphicsContextBase): """ - The graphics context provides the color, line styles, etc... See the gtk + The graphics context provides the color, line styles, etc... See the cairo and postscript backends for examples of mapping the graphics context attributes (cap styles, join styles, line widths, colors) to a particular - backend. In GTK this is done by wrapping a gtk.gdk.GC object and + backend. In cairo this is done by wrapping a cairo.Context object and forwarding the appropriate calls to it using a dictionary mapping styles to gdk constants. In Postscript, all the work is done by the renderer, mapping line styles to postscript calls. If it's more appropriate to do the mapping at the renderer level (as in the postscript backend), you don't need to override any of the GC methods. - If it's more appropriate to wrap an instance (as in the GTK backend) and + If it's more appropriate to wrap an instance (as in the cairo backend) and do the mapping here, you'll need to override several of the setter methods. @@ -153,8 +153,6 @@ class GraphicsContextTemplate(GraphicsContextBase): interval, e.g., (0.5, 0.0, 1.0). You may need to map this to colors appropriate for your backend. """ - pass - ######################################################################## @@ -166,19 +164,18 @@ class GraphicsContextTemplate(GraphicsContextBase): def draw_if_interactive(): """ - For image backends - is not required + For image backends - is not required. For GUI backends - this should be overridden if drawing should be done in - interactive python mode + interactive python mode. """ def show(block=None): """ - For image backends - is not required + For image backends - is not required. For GUI backends - show() is usually the last line of a pyplot script and - tells the backend that it is time to draw. In interactive mode, this may - be a do nothing func. See the GTK backend for an example of how to handle - interactive versus batch mode + tells the backend that it is time to draw. In interactive mode, this + should do nothing. """ for manager in Gcf.get_all_fig_managers(): # do something to display the GUI @@ -189,12 +186,11 @@ def new_figure_manager(num, *args, FigureClass=Figure, **kwargs): """ Create a new figure manager instance """ - # May be implemented via the `_new_figure_manager_template` helper. # If a main-level app must be created, this (and # new_figure_manager_given_figure) is the usual place to do it -- see # backend_wx, backend_wxagg and backend_tkagg for examples. Not all GUIs - # require explicit instantiation of a main-level app (egg backend_gtk, - # backend_gtkagg) for pylab. + # require explicit instantiation of a main-level app (e.g., backend_gtk3) + # for pylab. thisFig = FigureClass(*args, **kwargs) return new_figure_manager_given_figure(num, thisFig) @@ -203,7 +199,6 @@ def new_figure_manager_given_figure(num, figure): """ Create a new figure manager instance for the given figure. """ - # May be implemented via the `_new_figure_manager_template` helper. canvas = FigureCanvasTemplate(figure) manager = FigureManagerTemplate(canvas, num) return manager @@ -212,19 +207,18 @@ def new_figure_manager_given_figure(num, figure): class FigureCanvasTemplate(FigureCanvasBase): """ The canvas the figure renders into. Calls the draw and print fig - methods, creates the renderers, etc... + methods, creates the renderers, etc. - Note GUI templates will want to connect events for button presses, + Note: GUI templates will want to connect events for button presses, mouse movements and key presses to functions that call the base class methods button_press_event, button_release_event, - motion_notify_event, key_press_event, and key_release_event. See, - e.g., backend_gtk.py, backend_wx.py and backend_tkagg.py + motion_notify_event, key_press_event, and key_release_event. See the + implementations of the interactive backends for examples. Attributes ---------- figure : `matplotlib.figure.Figure` A high-level Figure instance - """ def draw(self): diff --git a/lib/matplotlib/path.py b/lib/matplotlib/path.py index 589606d777ea..ab9c271460bc 100644 --- a/lib/matplotlib/path.py +++ b/lib/matplotlib/path.py @@ -578,7 +578,7 @@ def to_polygons(self, transform=None, width=0, height=0, closed_only=True): polygon/polyline is an Nx2 array of vertices. In other words, each polygon has no ``MOVETO`` instructions or curves. This is useful for displaying in backends that do not support - compound paths or Bezier curves, such as GDK. + compound paths or Bezier curves. If *width* and *height* are both non-zero then the lines will be simplified so that vertices outside of (0, 0), (width, diff --git a/tutorials/introductory/usage.py b/tutorials/introductory/usage.py index 43e803855b95..33860d5280bc 100644 --- a/tutorials/introductory/usage.py +++ b/tutorials/introductory/usage.py @@ -449,8 +449,6 @@ def my_plotter(ax, data1, data2, param_dict): # .. _`Portable Document Format`: https://en.wikipedia.org/wiki/Portable_Document_Format # .. _`Scalable Vector Graphics`: https://en.wikipedia.org/wiki/Scalable_Vector_Graphics # .. _`Cairo graphics`: https://wwW.cairographics.org -# .. _`Gimp Drawing Kit`: https://en.wikipedia.org/wiki/GDK -# .. _PyGTK: http://www.pygtk.org # .. _PyGObject: https://wiki.gnome.org/action/show/Projects/PyGObject # .. _pycairo: https://www.cairographics.org/pycairo/ # .. _cairocffi: https://pythonhosted.org/cairocffi/