enthought / traits-enaml

A library to facilitate interoperation of Traits with Enaml > 0.8.x
Other
15 stars 11 forks source link

Creating TraitsView widgets with Include causes flicker #32

Closed tuomas2 closed 10 years ago

tuomas2 commented 10 years ago

When creating many TraitsView objects with Include, window flickers and looks like it is creating (and closing) a new window at the creation of each TraitsView object.

itziakos commented 10 years ago

Thanks @tuomas2, do you have any small example that demonstrates the problem?

tuomas2 commented 10 years ago

Here you are:

traits_view.enaml

enamldef Obj(TraitsView):
    attr person
    model := person

enamldef PersonView(Window):
    attr person
    Container:
        ScrollArea:
            Container:
                Include:
                    objects = [Obj(person=person) for i in range(100)]

and person.py:


from traits.api import HasTraits, Str, Range

import enaml
from enaml.qt.qt_application import QtApplication

class Person(HasTraits):
    """ A simple class representing a person object.

    """
    last_name = Str()

    first_name = Str()

    age = Range(low=0)

if __name__ == '__main__':
    with enaml.imports():
        from traits_view import PersonView

    john = Person(first_name='John', last_name='Doe', age=42)

    app = QtApplication()
    view = PersonView(person=john)
    view.show()

    app.start()
itziakos commented 10 years ago

Thanks, @tuomas2.

itziakos commented 10 years ago

I can verify the issue.