Skip to content

Commit

Permalink
Refresh arc chart on scene change, closes #1463
Browse files Browse the repository at this point in the history
  • Loading branch information
zkovari committed Oct 18, 2024
1 parent ff1ba1c commit 154424f
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/main/python/plotlyst/view/report/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"""
from dataclasses import dataclass, field
from functools import partial
from typing import List, Dict, Optional
from typing import List, Dict, Optional, Iterable

import qtanim
from PyQt6.QtCharts import QSplineSeries, QValueAxis, QLegend, QAbstractSeries, QLineSeries
Expand Down Expand Up @@ -115,6 +115,12 @@ def refresh(self):
# self._centralWidget.layout().addWidget(self._agendaCharactersNode)
self._centralWidget.layout().addWidget(vspacer())

def isGeneralProgressToggled(self) -> bool:
return self._generalProgressNode.isToggled()

def toggledStorylines(self) -> Iterable[Plot]:
return [x for x in self._storylineNodes.keys() if self._storylineNodes[x].isToggled()]

def removeStoryline(self, plot: Plot):
node = self._storylineNodes.pop(plot)
if node.isToggled():
Expand Down Expand Up @@ -162,6 +168,13 @@ def __init__(self, novel: Novel, parent=None):
@overrides
def refresh(self):
self._treeView.refresh()
self.chartValues.clear()
self.chartValues.refresh()
if self._treeView.isGeneralProgressToggled():
self.chartValues.setProgressVisible(True)

for plot in self._treeView.toggledStorylines():
self.chartValues.setStorylineVisible(plot, True)

def removeStoryline(self, plot: Plot):
self._treeView.removeStoryline(plot)
Expand Down Expand Up @@ -285,6 +298,9 @@ def setCharacterConflictVisible(self, character: Character, visible: bool):
def refresh(self):
self._axisX.setRange(0, len(self.novel.scenes))

def clear(self):
self.removeAllSeries()

def _characterArcs(self, character: Character) -> CharacterArcs:
if character not in self._characters.keys():
self._characters[character] = CharacterArcs()
Expand Down

0 comments on commit 154424f

Please sign in to comment.