pull/36045/head
Quantizr (Jimmy) 1 month ago
parent 789c470c64
commit 3447acde41
  1. 5
      tools/jotpluggler/data.py
  2. 2
      tools/jotpluggler/pluggle.py
  3. 11
      tools/jotpluggler/views.py

@ -3,7 +3,6 @@ import threading
import multiprocessing import multiprocessing
import bisect import bisect
from collections import defaultdict from collections import defaultdict
from typing import Any
import tqdm import tqdm
from openpilot.common.swaglog import cloudlog from openpilot.common.swaglog import cloudlog
from openpilot.tools.lib.logreader import _LogFileReader, LogReader from openpilot.tools.lib.logreader import _LogFileReader, LogReader
@ -11,7 +10,7 @@ from openpilot.tools.lib.logreader import _LogFileReader, LogReader
def flatten_dict(d: dict, sep: str = "/", prefix: str = None) -> dict: def flatten_dict(d: dict, sep: str = "/", prefix: str = None) -> dict:
result = {} result = {}
stack = [(d, prefix)] stack: list[tuple] = [(d, prefix)]
while stack: while stack:
obj, current_prefix = stack.pop() obj, current_prefix = stack.pop()
@ -164,7 +163,7 @@ def msgs_to_time_series(msgs):
return final_result, min_time or 0.0, max_time or 0.0 return final_result, min_time or 0.0, max_time or 0.0
def _process_segment(segment_identifier: str) -> tuple[dict[str, Any], float, float]: def _process_segment(segment_identifier: str):
try: try:
lr = _LogFileReader(segment_identifier, sort_by_time=True) lr = _LogFileReader(segment_identifier, sort_by_time=True)
return msgs_to_time_series(lr) return msgs_to_time_series(lr)

@ -66,7 +66,7 @@ class MainController:
self.plot_layout_manager = PlotLayoutManager(self.data_manager, self.playback_manager, scale=self.scale) self.plot_layout_manager = PlotLayoutManager(self.data_manager, self.playback_manager, scale=self.scale)
self.data_manager.add_observer(self.on_data_loaded) self.data_manager.add_observer(self.on_data_loaded)
self.avg_char_width = None self.avg_char_width = None
self.visible_paths = set() self.visible_paths: set[str] = set()
self.check_index = 0 self.check_index = 0
def _create_global_themes(self): def _create_global_themes(self):

@ -185,7 +185,7 @@ class DataTreeNode:
self.children: dict[str, DataTreeNode] = {} self.children: dict[str, DataTreeNode] = {}
self.is_leaf = False self.is_leaf = False
self.child_count = 0 self.child_count = 0
self.is_plottable_cached = None self.is_plottable_cached: bool | None = None
self.ui_created = False self.ui_created = False
self.ui_tag: str | None = None self.ui_tag: str | None = None
@ -229,12 +229,12 @@ class DataTreeView:
def _add_paths_to_tree(self, paths, incremental=False): def _add_paths_to_tree(self, paths, incremental=False):
search_term = self.current_search.strip().lower() search_term = self.current_search.strip().lower()
filtered_paths = [path for path in paths if self._should_show_path(path, search_term)] filtered_paths = [path for path in paths if self._should_show_path(path, search_term)]
target_tree = self.data_tree if incremental else DataTreeNode(name="root")
if not filtered_paths: if not filtered_paths:
return return target_tree
nodes_to_update = set() if incremental else None nodes_to_update = set() if incremental else None
target_tree = self.data_tree if incremental else DataTreeNode(name="root")
for path in sorted(filtered_paths): for path in sorted(filtered_paths):
parts = path.split('/') parts = path.split('/')
@ -343,8 +343,7 @@ class DataTreeView:
node.is_plottable_cached = self.data_manager.is_plottable(node.full_path) node.is_plottable_cached = self.data_manager.is_plottable(node.full_path)
if node.is_plottable_cached: if node.is_plottable_cached:
with dpg.drag_payload(parent=draggable_group, drag_data=node.full_path, with dpg.drag_payload(parent=draggable_group, drag_data=node.full_path, payload_type="TIMESERIES_PAYLOAD"):
payload_type="TIMESERIES_PAYLOAD"):
dpg.add_text(f"Plot: {node.full_path}") dpg.add_text(f"Plot: {node.full_path}")
node.ui_created = True node.ui_created = True
@ -371,7 +370,7 @@ class DataTreeView:
self._remove_children_from_queue(node.full_path) self._remove_children_from_queue(node.full_path)
def _remove_children_from_queue(self, collapsed_node_path: str): def _remove_children_from_queue(self, collapsed_node_path: str):
new_queue = deque() new_queue: deque[tuple] = deque()
for node, parent_tag, search_term, is_leaf in self.ui_render_queue: for node, parent_tag, search_term, is_leaf in self.ui_render_queue:
# Keep items that are not children of the collapsed node # Keep items that are not children of the collapsed node
if not node.full_path.startswith(collapsed_node_path + "/"): if not node.full_path.startswith(collapsed_node_path + "/"):

Loading…
Cancel
Save