From 814b5644c360e03b452c89fd3c6a514117a95c10 Mon Sep 17 00:00:00 2001 From: Zsolt Kovari Date: Thu, 10 Oct 2024 11:04:40 +0200 Subject: [PATCH] remove --- src/main/python/plotlyst/view/widget/world/conceit.py | 2 ++ src/main/python/plotlyst/view/widget/world/editor.py | 10 +++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/main/python/plotlyst/view/widget/world/conceit.py b/src/main/python/plotlyst/view/widget/world/conceit.py index b6d432c21..31bb4db13 100644 --- a/src/main/python/plotlyst/view/widget/world/conceit.py +++ b/src/main/python/plotlyst/view/widget/world/conceit.py @@ -40,6 +40,8 @@ def __init__(self, conceit: WorldConceit, parent=None): super().__init__(parent, titleEditable=True, titleMaxWidth=150) self.conceit = conceit + self._removalEnabled = True + self._title.setIcon(IconRegistry.from_name(self.conceit.icon, '#510442')) self._title.setText(self.conceit.name) self._title.lineEdit.textEdited.connect(self._titleEdited) diff --git a/src/main/python/plotlyst/view/widget/world/editor.py b/src/main/python/plotlyst/view/widget/world/editor.py index 586065a1a..17e0cf95e 100644 --- a/src/main/python/plotlyst/view/widget/world/editor.py +++ b/src/main/python/plotlyst/view/widget/world/editor.py @@ -741,7 +741,7 @@ def __init__(self, novel: Novel, element: WorldBuildingEntityElement, parent=Non @overrides def resizeEvent(self, event: QResizeEvent) -> None: super().resizeEvent(event) - self._wdgEditor.updateGeometry() + self._wdgDisplay.updateGeometry() def refresh(self): clear_layout(self._wdgDisplay) @@ -773,12 +773,20 @@ def _initBubble(self, conceit: WorldConceit) -> ConceitBubble: bubble = ConceitBubble(conceit) bubble.nameEdited.connect(partial(self._conceitNameChanged, conceit)) bubble.textChanged.connect(self.save) + bubble.removed.connect(partial(self._conceitRemoved, bubble)) return bubble def _conceitNameChanged(self, conceit: WorldConceit): self._wdgTree.updateItem(conceit) self.save() + def _conceitRemoved(self, bubble: ConceitBubble): + self.novel.world.conceits.remove(bubble.conceit) + fade_out_and_gc(self._wdgDisplay, bubble) + + self._wdgTree.refresh() + self.save() + class SectionElementEditor(WorldBuildingEntityElementWidget): WORLD_BLOCK_MIMETYPE = 'application/world-block'