On Fri, Sep 24, 2010 at 11:52 AM, Peter <peter@maubp.freeserve.co.uk> wrote:
On Wed, Sep 22, 2010 at 10:03 AM, Peter <peter@maubp.freeserve.co.uk> wrote:
I thought it would be more intuitive if these used the checkbox support, "Show advanced options: tick here", rather than a drop down with two choices.
...
I suspect that part of the problem is in lib/galaxy/tools/parameters/basic.py that the class BooleanToolParameter method get_initial_value returns a boolean (True/False) and not a string (the value given in the XML file, in my example "advanced" or "basic") like the other parameter classes. This change made some difference, but is not enough in itself (and I fear has side effects):
--- a/lib/galaxy/tools/parameters/basic.py Fri Sep 24 10:38:45 2010 +0100 +++ b/lib/galaxy/tools/parameters/basic.py Fri Sep 24 11:42:38 2010 +0100 @@ -283,7 +283,10 @@ def to_python( self, value, app ): return ( value == 'True' ) def get_initial_value( self, trans, context ): - return self.checked + if self.checked: + return self.truevalue + else: + return self.falsevalue def to_param_dict_string( self, value, other_values={} ): if value: return self.truevalue
Should <conditional> work with a checkbox (boolean) parameter?
I think the answer to my question is no one has every tried, because there are several things broken or not implemented here. First, I think that <conditional> get_current_case method currently only works with parameters where get_initial_value returns strings. This prevents it working on check boxes (booleans), and I assume also numbers (integer and float paramters). Second, the refresh_on_change="true" is only added to the HTML for select parameters (comboboxes/radio boxes), and not to checkboxes. The attached patch tackles the above two issues - but given the remaining problem I don't expect it to be committed as is. Third, having made sure refresh_on_change="true" is added to the HTML for checkboxes with dependencies, the refresh does not happen. This may be a JavaScript limitation? I've had a look at static/scripts/galaxy.base.js but it seems to only look for changes in comboboxes (?). I think a whole new JS function is needed to watch changes to checkboxes with the refresh_on_change="true" attribute. Am I on the right track? Would one of the main developers (who knows JavaScript) be able to make this work? Thanks, Peter