Logo Search packages:      
Sourcecode: yagtd version File versions

def yagtd::GTD::do_edit (   self,
  id 
)

Interactively edit task given by #id:
GTD> edit #id
GTD edit> My task to edit. @context p:Project

Definition at line 428 of file yagtd.py.

00428                          : 
        """Interactively edit task given by #id:
        GTD> edit #id
        GTD edit> My task to edit. @context p:Project""" 
        
        try: 
            import readline 
        except ImportError: 
            print "Cannot edit without the 'readline' module!" 
            return 
        
        # Parse command line 
        idx = self._parse_args(id)[0] 
        
        if not idx: 
            return 
        
        task = self.todo.find('id', idx) 
        if not task: 
            return 
        
        def pre_input_hook(): 
            readline.insert_text(self._dump_line(task)) 
            readline.redisplay() 
        
            # Unset the hook again 
            readline.set_pre_input_hook(None) 
        
        readline.set_pre_input_hook(pre_input_hook) 
        
        line = raw_input("GTD edit> ") 
        # Remove edited line from history: 
        #   oddly, get_history_item is 1-based,
        #   but remove_history_item is 0-based 
        readline.remove_history_item(readline.get_current_history_length() - 1) 
        self._replace(idx, line)
        print "Task #%d updated" % idx
        


Generated by  Doxygen 1.6.0   Back to index