Peter Wang | 1 Aug 01:08

Re: kiva GL backend

On Jul 31, 2007, at 5:33 PM, jelle wrote:

> I just started to have a glance at Kiva, and it seems a real gem to  
> me!
> The thing is that I'd like to use it for a realtime visualization  
> being able to
> render lots of 2d polygons fast & anti aliased is the issue. The GL  
> backend
> would be just the thing i need. It seems to me though that its  
> currently not
> running (I'm running the 2.5 win32 egg...)
> Simple because the Canvas & CanvasWindow classes aren't implemented  
> currently.
> However, it seems that quite a bit of effort went into this, and I  
> think it
> would be a very nice module. It would be great to get a status update!

Hi Jelle,

Kiva's Agg and Mac OS backends are actively used by Enable and  
Chaco.  There are two GL backends: one that uses Agg to raster into a  
memory image, which is then used as a GL texture, and a native GL  
backend that sets up a viewport and the various model/projection  
matrices, and translates Kiva's DisplayPDF calls into GL  
equivalents.  Both of these backends worked at one point and just  
need some updating.  I took a pass at cleaning up the native GL one  
back in early june (revision 12125), but it needs probably a few more  
hours of work to get the base up and running.  Is there a particular  
time frame you had in mind for your project?  Alternatively, if you  
want to take a stab at it, I'd be happy to give you some pointers.. :)
(Continue reading)

Brennan Williams | 1 Aug 01:31
Gravatar

Traits UI - defining an action as a radio or toggle button

I'm trying to put some radio or toggle buttons on the bottom button 
bar/line alongside "Exit" and "Help"

My radio button works (probably because I'm storing the on/off setting 
as an attribute in my own class) but just looks like a normal button so 
I can't tell whether it is checked on or off.

This is how I defined the action...

    ShowMessagesRadioButton=Action(name='Show Messages',
                 style='toggle',
                         action='_showmessages_clicked',
                         tooltip = 'Enable/Disable display of diagnostic 
messages')

I had a look through the traits and pyface code and I see that the 
traits ui action comes from Pyface and I ended up in action_item.py 
where the style is mapped to either wx.ITEM_NORMAL, wx.ITEM_RADIO or 
wx.ITEM_CHECK so it looks like my style='toggle' or style='radio' is not 
working.

Brennan
Alexander Michael | 1 Aug 01:35
Picon

Listing Instance traits for a given instance class

How can I query a HasTraits class for all Instance(MyClass) traits? For example:

class SomeClass(HasTraits):
    obj1 = Instance(MyClass)
    obj2 = Instance(MyClass)
    val1 = Int

a = SomeClass(obj1=myobj1, obj2=myobj2)

>>> print a.?????
['obj1', 'obj2']

or

>>> print a.?????
[myobj1, myobj2]

Thanks!
Alex
Brennan Williams | 1 Aug 03:46
Gravatar

Traints/Pyface - specifying the split ratio

I'm using VSplit and HSplit which both default to a split ratio of 0.5 
which means each time I start up my app I have to manually resize the 
panels.

Looking at the pyface example explorer.py which uses SplitPanel I see 
you can add in something like ratio=0.3 to set your ratio.

Is there any way to do this when using VSplit and HSplit in traits?

Brennan
David C. Morrill | 1 Aug 05:22

Re: TraitsUI and Pyface

Now that I've had some sleep, I took another look at you code. I would 
suggest trying something more like the following:

#! /usr/bin/env python
import wx

from enthought.traits.api import \
    HasTraits

from enthought.traits.ui.api import \
    View, Item

from enthought.traits.ui.wx.editor import \
    Editor

from enthought.traits.ui.wx.basic_editor_factory import \
    BasicEditorFactory

class _GraphvizEditor(Editor):

   scrollable = True

   def init(self, parent):
       self.control = wx.Panel(parent, -1, style=wx.CLIP_CHILDREN)
        self._sizer = wx.BoxSizer(wx.VERTICAL)
        self.control.SetSizer(self._sizer)
        self._figure = wx.BitmapFromImage(wx.Image(self.value, 
wx.BITMAP_TYPE_ANY))
        self._sizer.Add((0,0), 1)
        self._sizer.Add(self._figure, 0, wx.ALL|wx.ALIGN_CENTER, 10)
(Continue reading)

David C. Morrill | 1 Aug 05:27

Re: Traits UI - defining an action as a radio or toggle button

Is there some reason you're not just using a Bool trait (which will 
appear as a checkbox in your UI by default) to handle this?

Dave Morrill

Brennan Williams wrote:
> I'm trying to put some radio or toggle buttons on the bottom button 
> bar/line alongside "Exit" and "Help"
>
> My radio button works (probably because I'm storing the on/off setting 
> as an attribute in my own class) but just looks like a normal button so 
> I can't tell whether it is checked on or off.
>
> This is how I defined the action...
>
>     ShowMessagesRadioButton=Action(name='Show Messages',
>                  style='toggle',
>                          action='_showmessages_clicked',
>                          tooltip = 'Enable/Disable display of diagnostic 
> messages')
>
> I had a look through the traits and pyface code and I see that the 
> traits ui action comes from Pyface and I ended up in action_item.py 
> where the style is mapped to either wx.ITEM_NORMAL, wx.ITEM_RADIO or 
> wx.ITEM_CHECK so it looks like my style='toggle' or style='radio' is not 
> working.
>
> Brennan
>
> _______________________________________________
(Continue reading)

David C. Morrill | 1 Aug 05:34

Re: Listing Instance traits for a given instance class

Using metadata...for example:

AMyClass = Instance(MyClass, my_class = True )

class SomeClass(HasTraits):
    obj1 = AMyClass
    obj2 = AMyClass
    val1 = Int

Then:
a = SomeClass(obj1=myobj1, obj2=myobj2)
a.trait_names(my_class = True) should return:

['obj1','obj2']

Attaching metadata to traits is a very powerful technique, and one which 
can be used in a number of different ways. Note that you can also do it as:

class SomeClass(HasTraits):

    obj1 = Instance(MyClass, my_class = True)
    obj2 = Instance(MyClass, my_class = True)
    val1 = Int

Hope that helps...

Dave Morrill

Alexander Michael wrote:
> How can I query a HasTraits class for all Instance(MyClass) traits? For example:
(Continue reading)

David C. Morrill | 1 Aug 05:37

Re: Traints/Pyface - specifying the split ratio

Brennan Williams wrote:
> I'm using VSplit and HSplit which both default to a split ratio of 0.5 
> which means each time I start up my app I have to manually resize the 
> panels.
>
> Looking at the pyface example explorer.py which uses SplitPanel I see 
> you can add in something like ratio=0.3 to set your ratio.
>
> Is there any way to do this when using VSplit and HSplit in traits?
>
>
>   

I'm looking at adding this capability soon.

BTW, you don't have to manually resize EACH time you run your app. Just 
add an id = '...' trait to both your View and outermost VSplit/HSplit 
object, which will tell the traits UI that you want to persist user 
preference information both for the View (size/position) and the 
splitters (i.e. split ratio)...

Dave Morrill
jelle | 1 Aug 09:23
Picon

Re: kiva GL backend


> Also, note that you can start writing code using one of Kiva's other  
> backends for the time being, and once the GL one gets fixed up, you  
> should be able to seemless switch to it.

Hi Peter, 

Thanks for your detailed answer.
So, _wx_gl is the backend that agg rasterizes a texture to, right?
I assume to goal here is to have your open-gl accelerate the display of this
picture?

Seamless switching certainly is a promising prospect.
To get the _gl backend going once more, is that a matter of implementing Canvas
and CanvasWindow?

Thanks,

-jelle
Martin Chilvers | 1 Aug 11:18
Picon

[Fwd: Toolkit selection for Traits/PyFace etc...]

G'day,

So no replies to this as yet, but if y'all could take a look it would be 
greatly appreciated as I think it could make the code a lot easier to read and 
use, and if you agree I can get on and make it happen!

Martin
Picon
From: Martin Chilvers <martin_chilvers@...>
Subject: Toolkit selection for Traits/PyFace etc...
Date: 2007-07-30 22:10:48 GMT
G'day,

Here are a couple of examples that show two different approaches to the toolkit 
selection  thang... Unzip the attached files and have a browse for details, but 
here is a brief overview...

1) The first example is in the 'enthought.lcd' package (for 'lowest common 
denominator' ;^). For 'lcd' think 'pyface'!

As per Dave M's suggestion, this one uses categories to add the toolkit 
specific traits and methods to toolkit-independent base classes.

The 'enthought.lcd' package is a namespace package that is intended to be 
(Continue reading)


Gmane