nowfocus 0.4.4__tar.gz → 0.5.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. {nowfocus-0.4.4/src/nowfocus.egg-info → nowfocus-0.5.0}/PKG-INFO +1 -1
  2. {nowfocus-0.4.4 → nowfocus-0.5.0}/pyproject.toml +1 -1
  3. {nowfocus-0.4.4 → nowfocus-0.5.0}/src/nowfocus/__main__.py +1 -1
  4. {nowfocus-0.4.4 → nowfocus-0.5.0}/src/nowfocus/conf.py +2 -2
  5. {nowfocus-0.4.4 → nowfocus-0.5.0}/src/nowfocus/install.py +2 -2
  6. {nowfocus-0.4.4 → nowfocus-0.5.0}/src/nowfocus/task_window.py +1 -1
  7. {nowfocus-0.4.4 → nowfocus-0.5.0}/src/nowfocus/utils.py +79 -60
  8. {nowfocus-0.4.4 → nowfocus-0.5.0/src/nowfocus.egg-info}/PKG-INFO +1 -1
  9. {nowfocus-0.4.4 → nowfocus-0.5.0}/LICENSE +0 -0
  10. {nowfocus-0.4.4 → nowfocus-0.5.0}/README.md +0 -0
  11. {nowfocus-0.4.4 → nowfocus-0.5.0}/setup.cfg +0 -0
  12. {nowfocus-0.4.4 → nowfocus-0.5.0}/src/nowfocus/__init__.py +0 -0
  13. {nowfocus-0.4.4 → nowfocus-0.5.0}/src/nowfocus/connectors/activitywatch.py +0 -0
  14. {nowfocus-0.4.4 → nowfocus-0.5.0}/src/nowfocus/connectors/caldav.py +0 -0
  15. {nowfocus-0.4.4 → nowfocus-0.5.0}/src/nowfocus/connectors/csv.py +0 -0
  16. {nowfocus-0.4.4 → nowfocus-0.5.0}/src/nowfocus/connectors/psc_timetracker.py +0 -0
  17. {nowfocus-0.4.4 → nowfocus-0.5.0}/src/nowfocus/connectors/taskwarrior.py +0 -0
  18. {nowfocus-0.4.4 → nowfocus-0.5.0}/src/nowfocus/connectors/timewarrior.py +0 -0
  19. {nowfocus-0.4.4 → nowfocus-0.5.0}/src/nowfocus/connectors/todo_template.py +0 -0
  20. {nowfocus-0.4.4 → nowfocus-0.5.0}/src/nowfocus/connectors/todotxt.py +0 -0
  21. {nowfocus-0.4.4 → nowfocus-0.5.0}/src/nowfocus/connectors/trello.py +0 -0
  22. {nowfocus-0.4.4 → nowfocus-0.5.0}/src/nowfocus/connectors/txt.py +0 -0
  23. {nowfocus-0.4.4 → nowfocus-0.5.0}/src/nowfocus/connectors/vikunja.py +0 -0
  24. {nowfocus-0.4.4 → nowfocus-0.5.0}/src/nowfocus/desktop-extras/nowfocus.desktop +0 -0
  25. {nowfocus-0.4.4 → nowfocus-0.5.0}/src/nowfocus/desktop-extras/nowfocus.png +0 -0
  26. {nowfocus-0.4.4 → nowfocus-0.5.0}/src/nowfocus/desktop-extras/nowfocus.svg +0 -0
  27. {nowfocus-0.4.4 → nowfocus-0.5.0}/src/nowfocus/example-todo.txt +0 -0
  28. {nowfocus-0.4.4 → nowfocus-0.5.0}/src/nowfocus/icon/cancel.png +0 -0
  29. {nowfocus-0.4.4 → nowfocus-0.5.0}/src/nowfocus/icon/cancel.svg +0 -0
  30. {nowfocus-0.4.4 → nowfocus-0.5.0}/src/nowfocus/icon/edit.png +0 -0
  31. {nowfocus-0.4.4 → nowfocus-0.5.0}/src/nowfocus/icon/edit.svg +0 -0
  32. {nowfocus-0.4.4 → nowfocus-0.5.0}/src/nowfocus/icon/icon-0.svg +0 -0
  33. {nowfocus-0.4.4 → nowfocus-0.5.0}/src/nowfocus/icon/icon-1.svg +0 -0
  34. {nowfocus-0.4.4 → nowfocus-0.5.0}/src/nowfocus/icon/icon-2.svg +0 -0
  35. {nowfocus-0.4.4 → nowfocus-0.5.0}/src/nowfocus/icon/icon-3.svg +0 -0
  36. {nowfocus-0.4.4 → nowfocus-0.5.0}/src/nowfocus/icon/icon-4.svg +0 -0
  37. {nowfocus-0.4.4 → nowfocus-0.5.0}/src/nowfocus/icon/icon-5.svg +0 -0
  38. {nowfocus-0.4.4 → nowfocus-0.5.0}/src/nowfocus/icon/icon-6.svg +0 -0
  39. {nowfocus-0.4.4 → nowfocus-0.5.0}/src/nowfocus/icon/icon-7.svg +0 -0
  40. {nowfocus-0.4.4 → nowfocus-0.5.0}/src/nowfocus/icon/icon-8.svg +0 -0
  41. {nowfocus-0.4.4 → nowfocus-0.5.0}/src/nowfocus/icon/icon-9.svg +0 -0
  42. {nowfocus-0.4.4 → nowfocus-0.5.0}/src/nowfocus/icon/icon-red.svg +0 -0
  43. {nowfocus-0.4.4 → nowfocus-0.5.0}/src/nowfocus/icon/icon.svg +0 -0
  44. {nowfocus-0.4.4 → nowfocus-0.5.0}/src/nowfocus/icon/mark-done.png +0 -0
  45. {nowfocus-0.4.4 → nowfocus-0.5.0}/src/nowfocus/icon/mark-done.svg +0 -0
  46. {nowfocus-0.4.4 → nowfocus-0.5.0}/src/nowfocus/icon/pause.png +0 -0
  47. {nowfocus-0.4.4 → nowfocus-0.5.0}/src/nowfocus/icon/pause.svg +0 -0
  48. {nowfocus-0.4.4 → nowfocus-0.5.0}/src/nowfocus/icon/settings.png +0 -0
  49. {nowfocus-0.4.4 → nowfocus-0.5.0}/src/nowfocus/icon/settings.svg +0 -0
  50. {nowfocus-0.4.4 → nowfocus-0.5.0}/src/nowfocus/new_task_dialog.py +0 -0
  51. {nowfocus-0.4.4 → nowfocus-0.5.0}/src/nowfocus/session_edit_dialog.py +0 -0
  52. {nowfocus-0.4.4 → nowfocus-0.5.0}/src/nowfocus/session_options.py +0 -0
  53. {nowfocus-0.4.4 → nowfocus-0.5.0}/src/nowfocus/sessions.csv +0 -0
  54. {nowfocus-0.4.4 → nowfocus-0.5.0}/src/nowfocus/settings.py +0 -0
  55. {nowfocus-0.4.4 → nowfocus-0.5.0}/src/nowfocus/sound/bell-xylophone-g.mp3 +0 -0
  56. {nowfocus-0.4.4 → nowfocus-0.5.0}/src/nowfocus/sound/dinner-bell.mp3 +0 -0
  57. {nowfocus-0.4.4 → nowfocus-0.5.0}/src/nowfocus/sound/xylophone-chord.mp3 +0 -0
  58. {nowfocus-0.4.4 → nowfocus-0.5.0}/src/nowfocus/styles.css +0 -0
  59. {nowfocus-0.4.4 → nowfocus-0.5.0}/src/nowfocus/user_idle_time.py +0 -0
  60. {nowfocus-0.4.4 → nowfocus-0.5.0}/src/nowfocus/version_migrator.py +0 -0
  61. {nowfocus-0.4.4 → nowfocus-0.5.0}/src/nowfocus.egg-info/SOURCES.txt +0 -0
  62. {nowfocus-0.4.4 → nowfocus-0.5.0}/src/nowfocus.egg-info/dependency_links.txt +0 -0
  63. {nowfocus-0.4.4 → nowfocus-0.5.0}/src/nowfocus.egg-info/entry_points.txt +0 -0
  64. {nowfocus-0.4.4 → nowfocus-0.5.0}/src/nowfocus.egg-info/requires.txt +0 -0
  65. {nowfocus-0.4.4 → nowfocus-0.5.0}/src/nowfocus.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nowfocus
3
- Version: 0.4.4
3
+ Version: 0.5.0
4
4
  Summary: nowfocus: the open source task-tracking self-control panel.
5
5
  Author: AltruistEnterprises
6
6
  Project-URL: Homepage, https://www.nowfocus.org
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "nowfocus"
3
- version = "0.4.4"
3
+ version = "0.5.0"
4
4
  authors = [
5
5
  { name="AltruistEnterprises" },
6
6
  ]
@@ -437,7 +437,7 @@ class Application(Gtk.Application):
437
437
  self.task_running_menu_additions()
438
438
 
439
439
  self.menu.show_all()
440
- print("task data",task_data['data'])
440
+ dbg("Starting",task_data['extended_label'])
441
441
 
442
442
  if task_data['id'] in conf.user['task_commands']:
443
443
  command_data = conf.user['task_commands'][task_data['id']]
@@ -162,8 +162,8 @@ for key, val in prototype_settings.items():
162
162
  # print(json.dumps(connectors['todolists'], indent=4))
163
163
 
164
164
 
165
- with open(settings_file,"w") as settings_file:
166
- json.dump(user, settings_file)
165
+ with open(settings_file,"w") as file:
166
+ json.dump(user, file)
167
167
 
168
168
  todo_connectors = {}
169
169
  timetracker_connectors = {}
@@ -62,11 +62,11 @@ def db_init():
62
62
 
63
63
  # , tags TEXT
64
64
 
65
- db_query("CREATE TABLE sessions (start_time TEXT, duration INTEGER, task_id TEXT, parent_id TEXT, todolist TEXT, extended_label TEXT, notes TEXT, timetracker TEXT);")
65
+ db_query("CREATE TABLE sessions (start_time TEXT, duration INTEGER, task_id TEXT, parent_id TEXT, todolist TEXT, extended_label TEXT, notes TEXT, priority INTEGER DEFAULT 0, timetracker TEXT);")
66
66
 
67
67
  db_query("CREATE TABLE system (field TEXT PRIMARY KEY NOT NULL, value TEXT);")
68
68
 
69
- db_query("INSERT INTO system(field, value) VALUES('db_schema_version', '0.4')")
69
+ db_query("INSERT INTO system(field, value) VALUES('db_schema_version', '0.5')")
70
70
 
71
71
 
72
72
  def copy_desktop_integration_files():
@@ -390,7 +390,7 @@ class TaskWindow(Gtk.Window):
390
390
  self.r_sidebar.set_size_request(350, -1)
391
391
 
392
392
  focus_percent_label = Gtk.Label()
393
- focus_percent_label.set_markup("<b>Focus: "+str(utils.get_percent_time_focused())+"%</b>")
393
+ focus_percent_label.set_markup("<b>"+str(utils.get_percent_time_focused())+"% Focused. "+str(utils.get_percent_time_priority())+"% Priority Tasks</b>")
394
394
  self.r_sidebar.pack_start(focus_percent_label, False, True, 25)
395
395
 
396
396
  self.sessions_scrolledwindow = Gtk.ScrolledWindow()
@@ -30,72 +30,45 @@ notify.init(conf.app_name)
30
30
  lists = {}
31
31
 
32
32
 
33
- def dbg(*data, **kwargs):
34
- ''' Any number of positional args then kwargs
35
- l=level {-1: Default output, 0:Error, 1:Warning, 2:Info, 3:Details}
36
-
37
- s=system (Debuggable systems: 'taskwindow','signals','todoloading','user_settings', 'targets')
38
-
39
- If the optional 'notify' arg is true, a notification will be generated.
40
-
41
- if the optional 'e' arg is present and an exception object its traceback will be printed
33
+ def dbg(*data, s="", l=2, e=None, notify=None):
34
+ ''' Any number of positional args optionally
35
+ l: level {-1: Default output, 0:Error, 1:Warning, 2:Info, 3:Details}
36
+ s: system (Debuggable systems: 'taskwindow','signals','todoloading','user_settings', 'targets', 'performance')
37
+ notify: Show a notification with the content of notify.
38
+ e (Exception object) traceback will be printed
42
39
 
43
40
  '''
44
41
 
45
42
  levels = {-1:'', 0:'Error', 1:'Warning', 2:'Info', 3:'Details'}
46
43
 
47
- # default system and level
48
- system = ''
49
- level = 2
50
-
51
- if 's' in kwargs: system = kwargs['s']
44
+ system = s
45
+ level = int(l)
52
46
 
53
- if 'l' in kwargs: level = int(kwargs['l'])
54
-
55
- if 'e' in kwargs and isinstance(kwargs['e'],Exception):
56
- print(data)
57
- traceback.print_tb(kwargs['e'].__traceback__)
58
47
 
59
48
  if "all" in conf.debug_systems or system in conf.debug_systems or level <= conf.debug_level:
60
49
 
61
- if 'notify' in kwargs:
62
- # Will this cause a segfault if called from a bg thread?
63
- notify.Notification.new(conf.app_name+" "+levels[level], str(kwargs['notify']), None).show()
50
+ if notify:
51
+ notify.Notification.new(conf.app_name+" "+levels[level], str(notify), None).show()
64
52
 
65
- # o = "Debug "+system+" "+levels[level], tuple(filter(None,data))
66
53
  filter(None,data)
67
54
  if len(data) == 1:
68
55
  data = data[0]
69
56
  if system:
70
57
  system = "- "+system
71
58
 
72
- print(data, system+" "+levels[level])
73
-
74
- # if isinstance(data,str):
75
- # # print('str dbg data')
76
- # print(data, system+" "+levels[level])
77
- # else:
78
- # print('dbg data',type(data),len(data))
79
- # print(data)
80
- # # o = tuple(filter(None,data)), "("+system+" "+levels[level]+")"
81
- # o = data, system+" "+levels[level]
82
- # pretty_print(o)
59
+ print(json.dumps(data,indent=2), system+" "+levels[level])
83
60
 
84
61
  # else:
85
- # # debug the debug
86
- # print("Not displaying dbg ")
87
- # # pretty_print(data)
62
+ # print("Not displaying dbg s:",system,'conf.debug_systems',conf.debug_systems)
63
+ # pretty_print(data)
88
64
 
65
+ if e and isinstance(e,Exception):
66
+ traceback.print_tb(e.__traceback__)
89
67
 
90
68
  def error_notice(title, details = None, e = None):
91
69
  print('ERROR',title,details,e)
92
-
93
70
  notify.Notification.new(str(title),str(details), None).show()
94
71
 
95
- # try:
96
- # raise FileExistsError("This is not except-able!")
97
- # except Exception as e:
98
- # dbg('test exception',e=e)
99
72
 
100
73
  def pretty_dict(i, item_sep = ", ", use_indents=True, indent=''):
101
74
  o = ''
@@ -128,15 +101,19 @@ def pretty_print(i):
128
101
 
129
102
 
130
103
  def timeit(process=None):
104
+ # if 'performance' in conf.debug_systems or conf.debug_level >= 2:
131
105
  if not process:
132
106
  process = inspect.currentframe().f_back.f_code.co_name
133
107
 
134
108
  if process in conf.timers.keys():
135
- print('timeit', process, time.time() - conf.timers[process])
109
+ timer = time.time() - conf.timers[process]
110
+ dbg(process, 'took', timer, 'seconds', s='performance',l=2)
136
111
  del conf.timers[process]
112
+ return timer
137
113
  else:
138
- print('timeit', process, 'started')
114
+ dbg(process, 'performance timer started',s='performance',l=3)
139
115
  conf.timers[process] = time.time()
116
+ return process
140
117
 
141
118
 
142
119
  def time_to_sec(time=None):
@@ -385,14 +362,12 @@ def db_schema_update():
385
362
 
386
363
  db_query("ALTER TABLE sessions ADD COLUMN extended_label TEXT")
387
364
 
388
- # add default values for priority and data
389
365
  # Since these column are just a cache, replace instead of copying columns
390
366
  db_query("ALTER TABLE tasks DROP COLUMN priority")
391
367
  db_query("ALTER TABLE tasks DROP COLUMN data")
392
368
  db_query("ALTER TABLE lists DROP COLUMN priority")
393
369
  db_query("ALTER TABLE lists DROP COLUMN data")
394
370
 
395
- # add new columns
396
371
  db_query("ALTER TABLE lists ADD COLUMN priority INTEGER DEFAULT 0")
397
372
  db_query("ALTER TABLE lists ADD COLUMN data TEXT DEFAULT '{}'")
398
373
  db_query("ALTER TABLE tasks ADD COLUMN priority INTEGER DEFAULT 0")
@@ -419,16 +394,31 @@ def db_schema_update():
419
394
  print('adding timetracker column to session table')
420
395
 
421
396
  for todolist_id, todo in conf.user['todolists'].items():
422
- print("set timetracker to ",todo['timetracker'], " for sessions from ",todolist_id)
423
-
424
397
  db_query("UPDATE sessions SET timetracker = ? WHERE todolist = ?",(todo['timetracker'],todolist_id) )
425
398
 
426
399
  db_schema_version = 0.4
427
400
 
428
- # if db_schema_version == 0.4:
401
+ if db_schema_version == 0.4:
402
+ print('Adding priority column to session table')
403
+
404
+ db_query("ALTER TABLE sessions ADD COLUMN priority INTEGER DEFAULT 0")
405
+
406
+ for session in db_query("SELECT DISTINCT task_id, extended_label FROM sessions"):
407
+ t = db_get_item_by_id(session['task_id'],dgb_error_level_for_failure=3)
408
+ if t and t['priority'] > 0:
409
+ print("setting",session['extended_label']," session priority to ",t['priority'] )
410
+
411
+ db_query("UPDATE sessions SET priority = ? WHERE task_id = ?",(t['priority'],session['task_id']))
412
+
413
+ print("Total hours priority sessions",round(divide(db_query("SELECT SUM(duration) as total FROM sessions WHERE priority > 0")[0]['total'],3600),2))
414
+ db_query("REPLACE INTO system(field, value) VALUES('db_schema_version', '0.5')")
415
+
416
+ db_schema_version = 0.5
417
+
418
+ # if db_schema_version == 0.5:
429
419
  # db_query("ALTER TABLE tasks ADD COLUMN tags TEXT DEFAULT '{}'")
430
420
  # db_query("REPLACE INTO system(field, value) VALUES('db_schema_version', '0.5')")
431
- # db_schema_version = 0.5
421
+ # db_schema_version = 0.6
432
422
 
433
423
 
434
424
  dbg('db_schema_version', db_schema_version,s='db')
@@ -694,10 +684,10 @@ def db_cleanup(widget = None):
694
684
  print('Relinking',s['task_id'],'to', match['id'])
695
685
  db_query("UPDATE sessions SET task_id = ?, parent_id = ? WHERE task_id = ?",(match['id'],match['parent_id'],s['task_id']))
696
686
  # print(pretty_print(possible_matches))
697
- else:
687
+ # else:
698
688
  # not very good yet...
699
- search = db_query("SELECT *, rank FROM taskindex WHERE extended_label MATCH ? ORDER BY rank DESC",(s['extended_label'].replace('>','').replace('?',''),))
700
- print('fuzzy search results',(search,))
689
+ # search = db_query("SELECT *, rank FROM taskindex WHERE extended_label MATCH ? ORDER BY rank DESC",(s['extended_label'].replace('>','').replace('?',''),))
690
+ # print('fuzzy search results',(search,))
701
691
 
702
692
  # update extended_labels
703
693
  # mismatched_sessions = db_query("SELECT * FROM sessions WHERE extended_label NOT IN (SELECT extended_label FROM tasks)")
@@ -710,7 +700,7 @@ def db_cleanup(widget = None):
710
700
 
711
701
  # exit()
712
702
 
713
- def db_get_item_by_id(id,table = 'tasks'):
703
+ def db_get_item_by_id(id,table = 'tasks',dgb_error_level_for_failure=0):
714
704
 
715
705
  if table in ['task','list']:
716
706
  table = table+'s'
@@ -724,11 +714,11 @@ def db_get_item_by_id(id,table = 'tasks'):
724
714
  if data:
725
715
  return proc_db_item(data[0],table)
726
716
  else:
727
- dbg('db_get_item_by_id from '+table+' failed for id +',id,l=0)
717
+ dbg('db_get_item_by_id from '+table+' failed for id',id,l=dgb_error_level_for_failure)
728
718
  return {}
729
719
 
730
720
  except Exception as e:
731
- dbg('db_get_item_by_id failed',e,l=0)
721
+ dbg('db_get_item_by_id failed',e,l=dgb_error_level_for_failure)
732
722
 
733
723
 
734
724
  def get_todo_by_id(todo_or_todo_id = None):
@@ -765,6 +755,7 @@ def db_get_todolist(todolist_id):
765
755
 
766
756
 
767
757
  def db_save_session(session):
758
+ dbg("db_save_session",session)
768
759
  prepared_session = {
769
760
  'start_time' : str(session['start_time'].strftime("%Y-%m-%d %H:%M:%S")),
770
761
  'duration': round(session['duration']),
@@ -774,9 +765,13 @@ def db_save_session(session):
774
765
  'extended_label': str(session['extended_label']),
775
766
  'timetracker': str(session['timetracker']),
776
767
  'notes': str(session['notes']),
768
+ 'priority': "0",
777
769
  }
770
+
771
+ if 'priority' in session['task']:
772
+ prepared_session['priority']: str(session['task']['priority'])
778
773
 
779
- db_query("INSERT INTO sessions(start_time, duration, task_id, parent_id, todolist, extended_label,timetracker, notes) VALUES(:start_time, :duration, :task_id, :parent_id, :todolist, :extended_label, :timetracker, :notes )",prepared_session)
774
+ db_query("INSERT INTO sessions(start_time, duration, task_id, parent_id, todolist, extended_label,timetracker, notes, priority) VALUES(:start_time, :duration, :task_id, :parent_id, :todolist, :extended_label, :timetracker, :notes, :priority )",prepared_session)
780
775
 
781
776
  reindex(session['task'])
782
777
 
@@ -803,6 +798,18 @@ def default_session():
803
798
  return o
804
799
 
805
800
 
801
+ def get_sessions(conditions_sql = None, order_by = 'start_time', limit = 35, use_sessions_timeframe_setting = False):
802
+
803
+ conditions = ''
804
+
805
+ if conditions_sql:
806
+ conditions += " AND "+conditions_sql
807
+
808
+ if use_sessions_timeframe_setting:
809
+ conditions += " AND "+sessions_timeframe_sql()
810
+
811
+ return db_query(" SELECT * FROM sessions WHERE 1=1 "+conditions+" ORDER BY "+order_by+" DESC LIMIT ? ",(limit,))
812
+
806
813
 
807
814
  def show_sessions(widget = None, self = None, sessions_box = None, label_text = "Most Recent Sessions", order_by = 'start_time', limit = 35, passed_sessions = None, truncate = None ):
808
815
 
@@ -844,6 +851,7 @@ def show_sessions(widget = None, self = None, sessions_box = None, label_text =
844
851
 
845
852
  sessions_box.show_all()
846
853
 
854
+
847
855
  def db_set_session_cache(s):
848
856
  ''' Add active session to system db table. Not to be confused with db_save_session '''
849
857
  db_session = copy.deepcopy(s)
@@ -889,12 +897,24 @@ def get_percent_time_focused():
889
897
 
890
898
  focus_seconds = db_query("SELECT SUM(duration) as seconds FROM sessions WHERE sessions.task_id != 'Randomness' AND "+ sessions_timeframe_sql())[0]['seconds']
891
899
 
892
- percent = round(divide(focus_seconds,(focus_seconds + rand_seconds)) * 100, 2)
900
+ percent = round(divide(focus_seconds,(focus_seconds + rand_seconds)) * 100)
893
901
 
894
902
  dbg('get_percent_time_focused', str(percent)+"%", 'focus_seconds', focus_seconds, 'rand_seconds', rand_seconds)
895
903
 
896
904
  return percent
897
905
 
906
+ def get_percent_time_priority():
907
+
908
+ priority_seconds = db_query("SELECT SUM(duration) as seconds FROM sessions WHERE sessions.task_id = 'Randomness' AND "+ sessions_timeframe_sql())[0]['seconds']
909
+
910
+ total_seconds = db_query("SELECT SUM(duration) as seconds FROM sessions WHERE "+ sessions_timeframe_sql())[0]['seconds']
911
+
912
+ percent = round(divide(priority_seconds,(total_seconds)) * 100)
913
+
914
+ dbg('get_percent_time_focused', str(percent)+"%", 'focus_seconds', priority_seconds, 'rand_seconds', total_seconds)
915
+
916
+ return percent
917
+
898
918
 
899
919
  def get_recent_tasks(count = 15):
900
920
  data = db_query("SELECT DISTINCT tasks.* FROM tasks JOIN sessions ON sessions.task_id = tasks.id WHERE tasks.status = 1 GROUP BY tasks.id ORDER BY MAX(sessions.start_time) DESC LIMIT ?",(count,))
@@ -1067,7 +1087,6 @@ def handle_todo_file_read_error(todo_conf,e):
1067
1087
  dbg(todo_conf['label']+ " Deactivated",e,l=-1,notify=True)
1068
1088
 
1069
1089
 
1070
-
1071
1090
  def get_todolists(use_db_cache = False):
1072
1091
  tasks = {}
1073
1092
  lists = {}
@@ -1261,7 +1280,7 @@ def add_todos_to_menu(target_menu = None, menu_tasks = None, list_menus = None,
1261
1280
  list_menus[l['parent_id']].append(list_menu_items[list_id])
1262
1281
 
1263
1282
  except Exception as e:
1264
- dbg('Error adding list to menu',l,e=e,l=0)
1283
+ dbg('Error adding list to menu',l['extended_label'],e=e,l=0,s='menu')
1265
1284
 
1266
1285
 
1267
1286
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nowfocus
3
- Version: 0.4.4
3
+ Version: 0.5.0
4
4
  Summary: nowfocus: the open source task-tracking self-control panel.
5
5
  Author: AltruistEnterprises
6
6
  Project-URL: Homepage, https://www.nowfocus.org
File without changes
File without changes
File without changes