nowfocus 0.5.3__py3-none-any.whl → 0.5.5__py3-none-any.whl

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.
nowfocus/__main__.py CHANGED
@@ -97,11 +97,12 @@ class Application(Gtk.Application):
97
97
  self.open_task_window()
98
98
 
99
99
  # Testing
100
- # time.sleep(3)
100
+ # TODO: enable these automatically with dbg system
101
101
  # self.open_session_options_dialog('test_param')
102
102
  # self.open_settings_window() #for testing
103
103
  # self.open_new_task_dialog() #for testing
104
104
  # self.print_time_totals()
105
+ # self.new_task_dialog()
105
106
 
106
107
  signal.signal(signal.SIGINT, self.quit)
107
108
  signal.signal(signal.SIGUSR1, self.signal_handler)
nowfocus/task_window.py CHANGED
@@ -405,9 +405,10 @@ class TaskWindow(Gtk.Window):
405
405
  # self.r_sidebar.add_events(Gdk.EventMask.ENTER_NOTIFY_MASK)
406
406
  # self.r_sidebar.add_events(Gdk.EventMask.LEAVE_NOTIFY_MASK)
407
407
  # self.r_sidebar.connect("enter-notify-event",self.test)
408
-
408
+ # session = None, accepts_tasks = True, skip_top_level_lists = False, show_todolist_headers = True, deduplicate = False, truncate_labels_to_chars = 100
409
409
 
410
- self.l_sidebar.add(choose_from_lists(self.select_list_callback, 'None', None, False))
410
+ self.l_sidebar.add(choose_from_lists(
411
+ self.select_list_callback, 'None', None, accepts_tasks=False, skip_top_level_lists =True, show_todolist_headers=False, deduplicate=True, truncate_labels_to_chars=20))
411
412
 
412
413
  self.SessionEditDialog = SessionEditDialog # passed to show_sessions via self
413
414
  sidebar_sessions = get_sessions(use_sessions_timeframe_setting=False)
@@ -489,10 +490,11 @@ class TaskWindow(Gtk.Window):
489
490
 
490
491
  label = Gtk.Label()
491
492
 
493
+ if len(t['extended_label']) > 100:
494
+ t['extended_label'] = t['extended_label'][:100]+"…"
495
+
492
496
  extended_label = GLib.markup_escape_text(t['extended_label'])
493
497
 
494
- if len(extended_label) > 110:
495
- extended_label = extended_label[:110]+"..."
496
498
 
497
499
  if len(self.search_term) > 1:
498
500
 
nowfocus/utils.py CHANGED
@@ -1157,7 +1157,7 @@ def get_most_recent_list(session = None):
1157
1157
  return last_session[0]['parent_id']
1158
1158
 
1159
1159
 
1160
- def choose_from_lists(callback, selected_list_id = None, session = None, accepts_tasks = True):
1160
+ def choose_from_lists(callback, selected_list_id = None, session = None, accepts_tasks = True, skip_top_level_lists = False, show_todolist_headers = True, deduplicate = False, truncate_labels_to_chars = 100):
1161
1161
  ''' Returns a Gtk.ScrolledWindow widget with radio buttons'''
1162
1162
 
1163
1163
  # TODO: consider using TreeView https://lazka.github.io/pgi-docs/Gtk-3.0/classes/TreeView.html#Gtk.TreeView
@@ -1167,6 +1167,7 @@ def choose_from_lists(callback, selected_list_id = None, session = None, accepts
1167
1167
  selected_list_id = get_most_recent_list(session = None)
1168
1168
 
1169
1169
  box = Gtk.VBox()
1170
+ box.set_spacing(8)
1170
1171
 
1171
1172
  scrolled_window = Gtk.ScrolledWindow()
1172
1173
  scrolled_window.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)
@@ -1176,50 +1177,61 @@ def choose_from_lists(callback, selected_list_id = None, session = None, accepts
1176
1177
 
1177
1178
  todolist = None
1178
1179
 
1179
- where = " WHERE status = '1' "
1180
+ conditions = " "
1180
1181
 
1181
- if accepts_tasks:
1182
- where += " AND data like '%\"accepts_tasks\": true%' "
1183
- else:
1184
- # HACK: to not show op level lists
1185
- # TODO: think of a better way
1186
- where += " AND parent_label != '' "
1182
+ if skip_top_level_lists:
1183
+ conditions += " AND parent_label IS NOT NULL "
1187
1184
 
1185
+ if deduplicate:
1186
+ conditions += " GROUP BY extended_label "
1188
1187
 
1189
- lists = db_query("SELECT * FROM lists "+where+" ORDER BY todolist, extended_label ASC ", None, 'id')
1188
+ lists = db_query("SELECT lists.*, (SELECT start_time FROM sessions WHERE todolist = lists.todolist ORDER BY start_time DESC LIMIT 1 ) as last_session_on_todo FROM lists WHERE status = '1' "+conditions+" ORDER BY last_session_on_todo DESC, CASE WHEN parent_id IS NULL THEN 1 ELSE 2 END, extended_label ASC ", None, 'id')
1189
+
1190
+ r_button = None
1191
+ todolist_id = None
1190
1192
 
1191
1193
  for id, l in lists.items():
1192
- l['data'] = json.loads(l['data'])
1193
- # print("AddTask list ",l['label'])
1194
+ try:
1195
+ l['data'] = json.loads(l['data'])
1196
+ if len(l['label']) > truncate_labels_to_chars:
1197
+ l['label'] = l['label'][:truncate_labels_to_chars] + '…'
1198
+
1199
+ label = f'{" · " * l['extended_label'].count(' > ')}' + GLib.markup_escape_text(l['label'])
1200
+
1201
+ if todolist_id != l['todolist']:
1202
+ todolist_id = l['todolist']
1203
+ if show_todolist_headers:
1204
+ label = "<b>" + label + "</b>"
1205
+ if r_button:
1206
+ r_button.set_margin_bottom(20)
1207
+ else:
1208
+ continue
1194
1209
 
1195
- if todolist == None:
1196
- # initial button group
1197
- button_group = Gtk.RadioButton(label=l['label'])
1198
- item = button_group
1199
- else:
1200
- indent = len(get_lists_for_item(l)['ids'])
1201
- label = f'{" " * indent}' + l['label']
1202
- item = Gtk.RadioButton(label=GLib.markup_escape_text(label), group=button_group)
1210
+ label_widget = Gtk.Label()
1211
+ label_widget.set_halign(Gtk.Align.START)
1212
+ label_widget.set_markup(label)
1213
+
1214
+ if accepts_tasks and l['data']['accepts_tasks'] == False:
1215
+ label_widget.set_markup(' '+label)
1203
1216
 
1204
- if todolist != l['todolist']:
1205
- # new buttongroup for new todolist
1206
- todolist = l['todolist']
1207
- l['header'] = Gtk.Label()
1217
+ box.add(label_widget)
1208
1218
 
1209
- try:
1210
- l['header'].set_markup("<b>"+conf.user['todolists'][todolist]["label"]+"</b>")
1211
- except Exception as e:
1212
- dbg('Exception creating button group header for list',l, e=e, l=0)
1213
-
1214
- box.add(l['header'])
1215
-
1216
- if l['id'] == selected_list_id:
1217
- item.set_active(True)
1219
+ else:
1220
+ r_button = Gtk.RadioButton(group=r_button)
1221
+ r_button.add(label_widget)
1218
1222
 
1219
- item.connect("toggled", callback, l) #
1220
- box.add(item)
1223
+
1224
+ if l['id'] == selected_list_id:
1225
+ r_button.set_active(True)
1226
+
1227
+ r_button.connect("toggled", callback, l)
1228
+ box.add(r_button)
1229
+
1230
+ except Exception as e:
1231
+ dbg('Exception adding to choose_from_lists list', l, e=e, l=0)
1221
1232
 
1222
1233
  # TODO: allow a height argument to account for other things that require space, and possibly a global screen height value?
1234
+
1223
1235
  # Optimize the height, 27px per item with max of 700 px and a min of 50
1224
1236
  height = max(50,min(500, (len(lists) * 27)))
1225
1237
  scrolled_window.set_size_request(-1, height)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nowfocus
3
- Version: 0.5.3
3
+ Version: 0.5.5
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,5 +1,5 @@
1
1
  nowfocus/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
2
- nowfocus/__main__.py,sha256=kIJy1gd2FIZkXNqLdUYhjU7OSBKLYarieSw7f9PQA4U,33097
2
+ nowfocus/__main__.py,sha256=ow_EHA8LCeC6OG0PW-cMdHQuU6dcGedOyPec68mIb2U,33169
3
3
  nowfocus/conf.py,sha256=KV0iouYSSpYUITLlG-lPvmk1sHFVQsykwqmvb9wyTdk,6693
4
4
  nowfocus/example-todo.txt,sha256=o-ZRNiTlSGFbTK9jpdDIi07qHBrpvP0JhBZSk0VlpQU,246
5
5
  nowfocus/install.py,sha256=tcds4l6b492HTC7DfapatafgeMmDWvBfy8nwi1CjFXk,3040
@@ -9,9 +9,9 @@ nowfocus/session_options.py,sha256=mOnyEM3-usKgVvBhESY0TNBcy4FTG-AHP6ETMgB1fQ4,5
9
9
  nowfocus/sessions.csv,sha256=kYpr06yQg_J86NQ4AiYw4RnQchcw3ouPKVYa1lYDUNo,39
10
10
  nowfocus/settings.py,sha256=CZoSpFacxAs99Nq-NXNDKiBqjPSLPwg8bL5hcsi2a6E,35151
11
11
  nowfocus/styles.css,sha256=PG1SrLkwSSay8M2VKeRcE0UdK54ndsEDFnRLRkmP-9M,510
12
- nowfocus/task_window.py,sha256=Ypt3s8czczeoMTsAMbPW_zpFJlQq4uBU5x0ankPnZlg,29071
12
+ nowfocus/task_window.py,sha256=UIrHljw3IfnBjdK9idnzgB4cT6QfYY7PChCQhUR_0zI,29373
13
13
  nowfocus/user_idle_time.py,sha256=I44Ip-iGGzWAiHnM2_06jNqhCne9y1SbvcBI-nYBolU,2365
14
- nowfocus/utils.py,sha256=C2t3JPodSEfVdCHuroKpiH05Q5fV_vPfxyszN4cVoo0,50526
14
+ nowfocus/utils.py,sha256=OyLUTfUqODkMm_QtnQc65ihgCO-cbcMjAWbCKC2uePs,51147
15
15
  nowfocus/version_migrator.py,sha256=q8T1C8-DLOwUQUM5IPcMjPbVbsLTO4VsqADlAAXd9gw,628
16
16
  nowfocus/connectors/activitywatch.py,sha256=QbkOmjIOiVwccWc2xhhePd0Abww5vEiVpCNjeqOyYGg,921
17
17
  nowfocus/connectors/caldav.py,sha256=PeM_9yJC8W17L8Y5AyS75o6GfzTrPoMYKIvetND8T78,5089
@@ -52,9 +52,9 @@ nowfocus/icon/settings.svg,sha256=fgkGJouPPtZLxZn2nr_5pEp9MdhRSRaW9mtdxhJHDuQ,39
52
52
  nowfocus/sound/bell-xylophone-g.mp3,sha256=1OBcRWvD87AGNcq1uZFR8HqG0nanJykImERfVDVxHD4,53891
53
53
  nowfocus/sound/dinner-bell.mp3,sha256=hjjO0xqA4uXpYw9KLwwlBnrVfRhVq1K5OXzwlMXhRn4,113620
54
54
  nowfocus/sound/xylophone-chord.mp3,sha256=gwgBSqhMt5PMzT5N03Z6TvDgipQZfnkEz_o81Rq5Z1U,131806
55
- nowfocus-0.5.3.dist-info/licenses/LICENSE,sha256=fSJzoHs1EOCwEd7FIyokFeGEma7NKmTVEdHkCr5OIV4,35127
56
- nowfocus-0.5.3.dist-info/METADATA,sha256=N_QAlr4Ecm61b-0CKwc2YMPYkmJcFG2s94NHpGvrhzQ,6804
57
- nowfocus-0.5.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
58
- nowfocus-0.5.3.dist-info/entry_points.txt,sha256=RbYY19-irSoNVglNeNnL9D36cHft7aKsaEGEYoSH3pA,51
59
- nowfocus-0.5.3.dist-info/top_level.txt,sha256=3uLd9BwmfarZwqVUxkSJuVwJ8qHzjThte8rt_UYG7tE,9
60
- nowfocus-0.5.3.dist-info/RECORD,,
55
+ nowfocus-0.5.5.dist-info/licenses/LICENSE,sha256=fSJzoHs1EOCwEd7FIyokFeGEma7NKmTVEdHkCr5OIV4,35127
56
+ nowfocus-0.5.5.dist-info/METADATA,sha256=aGBt4lGMum7iyPyQGR283NutEy81KuhT3dpAYt51HuA,6804
57
+ nowfocus-0.5.5.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
58
+ nowfocus-0.5.5.dist-info/entry_points.txt,sha256=RbYY19-irSoNVglNeNnL9D36cHft7aKsaEGEYoSH3pA,51
59
+ nowfocus-0.5.5.dist-info/top_level.txt,sha256=3uLd9BwmfarZwqVUxkSJuVwJ8qHzjThte8rt_UYG7tE,9
60
+ nowfocus-0.5.5.dist-info/RECORD,,