Update note section of tutorial.txt.
authorW. Trevor King <wking@drexel.edu>
Sat, 7 Aug 2010 18:17:33 +0000 (14:17 -0400)
committerW. Trevor King <wking@drexel.edu>
Sat, 7 Aug 2010 18:17:33 +0000 (14:17 -0400)
Also replace empty strings with None during
hooke.util.convert._string_to_string() conversion to allow clearing
notes etc.

Also cleaned up docstrings in hooke.plugin.note to better reflect the
change made in commit 5e44aef4859c.

doc/tutorial.txt
hooke/plugin/note.py
hooke/util/convert.py

index b23a160c73c5ffc9a3ccf5bbbdc1d7efc606f332..58cb57f3bbfb847aafbc0441a55a96265226812c 100644 (file)
@@ -198,7 +198,7 @@ Taking notes
 ------------
 
 You can take notes about the curves you are looking at.  Just type
 ------------
 
 You can take notes about the curves you are looking at.  Just type
-``add_note`` followed by the text you want to append to that curve.
+``set_note`` followed by the text you want to attach to that curve.
 Hooke will save the text in your current playlist and in an external
 log file (TODO: no external file yet.  Is this important?).  The
 output will look like this::
 Hooke will save the text in your current playlist and in an external
 log file (TODO: no external file yet.  Is this important?).  The
 output will look like this::
@@ -220,8 +220,8 @@ will create sub-playlist :file:`c:\curves\nice.hkp`.  Make sure that
 the target directory (here :file:`c:\curves\`) already exists before
 doing that.
 
 the target directory (here :file:`c:\curves\`) already exists before
 doing that.
 
-If you change your mind about a note, you can remove it with
-``clear_note``.
+If you change your mind about a note, you can remove it by setting a
+blank note string with ``set_note ''``.
 
 Exporting curves
 ----------------
 
 Exporting curves
 ----------------
index b36c8013c84962e9c02fffa690d034d632bcccd4..eebf8c6368f2f48d6d95422110a35a7b4e3e7cb7 100644 (file)
@@ -34,7 +34,7 @@ class NotePlugin (Builtin):
 
 
 class SetNoteCommand (Command):
 
 
 class SetNoteCommand (Command):
-    """Add a note to one of several Hooke objects.
+    """Set the note on one of several Hooke objects.
     """
     def __init__(self, plugin):
         super(SetNoteCommand, self).__init__(
     """
     def __init__(self, plugin):
         super(SetNoteCommand, self).__init__(
@@ -59,7 +59,7 @@ The note text.
 
 
 class GetNoteCommand (Command):
 
 
 class GetNoteCommand (Command):
-    """Retrieve notes from one of several Hooke objects.
+    """Retrieve the note from one of several Hooke objects.
     """
     def __init__(self, plugin):
         super(GetNoteCommand, self).__init__(
     """
     def __init__(self, plugin):
         super(GetNoteCommand, self).__init__(
index 44955a574791a9fd04f6d717b2daae45a6960cdc..83ec76435d4f66301c9b7512c7f181c80a9e99e8 100644 (file)
@@ -3,14 +3,6 @@
 """Type conversion utilities.
 """
 
 """Type conversion utilities.
 """
 
-CONVERT_FROM_STRING = {
-    'string': lambda x: x,
-    'bool': lambda x: x == 'True',
-    'int': lambda x: int(x),
-    'float': lambda x: float(x),
-    }
-"""Functions converting strings to values, keyed by type.
-"""
 
 ANALOGS = {
     'file': 'string',
 
 ANALOGS = {
     'file': 'string',
@@ -63,6 +55,8 @@ def from_string(value, type, count=1):
     return fn(value)
 
 def _string_to_string(value):
     return fn(value)
 
 def _string_to_string(value):
+    if len(value) == 0:
+        return None
     return unicode(value)
 
 def _string_to_bool(value):
     return unicode(value)
 
 def _string_to_bool(value):