Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature - plot graph #371

Merged

Conversation

hicwic
Copy link
Contributor

@hicwic hicwic commented Oct 24, 2023

Hi,

some contribs, hope it's help

All change to your code is backward compatible, and avoid breaking the existing theme. If i miss something let me know, i'll correct it.

  • adding plot graph to draw a list of float (called it histo on sensors_custom) -> direct possibility to draw a fps graph (see photo)
  • added a sensors_custom to illustrate some capabilities
    • using my plot graph
    • using Riva Tuner statistic server to grap FPS (my GPU doesn't have FPS from lhm)
    • grabing CPU fan speed from motherboard chassis
    • grabing GPU fan speed from lhm
  • i tweaked MEMORY to have the possibility to display percentage as text (in your original code, you can only graph and radial) => a created new entry in default theme so it's backward compatible to avoid to break existing theme
  • correction on custom sensors display call, if value = 0 nothing was displayed (catching nan instead)
  • added the possiblity to override minimum size of TEXT display. Backward compatible.
  • you can find a theme builded on top of that (see screenshot/preview attached). Call Cyberdeck.

preview

photo

@orzel
Copy link

orzel commented Nov 27, 2023

I would love at least the graph feature to me merged :-)

@majormer
Copy link
Contributor

Love the concept here. I was about to do a pull request for adding vRAM Total and vRAM % (TEXT for both) sensors to the themes. One thing I noticed, however, is that you said you are putting in RAM % as text, and I think that is already there from a previous pull request of mine that was merged a while back:

In theme currently:

PERCENT_TEXT: SHOW: True SHOW_UNIT: True X: 0 Y: 232 FONT: jetbrains-mono/JetBrainsMono-Bold.ttf FONT_SIZE: 20 FONT_COLOR: 255, 0, 0 # BACKGROUND_COLOR: 132, 154, 165 BACKGROUND_IMAGE: background.png

And from stats.py:

`class Memory:
@staticmethod
def stats():
memory_stats_theme_data = config.THEME_DATA['STATS']['MEMORY']

    swap_percent = sensors.Memory.swap_percent()
    display_themed_progress_bar(memory_stats_theme_data['SWAP']['GRAPH'], swap_percent)
    display_themed_radial_bar(
        theme_data=memory_stats_theme_data['SWAP']['RADIAL'],
        value=int(swap_percent),
        min_size=3,
        unit="%"
    )

    virtual_percent = sensors.Memory.virtual_percent()
    display_themed_progress_bar(memory_stats_theme_data['VIRTUAL']['GRAPH'], virtual_percent)
    display_themed_radial_bar(
        theme_data=memory_stats_theme_data['VIRTUAL']['RADIAL'],
        value=int(virtual_percent),
        min_size=3,
        unit="%"
    )

    display_themed_value(
        theme_data=memory_stats_theme_data['VIRTUAL']['PERCENT_TEXT'],
        value=int(virtual_percent),
        min_size=3,
        unit="%"
    )

    display_themed_value(
        theme_data=memory_stats_theme_data['VIRTUAL']['USED'],
        value=int(sensors.Memory.virtual_used() / 1000000),
        min_size=5,
        unit=" M"
    )

    display_themed_value(
        theme_data=memory_stats_theme_data['VIRTUAL']['FREE'],
        value=int(sensors.Memory.virtual_free() / 1000000),
        min_size=5,
        unit=" M"
    )

    display_themed_value(
        theme_data=memory_stats_theme_data['VIRTUAL']['TOTAL'],
        value=int((sensors.Memory.virtual_free() + sensors.Memory.virtual_used()) / 1000000),
        min_size=5,
        unit=" M"
    )`

@majormer
Copy link
Contributor

majormer commented Jan 16, 2024

Correction, my pull request previously added total RAM, not the %. % was in there a while ago, I think.

@hicwic
Copy link
Contributor Author

hicwic commented Jan 16, 2024

I added it for gpu RAM.
I think we are confused by virtual memory and video memory, we call both VRAM :)

Anyway I don't know if my PR will be merged one day ;)

@mathoudebine mathoudebine changed the base branch from main to hicwic/feature/plot-graph January 28, 2024 12:21
@mathoudebine
Copy link
Owner

Hi @hicwic I'm merging your PR on a branch to fix conflicts that happened while it was open. I will also move your new sensors from sensors_custom to the official sensors libraries. I will create a PR when it is done for you to review!

@mathoudebine mathoudebine merged commit 4468e79 into mathoudebine:hicwic/feature/plot-graph Jan 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants