Enaml | can I mix it with an existing traitsui?

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Enaml | can I mix it with an existing traitsui?

_jelle_
Hi,

I'm curious if you could comment on the upgrade path to Enaml.
Is it possible for instance, to use an Enaml view of a particular traits
object in an existing traitsui / pyface application? That would make for
a low entry barrier, which is why I'm curious to know.

Thanks,

-jelle

_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
Reply | Threaded
Open this post in threaded view
|

Re: Enaml | can I mix it with an existing traitsui?

Jaidev Deshpande
On Tue, Aug 28, 2012 at 8:00 PM, Jelle Feringa <[hidden email]> wrote:
> Hi,
>
> I'm curious if you could comment on the upgrade path to Enaml.
> Is it possible for instance, to use an Enaml view of a particular traits
> object in an existing traitsui / pyface application? That would make for
> a low entry barrier, which is why I'm curious to know.

Hi,

Yes, this is possible. There is an TraitsUIItem widget in enaml which
can be used to view existing TraitsUI widgets.
Check this out -
http://docs.enthought.com/enaml/api_ref/widgets/enaml.components.traitsui_item.TraitsUIItem.html#enaml.components.traitsui_item.TraitsUIItem

>
> Thanks,
>
> -jelle
>
> _______________________________________________
> Enthought-Dev mailing list
> [hidden email]
> https://mail.enthought.com/mailman/listinfo/enthought-dev
_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
Reply | Threaded
Open this post in threaded view
|

Re: Enaml | can I mix it with an existing traitsui?

_jelle_
> Yes, this is possible. There is an TraitsUIItem widget in enaml which
> can be used to view existing TraitsUI widgets.

Thanks Jaidev,

Though that achieves the opposite of what I'm interested in:
Allowing to embed a TraitsUIItem in an Enaml app.
Its not possible to do the inverse, embedding a "EnamlUIItem" in a traitsui app?
That would offer a really nice upgrade path, but perhaps I'm asking too much ;)

-jelle

_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
Reply | Threaded
Open this post in threaded view
|

Re: Enaml | can I mix it with an existing traitsui?

Jaidev Deshpande
On Wed, Aug 29, 2012 at 2:22 PM, Jelle Feringa <[hidden email]> wrote:

>> Yes, this is possible. There is an TraitsUIItem widget in enaml which
>> can be used to view existing TraitsUI widgets.
>
> Thanks Jaidev,
>
> Though that achieves the opposite of what I'm interested in:
> Allowing to embed a TraitsUIItem in an Enaml app.
> Its not possible to do the inverse, embedding a "EnamlUIItem" in a traitsui app?
> That would offer a really nice upgrade path, but perhaps I'm asking too much ;)
>

I see :)

Out of curiosity, why do you need such an upgrade path?

Thanks

> -jelle
>
> _______________________________________________
> Enthought-Dev mailing list
> [hidden email]
> https://mail.enthought.com/mailman/listinfo/enthought-dev
_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
Reply | Threaded
Open this post in threaded view
|

Re: Enaml | can I mix it with an existing traitsui?

_jelle_
> Out of curiosity, why do you need such an upgrade path?

simply since that lowers the threshold of exploring / moving towards enaml.
when working on a larger app, such capabilities does make a difference.


_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
Reply | Threaded
Open this post in threaded view
|

Re: Enaml | can I mix it with an existing traitsui?

Pietro Berkes
Dear Jelle,

unfortunately it is not possible to embed Enaml in traitsui, nor is such a feature planned for the future. A possible way ahead would be to define an Enaml window containing all your traitsui views, and then replace those one at the time. (Full disclaimer: I haven't tried myself, but it should work.)

Best,
Pietro


On Wed, Aug 29, 2012 at 3:37 PM, Jelle Feringa <[hidden email]> wrote:
> Out of curiosity, why do you need such an upgrade path?

simply since that lowers the threshold of exploring / moving towards enaml.
when working on a larger app, such capabilities does make a difference.


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



--
Pietro Berkes
Scientific software developer
Enthought UK



_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
Reply | Threaded
Open this post in threaded view
|

Re: Enaml | can I mix it with an existing traitsui?

Corran Webster
In reply to this post by _jelle_
Hi Jelle,

if you are prepared to do a little (not a lot!) of messing around with TraitsUI and Enaml internals you should be able to do what you want using a (subclass of?) a TraitsUI CustomEditor.

Basically you need to create a factory function which takes the parent control, the editor instance (which you can introspect for trait values, if you want), and some optional arguments, and returns a raw Wx or Qt control which has been appropriately parented.  This factory function should create the appropriate Enaml UI, and grab the control to return.

You might want to have a look in Pyface Tasks implementation where there are Enaml Panes and Editors which are built using a similar trick.

You may find that a general solution is a fairly small number of lines of code.

-- Corran

On Wed, Aug 29, 2012 at 3:52 AM, Jelle Feringa <[hidden email]> wrote:
> Yes, this is possible. There is an TraitsUIItem widget in enaml which
> can be used to view existing TraitsUI widgets.

Thanks Jaidev,

Though that achieves the opposite of what I'm interested in:
Allowing to embed a TraitsUIItem in an Enaml app.
Its not possible to do the inverse, embedding a "EnamlUIItem" in a traitsui app?
That would offer a really nice upgrade path, but perhaps I'm asking too much ;)

-jelle

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


_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev
Reply | Threaded
Open this post in threaded view
|

Re: Enaml | can I mix it with an existing traitsui?

_jelle_
Thanks Corran, that's constructive feedback & uplifting news.
I'll go for that, will report back if I've cooked up something
sufficiently general.

Thanks,

-jelle

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