From b9d8c06f7afc04f3f7e6ca0c1501eda1edffd1f2 Mon Sep 17 00:00:00 2001 From: goanpeca Date: Mon, 31 Aug 2020 18:40:24 -0500 Subject: [PATCH] Fix several issues with the plots pane from API migration --- spyder/plugins/plots/widgets/figurebrowser.py | 12 ++++++++++++ spyder/plugins/plots/widgets/main_widget.py | 19 ++++++++++++------- 2 files changed, 24 insertions(+), 7 deletions(-) diff --git a/spyder/plugins/plots/widgets/figurebrowser.py b/spyder/plugins/plots/widgets/figurebrowser.py index 37955c9ec8f..4fb0ed857a2 100644 --- a/spyder/plugins/plots/widgets/figurebrowser.py +++ b/spyder/plugins/plots/widgets/figurebrowser.py @@ -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: diff --git a/spyder/plugins/plots/widgets/main_widget.py b/spyder/plugins/plots/widgets/main_widget.py index 5dd5ab7987b..bbddc5a285d 100644 --- a/spyder/plugins/plots/widgets/main_widget.py +++ b/spyder/plugins/plots/widgets/main_widget.py @@ -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' @@ -225,6 +225,7 @@ 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, @@ -232,13 +233,15 @@ def setup(self, options): 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, @@ -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, @@ -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)