Skip to content

Allow custom priorities #275

@nkakouros

Description

@nkakouros

In the taskrc file, one can have:

uda.priority.values = H,M,,L,0
urgency.uda.priority.H.coefficient=20
urgency.uda.priority..coefficient=1.8
urgency.uda.priority.L.coefficient=-1
urgency.uda.priority.0.coefficient=-100

This works fine with task on the cli. Only thing not working is bash completion for the 0 priority.

In taskwiki, if I try to modify a task and assign 0 priority to it, I get:

Error invoking 'python_execute' on channel 3 (python3-script-host):                                                                                                                                                                          
Traceback (most recent call last):                                                                                                                                                                                                           
  File "<string>", line 1, in <module>                                                                                                                                                                                                       
  File "/home/nikos/.local/share/nvim/plugged/taskwiki/taskwiki/errors.py", line 26, in wrapped_function                                                                                                                                     
    original_function(*args, **kwargs)                                                                                                                                                                                                       
  File "/home/nikos/.local/share/nvim/plugged/taskwiki/taskwiki/main.py", line 222, in modify                                                                                                                                                
    cache().update_vwtasks_in_buffer()                                                                                                                                                                                                       
  File "/home/nikos/.local/share/nvim/plugged/taskwiki/taskwiki/cache.py", line 202, in update_vwtasks_in_buffer                                                                                                                             
    task.update_in_buffer()                                                                                                                                                                                                                  
  File "/home/nikos/.local/share/nvim/plugged/taskwiki/taskwiki/vwtask.py", line 321, in update_in_buffer                                                                                                                                    
    self.cache.buffer[self['line_number']] = str(self)                                                                                                                                                                                       
  File "/home/nikos/.local/share/nvim/plugged/taskwiki/taskwiki/vwtask.py", line 338, in __str__                                                                                                                                             
    ' ' + '!' * self.priority_from_tw_format if self['priority'] else '',                                                                                                                                                                    
  File "/home/nikos/.local/share/nvim/plugged/taskwiki/taskwiki/vwtask.py", line 244, in priority_from_tw_format                                                                                                                             
    return convert_priority_from_tw_format(self.task['priority'])                                                                                                                                                                            
  File "/home/nikos/.local/share/nvim/plugged/taskwiki/taskwiki/vwtask.py", line 15, in convert_priority_from_tw_format                                                                                                                      
    return {None: None, 'L': 1, 'M': 2, 'H': 3}[priority]                                                                                                                                                                                    
KeyError: '0'                                                                                                                                                                                                                                

The dict with the priorities should not be hardcoded, but read from the taskrc.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions