Skip to content

Commit

Permalink
Merge pull request #13677 from goanpeca/fix/plot-pane
Browse files Browse the repository at this point in the history
PR: Fix several issues with the plots pane from API migration
  • Loading branch information
dalthviz committed Sep 1, 2020
2 parents 2386c7d + b9d8c06 commit 14e70b0
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 7 deletions.
12 changes: 12 additions & 0 deletions spyder/plugins/plots/widgets/figurebrowser.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,18 @@ def setup(self, options):
elif option == 'save_dir':
self.thumbnails_sb.save_dir = value

def update_splitter_widths(self, base_width):
"""
Update the widths to provide the scrollbar with a fixed minimumwidth.
Parameters
----------
base_width: int
The available splitter width.
"""
min_sb_width = self.thumbnails_sb._min_scrollbar_width
self.splitter.setSizes([base_width - min_sb_width, min_sb_width])

def show_fig_outline_in_viewer(self, state):
"""Draw a frame around the figure viewer if state is True."""
if state is True:
Expand Down
19 changes: 12 additions & 7 deletions spyder/plugins/plots/widgets/main_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@
class PlotsWidgetActions:
# Triggers
Save = 'save'
SaveAll = 'save_all'
SaveAll = 'save all'
Copy = 'copy'
Close = 'close'
CloseAll = 'close_all'
MoveToPreviousFigure = 'previous_figure'
MoveToNextFigure = 'next_figure'
ZoomIn = 'zoom_in'
ZoomOut = 'zoom_out'
CloseAll = 'close all'
MoveToPreviousFigure = 'previous figure'
MoveToNextFigure = 'next figure'
ZoomIn = 'zoom in'
ZoomOut = 'zoom out'

# Toggles
ToggleMuteInlinePlotting = 'toggle_mute_inline_plotting_action'
Expand Down Expand Up @@ -225,20 +225,23 @@ def setup(self, options):
save_action = self.create_action(
name=PlotsWidgetActions.Save,
text=_("Save plot as..."),
tip=_("Save plot as..."),
icon=self.create_icon('filesave'),
triggered=self.save_plot,
register_shortcut=True,
)
save_all_action = self.create_action(
name=PlotsWidgetActions.SaveAll,
text=_("Save all plots..."),
tip=_("Save all plots..."),
icon=self.create_icon('save_all'),
triggered=self.save_all_plots,
register_shortcut=True,
)
copy_action = self.create_action(
name=PlotsWidgetActions.Copy,
text=_("Copy Image"),
text=_("Copy image"),
tip=_("Copy plot to clipboard as image"),
icon=self.create_icon('editcopy'),
triggered=self.copy_image,
register_shortcut=True,
Expand All @@ -248,6 +251,7 @@ def setup(self, options):
text=_("Remove plot"),
icon=self.create_icon('editclear'),
triggered=self.remove_plot,
register_shortcut=True,
)
remove_all_action = self.create_action(
name=PlotsWidgetActions.CloseAll,
Expand Down Expand Up @@ -430,6 +434,7 @@ def add_shellwidget(self, shellwidget):
if shellwidget_id not in self._shellwidgets:
fig_browser = FigureBrowser(parent=self._stack,
background_color=MAIN_BG_COLOR)
fig_browser.update_splitter_widths(self.width())
fig_browser.set_shellwidget(shellwidget)
fig_browser.sig_redirect_stdio_requested.connect(
self.sig_redirect_stdio_requested)
Expand Down

0 comments on commit 14e70b0

Please sign in to comment.