yaq-project / qtypes

Build Python Qt graphical user interfaces out of simple type objects.
GNU Lesser General Public License v3.0
0 stars 2 forks source link

Very slow to recreate the widgets when adding many at once #29

Closed ksunden closed 2 years ago

ksunden commented 2 years ago

perhaps we could add a context manager to allow:

with model.supress_restructure():
    for i in items:
        model.append(i)

Which allows for bundling of successive model edits, but does emit the restructured callbacks only in __exit__

ksunden commented 2 years ago

also might help if we didn't actually traverse the whole parent chain and have to redo everything (i.e. if the individual widgets handled it and not just passed it up to the tree widget itself...)

ksunden commented 2 years ago

For the record, I've got an implementation of such a context manager and the difference in startup time is massive:

for 33 daemons it took 1m13s to startup and close (and I didn't even get to "responsive I can use the UI") without the contextmanager

for the same with the context manager, including actually seeing the UI, it took 8 seconds

In each case I closed it as soon as I was able to.

ksunden commented 2 years ago

I will also note that whilst I do not think it is a solution for #27, it does mean that initial widgets can be grouped and thus not remade like they were, so I can actually use buttons (though I think as soon as I got hide/unhide to work I'd be right back where we are on that front, so its only a stopgap)