Bug 450745

Summary: System monitor widgets wont load selfmade presets correctly
Product: [Applications] plasma-systemmonitor Reporter: Akseli Lahtinen <akselmo>
Component: generalAssignee: KSysGuard Developers <ksysguard-bugs>
Status: RESOLVED FIXED    
Severity: normal CC: ahiemstra, nate, plasma-bugs
Priority: NOR    
Version: 5.24.2   
Target Milestone: ---   
Platform: Kubuntu   
OS: Linux   
Latest Commit: Version Fixed In: 5.24.6

Description Akseli Lahtinen 2022-02-23 11:27:59 UTC
SUMMARY
I've made my own widget presets in the System Monitor app for GPU and CPU temperatures. 
Sending the widget directly from System Monitor works fine. 

However, loading preset through the System Monitor Sensor widget doesn't load it properly. For example instead of getting the GPU temperature line chart, i get an empty piechart.


STEPS TO REPRODUCE
1. Create a CPU temperature linechart preset with System Monitor  app
2. Add System Monitor Sensor widget to desktop
3. Load the CPU Temperature preset in the widget settings
4. Widget wont load correctly

This also fails if you try to directly load the preset through the Add Widget menu.

OBSERVED RESULT

Widget fails to load and shows an empty pie chart instead of the created linechart preset. 

EXPECTED RESULT

Widget would load the correct preset.

SOFTWARE/OS VERSIONS
Operating System: Kubuntu 21.10
KDE Plasma Version: 5.24.2
KDE Frameworks Version: 5.91.0
Qt Version: 5.15.2
Kernel Version: 5.13.0-30-generic (64-bit)
Graphics Platform: X11
Processors: 12 × AMD Ryzen 5 3600 6-Core Processor
Memory: 15,5 GiB of RAM
Graphics Processor: AMD Radeon ™ RX 480 Graphics

ADDITIONAL INFORMATION

I have checked the preset `faceproperties` file in the `~/.local/share/plasma/plasmoids/org.kde.plasma.systemmonitor.cputemperature/contents` folder and to me it looks correct, so System Monitor should be saving the preset correctly at least.

Here's the preset I used

```
[Config]
highPrioritySensorIds=["cpu/cpu0/temperature"]
lowPrioritySensorIds=[]
totalSensors=["cpu/cpu0/temperature"]

[FaceConfig]
historyAmount=60
lineChartFillOpacity=10
lineChartSmooth=true
lineChartStacked=false
rangeAutoX=false
rangeAutoY=true
rangeFromX=0
rangeFromY=0
rangeFromYMultiplier=1
rangeFromYUnit=-1
rangeToX=50
rangeToY=100
rangeToYMultiplier=1
rangeToYUnit=-1
showGridLines=true
showLegend=true
showYAxisLabels=true

[SensorColors]
cpu/cpu0/temperature=122,66,3
```
Comment 1 Akseli Lahtinen 2022-02-23 11:29:37 UTC
To add, I also use the kubuntu backports ppa.
Comment 2 Arjen Hiemstra 2022-04-28 14:15:58 UTC
Yeah I can reproduce this. I wonder if it's more fallout from the desktop-to-json conversion...
Comment 3 Arjen Hiemstra 2022-05-11 09:07:04 UTC
Git commit 05866a594198d8c76814d8cd4eb3e83cc9123c8d by Arjen Hiemstra.
Committed on 09/05/2022 at 17:05.
Pushed by ahiemstra into branch 'master'.

Faces: Write preset faceproperties to the right location

When loading presets we expect the faceproperties file to be located in
"contents/config/" but when writing we are placing it in "contents/"
which means that custom presets are not loaded properly.

M  +2    -2    faces/SensorFaceController.cpp

https://invent.kde.org/plasma/libksysguard/commit/05866a594198d8c76814d8cd4eb3e83cc9123c8d
Comment 4 Arjen Hiemstra 2022-05-11 09:07:41 UTC
Git commit b94b0e11f9c0f718f109f37dad8a889301f3a59a by Arjen Hiemstra.
Committed on 11/05/2022 at 09:07.
Pushed by ahiemstra into branch 'Plasma/5.24'.

Faces: Write preset faceproperties to the right location

When loading presets we expect the faceproperties file to be located in
"contents/config/" but when writing we are placing it in "contents/"
which means that custom presets are not loaded properly.


(cherry picked from commit 05866a594198d8c76814d8cd4eb3e83cc9123c8d)

M  +2    -2    faces/SensorFaceController.cpp

https://invent.kde.org/plasma/libksysguard/commit/b94b0e11f9c0f718f109f37dad8a889301f3a59a
Comment 5 Arjen Hiemstra 2022-05-11 09:28:11 UTC
Note that unfortunately the above commits don't fix presets that were exported previously - we actually did not write the correct thing. If you have presets that you want to preserve, you will need to find them in "~/.local/share/plasma/plasmoids/org.kde.plasma.systemmonitor.*". Those directories contain a "contents" directory that contains a single file "faceproperties". This needs to be moved to a "config" subdirectory in the contents directory and then the preset should start working.
Comment 6 Akseli Lahtinen 2022-05-12 13:54:47 UTC
(In reply to Arjen Hiemstra from comment #5)
> Note that unfortunately the above commits don't fix presets that were
> exported previously - we actually did not write the correct thing. If you
> have presets that you want to preserve, you will need to find them in
> "~/.local/share/plasma/plasmoids/org.kde.plasma.systemmonitor.*". Those
> directories contain a "contents" directory that contains a single file
> "faceproperties". This needs to be moved to a "config" subdirectory in the
> contents directory and then the preset should start working.

Tested it, can confirm this works