Skip to content

Commit

Permalink
rename window method
Browse files Browse the repository at this point in the history
  • Loading branch information
OceanWolf committed Apr 17, 2015
1 parent b4b7246 commit 93a8891
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 17 deletions.
2 changes: 1 addition & 1 deletion doc/devel/MEP/MEP27.rst
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ The description of this MEP gives us most of the solution:
+--------------------------------------+------------------------------+---------------------+--------------------------------+
|X |X |set_default_size | |
+--------------------------------------+------------------------------+---------------------+--------------------------------+
|X |X |add_element_to_window| |
|X |X |add_element | |
+--------------------------------------+------------------------------+---------------------+--------------------------------+


Expand Down
3 changes: 1 addition & 2 deletions examples/user_interfaces/toolmanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,7 @@ def trigger(self, *args, **kwargs):
tool_mgr.add_tool('D%s' % i, DotTool, color=c)]],
['hide', [tool_mgr.add_tool('H%s' % i, GroupHideTool, gid=c)]]]

fig.canvas.manager.window.add_element_to_window(sidebar, False, False, 0,
'west')
fig.canvas.manager.window.add_element(sidebar, False, 'west')
add_tools_to_container(sidebar, tools)

plt.show()
7 changes: 1 addition & 6 deletions lib/matplotlib/backend_bases.py
Original file line number Diff line number Diff line change
Expand Up @@ -2700,7 +2700,7 @@ def set_window_title(self, title):
"""
pass

def add_element_to_window(self, element, expand, fill, pad, place):
def add_element(self, element, expand, place):
""" Adds a gui widget to the window.
This has no effect for non-GUI backends and properties only apply
to those backends that support them, or have a suitable workaround.
Expand All @@ -2712,11 +2712,6 @@ def add_element_to_window(self, element, expand, fill, pad, place):
expand : bool
Whether the element should auto expand to fill as much space within
the window as possible.
fill : bool
If the element can expand, should it make the element bigger,
or go into extra padding? True, False respectfully.
pad : int
The extra amount of space in pixels to pad the element.
place : string
The location to place the element, either compass points north,
east, south, west, or center.
Expand Down
8 changes: 3 additions & 5 deletions lib/matplotlib/backend_managers.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def __init__(self, figure, num):
w = int(self.canvas.figure.bbox.width)
h = int(self.canvas.figure.bbox.height)

self.window.add_element_to_window(self.canvas, True, True, 0, 'center')
self.window.add_element(self.canvas, True, 'center')

self.toolmanager = self._get_toolmanager()
self.toolbar = self._get_toolbar()
Expand All @@ -98,12 +98,10 @@ def __init__(self, figure, num):
if self.toolbar:
tools.add_tools_to_container(self.toolbar)
self.statusbar = self._backend.Statusbar(self.toolmanager)
h += self.window.add_element_to_window(self.statusbar, False,
False, 0, 'south')
h += self.window.add_element(self.statusbar, False, 'south')

if self.toolbar is not None:
h += self.window.add_element_to_window(self.toolbar,
False, False, 0, 'south')
h += self.window.add_element(self.toolbar, False, 'south')

self.window.set_default_size(w, h)
self._full_screen_flag = False
Expand Down
6 changes: 3 additions & 3 deletions lib/matplotlib/backends/backend_gtk3.py
Original file line number Diff line number Diff line change
Expand Up @@ -436,17 +436,17 @@ def _setup_box(self, name, orientation, grow, parent):
self._layout[parent].pack_start(self._layout[name], grow, grow, 0)
self._layout[name].show()

def add_element_to_window(self, element, expand, fill, pad, place):
def add_element(self, element, expand, place):
element.show()

flow = _flow[not _flow.index(self._layout[place].get_orientation())]
separator = Gtk.Separator(orientation=flow)
separator.show()
if place in ['north', 'west', 'center']:
self._layout[place].pack_start(element, expand, fill, pad)
self._layout[place].pack_start(element, expand, expand, 0)
self._layout[place].pack_start(separator, False, False, 0)
elif place in ['south', 'east']:
self._layout[place].pack_end(element, expand, fill, pad)
self._layout[place].pack_end(element, expand, expand, 0)
self._layout[place].pack_end(separator, False, False, 0)
else:
raise KeyError('Unknown value for place, %s' % place)
Expand Down

0 comments on commit 93a8891

Please sign in to comment.