GUI

MainWindow

class GUI.MainWindow.MainWindow[source]
Inherit

QMainWindow

Description

Main class of graphical part.

Holds all other graphical widgets and communicate with them.

UI was created in Qt Designer and loaded from “MainWindow.ui”

activate_current_tab()[source]
Description

Activate all widgets in selected graph tab.

All other widget from graph tabs will be deactivated.

Deactivated widget do not update values in graph, so app runs faster.

fill_tabs_with_variables()[source]
Description

This method is called only once when initializing.

Append appropriate variable configuration for each tab.

Based on given config graphics is generated and values are updated.

let_tabs_generate_graphics()[source]
Description

This method is called only once when initializing.

Lets graph tabs and error tabs generate graphics based on configuration.

open_about_dialog()[source]
Description

Open about dialog.

open_com_setting_window()[source]
Description

Opens communication settings window.

Based on user selection is opened either Serial config or Wi-Fi config.

open_documentation_window()[source]
Description

Open documentation window.

open_update_window()[source]
Description

This method is invoked when update button is clicked.

Open update window, where user can adjust configuration for selected can variable.

push_data_to_tabs(queue)[source]
Description

Takes data received from formula and sends them to appropriate widget.

Parameters

queue (Queue(list[DataPoint])) – Queue of list of DataPoints containing decoded and processed data from formula

send_com_request()[source]
Description

Send signal to start communication of specific type

set_data_config_list()[source]
Description

Loads current data configuration.

show_variable_list_used_in_current_tab()[source]
Description

Update list of shown variable according to selected tab view(engine, suspension ,etc..)

update_can_msg(can_id, can_msg)[source]
Description

Updates can message label in UI.

Parameters
  • can_id (str) – Last received can id.

  • can_msg (str) – Last received can message.

update_connection_status(status)[source]
Description

Show current connection status.

Based on new status change button between “Connect” and “Disconnect”.

Status can be “Offline”, “Connecting”,”Reconnecting”, “Online”

Parameters

status (str) – Connection status.

Communication Windows

Serial Settings

class GUI.CommunicationWindow.SerialSettings.SerialSettingWindow(parent)[source]
Inherit

QMainWindow

Description

Create window with settings for serial communication.

Let user adjust configuration for serial communication.

UI was created in Qt Designer and loaded from “SerialSettings.ui”

Parameters

parent (QWidget) – Parent widget

static check_baud_rate(baud_rate)[source]
Description

Check if baud is convertible int in range of 300 - 921600.

If error is raised Warning Window will pop up.

Parameters

baud_rate (int) – Baud rate.

Raises
Returns

True if check is passed.

Return type

bool

static check_port(port)[source]
Description

Check if port is a non empty str and can be found on the system.

Parameters

port (str) – Com port name.

Raises
Returns

True if check is passed.

Return type

bool

save_settings()[source]
Description

Save new serial configuration.

If error is raised Warning Window will pop up.

Raises
  • ValueError

    – Baud rate in not convertible to integer.

    – Port is empty.

  • TypeError – Port is not a str.

  • ArithmeticError – Baud rate is not in range 300 - 921600.

  • OSError – Port cannot be find on the system.

show_actual_baud_rate()[source]
Description

Show actual baud rate setting.

show_actual_port()[source]
Description

Show actual port settings if saved port is available on system.

update_available_ports()[source]
Description

Loads a show all available COM ports.

Wi-fi Settings

class GUI.CommunicationWindow.WifiSettings.WifiSettingWindow(parent)[source]
Inherit

QMainWindow

Description

Create window with settings for Wi-Fi communication.

Let user adjust configuration for Wi-Fi communication.

UI was created in Qt Designer and loaded from “WifiSettings.ui”

Parameters

parent (QWidget) – Parent widget

static check_ip(ip)[source]
Description

Check if IP address is in a valid format.

If error is raised Warning Window will pop up.

Parameters

ip (str) – IP address.

Raises

OSError – IP address is not in a valid format.

Returns

True if check is passed.

Return type

bool

static check_port(port)[source]
Description

Check if port is int in range 1 - 65535.

If error is raised Warning Window will pop up.

Parameters

port (int) – Communication port.

Raises
Returns

True if check is passed.

Return type

bool

save_settings()[source]
Description

Save new Wi-Fi configuration.

Raises
show_actual_ip()[source]
Description

Show actual ip settings.

show_actual_port()[source]
Description

Show actual port settings .

Tab

class GUI.Tab.Tab(group_id=0)[source]
Inherit

QWidget

Description

Base class for all types of tabs ie. GraphTab, ErrorTab, OverviewTab.

Implement basic methods for loading config and updating values of variables.

Parameters

group_id (int, optional) – Group id based on which the configuration is assigned.

add_config_variable(variable)[source]
Description

Append new variable config to config list.

Parameters

variable (CanDataConfig) – Variable config.

sort_widget_list_by_id()[source]
Description

Sort generated widgets by its id, so data can be passed directly without need looping over all widgets.

tab_info()[source]
Description

Print info about every assigned variable.

update_data(data_point)[source]
Description

Update data in proper widget.

Parameters

data_point (DataPoint) – Data container

Error Tab

Error Tab

class GUI.ErrorTab.ErrorTab.ErrorTab(group_id)[source]
Inherit

Tab

Description

Error tab is used to show binary state variables, that indicates errors and malfunctions.

For more info see ErrorWidget.

Parameters

group_id (int) – Group id based on which the configuration is assigned.

add_error_widgets_to_layout()[source]
Description

Insert Errors Widgets to grid.

count_grid_size()[source]
Description

Calculates the appropriate rows and columns layout.

create_error_widgets()[source]
Description

Create Error Widgets based on configuration.

Error Widget

class GUI.ErrorTab.ErrorWidget.ErrorWidget(name, id)[source]
Inherit

QWidget

Description

Error widget is used to indicate state of binary variable.

States are as follow: 1. OK -> Green LED 2. No data -> Yellow LED 3. Error -> Red Led

Parameters
  • name (str) – The name of the variable it signals.

  • id – CAN ID used to identify where data should be send.

  • id – str

error_received()[source]
Description

Used when error status is received.

Shows time of error and reset button.

Locks widget do new states won’t change anything.

error_reset()[source]
Description

Event handler for reset button click.

Hide reset button and timestamp.

Sets icon to yellow.

Unlock widget and set state to None.

update_data(status)[source]
Description

Updates status and show appropriate signalization LED.

Parameters

status (bool) – New status value.

Graph Tab

Graph Tab

class GUI.GraphTabs.GraphTab.GraphTab(group_id)[source]
Inherit

Tab

Description

Graph tab is used to create and handle graphs

For more info see Graph.

Parameters

group_id (int) – Group id based on which the configuration is assigned.

add_graphs_to_layout()[source]
Description

Add Graphs widget to layout.

change_state(state)[source]
Description

Send state signal to all containing graph.

The status signal lets the graphs know if they should be plotted or not.

Parameters

state (bool) –

create_graphs()[source]
Description

Create Graph widgets based on configuration.

Graph

class GUI.GraphTabs.Graph.Graph(name, unit, id)[source]
Inherit

pyqtgraph.PlotWidget

Description

Used to create Graph widget.

Controls everything in graph (signals, store values, etc.)

Parameters
  • name (str) – Title of the graph.

  • unit (str) – Unit which will value on y axis represent.

  • id (int) – Id of widget in group. Used to identify destination of new value.

auto_focus()[source]
Description

Enables auto range mode, which automatically adjust range of Y axis based on shown values.

Turn off inspect mode.

change_state(state)[source]
Description

Used to change state of the graph.

Based on state of graph refreshes its view or not.

Parameters

state (bool) – New state of the graph.

extend_data_storage()[source]
Description

Extend data storage arrays by 1000 elements.

Used when the new value does not fit to the array.

is_view_box_on_actual_data()[source]
Returns

True if actual view is on newest data.

Return type

bool

keyPressEvent(ev)[source]
Description

Wrapper on base keyPressEvent.

If ‘c’ or ‘f’ is pressed graph will go to autofocus mode.

Parameters

ev (GraphicsView.keyPressEvent) – Key press event.

mousePressEvent(ev)[source]
Description

Wrapper on base mousePressEvent.

If left button is pressed activate inspect mode.

In inspect mode user can move, zoom etc. in graph.

Also, graph won’t be autofocusing to newest data.

Parameters

ev (GraphicsView.mousePressEvent) – Mouse press event.

mouseReleaseEvent(ev)[source]
Description

Wrapper on base mouseReleaseEvent.

If middle button is released graph will turn on autofocus on newest data and end inspect mode.

If left button is released and view box is on newest data turn on inspect mode will end.

Parameters

ev (GraphicsView.mouseReleaseEvent) – Mouse releae event.

setup_graph()[source]
Description

Setup graph background, title, axis. etc.

update_data(value)[source]
Description

Update graph data with new value.

Extend data storage if full.

Redraw graph curve if graph is active.

Adjust X axis range to value array if not in inspect mode.

Parameters

value (int, float) – New value to be shown.

class GUI.GraphTabs.Graph.TimeAxisItem(*args, **kwargs)[source]
Inherit

pyqtgraph.AxisItem

Description

Used for creating own AxisItem ie. own format of axis.

Own axis shows time in format H:M:S For more detail see base class pyqtgraph.AxisItem

tickStrings(values, scale, spacing)[source]

Return the strings that should be placed next to ticks. This method is called when redrawing the axis and is a good method to override in subclasses. The method is called with a list of tick values, a scaling factor (see below), and the spacing between ticks (this is required since, in some instances, there may be only one tick and thus no other way to determine the tick spacing)

The scale argument is used when the axis label is displaying units which may have an SI scaling prefix. When determining the text to display, use value*scale to correctly account for this prefix. For example, if the axis label’s units are set to ‘V’, then a tick value of 0.001 might be accompanied by a scale value of 1000. This indicates that the label is displaying ‘mV’, and thus the tick should display 0.001 * 1000 = 1.

GUI.GraphTabs.Graph.int2dt(ts, ts_mult=1000000.0)[source]
Description

Used to convert unix timestamp to UTC datetime.

Parameters
  • ts (int) – Unix timestamp ie. number of seconds since 1.1.1970.

  • ts_mult (float) – Timestamp multiplication.

GUI.GraphTabs.Graph.now_timestamp(ts_mult=1000000.0, epoch=datetime.datetime(1970, 1, 1, 0, 0))[source]
Description

Used to get current unix timestamp.

Parameters
  • ts_mult (float) – Timestamp multiplication.

  • epoch (datetime) – Unix epoch usually 1.1.1970.

Help

About window

class GUI.Help.AboutWindow.AboutDialog.AboutDialog(parent=None)[source]
Inherit

QDialog

Description

Open about dialog from AboutDialog.ui.

Documentation

class GUI.Help.Documentation.DocWindow.DocWindow(*args, **kwargs)[source]
Inherit

QMainWindow

Description

Open documentation in Qt WebEngine

Overview Tab

Overview Tab

class GUI.OverviewTab.OverviewTab.OverviewTab[source]
Inherit

Tab, :Inherit: QQuickWidget

Description

Overview tab is acting as dashboard in real car.

Design and behavior of overview tab is defined in *.qml file.

Task of this class is to load qml file and connect all variables to it.

add_config_variable(variable)[source]
Description

Add configuration to config list for new variable.

Parameters

variable (CanDataConfig) – New variable config.

update_data(data_point)[source]
Description

Replace overview variable value.

Parameters

data_point (DataPoint) – Data point containing new data.

QML Object Manager

class GUI.OverviewTab.QmlObjectManager.QmlObjectManager(overview_id, type='str', parent=None)[source]
Inherit

QObject

Description

Class used to create communication bridge between python variables and qml variables.

Parameters
  • overview_id (int) – Id of variable in overview.

  • type (str) – Type of input variable int.

  • parent (QObject) – Parent of the object.

value
Description

Getter for object value.

Returns

Value.

Return type

str

Update Window

Update Window

class GUI.UpdateWindow.UpdateWindow.UpdateWindow(main_window, config_id)[source]
Inherit

QMainWindow

Description

Graphical interface to update variable configuration.

User can changed can id, start bit, length, multiplier and offset. UI was created in Qt Designer and loaded from “UpdateWindow.ui”

Parameters
  • main_window (MainWindow) – Main app window object is load because of accessibility of signal.

  • config_id (int) – Id of variable which configs user want to adjust.

Raises
  • TypeError – Config_id is not an integer

  • ValueError – Config_id is greater then maximal id in config file

Note

Change signal/slot logic. Takes main app object as parameter to send its signal isn´t best approach.

is_little_endian_possible()[source]
Description

Set checkability of little endian.

Little endian cannot be set if data length is divisible by 8 WITH remainder and if data length is less or eq 8.

Returns

True if little endian can be set.

Return type

bool

setup_dynamic_name_box_width()[source]
Description

Adjust name box size if name is too long.

setup_dynamic_title()[source]
Description

Set window title based on data config name.

show_data()[source]
Description

Loads config for selected variable and displays it.

update_config()[source]
Description

Takes new data given by user and use them to update configuration file.

New DataConfig object will be temporary created because it will automatically check validity of input parameters.

Once config is updated, config update signal is emitted.

Warning Window

class GUI.UpdateWindow.WarningWindow.WarningWindow(can_id, start_bit, length, multiplier, offset, endian)[source]
Description

Used to check user’s inputs and pop up warning window if needed.

Parameters
  • can_id (str) – Can id in hex format.

  • start_bit (int) – Data start bit in can msg.

  • length (int) – Data length in can msg.

  • multiplier (float, int) – Data multiplier in can msg.

  • offset (float, int) – Data offset in can msg.

check_can_id()[source]
Description

Can id is expected to be convertible to HEX string of max len 8.

If error is raised Warning Window will pop up.

raises TypeError

Can_id is not a string.

raises ValueError

Can_id is hex string longer then 8.

check_endian()[source]
Description

Endian is expected to be convertible to str and have value of “L” or “B”.

If error is raised Warning Window will pop up.

Raises
check_length()[source]
Description

Length is expected to by convertible to int in range of 1 - 63.

If error is raised Warning Window will pop up.

Raises
check_multiplier()[source]
Description

Multiplier is expected to by convertible to float.

Cannot be equal to 0.

If error is raised Warning Window will pop up.

Raises
check_offset()[source]
Description

Offset is expected to by convertible to float.

If error is raised Warning Window will pop up.

Raises

TypeError – Offset is not an integer or float.

check_start_bit()[source]
Description

Start bit is expected to be convertible to int in range of 0 - 63.

If error is raised Warning Window will pop up.

Raises
check_user_inputs()[source]
Description

Runs series of checks on class input parameters.

Returns

True if all checked parameters are valid.

Return type

bool

static show_warning_window(title, msg)[source]
Description

Display warning message box with given title and message

Parameters
  • title – Title of message box.

  • title – str

  • msg (str) – Message that will be displayed.