d4nj1 / TLPUI

A GTK user interface for TLP written in Python
GNU General Public License v2.0
1.08k stars 83 forks source link

Error in css.py. Item 0: Must be number, not str #147

Closed jrequejo closed 3 months ago

jrequejo commented 4 months ago

Hi, Upon running python3 -m tlpui I get the following error:

Traceback (most recent call last): File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main return _run_code(code, main_globals, None, File "/usr/lib/python3.10/runpy.py", line 86, in _run_code exec(code, run_globals) File "/home/jri/TLPUI/tlpui/main.py", line 16, in get_css_provider(), File "/home/jri/TLPUI/tlpui/css.py", line 13, in get_css_provider cssprovider.load_from_data(cssdata) TypeError: Item 0: Must be number, not str

TLP is version 1.6 up and running and python is version 3.10.12 --- TLP 1.6.1 --------------------------------------------

+++ System Info System = HP SBKPF HP EliteBook 640 14 inch G9 Notebook PC BIOS = U75 Ver. 01.09.02 EC Firmware = 7.103 OS Release = Ubuntu 22.04.4 LTS Kernel = 6.5.0-26-generic #26~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue Mar 12 10:22:43 UTC 2 x86_64 /proc/cmdline = BOOT_IMAGE=/boot/vmlinuz-6.5.0-26-generic root=UUID=a4f858cd-8fa1-4201-8679-6cf679f9de51 ro quiet splash vt.handoff=7 Init system = systemd v249 (249.11-0ubuntu3.12) Boot mode = UEFI Suspend mode = [s2idle] deep

+++ TLP Status State = enabled RDW state = enabled Last run = 14:22:21, 13 sec(s) ago Mode = battery Power source = battery

What can the reason be? Thanks

d4nj1 commented 4 months ago

Hi, after looking quickly into it it seems there have been changes since GTK 4.12 which deprecate some CSSProvider methods, see https://docs.gtk.org/gtk4/method.CssProvider.load_from_data.html

I will test and add a fix for this the next days. If you want you can go ahead and change https://github.com/d4nj1/TLPUI/blob/master/tlpui/css.py#L13

from cssprovider.load_from_data(cssdata) to cssprovider.load_from_data(cssdata.encode()) and see if it works for you then. Feedback would be apreciated.

Thanks for reporting

d4nj1 commented 3 months ago

Fixed in https://github.com/d4nj1/TLPUI/releases/tag/tlpui-1.6.5