From c07a8192f92d4ca9c1c42788c5b3b6b0b7e26469 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Mon, 14 Sep 2020 13:58:24 +0100 Subject: [PATCH] Add flag to replace once only --- theme.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/theme.py b/theme.py index 4c157c1b5..50c259a20 100644 --- a/theme.py +++ b/theme.py @@ -67,9 +67,11 @@ def setCSSparam(css: str, param: str, value: str) -> str: if param.startswith('rgba('): return css.replace(param, value) # if the parameter begins with * then don't prepend -- + onceOnly = False if param.startswith('*'): if param.startswith('**'): - searchStr = param.replace('**', '', 1) + ':' + onceOnly = True + searchStr = param.replace('**', '') + ':' else: searchStr = param.replace('*', '') + ':' else: @@ -90,6 +92,8 @@ def setCSSparam(css: str, param: str, value: str) -> str: searchStr + ' ' + value + ';' + sectionStr.split(';', 1)[1] else: newcss += searchStr + ' ' + sectionStr + if onceOnly: + break return newcss.strip()