Ticket #10348 (closed: fixed)

Opened 6 years ago

Last modified 5 years ago

Options auto complete.

Reported by: Owen Arnold Owned by: Harry Jeffery
Priority: major Milestone: Release 3.3
Component: Reflectometry Keywords:
Cc: Blocked By:
Blocking: #10408 Tester: Owen Arnold

Description

The new reflgui has an Options column, which the users like. These are keyed to the parameters for the ReflectometryReductionOneAuto algorithm.

Users will need help, as they type, figuring out what Property names are available, and helping with autocomplete etc. The ideal scenario would be for these to autocomplete upon typing. Interactive python is a good example of the desired behaviour here. In any case, the users should have access to the properties that are valid for the algorithm.

The options should dynamically create the available names if possible. No hard-coded lists, since the algorithm properties may change.

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

Refs #10348 Align options column to the left

Changeset: 153e0963f059c3c90b9cfbca6e1ceb191ca8a94f

comment:4 Changed 6 years ago by Harry Jeffery

Refs #10348 Delegate options column

Changeset: e82ebfdcd648aaa478ae6563d6cc3bed795c1ec2

comment:5 Changed 6 years ago by Harry Jeffery

Refs #10348 Stub HintingLineEdit

Changeset: ba3032e4d1ac8abe35ea94692515ca671b137ed3

comment:6 Changed 6 years ago by Harry Jeffery

Refs #10348 Use properties for hints

Changeset: d6137c24a68fda4d4d1e9aabe191b45bfafb573c

comment:7 Changed 6 years ago by Harry Jeffery

Refs #10348 Rudimentary hint tooltips

Changeset: 89f3a413c6efd8c0191c62616c1a70e27a7a6d19

comment:8 Changed 6 years ago by Harry Jeffery

Refs #10348 Implement autocompletion

Changeset: 9a5fba2b9344741755abc7a8f9b8b78b639a0647

comment:9 Changed 6 years ago by Harry Jeffery

Refs #10348 Blacklist uninteresting properties

Changeset: 9ff5789b906e0570619b61c23d9b1bdff576e3b3

comment:10 Changed 6 years ago by Harry Jeffery

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

Testing

  • Start typing options into the options column and play with the auto completion
  • Check the behaviour is intuitive and the information is accurate
  • Review code

comment:11 Changed 6 years ago by Owen Arnold

I accept that the QMainView creates the new Presenter object, but it's now also choosing what style of autocomplete to create. Futhermore, this application logic of how the hints are parsed is completely untested because it's blocked out inside ReflOptionsDelegate.

My initial thoughts on the work here are that. ReflMainViewPresenter should provide the autocomplete QStyledItemDelegate and set it on the view. However, this is going to make the mocking messy. I think that a better option would be to have a generic form of the QStyledItemDelegate into which you can pass a Strategy object from the presenter.

class AlgorithmHintStrategy {

public:

AlgorithmHintStrategy(IAlgorithm*, std::vector<std::string> blackList) {

} virtual std::map<std::string, std::string> createHints() {

Current code from the ReflOptionsDelegate.

}

};

Now this is possible! class TestAlgorithmHintStrategy : public CxxTest::TestSuite {

.....

};

class HintingEditorFactory : public QStyledItemDelegate {

public:

HintingEditorFactory(AlgorithmHintStrategy* hintStrategy) { }

virtual QWidget* createEditor(QWidget* parent, const QStyleOptionViewItem& option, const QModelIndex& index) const {

Q_UNUSED(option); Q_UNUSED(index);

auto editor = new HintingLineEdit(parent, m_hitStrategy->createHints()); editor->setFrame(false); return editor;

}

};

class ReflMainView {

.... virtual void setHintingStrategy(AlgorithmHintStrategy* hintingStrategy) = 0;

};

class ReflMainViewPresenter {

ReflMainViewPresenter() {

...... create blacklist create algorithm m_view->setHintingStrategy(new AlgorithmHintStrategy(alg, blacklist) );

}

};

With this slightly altered design, you get TESTABILITY, DEPENDENCY INJECTION, and the ability to COLOCATE all ReflectometryReductionOneAuto algorithm properties.

comment:12 Changed 6 years ago by Harry Jeffery

Refs #10348 Refactor hint map creation

Changeset: cfb22f50b246d6e3b3d662836fc40a96e857b1b4

comment:13 Changed 6 years ago by Harry Jeffery

Refs #10348 Remove obsolete comment

Changeset: 9158daa74ea43635651c8e4eba9ad4719f23c532

comment:14 Changed 6 years ago by Harry Jeffery

Refs #10348 Allow user to cycle through suggestions

Up/Down arrow keys allow the user to switch between the available suggestions rapidly.

Changeset: 47f2b704dbdc8817f027625252cf9e0d24460195

comment:15 Changed 6 years ago by Harry Jeffery

  • Status changed from verify to reopened
  • Resolution fixed deleted

Re-opening to take the opportunity to tidy up a little.

comment:16 Changed 6 years ago by Harry Jeffery

Refs #10348 Tidy up HintingLineEdit

  • Reorder and rename some methods for clarity
  • Improve commenting

Changeset: bbc9bd655ad5522a16982696d10cf8f26d7738f9

comment:17 Changed 6 years ago by Harry Jeffery

Refs #10348 Add copyright headers and doxygen comments

Changeset: aa64548b4fb656b1ffccb93c7758ca852fe4b578

comment:18 Changed 6 years ago by Harry Jeffery

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

Testing

See comment 10 + changing autocompletion suggestion with the up/down arrow keys

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

comment:19 Changed 6 years ago by Owen Arnold

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

comment:20 Changed 6 years ago by Owen Arnold

  • Status changed from verifying to closed

Merge remote-tracking branch 'origin/feature/10348_options_auto_complete'

Full changeset: 681a586f18a79c5aefe53dc6c88017da41e5b848

comment:21 Changed 6 years ago by Owen Arnold

  • Blocking 10408 added

comment:22 Changed 5 years ago by Stuart Campbell

This ticket has been transferred to github issue 11190

Note: See TracTickets for help on using tickets.