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

Skip to content

Commit dcfa36c

Browse files
committed
Remove deprecated Statusbar classes.
1 parent b6d3d98 commit dcfa36c

File tree

7 files changed

+11
-99
lines changed

7 files changed

+11
-99
lines changed

doc/api/next_api_changes/removals/19898-ES.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,9 @@ NavigationToolbar2Wx attributes
2727
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2828
The ``prevZoomRect``, ``retinaFix``, ``savedRetinaImage``, ``wxoverlay``,
2929
``zoomAxes``, ``zoomStartX``, and ``zoomStartY`` attributes have been removed.
30+
31+
Statusbar classes and attributes
32+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
33+
The ``statusbar`` attribute of `.FigureManagerBase`, as well as
34+
``backend_bases.StatusbarBase`` and all its subclasses, and ``StatusBarWx``,
35+
have been removed, as messages are now displayed in the toolbar instead.

doc/api/prev_api_changes/api_changes_3.3.0/deprecations.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -575,7 +575,7 @@ This is deprecated; pass keys as a list of strings instead.
575575

576576
Statusbar classes and attributes
577577
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
578-
The ``statusbar`` attribute of `.FigureManagerBase`, `.StatusbarBase` and all
578+
The ``statusbar`` attribute of `.FigureManagerBase`, ``StatusbarBase`` and all
579579
its subclasses, and ``StatusBarWx``, are deprecated, as messages are now
580580
displayed in the toolbar instead.
581581

lib/matplotlib/backend_bases.py

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2777,8 +2777,6 @@ class FigureManagerBase:
27772777
figure.canvas.manager.button_press_handler_id)
27782778
"""
27792779

2780-
statusbar = _api.deprecated("3.3")(property(lambda self: None))
2781-
27822780
def __init__(self, canvas, num):
27832781
self.canvas = canvas
27842782
canvas.manager = self # store a pointer to parent
@@ -3454,29 +3452,6 @@ def set_message(self, s):
34543452
raise NotImplementedError
34553453

34563454

3457-
@_api.deprecated("3.3")
3458-
class StatusbarBase:
3459-
"""Base class for the statusbar."""
3460-
def __init__(self, toolmanager):
3461-
self.toolmanager = toolmanager
3462-
self.toolmanager.toolmanager_connect('tool_message_event',
3463-
self._message_cbk)
3464-
3465-
def _message_cbk(self, event):
3466-
"""Capture the 'tool_message_event' and set the message."""
3467-
self.set_message(event.message)
3468-
3469-
def set_message(self, s):
3470-
"""
3471-
Display a message on toolbar or in status bar.
3472-
3473-
Parameters
3474-
----------
3475-
s : str
3476-
Message text.
3477-
"""
3478-
3479-
34803455
class _Backend:
34813456
# A backend can be defined by using the following pattern:
34823457
#

lib/matplotlib/backends/_backend_tk.py

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
from matplotlib import _api, backend_tools, cbook, _c_internal_utils
1616
from matplotlib.backend_bases import (
1717
_Backend, FigureCanvasBase, FigureManagerBase, NavigationToolbar2,
18-
StatusbarBase, TimerBase, ToolContainerBase, cursors, _Mode)
18+
TimerBase, ToolContainerBase, cursors, _Mode)
1919
from matplotlib._pylab_helpers import Gcf
2020
from matplotlib.figure import Figure
2121
from matplotlib.widgets import SubplotTool
@@ -771,24 +771,6 @@ def set_message(self, s):
771771
self._message.set(s)
772772

773773

774-
@_api.deprecated("3.3")
775-
class StatusbarTk(StatusbarBase, tk.Frame):
776-
def __init__(self, window, *args, **kwargs):
777-
StatusbarBase.__init__(self, *args, **kwargs)
778-
xmin, xmax = self.toolmanager.canvas.figure.bbox.intervalx
779-
height, width = 50, xmax - xmin
780-
tk.Frame.__init__(self, master=window,
781-
width=int(width), height=int(height),
782-
borderwidth=2)
783-
self._message = tk.StringVar(master=self)
784-
self._message_label = tk.Label(master=self, textvariable=self._message)
785-
self._message_label.pack(side=tk.RIGHT)
786-
self.pack(side=tk.TOP, fill=tk.X)
787-
788-
def set_message(self, s):
789-
self._message.set(s)
790-
791-
792774
class SaveFigureTk(backend_tools.SaveFigureBase):
793775
def trigger(self, *args):
794776
NavigationToolbar2Tk.save_figure(

lib/matplotlib/backends/backend_gtk3.py

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from matplotlib._pylab_helpers import Gcf
1010
from matplotlib.backend_bases import (
1111
_Backend, FigureCanvasBase, FigureManagerBase, NavigationToolbar2,
12-
StatusbarBase, TimerBase, ToolContainerBase, cursors)
12+
TimerBase, ToolContainerBase, cursors)
1313
from matplotlib.figure import Figure
1414
from matplotlib.widgets import SubplotTool
1515

@@ -663,18 +663,6 @@ def set_message(self, s):
663663
self._message.set_label(s)
664664

665665

666-
@_api.deprecated("3.3")
667-
class StatusbarGTK3(StatusbarBase, Gtk.Statusbar):
668-
def __init__(self, *args, **kwargs):
669-
StatusbarBase.__init__(self, *args, **kwargs)
670-
Gtk.Statusbar.__init__(self)
671-
self._context = self.get_context_id('message')
672-
673-
def set_message(self, s):
674-
self.pop(self._context)
675-
self.push(self._context, s)
676-
677-
678666
class RubberbandGTK3(backend_tools.RubberbandBase):
679667
def draw_rubberband(self, x0, y0, x1, y1):
680668
NavigationToolbar2GTK3.draw_rubberband(

lib/matplotlib/backends/backend_qt5.py

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from matplotlib._pylab_helpers import Gcf
1010
from matplotlib.backend_bases import (
1111
_Backend, FigureCanvasBase, FigureManagerBase, NavigationToolbar2,
12-
TimerBase, cursors, ToolContainerBase, StatusbarBase, MouseButton)
12+
TimerBase, cursors, ToolContainerBase, MouseButton)
1313
import matplotlib.backends.qt_editor.figureoptions as figureoptions
1414
from matplotlib.backends.qt_editor._formsubplottool import UiSubplotTool
1515
from . import qt_compat
@@ -908,17 +908,6 @@ def set_message(self, s):
908908
self.widgetForAction(self._message_action).setText(s)
909909

910910

911-
@_api.deprecated("3.3")
912-
class StatusbarQt(StatusbarBase, QtWidgets.QLabel):
913-
def __init__(self, window, *args, **kwargs):
914-
StatusbarBase.__init__(self, *args, **kwargs)
915-
QtWidgets.QLabel.__init__(self)
916-
window.statusBar().addWidget(self)
917-
918-
def set_message(self, s):
919-
self.setText(s)
920-
921-
922911
class ConfigureSubplotsQt(backend_tools.ConfigureSubplotsBase):
923912
def trigger(self, *args):
924913
NavigationToolbar2QT.configure_subplots(

lib/matplotlib/backends/backend_wx.py

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
from matplotlib.backend_bases import (
2222
_Backend, _check_savefig_extra_args, FigureCanvasBase, FigureManagerBase,
2323
GraphicsContextBase, MouseButton, NavigationToolbar2, RendererBase,
24-
StatusbarBase, TimerBase, ToolContainerBase, cursors)
24+
TimerBase, ToolContainerBase, cursors)
2525

2626
from matplotlib import _api, cbook, backend_tools
2727
from matplotlib._pylab_helpers import Gcf
@@ -1205,21 +1205,6 @@ def set_history_buttons(self):
12051205
self.EnableTool(self.wx_ids['Forward'], can_forward)
12061206

12071207

1208-
@_api.deprecated("3.3")
1209-
class StatusBarWx(wx.StatusBar):
1210-
"""
1211-
A status bar is added to _FigureFrame to allow measurements and the
1212-
previously selected scroll function to be displayed as a user convenience.
1213-
"""
1214-
1215-
def __init__(self, parent, *args, **kwargs):
1216-
super().__init__(parent, -1)
1217-
self.SetFieldsCount(2)
1218-
1219-
def set_function(self, string):
1220-
self.SetStatusText("%s" % string, 1)
1221-
1222-
12231208
# tools for matplotlib.backend_managers.ToolManager:
12241209

12251210
class ToolbarWx(ToolContainerBase, wx.ToolBar):
@@ -1307,19 +1292,6 @@ def set_message(self, s):
13071292
self._label_text.SetLabel(s)
13081293

13091294

1310-
@_api.deprecated("3.3")
1311-
class StatusbarWx(StatusbarBase, wx.StatusBar):
1312-
"""For use with ToolManager."""
1313-
def __init__(self, parent, *args, **kwargs):
1314-
StatusbarBase.__init__(self, *args, **kwargs)
1315-
wx.StatusBar.__init__(self, parent, -1)
1316-
self.SetFieldsCount(1)
1317-
self.SetStatusText("")
1318-
1319-
def set_message(self, s):
1320-
self.SetStatusText(s)
1321-
1322-
13231295
class ConfigureSubplotsWx(backend_tools.ConfigureSubplotsBase):
13241296
def trigger(self, *args):
13251297
NavigationToolbar2Wx.configure_subplots(

0 commit comments

Comments
 (0)