Add 'block names' argument to 'curve info'.
authorW. Trevor King <wking@drexel.edu>
Thu, 2 Sep 2010 10:26:00 +0000 (06:26 -0400)
committerW. Trevor King <wking@drexel.edu>
Thu, 2 Sep 2010 10:26:00 +0000 (06:26 -0400)
Many commands key off the block name, so there should be a way for the
user to determine what the block names are.

hooke/plugin/curve.py

index 20d4e5e32e4cbf99d3f4c1debd757a341a417540..dbdace99c68c73b88e3c0ac4a7d9ca0d3c1fb90f 100644 (file)
@@ -293,7 +293,8 @@ class InfoCommand (CurveCommand):
                      help='Get all curve information.'),
             ]
         self.fields = ['name', 'path', 'experiment', 'driver', 'filetype',
                      help='Get all curve information.'),
             ]
         self.fields = ['name', 'path', 'experiment', 'driver', 'filetype',
-                       'note', 'command stack', 'blocks', 'block sizes']
+                       'note', 'command stack', 'blocks', 'block names',
+                       'block sizes']
         for field in self.fields:
             args.append(Argument(
                     name=field, type='bool', default=False, count=1,
         for field in self.fields:
             args.append(Argument(
                     name=field, type='bool', default=False, count=1,
@@ -343,6 +344,9 @@ class InfoCommand (CurveCommand):
     def _get_blocks(self, curve):
         return len(curve.data)
 
     def _get_blocks(self, curve):
         return len(curve.data)
 
+    def _get_block_names(self, curve):
+        return [block.info['name'] for block in curve.data]
+
     def _get_block_sizes(self, curve):
         return [block.shape for block in curve.data]
 
     def _get_block_sizes(self, curve):
         return [block.shape for block in curve.data]