Fix an issue with the priority list sorting;

"move to top/bottom" buttons no longer desync the in-GUI list, and the underlaying settings list
This commit is contained in:
DevilXD committed 2026-02-15 12:14:17 +01:00
1 parent 226cf3ff8f
commit f0b96b059c
1 file changed
+12 -10
+12 -10
View File
@@ -1971,19 +1971,21 @@ class SettingsPanel:
or amount < 0 and idx == max_idx or amount < 0 and idx == max_idx
): ):
return return
swap_idx: int = idx - amount insert_idx: int = idx - amount
if swap_idx <= 0: if insert_idx <= 0:
swap_idx = 0 insert_idx = 0
elif swap_idx >= max_idx: elif insert_idx >= max_idx:
swap_idx = max_idx insert_idx = max_idx
item: str = self._priority_list.get(idx) item: str = self._priority_list.get(idx)
self._priority_list.delete(idx) self._priority_list.delete(idx)
self._priority_list.insert(swap_idx, item) self._priority_list.insert(insert_idx, item)
# reselect the item and scroll the list if needed # reselect the item and scroll the list if needed
self._priority_list.selection_set(swap_idx) self._priority_list.selection_set(insert_idx)
self._priority_list.see(swap_idx) self._priority_list.see(insert_idx)
p = self._settings.priority # update the underlying settings list too
p[idx], p[swap_idx] = p[swap_idx], p[idx] self._settings.priority.pop(idx)
self._settings.priority.insert(insert_idx, item)
self._settings.alter() self._settings.alter()
def priority_delete(self) -> None: def priority_delete(self) -> None: