From: <mar...@us...> - 2007-06-29 16:41:14
|
Revision: 10417 http://svn.sourceforge.net/gphoto/?rev=10417&view=rev Author: marcusmeissner Date: 2007-06-29 09:41:15 -0700 (Fri, 29 Jun 2007) Log Message: ----------- applied widget additions from Niels Provos. Modified Paths: -------------- trunk/bindings/libgphoto2-python/gphoto2.pyx Modified: trunk/bindings/libgphoto2-python/gphoto2.pyx =================================================================== --- trunk/bindings/libgphoto2-python/gphoto2.pyx 2007-06-29 09:14:46 UTC (rev 10416) +++ trunk/bindings/libgphoto2-python/gphoto2.pyx 2007-06-29 16:41:15 UTC (rev 10417) @@ -867,10 +867,32 @@ check(gp_widget_ref(self.widget)) def count(self): - if self.widget == NULL: - return 0 + self._check() return gp_widget_count_children(self.widget) + def get_child_by_name(self, char *name): + cdef cameraWidget widget + self._check() + widget = cameraWidget() + check(gp_widget_get_child_by_name(self.widget, name, &widget.widget)) + check(gp_widget_ref(widget.widget)) + return widget + + def get_child_by_label(self, char *label): + cdef cameraWidget widget + self._check() + widget = cameraWidget() + check(gp_widget_get_child_by_label(self.widget, label, &widget.widget)) + check(gp_widget_ref(widget.widget)) + return widget + + def _check(self): + if not self.widget: + raise Exception('Uninitialized cameraWidget') + + def __len__(self): + return self.count() + def __getitem__(self, num): cdef cameraWidget widget widget = cameraWidget() @@ -954,10 +976,14 @@ check(gp_widget_get_info(self.widget, &info)) return info + property changed: + def __get__(self): + self._check() + return gp_widget_changed(self.widget) + property parent: def __get__(self): - if self.widget == NULL: - return None + self._check() cdef cameraWidget widget check(gp_widget_get_parent(self.widget, &widget.widget)) @@ -1102,6 +1128,7 @@ cdef cameraWidget widget widget = cameraWidget() check(gp_camera_get_config(self.camera, &widget.widget, NULL)) + check(gp_widget_ref(widget.widget)) return widget def __set__(self, cameraWidget widget): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |