aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormorefigs <morefigs@gmail.com>2019-01-23 14:24:27 +1100
committermorefigs <morefigs@gmail.com>2019-01-23 14:24:27 +1100
commitd26f4f736dde31d0a651a97500c63023578ed862 (patch)
tree35bb9eb45a5233198a475b370d4bb8d412e2919d
parent058cd5c653f09dc0308d259017c2a0b2195c8749 (diff)
downloadpymba-d26f4f736dde31d0a651a97500c63023578ed862.tar.gz
pymba-d26f4f736dde31d0a651a97500c63023578ed862.zip
simplify file names
-rw-r--r--pymba/camera.py (renamed from pymba/vimba_camera.py)8
-rw-r--r--pymba/feature.py (renamed from pymba/vimba_feature.py)2
-rw-r--r--pymba/frame.py (renamed from pymba/vimba_frame.py)4
-rw-r--r--pymba/interface.py (renamed from pymba/vimba_interface.py)2
-rw-r--r--pymba/system.py (renamed from pymba/vimba_system.py)2
-rw-r--r--pymba/vimba.py20
-rw-r--r--pymba/vimba_c.py22
-rw-r--r--pymba/vimba_object.py8
8 files changed, 23 insertions, 45 deletions
diff --git a/pymba/vimba_camera.py b/pymba/camera.py
index 27bd5d3..16910fb 100644
--- a/pymba/vimba_camera.py
+++ b/pymba/camera.py
@@ -3,11 +3,11 @@ from typing import Optional
from .vimba_object import VimbaObject
from .vimba_exception import VimbaException
-from .vimba_frame import VimbaFrame
+from .frame import Frame
from . import vimba_c
-class VimbaCamera(VimbaObject):
+class Camera(VimbaObject):
"""
A Vimba camera object.
"""
@@ -84,8 +84,8 @@ class VimbaCamera(VimbaObject):
if error:
raise VimbaException(error)
- def create_frame(self) -> VimbaFrame:
+ def create_frame(self) -> Frame:
"""
Creates and returns a new frame object. Multiple frames per camera can therefore be returned.
"""
- return VimbaFrame(self)
+ return Frame(self)
diff --git a/pymba/vimba_feature.py b/pymba/feature.py
index 6e68bea..f81ea6a 100644
--- a/pymba/vimba_feature.py
+++ b/pymba/feature.py
@@ -5,7 +5,7 @@ from .vimba_exception import VimbaException
from . import vimba_c
-class VimbaFeature:
+class Feature:
"""
A feature of a Vimba object.
"""
diff --git a/pymba/vimba_frame.py b/pymba/frame.py
index 0832429..1e01333 100644
--- a/pymba/vimba_frame.py
+++ b/pymba/frame.py
@@ -6,7 +6,7 @@ try:
except ImportError:
warnings.warn('could not import numpy, some Frame methods may not work.')
-from .vimba_camera import VimbaCamera
+from .camera import Camera
from .vimba_exception import VimbaException
from . import vimba_c
@@ -62,7 +62,7 @@ class Frame:
A Vimba frame.
"""
- def __init__(self, camera: VimbaCamera):
+ def __init__(self, camera: Camera):
self._camera = camera
self._handle = camera.handle
diff --git a/pymba/vimba_interface.py b/pymba/interface.py
index 647aa44..a035b0a 100644
--- a/pymba/vimba_interface.py
+++ b/pymba/interface.py
@@ -5,7 +5,7 @@ from .vimba_exception import VimbaException
from . import vimba_c
-class VimbaInterface(VimbaObject):
+class Interface(VimbaObject):
"""
A Vimba interface object. This class provides the minimal access
to Vimba functions required to control the interface.
diff --git a/pymba/vimba_system.py b/pymba/system.py
index 407bef6..2cc6870 100644
--- a/pymba/vimba_system.py
+++ b/pymba/system.py
@@ -1,7 +1,7 @@
from .vimba_object import VimbaObject
-class VimbaSystem(VimbaObject):
+class System(VimbaObject):
"""
A Vimba system object. This class provides the minimal access to Vimba functions required to control the system.
"""
diff --git a/pymba/vimba.py b/pymba/vimba.py
index 0d6c6b5..1174c3d 100644
--- a/pymba/vimba.py
+++ b/pymba/vimba.py
@@ -2,9 +2,9 @@ from ctypes import byref, sizeof, c_uint32
from typing import List
from .vimba_exception import VimbaException
-from .vimba_system import VimbaSystem
-from .vimba_camera import VimbaCamera
-from .vimba_interface import VimbaInterface
+from .system import System
+from .camera import Camera
+from .interface import Interface
from . import vimba_c
@@ -17,7 +17,7 @@ class Vimba(object):
def __init__(self):
# create own system singleton object
- self._system = VimbaSystem()
+ self._system = System()
self._vmb_interface_infos = None
self._interfaces = {}
self._cameras = {}
@@ -38,7 +38,7 @@ class Vimba(object):
self.shutdown()
@property
- def system(self) -> VimbaSystem:
+ def system(self) -> System:
"""
Get the system object.
"""
@@ -172,7 +172,7 @@ class Vimba(object):
raise VimbaException(error)
return vmb_camera_info
- def get_interface(self, id_string) -> VimbaInterface:
+ def get_interface(self, id_string) -> Interface:
"""
Gets interface object based on interface ID string. Will not recreate interface object if it already exists.
:param id_string: the ID of the interface.
@@ -181,11 +181,11 @@ class Vimba(object):
if id_string in self.get_interface_ids():
# create it if it doesn't exist
if id_string not in self._interfaces:
- self._interfaces[id_string] = VimbaInterface(id_string)
+ self._interfaces[id_string] = Interface(id_string)
return self._interfaces[id_string]
raise VimbaException(VimbaException.ERR_INTERFACE_NOT_FOUND)
- def get_camera(self, camera_id: str) -> VimbaCamera:
+ def get_camera(self, camera_id: str) -> Camera:
"""
Gets camera object based on camera ID string. Will not recreate camera object if it already exists.
:param camera_id: the ID of the camera object to get. This can be an ID or e.g. a serial number. Check the Vimba
@@ -195,7 +195,7 @@ class Vimba(object):
if camera_id in self.get_camera_ids():
# create it if it doesn't exist
if camera_id not in self._cameras:
- self._cameras[camera_id] = VimbaCamera(camera_id)
+ self._cameras[camera_id] = Camera(camera_id)
return self._cameras[camera_id]
else:
# the given string might not be a camera ID -> check for other IDs
@@ -208,5 +208,5 @@ class Vimba(object):
camera_id_string = vmb_camera_info.id_string.decode()
if camera_id_string not in self._cameras:
- self._cameras[camera_id_string] = VimbaCamera(camera_id_string)
+ self._cameras[camera_id_string] = Camera(camera_id_string)
return self._cameras[camera_id_string]
diff --git a/pymba/vimba_c.py b/pymba/vimba_c.py
index ef547ae..b996720 100644
--- a/pymba/vimba_c.py
+++ b/pymba/vimba_c.py
@@ -3,8 +3,6 @@ import platform
import os
from ctypes import *
-from .vimba_exception import VimbaException
-
if sys_plat == "win32":
@@ -75,26 +73,6 @@ else:
CALLBACK_FUNCTYPE = CFUNCTYPE
-class MemoryBlock:
- """
- A memory block object for dealing neatly with C memory allocations.
- """
-
- @property
- def block(self):
- return c_void_p(addressof(self._block))
-
- def __init__(self, block_size):
- self._block = create_string_buffer(block_size)
-
- # this seems to be None if too much memory is requested
- if self._block is None:
- raise VimbaException(VimbaException.ERR_FRAME_BUFFER_MEMORY)
-
- def __del__(self):
- del self._block
-
-
class VmbVersionInfo(Structure):
_fields_ = [
('major', c_uint32),
diff --git a/pymba/vimba_object.py b/pymba/vimba_object.py
index 7199e61..f8d7c93 100644
--- a/pymba/vimba_object.py
+++ b/pymba/vimba_object.py
@@ -2,7 +2,7 @@ from ctypes import byref, sizeof, c_void_p, c_uint32, c_uint64, c_bool
from typing import Union, Tuple, List, Optional
from .vimba_exception import VimbaException
-from .vimba_feature import VimbaFeature
+from .feature import Feature
from . import vimba_c
@@ -35,7 +35,7 @@ class VimbaObject:
def __getattr__(self, attr):
# if a feature value requested (requires object (camera) open)
if attr in self.get_feature_names():
- return VimbaFeature(attr, self._handle).value
+ return Feature(attr, self._handle).value
# otherwise don't know about it
raise AttributeError(''.join(["'VimbaObject' has no attribute '", attr, "'"]))
@@ -51,7 +51,7 @@ class VimbaObject:
# if it's an actual camera feature (requires camera open)
elif attr in self.get_feature_names():
- VimbaFeature(attr, self._handle).value = val
+ Feature(attr, self._handle).value = val
# otherwise just set the attribute value as normal
else:
@@ -125,7 +125,7 @@ class VimbaObject:
list -- names of possible enum values (for enum features only).
"""
# shouldn't cache this
- return VimbaFeature(feature_name, self._handle).range
+ return Feature(feature_name, self._handle).range
def run_feature_command(self, feature_name: str) -> None:
"""