Skip to content

Commit

Permalink
Show parent's title & children count in "Open Parent" button tooltip
Browse files Browse the repository at this point in the history
This allows checking at a glance if the current task blocks a project.

Fixes #1027
  • Loading branch information
nekohayo authored and diegogangl committed Apr 11, 2024
1 parent 51933c0 commit 1b95fe1
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions GTG/gtk/editor/editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -471,8 +471,17 @@ def refresh_editor(self, title=None, refreshtext=False):
if self.task.parent:
# Translators: Button label to open the parent task
self.parent_button.set_label(_('Open Parent'))
# TODO: preview the parent task's title here:
self.parent_button.set_tooltip_markup(_('View the Parent Task'))
__tip_contents = _('View the Parent Task:')
__tip_contents += f'\n<small><i>{self.task.parent.title}</i></small>'
__nb_siblings = len(self.task.parent.children) - 1
if __nb_siblings > 0:
__tip_contents += "\n\n"
__tip_contents += ngettext('That parent task also has <b>%(nb)d</b> other child.',
'That parent task also has <b>%(nb)d</b> other children.',
__nb_siblings) % {'nb': __nb_siblings}

self.parent_button.set_tooltip_markup(__tip_contents)

else:
# Translators: Button label to add an new parent task
self.parent_button.set_label(_('Add Parent'))
Expand Down

0 comments on commit 1b95fe1

Please sign in to comment.