aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormorefigs <morefigs@gmail.com>2018-06-22 16:06:56 +1000
committermorefigs <morefigs@gmail.com>2018-06-22 16:06:56 +1000
commitfbe8f52bf3903206784206de0603628a9be14fd5 (patch)
treeb5d82039f3c1a66b2fdd9000194bfe3f5239d639
parentfac2f7b87ebebf0a3255b9d02cddff24fa194226 (diff)
downloadpymba-fbe8f52bf3903206784206de0603628a9be14fd5.tar.gz
pymba-fbe8f52bf3903206784206de0603628a9be14fd5.zip
clean up
-rw-r--r--pymba/vimba.py8
-rw-r--r--pymba/vimba_feature.py2
-rw-r--r--pymba/vimba_object.py30
3 files changed, 19 insertions, 21 deletions
diff --git a/pymba/vimba.py b/pymba/vimba.py
index 475dedd..5656b7c 100644
--- a/pymba/vimba.py
+++ b/pymba/vimba.py
@@ -247,9 +247,11 @@ class Vimba(object):
versionInfo = structs.VimbaVersion()
# Vimba DLL will return an error code
- errorCode = VimbaDLL.versionQuery(versionInfo,
- sizeof(versionInfo))
- if errorCode != 0:
+ errorCode = VimbaDLL.versionQuery(
+ versionInfo,
+ sizeof(versionInfo)
+ )
+ if errorCode:
raise VimbaException(errorCode)
versionStr = '.'.join([str(versionInfo.major),
diff --git a/pymba/vimba_feature.py b/pymba/vimba_feature.py
index 16c4169..3e838f0 100644
--- a/pymba/vimba_feature.py
+++ b/pymba/vimba_feature.py
@@ -283,7 +283,7 @@ class VimbaFeature(object):
if errorCode != 0:
raise VimbaException(errorCode)
- return (int(str(minToGet.value)), int(str(maxToGet.value)))
+ return int(str(minToGet.value)), int(str(maxToGet.value))
def _rangeQueryFloatFeature(self):
"""
diff --git a/pymba/vimba_object.py b/pymba/vimba_object.py
index f75aa75..5f7480f 100644
--- a/pymba/vimba_object.py
+++ b/pymba/vimba_object.py
@@ -8,12 +8,10 @@ from ctypes import *
class VimbaObject(object):
-
"""
A Vimba object has a handle and features associated with it.
Objects include System, Camera, Interface and AncillaryData.
"""
-
@property
def handle(self):
return self._handle
@@ -22,24 +20,19 @@ class VimbaObject(object):
# create own handle
self._handle = c_void_p()
- # list of VimbaFeatureInfo objects
- # can't set yet as the object (e.g. a camera) won't be
- # opened yet, therefore no event for object opening
- # so will have it populate by user interaction
- # and blame them if the object is not opened then
+ # list of VimbaFeatureInfo objects can't set yet as the object (e.g. a camera) won't be opened yet, therefore
+ # no event for object opening so will have it populate by user interaction and blame them if the object is not
+ # opened then
self._featureInfos = None
# override getattr for undefined attributes
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,
- "'"]))
+ raise AttributeError(''.join(["'VimbaObject' has no attribute '", attr, "'"]))
# override setattr for undefined attributes
def __setattr__(self, attr, val):
@@ -147,23 +140,26 @@ class VimbaObject(object):
:param featureName: the name of the feature.
"""
# run a command
- errorCode = VimbaDLL.featureCommandRun(self._handle,
- featureName.encode())
+ errorCode = VimbaDLL.featureCommandRun(
+ self._handle,
+ featureName.encode()
+ )
if errorCode != 0:
raise VimbaException(errorCode)
def featureCommandIsDone(self, featureName):
isDone = c_bool()
- errorCode = VimbaDLL.featureCommandIsDone(self._handle,
- featureName.encode(),
- byref(isDone))
+ errorCode = VimbaDLL.featureCommandIsDone(
+ self._handle,
+ featureName.encode(),
+ byref(isDone)
+ )
if errorCode != 0:
raise VimbaException(errorCode)
return isDone.value
-
def readRegister(self, address):
# note that the underlying Vimba function allows reading of an array
# of registers, but only one address/value at a time is implemented