-
Notifications
You must be signed in to change notification settings - Fork 10
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
Feedback on using ltk.Model #19
Comments
Additional related information: When changing a
Error message is:
This may all be classvar vs instancevar problems and not so easily solved. |
Also I have been caught out a few times as |
I have not succeeded in making a component style object using the Model class. A good solution would be to move to instance variables. I wonder if this is at all possible? |
MVP Feedback:
In trying to migrate to using the MVP (
ltk.Model
class) I have come across some issues.I will lay them out here in the hopes that it might help in future development.
To get around the potential memory leak in
widget()
I have successfully been using a global var. The MVP approach looks like it may supersede the need for the recently addedwidget()
I am also using a global var to make easy ref to the following reactive component. This is working well.
I am also using a global to deal with rippling updates, if I update two or more reactive variables. This is working well.
I.e.
ltk.Model
using class variables.Specifically:
self.Len_measure = "foo"
self.Len_measure
through a function header and try to assign it, then an instance variable is created and the class var is not updated.E.g.
So to get around this I send the name of the classvar through (as in
changed()
above and do a more complicated operation like so:In short:
I am using
self.__setattr__(primary_var, newvalue)
instead ofprimary_var = newvalue
because its a classvar.So I am ok with my solution and its as neat as I can work out how to make it (by using the expanding
*vars
parameter).But I wonder if there is another way to architect it so it works differently.
Working example here:
Cheers...
The text was updated successfully, but these errors were encountered: