-
Notifications
You must be signed in to change notification settings - Fork 59
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
Feature Request: __getattr__ #116
Comments
I hadn't thought about doing it like this. It would add to the interface, and in general I don't like to combine libgphoto2 functions into something new. I would call the
I'm not surprised your attempt to modify the gphoto2.widget.CameraWidget class fails. SWIG generated stuff is not pure Python! |
I've been doing some experimenting with SWIG's "attribute.i" library, but not achieving any satisfactory result. The situation is complicated by the overloading of Given that attribute style access isn't essential, and it breaks away from the libgphoto2 way of doing things, I don't plan to pursue this any further. |
See feature request #116. This is a bit kludgy, and is read-only so far, but it seems to work and should be faster than calling gp_widget_get_value or CameraWidget.get_value
Alright, thanks for looking into it. I'm closing the issue then. |
Never say never. I'm keeping this in mind for the next release. |
Another step towards implementing request #116.
Having successfully done read-only implementation of 3 attributes I don't think this is worth taking any further. I take your point about it being more Pythonic, but it hides the fact that there's a libgphoto function call behind every attribute access. I'll take the attribute access stuff out again. |
This was discussed in feature request #116. Adding attribute access is possible but messy.
Alright - thanks for taking the time to look into it |
Your system
3.9
What version of libgphoto2 have you installed?
2.5.25
How have you installed (or attempted to install) python-gphoto2?
yes
Your problem
When using the package, I find I'm using the
get_child_by_name
attribute very often......where a more object-oriented / user-friendly interface might be
If there is a reason you haven't written it like this (staying close to the
gphoto2
API maybe?), then you can ignore this request, of course.I have tried to implement it myself, but ran into an issue I'm not sure I've seen before, at the first step (exposing the children as attributes). Still, it might be helpful to you, so I'll include it here. This should have allowed access to the widget with
cfg.iso
; setting its value would have been the next step.The text was updated successfully, but these errors were encountered: