s-victor / TinyPedal

Free and Open Source telemetry overlay application for racing simulation
GNU General Public License v3.0
75 stars 8 forks source link

[Enhancement] Little tweak on driver name #27

Closed srlemke closed 1 year ago

srlemke commented 1 year ago

Hello! It's me again to annoy :)

Screenshot_2023-05-27_01-01-32

I think the default 'print' of the driver name when the option to also show the car name becomes a little overwhelming (a lot of chars packed together), in order to improve that I did that little tweak in the code and the result is in the screenshot above, do you think that could be implemented?

I'm not creating a pull request because I do not really develop in python as you will see in the diff bellow:

diff --git a/tinypedal/widget/relative.py b/tinypedal/widget/relative.py
index 90ab8b1..8512ed5 100644
--- a/tinypedal/widget/relative.py
+++ b/tinypedal/widget/relative.py
@@ -21,7 +21,6 @@ Relative Widget
 """

 import random
-
 from PySide2.QtCore import Qt, Slot
 from PySide2.QtGui import QFont, QFontMetrics
 from PySide2.QtWidgets import (
@@ -456,7 +455,7 @@ class Draw(Widget):
         elif self.wcfg["driver_name_mode"] == 1:
             text = name[1]  # vehicle name
         elif name[1]:
-            text = f"{name[0]} [{name[1]}]"  # combined name
+            text = f"{name[0] : <25} {name[1]}"  # combined name
         else:
             text = ""
         if self.wcfg["driver_name_uppercase"]:

But I think you will get the idea :)

(the hard-coded '25' is the chars for driver name only, so currently in the settings I have 55. (maybe when the user selects driver name ' 2' - combined, he could also have the option to set the 'car name length' ) and something like this:

thanks!

s-victor commented 1 year ago

Hi, great suggestion. I'll add your code shortly. Also if you don't mind, I would add your name to the contributor list, as you have helped massively on various stuff so far, lemme know, thanks.

Edit: after some thoughts, I decide to add a new vehicle name column, I think this is better in the long run and keep the setting more easier for user to understand.

Edit: here is the changes https://github.com/s-victor/TinyPedal/commit/a32f5c8bfd98ebc4872c677347c9e8f43510a9d6

srlemke commented 1 year ago

Hello, you certainly can add me to the contributor list if you believe it's a fit.

The new implementation is really great! There seems to a small bug with the option:

Font Color Vehicle name

As changing the color in the GUI does not apply on the widget. I did not mind going into the code to find the exact issue as I believe that is probably trivial fix.

image

s-victor commented 1 year ago

Hi, no problem.

The Font Color XXXX is mostly a placeholder, because this font color from all non-player vehicles is overridden by show_lap_difference option, which overrides this color with font_color_same_lap, font_color_laps_ahead, font_color_laps_behind options.

srlemke commented 1 year ago

This seems to be fully implemented them, thanks!