enamlx
enamlx copied to clipboard
TableView doesn't handle Conditional, Container, or multiple widgets
If I put a Container inside a TableViewItem, then the resulting cell is empty and just displays a white background.
TableViewItem:
Container:
Label:
text << model.imodels[partition.substitution_model].name if not partition.fixed_alignment else 'none'
I tried putting two Label items inside the TableView, and in that case it displayed the second Label.
I trued putting two Conditionals inside the TableView, with opposite conditions, so that only only condition is true at a time, and it starts by displaying the first Conditional, but when I toggle the condition, I just get an empty cell:
TableViewItem:
Conditional:
condition << row >=0 and row < len(table.items) and not partition.fixed_alignment
Label:
text << model.imodels[partition.substitution_model].name if not partition.fixed_alignment else 'none'
Conditional:
condition << row >=0 and row < len(table.items) and partition.fixed_alignment
Label:
text << 'none'
double_clicked :: print("Double clicked %s"%partition.indel_model)
selected :: print("Selection %s is now %s"%(partition.indel_model,change['value']))
Is there a reason for not just using the TableViewItem's text
?
Yeah, I want to replace one of the Labels with a ComboBox, so that we see "none" if the condition is true, and a ComboBox otherwise. The above code is more like a reduced test case.
In other cases, I want to implement something where the cell is normally text, but when you double-click you get a ComboBox to select the item, after which it reverts to text. it might be possible to implement this via Menu instead though.