From 5b70216ad66fde38894f3641873f0e7ee1bc2c4e Mon Sep 17 00:00:00 2001 From: Zsolt Kovari Date: Thu, 10 Oct 2024 13:51:22 +0200 Subject: [PATCH] color --- src/main/python/plotlyst/core/domain.py | 4 ++-- src/main/python/plotlyst/view/widget/world/conceit.py | 6 +++++- src/main/python/plotlyst/view/widget/world/editor.py | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/main/python/plotlyst/core/domain.py b/src/main/python/plotlyst/core/domain.py index acac63db9..51d36b544 100644 --- a/src/main/python/plotlyst/core/domain.py +++ b/src/main/python/plotlyst/core/domain.py @@ -2184,8 +2184,8 @@ class WorldConceit: type: WorldConceitType id: uuid.UUID = field(default_factory=uuid.uuid4) text: str = field(default='', metadata=config(exclude=exclude_if_empty)) - icon: str = '' - icon_color: str = 'black' + icon: str = field(default='', metadata=config(exclude=exclude_if_empty)) + icon_color: str = field(default='', metadata=config(exclude=exclude_if_empty)) children: List['WorldConceit'] = field(default_factory=list, metadata=config(exclude=exclude_if_empty)) @overrides diff --git a/src/main/python/plotlyst/view/widget/world/conceit.py b/src/main/python/plotlyst/view/widget/world/conceit.py index 21a377982..2f4cd027e 100644 --- a/src/main/python/plotlyst/view/widget/world/conceit.py +++ b/src/main/python/plotlyst/view/widget/world/conceit.py @@ -45,7 +45,8 @@ def __init__(self, conceit: WorldConceit, parent=None): self._removalEnabled = True icon = self.conceit.icon if self.conceit.icon else self.conceit.type.icon() - self._title.setIcon(IconRegistry.from_name(icon, '#510442')) + color = self.conceit.icon_color if self.conceit.icon_color else '#510442' + self._title.setIcon(IconRegistry.from_name(icon, color)) self._title.setText(self.conceit.name) self._title.lineEdit.textEdited.connect(self._titleEdited) self._title.iconChanged.connect(self._iconChanged) @@ -70,6 +71,9 @@ def _textChanged(self): def _iconChanged(self, icon: str, color: str): self.conceit.icon = icon + if color == 'black' or color == '#000000': + color = '#510442' + self._title.setIcon(IconRegistry.from_name(icon, color)) self.conceit.icon_color = color self.iconChanged.emit() diff --git a/src/main/python/plotlyst/view/widget/world/editor.py b/src/main/python/plotlyst/view/widget/world/editor.py index 1187adf38..a3dbd3940 100644 --- a/src/main/python/plotlyst/view/widget/world/editor.py +++ b/src/main/python/plotlyst/view/widget/world/editor.py @@ -685,7 +685,7 @@ def __init__(self, novel: Novel, element: WorldBuildingEntityElement, parent=Non self._splitter.setChildrenCollapsible(False) self._splitter.setHandleWidth(10) self._splitter.setProperty('framed', True) - self._splitter.setSizes([150, 500]) + self._splitter.setSizes([100, 500]) self._wdgEditor.layout().addWidget(self._splitter) self._wdgTree = ConceitsTreeView(novel)