fix: use remove() instead of difference() for self collision checks

This commit is contained in:
Travis Abendshien
2025-02-17 15:39:43 -08:00
parent fe94d84b94
commit d11b514bab
2 changed files with 7 additions and 2 deletions

View File

@@ -3,6 +3,8 @@
# Created for TagStudio: https://github.com/CyanVoxel/TagStudio
import contextlib
import structlog
from PySide6.QtCore import Qt, Signal
from PySide6.QtGui import QColor
@@ -320,7 +322,8 @@ class BuildColorPanel(PanelWidget):
groups = self.lib.tag_color_groups
colors = groups.get(self.color_group.namespace, [])
self.known_colors = {c.slug for c in colors}
self.known_colors = self.known_colors.difference(self.color_group.slug)
with contextlib.suppress(KeyError):
self.known_colors.remove(self.color_group.slug)
def update_preview_text(self):
self.preview_button.button.setText(

View File

@@ -3,6 +3,7 @@
# Created for TagStudio: https://github.com/CyanVoxel/TagStudio
import contextlib
from uuid import uuid4
import structlog
@@ -110,7 +111,8 @@ class BuildNamespacePanel(PanelWidget):
namespaces = self.lib.namespaces
self.known_namespaces = {n.namespace for n in namespaces}
if self.namespace:
self.known_namespaces = self.known_namespaces.difference(self.namespace.namespace)
with contextlib.suppress(KeyError):
self.known_namespaces.remove(self.namespace.namespace)
def on_text_changed(self):
slug = ""