diff options
author | Caolán McNamara <caolanm@redhat.com> | 2021-11-14 16:43:40 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2021-11-15 12:35:08 +0100 |
commit | 90705b67729c849acc7cf196fffa8a2d3c86dc13 (patch) | |
tree | a3a417f8b6f02d00fe921ea55d9f4c2b6eae64a0 /bin/ui-rules-enforcer.py | |
parent | 2a8506c2f20f18c948fb4dc5beb42b1010ad6999 (diff) |
add a rule to enforce not sharing adjustments between widgets
Change-Id: I44e9548c41de2ea4816d5b87d7491ad06a46f111
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125204
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'bin/ui-rules-enforcer.py')
-rwxr-xr-x | bin/ui-rules-enforcer.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/bin/ui-rules-enforcer.py b/bin/ui-rules-enforcer.py index fe1709bf36da..7c20ee0a6db7 100755 --- a/bin/ui-rules-enforcer.py +++ b/bin/ui-rules-enforcer.py @@ -513,6 +513,16 @@ def enforce_button_always_show_image(current): else: always_show_image.text = "True" +def enforce_noshared_adjustments(current, adjustments): + for child in current: + enforce_noshared_adjustments(child, adjustments) + if child.tag == "property": + attributes = child.attrib + if attributes.get("name") == "adjustment": + if child.text in adjustments: + raise Exception(sys.argv[1] + ': adjustment used more than once', child.text) + adjustments.add(child.text) + with open(sys.argv[1], encoding="utf-8") as f: header = f.readline() f.seek(0) @@ -549,6 +559,7 @@ remove_skip_pager_hint(root) remove_toolbutton_focus(root) enforce_toolbar_can_focus(root) enforce_button_always_show_image(root) +enforce_noshared_adjustments(root, set()) with open(sys.argv[1], 'wb') as o: # without encoding='unicode' (and the matching encode("utf8")) we get &#XXXX replacements for non-ascii characters |