summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorJulien Nabet <serval2412@yahoo.fr>2021-09-22 20:54:26 +0200
committerCaolán McNamara <caolanm@redhat.com>2021-09-23 09:55:34 +0200
commit9f8ec7fb5751e3e120d0e09466b006085cea13fe (patch)
tree5a99510191360e94eb456a978f748822a45dfc43 /bin
parent9bf1d13ce76520a032b7986a3d9a31a3a6a4220e (diff)
Related tdf#144618: add check in bin/ui-rules-enforcer.py
+ fix vcl/qa/cppunit/builder/demo.ui Change-Id: I556cf99687f138e2d9667dc742dd44cafe7b1a02 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122488 Tested-by: Jenkins Tested-by: Caolán McNamara <caolanm@redhat.com> Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'bin')
-rwxr-xr-xbin/ui-rules-enforcer.py40
1 files changed, 40 insertions, 0 deletions
diff --git a/bin/ui-rules-enforcer.py b/bin/ui-rules-enforcer.py
index ef73541958c8..1a7c814eb52a 100755
--- a/bin/ui-rules-enforcer.py
+++ b/bin/ui-rules-enforcer.py
@@ -388,6 +388,44 @@ def enforce_active_in_group_consistency(current):
active.text = "True"
current.insert(insertpos, active)
+def enforce_entry_text_column_id_column_for_gtkcombobox(current):
+ entrytextcolumn = None
+ idcolumn = None
+ isgtkcombobox = current.get('class') == "GtkComboBox"
+ insertpos = 0
+ for child in current:
+ enforce_entry_text_column_id_column_for_gtkcombobox(child)
+ if not isgtkcombobox:
+ continue
+ if child.tag == "property":
+ insertpos = insertpos + 1;
+ attributes = child.attrib
+ if attributes.get("name") == "entry_text_column":
+ entrytextcolumn = child
+ if attributes.get("name") == "id_column":
+ idcolumn = child
+
+ if isgtkcombobox:
+ if entrytextcolumn != None and entrytextcolumn.text != "0":
+ raise Exception(sys.argv[1] + ': non-standard entry_text_column value', entrytextcolumn.text)
+ if idcolumn != None and idcolumn.text != "1":
+ raise Exception(sys.argv[1] + ': non-standard id_column value', idcolumn.text)
+ if entrytextcolumn == None:
+ # if there is no entry_text_column, create one
+ entrytextcolumn = etree.Element("property")
+ attributes = entrytextcolumn.attrib
+ attributes["name"] = "entry_text_column"
+ entrytextcolumn.text = "0"
+ current.insert(insertpos, entrytextcolumn)
+ insertpos = insertpos + 1;
+ if idcolumn == None:
+ # if there is no id_column, create one
+ idcolumn = etree.Element("property")
+ attributes = idcolumn.attrib
+ attributes["name"] = "id_column"
+ idcolumn.text = "1"
+ current.insert(insertpos, idcolumn)
+
with open(sys.argv[1], encoding="utf-8") as f:
header = f.readline()
f.seek(0)
@@ -417,9 +455,11 @@ remove_expander_label_fill(root)
remove_expander_spacing(root)
enforce_menubutton_indicator_consistency(root)
enforce_active_in_group_consistency(root)
+enforce_entry_text_column_id_column_for_gtkcombobox(root)
remove_double_buffered(root)
remove_skip_pager_hint(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
# which we don't want to see changed in the output