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

Skip to content

Commit 713abcb

Browse files
committed
rename window method
1 parent 7f7f05e commit 713abcb

File tree

5 files changed

+9
-17
lines changed

5 files changed

+9
-17
lines changed

doc/devel/MEP/MEP27.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ The description of this MEP gives us most of the solution:
128128
+--------------------------------------+------------------------------+---------------------+--------------------------------+
129129
|X |X |set_default_size | |
130130
+--------------------------------------+------------------------------+---------------------+--------------------------------+
131-
|X |X |add_element_to_window| |
131+
|X |X |add_element | |
132132
+--------------------------------------+------------------------------+---------------------+--------------------------------+
133133

134134

examples/user_interfaces/toolmanager.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,7 @@ def trigger(self, *args, **kwargs):
127127
tool_mgr.add_tool('D%s' % i, DotTool, color=c)]],
128128
['hide', [tool_mgr.add_tool('H%s' % i, GroupHideTool, gid=c)]]]
129129

130-
fig.canvas.manager.window.add_element_to_window(sidebar, False, False, 0,
131-
'west')
130+
fig.canvas.manager.window.add_element(sidebar, False, 'west')
132131
add_tools_to_container(sidebar, tools)
133132

134133
plt.show()

lib/matplotlib/backend_bases.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2710,7 +2710,7 @@ def set_window_title(self, title):
27102710
"""
27112711
pass
27122712

2713-
def add_element_to_window(self, element, expand, fill, pad, place):
2713+
def add_element(self, element, expand, place):
27142714
""" Adds a gui widget to the window.
27152715
This has no effect for non-GUI backends and properties only apply
27162716
to those backends that support them, or have a suitable workaround.
@@ -2722,11 +2722,6 @@ def add_element_to_window(self, element, expand, fill, pad, place):
27222722
expand : bool
27232723
Whether the element should auto expand to fill as much space within
27242724
the window as possible.
2725-
fill : bool
2726-
If the element can expand, should it make the element bigger,
2727-
or go into extra padding? True, False respectfully.
2728-
pad : int
2729-
The extra amount of space in pixels to pad the element.
27302725
place : string
27312726
The location to place the element, either compass points north,
27322727
east, south, west, or center.

lib/matplotlib/backend_managers.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ def __init__(self, figure, num):
8888
w = int(self.canvas.figure.bbox.width)
8989
h = int(self.canvas.figure.bbox.height)
9090

91-
self.window.add_element_to_window(self.canvas, True, True, 0, 'center')
91+
self.window.add_element(self.canvas, True, 'center')
9292

9393
self.toolmanager = self._get_toolmanager()
9494
self.toolbar = self._get_toolbar()
@@ -98,12 +98,10 @@ def __init__(self, figure, num):
9898
if self.toolbar:
9999
tools.add_tools_to_container(self.toolbar)
100100
self.statusbar = self._backend.Statusbar(self.toolmanager)
101-
h += self.window.add_element_to_window(self.statusbar, False,
102-
False, 0, 'south')
101+
h += self.window.add_element(self.statusbar, False, 'south')
103102

104103
if self.toolbar is not None:
105-
h += self.window.add_element_to_window(self.toolbar,
106-
False, False, 0, 'south')
104+
h += self.window.add_element(self.toolbar, False, 'south')
107105

108106
self.window.set_default_size(w, h)
109107
self._full_screen_flag = False

lib/matplotlib/backends/backend_gtk3.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -429,17 +429,17 @@ def _setup_box(self, name, orientation, grow, parent):
429429
self._layout[parent].pack_start(self._layout[name], grow, grow, 0)
430430
self._layout[name].show()
431431

432-
def add_element_to_window(self, element, expand, fill, pad, place):
432+
def add_element(self, element, expand, place):
433433
element.show()
434434

435435
flow = _flow[not _flow.index(self._layout[place].get_orientation())]
436436
separator = Gtk.Separator(orientation=flow)
437437
separator.show()
438438
if place in ['north', 'west', 'center']:
439-
self._layout[place].pack_start(element, expand, fill, pad)
439+
self._layout[place].pack_start(element, expand, expand, 0)
440440
self._layout[place].pack_start(separator, False, False, 0)
441441
elif place in ['south', 'east']:
442-
self._layout[place].pack_end(element, expand, fill, pad)
442+
self._layout[place].pack_end(element, expand, expand, 0)
443443
self._layout[place].pack_end(separator, False, False, 0)
444444
else:
445445
raise KeyError('Unknown value for place, %s' % place)

0 commit comments

Comments
 (0)