Conversation
Add support for setting a custom font and font size in the LogViewer widget via set_font and _apply_font methods. Ensure that the font is applied when clearing or refreshing the log view. Use `count=False` when adding records through the `refresh()` function to prevent double-counting during re-rendering.
Add `get_monospace_font()` function to select an appropriate monospace font based on the operating system. Set the custom log font and font size for the viewer.
|
Hi Max, |
|
Hi Beat, thanks for your quick reply ! The added The current code that uses QFont.StyleHint to get an available monospace font in lines 135-137 doesn't seem to function as expected, even if changing the StyleHint, the same default font is always used (as seen in your screenshot). This is probably caused by the HTML rendering engine using its own default font and ignoring what was set for the I actually tested different approaches, but setting the stylesheet on the That said, I'm new to a lot of stuff involved here and might definitely miss some things that you are more aware of. Please let me know what you think about my suggested approach and if you see any alternative approaches that could make more sense to set the log font manually. |
This pull request adds font customization for the
LogViewerand ensures consistent monospace font usage across platforms when running theviewer.pytest script.Font customization and consistency:
_fontattribute and new methods (set_font,_apply_font) to theLogViewerclass inlogger.py. The font is applied via a CSS stylesheet to ensure consistent appearance.clearandrefreshmethods inlogger.pyto reapply the font after clearing and to avoid double-counting log records during refresh.Platform-aware monospace font selection:
get_monospace_fontfunction intests/viewer.pyto select the best available monospace font for the current operating system, improving log readability and consistency.mainfunction intests/viewer.pyto use the new font selection helper and apply the chosen font to the log viewer at startup.