Skip to content

Conversation

GiulioRomualdi
Copy link
Member

@GiulioRomualdi GiulioRomualdi commented Oct 8, 2025

Implement functionality for saving and loading views, enhance the PlotItem class for better canvas management, and introduce serialization for view snapshots. Update the visualizer UI to support these features.

Screencast.from.2025-10-08.22-01-37.webm

This PR has been produced thanks to the help of Copilot + GPT-5 Codex

…nt, and implement view snapshot serialization

- Updated visualizer UI to include actions for saving and loading views.
- Enhanced PlotItem class with methods to clear the canvas, capture, and apply canvas state.
- Introduced view_snapshot.py to define data structures for serializing UI state to/from JSON.
@GiulioRomualdi GiulioRomualdi self-assigned this Oct 8, 2025
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements functionality for saving and loading views, enhances the PlotItem class for better canvas management, and introduces serialization for view snapshots. The primary purpose is to enable users to save their current visualizer state (including plot configurations, window layout, and 3D visualizations) and restore it later.

  • Added comprehensive view snapshot serialization system with JSON export/import
  • Enhanced PlotItem and canvas classes with state capture/restore capabilities
  • Added UI menu actions and command-line arguments for snapshot management

Reviewed Changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
robot_log_visualizer/ui/view_snapshot.py New module defining dataclasses for serializing view snapshots to/from JSON
robot_log_visualizer/ui/gui.py Major enhancements for snapshot save/load functionality and dataset management refactoring
robot_log_visualizer/ui/plot_item.py Added canvas state management methods for plot snapshots
robot_log_visualizer/plotter/pyqtgraph_viewer_canvas.py Enhanced canvas with state capture/restore and improved error handling
robot_log_visualizer/signal_provider/signal_provider.py Added export methods for registered 3D visualization items
robot_log_visualizer/ui/misc/visualizer.ui Added Save View and Load View menu actions with keyboard shortcuts
robot_log_visualizer/main.py Added command-line argument parsing for dataset and snapshot loading
robot_log_visualizer/utils/utils.py Minor code formatting change
robot_log_visualizer/ui/video_item.py Added blank line for formatting
README.md Updated documentation with new command-line usage examples
Comments suppressed due to low confidence (1)

robot_log_visualizer/ui/gui.py:1

  • Accessing a private method _load_mat_file from outside the class violates encapsulation. Consider making this method public or providing a public wrapper method.
# Copyright (C) 2022 Istituto Italiano di Tecnologia (IIT). All rights reserved.

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

self._select(pt_tuple, curve)
return missing

def _curve_key(self, curve: pg.PlotDataItem) -> str | None:
Copy link

Copilot AI Oct 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The return type annotation uses the newer union syntax str | None which may not be compatible with older Python versions. Consider using Optional[str] for broader compatibility.

Copilot uses AI. Check for mistakes.

Comment on lines +1357 to +1358
missing_curves: set[str] = set()
missing_annotations: set[str] = set()
Copy link

Copilot AI Oct 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The type annotations use the newer syntax set[str] which may not be compatible with older Python versions. Consider using Set[str] from typing for broader compatibility.

Copilot uses AI. Check for mistakes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant