Editing 3-D array using Tabular Editor

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Editing 3-D array using Tabular Editor

ameya chougule
Hiii

I am developing an application which have number of 3-D array of form [50][50][3] (50 by 50 grids in 3 layers).
I am editing them using Tabular Editor as 2D array. I am using 3rd dimension as Enumeration list to toggle 50 by 50 grid layers. this is roughly:

grid_x = grid_y = 50
grid_layer = 3
layers = [ '%d' (i+1) for i in range(grid_layer) ]
layer_no = Int(1)

array_3d[grid_x][grid_y][grid_layer]

view = View( Item('layer_no', label = 'layer', editor= Enumeditor('layers'),
                   Item('array_2d', editor  = tabular_editor())

now for the array_2d i tried two options:
1. made it as Property which will depend on value of layer_no and hence equal to array_3d[layer_no]. Along with this I am using method layer_no_changed in which I update my 3d array using value of array_2d,
array_3d[layer_no_old] = array_2d:
but this has the problem that array_2d being on right hand side it calls 'get_array_2d' method and hence new value of it get assigned to array_3d[layer_no_old] which is wrong.

2. Initialized it as array_2d= array_3d[0] and then in method 'layer_no_changed' update both the arrays:
array_3d[layer_no_old] = array_2d and then
array2_d = array_3d[layer_no_new],
but using this approach, array_2d not get updated in view.

Is there any solution on this?
or I have to use different editor: for TableEditor I don't know how to represent 2d array as its for List(class instance) and for ArrayViewEditor there is no attribute to make its elements editable. In either case, above two problems may come into picture.

Also, please tell the way to edit multiple cells of 2_d array in above.

Thank you
Take care

regards,
ameya
 

_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev