Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IPython3 widgets #562

Merged
merged 8 commits into from Mar 6, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 2 additions & 7 deletions menpo/feature/features.py
Expand Up @@ -787,17 +787,12 @@ def no_op(pixels):
return pixels.copy()


def features_selection_widget(popup=True):
def features_selection_widget():
r"""
Widget that allows for easy selection of a features function and its
options. It also has a 'preview' tab for visual inspection. It returns a
`list` of length 1 with the selected features function closure.

Parameters
----------
popup : `bool`, optional
If ``True``, the widget will appear as a popup window.

Returns
-------
features_function : `list` of length ``1``
Expand All @@ -821,4 +816,4 @@ def features_selection_widget(popup=True):
"""
from menpo.visualize.widgets import features_selection

return features_selection(popup=popup)
return features_selection()
7 changes: 2 additions & 5 deletions menpo/image/base.py
Expand Up @@ -572,24 +572,21 @@ def _view_2d(self, figure_id=None, new_figure=False, channels=None,
axes_font_weight=axes_font_weight, axes_x_limits=axes_x_limits,
axes_y_limits=axes_y_limits, figure_size=figure_size)

def view_widget(self, popup=False, browser_style='buttons',
figure_size=(10, 8)):
def view_widget(self, browser_style='buttons', figure_size=(10, 8)):
r"""
Visualizes the image object using the :map:`visualize_images` widget.
Currently only supports the rendering of 2D images.

Parameters
----------
popup : `bool`, optional
If ``True``, the widget will appear as a popup window.
browser_style : ``{buttons, slider}``, optional
It defines whether the selector of the images will have the form of
plus/minus buttons or a slider.
figure_size : (`int`, `int`) `tuple`, optional
The initial size of the rendered figure.
"""
from menpo.visualize import visualize_images
visualize_images(self, figure_size=figure_size, popup=popup,
visualize_images(self, figure_size=figure_size,
browser_style=browser_style)

def _view_landmarks_2d(self, channels=None, group=None,
Expand Down
13 changes: 4 additions & 9 deletions menpo/landmark/base.py
Expand Up @@ -288,24 +288,22 @@ def _transform_inplace(self, transform):
group.lms._transform_inplace(transform)
return self

def view_widget(self, popup=False, browser_style='buttons',
def view_widget(self, browser_style='buttons',
figure_size=(10, 8)):
r"""
Visualizes the landmark manager object using the
:map:`visualize_landmarks` widget.

Parameters
----------
popup : `bool`, optional
If ``True``, the widget will appear as a popup window.
browser_style : {``buttons``, ``slider``}, optional
It defines whether the selector of the landmark managers will have
the form of plus/minus buttons or a slider.
figure_size : (`int`, `int`), optional
The initial size of the rendered figure.
"""
from menpo.visualize import visualize_landmarks
visualize_landmarks(self, figure_size=figure_size, popup=popup,
visualize_landmarks(self, figure_size=figure_size,
browser_style=browser_style)

def __str__(self):
Expand Down Expand Up @@ -887,24 +885,21 @@ def _view_3d(self, figure_id=None, new_figure=False, **kwargs):
from menpo.visualize import Menpo3dErrorMessage
raise ImportError(Menpo3dErrorMessage)

def view_widget(self, popup=False, browser_style='buttons',
figure_size=(10, 8)):
def view_widget(self, browser_style='buttons', figure_size=(10, 8)):
r"""
Visualizes the landmark group object using the
:map:`visualize_landmarkgroups` widget.

Parameters
----------
popup : `bool`, optional
If ``True``, the widget will appear as a popup window.
browser_style : {``buttons``, ``slider``}, optional
It defines whether the selector of the landmark managers will have
the form of plus/minus buttons or a slider.
figure_size : (`int`, `int`), optional
The initial size of the rendered figure.
"""
from menpo.visualize import visualize_landmarkgroups
visualize_landmarkgroups(self, figure_size=figure_size, popup=popup,
visualize_landmarkgroups(self, figure_size=figure_size,
browser_style=browser_style)

def __str__(self):
Expand Down
7 changes: 2 additions & 5 deletions menpo/shape/graph.py
Expand Up @@ -1080,24 +1080,21 @@ def _view_3d(self, figure_id=None, new_figure=False):
from menpo.visualize import Menpo3dErrorMessage
raise ImportError(Menpo3dErrorMessage)

def view_widget(self, popup=False, browser_style='buttons',
figure_size=(10, 8)):
def view_widget(self, browser_style='buttons', figure_size=(10, 8)):
r"""
Visualization of the PointGraph using the :map:`visualize_pointclouds`
widget.

Parameters
----------
popup : `bool`, optional
If ``True``, the widget will be rendered in a popup window.
browser_style : ``{buttons, slider}``, optional
It defines whether the selector of the PointGraph objects will have
the form of plus/minus buttons or a slider.
figure_size : (`int`, `int`) `tuple`, optional
The initial size of the rendered figure.
"""
from menpo.visualize import visualize_pointclouds
visualize_pointclouds(self, popup=popup, figure_size=figure_size,
visualize_pointclouds(self, figure_size=figure_size,
browser_style=browser_style)


Expand Down
7 changes: 2 additions & 5 deletions menpo/shape/mesh/base.py
Expand Up @@ -325,22 +325,19 @@ def _view_3d(self, figure_id=None, new_figure=False, **kwargs):
from menpo.visualize import Menpo3dErrorMessage
raise ImportError(Menpo3dErrorMessage)

def view_widget(self, popup=False, browser_style='buttons',
figure_size=(10, 8)):
def view_widget(self, browser_style='buttons', figure_size=(10, 8)):
r"""
Visualization of the TriMesh using the :map:`visualize_pointclouds`
widget.

Parameters
----------
popup : `bool`, optional
If ``True``, the widget will be rendered in a popup window.
browser_style : ``{buttons, slider}``, optional
It defines whether the selector of the TriMesh objects will have
the form of plus/minus buttons or a slider.
figure_size : (`int`, `int`) `tuple`, optional
The initial size of the rendered figure.
"""
from menpo.visualize import visualize_pointclouds
visualize_pointclouds(self, popup=popup, figure_size=figure_size,
visualize_pointclouds(self, figure_size=figure_size,
browser_style=browser_style)
7 changes: 2 additions & 5 deletions menpo/shape/pointcloud.py
Expand Up @@ -622,24 +622,21 @@ def _view_landmarks_3d(self, figure_id=None, new_figure=False,
from menpo.visualize import Menpo3dErrorMessage
raise ImportError(Menpo3dErrorMessage)

def view_widget(self, popup=False, browser_style='buttons',
figure_size=(10, 8)):
def view_widget(self, browser_style='buttons', figure_size=(10, 8)):
r"""
Visualization of the PointCloud using the :map:`visualize_pointclouds`
widget.

Parameters
----------
popup : `bool`, optional
If ``True``, the widget will be rendered in a popup window.
browser_style : ``{buttons, slider}``, optional
It defines whether the selector of the PointCloud objects will have
the form of plus/minus buttons or a slider.
figure_size : (`int`, `int`), optional
The initial size of the rendered figure.
"""
from menpo.visualize import visualize_pointclouds
visualize_pointclouds(self, popup=popup, figure_size=figure_size,
visualize_pointclouds(self, figure_size=figure_size,
browser_style=browser_style)

def _transform_self_inplace(self, transform):
Expand Down
9 changes: 2 additions & 7 deletions menpo/visualize/viewmatplotlib.py
Expand Up @@ -119,18 +119,13 @@ def save_figure(self, filename, format='png', dpi=None, face_colour='w',
_export(save_fig_args, filename, self._extensions_map, format,
overwrite=overwrite)

def save_figure_widget(self, popup=True):
def save_figure_widget(self):
r"""
Method for saving the figure of the current ``figure_id`` to file using
:func:`menpo.visualize.widgets.base.save_matplotlib_figure` widget.

Parameters
----------
popup : `bool`, optional
If ``True``, the widget will appear as a popup window.
"""
from menpo.visualize.widgets import save_matplotlib_figure
save_matplotlib_figure(self, popup=popup)
save_matplotlib_figure(self)


class MatplotlibSubplots(object):
Expand Down