Ticket #8086 (closed: fixed)

Opened 7 years ago

Last modified 5 years ago

Default values not displayed in comboboxes

Reported by: Martyn Gigg Owned by: Martyn Gigg
Priority: critical Milestone: Release 3.0
Component: GUI Keywords:
Cc: Blocked By:
Blocking: Tester: Owen Arnold

Description

The following algorithm should generate a ComboBox on the algorithm dialog with "B" set as the default but it shows "A"

from mantid.kernel import *
from mantid.api import *

class PyAlg(PythonAlgorithm):
        
        def PyInit(self):
                self.declareProperty('Multiplier', 'B', StringListValidator(['A','B']), direction=Direction.Input, doc='Select the form of the invariant to calculate')
                
        def PyExec(self):
                pass
                
AlgorithmFactory.subscribe(PyAlg)

A related bug can be seen by using LoadRaw. This requires your old algorithm history to be deleted ($HOME/.config/Mantid/MantidPlot.conf on Linux, registry HKCU/Software/Mantid/MantidPlot on Windows). Click Load and navigate to a raw file. The "LoadMonitors" option should be set to Include by default, to match the algorithm, however Exclude is displayed.

This was reported by Steve King when trying to write a new Python algorithm.

Change History

comment:1 Changed 7 years ago by Martyn Gigg

  • Status changed from new to inprogress

Fix generation of ComboBox on GenericDialog.

  • The current value from the property needs to be set visible.
  • The signal connection needs to come after the box is populated or

it keeps changing the property value as things are added in the loop

Refs #8086

Changeset: 60d3df4c5a05dac6c65638ca66f94fd5e37b593f

comment:2 Changed 7 years ago by Martyn Gigg

Fix defaults for boolean options property dialog in LoadDialog.

Refs #8086

Changeset: 230490c8f3a54f177e9dc08fdbf12a52ed4461af

comment:3 Changed 7 years ago by Martyn Gigg

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

Branch: bugfix/8086_alg_combobox_defaults

Tester: Use the instructions in the description to test the ComboBox options on a generic dialog & Load dialog separately. For the Load dialog test be sure to clear you cache of old algorithm histories first'''.

For both tests check that once set the property is remembered next time the algorithm is run.

comment:4 Changed 7 years ago by Martyn Gigg

  • Milestone changed from Backlog to Release 3.0

comment:5 Changed 7 years ago by Owen Arnold

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

comment:6 Changed 7 years ago by Owen Arnold

This is indeed a problem in older version of Mantid.

comment:7 Changed 7 years ago by Owen Arnold

This is now fixed. Code review looks good. I'm going to have to hold off merging this to master as can't connect to github at the moment. Hopefully will be able to do this this afternoon.

comment:8 Changed 7 years ago by Owen Arnold

  • Status changed from verifying to closed

Merge remote-tracking branch 'origin/bugfix/8086_alg_combobox_defaults'

Full changeset: 51378f50da4b9f1595cc81c5a2d6caf39d6aae26

comment:9 Changed 5 years ago by Stuart Campbell

This ticket has been transferred to github issue 8931

Note: See TracTickets for help on using tickets.