Chris Colbert | 1 Oct 11:49
Picon
Gravatar

TraitsUI Handler Question

Is it possible to use the @on_trait_change decorator in a custom view Handler?

I have several buttons that I want to bind to a common method instead
of always making an object_whatever_button_changed() method for each
button.

Cheers!

Chris
Thorsten Kranz | 1 Oct 11:54

Re: TabularEditor reacting to doubleclick and pressing enter

Thank you, Bryce, for your reaction, but somehow the "activated"
attribute doesn'T work for me. I adapted your example for my own code
and still it doesn't work. But, the "activated_row" property does
work. Therefore I can reach my goals, and when I have more sparse
time, I'll go ahead and see what goes wrong with "activated".

Thanks again for your help,

Thorsten

2009/9/29 bryce hendrix <bhendrix@...>:
> Thorsten Kranz wrote:
>> Hi,
>>
>> I have a question concerning the behaviour of the TabularEditor
>> Widget. I'd like to know how to implement some callback for when the
>> user presses enter or performs a doubleclick on one of the elements.
>> >From the API reference at
>>
>> http://code.enthought.com/projects/files/ETS32_API/enthought.traits.ui.editors.tabular_editor.TabularEditor.html
>>
>> I can see the attributes
>>
>> """
>> activated
>>
>> The optional extended name of the trait to synchronize the activated value with:
>>
>> activated = Str
>> """
(Continue reading)

bryce hendrix | 1 Oct 16:11

Re: TraitsUI Handler Question

Its possible if you use the controller instead, which has a model attribute:

    @on_trait_change('model.button1, model.button2, model.button3')
    def _a_button_was_pressed(self, obj, name, old, new):
        print "a button was pressed"

Bryce

Chris Colbert wrote:
> Is it possible to use the @on_trait_change decorator in a custom view Handler?
>
> I have several buttons that I want to bind to a common method instead
> of always making an object_whatever_button_changed() method for each
> button.
>
> Cheers!
>
> Chris
> _______________________________________________
> Enthought-Dev mailing list
> Enthought-Dev@...
> https://mail.enthought.com/mailman/listinfo/enthought-dev
>   
Picon
Gravatar

Re: MayaVI on sage

Dear Chu-Ching Huang,

On Thursday 01 October 2009 01:12 PM, chu-ching huang wrote:
> I tried to installed Mayavi in Sage as your notes on official site. Here my
> environment:
> 
> 1. VTK-5.5 cvs with offscreen and GL2PS enabled
> 2. MayaVI-svn( 3.3.1)
> 3. numpy-1.4 svn
> 4. Slax linux-6.2

One option to get this working easier is to use femhub which works
nicely on linux and hopefully sometime soon win32 and mac osx will also
work.  femhub is here:

 http://femhub.org/

> MayaVI can work on Sage. But there is a problem about the picture generated.
> If a picture was created and savefig("t1.png"), it will be shown in Sage. But
> if there is another the picture created by savefig("t2.png"), then the latter
> will be overlapped with the previous one as attached. Why?

Can you send the exact code you used for this?  My guess is you didn't
do a mlab.clf() after the first plot and therefore t2.png has both
visualizations!

> Another problem is about GL2PS, Even the vtk "gl2ps" option enabled, mayavi
> always warning that gl2ps does not work. I use gl2ps-1.3.2.

Hmm, that is interesting.  A full description of the error messages
(Continue reading)

Uche Mennel | 1 Oct 17:09
Picon

MayaVI bug in changing visible trait of pipeline_base objects

Hi

The bug is pretty obvious. I am wondering why it has not been discovered 
so far ...

Exception occurred in traits notification handler for object: 
<even.scene.modules.text.Text object at 0x000000000FEE29E8>, trait: 
visible, old value: False, new value: True
Traceback (most recent call last):
   File

"c:\even\umennel\acm_kernel\gui\python\traits-3.1.1-py2.6-win-amd64.egg\enthought\traits\trait_notifiers.py", 
line 353, in call_2
     self.handler( object, new )
   File

"c:\even\umennel\acm_kernel\gui\python\mayavi-3.2.0-py2.6-win-amd64.egg\enthought\mayavi\core\module.py", 
line 237, in _visible_changed
     super(Module,self)._visible_changed(value)
   File

"c:\even\umennel\acm_kernel\gui\python\mayavi-3.2.0-py2.6-win-amd64.egg\enthought\mayavi\core\pipeline_base.py", 
line 223, in _visible_changed
     self._restore_widget_state()
   File

"c:\even\umennel\acm_kernel\gui\python\mayavi-3.2.0-py2.6-win-amd64.egg\enthought\mayavi\core\pipeline_base.py", 
line 214, in _restore_widget_state
     w.enable = True
TraitError: Cannot set the undefined 'enable' attribute of a 
(Continue reading)

Picon
Gravatar

[ANN] SciPy India conference in Dec. 2009

Greetings,

The first "Scientific Computing with Python" conference in India
(http://scipy.in) will be held from December 12th to 17th, 2009 at the
Technopark in Trivandrum, Kerala, India (http://www.technopark.org/).

The theme of the conference will be "Scientific Python in Action" with
respect to application and teaching.  We are pleased to have Travis
Oliphant, the creator and lead developer of numpy
(http://numpy.scipy.org) as the keynote speaker.

Here is a rough schedule of the conference:

     Sat.    Dec. 12  (conference)
     Sun.    Dec. 13  (conference)
     Mon.    Dec. 14  (tutorials)
     Tues.   Dec. 15  (tutorials)
     Wed.    Dec. 16  (sprint)
     Thu.    Dec. 17  (sprint)

The tutorial sessions will have two tracks, one specifically for
teachers and one for the general public.

There are no registration fees.

Please register at:

         http://scipy.in

The call for papers will be announced soon.
(Continue reading)

Brad Buran | 2 Oct 00:08
Picon
Favicon

problem with enabled_when and Traits UI

In the following example, I am having trouble with getting enabled_when to work for nested objects.  When b is set to 1, a is disabled as expected; however, when object.c.y is set to 1, object.c.x. is not disabled.

Am I using the wrong syntax?

Thanks!
Brad

_______________________________________________
Enthought-Dev mailing list
Enthought-Dev@...
https://mail.enthought.com/mailman/listinfo/enthought-dev
Brad Buran | 2 Oct 00:09
Picon
Favicon

Re: problem with enabled_when and Traits UI

Apologies, here is the example code:

from enthought.traits.api import *
from enthought.traits.ui.api import *

class Bar(HasTraits):

    x = Int
    y = Int

class Foo(HasTraits):

    a = Int
    b = Int
    c = Instance(Bar)

foo_view = View(
        VGroup(
            Item('a'),
            Item('b', enabled_when='a==1'), #WORKS
            Item('object.c.x', enabled_when='object.c.y==1'), #DOES NOT WORK
            Item('object.c.y'),
            ),
        resizable=True,
        )

if __name__ == '__main__':
    obj = Foo(c=Bar())
    obj.configure_traits(view=foo_

view)


On Thu, Oct 1, 2009 at 5:08 PM, Brad Buran <bburan-sFd2o/pSuJqVc3sceRu5cw@public.gmane.org> wrote:
In the following example, I am having trouble with getting enabled_when to work for nested objects.  When b is set to 1, a is disabled as expected; however, when object.c.y is set to 1, object.c.x. is not disabled.

Am I using the wrong syntax?

Thanks!
Brad

_______________________________________________
Enthought-Dev mailing list
Enthought-Dev@...
https://mail.enthought.com/mailman/listinfo/enthought-dev
Ju Zhang | 2 Oct 01:09
Picon
Picon
Favicon

Updating Range

Hi,

I have a Range trait that I want to update during __init__(). Specifically, I want to up set the high attribute of the Range object. The code below demonstrates how I've envisioned the problem.

class slice_viewer(HasTraits):
    image = Array
    slice_range = Property( Range( 0, 100 ), depends_on=['image'] )
    ...
    def __init__(self, inputImage):
        self.image = inputImage
        ....
    def _get_slice_range(self):
        """ somehow change the _high attribute in slice_range to be (self.image.shape[0] - 1)
        """"
        return ?

Can someone please shed some light on how this should be done? I tried declaring slice_range._high = Property(Int, depends_on['image']) as an alternative, but couldn't get it going either.

Cheer,
Ju

--
Ju Zhang
PhD Student
Auckland Bioengineering Institute
University of Auckland
New Zealand

_______________________________________________
Enthought-Dev mailing list
Enthought-Dev@...
https://mail.enthought.com/mailman/listinfo/enthought-dev
Tony S Yu | 2 Oct 02:21
Picon
Gravatar

Re: Updating Range


On Oct 1, 2009, at 7:09 PM, Ju Zhang wrote:

> Hi,
>
> I have a Range trait that I want to update during __init__().  
> Specifically, I want to up set the high attribute of the Range  
> object. The code below demonstrates how I've envisioned the problem.
>
> class slice_viewer(HasTraits):
>     image = Array
>     slice_range = Property( Range( 0, 100 ), depends_on=['image'] )
>     ...
>     def __init__(self, inputImage):
>         self.image = inputImage
>         ....
>     def _get_slice_range(self):
>         """ somehow change the _high attribute in slice_range to be  
> (self.image.shape[0] - 1)
>         """"
>         return ?
>
> Can someone please shed some light on how this should be done? I  
> tried declaring slice_range._high = Property(Int, depends_on 
> ['image']) as an alternative, but couldn't get it going either.

It sounds like you want to dynamically update the range limits. I  
think the best way to do this is to declare an Int trait (instead of a  
Range trait) and use a RangeEditor to set the view.

class slice_viewer(HasTraits):
     image = Array
     slice_index = Int
     image_height = Int(100)
     traits_view = ui.View(ui.Item('slice_index',
                    					editor=ui.RangeEditor(low=0,  
high_name='image_height',
                                          		mode='slider')
					  ...)
     ...
     def __init__(self, inputImage):
         self.image = inputImage
	self.image_height = self.image.shape[0] - 1
         ....

The above assumes you've imported traits ui as `import  
enthought.traits.ui.api as ui`. I think there's an example of  
different ways to create dynamic ranges in the svn examples
(https://svn.enthought.com/enthought/browser/Chaco/trunk/examples 
) but I couldn't find it.

Best,
-Tony

>
> Cheer,
> Ju
>
> -- 
> Ju Zhang
> PhD Student
> Auckland Bioengineering Institute
> University of Auckland
> New Zealand
> _______________________________________________
> Enthought-Dev mailing list
> Enthought-Dev@...
> https://mail.enthought.com/mailman/listinfo/enthought-dev

Gmane