Skip to content

Commit

Permalink
fix: LinePlotNode restoration bug
Browse files Browse the repository at this point in the history
  • Loading branch information
eri24816 committed Apr 22, 2024
1 parent 9c8b646 commit f3a20b3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
3 changes: 2 additions & 1 deletion backend/src/grapycal/sobjects/controls/linePlotControl.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from objectsync import EventTopic, ListTopic

from grapycal.sobjects.controls.control import Control
from objectsync import StringTopic, IntTopic, ListTopic, SetTopic, DictTopic, EventTopic


class LinePlotControl(Control):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import io
from typing import Never

from grapycal import FloatTopic, StringTopic
from grapycal.extension.utils import NodeInfo
from grapycal.sobjects.edge import Edge
from grapycal.sobjects.node import Node
from grapycal.sobjects.port import InputPort
from grapycal.sobjects.sourceNode import SourceNode
from grapycal import StringTopic, FloatTopic
from matplotlib import pyplot as plt

plt.style.use("dark_background")
Expand Down Expand Up @@ -432,17 +432,19 @@ def build_node(self):
options=["from 0", "continue"],
)

def init_node(self):

self.x_coord = [0]
self.line_plot.lines.on_insert.add_auto(self.add_line)
self.line_plot.lines.on_pop.add_auto(self.remove_line)
if self.is_new:
self.line_plot.lines.insert("line", 0)
else:
for name in self.line_plot.lines:
self.add_line(name, None)

def init_node(self):

self.x_coord = [0]
self.line_plot.lines.on_insert.add_auto(self.add_line)
self.line_plot.lines.on_pop.add_auto(self.remove_line)


def add_line(self, name, _):
self.add_in_port(name, 1)

Expand Down

0 comments on commit f3a20b3

Please sign in to comment.