From: W. Trevor King Date: Sat, 7 Aug 2010 18:17:33 +0000 (-0400) Subject: Update note section of tutorial.txt. X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=da88f72be5034c07efd8049c35a5e6c008d6a03a;p=hooke.git Update note section of tutorial.txt. 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. --- diff --git a/doc/tutorial.txt b/doc/tutorial.txt index b23a160..58cb57f 100644 --- a/doc/tutorial.txt +++ b/doc/tutorial.txt @@ -198,7 +198,7 @@ Taking notes ------------ 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:: @@ -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. -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 ---------------- diff --git a/hooke/plugin/note.py b/hooke/plugin/note.py index b36c801..eebf8c6 100644 --- a/hooke/plugin/note.py +++ b/hooke/plugin/note.py @@ -34,7 +34,7 @@ class NotePlugin (Builtin): 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__( @@ -59,7 +59,7 @@ The note text. 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__( diff --git a/hooke/util/convert.py b/hooke/util/convert.py index 44955a5..83ec764 100644 --- a/hooke/util/convert.py +++ b/hooke/util/convert.py @@ -3,14 +3,6 @@ """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', @@ -63,6 +55,8 @@ def from_string(value, type, count=1): return fn(value) def _string_to_string(value): + if len(value) == 0: + return None return unicode(value) def _string_to_bool(value):