Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/Project_structure.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ bus-log-analyzer/
│ ├── load_worker.py # LoadWorker (QThread): native MDF arrays + batched CAN-raw vectorized decode paths
│ ├── plot_widget.py # PlotPanel: normal / multi-axis / stacked, dual cursors, zoom_to_time(), signal table columns chosen from its header (Hex, Δ C2−C1, statistics) and headed by the time plot's name, Table view, measurement events; its tab's panels in a PanelArea, the time plot's card headed by a band with the cursor readout, the signal table a card level with it
│ ├── plot_tabs.py # PlotTabs: tabs of plots, each with its own PlotPanel; drop and move signals between tabs, synchronized time and cursors, tabs (and their panels) in configurations
│ ├── panel_area.py # PanelArea: a tab's panels (time plot, Table, XY views, CAN Trace) tiled by splitters or tabbed together, each drawn as a card with even gaps between (Card draws one for a widget beside them, gutter_splitter splits two cards with the same gap), a panel's header row a HeaderBand; titles drawn as plot tabs, shown at a panel's top edge on hover or always; maximise, close and reopen where it was, undock to an own window and dock back (✕ closes), rename in place; layouts in configurations
│ ├── panel_area.py # PanelArea: a tab's panels (time plot, Table, XY views, CAN Trace) tiled by splitters or tabbed together, each drawn as a card with even gaps between (Card draws one for a widget beside them, gutter_splitter splits two cards with the same gap), a panel's header row a HeaderBand; titles drawn as plot tabs where panels share a place, elsewhere a panel's maximise, undock and close at its own header's right end (PanelButtons); maximise, close and reopen where it was, undock to an own window and dock back (✕ closes), rename in place; layouts in configurations
│ ├── tab_drawing.py # The plot tabs' drawing (outlined tab, curving feet, small raised "x"), shared by the plot tabs and the panels' titles
│ ├── stack_sections.py # MultiStack: the signal table split into one section per stack, level with it (filtered views of the table's model), a line between stacks
│ ├── state_lane.py # Drawing a state lane: labelled coloured stretches, hatched busy blocks, a click on a stretch; the name axis of a lane row
Expand Down
4 changes: 2 additions & 2 deletions gui/gps_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
from core.signal_store import SignalSeries
from core.xy_data import color_steps
from gui.map_background import MapBackground
from gui.panel_area import STRIP_BUTTON_SIZE, TITLE_BUTTONS_ROOM, HeaderBand
from gui.panel_area import STRIP_BUTTON_SIZE, HeaderBand
from gui.plot_icons import plot_icon
from gui.plot_painting import PlotView, PreparedViewBox
from gui.xy_view import _ColorScale, _ElidedLabel, _backdrop, duration_text, scale_color
Expand Down Expand Up @@ -293,7 +293,7 @@ def __init__(self, parent=None) -> None:
top.addWidget(self.name_label)
top.addWidget(self.summary, 1)
top.addWidget(self.settings_button)
top.addSpacing(TITLE_BUTTONS_ROOM)
# Its panel's maximise, undock and close follow (gui.panel_area).

# ── Its settings, in the box the gear opens ──────────────────────
self.settings_box = QFrame(self, Qt.WindowType.Popup)
Expand Down
47 changes: 18 additions & 29 deletions gui/main_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,9 @@
)
from gui.plot_tag import PlotTag, load_plot_tag, save_plot_tag
from gui.panel_area import GUTTER, gutter_splitter, layout_keys
from gui.plot_widget import PlotPanel
from gui.plot_widget import (
COLUMN_CHOICES_VERSION, COLUMN_CHOICES_VERSION_KEY, PlotPanel,
)
from gui.signal_tree import MARGIN as SIGNAL_PANEL_MARGIN, SignalTreeWidget
from gui.calculated_signal_dialog import CalculatedSignalDialog, CalculationWorker
from gui.raw_frame_dialog import RawFrameDialog
Expand Down Expand Up @@ -420,8 +422,7 @@ def _new_plot_panel(self) -> PlotPanel:
# The signal panel's tree band is as high as this tab's time plot band.
panel.plot_header.installEventFilter(self)
panel.set_tag(self._plot_tag)
columns = read_setting(self._user_settings_path, 'signal_table_columns', {})
panel.set_column_choices(columns if isinstance(columns, dict) else {})
panel.set_column_choices(self._saved_column_choices())
panel.set_raw_format_lookup(self._raw_format_of)
panel.set_decoded_source(lambda: self.store)
if self.plot_tabs.count():
Expand Down Expand Up @@ -453,12 +454,7 @@ def _new_plot_panel(self) -> PlotPanel:
panel.markersChanged.connect(lambda p=panel: self._share_markers(p))
panel.clearRequested.connect(self.clear_plot)
panel.cursor1Moved.connect(lambda x, p=panel: self._forward_cursor1(p, x))
# Its panels: titles as Display ▸ Show panel titles says, and an own
# window named after the tab.
if getattr(self, '_panel_titles_shown', None) is None:
self._panel_titles_shown = bool(read_setting(
self._user_settings_path, 'panel_titles_shown', False))
panel.panels.set_titles_shown(self._panel_titles_shown)
# Its panels: an own window named after the tab.
panel.panels.window_title = lambda title, p=panel: self._window_title_for(p, title)
panel.panelClosedByUser.connect(lambda key, p=panel: self._on_panel_closed(p, key))
panel.panels.panelsChanged.connect(self._panels_changed)
Expand Down Expand Up @@ -1425,13 +1421,24 @@ def show_converter(self) -> None:
dialog.raise_()
dialog.activateWindow()

def _saved_column_choices(self) -> dict:
"""The signal table's columns as the user last chose them. Choices
saved before the defaults changed are dropped, once: back then every
column could start on, so a table showed them all."""
columns = read_setting(self._user_settings_path, 'signal_table_columns', {})
if (not isinstance(columns, dict)
or columns.get(COLUMN_CHOICES_VERSION_KEY) != COLUMN_CHOICES_VERSION):
return {}
return columns

def _save_column_choices(self, choices: dict) -> None:
# Every tab's signal table has the same columns. A tab that already
# has them says nothing, so this ends with the last tab.
for panel in self.plot_tabs.panels():
panel.set_column_choices(choices)
try:
write_setting(self._user_settings_path, 'signal_table_columns', dict(choices))
write_setting(self._user_settings_path, 'signal_table_columns',
{**choices, COLUMN_CHOICES_VERSION_KEY: COLUMN_CHOICES_VERSION})
except OSError as exc:
self._log(f'Settings save warning: {exc}')

Expand Down Expand Up @@ -1986,13 +1993,6 @@ def _fill_display_menu(self, menu: QMenu) -> None:
hide.setChecked(self.btn_hide_line.isChecked())
hide.setEnabled(self.btn_hide_line.isEnabled())
hide.setToolTip('The data points only, once they are shown')
menu.addSeparator()
titles = menu.addAction('Show panel titles')
titles.setCheckable(True)
titles.setChecked(bool(self._panel_titles_shown))
titles.triggered.connect(self._set_panel_titles_shown)
titles.setToolTip("Every panel's title in view. Off: a panel shows its title "
'while the pointer rests on its top edge.')

def _fill_more_menu(self, menu: QMenu) -> None:
clear = menu.addAction(plot_icon('clear_plot'), 'Clear Plot', self.clear_plot)
Expand Down Expand Up @@ -2135,17 +2135,6 @@ def _update_escape(self) -> None:
self.btn_zoom_rect.isChecked()
or self.plot_panel.panels.maximised() is not None)

def _set_panel_titles_shown(self, shown: bool) -> None:
"""Display ▸ Show panel titles: every panel's title in view, or each
only while the pointer is at its panel's top edge."""
self._panel_titles_shown = bool(shown)
for panel in self.plot_tabs.panels():
panel.panels.set_titles_shown(shown)
try:
write_setting(self._user_settings_path, 'panel_titles_shown', bool(shown))
except OSError as exc:
self._log(f'Settings save warning: {exc}')

def _window_title_for(self, panel: PlotPanel, title: str) -> str:
"""A panel's own window names its plot tab too."""
for each, name in zip(self.plot_tabs.panels(), self.plot_tabs.names()):
Expand Down Expand Up @@ -2251,7 +2240,7 @@ def _open_trace(self, tab: PlotPanel, rfs) -> None:
self.plotCursor1Moved.connect(dialog.follow_time)
self._raw_frame_dialog = dialog
area.add('trace', dialog, 'CAN Trace', home={'edge': 'bottom', 'share': 0.38},
name_label=dialog.name_label)
name_label=dialog.name_label, header=dialog.header)
area.open_panel('trace')
if tab._cursor1_enabled:
dialog.follow_time(tab.v_line.value())
Expand Down
Loading
Loading