Brennan Williams | 1 Jan 04:00
Gravatar

Re: upgrading Traits etc.

Looks like the latest version of Traits doesn't like a TreeEditor being 
used on an object that hasn't been defined yet,
i.e. I have a "project" object which has its hierarchy of child objects 
that I want to show in the tree, each with its own view
definition for the RHS panel. But if 'project' is null then no view 
window is displayed. If it is defined then things seem to work
ok although I still have a problem with an ArrayViewEditor error about 
not having a border_size attribute.

I'm also still getting the deprecation
warning...

C:\Python25\lib\site-packages\traitsbackendwx-3.0.4.dev_r22772-py2.5.egg\enthought\traits\ui\wx\editor_factory.py:54: 
DeprecationWarning: DEPRECATED: Use 
enthought.traits.ui.editory_factor..EditorFactory instead.

I've attached a little testtree.py which is modified from someone else's 
earlier posting about using tree editors.
If I make the

#    proj=Project('myproject',session)

line down the bottom active then the view window appears, if it is 
commented out (and therefore proj is null) then there
is no window. Hopefully this may help.

Brennan

Brennan Williams wrote:
> Vibha Srinivasan wrote:
(Continue reading)

Brennan Williams | 1 Jan 04:50
Gravatar

Re: upgrading Traits etc.

forgot the attachment...

Brennan Williams wrote:
> Looks like the latest version of Traits doesn't like a TreeEditor being 
> used on an object that hasn't been defined yet,
> i.e. I have a "project" object which has its hierarchy of child objects 
> that I want to show in the tree, each with its own view
> definition for the RHS panel. But if 'project' is null then no view 
> window is displayed. If it is defined then things seem to work
> ok although I still have a problem with an ArrayViewEditor error about 
> not having a border_size attribute.
>
> I'm also still getting the deprecation warning...
>
>
C:\Python25\lib\site-packages\traitsbackendwx-3.0.4.dev_r22772-py2.5.egg\enthought\traits\ui\wx\editor_factory.py:54: 
> DeprecationWarning: DEPRECATED: Use 
> enthought.traits.ui.editory_factor..EditorFactory instead.
>
> I've attached a little testtree.py which is modified from someone else's 
> earlier posting about using tree editors.
> If I make the
>
> #    proj=Project('myproject',session)
>
> line down the bottom active then the view window appears, if it is 
> commented out (and therefore proj is null) then there
> is no window. Hopefully this may help.
>
> Brennan
(Continue reading)

Sandy Wilson | 2 Jan 03:08

Changing data graphically in mayavi2

I've been trying to find in the documentation a way of changing the data
of parts of a 3D visualization in mayavi2.  Specifically, suppose I've written
a script that is launched from within mayavi2 that creates a triangular mesh
viz

hfig = mlab.triangular_mesh( x, y, z, tris, representation = 'wireframe' )

where x, y, and z define the vertex vectors and tris is the required array 
of triangle
indices into the x, y, and z arrays.  Is there a way of using a filter or 
module that
allows a user to select graphically parts of the resulting mesh and move or 
scale them and have
those changes be reflected in the underlying data so the changes can be 
read back
out again in another part of the script?

Thanks,

Sandy
Gael Varoquaux | 2 Jan 12:18
Favicon
Gravatar

Re: Changing data graphically in mayavi2

On Thu, Jan 01, 2009 at 08:08:54PM -0600, Sandy Wilson wrote:
> I've been trying to find in the documentation a way of changing the data
> of parts of a 3D visualization in mayavi2.  Specifically, suppose I've written
> a script that is launched from within mayavi2 that creates a triangular mesh
> viz

> hfig = mlab.triangular_mesh( x, y, z, tris, representation = 'wireframe' )

> where x, y, and z define the vertex vectors and tris is the required
> array of triangle indices into the x, y, and z arrays.  Is there a way
> of using a filter or module that allows a user to select graphically
> parts of the resulting mesh and move or scale them and have those
> changes be reflected in the underlying data so the changes can be read
> back out again in another part of the script?

I am sorry, I don't believe this is possible (I may be wrong, and there
might be a VTK filter that does that, but I do not know about it).

The closest thing in Mayavi would be to use the picker to identify which
point you want to modify, and then modifying the data corresponding to
this point. Tedious! Things could be made easier by adding to the picker
some code to directly modify the coordinnates. I don't have time to do it
right now, but you are welcomed to have a go at it.

The best soft that I know to edit meshes is blender. You can save your
data to VTK files (for instance by right-clicking on the pipeline, and
choose 'save output to file'). There is on the net a blender script to
import VTK data in blender. You could then use blender to modify the
data.

(Continue reading)

Sandy Wilson | 2 Jan 17:12

Re: Changing data graphically in mayavi2

Hi Gael,

Thanks for the reply and confirming what I had suspected.  My back-up plan
was exactly what you indicated; creating a dialog where users obtain the vertex
Ids with the picker and enter them into an edit box, then enter x, y, and z 
offsets
and clicking a Move button to implement the changes into the points array.
I'll see how that works first and then try the blender option if it seems 
too clunky.

Thanks,

Sandy

At 05:18 AM 1/2/2009, you wrote:
>On Thu, Jan 01, 2009 at 08:08:54PM -0600, Sandy Wilson wrote:
> > I've been trying to find in the documentation a way of changing the data
> > of parts of a 3D visualization in mayavi2.  Specifically, suppose I've 
> written
> > a script that is launched from within mayavi2 that creates a triangular 
> mesh
> > viz
>
> > hfig = mlab.triangular_mesh( x, y, z, tris, representation = 'wireframe' )
>
> > where x, y, and z define the vertex vectors and tris is the required
> > array of triangle indices into the x, y, and z arrays.  Is there a way
> > of using a filter or module that allows a user to select graphically
> > parts of the resulting mesh and move or scale them and have those
> > changes be reflected in the underlying data so the changes can be read
(Continue reading)

Jed Frechette | 2 Jan 18:43
Picon

Re: Changing data graphically in mayavi2

On Fri, 02 Jan 2009 09:12:33 -0700, Sandy Wilson  
<sanford.wilson@...> wrote:

...
> I'll see how that works first and then try the blender option if it seems
> too clunky.
...

You might want to take a look at MeshLab as well, especially if your mesh  
is large. Altough I don't think it will work with VTK files directly.

Best,

--

-- 
Jed Frechette

University of New Mexico Lidar Lab
www.unm.edu/~lidar
Brennan Williams | 3 Jan 04:41
Gravatar

ArrayViewEditor in Traits 3.0.4

While upgrading to the latest Traits trunk etc I'm running into a 
problem with ArrayViewEditor.

I mentioned this in my recent "upgrading Traits etc" posting and I know 
most of you are still on holiday (Happy New Year btw)
but I thought I'd clarify what I've found so far...

the problem seems to occur in ui_panel.py with _ArrayVieweditor not 
having a border_size or layout_style attribute.
These two attributes are set up in editors.py.
There is also an editors_gen.py which   generates editor definitions.

 From array_view_editor.py and ui_editor.py it looks as though 
ArrayViewEditor is based on UIEditor which in turn is based on Editor so 
in theory
ArrayViewEditor should pick up the border_size and layout_style attributes.

Brennan
Gael Varoquaux | 4 Jan 23:11
Favicon
Gravatar

Re: Traits question on setting and sharing a global - Solved! (mostly)

Hi Alan,

I had seen this post a while ago, with no to to answer, eventhought I
thought I could help. Looks like the holidays do not even give me more
time, they just allow me to focus on other things. So here we go for a
quick answer...

On Mon, Dec 22, 2008 at 03:33:21PM -0600, Alan Jackson wrote:
> why when I tried using G=Instance(Globals) instead of G=Globals(), as the
> documentation implied, that failed,

If you use "G=Globals()", G is not registered as a Traits by the
metaclass constructor (on a side note, november's edition of the Python
Magazine had a noce article on metaclasses, with code examples that
really shed some light on how Traits work).

> and I'm not clear on why from MainUI I have to DelegateTo SetUnits, and
> why DelegateTo Globals fails.

I am not sure what you mean by this, but if I get it right, you haven't
groked well the signature of 'DelegateTo': by default, 'DelegateTo' takes
the name of the object that hold the traits you want to delegate to, and
the name of the trait on this object is assumed to be the same as the
name of trait you are setting as a delegation. I am not sure I am
terribly clear here :).

Happy new year,

Gaël
(Continue reading)

Gael Varoquaux | 4 Jan 23:15
Favicon
Gravatar

Re: TableEditor and scrollbars

On Wed, Dec 31, 2008 at 03:44:28PM -0600, Alan Jackson wrote:
> I am really close to having a nice little application done I can post as
> an example (Google turns up far too few traits examples), but I have one
> little issue to fix still. I create a table using TableEditor, and start it
> out empty. I add rows until the vertical space is full, and no scrollbar
> magically appears. What do I need to do to get a scrollbar?

AFAIK this is a long-lasting bug in scrollbar-management with wxPython.
If I understood things well (and chances are I didn't), wxPython has its
own logics for adding scrollbars, and doesn't make it easy to control,
especially since the layout and refresh code is slightly incompatible
between versions. Some progress was made on this side this summer, but
things are still clearly not ideal. The only suggestion I can have is to
dig in the traits code deeply and see if you can find some modifications
that make you dialog work properly. Send these to the mailing list, and
the traits maintainers will probably look at them to see if they can be
generalized to other dialogs.

Hopefully I am wrong, and it is a trivial problem in your code :).

Gaël
Alan Jackson | 5 Jan 04:40

Re: TableEditor and scrollbars

On Sun, 4 Jan 2009 23:15:47 +0100
Gael Varoquaux <gael.varoquaux@...> wrote:

> On Wed, Dec 31, 2008 at 03:44:28PM -0600, Alan Jackson wrote:
> > I am really close to having a nice little application done I can post as
> > an example (Google turns up far too few traits examples), but I have one
> > little issue to fix still. I create a table using TableEditor, and start it
> > out empty. I add rows until the vertical space is full, and no scrollbar
> > magically appears. What do I need to do to get a scrollbar?
> 
> AFAIK this is a long-lasting bug in scrollbar-management with wxPython.
> If I understood things well (and chances are I didn't), wxPython has its
> own logics for adding scrollbars, and doesn't make it easy to control,
> especially since the layout and refresh code is slightly incompatible
> between versions. Some progress was made on this side this summer, but
> things are still clearly not ideal. The only suggestion I can have is to
> dig in the traits code deeply and see if you can find some modifications
> that make you dialog work properly. Send these to the mailing list, and
> the traits maintainers will probably look at them to see if they can be
> generalized to other dialogs.
> 
> Hopefully I am wrong, and it is a trivial problem in your code :).

After playing with it for a bit, I think you are correct. 8-(

--

-- 
-----------------------------------------------------------------------
| Alan K. Jackson            | To see a World in a Grain of Sand      |
| alan@...          | And a Heaven in a Wild Flower,         |
| www.ajackson.org           | Hold Infinity in the palm of your hand |
(Continue reading)


Gmane