Open basak opened 8 years ago
If you turn it in to a pull request, I think it's easier to comment on the changes.
I think it's good to have that as another option, and if the performance is bad, we can always try to make it more efficient, or people just user other methods for interfacing QML with Python (I've done it in my projects by sending objects back and forth between QML and Python and manually syncing the QML state with the Python state). For a first version, I think it's okay to possibly trade performance for convenience (having the Python state sync automatically with QML is a nice thing to have).
Can you turn this into a pull request?
Any news there?
Sorry, I've been busy. I do intend to finish this at some point, but I don't expect to get to it for a month or two at least.
FYI, I've resumed this effort. I'll send a pull request soon, even if it's just my mess of work in progress so that you can comment inline. Probably best to get an idea of where you want things to go before I polish it up.
Any update @basak on your commit ?
In C++, I can write an
AbstractItemModel
implementation. I'd like to do the same thing in Python so that I can have Pythonic data structures that can be manipulated naturally by a Python backend and the data reflected naturally with a QML frontend.I have a basic implementation of this working. It needs considerable cleaning up and isn't ready yet, but I thought it would be useful to get some initial review and feedback on the basic design and API at this stage. I've pushed it to https://github.com/basak/pyotherside/tree/models. Some rudimentary documentation is at https://github.com/basak/pyotherside/blob/models/docs/models including an example, along with a basic model implementation in Python in https://github.com/basak/pyotherside/blob/models/docs/pymodel.py. Here are some notes copied from my initial documentation for your reference: