Ticket #8091 (closed: fixed)

Opened 7 years ago

Last modified 5 years ago

Control Spawning of Plot Windows

Reported by: Owen Arnold Owned by: Federico M Pouzols
Priority: major Milestone: Release 3.3
Component: GUI Keywords:
Cc: jon.taylor@…, nick.draper@… Blocked By:
Blocking: Tester: Dan Nixon

Description

The current MantidPlot behaviour is that every time you right-click and Plot (slice, spectrum) you get a new instance of a plot window. This can easily get out of hand. Some users want to re-use the same plot instance rather than generate new windows each time.

We should have a one-time configuration option that allows users to have a 1:1 mapping between the various plot types and their MantidPlot instance. The option should be off by default to preserve existing behaviour.

This is a requirement request from Jon Taylor, from the MantidPlot/Vates meeting 07/Oct/2013.

Change History

comment:1 Changed 7 years ago by Nick Draper

  • Status changed from new to assigned

Bulk move to assigned at the introduction of the triage step

comment:2 Changed 6 years ago by Federico M Pouzols

  • Owner changed from Anyone to Federico M Pouzols

comment:3 Changed 6 years ago by Federico Montesino Pouzols

  • Status changed from assigned to inprogress

Added config option: ReusePlotInstances (On/Off), re #8091

Changeset: 5f500a75aca8d6d63ccd0e69bcdb7ad583e18cc6

comment:4 Changed 6 years ago by Federico Montesino Pouzols

Support option 'ReusePlotInstances' in MantidPlot UI, re #8091

Changeset: 84ba0ed77aeca753277f0ef5d5a5a5487a1fe1a2

comment:5 Changed 6 years ago by Federico Montesino Pouzols

Added individual close slice viewer win, re #8091

Changeset: aba0f88fe8a6337cf572b1344bf10fbd4aeababf

comment:6 Changed 6 years ago by Federico Montesino Pouzols

tooltip, and try to keep positions, re #8091

Changeset: 9be889d5621dc7a830c2cfbfc7e8416a2216eb0c

comment:7 Changed 6 years ago by Federico Montesino Pouzols

Nicer error handling/messaging - spectrum and slice viewers, re #8091

Changeset: 56d66937308d58ef2de2dbdb06ecd35e53473fce

comment:8 Changed 6 years ago by Federico Montesino Pouzols

Nicer error handling/messaging - color fill plot, re #8091

Changeset: 4a6f4269bdbab9512e131ad3ec960b06a9d12dcb

comment:9 Changed 6 years ago by Federico Montesino Pouzols

comment out, not really possible, cause of plot differences, re #8091

Changeset: 0457dc3b1c3054216636803ebcb889041e7f1414

comment:10 Changed 6 years ago by Federico Montesino Pouzols

fixed initialization, re #8091

Changeset: af5c9066eda258436c816ed8751ae816e8da1348

comment:11 Changed 6 years ago by Federico Montesino Pouzols

fixed window name issues on windoze, re #8091

Changeset: 8ffc5e7c668412041ae2604327209c7a4885efd1

comment:12 Changed 6 years ago by Federico M Pouzols

  • Status changed from inprogress to verify
  • Resolution set to fixed
  • Milestone changed from Backlog to Release 3.3

A new plotting mode has been added that prevents the traditional (annoying) spawning of new windows for every new plot. This new plotting mode is disabled by default, as suggested. The checkbox to enable it can be found in:

View->Preferences->Mantid->Options (tab): "Re-use plot instances for different types of plots"

(http://www.mantidproject.org/MantidPlot:_Preferences_Dialog_Mantid#Options)

The new option has been added in the ConfigService as: "MantidOptions.ReusePlotInstances" = On/Off

When you enable this option, there are now 5 (reused) instances of different types of plots/interfaces that can be shown from the workspaces (dock) window, by right-clicking on workspaces:

  • spectrum plot (with/without errors, with/without distribution, etc.)
  • color fill plot
  • spectrum viewer
  • instrument view
  • slice viewer

There can only be one spectrum plot at a time, and one color fill plot, etc.

I updated and expanded a bit the description of the general View->Preferences: http://www.mantidproject.org/MantidPlot:_The_View_Menu#View_-.3E_Preferences . And then updated the screenshot of the Preferences Dialog / Options: http://www.mantidproject.org/MantidPlot:_Preferences_Dialog_Mantid#Options

It would be great if Jon Taylor and/or others who were interested in this change could check and provide feedback, as there would certainly be other alternative, plausible ways to address this ticket.

To test:

  • check that you can enable/disable the new option (If you hover the mouse you should see a tool tip explanation), and that new windows are created or not depending on your choice.
  • With the option disabled you should see the traditional MantidPlot behavior. When you enable it, if for example you plot several color fill plots from different workspaces, all these plots should be shown on a single window.
  • check that you can switch between the new "controled" mode and the old "spawning" mode by using the tickbox in preferences / options, at any time.

Note the following imperfection:

  • The implementation seems sound for the spectrum plots and the color fill plots: new plots re-use the same window.
  • The implementation for spectrum viewer, instrument view, and slice viewer is deficient: if there's a previous windows it is closed and destroyed, and a new window is created and shown. This is because a "refresh" or "update underlying data / workspace" functionality is not provided. "Refresh window" methods are required for these three classes that would be able to take a new workspace and show the relevant information without requiring a destroy/new cycle. That functionality is currently entangled in the constructors and other methods. I created three (lowish priority) separate tickets for these, as suggested by Owen. See #10445, #10446, and #10447.

Last edited 6 years ago by Federico M Pouzols (previous) (diff)

comment:13 Changed 6 years ago by Dan Nixon

  • Status changed from verify to verifying
  • Tester set to Dan Nixon

comment:14 Changed 6 years ago by Dan Nixon

  • Status changed from verifying to reopened
  • Resolution fixed deleted

After having plotted two workspaces with the "Re-use plot instances for different types of plots" option disabled I closed the two plot windows changed the option in Preferences and attempted to plot one of the workspaces again, this gave the following segfault:

Program received signal SIGSEGV, Segmentation fault.
0x00000000006ef4af in QListData::size (this=0x1bc83b0) at /usr/include/qt4/QtCore/qlist.h:98
98	    inline int size() const { return d->end - d->begin; }
(gdb) bt
#0  0x00000000006ef4af in QListData::size (this=0x1bc83b0) at /usr/include/qt4/QtCore/qlist.h:98
#1  0x00000000006f4d74 in QList<Graph*>::size (this=0x1bc83b0) at /usr/include/qt4/QtCore/qlist.h:137
#2  0x0000000000857225 in MultiLayer::setLayersNumber (this=0x1bc8300, n=0) at /home/dan/testing-builds/test1/Code/Mantid/MantidPlot/src/MultiLayer.cpp:1237
#3  0x0000000000647de1 in ApplicationWindow::prepareMultiLayer (this=0x1996000, isNew=@0x7fffffffd1e0: false, window=0x1bc8300, newWindowName=..., clearWindow=true) at /home/dan/testing-builds/test1/Code/Mantid/MantidPlot/src/ApplicationWindow.cpp:2796
#4  0x00000000009d4c9a in MantidUI::plot1D (this=0x1abbb80, toPlot=..., spectrumPlot=true, errs=false, distr=false, style=Graph::Unspecified, plotWindow=0x1bc8300, clearWindow=true) at /home/dan/testing-builds/test1/Code/Mantid/MantidPlot/src/Mantid/MantidUI.cpp:3063
#5  0x00000000009d4843 in MantidUI::plot1D (this=0x1abbb80, toPlot=..., spectrumPlot=true, errs=false, distr=false, plotWindow=0x0, clearWindow=false) at /home/dan/testing-builds/test1/Code/Mantid/MantidPlot/src/Mantid/MantidUI.cpp:2994
#6  0x00000000009a0c14 in MantidDockWidget::plotSpectra (this=0x1cb9a40) at /home/dan/testing-builds/test1/Code/Mantid/MantidPlot/src/Mantid/MantidDock.cpp:1263
#7  0x0000000000ad4f07 in MantidDockWidget::qt_static_metacall (_o=0x1cb9a40, _c=QMetaObject::InvokeMetaMethod, _id=15, _a=0x7fffffffd4f0) at /home/dan/testing-builds/test1-build/MantidPlot/src/Mantid/moc_MantidDock.cxx:108
#8  0x00007ffff33fe87a in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#9  0x00007ffff3b5aa62 in QAction::triggered(bool) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#10 0x00007ffff3b5c433 in QAction::activate(QAction::ActionEvent) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#11 0x00007ffff3f8a489 in ?? () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#12 0x00007ffff3f8e9b9 in ?? () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#13 0x00007ffff3bb050a in QWidget::event(QEvent*) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#14 0x00007ffff3f927bb in QMenu::event(QEvent*) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#15 0x00007ffff3b60e2c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#16 0x00007ffff3b675dd in QApplication::notify(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#17 0x0000000000996476 in MantidApplication::notify (this=0x7fffffffe460, receiver=0x5935b90, event=0x7fffffffdc10) at /home/dan/testing-builds/test1/Code/Mantid/MantidPlot/src/Mantid/MantidApplication.cpp:29
#18 0x00007ffff33ea4dd in QCoreApplication::notifyInternal(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#19 0x00007ffff3b66d93 in QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#20 0x00007ffff3bdbcfc in ?? () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#21 0x00007ffff3bdb269 in QApplication::x11ProcessEvent(_XEvent*) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#22 0x00007ffff3c02b02 in ?? () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#23 0x00007fffe90b2e04 in g_main_context_dispatch () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#24 0x00007fffe90b3048 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#25 0x00007fffe90b30ec in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#26 0x00007ffff34177be in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#27 0x00007ffff3c02bb6 in ?? () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#28 0x00007ffff33e90af in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#29 0x00007ffff33e93a5 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#30 0x00007ffff33eeb79 in QCoreApplication::exec() () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#31 0x0000000000ae4c0c in main (argc=1, argv=0x7fffffffe5f8) at /home/dan/testing-builds/test1/Code/Mantid/MantidPlot/src/main.cpp:219
(gdb) p d
$1 = (QListData::Data *) 0x0
Last edited 6 years ago by Dan Nixon (previous) (diff)

comment:15 Changed 6 years ago by Federico Montesino Pouzols

  • Status changed from reopened to inprogress

Fix crash when users close plot windows, re #8091

Changeset: c8877c94de15485178ac296f9306d7318ccb2d45

comment:16 Changed 6 years ago by Federico M Pouzols

  • Status changed from inprogress to verify
  • Resolution set to fixed

Good catch! This is now properly handled using (guarded) QPointer.

comment:17 Changed 6 years ago by Dan Nixon

  • Status changed from verify to verifying

comment:18 Changed 6 years ago by Dan Nixon

  • Status changed from verifying to closed

Merge remote-tracking branch 'origin/feature/8091_control_spawning_of_plot_windows'

Full changeset: 4b0e772141f60ca801c0c97c6b0d22fa2b28b8ee

comment:19 Changed 6 years ago by Dan Nixon

I quite like this, however one thing that would be nice is to be able to enable and disable the controlled/spawning mode on a per feature basis.

For instance I would quite like to only ever have one spectrum viewer instance but also have "unlimited" spectra plot instances. But this is something that could easily be implemented later.

comment:20 Changed 6 years ago by Federico M Pouzols

I like this suggestion a lot. I'd add a ticket about it. Let's check with Owen and also see if we get feedback from users.

comment:21 Changed 5 years ago by Stuart Campbell

This ticket has been transferred to github issue 8936

Note: See TracTickets for help on using tickets.