Opened 18 months ago
Closed 18 months ago
#15151 closed defect (fixed)
In CmdDescs, Or(TupleOf(IntArg, 3), TupleOf(IntArg, 2)) only admits the first form
| Reported by: | Zach Pearson | Owned by: | Greg Couch |
|---|---|---|---|
| Priority: | moderate | Milestone: | 1.9 |
| Component: | Command Line | Version: | |
| Keywords: | Cc: | Tom Goddard | |
| Blocked By: | Blocking: | ||
| Notify when closed: | Platform: | all | |
| Project: | ChimeraX |
Description
Even when reversed, this Or will only accept whichever TupleArg comes first. I was trying to add a consolidated 'center' parameter to the segmentations command. The center an either be the x,y coordinates of a point on a 2D slice or a 3D coordinate.
Change History (3)
comment:1 by , 18 months ago
| Cc: | added |
|---|---|
| Milestone: | → 1.9 |
| Owner: | set to |
| Status: | new → assigned |
| Summary: | In CmdDescs, Or(TupleArg(IntArg, 3), TupleArg(IntArg, 2)) only admits the first form → In CmdDescs, Or(TupleOf(IntArg, 3), TupleOf(IntArg, 2)) only admits the first form |
comment:2 by , 18 months ago
| Status: | assigned → accepted |
|---|
Reproduce with:
from chimerax.core.commands import TupleOf, IntArg, Or
arg = Or(TupleOf(IntArg, 3), TupleOf(IntArg, 2))
arg.parse("1, 2, 3", session) # works
arg.parse("1, 2", session) # fails
comment:3 by , 18 months ago
| Resolution: | → fixed |
|---|---|
| Status: | accepted → closed |
The offset logic was the problem. Revise to use offset of the longest subparse if none succeed.
Note:
See TracTickets
for help on using tickets.
It looks like that because Aggregate (which TupleOf inherits from) sets its 'offset' attribute, Or does not try the second alternative.