Fix tags crash with preview hidden; Ctrl+B toggles the sidebar

This commit is contained in:
sarah committed 2026-09-24 23:23:07 +02:00
1 parent 4c8d272719
commit 3cb1f416fb
5 files changed
+45 -7

No files matched your search

+14 -3
View File
@@ -165,14 +165,24 @@ class DevicesPanel(ft.Container):
self.DeviceTiles: dict[str, ft.ListTile] = {}
self.RefreshScheduled = False
self.Busy: set[str] = set() # devices being mounted/ejected right now
self.Unmounted = False
self.List = ft.ListView(spacing=0)
self.List.controls = self._BuildTiles()
super().__init__(content=self.List, padding=0)
def did_mount(self) -> None:
self.Unmounted = False
self.page.run_task(self._Start)
def will_unmount(self) -> None:
# The sidebar gets rebuilt when its settings change; close this panel's
# D-Bus connection so old panels don't pile up listening to udisks2.
self.Unmounted = True
if self.Client is not None:
self.Client.Bus.disconnect()
self.Client = None
async def _Start(self) -> None:
try:
self.Client = await UDisksClient.Connect()
@@ -184,20 +194,21 @@ class DevicesPanel(ft.Container):
await self._Refresh(IsStartup=True)
async def _PollLoop(self) -> None:
while True:
while not self.Unmounted:
self._Show(ListFallbackDevices())
await asyncio.sleep(PollInterval)
def _ScheduleRefresh(self) -> None:
# One plug-in fires a burst of signals; refresh once per burst.
if not self.RefreshScheduled:
if not self.RefreshScheduled and not self.Unmounted:
self.RefreshScheduled = True
self.page.run_task(self._DelayedRefresh)
async def _DelayedRefresh(self) -> None:
await asyncio.sleep(0.25)
self.RefreshScheduled = False
await self._Refresh()
if self.Client is not None and not self.Unmounted:
await self._Refresh()
async def _Refresh(self, IsStartup: bool = False) -> None:
try: