Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
zkovari committed Aug 31, 2023
1 parent 1f640b3 commit 6883291
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"""
from typing import Optional

from PyQt6.QtCore import QTimer
from overrides import overrides

from src.main.python.plotlyst.core.domain import Novel, RelationsNetwork, Character
Expand Down Expand Up @@ -65,7 +66,7 @@ def _startAddition(self, itemType: CharacterNetworkItemType):
def _endAddition(self, itemType: Optional[NetworkItemType] = None, item: Optional[NodeItem] = None):
super()._endAddition(itemType, item)
if itemType == CharacterNetworkItemType.CHARACTER:
self._finishCharacterAddition(item)
QTimer.singleShot(100, lambda: self._finishCharacterAddition(item))

def _finishCharacterAddition(self, item: CharacterItem):
def select(character: Character):
Expand Down
3 changes: 2 additions & 1 deletion src/main/python/plotlyst/view/widget/story_map/scene.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ def displayStickerMessage(self, sticker: StickerItem):
def hideStickerMessage(self):
self.closeSticker.emit()

def _addNewEvent(self, itemType: ItemType, scenePos: QPointF):
@overrides
def _addNewItem(self, itemType: ItemType, scenePos: QPointF):
if itemType == ItemType.CHARACTER:
item = CharacterItem(self.toCharacterNode(scenePos), character=None)
elif itemType in [ItemType.COMMENT, ItemType.TOOL, ItemType.COST]:
Expand Down
5 changes: 3 additions & 2 deletions src/main/python/plotlyst/view/widget/story_map/view.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
from typing import Optional

import qtanim
from PyQt6.QtCore import QTimer
from overrides import overrides

from src.main.python.plotlyst.core.domain import Character
Expand Down Expand Up @@ -129,9 +130,9 @@ def _endAddition(self, itemType: Optional[ItemType] = None, item: Optional[MindM
self._wdgSecondaryStickerSelector.setHidden(True)

if itemType == ItemType.CHARACTER:
self._endCharacterAddition(item)
QTimer.singleShot(100, lambda: self._finishCharacterAddition(item))

def _endCharacterAddition(self, item: CharacterItem):
def _finishCharacterAddition(self, item: CharacterItem):
def select(character: Character):
item.setCharacter(character)

Expand Down

0 comments on commit 6883291

Please sign in to comment.