Skip to content

Commit

Permalink
Avoid duplicate tabs when logging out/in
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Oct 27, 2023
1 parent bd26b1b commit 9ade551
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
8 changes: 8 additions & 0 deletions koordinates/gui/explore_tab_bar.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,14 @@ def _explore_sections_retrieved(self, sections: List[ExploreSection]):
if sip.isdeleted(self):
return

# clear out old explore section tabs
for i in range(self.count()-1, -1, -1):
if self.tabData(i) not in (
StandardExploreModes.Browse,
StandardExploreModes.Publishers
):
self.removeTab(i)

for section in sections:
if section.slug == 'popular':
# special case for popular, should always be first tab
Expand Down
6 changes: 6 additions & 0 deletions koordinates/gui/filter_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,12 @@ def _explore_sections_retrieved(self, sections: List[ExploreSection]):
if sip.isdeleted(self):
return

# clear out old explore section tabs
for button in self.explore_buttons:
self.explore_buttons_layout.removeWidget(button)
button.deleteLater()
self.explore_buttons = []

default_section = None
for section in sections:

Expand Down

0 comments on commit 9ade551

Please sign in to comment.