From a3b95e65a2f543cab44ca4aa3943ddfcc19d7e60 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Mon, 14 Sep 2020 14:05:12 +0100 Subject: [PATCH] Replace once only --- theme.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/theme.py b/theme.py index 50c259a20..21262190b 100644 --- a/theme.py +++ b/theme.py @@ -78,7 +78,10 @@ def setCSSparam(css: str, param: str, value: str) -> str: searchStr = '--' + param + ':' if searchStr not in css: return css - s = css.split(searchStr) + if onceOnly: + s = css.split(searchStr, 1) + else: + s = css.split(searchStr) newcss = '' for sectionStr in s: if not newcss: @@ -92,8 +95,6 @@ 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()