More cleanups to Setting/Argument type handling, mostly for count != 1.
[hooke.git] / hooke / driver / __init__.py
index 0ae0add0a2102ccff2d27cc7ee9863094c9a1326..4e37d79f07e16cf804782ffd70623031e2d8d92c 100644 (file)
@@ -2,15 +2,15 @@
 #
 # This file is part of Hooke.
 #
 #
 # This file is part of Hooke.
 #
-# Hooke is free software: you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation, either
-# version 3 of the License, or (at your option) any later version.
+# Hooke is free software: you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
 #
 #
-# Hooke is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU Lesser General Public License for more details.
+# Hooke is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+# or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General
+# Public License for more details.
 #
 # You should have received a copy of the GNU Lesser General Public
 # License along with Hooke.  If not, see
 #
 # You should have received a copy of the GNU Lesser General Public
 # License along with Hooke.  If not, see
@@ -24,6 +24,8 @@ commercial force spectroscopy microscopes are provided, and it's easy
 to write your own to handle your lab's specific format.
 """
 
 to write your own to handle your lab's specific format.
 """
 
+import logging
+
 from ..config import Setting
 from ..util.pluggable import IsSubclass, construct_graph
 
 from ..config import Setting
 from ..util.pluggable import IsSubclass, construct_graph
 
@@ -31,13 +33,12 @@ from ..util.pluggable import IsSubclass, construct_graph
 DRIVER_MODULES = [
 #    ('csvdriver', True),
 #    ('hdf5', True),
 DRIVER_MODULES = [
 #    ('csvdriver', True),
 #    ('hdf5', True),
-#    ('hemingclamp', True),
-#    ('jpk', True),
+    ('hemingway', True),
+    ('jpk', True),
 #    ('mcs', True),
 #    ('mfp1dexport', True),
 #    ('mcs', True),
 #    ('mfp1dexport', True),
-#    ('mfp3d', True),
+    ('mfp3d', True),
     ('picoforce', True),
     ('picoforce', True),
-#    ('picoforcealt', True),
     ('tutorial', True),
     ('wtk', True),
 ]
     ('tutorial', True),
     ('wtk', True),
 ]
@@ -50,10 +51,10 @@ DRIVER_SETTING_SECTION = 'drivers'
 """
 
 
 """
 
 
-class Driver(object):
+class Driver (object):
     """Base class for file format drivers.
     
     """Base class for file format drivers.
     
-    :attr:`name` identifies your driver, and should match the module
+    :attr:`name` identifies your driver and should match the module
     name.
     """
     def __init__(self, name):
     name.
     """
     def __init__(self, name):
@@ -80,16 +81,22 @@ class Driver(object):
         """
         return False
 
         """
         return False
 
-    def read(self, path):
+    def read(self, path, info=None):
         """Read data from `path` and return a
         ([:class:`hooke.curve.Data`, ...], `info`) tuple.
 
         """Read data from `path` and return a
         ([:class:`hooke.curve.Data`, ...], `info`) tuple.
 
+        The input `info` :class:`dict` may contain attributes read
+        from the :class:`~hooke.playlist.FilePlaylist`.
+
         The `info` :class:`dict` must contain values for the keys:
         'filetype' and 'experiment'.  See :class:`hooke.curve.Curve`
         for details.
         """
         raise NotImplementedError
 
         The `info` :class:`dict` must contain values for the keys:
         'filetype' and 'experiment'.  See :class:`hooke.curve.Curve`
         for details.
         """
         raise NotImplementedError
 
+    def logger(self):
+        return logging.getLogger('hooke')
+
 # Construct driver dependency graph and load default drivers.
 
 DRIVER_GRAPH = construct_graph(
 # Construct driver dependency graph and load default drivers.
 
 DRIVER_GRAPH = construct_graph(
@@ -110,7 +117,8 @@ def default_settings():
         settings.append(Setting(
                 section=DRIVER_SETTING_SECTION,
                 option=driver.name,
         settings.append(Setting(
                 section=DRIVER_SETTING_SECTION,
                 option=driver.name,
-                value=str(default_include),
+                value=default_include,
+                type='bool',
                 help=help,
                 ))
     for dnode in DRIVER_GRAPH:
                 help=help,
                 ))
     for dnode in DRIVER_GRAPH: