From 7a9382b175ad6ca6ce9bf52849039120f3f7aec2 Mon Sep 17 00:00:00 2001 From: Zsolt Kovari Date: Mon, 4 Sep 2023 12:23:49 +0200 Subject: [PATCH] more relation types --- .../view/widget/character/network/editor.py | 44 +++++++++++++++---- .../python/plotlyst/view/widget/characters.py | 2 +- 2 files changed, 37 insertions(+), 9 deletions(-) diff --git a/src/main/python/plotlyst/view/widget/character/network/editor.py b/src/main/python/plotlyst/view/widget/character/network/editor.py index 53ed2e908..972c7a94b 100644 --- a/src/main/python/plotlyst/view/widget/character/network/editor.py +++ b/src/main/python/plotlyst/view/widget/character/network/editor.py @@ -37,22 +37,50 @@ class RelationSelector(GridMenuWidget): relationSelected = pyqtSignal(Relation) - def __init__(self, network: RelationsNetwork, parent=None): + def __init__(self, network: RelationsNetwork = None, parent=None): super().__init__(parent) self._network = network self._romance = Relation('Romance', icon='ei.heart', icon_color='#d1495b') + self._breakUp = Relation('Breakup', icon='fa5s.heart-broken', icon_color='#d1495b') + self._affection = Relation('Affection', icon='mdi.sparkles', icon_color='#d1495b') + self._crush = Relation('Crush', icon='fa5.grin-hearts', icon_color='#d1495b') + self._unrequited = Relation('Unrequited love', icon='mdi.heart-half-full', icon_color='#d1495b') + + self._colleague = Relation('Colleague', icon='fa5s.briefcase', icon_color='#9c6644') + self._student = Relation('Student', icon='fa5s.graduation-cap', icon_color='black') + self._foil = Relation('Foil', icon='fa5s.yin-yang', icon_color='#947eb0') + self._friendship = Relation('Friendship', icon='fa5s.user-friends', icon_color='#457b9d') self._sidekick = Relation('Sidekick', icon='ei.asl', icon_color='#b0a990') self._guide = Relation('Guide', icon='mdi.compass-rose', icon_color='#80ced7') + self._supporter = Relation('Supporter', icon='fa5s.thumbs-up', icon_color='#266dd3') + self._adversary = Relation('Adversary', icon='fa5s.thumbs-down', icon_color='#9e1946') + self._betrayal = Relation('Betrayal', icon='mdi6.knife', icon_color='grey') + self._conflict = Relation('Conflict', icon='mdi.sword-cross', icon_color='#f3a712') self._newAction(self._romance, 0, 0) - self._newAction(self._friendship, 0, 1) - self._newAction(self._sidekick, 0, 2) - self._newAction(self._guide, 1, 0) - - def _newAction(self, relation: Relation, row: int, col: int) -> QAction: - action_ = action(relation.text, IconRegistry.from_name(relation.icon, relation.icon_color)) - self.addAction(action_, row, col) + self._newAction(self._affection, 0, 1) + self._newAction(self._crush, 0, 2) + self._newAction(self._breakUp, 1, 0) + self._newAction(self._unrequited, 1, 1, 2) + self.addSeparator(2, 0, colSpan=3) + self._newAction(self._friendship, 3, 0) + self._newAction(self._sidekick, 3, 1) + self._newAction(self._guide, 3, 2) + self._newAction(self._supporter, 4, 0) + self._newAction(self._adversary, 4, 1) + self._newAction(self._betrayal, 5, 0) + self._newAction(self._conflict, 5, 1) + self._newAction(self._foil, 6, 0) + self.addSeparator(7, 0, colSpan=3) + self._newAction(self._colleague, 8, 0) + self._newAction(self._student, 8, 1) + + def _newAction(self, relation: Relation, row: int, col: int, colSpan: int = 1, showText: bool = True) -> QAction: + text = relation.text if showText else '' + action_ = action(text, IconRegistry.from_name(relation.icon, relation.icon_color)) + action_.setToolTip(relation.text) + self.addAction(action_, row, col, colSpan=colSpan) action_.triggered.connect(lambda: self.relationSelected.emit(relation)) return action_ diff --git a/src/main/python/plotlyst/view/widget/characters.py b/src/main/python/plotlyst/view/widget/characters.py index 28a697b82..814532e80 100644 --- a/src/main/python/plotlyst/view/widget/characters.py +++ b/src/main/python/plotlyst/view/widget/characters.py @@ -1514,7 +1514,7 @@ def _addItem(self, item: SelectionItem, row: int, col: int): default_topics: List[Topic] = [ Topic('Family', uuid.UUID('2ce9c3b4-1dd9-4f88-a16e-b8dc507633b7'), 'mdi6.human-male-female-child', '#457b9d'), - Topic('Job', uuid.UUID('19d9bfe9-5432-42d8-a444-0bd849720b2d'), 'fa5s.briefcase', '9c6644'), + Topic('Job', uuid.UUID('19d9bfe9-5432-42d8-a444-0bd849720b2d'), 'fa5s.briefcase', '#9c6644'), Topic('Education', uuid.UUID('01e9ef93-7a71-4b2d-af88-53b30d3947cb'), 'fa5s.graduation-cap'), Topic('Hometown', uuid.UUID('1ac1eec9-7953-419c-a265-88a0723a64ea'), 'ei.home-alt', '#4c334d'), Topic('Physical appearance', uuid.UUID('3c1a00d2-5085-47f0-8fe5-6d253e708999'), 'ri.body-scan-fill', ''),