Changes between Version 1 and Version 2 of GettingThingsDone


Ignore:
Timestamp:
Mar 18, 2010 7:49:05 PM (8 years ago)
Author:
newacct
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • GettingThingsDone

    v1 v2  
    3434        editor.ReplaceSelection("\n")
    3535        for todo in todos:
    36           if str(todo[1])[:4] == "todo":   # filter out others (like done:)  should not include 5th char = ':'
     36          if str(todo[1]).startswith("todo"):   # filter out others (like done:)  should not include 5th char = ':'
    3737            editor.AddText(str(todo[0]))
    3838            editor.AddText("  ")
     
    5050        editor.ReplaceSelection("\n")
    5151        for todo in todos:
    52           if str(todo[1])[:4] == "wait":   # filter out others (like done:)  should not include 5th char = ':'
     52          if str(todo[1]).startswith("wait"):   # filter out others (like done:)  should not include 5th char = ':'
    5353            editor.AddText(str(todo[0]))
    5454            editor.AddText("  ")
    5555            editor.AddText(str(todo[1])[5:])
    5656            editor.AddText("\n")       
    57     pass
    5857
    5958}}}
     
    7170#!python
    7271def openedWikiWord(wikidPad, wikiWord):
    73     def customCompare(todo1, todo2):
    74         return cmp(todo1[1], todo2[1])
    7572    if wikiWord == "NextActions":
    7673        # editor = wikidPad.editor
    7774        editor = wikidPad.getActiveEditor()
    7875        todos = wikidPad.wikiData.getTodos()
    79         todos.sort(customCompare)
     76        todos.sort(key=lambda x:x[1])
    8077        #FindText returns start position or -1 if not found
    8178        s = editor.FindText(0, editor.GetLength(), "+++Actions from projects:", 0)
     
    9087          if mt != None:
    9188            context1t = mt.group(1)
    92           if (context1t != context2t):
     89          if context1t != context2t:
    9390            editor.AddText("\n++ @")
    9491            editor.AddText(context1t)
    9592            editor.AddText("\n")
    96           if str(todo[1])[:4] == "todo":   # filter out others (like done:)  should not include 5th char = ':'
     93          if str(todo[1]).startswith("todo"):   # filter out others (like done:)  should not include 5th char = ':'
    9794            editor.AddText(str(todo[0]))
    9895            editor.AddText("  ")
     
    103100        editor = wikidPad.getActiveEditor()
    104101        todos = wikidPad.wikiData.getTodos()
    105         todos.sort(customCompare)
     102        todos.sort(key=lambda x:x[1])
    106103        #FindText returns start position or -1 if not found
    107104        s = editor.FindText(0, editor.GetLength(), "+++Collected from projects:", 0)
     
    116113          if mw != None:
    117114            context1w = mw.group(1)
    118           if (context1w != context2w):
     115          if context1w != context2w:
    119116            editor.AddText("\n++ @")
    120117            editor.AddText(context1w)
    121118            editor.AddText("\n")
    122           if str(todo[1])[:4] == "wait":   # filter out others (like done:)  should not include 5th char = ':'
     119          if str(todo[1]).startswith("wait"):   # filter out others (like done:)  should not include 5th char = ':'
    123120            editor.AddText(str(todo[0]))
    124121            editor.AddText("  ")
    125122            editor.AddText(str(todo[1])[5:])
    126123            editor.AddText("\n") 
    127     pass
    128124}}}
    129125
     
    169165    wikiWord -- name of the wiki word to create
    170166    """
    171     if (wikiWord[:4].upper() == "TODO"):
     167    if wikiWord.upper().startswith("TODO"):
    172168        # tags contains the (Tag, TagHeader) pairs - customize the list of sort categories here:
    173169        # TagHeaders are the descriptive headings that will be shown for each category.
     
    195191        # get all todos with 'todo' in them to seperate list to be used here:
    196192        todosFull = wikidPad.wikiData.getTodos()
    197         todos = [todo for todo in todosFull if ('todo' in todo[1]) ] # and srchstr in todo[1]) ]
     193        todos = [todo for todo in todosFull if 'todo' in todo[1] ] # and srchstr in todo[1]) ]
    198194
    199195        #clean the page code - and insert the harvested todos after placemark = '++ auto-harvested todos:'
     
    213209            words = allTodo[0].split(".")
    214210            for word in words[1:]:
    215                 if not word in checkTags:
     211                if word not in checkTags:
    216212                    tags.append( ("_spec.SPACER","") )
    217213                    tags.append( (word,"Tagged "+word) )
    218214                    checkTags.append(word)
    219         tags = tags + tagEnd
     215        tags += tagEnd
    220216
    221217        for tag in tags:
     
    231227            elif tag[0] != '_spec.NOTAGS':
    232228                for todo in todos:
    233                     if (tag[0] in todo[1]):
     229                    if tag[0] in todo[1]:
    234230                        if not wroteHeader:
    235231                            editor.AddText('\n++ ' + tag[1] + ' :\n')
     
    334330                addedColor=0
    335331                for todo in todos:
    336                     if (tag[0] in todo[1]):
     332                    if tag[0] in todo[1]:
    337333                        if not wroteHeader:
    338                             if (len(tag)>2 and tag[2] != ''):
     334                            if len(tag)>2 and tag[2] != '':
    339335                                addedColor=1
    340336                                editor.AddText("\n<font color="+tag[2]+">\n")
     
    347343                        todos[todos.index(todo)] = ('DEL','DEL') #marks that todo to be ignored
    348344                        tagAdded = True
    349                 if (addedColor):
     345                if addedColor:
    350346                    editor.AddText("\n</font>\n")
    351347                    addedColor=0
     
    377373        editor.ReplaceSelection("\n")
    378374        for todo in todos:
    379           if str(todo[1])[:4] == "todo":   # filter out others (like done:)  should not include 5th char = ':'
     375          if str(todo[1]).startswith("todo"):   # filter out others (like done:)  should not include 5th char = ':'
    380376            editor.AddText(str(todo[0]))
    381377            editor.AddText("  ")
     
    394390        editor.ReplaceSelection("\n")
    395391        for todo in todos:
    396           if str(todo[1])[:4] == "wait":   # filter out others (like done:)  should not include 5th char = ':'
     392          if str(todo[1]).startswith("wait"):   # filter out others (like done:)  should not include 5th char = ':'
    397393            editor.AddText(str(todo[0]))
    398394            editor.AddText("  ")
    399395            editor.AddText(str(todo[1])[5:])
    400396            editor.AddText("\n")       
    401     pass
    402397}}}
    403398