Dashboard module
This module defines the Dashboard
class, which provides the main GUI window
and integrates with the data bus for a real-time dashboard.
It also includes QGraphicsViewWrapper
for enhanced view interactions
and the dashboard_driver
function to launch the application.
Classes
QGraphicsViewWrapper
Wrapper around QGraphicsView
to intercept wheel events for custom zooming
and horizontal/vertical scrolling.
- class dashboard.QGraphicsViewWrapper(scene, dashboard)
- Parameters:
scene – Instance of
QGraphicsScene
to display.dashboard – The parent
Dashboard
instance.
Methods
- __init__(scene, dashboard)
Initialize the view wrapper with default zoom level, scroll sensitivity, and a reference to the dashboard.
- wheelEvent(event)
Handle wheel events:
Zoom in/out if Ctrl/Cmd is held.
Scroll horizontally if Shift is held.
Scroll vertically otherwise.
Dashboard
Main widget for the dashboard application, managing items, menus, interactions, and timed updates.
- class dashboard.Dashboard(callback)
- Parameters:
callback – Function invoked for outgoing message callbacks (e.g., sending CAN messages).
Class Attributes
- build_info: BuildInfoManager
Holds application name and build number metadata.
Methods
- __init__(callback)
Set up the application window, subscribe to the data bus on
"ALL"
, and initialize menus, scene, view, and registry triggers.
- contextMenuEvent(event)
Display a context menu at the cursor for item actions (duplicate, remove, lock, z-order operations).
- select_instance(instance)
Change the current Parsley data source instance and reload items.
- check_for_changes()
Detect external configuration changes via
EventTracker
and prompt to reload.
- change_detector()
Periodically poll for backend data updates and mark for refresh.
- every_second(stream, payload)
Handler for the special
"ALL"
stream; used for timed callbacks.
- send_can_message()
Send a CAN bus message using the configured
omnibus_sender
.
- open_property_panel()
Show the property panel for the currently selected dashboard item.
- on_selection_changed()
React to selection changes in the scene and update the property panel.
- close_property_tree()
Close and remove the property panel widget.
- on_duplicate()
Duplicate the currently selected dashboard items.
- on_item_resize()
Update item parameters in response to user-initiated resizing.
- remove()
Remove the currently selected dashboard item.
- remove_all()
Prompt for confirmation and remove all dashboard items.
- remove_selected()
Remove all currently selected dashboard items.
- load()
Load a dashboard layout from a JSON configuration file.
- save()
Save the current layout to the last opened file.
- save_as()
Prompt for a file path and save the layout under a new name.
- open()
Open a file dialog and load a dashboard configuration file.
- show_save_popup()
Display a dialog prompting the user to save unsaved changes.
- show_save_as_prompt()
Prompt the user for a new save location via dialog.
- lock_selected()
Mark all selected widgets as locked against movement and resizing.
- lock_widget(widget)
Lock a specific widget, disabling its movement/resizing.
- unlock()
Unlock the specified widget(s), restoring movement and resizing.
- toggle_lock()
Toggle the lock/unlock state of all dashboard items.
- toggle_mouse()
Toggle mouse-powered item resizing mode.
- reset_zoom()
Reset the view’s zoom level to its default scale.
- get_data()
Retrieve data or parameters from the selected dashboard item.
- help()
Show the application’s help or about dialog.
- update()
Timer-driven refresh method; called at ~60 FPS to refresh the dashboard.
- send_forward()
Move selected item(s) one layer forward in the z-order.
- send_backward()
Move selected item(s) one layer backward in the z-order.
- send_to_front()
Bring selected item(s) to the front of the view stack.
- send_to_back()
Send selected item(s) to the back of the view stack.
Functions
dashboard_driver
- dashboard.dashboard_driver(callback)
Launch the Qt application and start the main event loop with a
Dashboard
instance and a periodic update timer.- Parameters:
callback – Function for message callbacks from the UI.