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_com_setting_window
()[source]¶ - Description
Opens communication settings window.
Based on user selection is opened either Serial config or Wi-Fi config.
-
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.
-
show_variable_list_used_in_current_tab
()[source]¶ - Description
Update list of shown variable according to selected tab view(engine, suspension ,etc..)
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
ValueError – Baud rate in not convertible to integer.
ArithmeticError – Baud rate is not in range 300 - 921600.
- Returns
True if check is passed.
- Return type
-
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
TypeError – Port is not a str.
ValueError – Port is empty.
OSError – Port cannot be find on the system.
- Returns
True if check is passed.
- Return type
-
save_settings
()[source]¶ - Description
Save new serial configuration.
If error is raised Warning Window will pop up.
- Raises
– 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.
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_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
ValueError – – Port in not convertible to integer.
ArithmeticError – Port is not in range 1 - 65535.
- Returns
True if check is passed.
- Return type
-
save_settings
()[source]¶ - Description
Save new Wi-Fi configuration.
- Raises
ValueError – – Port in not convertible to integer.
ArithmeticError – Port is not in range 1 - 65535.
OSError – IP address is not valid.
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.
Error Tab¶
Error Tab¶
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.
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.
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
-
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.
-
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.
-
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.
Help¶
About window¶
Documentation¶
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.
QML Object Manager¶
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.
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
-
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
TypeError – Endian is not a str.
ValueError – Endian is not a “L” or “B”.
-
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
ValueError – Length bit is not an integer.
ArithmeticError – Length is not in range 1 - 63.
-
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
ValueError – Multiplier is not an integer or float.
ArithmeticError – Multiplier is equal to 0.
-
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
ValueError – Start bit is not an integer.
ArithmeticError – Start bit is not in range 0 - 63.