def __getattr__(self, attr): # if a feature value requested (requires object (camera) open) if attr in self.getFeatureNames(): return VimbaFeature(attr, self._handle).value # otherwise don't know about it raise AttributeError(''.join( ["'VimbaObject' has no attribute '", attr, "'"]))
def getFeatureRange(self, featureName): """ Get valid range of feature values. :param featureName: name of the feature to query. :returns: tuple -- range as (feature min value, feature max value). """ # can't cache this, need to look it up live return VimbaFeature(featureName, self._handle).range
def __setattr__(self, attr, val): # set privates as normal # check this first to allow all privates to set normally # and avoid recursion errors if attr.startswith('_'): super(VimbaObject, self).__setattr__(attr, val) # if it's an actual camera feature (requires camera open) elif attr in self.getFeatureNames(): VimbaFeature(attr, self._handle).value = val # otherwise just set the attribute value as normal else: super(VimbaObject, self).__setattr__(attr, val)