And in GenList() I added ,"battery" to the list in the for-loop.
Also, I entered the function self.BatteryLevel() in Init() before the line self.GenList().
Thanks, this looks like a very useful mod, but for some reason it didn’t work for me.
I’m not very familiar with python, so I have a question where the function definition should go? I’ve tried adding it to the end of the file and inside the AboutPage class and both times I was getting stuck on the “loading” screen unless I removed the BatteryLevel function. Just removing “battery” from for-loop and commenting out self.BatteryLevel() didn’t help, so I guess that it’s something within the function itself that was causing my problem
In the file there are the functions calculating or getting the data at first. So, I put the BatteryLevel from above between the OsImageVersion function and the GenList function.
In the GenListfunction I added the “battery”-string in this list:
for i,u in enumerate( ["processor","armcores","cpuscalemhz","features","memory","uname","launcher_ver","os_image_ver","battery"] )
At first I had it at the end like in the line above but I changed it after “cpuscalemhz” to see it without scrolling in the About section.
But to get it working the function BatteryLevel has to be called, so the _AList is filled with the battery data. This is done in the Init function. I put it between these:
The function BatteryLevel to generate the output for the About screen.
Call it in Init.
Add the “battery” string in GenList to show it at the place you want.
I hope you will get it work now.
If not, just ask again. No problem.
–
Additional thoughts:
Like everything in the Launcher, you’ve to use “Reload UI” to see changes in the battery level. But after playing a game, the launcher gets reloaded automatically, so it’s useful for me as it is.
And I also added additional notifications to get an info when the battery is full, 80%, 60%, 40% and 20%, additionally to the “low battery” at 10 and 5%.
It took me a while to make it work, in the end all I needed is to pay some attention and not blindly copy your code, as it has 2 typos
Just in case anybody else tries it: battery{"label"] should have opening square bracket instead of curly one (thanks vscode, as nano didn’t highlight this), and self._Alist["battery"] should have a capital L in AList.