diff --git a/docs/changelog.txt b/docs/changelog.txt index 47620097..cba6e920 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -1,3 +1,9 @@ +2.11.1 (2024-03-28) +----------------------------- +* Trailing Widget + - Add "draw_order_index_*" options, + which sets draw order of plot lines. + 2.11.0 (2024-03-28) ----------------------------- * [New]Fuel calculator diff --git a/docs/customization.md b/docs/customization.md index 9cdc0e79..bf98c067 100644 --- a/docs/customization.md +++ b/docs/customization.md @@ -1750,6 +1750,9 @@ Set reference line style. `0` for solid line, `1` for dashed line. reference_line_*_width Set reference line width in pixels. Set value to `0` to hide line. + draw_order_index_* +Set draw order of plot lines. + ## Tyre carcass temperature **This widget displays tyre carcass temperature info.** diff --git a/tinypedal/const.py b/tinypedal/const.py index fbef9b65..5e2105d9 100644 --- a/tinypedal/const.py +++ b/tinypedal/const.py @@ -25,7 +25,7 @@ APP_NAME = "TinyPedal" -VERSION = "2.11.0" +VERSION = "2.11.1" PLATFORM = platform.system() APP_ICON = "images/icon.png" COPYRIGHT = "Copyright (C) 2022-2024 TinyPedal developers" diff --git a/tinypedal/regex_pattern.py b/tinypedal/regex_pattern.py index 85eb2ede..c4d887c1 100644 --- a/tinypedal/regex_pattern.py +++ b/tinypedal/regex_pattern.py @@ -85,6 +85,7 @@ "decimal_places|" "display_margin|" "display_size|" + "draw_order_index|" "font_size|" "icon_size|" "inner_gap|" diff --git a/tinypedal/template/setting_widget.py b/tinypedal/template/setting_widget.py index 4b8c3c7c..c8c1a0a5 100644 --- a/tinypedal/template/setting_widget.py +++ b/tinypedal/template/setting_widget.py @@ -1600,6 +1600,12 @@ "reference_line_5_offset": 0, "reference_line_5_width": 0, "reference_line_5_color": "#666666", + "draw_order_index_throttle": 2, + "draw_order_index_brake": 1, + "draw_order_index_clutch": 5, + "draw_order_index_ffb": 6, + "draw_order_index_wheel_lock": 4, + "draw_order_index_wheel_slip": 3, }, "tyre_carcass": { "enable": True, diff --git a/tinypedal/widget/trailing.py b/tinypedal/widget/trailing.py index 90e46dde..f8f08de7 100644 --- a/tinypedal/widget/trailing.py +++ b/tinypedal/widget/trailing.py @@ -57,6 +57,7 @@ def __init__(self, config): self.pedal_max_range = self.display_height self.area_width = self.display_width self.area_height = self.display_height + self.margin * 2 + self.draw_queue = self.config_draw_order() # Config canvas self.resize(self.area_width, self.area_height) @@ -223,18 +224,9 @@ def draw_plot_section(self): painter.setBrush(Qt.NoBrush) self.pen.setStyle(Qt.SolidLine) - if self.wcfg["show_ffb"]: - self.draw_line(painter, "ffb") - if self.wcfg["show_clutch"]: - self.draw_line(painter, "clutch") - if self.wcfg["show_wheel_lock"]: - self.draw_line(painter, "wheel_lock") - if self.wcfg["show_brake"]: - self.draw_line(painter, "brake") - if self.wcfg["show_wheel_slip"]: - self.draw_line(painter, "wheel_slip") - if self.wcfg["show_throttle"]: - self.draw_line(painter, "throttle") + for plot_name in self.draw_queue: + if self.wcfg[f"show_{plot_name}"]: + self.draw_line(painter, plot_name) def draw_line(self, painter, suffix): """Draw plot line""" @@ -294,3 +286,15 @@ def set_viewport_orientation(self): x_pos = 0 width = self.area_width return QRect(x_pos, y_pos, width, height) + + def config_draw_order(self): + """Config plot draw order""" + plot_list = ( + (self.wcfg["draw_order_index_throttle"], "throttle"), + (self.wcfg["draw_order_index_brake"], "brake"), + (self.wcfg["draw_order_index_clutch"], "clutch"), + (self.wcfg["draw_order_index_ffb"], "ffb"), + (self.wcfg["draw_order_index_wheel_lock"], "wheel_lock"), + (self.wcfg["draw_order_index_wheel_slip"], "wheel_slip"), + ) + return tuple(zip(*sorted(plot_list, reverse=True)))[1]