enthought / ensemble

High-level widgets for building Python applications
Other
4 stars 7 forks source link

Color Transfer Function editor #1

Closed jwiggins closed 10 years ago

jwiggins commented 10 years ago

(moving from enthought/enable#124)

This big chunk of code implements a CTF editor for creating/editing functions which map from some data space to RGBA values. I'm using it for a volume rendering viewer, but it could also be used for creating a colormap for an image plot.

jwiggins commented 10 years ago

@rkern: I went ahead and created the project...

rkern commented 10 years ago

None of the following are merge-blockers, just suggestions for future development.

On OS X, I found it impossible to change the leftmost opacity node because the example has the CtfEditor as the only widget in the window. The window resize function always took priority. If the example put a bit of a margin between the widget and the border of the window, I'm sure I could get at it.

More generally, it would be good to have some more feedback as you hover over things that can be manipulated. For example a <-> cursor when hovered over a color node. It should also be highlighted. Remove Node and Edit Color should not be enabled in the menu if the mouse was not over a removable node or a color node, respectively.

I would probably not have the load and save functionality exposed in the context menu. That should be up to whoever is embedding this widget. Typically, this would be done by buttons and drop-downs ("Most Recent" or "Favorites", etc.) next to the widget, not context menus.

Undo/redo would be really useful here. @cfarrow has some experience that you can draw on.

cfarrow commented 10 years ago

I've been looking for an excuse for porting the undo/redo helpers we created for a consulting project to our tool stack. :)

Those helpers, however, were designed for HasTraits classes, so may not be the best option here. In any case, +1 to undo/redo.

cfarrow commented 10 years ago

I take that back. It would be appropriate and not difficult to add the undo/redo functionality to the tools, which are HasTraits classes, with the proper helpers.

jwiggins commented 10 years ago

That should work a bit better now @rkern. I like your UI suggestions but I don't want to cover them in this PR since this is already quite a chunk of code.

@cfarrow: Don't be shy about adding undo/redo if you can find the time. My next PR for this project is the volume rendering stuff that I showed you late last year...