sidebar: Don't set headers on child TagRows

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This commit is contained in:
Anna Schumaker 2021-07-03 09:39:56 -04:00
parent f477f8f12a
commit 3362029123
2 changed files with 9 additions and 0 deletions

View File

@ -106,3 +106,9 @@ class ParentTagBox(TagBox):
def child_tag_removed(self, tag):
self.bus.board(self.on_child_tag_removed, tag)
def header_func(self, cur, prev):
if isinstance(cur, tagrow.ParentTagRow):
if prev and not isinstance(prev, tagrow.ParentTagRow):
prev = prev.tag.parent.widgets
super().header_func(cur, prev)

View File

@ -161,3 +161,6 @@ class TestParentTagBox(unittest.TestCase):
self.assertEqual(ptbox[0], tag.widgets)
self.assertEqual(ptbox[1], tag1.widgets)
self.assertEqual(ptbox[2], tag2.widgets)
self.assertIsNone(tag1.widgets.get_header())
self.assertIsNone(tag2.widgets.get_header())