Ticket #8532 (closed: fixed)

Opened 7 years ago

Last modified 5 years ago

Refl_gui Improvements - Save Check and Autosave

Reported by: Keith Brown Owned by: Keith Brown
Priority: major Milestone: Release 3.1
Component: Reflectometry Keywords:
Cc: Blocked By: #8531, #8549
Blocking: #7377, #8560 Tester: Owen Arnold

Description

If the user closes the refl_gui dialog, it should prompt for a save if anything has changed in the GUI over the top of the loaded tbl file. That way users won't accidentally loose their work.

There should be an autosave feature. In the presence of an exception, we want to be able to autosave work. This may require a little design work, as we want to guarantee that the autosave gets run with true Exception safety.

Change History

comment:1 Changed 7 years ago by Keith Brown

  • Status changed from new to inprogress

Refs #8532. Save on close in place and new file menu items

The save-on-close behavior is in place but not fully wired up yet. It relys on a modified flag which currently isn't set by anything, but hard coding the value makes it work. The autosave-on-fail behavior is also in place and not wired up.

The file menu has had a few tweaks as they were related to this ticket:

  • "Save Table" has been renamed and relabled as "Save As..." to conform with a universally recognised command. It's shortcut has also changed to Ctrl-Alt-S (taking inspiration from Notepad++)
  • "Load Table" has been renamed and relabled as "Open Table..." to conform with a universally recognised command. It's shortcut hasn't changed and is still Ctrl-O
  • "Re-Load Table" had been renamed and relabled as "Reload from Disk" (taking inspiration from Notepad++) - it's shortcut hasn't changed and is still Ctrl-R
  • New Command - "Save" overwrites the existing file if one has been loaded in, or will be the same as Save As if it's a new file. It's shortcut is the universally recognised Ctrl-S
  • New Command - "Close Refl Gui" has been added as originally the only way to close the GUI was the control on the title bar, which is bad UI design. It takes on the same close command as any mantid sub-window: Ctrl-F4

The "Save" menu item, Save-on-close and Autosave-on-fail actualy share the same function, with a boolean flag separating the functionality. The default is save/save-on-close behavior, boolean true is passed to trigger the autosave behavior.

In order to do the save-on-close behavior I've had to re-implement QMainwindow in ISIS_Reflectonomy.py, overriding the closeEvent.

In order ot follow better pyqt practice, the existing signals have also had their connection statements changed to the new [object].[trigger].connect([slot/function]) form.

Changeset: db05c587bd5a8437238286295bcaff6149da09aa

comment:2 Changed 7 years ago by Keith Brown

Refs #8532. Modified flag and autosave wired up

The autosave is wired up to the destructor, even if that may be a bad idea in python - this is purely becuse we've not been told any specific cases where the entrie GUI failed in the old version so it's the best option for now.

The modified flag has been wired up to the table's cellChanged signal and its made sure the triggers as when the window's closeEvent is called it will focus the process button to make sure the table fires events.

A loading flag as been introduced to prevent the modified flag from being tripped when loading a file.

Changeset: 5501e1a18009b54f6c8353677eee6a86586d2920

comment:3 Changed 7 years ago by Keith Brown

I think I've done all I can here

To test: (READ THE WARNING IN comment:5 BEFORE ACCEPTING FOR TESTING)

The gui in question is ISIS Reflectometry in Interfaces->Reflectometry

Make sure the gui asks if you want to save if you've modified the table (other than loading which it shouldn't ask about)

Also check the file menu items work as expected

If you can find a way to crash the GUI so that it closes let me know.

Last edited 7 years ago by Keith Brown (previous) (diff)

comment:4 Changed 7 years ago by Keith Brown

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

comment:5 Changed 7 years ago by Keith Brown

There is a high chance this will cause merge conflicts with master as #8531 and #8549 also alter the same code as this ticket.

In the case of a merge conflict, fail the test and reopen so I can merge master into the branch and resolve it before submitting for testing again.

I believe the likelihood of conflicts will be increased if this ticket is merged before the other aforementioned tickets, so if possible, let them both pass first.

comment:6 Changed 7 years ago by Keith Brown

  • Blocked By 8531, 8549 added

comment:7 Changed 7 years ago by Keith Brown

  • Status changed from verify to reopened
  • Resolution fixed deleted

comment:8 Changed 7 years ago by Keith Brown

as this is the ticket most likly to cause those conflicts, I've reopened it and will resolve any conflicts before reopening

comment:9 Changed 7 years ago by Keith Brown

  • Blocking 8560 added

(In #8560) Added blocking tickets as they need to be pushed to master before I can finish this ticket as I'll need to merge them in.

comment:10 Changed 7 years ago by Keith Brown

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

comment:11 Changed 7 years ago by Keith Brown

Refs #8532. Merge remote-tracking branch 'origin' into feature/8532_Refl_gui_Save_check_and_Autosave

Changeset: 138cdb7f17443c59d2d49e578c2f80aaadd07ff5

comment:12 Changed 7 years ago by Keith Brown

Refs #8532. removed unneeded print

Changeset: b130cacc5bd91363f4d10ba13dbb5d89c2c7af95

comment:13 Changed 7 years ago by Keith Brown

  • Tester set to Owen Arnold

comment:14 Changed 7 years ago by Owen Arnold

  • Status changed from verify to verifying

comment:15 Changed 7 years ago by Owen Arnold

  • Status changed from verifying to closed

Merge remote-tracking branch 'origin/feature/8532_Refl_gui_Save_check_and_Autosave'

Full changeset: 175a4dd971281ab759e71a4c4bcd9c729da55a0b

comment:16 Changed 7 years ago by Owen Arnold

This is great. Works exactly as I would expect.

comment:17 Changed 5 years ago by Stuart Campbell

This ticket has been transferred to github issue 9376

Note: See TracTickets for help on using tickets.