Closed GuiMacielPereira closed 11 months ago
Last thing I just spotted, is when you give a ridiculously large number as the font size such as 10e7
, I get this error:
Traceback (most recent call last):
File "/home/mlc47243/mambaforge/envs/mantidnightly/lib/python3.10/site-packages/matplotlib/backends/backend_agg.py", line 405, in draw
self.figure.draw(self.renderer)
File "/home/mlc47243/mambaforge/envs/mantidnightly/lib/python3.10/site-packages/matplotlib/artist.py", line 74, in draw_wrapper
result = draw(artist, renderer, *args, **kwargs)
File "/home/mlc47243/mambaforge/envs/mantidnightly/lib/python3.10/site-packages/matplotlib/artist.py", line 51, in draw_wrapper
return draw(artist, renderer)
File "/home/mlc47243/mambaforge/envs/mantidnightly/lib/python3.10/site-packages/matplotlib/figure.py", line 3082, in draw
mimage._draw_list_compositing_images(
File "/home/mlc47243/mambaforge/envs/mantidnightly/lib/python3.10/site-packages/matplotlib/image.py", line 131, in _draw_list_compositing_images
a.draw(renderer)
File "/home/mlc47243/mambaforge/envs/mantidnightly/lib/python3.10/site-packages/matplotlib/artist.py", line 51, in draw_wrapper
return draw(artist, renderer)
File "/home/mlc47243/mambaforge/envs/mantidnightly/lib/python3.10/site-packages/matplotlib/axes/_base.py", line 3064, in draw
self._update_title_position(renderer)
File "/home/mlc47243/mambaforge/envs/mantidnightly/lib/python3.10/site-packages/matplotlib/axes/_base.py", line 3008, in _update_title_position
ax.yaxis.get_tightbbox(renderer) # update offsetText
File "/home/mlc47243/mambaforge/envs/mantidnightly/lib/python3.10/site-packages/matplotlib/axis.py", line 1253, in get_tightbbox
self._update_label_position(renderer)
File "/home/mlc47243/mambaforge/envs/mantidnightly/lib/python3.10/site-packages/matplotlib/axis.py", line 2506, in _update_label_position
bboxes, bboxes2 = self._get_tick_boxes_siblings(renderer=renderer)
File "/home/mlc47243/mambaforge/envs/mantidnightly/lib/python3.10/site-packages/matplotlib/axis.py", line 2056, in _get_tick_boxes_siblings
tlb, tlb2 = axis._get_ticklabel_bboxes(ticks_to_draw, renderer)
File "/home/mlc47243/mambaforge/envs/mantidnightly/lib/python3.10/site-packages/matplotlib/axis.py", line 1232, in _get_ticklabel_bboxes
return ([tick.label1.get_window_extent(renderer)
File "/home/mlc47243/mambaforge/envs/mantidnightly/lib/python3.10/site-packages/matplotlib/axis.py", line 1232, in <listcomp>
return ([tick.label1.get_window_extent(renderer)
File "/home/mlc47243/mambaforge/envs/mantidnightly/lib/python3.10/site-packages/matplotlib/text.py", line 915, in get_window_extent
bbox, info, descent = self._get_layout(self._renderer)
File "/home/mlc47243/mambaforge/envs/mantidnightly/lib/python3.10/site-packages/matplotlib/text.py", line 313, in _get_layout
_, lp_h, lp_d = _get_text_metrics_with_cache(
File "/home/mlc47243/mambaforge/envs/mantidnightly/lib/python3.10/site-packages/matplotlib/text.py", line 97, in _get_text_metrics_with_cache
return _get_text_metrics_with_cache_impl(
File "/home/mlc47243/mambaforge/envs/mantidnightly/lib/python3.10/site-packages/matplotlib/text.py", line 105, in _get_text_metrics_with_cache_impl
return renderer_ref().get_text_width_height_descent(text, fontprop, ismath)
File "/home/mlc47243/mambaforge/envs/mantidnightly/lib/python3.10/site-packages/matplotlib/backends/backend_agg.py", line 238, in get_text_width_height_descent
font = self._prepare_font(prop)
File "/home/mlc47243/mambaforge/envs/mantidnightly/lib/python3.10/site-packages/matplotlib/backends/backend_agg.py", line 275, in _prepare_font
font.set_size(size, self.dpi)
RuntimeError: In set_size: Could not set the fontsize (invalid pixel size; error code 0x17)
A similar problem probably happens for the scale option. We might want to set a sensible maximum possible value for font size?
if
statements that set font size to reasonable limits: 1 or 1000.
0.0
after an invalid input - which, in itself, is also an invalid input)Increment all font sizes
I just realised that I will need to write a release note for these changes?
The tooltip change looks good
I think the next step is:
Apply
is clicked, then the font sizes to use should be the ones displayed in the tooltipApply
is clickedIt should then be possible to remove the top checkbox
Overall Changes:
Summary of Changes
Description of work:
plot_options_presenter.py
to signal whether the two new fields (for setting all font sizes and scaling all font sizes) are part of the modified values. Added a new function also in this class that removes elements from the dictionary of modified values. This function is triggered when user unticks either of the checkboxes, so that any changes previously made are internally discarded from the dict of modified values. Similarly, when a checkbox is ticked, the default values are loaded ontomodified values
and any sunbsequent edit by the user in the Gui apdatest these values.cut_plot.py
, the implementation of setting and scaling all fonts is contained whithin the funcitonsCutPlot.all_fonts_size
andCutPlot.scale_all_fonts
respectively. These two functions are implemented by getter and setter decorators.cut_options_presenter_test.py
to confirm that data transfer between GUI view and internal class is happening successfully.To test:
cut_options_presenter_test.py
, comment out any line that callsself.presenter._value_modified
and check that test fails (this is the equivalent of no checkboxes being ticked)Fixes #942 .