Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/source/release/v6.13.0/Workbench/Bugfixes/39247.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Minimizing the sample log plot on the ``SampleLogs`` widget so that it is not visible no longer throws an error.
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,11 @@ def test_workspace_updates(self):
assert pres.view.isVisible()
DeleteWorkspace("new_name")
assert not pres.view.isVisible()

def test_minimum_canvas_size(self):
ws = CreateSampleWorkspace()
pres = SampleLogs(ws)
pres.view.show_plot_and_stats(True)
pres.view.canvas.resize(-1, -1)
self.assertEqual(0, pres.view.canvas.width())
self.assertEqual(0, pres.view.canvas.height())
5 changes: 3 additions & 2 deletions qt/python/mantidqt/mantidqt/widgets/samplelogs/view.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
QFrame,
QSpacerItem,
)
from qtpy.QtCore import QItemSelectionModel, Qt, Signal
from qtpy.QtCore import QItemSelectionModel, Qt, Signal, QSize
from mantidqt.widgets.observers.observing_view import ObservingView
from mantidqt.MPLwidgets import FigureCanvas
from mantid.api import Workspace
Expand Down Expand Up @@ -123,6 +123,7 @@ def __init__(self, presenter, parent=None, window_flags=Qt.Window, name="", isMD
self.fig = Figure()
self.canvas = FigureCanvas(self.fig)
self.canvas.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
self.canvas.setMinimumSize(QSize(0, 0))
self.canvas.mpl_connect("button_press_event", self.presenter.plot_clicked)
self.ax = self.fig.add_subplot(111, projection="mantid")
layout_right.addWidget(self.canvas)
Expand Down Expand Up @@ -169,7 +170,7 @@ def set_model(self, model):
self.table.selectionModel().selectionChanged.connect(self.presenter.update)

def show_plot_and_stats(self, show_plot_and_stats):
"""sets wether the plot and stats section should be visible"""
"""sets whether the plot and stats section should be visible"""
if self.frame_right.isVisible() != show_plot_and_stats:
# the desired state is nor the current state
self.setUpdatesEnabled(False)
Expand Down