-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TreeView/TableView/ListView in conjuction with psygnal EventedDataclass/EventedModel #255
Comments
hey @ndxmrb, #77 was essentially a pointer to a large amount of prior work and discussion that happened over in napari. In napari, I did create I'm not going to lie, it gets rather hairy... but the end goal is indeed quite nice; python objects that automagically update themselves as you work with them. I would encourage you to start by looking at the napri code for @alisterburt took a stab at porting all of that over here in #105 ... so you could also start there and see what state it's in. QTable and QTree would be a bit harder, since there's no direct model backing either of those quite like the I'm afraid i can't personally offer to work on this at the moment, but if you do dig deeper and have any questions as you go, feel free to keep asking them here |
Hey @tlambert03, I had a look at napari prior to my post here. I tried to use it as a role model, but got stuck (for now)... I also looked at the Issues over there, because I was hoping to find a road map for migrating to psygnal It's nice that the ground work for a list model has already been done. Do you remember why you didn't pull after the test was added? @alisterburt mentions a yet to be developed superqt As for the additional decisions you mentioned: For tables and trees the main difference is, that conceptionally the ListModel is just a 1-to-1 mapper of the existing structure, whereas for tables and trees you essentially define a view model instead. E.g. you provide the columns you want to see [and the nested container path]. Other frameworks do this too and have different approaches. For instance, the close-to-pydantic FastUI does this with an extra Coming from |
I can't speak to napari's plans for migration, I don't work on it anymore. I suspect there's no active push towards that direction at the moment though.
i don't remember the exact reason at this point. my guess is that the tests were limited? but I really can't remember. If have the time, and you checkout that branch and can confirm that it does something (anything) that you would like to have merged into main. Then I'm not opposed to merging it in an experimental capacity.
I think his words were "first step towards a psygnal backed QtListView in superqt". So, I'm guessing he mostly means what you mean too (that the model is the main step). However, I'll note that in napari, it looks like I did create a QtView mixin that was designed specifically for our evented models. An example of using that mixin is here. |
Hi all,
I wasn't sure where to place this question (which might lead to a feature request?), but because of #77 I now decided to go ahead here:
If I had a psygnal
EventedContainer
holdingEventedModel
instances, I'd like those to be shown in aQTable[...]
or even aQTree[...]
.Two approaches are feasible:
EventedContainer
to aQAbstractItemModel
. This could utilize the.internalPointer()
function to return data directly from theEventedModel
. Then you could use aQTreeView
orQTableView
to show the data from the Qt model.QTreeWidget
orQTableWidget
, in which the respective Items are connected to the EventedModel signals.I see the following issues with these approaches:
Which implementation should be chosen here? Regarding the threading, I fear approach 2. could still run into race conditions on read/write enabled items (but isn't that the case for magicgui widgets, too?)...
Again, #77 leaves this intentionally vague, so this might be the starting point.
I tried to provide some (ever so small) value in addition to my question, but if it still is too forumy-questiony, feel free to close this 😋
Thanks for having a look though!
The text was updated successfully, but these errors were encountered: