NicklasVraa / Color-manager

Recolor icon packs, themes, wallpapers and assets with a few clicks or lines of code.
GNU Affero General Public License v3.0
500 stars 7 forks source link

Error when running the script #14

Open astrocaat opened 3 months ago

astrocaat commented 3 months ago

I'm trying adding backdrops to an icon theme I have installed. But when running the following script:

from color_manager import utils

src      = "/usr/share/icons/Sevi/apps/scalable"
name     = "testDest"
dest     = "~/Downloads"
color    = "#000000" # Optional - Defaults to black.
padding  = 0   # Optional - Between backdrop and edge.
rounding = 0.5 # Optional - Between 0 and 1, i.e. rectangle and ellipse.

utils.add_backdrop(src, dest, name, color, padding, rounding)

I get the following error in the console:

/home/user/Downloads/testDest/index.theme Changing svgs : 0%| | 0/994 [00:00<?, ?file/s] Changing svgs : 0%| | 0/994 [00:00<?, ?file/s] Traceback (most recent call last): File "/home/user/Development/Color-manager/script_icon.py", line 10, in <module> utils.add_backdrop(src, dest, name, color, padding, rounding) File "/home/user/Development/Color-manager/color_manager/utils.py", line 603, in add_backdrop width = int(re.search(r'<svg.*width=\"(\d*)\"', svg).group(1)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ AttributeError: 'NoneType' object has no attribute 'group'

ItsTerm1n4l commented 3 months ago

does the gtk frontend work?

astrocaat commented 3 months ago

yes, the frontend and its features work but it doesn't have the backdrop one so I can't test that.

Anyway the problem lies in the regex expression in re.search(). I managed to make it work by tinkering a bit with it, but I just adjusted it to my use case by understanding the syntax of my svg files.

I'm not that versed in regex exps to understand what the actual problem was though.