Skip to content

Commit

Permalink
Fixed merge
Browse files Browse the repository at this point in the history
  • Loading branch information
nicktrem committed Mar 6, 2024
2 parents d8b573b + 4eacfa2 commit ecdf600
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
14 changes: 10 additions & 4 deletions robot_log_visualizer/plotter/matplotlib_viewer_canvas.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def __init__(self, parent, signal_provider, period):
# start the vertical line animation
(self.vertical_line,) = self.axes.plot([], [], "-", lw=1, c="k")

self.periond_in_ms = int(period * 1000)
self.period_in_ms = int(period * 1000)

# active paths
self.active_paths = {}
Expand All @@ -49,7 +49,7 @@ def __init__(self, parent, signal_provider, period):
self.fig,
self.update_vertical_line,
init_func=self.init_vertical_line,
interval=self.periond_in_ms,
interval=self.period_in_ms,
blit=True,
)

Expand All @@ -65,7 +65,13 @@ def quit_animation(self):
if self.vertical_line_anim:
self.vertical_line_anim._stop()

def update_plots(self, paths, legends, realtimePlot=False):
def pause_animation(self):
self.vertical_line_anim.pause()

def resume_animation(self):
self.vertical_line_anim.resume()

def update_plots(self, paths, legends, realtimePlot):
self.axes.cla()
for path, legend in zip(paths, legends):
path_string = "/".join(path)
Expand Down Expand Up @@ -114,7 +120,7 @@ def update_plots(self, paths, legends, realtimePlot=False):
self.fig,
self.update_vertical_line,
init_func=self.init_vertical_line,
interval=self.periond_in_ms,
interval=self.period_in_ms,
blit=True,
)

Expand Down
7 changes: 7 additions & 0 deletions robot_log_visualizer/ui/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,13 @@ def textLogTreeWidget_on_click(self):
self.text_logger.highlight_cell(self.find_text_log_index(path))

def plotTabBar_currentChanged(self, index):
# pause all the animations except the one that is selected, this is done to avoid the overhead of the animations
for i in range(len(self.plot_items)):
if i != index:
self.plot_items[i].canvas.pause_animation()
else:
self.plot_items[i].canvas.resume_animation()

# clear the selection to prepare a new one
self.ui.variableTreeWidget.clearSelection()
for active_path_str in self.plot_items[index].canvas.active_paths.keys():
Expand Down

0 comments on commit ecdf600

Please sign in to comment.