Sat 19 Jan 2013 06:46:44 PM UTC, comment #7:
Fixed in commit 877b93c
Tables can now be edited from inside an InputDialog. See the following example
giving the following output after changing the entries in the first column to '1'.
Note
- You have to use the itemtype='widget' syntax to get the results of the table back in the dialog results.
- The result is an array for the ArrayModel, and a list for
the TableModel.
- TableModel can have per row or per column different type.
- Default TableModel type is str.
- The possibility of adding a plain widget to the dialog items
is intended for widgets that just display information or that aid in the working of other input fields. They can not return a value, as they do not even have a key (name).
I leave this bug open for a while, in case some problems arise with the new functionality.
|
Thu 17 Jan 2013 09:18:11 AM UTC, comment #6:
For the nested results: consider this example:
def run2():
"""Table widget in InputDialog"""
dataTable = np.arange(40).reshape((-1, 2)).tolist()
# print(dataTable)
table = widgets.Table(dataTable, label='table',chead=[1, 2], edit=True)
input_data = [
dict(name='bla',value=None,text="A constant info field",itemtype='info'),
_I('clist',['First','Third'],text="itemtype 'list' with check=True",itemtype='list',choices=['First','Second','Third','Fourth'],check=True),
table
]
dialog = widgets.InputDialog(input_data, autoprefix=True,caption='InputDialog',modal=True)
print dialog.getResult()
print table.tm.arraydata
The getResults() will only output [('bla', None), ('clist', ['First', 'Third'])], while we also want the table.tm.arraydata in the results I imagine!
I have not found a way to fix this without breaking something else.
|