problems with "kind" and "resizable" View attributes

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

problems with "kind" and "resizable" View attributes

Luca Fasano
Hi all,
If I use a class derived from HasTraits as "Instance" in another
"HasTraits" class I have some problems. I'm trying to use "kind" and
"resizable" attributes and what happens is resumed following:
 - If I use "resizable=True" the second Window is shown *behind* the
first one
 - If I use "kind='livemodal'" or "kind='modal'" the second Windows
*doesn't* appear as modal.

Why? Can I find a workaround for these problems?

following a simple example: try to press 3 buttons:


from enthought.etsconfig.api import ETSConfig
ETSConfig.toolkit = 'qt4'

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


class I(HasTraits):
    x = Int()

class I1(I):
    v2 = View('x')

class I2(HasTraits):
    v2 = View('x', resizable=True)

class I3(HasTraits):
    v2 = View('x', kind='livemodal')

class C(HasTraits):
    i1 = Instance(I1, ())
    i2 = Instance(I2, ())#shown behind first window
    i3 = Instance(I3, ())#doesn't shown as modal

    v = View(
        Item('i1', label='base'),
        Item('i2', label='resizable'),
        Item('i3', label='livemodal')
    )


if __name__ == '__main__':
    c = C()
    c.configure_traits()


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

Re: problems with " kind" and " resizable" View attributes

Luca Fasano
Luca Fasano <lucafasano@...> writes:

>
> Hi all,
> If I use a class derived from HasTraits as "Instance" in another
> "HasTraits" class I have some problems. I'm trying to use "kind"
> and "resizable" attributes and what happens is resumed following:
>  - If I use "resizable=True" the second Window is shown *behind*
> the first one
>  - If I use "kind='livemodal'" or "kind='modal'" the second
> Windows *doesn't* appear as modal.
>
> Why? Can I find a workaround for these problems?
>
> following a simple example: try to press 3 buttons:
>
> from enthought.etsconfig.api import ETSConfig
> ETSConfig.toolkit = 'qt4'
>
> from enthought.traits.api import *
> from enthought.traits.ui.api import *
>
> class I(HasTraits):
>     x = Int()
>
> class I1(I):
>     v2 = View('x')
>
> class I2(HasTraits):
>     v2 = View('x', resizable=True)
>
> class I3(HasTraits):
>     v2 = View('x', kind='livemodal')
>
> class C(HasTraits):
>     i1 = Instance(I1, ())
>     i2 = Instance(I2, ())#shown behind first window
>     i3 = Instance(I3, ())#doesn't shown as modal
>
>     v = View(
>         Item('i1', label='base'),
>         Item('i2', label='resizable'),
>         Item('i3', label='livemodal')
>     )
>
> if __name__ == '__main__':
>     c = C()
>     c.configure_traits()
>

I searched for something useful to my question into ETS Trac.

I found changeset [24432]
(https://svn.enthought.com/enthought/changeset/24432/TraitsBackendQt/
trunk/enthought/traits/ui/qt4/ui_base.py)
with a modification that seems to cause my problem. Is that right?

At this point my question is: how can I fix it? Can I set an appropriate
attribute to set the parent to allow the window shown to be modal?
Perhaps the windows shown are only modal respect of another window...
how can I set this last one?

Or is there another way even to workaround this problem?

Any suggestion?



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

Re: problems with &quot; kind&quot; and &quot; resizable&quot; View attributes

bryce hendrix-2
On 2/18/2010 4:56 AM, Luca Fasano wrote:

> Luca Fasano<lucafasano@...>  writes:
>
>    
>> Hi all,
>> If I use a class derived from HasTraits as "Instance" in another
>> "HasTraits" class I have some problems. I'm trying to use "kind"
>> and "resizable" attributes and what happens is resumed following:
>>   - If I use "resizable=True" the second Window is shown *behind*
>> the first one
>>   - If I use "kind='livemodal'" or "kind='modal'" the second
>> Windows *doesn't* appear as modal.
>> ...
> I searched for something useful to my question into ETS Trac.
>
> I found changeset [24432]
> (https://svn.enthought.com/enthought/changeset/24432/TraitsBackendQt/
> trunk/enthought/traits/ui/qt4/ui_base.py)
> with a modification that seems to cause my problem. Is that right?
>
> At this point my question is: how can I fix it? Can I set an appropriate
> attribute to set the parent to allow the window shown to be modal?
> Perhaps the windows shown are only modal respect of another window...
> how can I set this last one?
>
> Or is there another way even to workaround this problem?
>
> Any suggestion?
>
>    

Looks like a bonafide bug. I suggest replacing the items in the view
with Buttons. In the buttons event listeners, there you can call
edit_traits(kind='livemodal'). Let me know if that still doesn't work
for you.

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