Refactor task activation

 * Reuse and simplificate the code
 * Fix minor issues
Fixes in PSP metrics due task activation:

 * Clean up PSP metrics on task deactivation
 * Do not track time if task is suspended
Avoid camera sensor time traking if task is suspended
Fix debugger pipe encoding (provisional)
Fix task description textbox resizing
Fix unicode issue in psp defect summary
Mimic get dict method in database row
Don't load task from GitHub on startup (use internal db)
Add shelve like dict database container
Fix database insert and update issues
Fix database shelve setdefault and minimal tests
Store PSP in the database (instead of pickle shelves) & minor refactory
Fix to force database sync in shelve-like dict