UI Reference
kevinbotlib.ui.theme
kevinbotlib.ui.theme.ThemeStyle
Bases: Enum
Theme options for the KevinbotLib UI theme
Light = 0
class-attribute
instance-attribute
Light mode
Dark = 1
class-attribute
instance-attribute
Dark mode
System = 2
class-attribute
instance-attribute
System theme, uses GTK on Linux, and system preference on Windows/macOS
kevinbotlib.ui.theme.Theme
Qt theming engine for the KevinbotLib UI style
__init__(style)
Initialize the theming system.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
style
|
ThemeStyle
|
Theme to use. |
required |
is_dark()
Detect if the currently applied style is dark
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
Is the current style dark? |
get_stylesheet()
Get the formatted stylesheet string to apply
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
Qt QSS Stylesheet string. |
apply(app)
Apply the theme to an application or window
Parameters:
Name | Type | Description | Default |
---|---|---|---|
app
|
QApplication | QMainWindow
|
App or window to apply the theme to. |
required |
set_style(style)
Apply a new theme to the application or window.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
style
|
ThemeStyle
|
ThemeStyle. Theme to use. |
required |
kevinbotlib.ui.widgets
kevinbotlib.ui.widgets.Battery
dataclass
Battery item to be used in BatteryManager.
voltage
instance-attribute
Current battery voltage.
y_min
instance-attribute
Minimum reasonable battery voltage.
y_max
instance-attribute
Maximum reasonable battery voltage.
kevinbotlib.ui.widgets.BatteryGrapher
Bases: QWidget
Qt widget to plot battery voltage over time.
__init__(parent=None)
Create the widget
Parameters:
Name | Type | Description | Default |
---|---|---|---|
parent
|
QObject | None
|
Parent QObject of the widget. Defaults to None. |
None
|
add(value)
Add a new data point, scroll left if necessary.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
value
|
float
|
New value to add |
required |
set_range(y_min, y_max)
Set the y-axis range for the graph.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
y_min
|
float
|
Minimum Y value. |
required |
y_max
|
float
|
Maximum Y value. |
required |
kevinbotlib.ui.widgets.BatteryManager
Bases: QWidget
Qt widget to display multiple BatteryGraphers and voltage labels.
__init__(parent=None)
Create the widget.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
parent
|
QObject | None
|
Parent QObject of the widget. Defaults to None. |
None
|
set(batts)
Set the current battery voltages. Will update all graphs.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
batts
|
list[Battery]
|
List of batteries |
required |
kevinbotlib.ui.widgets.LicenseDialog
Bases: QDialog
Qt Dialog for viewing KevinbotLib's internal licenses.
__init__(parent=None)
Create the dialog.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
parent
|
QObject | None
|
Parent QObject of the dialog. Defaults to None. |
None
|
kevinbotlib.ui.delegates
kevinbotlib.ui.delegates.NoFocusDelegate
Bases: QStyledItemDelegate
Qt QStyledItemDelegate that removes the focus indicator
kevinbotlib.ui.delegates.ComboBoxNoTextDelegate
Bases: QStyledItemDelegate
Qt QStyledItemDelegate that removes text from QComboBox