Repository: lutris/lutris

Issue:
When a new runner is installed, the sidebar may be corrupted
### Bug description

Installing a runner may leave the sidebar in a corrupted state, with misplaced headers. Restarting Lutris corrects this.

What is happening, I think, is that the header_func that sets up the headers does not *remove* the header row from rows that are no longer at the top of the section- so the same header is attached to two rows. This seems to draw the header in one slot, and leave the other slot blank.

This header_func needs to remove the header from where it does not belong, not just add it where it does belong.

### How to Reproduce

Go into Preferences and install "Citra"- I expect other runners could do this. Once it has installed, observe that sidebar shows a gap in it. See attached media. The "Runners" header is below the new runner, not above it, and a blank space is above it.

I pick "Citra" because it will appear above all other runners, due to alphabetical order. I think it needs to be the new first runner.

### Expected behavior

I expect the "Runners" header to move above "Citra" here, and disappear from where it was.

### Log output

```shell
INFO     2021-12-23 19:05:51,532 [startup.check_driver:53]:Using NVIDIA drivers 470.86 for x86_64
INFO     2021-12-23 19:05:51,532 [startup.check_driver:57]:GPU: NVIDIA GeForce RTX 3060
INFO     2021-12-23 19:05:51,532 [startup.check_driver:73]:GPU: 10DE:2503 196E:1377 (nvidia drivers)
WARNING  2021-12-23 19:05:51,640 [dll_manager.versions:38]:Loading of DXVK versions failed, defaulting to locally available versions
WARNING  2021-12-23 19:05:51,640 [dll_manager.versions:38]:Loading of DXVK versions failed, defaulting to locally available versions
WARNING  2021-12-23 19:05:51,640 [dll_manager.versions:38]:Loading of DXVK versions failed, defaulting to locally available versions
WARNING  2021-12-23 19:05:51,640 [dll_manager.versions:38]:Loading of VKD3D versions failed, defaulting to locally available versions
WARNING  2021-12-23 19:05:51,641 [dll_manager.versions:38]:Loading of VKD3D versions failed, defaulting to locally available versions
WARNING  2021-12-23 19:05:51,641 [dll_manager.versions:38]:Loading of VKD3D versions failed, defaulting to locally available versions
WARNING  2021-12-23 19:05:51,641 [dll_manager.versions:38]:Loading of D3D Extras versions failed, defaulting to locally available versions
WARNING  2021-12-23 19:05:51,641 [dll_manager.versions:38]:Loading of D3D Extras versions failed, defaulting to locally available versions
WARNING  2021-12-23 19:05:51,641 [dll_manager.versions:38]:Loading of D3D Extras versions failed, defaulting to locally available versions
WARNING  2021-12-23 19:05:51,641 [dll_manager.versions:38]:Loading of DXVK-NVAPI versions failed, defaulting to locally available versions
WARNING  2021-12-23 19:05:51,641 [dll_manager.versions:38]:Loading of DXVK-NVAPI versions failed, defaulting to locally available versions
WARNING  2021-12-23 19:05:51,641 [dll_manager.versions:38]:Loading of DXVK-NVAPI versions failed, defaulting to locally available versions
WARNING  2021-12-23 19:05:51,642 [dll_manager.versions:38]:Loading of DXVK versions failed, defaulting to locally available versions
WARNING  2021-12-23 19:05:51,643 [dll_manager.versions:38]:Loading of DXVK versions failed, defaulting to locally available versions
WARNING  2021-12-23 19:05:51,643 [dll_manager.versions:38]:Loading of DXVK versions failed, defaulting to locally available versions
WARNING  2021-12-23 19:05:51,643 [dll_manager.versions:38]:Loading of VKD3D versions failed, defaulting to locally available versions
WARNING  2021-12-23 19:05:51,643 [dll_manager.versions:38]:Loading of VKD3D versions failed, defaulting to locally available versions
WARNING  2021-12-23 19:05:51,643 [dll_manager.versions:38]:Loading of VKD3D versions failed, defaulting to locally available versions
WARNING  2021-12-23 19:05:51,643 [dll_manager.versions:38]:Loading of D3D Extras versions failed, defaulting to locally available versions
WARNING  2021-12-23 19:05:51,643 [dll_manager.versions:38]:Loading of D3D Extras versions failed, defaulting to locally available versions
WARNING  2021-12-23 19:05:51,643 [dll_manager.versions:38]:Loading of D3D Extras versions failed, defaulting to locally available versions
WARNING  2021-12-23 19:05:51,643 [dll_manager.versions:38]:Loading of DXVK-NVAPI versions failed, defaulting to locally available versions
WARNING  2021-12-23 19:05:51,643 [dll_manager.versions:38]:Loading of DXVK-NVAPI versions failed, defaulting to locally available versions
WARNING  2021-12-23 19:05:51,643 [dll_manager.versions:38]:Loading of DXVK-NVAPI versions failed, defaulting to locally available versions
WARNING  2021-12-23 19:05:51,645 [dll_manager.versions:38]:Loading of DXVK versions failed, defaulting to locally available versions
WARNING  2021-12-23 19:05:51,645 [dll_manager.versions:38]:Loading of DXVK versions failed, defaulting to locally available versions
WARNING  2021-12-23 19:05:51,645 [dll_manager.versions:38]:Loading of DXVK versions failed, defaulting to locally available versions
WARNING  2021-12-23 19:05:51,645 [dll_manager.versions:38]:Loading of VKD3D versions failed, defaulting to locally available versions
WARNING  2021-12-23 19:05:51,645 [dll_manager.versions:38]:Loading of VKD3D versions failed, defaulting to locally available versions
WARNING  2021-12-23 19:05:51,645 [dll_manager.versions:38]:Loading of VKD3D versions failed, defaulting to locally available versions
WARNING  2021-12-23 19:05:51,645 [dll_manager.versions:38]:Loading of D3D Extras versions failed, defaulting to locally available versions
WARNING  2021-12-23 19:05:51,645 [dll_manager.versions:38]:Loading of D3D Extras versions failed, defaulting to locally available versions
WARNING  2021-12-23 19:05:51,645 [dll_manager.versions:38]:Loading of D3D Extras versions failed, defaulting to locally available versions
WARNING  2021-12-23 19:05:51,646 [dll_manager.versions:38]:Loading of DXVK-NVAPI versions failed, defaulting to locally available versions
WARNING  2021-12-23 19:05:51,646 [dll_manager.versions:38]:Loading of DXVK-NVAPI versions failed, defaulting to locally available versions
WARNING  2021-12-23 19:05:51,646 [dll_manager.versions:38]:Loading of DXVK-NVAPI versions failed, defaulting to locally available versions
WARNING  2021-12-23 19:05:51,647 [dll_manager.versions:38]:Loading of DXVK versions failed, defaulting to locally available versions
WARNING  2021-12-23 19:05:51,647 [dll_manager.versions:38]:Loading of DXVK versions failed, defaulting to locally available versions
WARNING  2021-12-23 19:05:51,647 [dll_manager.versions:38]:Loading of DXVK versions failed, defaulting to locally available versions
WARNING  2021-12-23 19:05:51,648 [dll_manager.versions:38]:Loading of VKD3D versions failed, defaulting to locally available versions
WARNING  2021-12-23 19:05:51,648 [dll_manager.versions:38]:Loading of VKD3D versions failed, defaulting to locally available versions
WARNING  2021-12-23 19:05:51,648 [dll_manager.versions:38]:Loading of VKD3D versions failed, defaulting to locally available versions
WARNING  2021-12-23 19:05:51,648 [dll_manager.versions:38]:Loading of D3D Extras versions failed, defaulting to locally available versions
WARNING  2021-12-23 19:05:51,648 [dll_manager.versions:38]:Loading of D3D Extras versions failed, defaulting to locally available versions
WARNING  2021-12-23 19:05:51,648 [dll_manager.versions:38]:Loading of D3D Extras versions failed, defaulting to locally available versions
WARNING  2021-12-23 19:05:51,648 [dll_manager.versions:38]:Loading of DXVK-NVAPI versions failed, defaulting to locally available versions
WARNING  2021-12-23 19:05:51,648 [dll_manager.versions:38]:Loading of DXVK-NVAPI versions failed, defaulting to locally available versions
WARNING  2021-12-23 19:05:51,648 [dll_manager.versions:38]:Loading of DXVK-NVAPI versions failed, defaulting to locally available versions
WARNING  2021-12-23 19:05:51,656 [dll_manager.versions:38]:Loading of DXVK versions failed, defaulting to locally available versions
WARNING  2021-12-23 19:05:51,656 [dll_manager.versions:38]:Loading of DXVK versions failed, defaulting to locally available versions
WARNING  2021-12-23 19:05:51,656 [dll_manager.versions:38]:Loading of DXVK versions failed, defaulting to locally available versions
WARNING  2021-12-23 19:05:51,656 [dll_manager.versions:38]:Loading of VKD3D versions failed, defaulting to locally available versions
WARNING  2021-12-23 19:05:51,656 [dll_manager.versions:38]:Loading of VKD3D versions failed, defaulting to locally available versions
WARNING  2021-12-23 19:05:51,656 [dll_manager.versions:38]:Loading of VKD3D versions failed, defaulting to locally available versions
WARNING  2021-12-23 19:05:51,656 [dll_manager.versions:38]:Loading of D3D Extras versions failed, defaulting to locally available versions
WARNING  2021-12-23 19:05:51,656 [dll_manager.versions:38]:Loading of D3D Extras versions failed, defaulting to locally available versions
WARNING  2021-12-23 19:05:51,656 [dll_manager.versions:38]:Loading of D3D Extras versions failed, defaulting to locally available versions
WARNING  2021-12-23 19:05:51,656 [dll_manager.versions:38]:Loading of DXVK-NVAPI versions failed, defaulting to locally available versions
WARNING  2021-12-23 19:05:51,657 [dll_manager.versions:38]:Loading of DXVK-NVAPI versions failed, defaulting to locally available versions
WARNING  2021-12-23 19:05:51,657 [dll_manager.versions:38]:Loading of DXVK-NVAPI versions failed, defaulting to locally available versions
WARNING  2021-12-23 19:05:51,658 [dll_manager.versions:38]:Loading of DXVK versions failed, defaulting to locally available versions
WARNING  2021-12-23 19:05:51,658 [dll_manager.versions:38]:Loading of DXVK versions failed, defaulting to locally available versions
WARNING  2021-12-23 19:05:51,658 [dll_manager.versions:38]:Loading of DXVK versions failed, defaulting to locally available versions
WARNING  2021-12-23 19:05:51,658 [dll_manager.versions:38]:Loading of VKD3D versions failed, defaulting to locally available versions
WARNING  2021-12-23 19:05:51,658 [dll_manager.versions:38]:Loading of VKD3D versions failed, defaulting to locally available versions
WARNING  2021-12-23 19:05:51,658 [dll_manager.versions:38]:Loading of VKD3D versions failed, defaulting to locally available versions
WARNING  2021-12-23 19:05:51,658 [dll_manager.versions:38]:Loading of D3D Extras versions failed, defaulting to locally available versions
WARNING  2021-12-23 19:05:51,658 [dll_manager.versions:38]:Loading of D3D Extras versions failed, defaulting to locally available versions
WARNING  2021-12-23 19:05:51,659 [dll_manager.versions:38]:Loading of D3D Extras versions failed, defaulting to locally available versions
WARNING  2021-12-23 19:05:51,659 [dll_manager.versions:38]:Loading of DXVK-NVAPI versions failed, defaulting to locally available versions
WARNING  2021-12-23 19:05:51,659 [dll_manager.versions:38]:Loading of DXVK-NVAPI versions failed, defaulting to locally available versions
WARNING  2021-12-23 19:05:51,659 [dll_manager.versions:38]:Loading of DXVK-NVAPI versions failed, defaulting to locally available versions
WARNING  2021-12-23 19:05:51,660 [dll_manager.versions:38]:Loading of DXVK versions failed, defaulting to locally available versions
WARNING  2021-12-23 19:05:51,661 [dll_manager.versions:38]:Loading of DXVK versions failed, defaulting to locally available versions
WARNING  2021-12-23 19:05:51,661 [dll_manager.versions:38]:Loading of DXVK versions failed, defaulting to locally available versions
WARNING  2021-12-23 19:05:51,661 [dll_manager.versions:38]:Loading of VKD3D versions failed, defaulting to locally available versions
WARNING  2021-12-23 19:05:51,661 [dll_manager.versions:38]:Loading of VKD3D versions failed, defaulting to locally available versions
WARNING  2021-12-23 19:05:51,661 [dll_manager.versions:38]:Loading of VKD3D versions failed, defaulting to locally available versions
WARNING  2021-12-23 19:05:51,661 [dll_manager.versions:38]:Loading of D3D Extras versions failed, defaulting to locally available versions
WARNING  2021-12-23 19:05:51,661 [dll_manager.versions:38]:Loading of D3D Extras versions failed, defaulting to locally available versions
WARNING  2021-12-23 19:05:51,661 [dll_manager.versions:38]:Loading of D3D Extras versions failed, defaulting to locally available versions
WARNING  2021-12-23 19:05:51,661 [dll_manager.versions:38]:Loading of DXVK-NVAPI versions failed, defaulting to locally available versions
WARNING  2021-12-23 19:05:51,661 [dll_manager.versions:38]:Loading of DXVK-NVAPI versions failed, defaulting to locally available versions
WARNING  2021-12-23 19:05:51,661 [dll_manager.versions:38]:Loading of DXVK-NVAPI versions failed, defaulting to locally available versions
WARNING  2021-12-23 19:05:51,663 [dll_manager.versions:38]:Loading of DXVK versions failed, defaulting to locally available versions
WARNING  2021-12-23 19:05:51,663 [dll_manager.versions:38]:Loading of DXVK versions failed, defaulting to locally available versions
WARNING  2021-12-23 19:05:51,663 [dll_manager.versions:38]:Loading of DXVK versions failed, defaulting to locally available versions
WARNING  2021-12-23 19:05:51,663 [dll_manager.versions:38]:Loading of VKD3D versions failed, defaulting to locally available versions
WARNING  2021-12-23 19:05:51,663 [dll_manager.versions:38]:Loading of VKD3D versions failed, defaulting to locally available versions
WARNING  2021-12-23 19:05:51,663 [dll_manager.versions:38]:Loading of VKD3D versions failed, defaulting to locally available versions
WARNING  2021-12-23 19:05:51,663 [dll_manager.versions:38]:Loading of D3D Extras versions failed, defaulting to locally available versions
WARNING  2021-12-23 19:05:51,663 [dll_manager.versions:38]:Loading of D3D Extras versions failed, defaulting to locally available versions
WARNING  2021-12-23 19:05:51,664 [dll_manager.versions:38]:Loading of D3D Extras versions failed, defaulting to locally available versions
WARNING  2021-12-23 19:05:51,664 [dll_manager.versions:38]:Loading of DXVK-NVAPI versions failed, defaulting to locally available versions
WARNING  2021-12-23 19:05:51,664 [dll_manager.versions:38]:Loading of DXVK-NVAPI versions failed, defaulting to locally available versions
WARNING  2021-12-23 19:05:51,664 [dll_manager.versions:38]:Loading of DXVK-NVAPI versions failed, defaulting to locally available versions
DEBUG    2021-12-23 19:05:51,677 [lutriswindow.update_store:451]:Showing 25 games
INFO     2021-12-23 19:05:56,274 [application.do_shutdown:631]:Shutting down Lutris
```


### System Information

```shell
[System]
OS:              Pop!_OS 21.10 impish
Arch:            x86_64
Kernel:          5.15.8-76051508-generic
Desktop:         GNOME
Display Server:  x11

[CPU]
Vendor:          AuthenticAMD
Model:           AMD Ryzen 7 5800X 8-Core Processor
Physical cores:  8
Logical cores:   16

[Memory]
RAM:             31.4 GB
Swap:            0.0 GB

[Graphics]
Vendor:          NVIDIA Corporation
OpenGL Renderer: NVIDIA GeForce RTX 3060/PCIe/SSE2
OpenGL Version:  4.6.0 NVIDIA 470.86
OpenGL Core:     4.6.0 NVIDIA 470.86
OpenGL ES:       OpenGL ES 3.2 NVIDIA 470.86
Vulkan:          Supported
```


### Media (optional)

![Screenshot from 2021-12-23 18-58-48](https://user-images.githubusercontent.com/6507403/147300734-afc87bbc-c3a7-4e88-9800-c4e79bcf937f.png)


### Checklist:

- [X] I'm not asking for support with a game or the wine runner.
- [X] I have followed the above mentioned guides and have all the graphics and wine dependencies installed.
- [X] I have checked for existing issues that describe my problem prior to opening this one.
- [X] I understand that improperly formatted bug reports may be closed without explanation.


Discussion:

Resolving patch:
diff --git a/lutris/gui/widgets/sidebar.py b/lutris/gui/widgets/sidebar.py
--- a/lutris/gui/widgets/sidebar.py
+++ b/lutris/gui/widgets/sidebar.py
@@ -368,8 +368,6 @@ def _filter_func(self, row):
         return row.id in self.active_platforms
 
     def _header_func(self, row, before):
-        if row.get_header():
-            return
         if not before:
             row.set_header(self.row_headers["library"])
         elif before.type in ("category", "dynamic_category") and row.type == "service":
@@ -378,6 +376,8 @@ def _header_func(self, row, before):
             row.set_header(self.row_headers["runners"])
         elif before.type == "runner" and row.type == "platform":
             row.set_header(self.row_headers["platforms"])
+        else:
+            row.set_header(None)
 
     def update(self, *_args):
         self.installed_runners = [runner.name for runner in runners.get_installed()]


Test patch: