ThemedCheckboxEditor, wx backend, ETS 3.3.0

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

ThemedCheckboxEditor, wx backend, ETS 3.3.0

James Yoo
Hello,



I'm trying to use ThemedCheckboxEditor with the wx backend, but am finding that the import of themed_control.py fails 

lib/python2.5/site-packages/
TraitsBackendWX-3.2.0-py2.5.egg/enthought/traits/ui/wx/themed_control.py in <module>()
     36     import Image, Position, Alignment, Spacing
     37
---> 38 from image_slice \
     39     import default_image_slice
     40

ImportError: cannot import name default_image_slice


turns out default_image_slice is commented out in image_slice.py.

Anyone know why?

This is with ETS 3.3.0


thanks,
James


--
---


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

Re: ThemedCheckboxEditor, wx backend, ETS 3.3.0

bryce hendrix-2
Yeah, I purposefly disabled that code a while ago because it had enormous performance implications and was affecting themed and non-themed controls.

At the time I asked around and only 1 person was using any part of theming. We can talk about how to fix it to work with theming, but in general we've decided that theming is generally a bad idea. What is it you're trying to do with themes? Maybe we can suggest an alternate approach.

Bryce

James Yoo wrote:
Hello,



I'm trying to use ThemedCheckboxEditor with the wx backend, but am finding that the import of themed_control.py fails 

lib/python2.5/site-packages/
TraitsBackendWX-3.2.0-py2.5.egg/enthought/traits/ui/wx/themed_control.py in <module>()
     36     import Image, Position, Alignment, Spacing
     37
---> 38 from image_slice \
     39     import default_image_slice
     40

ImportError: cannot import name default_image_slice


turns out default_image_slice is commented out in image_slice.py.

Anyone know why?

This is with ETS 3.3.0


thanks,
James


--
---


_______________________________________________ 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: ThemedCheckboxEditor, wx backend, ETS 3.3.0

James Yoo
thanks Bryce,

what I'm trying to do is to display an image next to or underneath a checkbox.  I thought that using ThemedCheckboxEditor would be a convenient solution, since according to the documentation I could modify the "checked" image.

thanks again,
James

On Thu, Feb 18, 2010 at 12:47 PM, bryce hendrix <[hidden email]> wrote:
Yeah, I purposefly disabled that code a while ago because it had enormous performance implications and was affecting themed and non-themed controls.

At the time I asked around and only 1 person was using any part of theming. We can talk about how to fix it to work with theming, but in general we've decided that theming is generally a bad idea. What is it you're trying to do with themes? Maybe we can suggest an alternate approach.

Bryce

James Yoo wrote:
Hello,



I'm trying to use ThemedCheckboxEditor with the wx backend, but am finding that the import of themed_control.py fails 

lib/python2.5/site-packages/
TraitsBackendWX-3.2.0-py2.5.egg/enthought/traits/ui/wx/themed_control.py in <module>()
     36     import Image, Position, Alignment, Spacing
     37
---> 38 from image_slice \
     39     import default_image_slice
     40

ImportError: cannot import name default_image_slice


turns out default_image_slice is commented out in image_slice.py.

Anyone know why?

This is with ETS 3.3.0


thanks,
James


--
---


_______________________________________________ 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




--
---


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

Re: ThemedCheckboxEditor, wx backend, ETS 3.3.0

bryce hendrix-2
James Yoo wrote:
> thanks Bryce,
>
> what I'm trying to do is to display an image next to or underneath a
> checkbox.  I thought that using ThemedCheckboxEditor would be a
> convenient solution, since according to the documentation I could
> modify the "checked" image.

The simplest solution is to define a class with the Bool and Image:

class BoolAndImage(HasTraits):
    value = Bool(True)
    image = Image()

    traits_view = View(Item('value'), Item('image'))

class MyClass(HasTraits):
    toggle = Instance(BoolAndImage, ())
    traits_view = View(Item('toggle', editor=InstanceEditor(),
style='custom'))

I'm not sure how your model works, so I left out most of the details,
but that will get you a checkbox with an image underneath it. To get
them side-by-side, use an HGroup in the BoolAndImage view.

Another solution is to use the SVG button in a toggle state where you
can provide 2 different SVG's and toggle between them. With this you can
fake a checkbox control with the image.

Bryce

>
> thanks again,
> James
>
> On Thu, Feb 18, 2010 at 12:47 PM, bryce hendrix
> <[hidden email] <mailto:[hidden email]>> wrote:
>
>     Yeah, I purposefly disabled that code a while ago because it had
>     enormous performance implications and was affecting themed and
>     non-themed controls.
>
>     At the time I asked around and only 1 person was using any part of
>     theming. We can talk about how to fix it to work with theming, but
>     in general we've decided that theming is generally a bad idea.
>     What is it you're trying to do with themes? Maybe we can suggest
>     an alternate approach.
>
>     Bryce
>
>     James Yoo wrote:
>>     Hello,
>>
>>
>>
>>     I'm trying to use ThemedCheckboxEditor with the wx backend, but
>>     am finding that the import of themed_control.py fails
>>
>>     lib/python2.5/site-packages/
>>     TraitsBackendWX-3.2.0-py2.5.egg/enthought/traits/ui/wx/themed_control.py
>>     in <module>()
>>          36     import Image, Position, Alignment, Spacing
>>          37
>>     ---> 38 from image_slice \
>>          39     import default_image_slice
>>          40
>>
>>     ImportError: cannot import name default_image_slice
>>
>>
>>     turns out default_image_slice is commented out in image_slice.py.
>>
>>     Anyone know why?
>>
>>     This is with ETS 3.3.0
>>
>>
>>     thanks,
>>     James
>>
>>
>>     --
>>     ---
>>
>>     ------------------------------------------------------------------------
>>
>>     _______________________________________________
>>     Enthought-Dev mailing list
>>     [hidden email] <mailto:[hidden email]>
>>     https://mail.enthought.com/mailman/listinfo/enthought-dev
>>      
>
>
>     _______________________________________________
>     Enthought-Dev mailing list
>     [hidden email] <mailto:[hidden email]>
>     https://mail.enthought.com/mailman/listinfo/enthought-dev
>
>
>
>
> --
> ---
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> 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