-
-
Notifications
You must be signed in to change notification settings - Fork 690
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
Fixed bug related to missing_value for android and linux #1913
Fixed bug related to missing_value for android and linux #1913
Conversation
…vided for all headings and crashed on android for the same reason.
gtk/src/toga_gtk/widgets/tree.py
Outdated
@@ -15,6 +15,7 @@ def create(self): | |||
self.store = SourceTreeModel( | |||
[{"type": str, "attr": a} for a in self.interface._accessors], | |||
is_tree=is_tree, | |||
missing_value=getattr(self.interface, "missing_value", None), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why use getattr here? Unless I'm missing something, missing_value
should always be defined on the interface.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not at my computer to confirm fully but I believe the issue was the Tree interface did not have the missing_value. If you are able to look at the first round of checks it should show which interface did have it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah - that makes sense. That's an API inconsistency that should probably be resolved...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The missing_value handling on tree is something we need to backfill for tree, but otherwise, this looks great! Thanks!
gtk/src/toga_gtk/widgets/tree.py
Outdated
@@ -15,6 +15,7 @@ def create(self): | |||
self.store = SourceTreeModel( | |||
[{"type": str, "attr": a} for a in self.interface._accessors], | |||
is_tree=is_tree, | |||
missing_value=getattr(self.interface, "missing_value", None), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah - that makes sense. That's an API inconsistency that should probably be resolved...
ff3186f
to
a49ef11
Compare
For linux, I passed the missing_value from self.interface.missing_value from Tree to the sourcetreemodel. I did this because self.instance is not available inside the sourcetreemodel but the value is needed to be able to solve the bug.
For android, I simply added the self.interface.missing_value as the default option for the getattr.
On android the app will crash if values are not provided for all headings, on linux it will cause an error in the logs.
Fixes #1879
PR Checklist: