Ticket #9970 (closed: fixed)

Opened 6 years ago

Last modified 5 years ago

Refactor and improve project load/saving code

Reported by: Nick Draper Owned by: Harry Jeffery
Priority: major Milestone: Release 3.3
Component: Framework Keywords:
Cc: Blocked By:
Blocking: #1042, #2535, #2536, #5702, #8252, #8310, #8517, #9847, #9935, #9952, #10121 Tester:

Description (last modified by Harry Jeffery) (diff)

All of the project loading/saving code has been inherited from QtiPlot and suffers from several issues:

  • Fragile - Users report crashes when loading/saving projects
  • Buggy - Users have reported numerous bugs with its behaviour
  • Difficult to maintain - The code is messy and does not conform to Mantid's code standards
  • Incomplete - Many windows are not loaded/saved as part of projects, or only partially saved.

This ticket aims to resolve the fragility and maintainability of the code.

Goals:

  • Mantid should not crash while loading/saving
  • Project files should remain backwards compatible
  • Project loading/saving code should be easy to comprehend and conform to Mantid's standards
  • It should be easy to extend loading/saving coverage in future

Change History

comment:1 Changed 6 years ago by Harry Jeffery

  • Status changed from new to assigned

comment:2 Changed 6 years ago by Harry Jeffery

  • Status changed from assigned to inprogress

comment:3 Changed 6 years ago by Harry Jeffery

Added TSVSerialiser utility class. Refs #9970

This class provides useful deserialisation routines for loading and saving project files. Currently it only supports loading but it will be given support for saving in the near future.

Hopefully this will help to seriously reduce the technical debt of loading and saving project files.

Changeset: d71d564025a04cf5985ca81679bab56e02aa64fe

comment:4 Changed 6 years ago by Harry Jeffery

Revert to fix broken build. Refs #9970

Changeset: 4176734a929911099236aa94be38e46b2faeaf44

comment:5 Changed 6 years ago by Harry Jeffery

Add TSVSerialiser class. Refs #9970

This time it ought not break the build.

Changeset: 8d7cbe578eb8c0817bee74a92d3602af491f1edf

comment:6 Changed 6 years ago by Harry Jeffery

Fix most of, if not all, of the cppcheck warnings.

Refs #9970

Changeset: 2349df105a32168d17374b63e17d6639fbf40f1e

comment:7 Changed 6 years ago by Harry Jeffery

Fix cppcheck warning in TSVSerialiser. Refs #9970

Changeset: a32a3d81637d545f02c87628fc8499ed7d0c5ea3

comment:8 Changed 6 years ago by Harry Jeffery

Fix crash when loading spectrogram. Refs #9970

Changeset: b6c826f60c4615b8d3f2acb79b1209c57e7e29e4

comment:9 Changed 6 years ago by Harry Jeffery

Fix build on OSX. Refs #9970

Changeset: 1e57394cb00e3f1a85eb4aa4b8a26f3ba963fd2b

comment:10 Changed 6 years ago by Harry Jeffery

Fix spectrogram loading error found by cppcheck

Refs #9970

Changeset: 00b18973e52fb19ae26f2619dbb50cbaaee3a161

comment:11 Changed 6 years ago by Harry Jeffery

Create IProjectSerialisable interface.

This is the first part of the interface needed for the project loading/saving refactoring. It specifies the method used to accept input lines from a project and apply them to the window.

Refs #9970

Changeset: f9502b8833e47078762be7ff29ac0259f9eecba2

comment:12 Changed 6 years ago by Harry Jeffery

Begin moving MultiLayer parsing into MultiLayer itself.

Refs #9970

Changeset: 833ee91d8ff4b0eb16fe267453728b26d72cd0f9

comment:13 Changed 6 years ago by Harry Jeffery

Fix minor bug where project root folder was left unnamed.

Refs #9970

Changeset: daf1a9051c7dce20a3a7cadb7fd85da7f5a2b021

comment:14 Changed 6 years ago by Harry Jeffery

Change IProjectSerialisationInterface to ease further refactoring.

Refs #9970

Changeset: d399311e58564b1dae303b1e2091ce6c3533e07f

comment:15 Changed 6 years ago by Harry Jeffery

Add float parsing to TSVSerialiser

Refs #9970

Changeset: ae47ef6df16995d14a0f8bbc7546bf5295e5c4e6

comment:16 Changed 6 years ago by Harry Jeffery

Implement most of Graph::loadFromProject

This is the vast majority of loadFromProject implemented.

Yet to be implemented:

  • <spectrogram>
  • <AxisFormula (N)>

Unable to be implemented currently:

  • <CurveLabels>
  • <MantidYErrors>
  • <SkipPoints>

This is because their parsing depends on their order relative to the definition of curves in the project file. We cannot handle this correctly because we do not discern the order of elements when parsing. To resolve this, we will either have to make TSVSerialiser a lot more sophisticated, or break backwards compatibility for a few small cases.

Refs #9970.

Changeset: 1c4d88aad7668afc2f8050dbddd450ba39f98471

comment:17 Changed 6 years ago by Harry Jeffery

Fix typo in date. Refs #9970

Changeset: 3d5cd8d9b252aa8052d1ef698edf8260667b3ee2

comment:18 Changed 6 years ago by Harry Jeffery

Remove legacy cruft.

Assertion: Mantid was forked from QtiPlot 0.9.5 Therefore: Mantid has never saved a project file with a format older

than 0.9.5.

Conclusion: It's safe to delete this cruft as it'll be never used.

Refs #9970

Changeset: b23f01423780d4d930c0c331e20420ca3e917b72

comment:19 Changed 6 years ago by Harry Jeffery

Refs #9970. Tweak comment.

Changeset: c0d61905f15303d0482aa0228b10ba3288fe1122

comment:20 Changed 6 years ago by Harry Jeffery

Stub out ApplicationWindow::openGraph

We're not yet at the point of being able to delete this, but we're getting close, so for now let's stub out this function.

Refs #9970

Changeset: 74235e084f057a8b17b0a905a9eade726f6220d2

comment:21 Changed 6 years ago by Harry Jeffery

Remove unused methods from ApplicationWindow.

These were used by openGraph. They have been moved into the Graph class.

Refs #9970.

Changeset: 49ea7a52d7ca495f7603fe1c0e26b12a31acb284

comment:22 Changed 6 years ago by Harry Jeffery

Remove some obsolete logic from Graph::fillCurveSettings

Mantid was forked from QtiPlot 0.9.5 so we'll never encounter a project with a file version older than 0.9.5.

Refs #9970.

Changeset: 5b1dd5eaa42096b0586d571224ee0940e175f65a

comment:23 Changed 6 years ago by Harry Jeffery

Refs #9970. Remove orphaned method in Graph.

Changeset: 8583a79379277c177ba7786c65ce9c472f2b98ea

comment:24 Changed 6 years ago by Harry Jeffery

Add <spectrogram> handler to Graph::loadFromProject.

Refs #9970

Changeset: 6284b90d03b4900e1807480992fcceb147885d72

comment:25 Changed 6 years ago by Harry Jeffery

Parse spectrogram sections from project files.

This commit add basic support for parsing spectrogram sections and loading them into projects properly. Not all sections are supported yet. <ColorBar> and <ColorMap> are notably unsupported. They shouldn't be too difficult to add later on though.

Refs #9970

Changeset: 6a886631d3b01cea1eb48376e6afe81dc85ab766

comment:26 Changed 6 years ago by Harry Jeffery

Since this has been going on a while I'm taking a quick progress-check. This is proving to be quite a time sink but I'm managing my time so that I either spend roughly an afternoon or a morning working on this every day. That way it moves forward, but I still have time for other tickets.

Done: (the short version)

  • Parse project files using TSVSerialiser
    • Some subsections use TSVSerialiser, some still use old parsing code. More on that below.
  • Create interface for ISerialisable and start implementing it with long term goal for a static factory to ease saving more stuff to project files in future.

Todo:

  • Units in axis captions are not set correctly, for example pre-save: TOF (µs), post-save: TOF (?s)
  • <spectrogram>s load, but not fully.
  • There are numerous bugs in saving (many curves aren't saved), that give the illusion of a bug in loading.
  • To be refactored:
    • All the project saving code.
    • <MultiLayer><Graph><Function>...</Function></Graph></MultiLayer>
    • <MultiLayer><Graph><image>...</image></Graph></MultiLayer>
    • <MultiLayer><Graph><legend>...</legend></Graph></MultiLayer>
    • <MultiLayer><Graph><line>...</line></Graph></MultiLayer>
    • <MultiLayer><Graph><PieLabel>...</PieLabel></Graph></MultiLayer>
    • <MultiLayer><Graph><text>...</text></Graph></MultiLayer>
    • And probably a few more.
  • Sort out loading/closing projects in a sane way. Right now this is very buggy and awkward and the best way to close a project is to restart Mantid.

Problems:

  • Some saved values (specified in comment 16) are saved in a very awkward way that depends on their order relative to other values. There's only a few of these, and it'd be a lot of unnecessary complication to support them. Long term we'll be far better off breaking backwards-compatibility for these and having something simpler and more reliable for all future releases.
  • <MultiLayer><Graph><AxisFormula 1>...</AxisFormula></Graph></MultiLayer> This is totally inconsistent (and the number changes in the tag name). I'll probably need to put in some manual parsing for this (if only to remove it and avoid breaking TSVSerialiser). I'm strongly leaning towards getting rid of this in saving completely and providing a new, more consistent way of saving these values.

To summarise: This is going slowly but it's going. Refactoring saving ought to be much quicker and easier than doing the loading, but I expect to find many minor bugs in both loading/saving that will take time to fully resolve.

Last edited 6 years ago by Harry Jeffery (previous) (diff)

comment:27 Changed 6 years ago by Harry Jeffery

Stub out ApplicationWindow::appendProject.

This method uses the old parsing logic and is due to be replaced. I'm stubbing it out to allow myself to change the types of any other methods it calls in turn.

Refs #9970

Changeset: 160e172f684fa193db75e0fa4dab5890a5f73cde

comment:28 Changed 6 years ago by Harry Jeffery

Move <Matrix> parsing into interfaced stub.

This is the first half of the work required to move <Matrix> parsing into an IProjectSerialisable interface. It does everything up to the point of actually parsing the contents of <Matrix>. That ought to come in the next commit.

Refs #9970

Changeset: 8c4e2f74573fca415ab8fad0498c53202eab5d3b

comment:29 Changed 6 years ago by Harry Jeffery

  • Blocking 8517 added

There's already extremely limited support for what #8517 describes, but it's so limited, messy and broken that there's no way it's worth carrying in its current form. I'll be clearing it out as part of the refactoring, and then once the refactoring is done it should be easier to implement and maintain.

comment:30 Changed 6 years ago by Harry Jeffery

Implement Matrix::loadFromProject

Refs #9970

Changeset: 0285cb1490de58f6652651e24fdf534c937fd10b

comment:31 Changed 6 years ago by Harry Jeffery

Prepare to remove d_file_version.

It should not be a instance-global variable, but a parameter passed to the functions that need it. This commit cleans up the openProject and openProjectFolder methods of ApplicationWindow in preparation for its removal.

Refs #9970

Changeset: 21d5f1f59fe7aa26fa20369875e2f91e53f06df2

comment:32 Changed 6 years ago by Harry Jeffery

Remove obsolete dependency logic.

Reminder: MantidPlot forked QtiPlot 0.9.5, so we'll never encounter a mantid project file older that 0.9.5, so we can drop special handling for versions old than that.

Refs #9970

Changeset: eb7bb0915266a7a846804ef27e29ef786c0a55ad

comment:33 Changed 6 years ago by Harry Jeffery

Remove d_file_version.

Refs #9970

Changeset: 2c4c055be3127c30aef3c39f9ca36d755cff1316

comment:34 Changed 6 years ago by Harry Jeffery

Refactor Application::openNote.

This is a stop-gap.

Note itself needs to be refactored to use the IProjectSerialisable interface in the future.

Refs #9970

Changeset: 882219eeaa7c5f1403a528f771185ceb29ea9773

comment:35 Changed 6 years ago by Harry Jeffery

Refactor ApplicationWindow::openMantidMatrix

Refs #9970

Changeset: 19ad9701356e1b4807875cd55c4c43a9ef9b8338

comment:36 Changed 6 years ago by Harry Jeffery

Replace QString(str.c_str()) with QString::fromStdString(str)

Turns out I've been converting std::strings to QStrings the bad way. There probably isn't much gain to this way, but if I'm refactoring I may as well be refactoring correctly.

Refs #9970

Changeset: 09baa975311bd1e62ca2ef6926fbe4eca2b57003

comment:37 Changed 6 years ago by Harry Jeffery

Remove curFolder param from App..Window::openProjectFolder

It wasn't being used to replace current_folder, and it probably wouldn't be. Leaving it in would just cause confusion.

Refs #9970

Changeset: 9a97519c91432fea3f769379e7c97cbf0279ad04

comment:38 Changed 6 years ago by Harry Jeffery

Remove graph template cruft from ApplicationWindow.

This is unmaintainable and nonfunctional in its current form. Once the refactoring is complete, it ought to be far easier to re-implement properly. See #8517 for more information on templates.

Refs #9970

Changeset: c045dd926dc45225087efa60af17ccf9285b0a77

comment:39 Changed 6 years ago by Harry Jeffery

Move multilayer loading logic into its own function.

Refs #9970

Changeset: c3a3d94e74b0a72ec4be41d5c753e114bd2bfa3b

comment:40 Changed 6 years ago by Harry Jeffery

Remove orphan: ApplicationWindow::openSpectrogram.

Refs #9970

Changeset: 6e14c2fdcfda9f896fd080afe3f52e86d8935b8b

comment:41 Changed 6 years ago by Harry Jeffery

Remove orphan: ApplicationWindow::openGraph.

Refs #9970

Changeset: 9138026b4700c571df038ab6c108e12ad72bbeb6

comment:42 Changed 6 years ago by Harry Jeffery

Remove more cruft from ApplicationWindow.

Refs #9970

Changeset: 0c58cb9f1d87f50421b7668451a026a361c81070

comment:43 Changed 6 years ago by Harry Jeffery

Refactor loading SurfacePlot to use Graph3D (stub).

Refs #9970

Changeset: 939cfcec1e4fcd57d5035cc7e8fbc81839c2323e

comment:44 Changed 6 years ago by Harry Jeffery

Include <string> int IProjectSerialisable.

Refs #9970

Changeset: 6ec00720a56da6ae09b6bcf0283d7500822f58de

comment:45 Changed 6 years ago by Harry Jeffery

Implement Graph3D::loadFromProject.

We can now load SurfacePlots from project files.

Refs #9970.

Changeset: ec3272f17f0143b281982036244fb951120cae02

comment:46 Changed 6 years ago by Harry Jeffery

Refactor ApplicationWindow::openTable.

Now openTable calls Table::loadFromProject (which is only a stub so far, its implementation is forthcoming in the next patch)

Refs #9970

Changeset: 5f578767cf4d7130091bca22855d90e38b475499

comment:47 Changed 6 years ago by Harry Jeffery

Resolve some cppcheck warnings and errors.

In the case where a throw is removed, the return may be replaced with a new throw at a later date, as part of a polishing stage of this branch.

Refs #9970

Changeset: eab1ec2a91d3965fe50c8d4960a99b4d6252020d

comment:48 Changed 6 years ago by Harry Jeffery

Implemented Table::loadFromProject

Refs #9970

Changeset: 5c7970c76b04f514e5ff8373eb396fc46684bc0e

comment:49 Changed 6 years ago by Harry Jeffery

Fix exception in Table::loadFromProject.

Refs #9970.

Changeset: 5eed59eb2972a5c224b52186802140cc22893d21

comment:50 Changed 6 years ago by Harry Jeffery

Refactor TableStatistics project loading.

There still appears to be a bug with this though, where a statistics line is prepended to the statistics table upon project load. It's most likely being added when the statistics table is being created.

Refs #9970.

Changeset: f02fecad7b72e13b33b6505cbf20eb5c90bbb7a1

comment:51 Changed 6 years ago by Harry Jeffery

Tidy up logging.

Refs #9970.

Changeset: ca2c8a82bb1ce09783eac83f917dd28617cedbdf

comment:52 Changed 6 years ago by Harry Jeffery

Tidy up project loading a little.

This commit tidies up a few rough edges that I had left behind.

Refs #9970.

Changeset: 37b78f1d47c8bbd8621feac506fed81611cad599

comment:53 Changed 6 years ago by Harry Jeffery

Merge ApplicationWindow::loadScript overloads.

The overloaded version should just use a default parameter.

Refs #9970.

Changeset: 2d93817e38b3aaa9aacc939f305521f0c7ce0090

comment:54 Changed 6 years ago by Harry Jeffery

Tidy up ApplicationWindow.h a bit.

This commit does not contain any functional changes, and should not change any behaviour whatsoever. It is merely tidying up ApplicationWindow's header a little bit.

Refs #9970.

Changeset: 6fee883a660bdf38f199c823787f687c28497a34

comment:55 Changed 6 years ago by Harry Jeffery

Replace QString(str.c_str()) with QString::fromStdString.

This is more idiomatic, and less hacky.

Refs #9970.

Changeset: 4f5b3a24a74c6440f3f3c2affe4116fb8419f845

comment:56 Changed 6 years ago by Harry Jeffery

Finish project loading support for Graphs.

This commit adds support for a few awkward edge cases that were not yet supported by the project file loading refactoring.

Refs #9970.

Changeset: 9733dcfec7ab935aa0367f29e6bbc215450a7c87

comment:57 Changed 6 years ago by Harry Jeffery

Clear out old project on project load.

Before this commit, old projects would stay loaded when a new one was loaded. This commit causes them to be removed properly before loading the new one.

Refs #9970.

Changeset: 88f2cb939ca3bdc815905630bf654fe7744c211d

comment:58 Changed 6 years ago by Harry Jeffery

Restore current folder from project file.

Projects save which folder was selected. This commit restores this setting upon load.

Refs #9970.

Changeset: 59b6d5c9bbe94adaef0452f1f6245150e030b081

comment:59 Changed 6 years ago by Harry Jeffery

Implement writing logic of TSVSerialiser.

Refs #9970.

Changeset: ec2118173180864705f806bbcccbe5a47bc03ea2

comment:60 Changed 6 years ago by Harry Jeffery

Move project serialisation logic into saveProjectFolder.

Refs #9970.

Changeset: bc8fe494fe08115d599e042f2270b8b7ffa16a8d

comment:61 Changed 6 years ago by Harry Jeffery

Rename saveFolder to saveProjectFile.

Refs #9970.

Changeset: e3870256b6c5f8dc2f6697bcc5c50a00a7387d2c

comment:62 Changed 6 years ago by Harry Jeffery

Refactor saveProjectFolder to be recursive.

Refs #9970.

Changeset: 697c2e817746cc87365b14b8aeb1394df383a8e8

comment:63 Changed 6 years ago by Harry Jeffery

Remove saveAsTemplate orphans.

These are currently unused and blocking refactoring of saveToString methods into saveToProject methods. They ought to be relatively easy to re-add later when needed.

Refs #9970.

Changeset: 8480e968e35da77b7596d20c79616ab1789aa3d2

comment:64 Changed 6 years ago by Harry Jeffery

Fix bug where <open> was appended to project file.

Refs #9970.

Changeset: f92ee48bf2cf281cf13cd9d998d44abef4cc7bc6

comment:65 Changed 6 years ago by Harry Jeffery

Add saveToProject to IProjectSerialisable and use it.

Refs #9970.

Changeset: f5248cd4a4d9ccb9a3945c19db122823b41f4aae

comment:66 Changed 6 years ago by Harry Jeffery

Start refactoring Table to use saveToProject.

Refs #9970.

Changeset: d6fb13740834d013315abfa0c6334713f7ba060f

comment:67 Changed 6 years ago by Harry Jeffery

Refactor Table::saveToProject to use TSVSerialiser.

Refs #9970.

Changeset: f63b4ab14230ee48b1abd7c4f31cb8996390067c

comment:68 Changed 6 years ago by Harry Jeffery

Correct minor error when parsing TableStatistics.

Refs #9970.

Changeset: 94934e9ed32d83e6d0c734cf1140cac7427e3fca

comment:69 Changed 6 years ago by Harry Jeffery

  • Blocking 9847 added

comment:70 Changed 6 years ago by Harry Jeffery

  • Blocking 2535 added

comment:71 Changed 6 years ago by Harry Jeffery

  • Blocking 2536 added

comment:72 Changed 6 years ago by Harry Jeffery

  • Blocking 5702 added

comment:73 Changed 6 years ago by Harry Jeffery

  • Blocking 8252 added

comment:74 Changed 6 years ago by Harry Jeffery

  • Blocking 9952 added

comment:75 Changed 6 years ago by Harry Jeffery

  • Blocking 1042 added

comment:76 Changed 6 years ago by Harry Jeffery

  • Blocking 9935 added

comment:77 Changed 6 years ago by Harry Jeffery

Stylistic tweaks to TSVSerialiser.

Refs #9970.

Changeset: bd432c1bc30aa55d90bbb8ed2f2c595c7329fc92

comment:78 Changed 6 years ago by Harry Jeffery

Replace Matrix::saveToString with Matrix::saveToProject.

Refs #9970.

Changeset: cf56344b028535181bc27d55e7b2e080963c8e72

comment:79 Changed 6 years ago by Harry Jeffery

Tidy up newMantidMatrix orphans.

Refs #9970.

Changeset: 80c13c05356ca560f0a1c50578e5494535dbd497

comment:80 Changed 6 years ago by Harry Jeffery

Tidy up MantidUI::openMatrixWorkspace.

Refs #9970.

Changeset: 9d1efa6215c0e949e7bb10a1e5ac5cc979364432

comment:81 Changed 6 years ago by Harry Jeffery

Replace MantidMatrix's saveToString with saveToProject.

Refs #9970.

Changeset: f0c6f213a5509727c9bc891b29ce87d66ad6c4a5

comment:82 Changed 6 years ago by Harry Jeffery

Refactor ApplicationWindow::windowGeometryInfo.

Refs #9970.

Changeset: 6922f705f9153f009c678c38c2243622bcb345d7

comment:83 Changed 6 years ago by Harry Jeffery

Replace MultiLayer's saveToString with saveToProject.

Refs #9970.

Changeset: c7c7de97b49d5a725092b63d7e0706489723356d

comment:84 Changed 6 years ago by Harry Jeffery

Refactor Grid::saveToString.

Refs #9970.

Changeset: 4061a80f88151ef3203335756cab0e5c055c9aca

comment:85 Changed 6 years ago by Harry Jeffery

Refactor Graph::saveScale()

Refs #9970.

Changeset: 548a73994939127c69b0307bc429655a1139c059

comment:86 Changed 6 years ago by Harry Jeffery

Refactor Graph::saveCurves() into Graph::saveCurve()

Refs #9970.

Changeset: 6c6b7d60634ecbe9c507bc9a67943a02eaa55e2a

comment:87 Changed 6 years ago by Harry Jeffery

Refactor Graph::saveMarkers()

Refs #9970.

Changeset: afd9ec5f1f6c65c8d97db239f5289eb2a1ec6971

comment:88 Changed 6 years ago by Harry Jeffery

Refactor Graph::saveToString to Graph::saveToProject.

Refs #9970.

Changeset: 5752781bfc125ef3e54e4102a5f7e72dee6f0edd

comment:89 Changed 6 years ago by Harry Jeffery

Graph doesn't need to inherit IProjectSerialisable.

Graph itself is not a top level window that's saved as part of a project. It's a child object of MultiLayer. MultiLayer handles loading and saving graphs explicitly, so the interface is simply not needed here.

Refs #9970.

Changeset: 3540abe071a5ba311b351a835eb4a1127ba6f434

comment:90 Changed 6 years ago by Harry Jeffery

Refactor Note's load/save to use IProjectSerialisable.

Refs #9970.

Changeset: ca98ab1b76b5dc8c5f141327594520e103fcca1b

comment:91 Changed 6 years ago by Harry Jeffery

Replace Graph3D::saveToString with Graph3D::saveToProject.

Refs #9970.

Changeset: 7bb3533208f4b36892a255c40bd40bb7ce6c7971

comment:92 Changed 6 years ago by Harry Jeffery

Remove IProjectSerialisable interface from Spectrogram.

Spectrogram is not an MdiSubwindow, so it doesn't need this interface, as it's not going to be serialised directly. It's explicitly serialised/deserialised by the graph that owns it. So we can ditch the official interface and just use simplified methods similar to the interface.

Refs #9970.

Changeset: cb632596afbf64e2d1c4a8a605bfd53bfe9dab58

comment:93 Changed 6 years ago by Harry Jeffery

Replace Spectrogram::saveToString with Spectrogram::saveToProject.

Refs #9970.

Changeset: f3aa906a1d6d20648a39168486ff5aa90f409d07

comment:94 Changed 6 years ago by Harry Jeffery

Force implementors of IProjectSerialisable to implement saveToProject.

Refs #9970.

Changeset: 8b939dd57cb678124c8ae04975c530ae9d80c665

comment:95 Changed 6 years ago by Harry Jeffery

Make InstrumentWindow implement IProjectSerialisable.

Refs #9970.

Changeset: 2074e936a34b4e2f5c5c730322c8d30207cbf8ec

comment:96 Changed 6 years ago by Harry Jeffery

Move some logic into Table::saveTableMetadata.

I'm doing this so it can be re-used by TableStatistics.

Refs #9970.

Changeset: cd568ede7f6f799ea18b5823d1bb6338377135bb

comment:97 Changed 6 years ago by Harry Jeffery

Refactor TableStatistics's saveToString into saveToProject.

Refs #9970.

Changeset: bbf930511c01b7f7d5162bd42e637c2cee471b9c

comment:98 Changed 6 years ago by Harry Jeffery

Remove orphaned functions from Table.

Refs #9970.

Changeset: 86636451dbcbf6995860563acaa445faf007c0a4

comment:99 Changed 6 years ago by Harry Jeffery

Fix some small errors in Graph::saveToProject.

Refs #9970.

Changeset: 04f8bcf715d03944a66dd38bee88065e38060e76

comment:100 Changed 6 years ago by Harry Jeffery

Refactor MatrixModel::saveToString to saveToProject.

Refs #9970.

Changeset: 7cb889a2b751f6ad77a0ca5d8d31883587e6f94c

comment:101 Changed 6 years ago by Harry Jeffery

Remove obsolete saveToString calls.

Table no longer implements saveToString, so these calls does nothing.

Refs #9970.

Changeset: 1b91408a83ec1d946e3bbb5746fd8b68feb4cd13

comment:102 Changed 6 years ago by Harry Jeffery

Remove some orphans from Graph and Table.

Refs #9970.

Changeset: f9bba4cd1a9b49f8dac790ec66dc550ac156087a

comment:103 Changed 6 years ago by Harry Jeffery

Support loading ColorMap and ColorBar in Spectrogram

Refs #9970.

Changeset: aff161b3d057ac56054f3dbf7e235bf27c25a90a

comment:104 Changed 6 years ago by Harry Jeffery

Add enable waterfall plot parsing

Refs #9970.

Changeset: 123a00fd68b7980308171b2819cdf1472b8f0afa

comment:105 Changed 6 years ago by Harry Jeffery

Reimplement ApplicationWindow::appendProject()

Refs #9970.

Changeset: fa6ec2996c03543a367c731f76ca4a4b1fcfa007

comment:106 Changed 6 years ago by Harry Jeffery

Fix some errors found by checkbuild.

Refs #9970.

Changeset: 480bb2c48906614da0084344e0bcb61d989bccfb

comment:107 Changed 6 years ago by Harry Jeffery

Clean up usage of current_folder and loaded_folder

Refs #9970.

Changeset: 203c47b998ee267bda65252a7b8cb4f900e27eb1

comment:108 Changed 6 years ago by Harry Jeffery

Fix bug where loaded windows were not resized

Refs #9970.

Changeset: 37f44cb0cc186bd149893b9d42d93d55bb2d9842

comment:109 Changed 6 years ago by Harry Jeffery

Refactor Graph::insertText

Refs #9970

Changeset: 6a0209470c16baabf01c0187473cabaa57096012

comment:110 Changed 6 years ago by Harry Jeffery

Fix bug when saving Graphs

Refs #9970

Changeset: fab219d546c14e3b3d77dce213912b6f8847b26d

comment:111 Changed 6 years ago by Harry Jeffery

Fix saving of function curve graphs

Refs #9970

Changeset: d1590a18d075abfa96ba7cc218dec17aa110f98f

comment:112 Changed 6 years ago by Harry Jeffery

  • Blocking 10121 added

comment:113 Changed 6 years ago by Harry Jeffery

  • Blocking 8310 added

comment:114 Changed 6 years ago by Harry Jeffery

TSVSerialiser: Add support for numbered sections

There is exactly one case where this is needed: <AxisFormula 1>...</AxisFormula>

TSVSerialiser will now parse these sections and save them with the space and number included in the section name.

Refs #9970

Changeset: 5a2b39e3b5c20e9db093448efad7bbc537ec85cf

comment:115 Changed 6 years ago by Harry Jeffery

Add support for loading <AxisFormula n> sections

Refs #9970

Changeset: 394b34d1dcade6c3bfb7dfce0f0ebca84f6c3bd0

comment:116 Changed 6 years ago by Harry Jeffery

ApplicationWindow: Preserve unicode when loading/saving

Refs #9970

Changeset: 3771d4a643315024b6593c54c2b240e5b9ee613f

comment:117 Changed 6 years ago by Harry Jeffery

TSVSerialiser: add selectSection

Going into the final polish, this ought to clean up serialisation logic a little.

Refs #9970

Changeset: edfdec695a57f50ba586f16710e3d775af55b59a

comment:118 Changed 6 years ago by Harry Jeffery

Preserve unicode when loading/saving

This applies to:

  • Graph
  • Graph3D
  • Grid
  • Matrix
  • MatrixModel
  • MultiLayer
  • Note
  • Table
  • TableStatistics

Refs #9970

Changeset: 97d033c7b11301d36a45cd6c4af38dbab01fdfa2

comment:119 Changed 6 years ago by Harry Jeffery

Progress report

The refactoring and conversion of existing functionality is complete and the branch is almost ready for testing.

The only known bug is in the loading and saving of windows' geometry. When loaded, windows shrink by the size of their window decorations. Somewhere geometry and frameGeometry are being confused. https://qt-project.org/doc/qt-4.8/application-windows.html#window-geometry

comment:120 Changed 6 years ago by Harry Jeffery

Tidy up restoreWindowGeometry

Refs #9970

Changeset: 972b97be78aa5e8099de08802ddc3528f09263f1

comment:121 Changed 6 years ago by Harry Jeffery

Improve variable names

Refs #9970

Changeset: 98598bacf8c9f613366365a32a420b9a6748b48e

comment:122 Changed 6 years ago by Harry Jeffery

Fix the MdiSubWindow sizing bug

Refs #9970

Changeset: 04c1c75a80b91569cbc27e4efe12fa733d37f138

comment:123 Changed 6 years ago by Harry Jeffery

Refs #9970 Merge branch 'master' into feature branch

Conflicts:

Code/Mantid/MantidPlot/src/Mantid/MantidMatrix.cpp

Changeset: 18ec20da20a1012e08b443a9a042ddf814c2d9d7

comment:124 Changed 6 years ago by Harry Jeffery

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

This is obviously a very large branch touching a lot of functionality and should be tested carefully across all supported platforms. I have been using/testing it on Ubuntu 14.04 as I have been working, but as ever it's possible I've missed something.

This ticket has reached feature parity with the existing functionality and has no known bugs (other than shortcomings for which other tickets already exist, (see blocking)).

The only merge conflict that has occured has been an include added in the same place a different include was added on another branch.

Branch: https://github.com/mantidproject/mantid/compare/feature/9970_refactor_project_serialisation

To Test:

  • Load and save projects with various graphs and windows open. Look for breakages.
  • Load existing project files in pre-refactored mantid and post-refactored mantid. Look for breakages.
  • Save project files in post-refactored mantid and open them in pre-refactored mantid. Look for breakages.
  • Inspect code
  • Check for broken unit and system tests

comment:125 Changed 6 years ago by Owen Arnold

  • Status changed from verify to reopened
  • Resolution fixed deleted

This ticket needs a description of the things that needed to have been fixed. In other words, I do not see the scope for this work. Please update the ticket description so that the tester can understand what has happened. The PM will also need this for project reporting upon release.

You can close the ticket again when this has been added.

comment:126 Changed 6 years ago by Harry Jeffery

  • Status changed from reopened to verify
  • Resolution set to fixed
  • Description modified (diff)

comment:127 Changed 6 years ago by Roman Tolchenov

  • Status changed from verify to verifying
  • Tester set to Roman Tolchenov

comment:128 Changed 6 years ago by Roman Tolchenov

  • Status changed from verifying to reopened
  • Resolution fixed deleted

Tested on windows. Defect found:

  1. Not all types of workspaces can be saved.
  2. 3D plot doesn't load back (or not saved).
  3. Colour fill plot loads blank.
  4. Curve colours are lost after loading.

comment:129 Changed 6 years ago by Harry Jeffery

  • Status changed from reopened to inprogress

Merge branch 'master' into feature/9970_refactor_project_serialisation

Refs #9970

Conflicts:

Code/Mantid/MantidPlot/src/ApplicationWindow.cpp Code/Mantid/MantidPlot/src/ApplicationWindow.h

Changeset: eb3da6493eacdd8d9e8f02b25a416a30809c70b9

comment:130 Changed 6 years ago by Harry Jeffery

Refs #9970 Save spectrogram's matrix

The matrix a spectrogram was meant to be representing was not being saved into the project files. This has now been resolved. However, this is not being saved in previous versions of Mantid (which crash when dealing with spectrograms apparently).

Changeset: ddd84331a7fbe07c249965515d026da2a1683779

comment:131 Changed 6 years ago by Harry Jeffery

Refs #9970 Fix saving of 3D graphs

Changeset: e05874b80fe38ae37b29a4b5a5c1d3f7ef58d0a0

comment:132 Changed 6 years ago by Harry Jeffery

Refs #9970 Fix losing curve colors upon load

Changeset: 7315320f68c2dd03331dfe37b63b0e77e8711cc5

comment:133 Changed 6 years ago by Harry Jeffery

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

See comment 124 (http://trac.mantidproject.org/mantid/ticket/9970#comment:124) for testing instructions.

Issues found so far have been resolved.

comment:134 Changed 6 years ago by Owen Arnold

Try to create a MDWorkspace like this:

CreateMDWorkspace(Dimensions=3, Extents='-10,10,-10,10,-10,10', Names='A,B,C', Units='U,U,U', OutputWorkspace='demo')

Then try to save the project.

Error in execution of algorithm SaveNexusProcessed
Workspace "demo" not saved because it is not of a type we can presently save.

You may be able to fix this by getting the save project to consider looking at SaveMD also as a candidate algorithm.

comment:135 Changed 6 years ago by Harry Jeffery

  • Status changed from verify to reopened
  • Resolution fixed deleted

comment:136 Changed 6 years ago by Harry Jeffery

  • Status changed from reopened to inprogress

Refs #9970 Use SaveMD when required to save workspaces

Changeset: fadf696dfea5c147add8f624399fe1f2d5c13953

comment:137 Changed 6 years ago by Harry Jeffery

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

The issue raised in comment (134) has been fixed. However, the generated workspace cannot be loaded afterwards as it contains no data, which the loading algorithm does not seem to like.

See comment 124 (​http://trac.mantidproject.org/mantid/ticket/9970#comment:124) for testing instructions.

comment:138 Changed 6 years ago by Owen Arnold

  • Status changed from verify to verifying
  • Tester changed from Roman Tolchenov to Owen Arnold

comment:139 Changed 6 years ago by Owen Arnold

Unfortunately doesn't work even after adding mdevents

CreateMDWorkspace(Dimensions=3, Extents='-10,10,-10,10,-10,10', Names='A,B,C', Units='U,U,U', OutputWorkspace='c')
FakeMDEventData(InputWorkspace='c', PeakParams='10000,0,0,0,1')

Seems to save out ok, but doesn't load it. I presume it's using LoadNexus rather than LoadMD.

comment:140 Changed 6 years ago by Owen Arnold

  • Status changed from verifying to reopened
  • Resolution fixed deleted

comment:141 Changed 6 years ago by Harry Jeffery

  • Status changed from reopened to inprogress

comment:142 Changed 6 years ago by Harry Jeffery

Refs #9970 Support loading MD workspaces in a project

Changeset: f2f2f07d29cd1b387805705160b82448ce190c22

comment:143 Changed 6 years ago by Harry Jeffery

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

See comment 124 (​​http://trac.mantidproject.org/mantid/ticket/9970#comment:124) for testing instructions.

comment:144 Changed 6 years ago by Owen Arnold

  • Status changed from verify to verifying

comment:145 Changed 6 years ago by Owen Arnold

  • Status changed from verifying to verify
  • Tester Owen Arnold deleted

comment:146 Changed 6 years ago by Dan Nixon

The issue with MDWorkspaces seems to be resolved.

Ont thing I noticed is that when I save a project with a detector table open in which multiple detectors are mapped to a single spectra when I load the project the detector ID cells which contained multiple detector IDs not just contain zeros.

I also get this error in the console:

TSVSerialiser-[Warning] Unable to identify line in TSVSerialiser::parseLines(): 'irs26176_graphite002_sqw-Detectors-1	13	7	28/11/2014 14:23'

Also if I have the Python window open without saving the script, close Mantid saving the project but not the script I get a load dialog from the script window when I load the project.

Also a very minor issue, if I load a project that contains plots then delete the workspaces behind one of the plots, the plot window remains (usually the plot window would be closed) and contour plots remain with the plot still visible.

I also see that the results log is cleared sometimes, I'm not sure what the conditions for this are but should this really happen.

comment:147 Changed 6 years ago by Harry Jeffery

  • Status changed from verify to reopened
  • Resolution fixed deleted

comment:148 Changed 6 years ago by Harry Jeffery

  • Status changed from reopened to inprogress

Further testing shows that the problem with detector tables is a bug in the tables themselves. Strings are placed into numeric columns, which reset to 0 when interacted with. The behaviour is the same before this branch.

The Python script window issue has been identified and will be fixed.

The plot window closing issue is small enough to be ignored for now and looked into later.

The results log is cleared when the folder or project is changed. This is the original logic, and has not been modified. So far as I am aware, no users have had issue with this, so I won't be touching it.

comment:149 Changed 6 years ago by Harry Jeffery

Merge remote-tracking branch 'origin/master' into feature/9970_refactor_project_serialisation

Refs #9970

Changeset: 5c724069f83039db4e8641aa4513d978e27282ed

comment:150 Changed 6 years ago by Harry Jeffery

Refs #9970 Do not save a blank script window

Changeset: 46215dea3eda5d761bdf9f95b4cb8ff5d22e7849

comment:151 Changed 6 years ago by Harry Jeffery

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

comment:152 Changed 6 years ago by Dan Nixon

The issue with the Python window still exists if at least one script tab open is saved.

Other than this I have no other issues, as far as I have tested plots and workspaces seem to load and save fine.

comment:153 Changed 6 years ago by Harry Jeffery

The script window issue can be resolved as part of #2535

comment:154 Changed 6 years ago by Lottie Greenwood

  • Status changed from verify to verifying
  • Tester set to Lottie Greenwood

comment:155 Changed 6 years ago by Harry Jeffery

  • Status changed from verifying to closed

Merge branch 'master' into feature/9970_refactor_project_serialisation

Refs #9970

Conflicts:

Code/Mantid/MantidPlot/src/ApplicationWindow.cpp Code/Mantid/MantidPlot/src/ApplicationWindow.h

Full changeset: eb3da6493eacdd8d9e8f02b25a416a30809c70b9

comment:156 Changed 6 years ago by Harry Jeffery

Merge remote-tracking branch 'origin/master' into feature/9970_refactor_project_serialisation

Refs #9970

Full changeset: 5c724069f83039db4e8641aa4513d978e27282ed

comment:157 Changed 6 years ago by Lottie Greenwood

Merge remote-tracking branch 'origin/feature/9970_refactor_project_serialisation'

Full changeset: 65ff2f3d28fe2d4fe889cf5f2d2f2bd61eb12485

comment:158 Changed 6 years ago by Lottie Greenwood

  • Tester Lottie Greenwood deleted

comment:159 Changed 5 years ago by Stuart Campbell

This ticket has been transferred to github issue 10812

Note: See TracTickets for help on using tickets.