summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2021-06-06 11:30:31 +0100
committerCaolán McNamara <caolanm@redhat.com>2021-06-06 21:36:49 +0200
commite2e89bb4187e08c4b6052f535d80886e198051c8 (patch)
tree2d9e19b743e703eace7588dd83b7f27ad0cc0de0 /bin
parent3f59f4a7e667b571640572f9316216ec73aeca7d (diff)
enforce indicator consistency
so there is either a standard indicator shown or one of a small subset of named icons a) adds an indicator to show the MenuButton provides a dropdown to the spelling dialog when there are multiple user dictionaries the word could be added to b) use open-menu-symbolic instead of gear icon for the sidebar menu Change-Id: If4f0842fb0f805dde45e375061f23d2aaea0990c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116757 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'bin')
-rwxr-xr-xbin/ui-rules-enforcer.py33
1 files changed, 33 insertions, 0 deletions
diff --git a/bin/ui-rules-enforcer.py b/bin/ui-rules-enforcer.py
index dfffe79ce7cd..bc3561bab1e1 100755
--- a/bin/ui-rules-enforcer.py
+++ b/bin/ui-rules-enforcer.py
@@ -222,6 +222,38 @@ def remove_label_fill(current):
if label_fill != None:
current.remove(label_fill)
+def enforce_menubutton_indicator_consistency(current):
+ draw_indicator = None
+ image = None
+ ismenubutton = current.get('class') == "GtkMenuButton"
+ insertpos = 0
+ for child in current:
+ enforce_menubutton_indicator_consistency(child)
+ if not ismenubutton:
+ continue
+ if child.tag == "property":
+ insertpos = insertpos + 1;
+ attributes = child.attrib
+ if attributes.get("name") == "draw_indicator" or attributes.get("name") == "draw-indicator":
+ draw_indicator = child
+ elif attributes.get("name") == "image":
+ image = child
+
+ if ismenubutton:
+ if draw_indicator == None:
+ if image == None:
+ # if there is no draw indicator and no image there should be a draw indicator
+ draw_indicator = etree.Element("property")
+ attributes = draw_indicator.attrib
+ attributes["name"] = "draw-indicator"
+ draw_indicator.text = "True"
+ current.insert(insertpos, draw_indicator)
+ else:
+ # if there is no draw indicator but there is an image that image should be open-menu-symbolic or x-office-calendar
+ for status_elem in tree.xpath("/interface/object[@id='" + image.text + "']/property[@name='icon_name' or @name='icon-name']"):
+ if status_elem.text != 'x-office-calendar':
+ status_elem.text = "open-menu-symbolic"
+
with open(sys.argv[1], encoding="utf-8") as f:
header = f.readline()
f.seek(0)
@@ -244,6 +276,7 @@ replace_image_stock(root)
remove_check_button_align(root)
remove_track_visited_links(root)
remove_label_fill(root)
+enforce_menubutton_indicator_consistency(root)
with open(sys.argv[1], 'wb') as o:
# without encoding='unicode' (and the matching encode("utf8")) we get &#XXXX replacements for non-ascii characters